From 21375f667b65809efe834b084df82c793672ba7d Mon Sep 17 00:00:00 2001 From: Philip Smart Date: Tue, 24 Mar 2026 22:22:37 +0000 Subject: [PATCH] Initial git setup --- .gitattributes | 7 + .gitignore | 156 + build_tzpuPico.sh | 125 + get_and_build_sdk.sh | 53 + picoZ80.h.tmpl | 99 + projects/Z80/.editorconfig | 18 + projects/Z80/.github/FUNDING.yml | 5 + projects/Z80/.github/pull_request_template.md | 11 + .../workflows/build-and-test-library.yml | 95 + .../.github/workflows/build-documentation.yml | 70 + projects/Z80/.gitignore | 5 + projects/Z80/.vimrc | 4 + projects/Z80/API/Z80.h | 904 +++ projects/Z80/API/Z80.h.bak | 904 +++ projects/Z80/AUTHORS | 6 + projects/Z80/CITATION.cff | 22 + projects/Z80/CMake/FindBreathe.cmake | 31 + projects/Z80/CMake/FindSphinx.cmake | 31 + projects/Z80/CMake/FindZeta.cmake | 108 + projects/Z80/CMakeLists.txt | 435 ++ projects/Z80/COPYING | 674 +++ projects/Z80/COPYING.LESSER | 165 + projects/Z80/HISTORY | 111 + projects/Z80/README | 339 ++ projects/Z80/README.md | 881 +++ projects/Z80/THANKS | 203 + projects/Z80/documentation/APIReference.rst | 181 + projects/Z80/documentation/CMakeLists.txt | 128 + projects/Z80/documentation/Installation.rst | 223 + projects/Z80/documentation/Integration.rst | 105 + projects/Z80/documentation/Introduction.rst | 92 + projects/Z80/documentation/License.rst | 11 + projects/Z80/documentation/Makefile | 20 + projects/Z80/documentation/Tests.rst | 3 + projects/Z80/documentation/Thanks.rst | 532 ++ projects/Z80/documentation/Usage.rst | 131 + projects/Z80/documentation/VersionHistory.rst | 75 + projects/Z80/documentation/conf.py | 56 + projects/Z80/documentation/index.rst | 34 + projects/Z80/documentation/make.bat | 35 + projects/Z80/file_id.diz | 5 + projects/Z80/sources/Z80.c | 2766 +++++++++ projects/Z80/sources/Z80.c.bak | 2766 +++++++++ projects/Z80/sources/Z80.pas | 287 + projects/Z80/sources/Z80.rc.in | 34 + projects/Z80/sources/test-Z80.c | 1012 ++++ projects/Z80/support/Z80.pc.in | 13 + projects/Z80/support/Z80Config.cmake.in | 66 + projects/Z80/support/firmware.sha3-512 | 1 + projects/Z80/support/software.sha3-512 | 10 + projects/Zeta/.editorconfig | 15 + projects/Zeta/.github/FUNDING.yml | 5 + .../Zeta/.github/pull_request_template.md | 11 + projects/Zeta/.gitignore | 5 + projects/Zeta/.vimrc | 4 + projects/Zeta/API/Z/classes/Empty.hpp | 14 + projects/Zeta/API/Z/classes/Functor.hpp | 185 + .../Zeta/API/Z/classes/InitializerList.hpp | 45 + projects/Zeta/API/Z/classes/Iterator.hpp | 38 + .../Zeta/API/Z/classes/MemberFunction.hpp | 85 + projects/Zeta/API/Z/classes/NaT.hpp | 30 + .../API/Z/classes/ObjectMemberFunction.hpp | 148 + .../Zeta/API/Z/classes/ObjectSelector.hpp | 94 + .../Z/classes/OpaqueMemberFunctionPointer.hpp | 30 + projects/Zeta/API/Z/classes/Pair.hpp | 48 + projects/Zeta/API/Z/classes/Range.hpp | 135 + projects/Zeta/API/Z/classes/Rectangle.hpp | 736 +++ projects/Zeta/API/Z/classes/Reference.hpp | 39 + projects/Zeta/API/Z/classes/Selector.hpp | 128 + projects/Zeta/API/Z/classes/Shared.hpp | 177 + projects/Zeta/API/Z/classes/SizedString.hpp | 55 + projects/Zeta/API/Z/classes/Span.hpp | 78 + projects/Zeta/API/Z/classes/Strid.hpp | 60 + projects/Zeta/API/Z/classes/StringView.hpp | 112 + projects/Zeta/API/Z/classes/TripleBuffer.hpp | 107 + projects/Zeta/API/Z/classes/Tuple.hpp | 143 + projects/Zeta/API/Z/classes/XY.hpp | 501 ++ projects/Zeta/API/Z/classes/XYZ.hpp | 522 ++ projects/Zeta/API/Z/constants/boolean.h | 32 + projects/Zeta/API/Z/constants/build.hpp | 47 + projects/Zeta/API/Z/constants/numbers.h | 968 ++++ projects/Zeta/API/Z/constants/pointer.h | 29 + projects/Zeta/API/Z/formats/archive/TAR.h | 59 + .../Zeta/API/Z/formats/character_set/ASCII.h | 141 + .../API/Z/formats/character_set/DOS_CP437.h | 160 + .../API/Z/formats/character_set/DOS_CP737.h | 160 + .../API/Z/formats/character_set/DOS_CP775.h | 160 + .../API/Z/formats/character_set/DOS_CP850.h | 160 + .../API/Z/formats/character_set/DOS_CP852.h | 160 + .../API/Z/formats/character_set/DOS_CP855.h | 160 + .../API/Z/formats/character_set/DOS_CP857.h | 160 + .../API/Z/formats/character_set/DOS_CP858.h | 160 + .../API/Z/formats/character_set/DOS_CP860.h | 160 + .../API/Z/formats/character_set/DOS_CP861.h | 160 + .../API/Z/formats/character_set/DOS_CP862.h | 160 + .../API/Z/formats/character_set/DOS_CP863.h | 160 + .../API/Z/formats/character_set/DOS_CP864.h | 160 + .../API/Z/formats/character_set/DOS_CP865.h | 160 + .../API/Z/formats/character_set/DOS_CP866.h | 160 + .../API/Z/formats/character_set/DOS_CP869.h | 160 + .../API/Z/formats/character_set/DOS_CP872.h | 160 + .../API/Z/formats/character_set/DOS_CP874.h | 160 + .../Zeta/API/Z/formats/data_model/I16LP32.h | 20 + .../Zeta/API/Z/formats/data_model/ILP32.h | 20 + .../Zeta/API/Z/formats/data_model/ILP64.h | 20 + .../Zeta/API/Z/formats/data_model/IP16L32.h | 20 + .../Zeta/API/Z/formats/data_model/LLP64.h | 20 + projects/Zeta/API/Z/formats/data_model/LP32.h | 20 + projects/Zeta/API/Z/formats/data_model/LP64.h | 20 + .../Zeta/API/Z/formats/data_model/SILP64.h | 20 + .../floating-point/Brain_Floating-Point.h | 27 + .../Zeta/API/Z/formats/floating-point/IBM.h | 27 + .../API/Z/formats/floating-point/IEEE_754.h | 117 + .../Zeta/API/Z/formats/floating-point/x87.h | 27 + projects/Zeta/API/Z/formats/keymap/Mac_OS.h | 285 + projects/Zeta/API/Z/formats/keymap/USB.h | 468 ++ projects/Zeta/API/Z/formats/keymap/Z.h | 142 + .../machine/computer/ZX_Spectrum/+D.h | 46 + .../machine/computer/ZX_Spectrum/ACH.h | 54 + .../machine/computer/ZX_Spectrum/FRZ.h | 68 + .../machine/computer/ZX_Spectrum/PRG.h | 59 + .../machine/computer/ZX_Spectrum/SEM.h | 54 + .../machine/computer/ZX_Spectrum/SIT.h | 40 + .../machine/computer/ZX_Spectrum/SLT.h | 0 .../machine/computer/ZX_Spectrum/SNA.h | 131 + .../machine/computer/ZX_Spectrum/SNP.h | 45 + .../machine/computer/ZX_Spectrum/SNX.h | 72 + .../machine/computer/ZX_Spectrum/SP.h | 85 + .../machine/computer/ZX_Spectrum/Z80.h | 172 + .../machine/computer/ZX_Spectrum/ZLS.h | 44 + .../machine/computer/ZX_Spectrum/ZX-State.h | 683 +++ .../machine/computer/ZX_Spectrum/ZX.h | 70 + .../machine/computer/ZX_Spectrum/ZX82.h | 77 + .../machine/computer/ZX_Spectrum/ZXS.h | 155 + .../storage_medium_image/NES_Game_Pak/TNES.h | 59 + .../storage_medium_image/NES_Game_Pak/UNIF.h | 36 + .../storage_medium_image/NES_Game_Pak/iNES.h | 134 + .../formats/storage_medium_image/audio/TZX.h | 1274 ++++ .../storage_medium_image/audio/Warajevo_TAP.h | 34 + projects/Zeta/API/Z/functions/Objective-C.hpp | 41 + projects/Zeta/API/Z/functions/atomic.h | 651 +++ projects/Zeta/API/Z/functions/bitwise.h | 144 + projects/Zeta/API/Z/functions/buffer.h | 84 + projects/Zeta/API/Z/functions/calendar.h | 36 + projects/Zeta/API/Z/functions/casting.hpp | 58 + projects/Zeta/API/Z/functions/character.h | 85 + projects/Zeta/API/Z/functions/class.hpp | 83 + projects/Zeta/API/Z/functions/hash.hpp | 56 + projects/Zeta/API/Z/functions/math.h | 768 +++ projects/Zeta/API/Z/functions/math.hpp | 124 + projects/Zeta/API/Z/functions/type.hpp | 54 + projects/Zeta/API/Z/functions/unevaluated.hpp | 19 + projects/Zeta/API/Z/hardware/ISA/6502.h | 18 + projects/Zeta/API/Z/hardware/ISA/RISC-V.h | 368 ++ projects/Zeta/API/Z/hardware/ISA/Z80.h | 14 + projects/Zeta/API/Z/hardware/bus/USB.h | 57 + .../Z/hardware/machine/computer/ZX_Spectrum.h | 947 +++ projects/Zeta/API/Z/inspection/C++.h | 76 + .../Zeta/API/Z/inspection/C++/modules/C++03.h | 16 + .../Zeta/API/Z/inspection/C++/modules/C++11.h | 90 + .../Zeta/API/Z/inspection/C++/modules/C++14.h | 27 + .../Zeta/API/Z/inspection/C++/modules/C++17.h | 59 + .../Zeta/API/Z/inspection/C++/modules/C++20.h | 53 + .../Zeta/API/Z/inspection/C++/modules/C++98.h | 20 + projects/Zeta/API/Z/inspection/C.h | 75 + .../Zeta/API/Z/inspection/C/modules/C11.h | 61 + .../Zeta/API/Z/inspection/C/modules/C23.h | 34 + .../Zeta/API/Z/inspection/C/modules/C78.h | 21 + .../Zeta/API/Z/inspection/C/modules/C89.h | 56 + .../Zeta/API/Z/inspection/C/modules/C95.h | 16 + .../Zeta/API/Z/inspection/C/modules/C99.h | 61 + projects/Zeta/API/Z/inspection/ISA.h | 206 + .../Zeta/API/Z/inspection/ISA/detection.h | 281 + projects/Zeta/API/Z/inspection/OS.h | 340 ++ projects/Zeta/API/Z/inspection/OS/detection.h | 364 ++ projects/Zeta/API/Z/inspection/Z.h | 17 + .../Zeta/API/Z/inspection/character_set.h | 83 + projects/Zeta/API/Z/inspection/compiler.h | 297 + .../API/Z/inspection/compiler/completion.h | 1418 +++++ .../API/Z/inspection/compiler/detection.h | 274 + .../API/Z/inspection/compiler/modules/Clang.h | 2618 +++++++++ .../API/Z/inspection/compiler/modules/GCC.h | 1194 ++++ .../API/Z/inspection/compiler/modules/MSVC.h | 921 +++ .../Z/inspection/compiler/modules/TinyCC.h | 197 + .../API/Z/inspection/compiler/modules/cc65.h | 104 + .../Z/inspection/compiler/modules/generic.h | 14 + .../Z/inspection/compiler/modules/template.h | 810 +++ projects/Zeta/API/Z/inspection/data_model.h | 415 ++ .../API/Z/inspection/data_model/deduction.h | 409 ++ .../API/Z/inspection/data_model/detection.h | 48 + .../Zeta/API/Z/inspection/floating-point.h | 334 ++ .../Z/inspection/floating-point/completion.h | 60 + projects/Zeta/API/Z/inspection/language.h | 192 + projects/Zeta/API/Z/inspection/platform.h | 30 + .../API/Z/inspection/platform/detection.h | 98 + projects/Zeta/API/Z/keys/C++.h | 30 + projects/Zeta/API/Z/keys/C.h | 28 + projects/Zeta/API/Z/keys/ISA.h | 102 + projects/Zeta/API/Z/keys/OS.h | 202 + projects/Zeta/API/Z/keys/compiler.h | 193 + projects/Zeta/API/Z/keys/data_model.h | 30 + projects/Zeta/API/Z/keys/endianness.h | 16 + projects/Zeta/API/Z/keys/fundamental.h | 84 + projects/Zeta/API/Z/keys/language.h | 22 + projects/Zeta/API/Z/keys/number.h | 71 + projects/Zeta/API/Z/keys/order.h | 18 + projects/Zeta/API/Z/keys/platform.h | 100 + projects/Zeta/API/Z/macros/T.h | 463 ++ projects/Zeta/API/Z/macros/array.h | 15 + projects/Zeta/API/Z/macros/bit-field.h | 83 + projects/Zeta/API/Z/macros/bitwise.h | 234 + projects/Zeta/API/Z/macros/calendar.h | 18 + projects/Zeta/API/Z/macros/casting.h | 18 + projects/Zeta/API/Z/macros/character.h | 146 + projects/Zeta/API/Z/macros/hash.h | 44 + projects/Zeta/API/Z/macros/iteration.h | 284 + projects/Zeta/API/Z/macros/language.h | 167 + projects/Zeta/API/Z/macros/language.hpp | 74 + projects/Zeta/API/Z/macros/math.h | 32 + projects/Zeta/API/Z/macros/pointer.h | 20 + projects/Zeta/API/Z/macros/structure.h | 32 + projects/Zeta/API/Z/macros/token.h | 367 ++ projects/Zeta/API/Z/macros/variadic.h | 50 + projects/Zeta/API/Z/macros/variadic_control.h | 57 + projects/Zeta/API/Z/macros/variadic_pasting.h | 26 + projects/Zeta/API/Z/macros/version.h | 24 + .../Zeta/API/Z/protocols/network/7/HTTP.h | 101 + projects/Zeta/API/Z/traits/TypeCount.hpp | 48 + projects/Zeta/API/Z/traits/TypeList.hpp | 377 ++ projects/Zeta/API/Z/traits/ValueList.hpp | 32 + projects/Zeta/API/Z/traits/casting.hpp | 40 + projects/Zeta/API/Z/traits/constants.hpp | 21 + projects/Zeta/API/Z/traits/control.hpp | 105 + projects/Zeta/API/Z/traits/math.hpp | 48 + projects/Zeta/API/Z/traits/type.hpp | 4153 +++++++++++++ projects/Zeta/API/Z/types/bitwise.h | 611 ++ projects/Zeta/API/Z/types/bitwise.hpp | 42 + projects/Zeta/API/Z/types/buffer.h | 19 + projects/Zeta/API/Z/types/integral.h | 855 +++ projects/Zeta/API/Z/types/integral.hpp | 219 + projects/Zeta/API/Z/types/pointer.hpp | 23 + projects/Zeta/API/Z/types/real.h | 657 +++ projects/Zeta/API/Z/types/real.hpp | 135 + projects/Zeta/API/Z/version.h | 20 + projects/Zeta/AUTHORS | 5 + projects/Zeta/CMake/FindSphinx.cmake | 31 + projects/Zeta/CMake/FindZeta.cmake | 108 + projects/Zeta/CMakeLists.txt | 142 + projects/Zeta/COPYING | 674 +++ projects/Zeta/COPYING.LESSER | 165 + projects/Zeta/documentation/APIReference.rst | 20 + .../APIReference/Classes/Empty.rst | 0 .../APIReference/Classes/Functor.rst | 0 .../APIReference/Classes/NaT.rst | 0 .../APIReference/Classes/Pair.rst | 0 .../APIReference/Classes/Range.rst | 0 .../APIReference/Classes/Rectangle.rst | 0 .../APIReference/Classes/TripleBuffer.rst | 0 .../APIReference/Classes/Tuple.rst | 0 .../documentation/APIReference/Classes/XY.rst | 0 .../APIReference/Classes/XYZ.rst | 0 .../APIReference/Inspection/CharacterSet.rst | 3 + .../APIReference/Inspection/Compiler.rst | 3 + .../APIReference/Inspection/DataModel.rst | 3 + .../APIReference/Inspection/FloatingPoint.rst | 3 + .../APIReference/Inspection/ISA.rst | 3 + .../APIReference/Inspection/Language.rst | 3 + .../APIReference/Inspection/OS.rst | 3 + .../APIReference/Inspection/Platform.rst | 3 + .../APIReference/Inspection/Z.rst | 3 + projects/Zeta/documentation/CMakeLists.txt | 79 + projects/Zeta/documentation/CodingStyle.rst | 3 + projects/Zeta/documentation/Contributing.rst | 3 + projects/Zeta/documentation/FAQ.rst | 0 projects/Zeta/documentation/Installation.rst | 3 + projects/Zeta/documentation/Integration.rst | 3 + projects/Zeta/documentation/Makefile | 20 + .../Zeta/documentation/NamingConvention.rst | 3 + projects/Zeta/documentation/conf.py | 57 + .../documentation/images/lgplv3-147x51.png | Bin 0 -> 3343 bytes projects/Zeta/documentation/index.rst | 23 + projects/Zeta/documentation/make.bat | 35 + projects/Zeta/support/Zeta.pc.in | 10 + projects/Zeta/support/ZetaConfig.cmake.in | 4 + projects/tzpuPico/.gdbinit.3333 | 43 + projects/tzpuPico/.gdbinit.3334 | 41 + projects/tzpuPico/.gdbinit.bootloader.3333 | 43 + projects/tzpuPico/.gdbinit.bootloader.3334 | 41 + projects/tzpuPico/CMakeLists.txt | 90 + projects/tzpuPico/esp32/CMakeLists.txt | 22 + projects/tzpuPico/esp32/backup_version.sh | 18 + projects/tzpuPico/esp32/build_webfs_gz.sh | 64 + projects/tzpuPico/esp32/copy_to_nas.sh | 22 + projects/tzpuPico/esp32/dependencies.lock | 21 + projects/tzpuPico/esp32/filepack_version.txt | 1 + projects/tzpuPico/esp32/idf.cmake | 63 + projects/tzpuPico/esp32/license.txt | 674 +++ projects/tzpuPico/esp32/main/CMakeLists.txt | 11 + .../tzpuPico/esp32/main/CommandProcessor.cpp | 478 ++ projects/tzpuPico/esp32/main/FSPI.cpp | 354 ++ projects/tzpuPico/esp32/main/IO.cpp | 645 +++ .../tzpuPico/esp32/main/Kconfig.projbuild | 213 + projects/tzpuPico/esp32/main/NVS.cpp | 311 + projects/tzpuPico/esp32/main/SDCard.cpp | 825 +++ projects/tzpuPico/esp32/main/WiFi.cpp | 5123 +++++++++++++++++ projects/tzpuPico/esp32/main/cJSON.c | 3293 +++++++++++ projects/tzpuPico/esp32/main/component.mk | 8 + .../esp32/main/esp_efuse_custom_table.c | 61 + .../esp32/main/esp_efuse_custom_table.csv | 36 + .../tzpuPico/esp32/main/idf_component.yml | 17 + .../esp32/main/include/CommandProcessor.h | 190 + projects/tzpuPico/esp32/main/include/FSPI.h | 174 + projects/tzpuPico/esp32/main/include/IO.h | 152 + projects/tzpuPico/esp32/main/include/NVS.h | 155 + projects/tzpuPico/esp32/main/include/SDCard.h | 171 + projects/tzpuPico/esp32/main/include/WiFi.h | 409 ++ projects/tzpuPico/esp32/main/include/assert.h | 48 + projects/tzpuPico/esp32/main/include/cJSON.h | 306 + .../main/include/esp_efuse_custom_table.h | 28 + .../tzpuPico/esp32/main/include/flash_ram.h | 278 + .../esp32/main/include/ipc_protocol.h | 101 + .../tzpuPico/esp32/main/include/tzpuPico.h | 108 + projects/tzpuPico/esp32/main/include/untar.h | 110 + projects/tzpuPico/esp32/main/tzpuPico.cpp | 774 +++ projects/tzpuPico/esp32/main/untar.c | 493 ++ projects/tzpuPico/esp32/make_filepack.sh | 123 + projects/tzpuPico/esp32/make_release.sh | 20 + projects/tzpuPico/esp32/sdkconfig | 2872 +++++++++ projects/tzpuPico/esp32/targets.cmake | 172 + projects/tzpuPico/esp32/tzpuPico.cmake | 783 +++ .../esp32/tzpuPico_partition_table.csv | 7 + projects/tzpuPico/esp32/tzpuPico_version.txt | 1 + projects/tzpuPico/esp32/update_version.sh | 16 + projects/tzpuPico/esp32/version.txt | 1 + .../esp32/webserver/Trumbowyg-main.zip | Bin 0 -> 1130753 bytes projects/tzpuPico/esp32/webserver/config.htm | 159 + .../tzpuPico/esp32/webserver/css/Undef.css | 305 + .../webserver/css/bootstrap-theme.css.gz | Bin 0 -> 2863 bytes .../webserver/css/bootstrap-theme.css.map.gz | Bin 0 -> 7191 bytes .../webserver/css/bootstrap-theme.min.css.gz | Bin 0 -> 2799 bytes .../css/bootstrap-theme.min.css.map.gz | Bin 0 -> 8189 bytes .../esp32/webserver/css/bootstrap.css.gz | Bin 0 -> 21140 bytes .../esp32/webserver/css/bootstrap.css.map.gz | Bin 0 -> 74669 bytes .../esp32/webserver/css/bootstrap.min.css.gz | Bin 0 -> 19606 bytes .../webserver/css/bootstrap.min.css.map.gz | Bin 0 -> 95428 bytes .../webserver/css/jasny-bootstrap.min.css.gz | Bin 0 -> 3226 bytes .../webserver/css/jquery.edittable.min.css.gz | Bin 0 -> 638 bytes .../tzpuPico/esp32/webserver/css/p6502.css | 305 + .../tzpuPico/esp32/webserver/css/pZ80.css | 464 ++ .../tzpuPico/esp32/webserver/css/sb-admin.css | 159 + .../tzpuPico/esp32/webserver/css/style.css | 253 + .../tzpuPico/esp32/webserver/css/styles.css | 1 + .../esp32/webserver/css/trumbowyg.min.css.gz | Bin 0 -> 3467 bytes projects/tzpuPico/esp32/webserver/favicon.ico | Bin 0 -> 4286 bytes .../tzpuPico/esp32/webserver/filemanager.htm | 159 + .../font-awesome/css/font-awesome.css.gz | Bin 0 -> 7422 bytes .../font-awesome/css/font-awesome.min.css.gz | Bin 0 -> 4031 bytes .../css/font-awesome.min.css.orig | 4 + .../fonts/fontawesome-webfont.ttf.orig | Bin 0 -> 80652 bytes .../fonts/fontawesome-webfont.woff.gz | Bin 0 -> 97938 bytes .../fonts/fontawesome-webfont.woff.orig | Bin 0 -> 44432 bytes projects/tzpuPico/esp32/webserver/index.htm | 312 + .../esp32/webserver/js/140medley.min.js.gz | Bin 0 -> 523 bytes .../tzpuPico/esp32/webserver/js/actions.js | 41 + .../esp32/webserver/js/bootstrap.js.gz | Bin 0 -> 16145 bytes .../esp32/webserver/js/bootstrap.min.js.gz | Bin 0 -> 10953 bytes .../tzpuPico/esp32/webserver/js/common.js | 5 + .../tzpuPico/esp32/webserver/js/editor.js | 215 + .../esp32/webserver/js/filemanager.js | 232 + projects/tzpuPico/esp32/webserver/js/index.js | 106 + .../webserver/js/jasny-bootstrap.min.js.gz | Bin 0 -> 4837 bytes .../esp32/webserver/js/jquery.edittable.js.gz | Bin 0 -> 2571 bytes .../webserver/js/jquery.edittable.min.js.gz | Bin 0 -> 1398 bytes .../esp32/webserver/js/jquery.min.js.gz | Bin 0 -> 33651 bytes .../tzpuPico/esp32/webserver/js/ota-esp32.js | 309 + .../tzpuPico/esp32/webserver/js/ota-rp2350.js | 264 + .../esp32/webserver/js/personality.js | 81 + .../esp32/webserver/js/trumbowyg.min.js.gz | Bin 0 -> 9641 bytes .../tzpuPico/esp32/webserver/js/ui/icons.svg | 1 + .../esp32/webserver/js/wifimanager.js | 189 + .../tzpuPico/esp32/webserver/ota-esp32.htm | 292 + .../tzpuPico/esp32/webserver/ota-rp2350.htm | 287 + .../tzpuPico/esp32/webserver/personality.htm | 308 + .../esp32/webserver/webfs_version.txt | 1 + .../tzpuPico/esp32/webserver/wifimanager.htm | 381 ++ projects/tzpuPico/license.txt | 674 +++ projects/tzpuPico/src/CMakeLists.txt | 76 + projects/tzpuPico/src/ESP.c | 558 ++ projects/tzpuPico/src/FSPI.c | 712 +++ projects/tzpuPico/src/FaultHandlers.c | 229 + projects/tzpuPico/src/Z80CPU.c | 3683 ++++++++++++ projects/tzpuPico/src/cJSON.c | 3293 +++++++++++ projects/tzpuPico/src/drivers/Sharp/MZ-1E05.c | 237 + projects/tzpuPico/src/drivers/Sharp/MZ-1E14.c | 207 + projects/tzpuPico/src/drivers/Sharp/MZ-1E19.c | 290 + projects/tzpuPico/src/drivers/Sharp/MZ-1R12.c | 357 ++ projects/tzpuPico/src/drivers/Sharp/MZ-1R18.c | 174 + projects/tzpuPico/src/drivers/Sharp/MZ700.c | 1057 ++++ projects/tzpuPico/src/drivers/Sharp/QDDrive.c | 913 +++ projects/tzpuPico/src/drivers/Sharp/RFS.c | 977 ++++ projects/tzpuPico/src/drivers/Sharp/TZFS.c | 429 ++ projects/tzpuPico/src/drivers/Sharp/WD1773.c | 1037 ++++ projects/tzpuPico/src/include/ESP.h | 133 + projects/tzpuPico/src/include/FSPI.h | 167 + projects/tzpuPico/src/include/Z80CPU.h | 500 ++ projects/tzpuPico/src/include/cJSON.h | 306 + projects/tzpuPico/src/include/debug.h | 178 + .../src/include/drivers/Sharp/MZ-1E05.h | 63 + .../src/include/drivers/Sharp/MZ-1E14.h | 61 + .../src/include/drivers/Sharp/MZ-1E19.h | 61 + .../src/include/drivers/Sharp/MZ-1R12.h | 69 + .../src/include/drivers/Sharp/MZ-1R18.h | 50 + .../tzpuPico/src/include/drivers/Sharp/MZ.h | 48 + .../src/include/drivers/Sharp/MZ700.h | 92 + .../src/include/drivers/Sharp/QDDrive.h | 181 + .../tzpuPico/src/include/drivers/Sharp/RFS.h | 198 + .../tzpuPico/src/include/drivers/Sharp/TZFS.h | 807 +++ .../src/include/drivers/Sharp/WD1773.h | 244 + projects/tzpuPico/src/include/flash_ram.h | 286 + projects/tzpuPico/src/include/intercore.h | 92 + projects/tzpuPico/src/include/ipc_protocol.h | 101 + projects/tzpuPico/src/include/psram.h | 40 + projects/tzpuPico/src/include/rp2350.h | 101 + projects/tzpuPico/src/include/tusb_config.h | 39 + projects/tzpuPico/src/include/usb_bridge.h | 134 + .../tzpuPico/src/include/usb_descriptors.c | 199 + .../tzpuPico/src/model/BaseZ80/CMakeLists.txt | 97 + projects/tzpuPico/src/model/BaseZ80/main.c | 1758 ++++++ .../model/BaseZ80/main_memmap_partition_1.ld | 342 ++ .../model/BaseZ80/main_memmap_partition_2.ld | 342 ++ .../src/model/BaseZ80/update_version.sh | 19 + .../tzpuPico/src/model/BaseZ80/version.txt | 1 + .../src/model/Bootloader/Bootloader.c | 308 + .../src/model/Bootloader/Bootloader_memmap.ld | 303 + .../src/model/Bootloader/CMakeLists.txt | 59 + .../src/model/Bootloader/update_version.sh | 16 + .../tzpuPico/src/model/Bootloader/version.txt | 1 + projects/tzpuPico/src/model/CMakeLists.txt | 15 + projects/tzpuPico/src/psram.c | 300 + projects/tzpuPico/src/usb_bridge.c | 1600 +++++ projects/tzpuPico/src/usb_descriptor.c | 125 + projects/tzpuPico/src/z80.pio | 468 ++ projects/tzpuPico/tools/MZQDTool.c | 385 ++ projects/tzpuPico/version.txt | 1 + rp2350_tzpu.cfg | 79 + 445 files changed, 103481 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100755 build_tzpuPico.sh create mode 100755 get_and_build_sdk.sh create mode 100644 picoZ80.h.tmpl create mode 100644 projects/Z80/.editorconfig create mode 100644 projects/Z80/.github/FUNDING.yml create mode 100644 projects/Z80/.github/pull_request_template.md create mode 100644 projects/Z80/.github/workflows/build-and-test-library.yml create mode 100644 projects/Z80/.github/workflows/build-documentation.yml create mode 100644 projects/Z80/.gitignore create mode 100644 projects/Z80/.vimrc create mode 100644 projects/Z80/API/Z80.h create mode 100644 projects/Z80/API/Z80.h.bak create mode 100644 projects/Z80/AUTHORS create mode 100644 projects/Z80/CITATION.cff create mode 100644 projects/Z80/CMake/FindBreathe.cmake create mode 100644 projects/Z80/CMake/FindSphinx.cmake create mode 100644 projects/Z80/CMake/FindZeta.cmake create mode 100644 projects/Z80/CMakeLists.txt create mode 100644 projects/Z80/COPYING create mode 100644 projects/Z80/COPYING.LESSER create mode 100644 projects/Z80/HISTORY create mode 100644 projects/Z80/README create mode 100644 projects/Z80/README.md create mode 100644 projects/Z80/THANKS create mode 100644 projects/Z80/documentation/APIReference.rst create mode 100644 projects/Z80/documentation/CMakeLists.txt create mode 100644 projects/Z80/documentation/Installation.rst create mode 100644 projects/Z80/documentation/Integration.rst create mode 100644 projects/Z80/documentation/Introduction.rst create mode 100644 projects/Z80/documentation/License.rst create mode 100644 projects/Z80/documentation/Makefile create mode 100644 projects/Z80/documentation/Tests.rst create mode 100644 projects/Z80/documentation/Thanks.rst create mode 100644 projects/Z80/documentation/Usage.rst create mode 100644 projects/Z80/documentation/VersionHistory.rst create mode 100644 projects/Z80/documentation/conf.py create mode 100644 projects/Z80/documentation/index.rst create mode 100644 projects/Z80/documentation/make.bat create mode 100644 projects/Z80/file_id.diz create mode 100644 projects/Z80/sources/Z80.c create mode 100644 projects/Z80/sources/Z80.c.bak create mode 100644 projects/Z80/sources/Z80.pas create mode 100644 projects/Z80/sources/Z80.rc.in create mode 100644 projects/Z80/sources/test-Z80.c create mode 100644 projects/Z80/support/Z80.pc.in create mode 100644 projects/Z80/support/Z80Config.cmake.in create mode 100644 projects/Z80/support/firmware.sha3-512 create mode 100644 projects/Z80/support/software.sha3-512 create mode 100644 projects/Zeta/.editorconfig create mode 100644 projects/Zeta/.github/FUNDING.yml create mode 100644 projects/Zeta/.github/pull_request_template.md create mode 100644 projects/Zeta/.gitignore create mode 100644 projects/Zeta/.vimrc create mode 100644 projects/Zeta/API/Z/classes/Empty.hpp create mode 100644 projects/Zeta/API/Z/classes/Functor.hpp create mode 100644 projects/Zeta/API/Z/classes/InitializerList.hpp create mode 100644 projects/Zeta/API/Z/classes/Iterator.hpp create mode 100644 projects/Zeta/API/Z/classes/MemberFunction.hpp create mode 100644 projects/Zeta/API/Z/classes/NaT.hpp create mode 100644 projects/Zeta/API/Z/classes/ObjectMemberFunction.hpp create mode 100644 projects/Zeta/API/Z/classes/ObjectSelector.hpp create mode 100644 projects/Zeta/API/Z/classes/OpaqueMemberFunctionPointer.hpp create mode 100644 projects/Zeta/API/Z/classes/Pair.hpp create mode 100644 projects/Zeta/API/Z/classes/Range.hpp create mode 100644 projects/Zeta/API/Z/classes/Rectangle.hpp create mode 100644 projects/Zeta/API/Z/classes/Reference.hpp create mode 100644 projects/Zeta/API/Z/classes/Selector.hpp create mode 100644 projects/Zeta/API/Z/classes/Shared.hpp create mode 100644 projects/Zeta/API/Z/classes/SizedString.hpp create mode 100644 projects/Zeta/API/Z/classes/Span.hpp create mode 100644 projects/Zeta/API/Z/classes/Strid.hpp create mode 100644 projects/Zeta/API/Z/classes/StringView.hpp create mode 100644 projects/Zeta/API/Z/classes/TripleBuffer.hpp create mode 100644 projects/Zeta/API/Z/classes/Tuple.hpp create mode 100644 projects/Zeta/API/Z/classes/XY.hpp create mode 100644 projects/Zeta/API/Z/classes/XYZ.hpp create mode 100644 projects/Zeta/API/Z/constants/boolean.h create mode 100644 projects/Zeta/API/Z/constants/build.hpp create mode 100644 projects/Zeta/API/Z/constants/numbers.h create mode 100644 projects/Zeta/API/Z/constants/pointer.h create mode 100644 projects/Zeta/API/Z/formats/archive/TAR.h create mode 100644 projects/Zeta/API/Z/formats/character_set/ASCII.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP437.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP737.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP775.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP850.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP852.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP855.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP857.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP858.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP860.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP861.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP862.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP863.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP864.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP865.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP866.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP869.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP872.h create mode 100644 projects/Zeta/API/Z/formats/character_set/DOS_CP874.h create mode 100644 projects/Zeta/API/Z/formats/data_model/I16LP32.h create mode 100644 projects/Zeta/API/Z/formats/data_model/ILP32.h create mode 100644 projects/Zeta/API/Z/formats/data_model/ILP64.h create mode 100644 projects/Zeta/API/Z/formats/data_model/IP16L32.h create mode 100644 projects/Zeta/API/Z/formats/data_model/LLP64.h create mode 100644 projects/Zeta/API/Z/formats/data_model/LP32.h create mode 100644 projects/Zeta/API/Z/formats/data_model/LP64.h create mode 100644 projects/Zeta/API/Z/formats/data_model/SILP64.h create mode 100644 projects/Zeta/API/Z/formats/floating-point/Brain_Floating-Point.h create mode 100644 projects/Zeta/API/Z/formats/floating-point/IBM.h create mode 100644 projects/Zeta/API/Z/formats/floating-point/IEEE_754.h create mode 100644 projects/Zeta/API/Z/formats/floating-point/x87.h create mode 100644 projects/Zeta/API/Z/formats/keymap/Mac_OS.h create mode 100644 projects/Zeta/API/Z/formats/keymap/USB.h create mode 100644 projects/Zeta/API/Z/formats/keymap/Z.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/+D.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ACH.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/FRZ.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/PRG.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SEM.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SIT.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SLT.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNA.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNP.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNX.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SP.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/Z80.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZLS.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX-State.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX82.h create mode 100644 projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZXS.h create mode 100644 projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/TNES.h create mode 100644 projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/UNIF.h create mode 100644 projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/iNES.h create mode 100644 projects/Zeta/API/Z/formats/storage_medium_image/audio/TZX.h create mode 100644 projects/Zeta/API/Z/formats/storage_medium_image/audio/Warajevo_TAP.h create mode 100644 projects/Zeta/API/Z/functions/Objective-C.hpp create mode 100644 projects/Zeta/API/Z/functions/atomic.h create mode 100644 projects/Zeta/API/Z/functions/bitwise.h create mode 100644 projects/Zeta/API/Z/functions/buffer.h create mode 100644 projects/Zeta/API/Z/functions/calendar.h create mode 100644 projects/Zeta/API/Z/functions/casting.hpp create mode 100644 projects/Zeta/API/Z/functions/character.h create mode 100644 projects/Zeta/API/Z/functions/class.hpp create mode 100644 projects/Zeta/API/Z/functions/hash.hpp create mode 100644 projects/Zeta/API/Z/functions/math.h create mode 100644 projects/Zeta/API/Z/functions/math.hpp create mode 100644 projects/Zeta/API/Z/functions/type.hpp create mode 100644 projects/Zeta/API/Z/functions/unevaluated.hpp create mode 100644 projects/Zeta/API/Z/hardware/ISA/6502.h create mode 100644 projects/Zeta/API/Z/hardware/ISA/RISC-V.h create mode 100644 projects/Zeta/API/Z/hardware/ISA/Z80.h create mode 100644 projects/Zeta/API/Z/hardware/bus/USB.h create mode 100644 projects/Zeta/API/Z/hardware/machine/computer/ZX_Spectrum.h create mode 100644 projects/Zeta/API/Z/inspection/C++.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++03.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++11.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++14.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++17.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++20.h create mode 100644 projects/Zeta/API/Z/inspection/C++/modules/C++98.h create mode 100644 projects/Zeta/API/Z/inspection/C.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C11.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C23.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C78.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C89.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C95.h create mode 100644 projects/Zeta/API/Z/inspection/C/modules/C99.h create mode 100644 projects/Zeta/API/Z/inspection/ISA.h create mode 100644 projects/Zeta/API/Z/inspection/ISA/detection.h create mode 100644 projects/Zeta/API/Z/inspection/OS.h create mode 100644 projects/Zeta/API/Z/inspection/OS/detection.h create mode 100644 projects/Zeta/API/Z/inspection/Z.h create mode 100644 projects/Zeta/API/Z/inspection/character_set.h create mode 100644 projects/Zeta/API/Z/inspection/compiler.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/completion.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/detection.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/Clang.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/GCC.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/MSVC.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/TinyCC.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/cc65.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/generic.h create mode 100644 projects/Zeta/API/Z/inspection/compiler/modules/template.h create mode 100644 projects/Zeta/API/Z/inspection/data_model.h create mode 100644 projects/Zeta/API/Z/inspection/data_model/deduction.h create mode 100644 projects/Zeta/API/Z/inspection/data_model/detection.h create mode 100644 projects/Zeta/API/Z/inspection/floating-point.h create mode 100644 projects/Zeta/API/Z/inspection/floating-point/completion.h create mode 100644 projects/Zeta/API/Z/inspection/language.h create mode 100644 projects/Zeta/API/Z/inspection/platform.h create mode 100644 projects/Zeta/API/Z/inspection/platform/detection.h create mode 100644 projects/Zeta/API/Z/keys/C++.h create mode 100644 projects/Zeta/API/Z/keys/C.h create mode 100644 projects/Zeta/API/Z/keys/ISA.h create mode 100644 projects/Zeta/API/Z/keys/OS.h create mode 100644 projects/Zeta/API/Z/keys/compiler.h create mode 100644 projects/Zeta/API/Z/keys/data_model.h create mode 100644 projects/Zeta/API/Z/keys/endianness.h create mode 100644 projects/Zeta/API/Z/keys/fundamental.h create mode 100644 projects/Zeta/API/Z/keys/language.h create mode 100644 projects/Zeta/API/Z/keys/number.h create mode 100644 projects/Zeta/API/Z/keys/order.h create mode 100644 projects/Zeta/API/Z/keys/platform.h create mode 100644 projects/Zeta/API/Z/macros/T.h create mode 100644 projects/Zeta/API/Z/macros/array.h create mode 100644 projects/Zeta/API/Z/macros/bit-field.h create mode 100644 projects/Zeta/API/Z/macros/bitwise.h create mode 100644 projects/Zeta/API/Z/macros/calendar.h create mode 100644 projects/Zeta/API/Z/macros/casting.h create mode 100644 projects/Zeta/API/Z/macros/character.h create mode 100644 projects/Zeta/API/Z/macros/hash.h create mode 100644 projects/Zeta/API/Z/macros/iteration.h create mode 100644 projects/Zeta/API/Z/macros/language.h create mode 100644 projects/Zeta/API/Z/macros/language.hpp create mode 100644 projects/Zeta/API/Z/macros/math.h create mode 100644 projects/Zeta/API/Z/macros/pointer.h create mode 100644 projects/Zeta/API/Z/macros/structure.h create mode 100644 projects/Zeta/API/Z/macros/token.h create mode 100644 projects/Zeta/API/Z/macros/variadic.h create mode 100644 projects/Zeta/API/Z/macros/variadic_control.h create mode 100644 projects/Zeta/API/Z/macros/variadic_pasting.h create mode 100644 projects/Zeta/API/Z/macros/version.h create mode 100644 projects/Zeta/API/Z/protocols/network/7/HTTP.h create mode 100644 projects/Zeta/API/Z/traits/TypeCount.hpp create mode 100644 projects/Zeta/API/Z/traits/TypeList.hpp create mode 100644 projects/Zeta/API/Z/traits/ValueList.hpp create mode 100644 projects/Zeta/API/Z/traits/casting.hpp create mode 100644 projects/Zeta/API/Z/traits/constants.hpp create mode 100644 projects/Zeta/API/Z/traits/control.hpp create mode 100644 projects/Zeta/API/Z/traits/math.hpp create mode 100644 projects/Zeta/API/Z/traits/type.hpp create mode 100644 projects/Zeta/API/Z/types/bitwise.h create mode 100644 projects/Zeta/API/Z/types/bitwise.hpp create mode 100644 projects/Zeta/API/Z/types/buffer.h create mode 100644 projects/Zeta/API/Z/types/integral.h create mode 100644 projects/Zeta/API/Z/types/integral.hpp create mode 100644 projects/Zeta/API/Z/types/pointer.hpp create mode 100644 projects/Zeta/API/Z/types/real.h create mode 100644 projects/Zeta/API/Z/types/real.hpp create mode 100644 projects/Zeta/API/Z/version.h create mode 100644 projects/Zeta/AUTHORS create mode 100644 projects/Zeta/CMake/FindSphinx.cmake create mode 100644 projects/Zeta/CMake/FindZeta.cmake create mode 100644 projects/Zeta/CMakeLists.txt create mode 100644 projects/Zeta/COPYING create mode 100644 projects/Zeta/COPYING.LESSER create mode 100644 projects/Zeta/documentation/APIReference.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Empty.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Functor.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/NaT.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Pair.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Range.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Rectangle.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/TripleBuffer.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/Tuple.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/XY.rst create mode 100644 projects/Zeta/documentation/APIReference/Classes/XYZ.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/CharacterSet.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/Compiler.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/DataModel.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/FloatingPoint.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/ISA.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/Language.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/OS.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/Platform.rst create mode 100644 projects/Zeta/documentation/APIReference/Inspection/Z.rst create mode 100644 projects/Zeta/documentation/CMakeLists.txt create mode 100644 projects/Zeta/documentation/CodingStyle.rst create mode 100644 projects/Zeta/documentation/Contributing.rst create mode 100644 projects/Zeta/documentation/FAQ.rst create mode 100644 projects/Zeta/documentation/Installation.rst create mode 100644 projects/Zeta/documentation/Integration.rst create mode 100644 projects/Zeta/documentation/Makefile create mode 100644 projects/Zeta/documentation/NamingConvention.rst create mode 100644 projects/Zeta/documentation/conf.py create mode 100644 projects/Zeta/documentation/images/lgplv3-147x51.png create mode 100644 projects/Zeta/documentation/index.rst create mode 100644 projects/Zeta/documentation/make.bat create mode 100644 projects/Zeta/support/Zeta.pc.in create mode 100644 projects/Zeta/support/ZetaConfig.cmake.in create mode 100644 projects/tzpuPico/.gdbinit.3333 create mode 100644 projects/tzpuPico/.gdbinit.3334 create mode 100644 projects/tzpuPico/.gdbinit.bootloader.3333 create mode 100644 projects/tzpuPico/.gdbinit.bootloader.3334 create mode 100644 projects/tzpuPico/CMakeLists.txt create mode 100644 projects/tzpuPico/esp32/CMakeLists.txt create mode 100755 projects/tzpuPico/esp32/backup_version.sh create mode 100755 projects/tzpuPico/esp32/build_webfs_gz.sh create mode 100755 projects/tzpuPico/esp32/copy_to_nas.sh create mode 100644 projects/tzpuPico/esp32/dependencies.lock create mode 100644 projects/tzpuPico/esp32/filepack_version.txt create mode 100644 projects/tzpuPico/esp32/idf.cmake create mode 100644 projects/tzpuPico/esp32/license.txt create mode 100644 projects/tzpuPico/esp32/main/CMakeLists.txt create mode 100644 projects/tzpuPico/esp32/main/CommandProcessor.cpp create mode 100644 projects/tzpuPico/esp32/main/FSPI.cpp create mode 100644 projects/tzpuPico/esp32/main/IO.cpp create mode 100644 projects/tzpuPico/esp32/main/Kconfig.projbuild create mode 100644 projects/tzpuPico/esp32/main/NVS.cpp create mode 100644 projects/tzpuPico/esp32/main/SDCard.cpp create mode 100644 projects/tzpuPico/esp32/main/WiFi.cpp create mode 100644 projects/tzpuPico/esp32/main/cJSON.c create mode 100644 projects/tzpuPico/esp32/main/component.mk create mode 100644 projects/tzpuPico/esp32/main/esp_efuse_custom_table.c create mode 100644 projects/tzpuPico/esp32/main/esp_efuse_custom_table.csv create mode 100644 projects/tzpuPico/esp32/main/idf_component.yml create mode 100644 projects/tzpuPico/esp32/main/include/CommandProcessor.h create mode 100644 projects/tzpuPico/esp32/main/include/FSPI.h create mode 100644 projects/tzpuPico/esp32/main/include/IO.h create mode 100644 projects/tzpuPico/esp32/main/include/NVS.h create mode 100644 projects/tzpuPico/esp32/main/include/SDCard.h create mode 100644 projects/tzpuPico/esp32/main/include/WiFi.h create mode 100644 projects/tzpuPico/esp32/main/include/assert.h create mode 100644 projects/tzpuPico/esp32/main/include/cJSON.h create mode 100644 projects/tzpuPico/esp32/main/include/esp_efuse_custom_table.h create mode 100644 projects/tzpuPico/esp32/main/include/flash_ram.h create mode 100644 projects/tzpuPico/esp32/main/include/ipc_protocol.h create mode 100644 projects/tzpuPico/esp32/main/include/tzpuPico.h create mode 100644 projects/tzpuPico/esp32/main/include/untar.h create mode 100644 projects/tzpuPico/esp32/main/tzpuPico.cpp create mode 100644 projects/tzpuPico/esp32/main/untar.c create mode 100755 projects/tzpuPico/esp32/make_filepack.sh create mode 100755 projects/tzpuPico/esp32/make_release.sh create mode 100644 projects/tzpuPico/esp32/sdkconfig create mode 100644 projects/tzpuPico/esp32/targets.cmake create mode 100644 projects/tzpuPico/esp32/tzpuPico.cmake create mode 100644 projects/tzpuPico/esp32/tzpuPico_partition_table.csv create mode 100644 projects/tzpuPico/esp32/tzpuPico_version.txt create mode 100755 projects/tzpuPico/esp32/update_version.sh create mode 100644 projects/tzpuPico/esp32/version.txt create mode 100644 projects/tzpuPico/esp32/webserver/Trumbowyg-main.zip create mode 100644 projects/tzpuPico/esp32/webserver/config.htm create mode 100644 projects/tzpuPico/esp32/webserver/css/Undef.css create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap-theme.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap-theme.css.map.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap-theme.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap-theme.min.css.map.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap.css.map.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/bootstrap.min.css.map.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/jasny-bootstrap.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/jquery.edittable.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/css/p6502.css create mode 100644 projects/tzpuPico/esp32/webserver/css/pZ80.css create mode 100644 projects/tzpuPico/esp32/webserver/css/sb-admin.css create mode 100644 projects/tzpuPico/esp32/webserver/css/style.css create mode 100644 projects/tzpuPico/esp32/webserver/css/styles.css create mode 100644 projects/tzpuPico/esp32/webserver/css/trumbowyg.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/favicon.ico create mode 100644 projects/tzpuPico/esp32/webserver/filemanager.htm create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/css/font-awesome.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/css/font-awesome.min.css.gz create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/css/font-awesome.min.css.orig create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/fonts/fontawesome-webfont.ttf.orig create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/fonts/fontawesome-webfont.woff.gz create mode 100644 projects/tzpuPico/esp32/webserver/font-awesome/fonts/fontawesome-webfont.woff.orig create mode 100644 projects/tzpuPico/esp32/webserver/index.htm create mode 100644 projects/tzpuPico/esp32/webserver/js/140medley.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/actions.js create mode 100644 projects/tzpuPico/esp32/webserver/js/bootstrap.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/bootstrap.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/common.js create mode 100644 projects/tzpuPico/esp32/webserver/js/editor.js create mode 100644 projects/tzpuPico/esp32/webserver/js/filemanager.js create mode 100644 projects/tzpuPico/esp32/webserver/js/index.js create mode 100644 projects/tzpuPico/esp32/webserver/js/jasny-bootstrap.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/jquery.edittable.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/jquery.edittable.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/jquery.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/ota-esp32.js create mode 100644 projects/tzpuPico/esp32/webserver/js/ota-rp2350.js create mode 100644 projects/tzpuPico/esp32/webserver/js/personality.js create mode 100644 projects/tzpuPico/esp32/webserver/js/trumbowyg.min.js.gz create mode 100644 projects/tzpuPico/esp32/webserver/js/ui/icons.svg create mode 100644 projects/tzpuPico/esp32/webserver/js/wifimanager.js create mode 100644 projects/tzpuPico/esp32/webserver/ota-esp32.htm create mode 100644 projects/tzpuPico/esp32/webserver/ota-rp2350.htm create mode 100644 projects/tzpuPico/esp32/webserver/personality.htm create mode 100644 projects/tzpuPico/esp32/webserver/webfs_version.txt create mode 100644 projects/tzpuPico/esp32/webserver/wifimanager.htm create mode 100644 projects/tzpuPico/license.txt create mode 100644 projects/tzpuPico/src/CMakeLists.txt create mode 100644 projects/tzpuPico/src/ESP.c create mode 100644 projects/tzpuPico/src/FSPI.c create mode 100644 projects/tzpuPico/src/FaultHandlers.c create mode 100644 projects/tzpuPico/src/Z80CPU.c create mode 100644 projects/tzpuPico/src/cJSON.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ-1E05.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ-1E14.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ-1E19.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ-1R12.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ-1R18.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/MZ700.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/QDDrive.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/RFS.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/TZFS.c create mode 100644 projects/tzpuPico/src/drivers/Sharp/WD1773.c create mode 100644 projects/tzpuPico/src/include/ESP.h create mode 100644 projects/tzpuPico/src/include/FSPI.h create mode 100644 projects/tzpuPico/src/include/Z80CPU.h create mode 100644 projects/tzpuPico/src/include/cJSON.h create mode 100644 projects/tzpuPico/src/include/debug.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ-1E05.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ-1E14.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ-1E19.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ-1R12.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ-1R18.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/MZ700.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/QDDrive.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/RFS.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/TZFS.h create mode 100644 projects/tzpuPico/src/include/drivers/Sharp/WD1773.h create mode 100644 projects/tzpuPico/src/include/flash_ram.h create mode 100644 projects/tzpuPico/src/include/intercore.h create mode 100644 projects/tzpuPico/src/include/ipc_protocol.h create mode 100644 projects/tzpuPico/src/include/psram.h create mode 100644 projects/tzpuPico/src/include/rp2350.h create mode 100644 projects/tzpuPico/src/include/tusb_config.h create mode 100644 projects/tzpuPico/src/include/usb_bridge.h create mode 100644 projects/tzpuPico/src/include/usb_descriptors.c create mode 100644 projects/tzpuPico/src/model/BaseZ80/CMakeLists.txt create mode 100644 projects/tzpuPico/src/model/BaseZ80/main.c create mode 100644 projects/tzpuPico/src/model/BaseZ80/main_memmap_partition_1.ld create mode 100644 projects/tzpuPico/src/model/BaseZ80/main_memmap_partition_2.ld create mode 100755 projects/tzpuPico/src/model/BaseZ80/update_version.sh create mode 100644 projects/tzpuPico/src/model/BaseZ80/version.txt create mode 100644 projects/tzpuPico/src/model/Bootloader/Bootloader.c create mode 100644 projects/tzpuPico/src/model/Bootloader/Bootloader_memmap.ld create mode 100644 projects/tzpuPico/src/model/Bootloader/CMakeLists.txt create mode 100755 projects/tzpuPico/src/model/Bootloader/update_version.sh create mode 100644 projects/tzpuPico/src/model/Bootloader/version.txt create mode 100644 projects/tzpuPico/src/model/CMakeLists.txt create mode 100644 projects/tzpuPico/src/psram.c create mode 100644 projects/tzpuPico/src/usb_bridge.c create mode 100644 projects/tzpuPico/src/usb_descriptor.c create mode 100644 projects/tzpuPico/src/z80.pio create mode 100755 projects/tzpuPico/tools/MZQDTool.c create mode 100644 projects/tzpuPico/version.txt create mode 100644 rp2350_tzpu.cfg diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1c292de --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +* linguist-vendored +*.asm linguist-vendored=false +*.c linguist-vendored=false +*.cpp linguist-vendored=false +*.pl linguist-vendored=false +*.sh linguist-vendored=false +*.vhd linguist-vendored=false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e76473 --- /dev/null +++ b/.gitignore @@ -0,0 +1,156 @@ +*.o.cmd +*.bin +**/build/** +c5_pin_model_dump.txt +_config.yml +.dm +*.dmp +docs +*.done +*.elf +.gradle +*.jdi +*.log +*.lss +Manuals/ +*.map +.metadata +/.nb-gradle/ +nohup.out +*.o +**/old/** +*/*/old/ +*/old/ +old/ +old/** +**/output/** +*.out.sdc +*.pin +*.pold/* +../RC6502-Apple-1-Replica/ +../RP2040USB2Serial/ +../build_examples.sh +../build_p6502.sh.old +../build_pZ80.sh.old +../build_projects.sh +../build_zxspectrum.sh +../c +../cmake/ +../cronrun.sh +../external/ +../hello_uart.c +../memviewer/ +../pico-examples/ +../pico-extras/ +../pico-sdk.983960/ +../pico-sdk/ +../pico_setup_on_rpi_linux.sh +Hunter-Adams-RP2040-Demos/ +arduino-esp32.old/ +circle/ +hello_world/ +old.tzpuPico/ +p6502.old/ +pico-emu-utils/ +pico_extras_import_optional.cmake +pico_sdk_import.cmake +projects_auto_set_url.cmake +tusb_config.h +tzpuPico.claude1_fspi/ +tzpuPico/.clang-format +tzpuPico/BASIC_2Z009.dsk +tzpuPico/BASIC_5Z008A.qd +tzpuPico/BASIC_5Z008A_RFS.qd +tzpuPico/MZ-2Z009-RFS.dsk +tzpuPico/MZ-2Z009.dsk +tzpuPico/MZ-2Z009E.dsk +tzpuPico/arduino-esp32/ +tzpuPico/config.json +tzpuPico/esp32.ba/ +tzpuPico/esp32/archive/ +tzpuPico/esp32/filepack_3.23.tar.gz +tzpuPico/esp32/idf/ +tzpuPico/esp32/idfcomponents/ +tzpuPico/esp32/managed_components/ +tzpuPico/esp32/release/ +tzpuPico/esp32/versions/ +tzpuPico/esp32/webfs/ +tzpuPico/esp_littlefs/ +tzpuPico/fw/ +tzpuPico/gdb.txt +tzpuPico/memviewer/ +tzpuPico/openocd_gdb_init.gdb +tzpuPico/src.bak/ +tzpuPico/src/drivers/Sharp/QD.txt +tzpuPico/src/include/M6502.h +tzpuPico/src/include/M6502CPU.h +tzpuPico/src/model/Base6502/ +tzpuPico/src/model/ESP-Bridge/ +tzpuPico/src/model/SharpMZ/ +tzpuPico/uf2/ +versions/ +zxspectrum.bad/ +zxspectrum/ +../tinyusb.orig/ +../tinyusb/ +.gitignore.swp +RC6502-Apple-1-Replica/ +RP2040USB2Serial/ +build_examples.sh +build_p6502.sh.old +build_pZ80.sh.old +build_projects.sh +build_zxspectrum.sh +c +cmake/ +cronrun.sh +external/ +hello_uart.c +memviewer/ +pico-examples/ +pico-extras/ +pico-sdk.983960/ +pico-sdk/ +pico_setup_on_rpi_linux.sh +projects/CMakeLists.txt +projects/tzpuPico/.clang-format +projects/tzpuPico/.gdb.txt.swo +projects/tzpuPico/BASIC_2Z009.dsk +projects/tzpuPico/BASIC_5Z008A.qd +projects/tzpuPico/BASIC_5Z008A_RFS.qd +projects/tzpuPico/MZ-2Z009-RFS.dsk +projects/tzpuPico/MZ-2Z009.dsk +projects/tzpuPico/MZ-2Z009E.dsk +projects/tzpuPico/arduino-esp32/ +projects/tzpuPico/config.json +projects/tzpuPico/esp32.ba/ +projects/tzpuPico/esp32/archive/ +projects/tzpuPico/esp32/filepack_3.23.tar.gz +projects/tzpuPico/esp32/idf/ +projects/tzpuPico/esp32/idfcomponents/ +projects/tzpuPico/esp32/managed_components/ +projects/tzpuPico/esp32/release/ +projects/tzpuPico/esp32/webfs/ +projects/tzpuPico/esp_littlefs/ +projects/tzpuPico/fw/ +projects/tzpuPico/gdb.txt +projects/tzpuPico/memviewer/ +projects/tzpuPico/openocd_gdb_init.gdb +projects/tzpuPico/pico_extras_import.cmake +projects/tzpuPico/src.bak/ +projects/tzpuPico/src/M6502.c +projects/tzpuPico/src/M6502.pio +projects/tzpuPico/src/M6502CPU.c +projects/tzpuPico/src/drivers/Sharp/QD.txt +projects/tzpuPico/src/include/M6502.h +projects/tzpuPico/src/include/M6502CPU.h +projects/tzpuPico/src/model/Base6502/ +projects/tzpuPico/src/model/ESP-Bridge/ +projects/tzpuPico/src/model/SharpMZ/ +projects/tzpuPico/uf2/ +tinyusb.orig/ +tinyusb/ +projects/tzpuPico/esp32/main/include/assert.h +projects/tzpuPico/esp32/main/include/flash_ram.h +projects/tzpuPico/esp32/version.txt + diff --git a/build_tzpuPico.sh b/build_tzpuPico.sh new file mode 100755 index 0000000..6161dde --- /dev/null +++ b/build_tzpuPico.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +export PICO_PATH=/dvlp/Projects/pico/ +export PICO_SDK_PATH=${PICO_PATH}/pico-sdk/ +export PICO_SDK_EXAMPLE_PATH=${PICO_PATH}/pico-examples/ +export PICO_SDK_PROJECTS_PATH=${PICO_PATH}/projects/ +export PICO_SDK_PROJECTS_PATH_PICO=${PICO_PATH}/projects/tzpuPico +export PICO_SDK_PROJECTS_PATH_PICOESP32=${PICO_PATH}/projects/tzpuPico/esp32 +export NAS_DST=/srv2/build/ + +echo "****************************************************************************" +echo "* Building tzpuPico $1 " +echo "****************************************************************************" +echo "" + +#echo "Reverting tiny_usb..." +#cd $PICO_SDK_PATH/lib/ +#rm -fr tinyusb +#cp -pr tinyusb.orig tinyusb + +OLDVERSION=$(cat ${PICO_SDK_PROJECTS_PATH_PICO}/version.txt) +NEWVERSION=$(perl -e "$(echo "print $(cat ${PICO_SDK_PROJECTS_PATH_PICO}/version.txt)+0.001")") + +echo "Building tzpuPico..." +cd ${PICO_SDK_PROJECTS_PATH_PICO}/ + +echo "Backing up version (${OLDVERSION}) to ${PICO_SDK_PROJECTS_PATH}/versions/pz80_${OLDVERSION}_$(date +'%y%m%d%H%M').tar.gz..." +tar -cvzf ${PICO_SDK_PROJECTS_PATH}/versions/pz80_${OLDVERSION}_$(date +'%y%m%d%H%M').tar.gz \ + src pico_sdk_import.cmake pico_extras_import.cmake version.txt CMakeLists.txt +if [[ $? != 0 ]]; then + echo "Backup failure!" + cd ${PICO_PATH} + exit 1 +fi + +# Ensure our versions of board etc are in the SDK. +cp ${PICO_PATH}/picoZ80.h.tmpl ${PICO_SDK_PATH}/src/boards/include/boards/picoZ80.h + +# Prepare build directory. +rm -fr build +mkdir -p build +cd build +#cmake -DPICO_BOARD=pimoroni_pga2350 -DPICO_PLATFORM=rp2350-arm-s -DPICO_COPY_TO_RAM=0 .. +if [[ "$1" == "DEBUG" ]]; then + cmake -DCMAKE_BUILD_TYPE=Debug -DPICO_COPY_TO_RAM=0 -DPICO_PLATFORM=rp2350-arm-s -DPICO_BOARD=picoZ80 .. +else + cmake -DPICO_COPY_TO_RAM=0 -DPICO_PLATFORM=rp2350-arm-s -DPICO_BOARD=picoZ80 .. +fi +if [[ $? != 0 ]]; then + echo "CMAKE failure!" + cd ${PICO_PATH} + exit 2 +fi +make clean +#make VERBOSE=1 -j4 +make -j4 +if [[ $? != 0 ]]; then + echo "Build failure!" + cd ${PICO_PATH} + exit 3 +fi + +# Update to next version as this version has built without error. +echo ${NEWVERSION} > ${PICO_SDK_PROJECTS_PATH_PICO}/version.txt +cd .. + +echo "Copying binaries to project dir..." +echo "" +mkdir -p ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2/ +mkdir -p ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/ +for f in $(find ${PICO_SDK_PROJECTS_PATH_PICO}/src/model/* -maxdepth 0 -type d) +do + FILE=$(basename $f) + #VERSION=$(cat ${f}/version.txt) + VERSION=$(perl -e "$(echo "print $(cat ${f}/version.txt)-0.001")") + echo "Target: ${FILE}" + if [ -f ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 ]; then + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2/${FILE}_${VERSION}.uf2 + fi + if [ -f ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.bin ]; then + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.bin ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/${FILE}_${VERSION}.bin + else + for vf in $(ls -1 ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}*.bin 2>/dev/null) + do + VARIANTNAME=$(basename ${vf} .bin | sed "s/${FILE}_//g") + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}_${VARIANTNAME}.bin ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/${FILE}_${VARIANTNAME}_${VERSION}.bin + done + fi +# if [ -f ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 ]; then +# ${PICO_SDK_PROJECTS_PATH_PICO}/build/_deps/picotool/picotool info -a ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 +# fi + if [ -f ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 ]; then + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.uf2 ${NAS_DST}/${FILE}_${VERSION}.uf2 + fi + if [ -f ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.bin ]; then + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}.bin ${NAS_DST}/${FILE}_${VERSION}.bin + else + for vf in $(ls -1 ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}*.bin 2>/dev/null) + do + VARIANTNAME=$(basename ${vf} .bin | sed "s/${FILE}_//g") + cp ${PICO_SDK_PROJECTS_PATH_PICO}/build/bin/model/${FILE}/${FILE}_${VARIANTNAME}.bin ${NAS_DST}/${FILE}_${VARIANTNAME}_${VERSION}.bin + done + fi +done +ls -lart ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2/ ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/ +cp ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2/* /srv2/build/ +cp ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/* /srv2/build/ +mkdir -p ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2.bak +mkdir -p ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin.bak +mv ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2/* ${PICO_SDK_PROJECTS_PATH_PICO}/fw/uf2.bak/ +mv ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin/* ${PICO_SDK_PROJECTS_PATH_PICO}/fw/bin.bak/ + +if [[ "$1" = "ALL" ]]; then + cd ${PICO_SDK_PROJECTS_PATH_PICOESP32}/ + docker run --rm --privileged --volume /dev:/dev --volume /sys:/sys:ro --volume /dev/bus/usb:/dev/bus/usb -v $PWD:/project -w /project -it espressif/idf:release-v5.4 idf.py clean build +fi + +# Save the esp32 backups too, out of the main dev tree. +mv ${PICO_SDK_PROJECTS_PATH_PICOESP32}/versions/* ${PICO_SDK_PROJECTS_PATH}/versions/ +rsync -ah ${PICO_SDK_PROJECTS_PATH}/versions/ /srv2/dvlp/versions/ 2>/dev/null + +echo "" +echo "****************************************************************************" +echo "* End of tzpuPico build... *" +echo "****************************************************************************" diff --git a/get_and_build_sdk.sh b/get_and_build_sdk.sh new file mode 100755 index 0000000..6c3f4a3 --- /dev/null +++ b/get_and_build_sdk.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +export PICO_PATH=/dvlp/Projects/pico/ +export PICO_SDK_PATH=${PICO_PATH}/pico-sdk/ +export PICO_SDK_EXAMPLE_PATH=${PICO_PATH}/pico-examples/ +export PICO_SDK_PROJECTS_PATH=${PICO_PATH}/projects/ + +cd ${PICO_PATH} +#git clone https://github.com/raspberrypi/pico-sdk.git --branch master +mv pico-sdk pico-sdk.$$ +git clone https://github.com/raspberrypi/pico-sdk.git --branch develop +mkdir -p $PICO_SDK_PATH/lib/ +cd $PICO_SDK_PATH/lib/ +#mv tinyusb tinyusb.orig.$$.2 +#git clone https://github.com/fruit-bat/tinyusb.git +#cd tinyusb +#git checkout hid_micro_parser +# Use a known version of tinyusb, the pico build tools will use this. +#cp -r ${PICO_PATH}/tinyusb.orig ${PICO_SDK_PATH}/lib/tinyusb.orig + +cd ${PICO_SDK_PATH} +git submodule update --init +git pull +git submodule update + +cd ${PICO_PATH} +git clone https://github.com/raspberrypi/pico-examples.git --branch master +cd ${PICO_SDK_EXAMPLE_PATH} +git submodule update --init +git pull +git submodule update + +cd ${PICO_SDK_PATH} +rm -fr build +mkdir -p build +cd build + +cmake -DPICO_BOARD=pimoroni_pga2350 -DPICO_PLATFORM=rp2350-arm-s -DPICO_SDK_PATH=${PICO_SDK_PATH} .. +make + +#cd ${PICO_SDK_EXAMPLE_PATH} +#mkdir -p build +#cd build +#cmake -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-arm-s -DPICO_SDK_PATH=${PICO_SDK_PATH}.. +#make +#cd .. + +#cd ${PICO_SDK_PROJECTS_PATH} +#mkdir -p build +#cd build +#cmake .. +#make +#cd .. diff --git a/picoZ80.h.tmpl b/picoZ80.h.tmpl new file mode 100644 index 0000000..f56e1a3 --- /dev/null +++ b/picoZ80.h.tmpl @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +// ----------------------------------------------------- +// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO +// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES +// ----------------------------------------------------- + +// This header may be included by other board headers as "boards/pimoroni_pga2350.h" + +#ifndef _BOARDS_PICOZ80_H +#define _BOARDS_PICOZ80_H + +pico_board_cmake_set(PICO_PLATFORM, rp2350) + +// For board detection +#define PICOZ80 +#define PICOZ80_16MB + +// --- RP2350 VARIANT --- +#define PICO_RP2350A 0 + +// --- BOARD SPECIFIC --- +#define PICOZ80_PSRAM_CS_PIN 47 + +// --- UART --- +#ifndef PICO_DEFAULT_UART +#define PICO_DEFAULT_UART 0 +#endif +#ifndef PICO_DEFAULT_UART_TX_PIN +#define PICO_DEFAULT_UART_TX_PIN 0 +#endif +#ifndef PICO_DEFAULT_UART_RX_PIN +#define PICO_DEFAULT_UART_RX_PIN 1 +#endif + +// --- LED --- +#ifndef PICO_DEFAULT_LED_PIN +#define PICO_DEFAULT_LED_PIN 25 +#endif +// no PICO_DEFAULT_WS2812_PIN + +// --- I2C --- +#ifndef PICO_DEFAULT_I2C +#define PICO_DEFAULT_I2C 0 +#endif +#ifndef PICO_DEFAULT_I2C_SDA_PIN +#define PICO_DEFAULT_I2C_SDA_PIN 4 +#endif +#ifndef PICO_DEFAULT_I2C_SCL_PIN +#define PICO_DEFAULT_I2C_SCL_PIN 5 +#endif + +// --- SPI --- +#ifndef PICO_DEFAULT_SPI +#define PICO_DEFAULT_SPI 0 +#endif +#ifndef PICO_DEFAULT_SPI_SCK_PIN +#define PICO_DEFAULT_SPI_SCK_PIN 18 +#endif +#ifndef PICO_DEFAULT_SPI_TX_PIN +#define PICO_DEFAULT_SPI_TX_PIN 19 +#endif +#ifndef PICO_DEFAULT_SPI_RX_PIN +#define PICO_DEFAULT_SPI_RX_PIN 16 +#endif +#ifndef PICO_DEFAULT_SPI_CSN_PIN +#define PICO_DEFAULT_SPI_CSN_PIN 17 +#endif + +// --- FLASH --- + +#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 +//#define PICO_NO_RAM_VECTOR_TABLE 1 +//#define PICO_TIME_DEFAULT_ALARM_POOL_DISABLED 1 +//#define PICO_TIME_DEFAULT_ALARM_POOL_HARDWARE_ALARM_NUM 4 + +#ifndef PICO_FLASH_SPI_CLKDIV +#define PICO_FLASH_SPI_CLKDIV 4 +#endif + +pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024)) +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) +#endif + +// no PICO_SMPS_MODE_PIN +// no PICO_VBUS_PIN +// no PICO_VSYS_PIN + +pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1) +#ifndef PICO_RP2350_A2_SUPPORTED +#define PICO_RP2350_A2_SUPPORTED 1 +#endif + +#endif diff --git a/projects/Z80/.editorconfig b/projects/Z80/.editorconfig new file mode 100644 index 0000000..7a38c82 --- /dev/null +++ b/projects/Z80/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 8 +indent_style = tab +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.rc] +charset = utf-8-bom + +[*.{cff,yml}] +indent_size = 2 +indent_style = space diff --git a/projects/Z80/.github/FUNDING.yml b/projects/Z80/.github/FUNDING.yml new file mode 100644 index 0000000..b45ed9c --- /dev/null +++ b/projects/Z80/.github/FUNDING.yml @@ -0,0 +1,5 @@ +buy_me_a_coffee: redcode +github: redcode +ko_fi: redcode +liberapay: redcode +patreon: redcode diff --git a/projects/Z80/.github/pull_request_template.md b/projects/Z80/.github/pull_request_template.md new file mode 100644 index 0000000..74984ed --- /dev/null +++ b/projects/Z80/.github/pull_request_template.md @@ -0,0 +1,11 @@ +_Describe your pull request here._ + +--- + +### Legal notice _(do not delete)_ + +It is required that contributors assign copyright to the original author so that he retains full ownership of the project. This makes it easier for other entities to use the software because they only have to deal with one copyright holder. It also gives the original author assurance that he will be able to make decisions in the future without gathering and consulting all contributors. + +By submitting this PR, you agree to the following: + +> You hereby assign copyright in this PR's code to the original author of the Z80 library, Manuel Sainz de Baranda y Goñi, to be licensed under the same terms as the rest of the code. You agree to relinquish any and all copyright interest in the software, to the detriment of your heirs and successors. diff --git a/projects/Z80/.github/workflows/build-and-test-library.yml b/projects/Z80/.github/workflows/build-and-test-library.yml new file mode 100644 index 0000000..50b1879 --- /dev/null +++ b/projects/Z80/.github/workflows/build-and-test-library.yml @@ -0,0 +1,95 @@ +name: Build and test library + +on: + push: + paths: + - '.github/workflows/build-and-test-library.yml' + - 'API/**' + - 'CMake/FindZeta.cmake' + - 'sources/*.c' + - 'sources/*.rc.in' + - 'support/*.sha3-512' + - 'CMakeLists.txt' + pull_request: + paths: + - '.github/workflows/build-and-test-library.yml' + - 'API/**' + - 'CMake/FindZeta.cmake' + - 'sources/*.c' + - 'sources/*.rc.in' + - 'support/*.sha3-512' + - 'CMakeLists.txt' + +env: + ZETA_TARBALL_URL: 'http://zxe.io/software/Zeta/download/Zeta-latest.tar.xz' + BUILD_SHARED_LIBS: YES + CMAKE_BUILD_TYPE: Release + Z80_FETCH_TEST_FILES: YES + Z80_NOSTDLIB_FLAGS: Auto + Z80_WITH_CMAKE_SUPPORT: NO + Z80_WITH_HTML_DOCUMENTATION: NO + Z80_WITH_PDF_DOCUMENTATION: NO + Z80_WITH_PKGCONFIG_SUPPORT: NO + Z80_WITH_STANDARD_DOCUMENTS: NO + Z80_WITH_TESTS: YES + Z80_WITH_EXECUTE: YES + Z80_WITH_FULL_IM0: YES + Z80_WITH_IM0_RETX_NOTIFICATIONS: YES + Z80_WITH_Q: YES + Z80_WITH_SPECIAL_RESET: YES + Z80_WITH_UNOFFICIAL_RETI: NO + Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG: YES + +jobs: + build-and-test-library: + runs-on: ${{matrix.os}} + + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies (POSIX) + if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') + run: | + mkdir -p "${{github.workspace}}/build" + curl -L "${{env.ZETA_TARBALL_URL}}" | xz -cd | tar -C "${{github.workspace}}/build" --strip-components=2 -xvf - Zeta/API/Z + + - name: Install dependencies (Windows) + if: startsWith(matrix.os, 'windows') + shell: cmd + run: | + mkdir "${{github.workspace}}\build" + curl -L "${{env.ZETA_TARBALL_URL}}" | 7z x -txz -si -so | 7z x -si -ttar -o"${{github.workspace}}\build" Zeta/API/Z + + - name: Configure CMake + run: >- + cmake + -DBUILD_SHARED_LIBS=${{env.BUILD_SHARED_LIBS}} + -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} + -DZ80_FETCH_TEST_FILES=${{env.Z80_FETCH_TEST_FILES}} + -DZ80_NOSTDLIB_FLAGS=${{env.Z80_NOSTDLIB_FLAGS}} + -DZ80_WITH_CMAKE_SUPPORT=${{env.Z80_WITH_CMAKE_SUPPORT}} + -DZ80_WITH_HTML_DOCUMENTATION=${{env.Z80_WITH_HTML_DOCUMENTATION}} + -DZ80_WITH_PDF_DOCUMENTATION=${{env.Z80_WITH_PDF_DOCUMENTATION}} + -DZ80_WITH_PKGCONFIG_SUPPORT=${{env.Z80_WITH_PKGCONFIG_SUPPORT}} + -DZ80_WITH_STANDARD_DOCUMENTS=${{env.Z80_WITH_STANDARD_DOCUMENTS}} + -DZ80_WITH_TESTS=${{env.Z80_WITH_TESTS}} + -DZ80_WITH_EXECUTE=${{env.Z80_WITH_EXECUTE}} + -DZ80_WITH_FULL_IM0=${{env.Z80_WITH_FULL_IM0}} + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=${{env.Z80_WITH_IM0_RETX_NOTIFICATIONS}} + -DZ80_WITH_Q=${{env.Z80_WITH_Q}} + -DZ80_WITH_SPECIAL_RESET=${{env.Z80_WITH_SPECIAL_RESET}} + -DZ80_WITH_UNOFFICIAL_RETI=${{env.Z80_WITH_UNOFFICIAL_RETI}} + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=${{env.Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG}} + -B "${{github.workspace}}/build" + -S "${{github.workspace}}" + + - name: Build + run: cmake --build "${{github.workspace}}/build" --config ${{env.CMAKE_BUILD_TYPE}} --verbose + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest --build-config ${{env.CMAKE_BUILD_TYPE}} --output-on-failure diff --git a/projects/Z80/.github/workflows/build-documentation.yml b/projects/Z80/.github/workflows/build-documentation.yml new file mode 100644 index 0000000..a0f38b7 --- /dev/null +++ b/projects/Z80/.github/workflows/build-documentation.yml @@ -0,0 +1,70 @@ +name: Build documentation + +on: + push: + paths: + - '.github/workflows/build-documentation.yml' + - 'API/**' + - 'CMake/**' + - 'documentation/**' + - 'CMakeLists.txt' + pull_request: + paths: + - '.github/workflows/build-documentation.yml' + - 'API/**' + - 'CMake/**' + - 'documentation/**' + - 'CMakeLists.txt' + +env: + ZETA_TARBALL_URL: 'http://zxe.io/software/Zeta/download/Zeta-latest.tar.xz' + BUILD_SHARED_LIBS: NO + CMAKE_BUILD_TYPE: Release + Z80_FETCH_TEST_FILES: NO + Z80_WITH_CMAKE_SUPPORT: NO + Z80_WITH_HTML_DOCUMENTATION: YES + Z80_WITH_PDF_DOCUMENTATION: YES + Z80_WITH_PKGCONFIG_SUPPORT: NO + Z80_WITH_STANDARD_DOCUMENTS: NO + Z80_WITH_TESTS: NO + +jobs: + build-documentation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install build tools + run: | + sudo apt-get update + sudo apt-get -y install doxygen + sudo apt-get -y install texlive-full + pip install --user sphinx + pip install --user breathe + + - name: Install dependencies + run: | + mkdir -p "${{github.workspace}}/build" + curl -L "${{env.ZETA_TARBALL_URL}}" | xz -cd | tar -C "${{github.workspace}}/build" --strip-components=2 -xvf - Zeta/API/Z + + - name: Configure CMake + run: >- + cmake + -DBUILD_SHARED_LIBS=${{env.BUILD_SHARED_LIBS}} + -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} + -DZ80_FETCH_TEST_FILES=${{env.Z80_FETCH_TEST_FILES}} + -DZ80_WITH_CMAKE_SUPPORT=${{env.Z80_WITH_CMAKE_SUPPORT}} + -DZ80_WITH_HTML_DOCUMENTATION=${{env.Z80_WITH_HTML_DOCUMENTATION}} + -DZ80_WITH_PDF_DOCUMENTATION=${{env.Z80_WITH_PDF_DOCUMENTATION}} + -DZ80_WITH_PKGCONFIG_SUPPORT=${{env.Z80_WITH_PKGCONFIG_SUPPORT}} + -DZ80_WITH_STANDARD_DOCUMENTS=${{env.Z80_WITH_STANDARD_DOCUMENTS}} + -DZ80_WITH_TESTS=${{env.Z80_WITH_TESTS}} + -B "${{github.workspace}}/build" + -S "${{github.workspace}}" + + - name: Build HTML documentation + run: cmake --build "${{github.workspace}}/build" --config ${{env.CMAKE_BUILD_TYPE}} --target Z80-Documentation-HTML --verbose + + - name: Build PDF documentation + run: cmake --build "${{github.workspace}}/build" --config ${{env.CMAKE_BUILD_TYPE}} --target Z80-Documentation-PDF --verbose diff --git a/projects/Z80/.gitignore b/projects/Z80/.gitignore new file mode 100644 index 0000000..d123c79 --- /dev/null +++ b/projects/Z80/.gitignore @@ -0,0 +1,5 @@ +.directory +.DS_Store +Thumbs.db +/build/ +/CMakeLists.txt.user diff --git a/projects/Z80/.vimrc b/projects/Z80/.vimrc new file mode 100644 index 0000000..361ddcf --- /dev/null +++ b/projects/Z80/.vimrc @@ -0,0 +1,4 @@ +set noexpandtab +set shiftwidth=8 +set tabstop=8 +autocmd BufWritePre * %s/\s\+$//e diff --git a/projects/Z80/API/Z80.h b/projects/Z80/API/Z80.h new file mode 100644 index 0000000..2ac7d15 --- /dev/null +++ b/projects/Z80/API/Z80.h @@ -0,0 +1,904 @@ +/* Z80 API + ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator | +| Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. | +| | +| This emulator 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 of the License, or (at your | +| option) any later version. | +| | +| This emulator 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 emulator. If not, see . | +| | +'=============================================================================*/ + +#ifndef Z80_H + +/** @file Z80.h + * @brief Zilog Z80 CPU emulator. + * + * @details The Z80 library implements a fast, small and accurate emulator + * of the Zilog Z80 that emulates all that is known to date about this CPU, + * including the undocumented behaviors, MEMPTR, Q and the special RESET. + * + * @version 0.2 + * @date 2024 + * @author Manuel Sainz de Baranda y Goñi */ + +#ifdef Z80_DEPENDENCIES_HEADER +# define Z80_H +# include Z80_DEPENDENCIES_HEADER +# undef Z80_H +#else +# include +# include +#endif + +#ifndef Z80_API +# if defined(Z80_STATIC) || defined(__DOXYGEN__) +# define Z80_API +# else +# define Z80_API Z_API_IMPORT +# endif +#endif + +/** @brief Major version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MAJOR 0 + +/** @brief Minor version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MINOR 2 + +/** @brief Micro version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MICRO 0 + +/** @brief String literal with the version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_STRING "0.2" + +/** @brief Maximum number of clock cycles that @ref z80_run and + * @ref z80_execute can emulate. */ + +#define Z80_MAXIMUM_CYCLES (Z_USIZE_MAXIMUM - Z_USIZE(30)) + +/** @brief Maximum number of clock cycles that @ref z80_run will + * emulate if instructed to execute 1 clock cycle. + * + * This is the number of clock cycles it takes to execute the longest + * instruction through interrupt mode 0, not counting the M-cycle used to fetch + * a @c 0xDD or @c 0xFD prefix. For @ref z80_execute, subtract 4 clock + * cycles from this value. */ + +#define Z80_MAXIMUM_CYCLES_PER_STEP 25 + +/** @brief Minimum number of clock cycles that @ref z80_run or + * @ref z80_execute will emulate if instructed to execute 1 clock + * cycle. */ + +#define Z80_MINIMUM_CYCLES_PER_STEP 4 + +/** @brief Opcode interpreted as a trap by the Z80 library. It corresponds to + * the ld h,h instruction in the Z80 ISA. */ + +#define Z80_HOOK 0x64 + +#define Z80_SF 128 /**< @brief Bitmask of the Z80 S flag. */ +#define Z80_ZF 64 /**< @brief Bitmask of the Z80 Z flag. */ +#define Z80_YF 32 /**< @brief Bitmask of the Z80 Y flag. */ +#define Z80_HF 16 /**< @brief Bitmask of the Z80 H flag. */ +#define Z80_XF 8 /**< @brief Bitmask of the Z80 X flag. */ +#define Z80_PF 4 /**< @brief Bitmask of the Z80 P/V flag. */ +#define Z80_NF 2 /**< @brief Bitmask of the Z80 N flag. */ +#define Z80_CF 1 /**< @brief Bitmask of the Z80 C flag. */ + +typedef struct Z80 Z80; + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * perform a read operation. + * + * @param context The @ref Z80::context of the calling object. + * @param address The memory address or I/O port to read from. + * @return The byte read. */ + +typedef zuint8 (* Z80Read)(void *context, zuint16 address); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * perform a write operation. + * + * @param context The @ref Z80::context of the calling object. + * @param address The memory address or I/O port to write to. + * @param value The byte to write. */ + +typedef void (* Z80Write)(void *context, zuint16 address, zuint8 value); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * notify a signal change on the HALT line. + * + * @param context The @ref Z80::context of the calling object. + * @param signal A code specifying the type of signal change. */ + +typedef void (* Z80Halt)(void *context, zuint8 signal); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * notify an event. + * + * @param context The @ref Z80::context of the calling object. */ + +typedef void (* Z80Notify)(void *context); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * delegate the emulation of an illegal instruction. + * + * @param cpu The calling object. + * @param opcode The illegal opcode. + * @return The number of clock cycles consumed by the instruction. */ + +typedef zuint8 (* Z80Illegal)(Z80 *cpu, zuint8 opcode); + +/** @struct Z80 Z80.h + * + * @brief A Z80 CPU emulator. + * + * A @c Z80 object contains the state of an emulated Z80 CPU, pointers to + * callback functions that interconnect the emulator with the external logic + * and a context that is passed to these functions. + * + * Because no constructor function is provided, it is mandatory to directly + * initialize all callback pointers and @ref Z80::options before using + * an object of this type. Optional callbacks must be set to @c Z_NULL when not + * in use. */ + +struct Z80 { + + /** @brief Number of clock cycles already executed. */ + + zusize cycles; + + /** @brief Maximum number of clock cycles to be executed. */ + + zusize cycle_limit; + + /** @brief Pointer to pass as the first argument to all callback + * functions. + * + * This member is intended to hold a reference to the context to which + * the object belongs. It is safe not to initialize it when this is not + * necessary. */ + + void *context; + + /** @brief Invoked to perform an opcode fetch. + * + * This callback indicates the beginning of an opcode fetch M-cycle. + * The function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read fetch_opcode; + + /** @brief Invoked to perform a memory read on instruction data. + * + * This callback indicates the beginning of a memory read M-cycle + * during which the CPU fetches one byte of instruction data (i.e., one + * byte of the instruction that is neither a prefix nor an opcode). The + * function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read fetch; + + /** @brief Invoked to perform a memory read. + * + * This callback indicates the beginning of a memory read M-cycle. The + * function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read read; + + /** @brief Invoked to perform a memory write. + * + * This callback indicates the beginning of a memory write M-cycle. The + * function must write the third argument into the memory location + * specified by the second argument. */ + + Z80Write write; + + /** @brief Invoked to perform an I/O port read. + * + * This callback indicates the beginning of an I/O read M-cycle. The + * function must return the byte read from the I/O port specified by + * the second argument. */ + + Z80Read in; + + /** @brief Invoked to perform an I/O port write. + * + * This callback indicates the beginning of an I/O write M-cycle. The + * function must write the third argument to the I/O port specified by + * the second argument. */ + + Z80Write out; + + /** @brief Invoked to notify a signal change on the HALT line. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. Its invocation is always deferred until the next emulation step + * so that the emulator can abort the signal change if any invalidating + * condition occurs, such as the acceptance of an interrupt during the + * execution of a @c halt instruction. + * + * The second parameter of the function specifies the type of signal + * change and can only contain a boolean value if the Z80 library has + * not been built with special RESET support: + * + * - @c 1 indicates that the HALT line is going low during the last + * clock cycle of a @c halt instruction, which means that the CPU + * is entering the HALT state. + * + * - @c 0 indicates that the HALT line is going high during the last + * clock cycle of an internal NOP executed during the HALT state, + * i.e., the CPU is exiting the HALT state due to an interrupt or + * normal RESET. + * + * If the library has been built with special RESET support, the values + * @ref Z80_HALT_EXIT_EARLY and @ref Z80_HALT_CANCEL + * are also possible for the second parameter. */ + + Z80Halt halt; + + /** @brief Invoked to perform an opcode fetch that corresponds to an + * internal NOP. + * + * This callback indicates the beginning of an opcode fetch M-cycle of + * 4 clock cycles that is generated in the following two cases: + * + * - During the HALT state, the CPU repeatedly executes an internal NOP + * that fetches the next opcode after the @c halt instruction without + * incrementing the PC register. This opcode is read again and again + * until an exit condition occurs (i.e., NMI, INT or RESET). + * + * - After detecting a special RESET signal, the CPU completes the + * ongoing instruction or interrupt response and then zeroes the PC + * register during the first clock cycle of the next M1 cycle. If no + * interrupt has been accepted at the end of the instruction or + * interrupt response, the CPU produces an internal NOP to allow for + * the fetch-execute overlap to take place, during which it fetches + * the next opcode and zeroes PC. + * + * This callback is optional but note that setting it to @c Z_NULL is + * equivalent to enabling @ref Z80_OPTION_HALT_SKIP. */ + + Z80Read nop; + + /** @brief Invoked to perform an opcode fetch that corresponds to a + * non-maskable interrupt acknowledge M-cycle. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It indicates the beginning of an NMI acknowledge M-cycle. The + * value returned by the function is ignored. */ + + Z80Read nmia; + + /** @brief Invoked to perform a data bus read that corresponds to a + * maskable interrupt acknowledge M-cycle. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It indicates the beginning of an INT acknowledge M-cycle. The + * function must return the byte that the interrupting I/O device + * supplies to the CPU via the data bus during this M-cycle. + * + * When this callback is @c Z_NULL, the emulator assumes that the value + * read from the data bus is @c 0xFF. */ + + Z80Read inta; + + /** @brief Invoked to perform a memory read on instruction data during a + * maskable interrupt response in mode 0. + * + * The role of this callback is analogous to that of + * @ref Z80::fetch, but it is specific to the INT response in + * mode 0. Ideally, the function should return a byte of instruction + * data that the interrupting I/O device supplies to the CPU via the + * data bus, but depending on the emulated hardware, the device may not + * be able to do this during a memory read M-cycle because the memory + * is addressed instead, in which case the function must return the + * byte located at the memory address specified by the second + * parameter. + * + * This callback will only be invoked if @ref Z80::inta is not + * @c Z_NULL and returns an opcode that implies subsequent memory read + * M-cycles to fetch the non-opcode bytes of the instruction, so it is + * safe not to initialize it or set it to @c Z_NULL if such a scenario + * is not possible. */ + + Z80Read int_fetch; + + /** @brief Invoked to notify that an ld i,a instruction has + * been fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify ld_i_a; + + /** @brief Invoked to notify that an ld r,a instruction has + * been fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify ld_r_a; + + /** @brief Invoked to notify that a @c reti instruction has been + * fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify reti; + + /** @brief Invoked to notify that a @c retn instruction has been + * fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify retn; + + /** @brief Invoked when a trap is fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use, in which case the opcode of the trap will be executed normally. + * The function receives the memory address of the trap as the second + * parameter and must return the opcode to be executed instead of the + * trap. If the function returns a trap (i.e., @ref Z80_HOOK), + * the emulator will do nothing, so the trap will be fetched again + * unless the function has modified @ref Z80::pc or replaced + * the trap in memory with another opcode. Also note that returning a + * trap does not revert the increment of @ref Z80::r performed + * before each opcode fetch. */ + + Z80Read hook; + + /** @brief Invoked to delegate the execution of an illegal instruction. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. Only those instructions with the @c 0xED prefix that behave the + * same as two consecutive @c nop instructions are considered illegal. + * The function receives the illegal opcode as the second parameter and + * must return the number of clock cycles taken by the instruction. + * + * At the time of invoking this callback, and relative to the start of + * the instruction, only @ref Z80::r has been incremented + * (twice), so @ref Z80::pc still contains the memory address + * of the @c 0xED prefix. */ + + Z80Illegal illegal; + + /** @brief Temporary storage used for instruction fetch. */ + + ZInt32 data; + + ZInt16 ix_iy[2]; /**< @brief Index registers, IX and IY. */ + ZInt16 pc; /**< @brief Register PC (program counter). */ + ZInt16 sp; /**< @brief Register SP (stack pointer). */ + + /** @brief Temporary index register. + * + * All instructions with the @c 0xDD prefix behave exactly the same as + * their counterparts with the @c 0xFD prefix, differing only in the + * index register: the former use IX, whereas the latter use IY. When + * one of these prefixes is fetched, the corresponding index register + * is copied into this member; the instruction logic is then executed + * and finally this member is copied back into the index register. */ + + ZInt16 xy; + + ZInt16 memptr; /**< @brief Register MEMPTR, also known as WZ. */ + ZInt16 af; /**< @brief Register pair AF (accumulator and flags). */ + ZInt16 bc; /**< @brief Register pair BC. */ + ZInt16 de; /**< @brief Register pair DE. */ + ZInt16 hl; /**< @brief Register pair HL. */ + ZInt16 af_; /**< @brief Register pair AF'. */ + ZInt16 bc_; /**< @brief Register pair BC'. */ + ZInt16 de_; /**< @brief Register pair DE'. */ + ZInt16 hl_; /**< @brief Register pair HL'. */ + zuint8 r; /**< @brief Register R (memory refresh). */ + zuint8 i; /**< @brief Register I (interrupt vector base). */ + + /** @brief Backup of bit 7 of the R register. + * + * The Z80 CPU increments the R register during each M1 cycle without + * altering its most significant bit, commonly known as R7. However, + * the emulator only performs normal full-byte increments for speed + * reasons, which eventually corrupts R7. + * + * Before entering the execution loop, both @ref z80_execute + * and @ref z80_run copy @ref Z80::r into this member + * to preserve the value of R7, so that they can restore it before + * returning. The emulation of the ld r, a instruction also + * updates the value of this member. */ + + zuint8 r7; + + /** @brief Maskable interrupt mode. + * + * Contains the number of the maskable interrupt mode in use: @c 0, + * @c 1 or @c 2. */ + + zuint8 im; + + /** @brief Requests pending to be responded. */ + + zuint8 request; + + /** @brief Type of unfinished operation to be resumed. */ + + zuint8 resume; + + zuint8 iff1; /**< @brief Interrupt enable flip-flop #1 (IFF1). */ + zuint8 iff2; /**< @brief Interrupt enable flip-flop #2 (IFF2). */ + zuint8 q; /**< @brief Pseudo-register Q. */ + + /** @brief Emulation options. + * + * This member specifies the different emulation options that are + * enabled. It is mandatory to initialize it before using the emulator. + * Setting it to @c 0 disables all options. */ + + zuint8 options; + + /** @brief State of the INT line. + * + * The value of this member is @c 1 if the INT line is low; otherwise, + * @c 0. */ + + zuint8 int_line; + + /** @brief State of the HALT line. + * + * The value of this member is @c 1 if the HALT line is low; otherwise, + * @c 0. The emulator updates this member before invoking + * @ref Z80::halt, not after. */ + + zuint8 halt_line; +}; + +/** @brief @ref Z80::options bitmask that enables emulation of the + * out (c),255 instruction, specific to the Zilog Z80 CMOS. */ + +#define Z80_OPTION_OUT_VC_255 1 + +/** @brief @ref Z80::options bitmask that enables emulation of the bug + * affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a + * maskable interrupt is accepted during the execution of the + * ld a,{i|r} instructions. */ + +#define Z80_OPTION_LD_A_IR_BUG 2 + +/** @brief @ref Z80::options bitmask that enables the HALTskip + * optimization. */ + +#define Z80_OPTION_HALT_SKIP 4 + +/** @brief @ref Z80::options bitmask that enables the XQ factor in the + * emulation of the @c ccf and @c scf instructions. */ + +#define Z80_OPTION_XQ 8 + +/** @brief @ref Z80::options bitmask that enables notifications for any + * @c reti or @c retn instruction executed during the interrupt mode 0 + * response. */ + +#define Z80_OPTION_IM0_RETX_NOTIFICATIONS 16 + +/** @brief @ref Z80::options bitmask that enables the YQ factor in the + * emulation of the @c ccf and @c scf instructions. */ + +#define Z80_OPTION_YQ 32 + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * Zilog NMOS models. */ + +#define Z80_MODEL_ZILOG_NMOS \ + (Z80_OPTION_LD_A_IR_BUG | Z80_OPTION_XQ | Z80_OPTION_YQ) + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * Zilog CMOS models. */ + +#define Z80_MODEL_ZILOG_CMOS \ + (Z80_OPTION_OUT_VC_255 | Z80_OPTION_XQ | Z80_OPTION_YQ) + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * NEC NMOS models. */ + +#define Z80_MODEL_NEC_NMOS \ + Z80_OPTION_LD_A_IR_BUG + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * ST CMOS models. */ + +#define Z80_MODEL_ST_CMOS \ + (Z80_OPTION_OUT_VC_255 | Z80_OPTION_LD_A_IR_BUG | Z80_OPTION_YQ) + +/** @brief @ref Z80::request bitmask that prevents the NMI signal from + * being accepted. */ + +#define Z80_REQUEST_REJECT_NMI 2 + +/** @brief @ref Z80::request bitmask indicating that an NMI signal has + * been received. */ + +#define Z80_REQUEST_NMI 4 + +/** @brief @ref Z80::request bitmask indicating that the INT line is + * low and interrupts are enabled. */ + +#define Z80_REQUEST_INT 8 + +/** @brief @ref Z80::request bitmask indicating that a special RESET + * signal has been received. */ + +#define Z80_REQUEST_SPECIAL_RESET 16 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles during the HALT state. */ + +#define Z80_RESUME_HALT 1 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles by fetching a prefix @c 0xDD or @c 0xFD. */ + +#define Z80_RESUME_XY 2 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles by fetching a prefix @c 0xDD or @c 0xFD, during a maskable + * interrupt response in mode 0. */ + +#define Z80_RESUME_IM0_XY 3 + +/** @brief Value of the second parameter of @ref Z80::halt when the + * HALT line goes high due to a special RESET signal. */ + +#define Z80_HALT_EXIT_EARLY 2 + +/** @brief Value of the second paratemer of @ref Z80::halt when the + * HALT line goes low and then high due to a special RESET signal during the + * execution of a @c halt instruction. */ + +#define Z80_HALT_CANCEL 3 + +/** @brief Accesses the MEMPTR register of a @ref Z80 @p object. */ + +#define Z80_MEMPTR(object) (object).memptr.uint16_value + +/** @brief Accesses the PC register of a @ref Z80 @p object. */ + +#define Z80_PC(object) (object).pc.uint16_value + +/** @brief Accesses the SP register of a @ref Z80 @p object. */ + +#define Z80_SP(object) (object).sp.uint16_value + +/** @brief Accesses the temporary index register of a @ref Z80 @p + * object */ + +#define Z80_XY(object) (object).xy.uint16_value + +/** @brief Accesses the IX register of a @ref Z80 @p object. */ + +#define Z80_IX(object) (object).ix_iy[0].uint16_value + +/** @brief Accesses the IY register of a @ref Z80 @p object. */ + +#define Z80_IY(object) (object).ix_iy[1].uint16_value + +/** @brief Accesses the AF register of a @ref Z80 @p object. */ + +#define Z80_AF(object) (object).af.uint16_value + +/** @brief Accesses the BC register of a @ref Z80 @p object. */ + +#define Z80_BC(object) (object).bc.uint16_value + +/** @brief Accesses the DE register of a @ref Z80 @p object. */ + +#define Z80_DE(object) (object).de.uint16_value + +/** @brief Accesses the HL register of a @ref Z80 @p object. */ + +#define Z80_HL(object) (object).hl.uint16_value + +/** @brief Accesses the AF' register of a @ref Z80 @p object. */ + +#define Z80_AF_(object) (object).af_.uint16_value + +/** @brief Accesses the BC' register of a @ref Z80 @p object. */ + +#define Z80_BC_(object) (object).bc_.uint16_value + +/** @brief Accesses the DE' register of a @ref Z80 @p object. */ + +#define Z80_DE_(object) (object).de_.uint16_value + +/** @brief Accesses the HL' register of a @ref Z80 @p object. */ + +#define Z80_HL_(object) (object).hl_.uint16_value + +/** @brief Accesses the most significant byte of the MEMPTR register of a + * @ref Z80 @p object. */ + +#define Z80_MEMPTRH(object) (object).memptr.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the MEMPTR register of a + * @ref Z80 @p object. */ + +#define Z80_MEMPTRL(object) (object).memptr.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the PC register of a + * @ref Z80 @p object. */ + +#define Z80_PCH(object) (object).pc.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the PC register of a + * @ref Z80 @p object. */ + +#define Z80_PCL(object) (object).pc.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the SP register of a + * @ref Z80 @p object. */ + +#define Z80_SPH(object) (object).sp.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the SP register of a + * @ref Z80 @p object. */ + +#define Z80_SPL(object) (object).sp.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the temporary index register + * of a @ref Z80 @p object. */ + +#define Z80_XYH(object) (object).xy.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the temporary index register + * of a @ref Z80 @p object. */ + +#define Z80_XYL(object) (object).xy.uint8_values.at_0 + +/** @brief Accesses the IXH register of a @ref Z80 @p object. */ + +#define Z80_IXH(object) (object).ix_iy[0].uint8_values.at_1 + +/** @brief Accesses the IXL register of a @ref Z80 @p object. */ + +#define Z80_IXL(object) (object).ix_iy[0].uint8_values.at_0 + +/** @brief Accesses the IYH register of a @ref Z80 @p object. */ + +#define Z80_IYH(object) (object).ix_iy[1].uint8_values.at_1 + +/** @brief Accesses the IYL register of a @ref Z80 @p object. */ + +#define Z80_IYL(object) (object).ix_iy[1].uint8_values.at_0 + +/** @brief Accesses the A register of a @ref Z80 @p object. */ + +#define Z80_A(object) (object).af.uint8_values.at_1 + +/** @brief Accesses the F register of a @ref Z80 @p object. */ + +#define Z80_F(object) (object).af.uint8_values.at_0 + +/** @brief Accesses the B register of a @ref Z80 @p object. */ + +#define Z80_B(object) (object).bc.uint8_values.at_1 + +/** @brief Accesses the C register of a @ref Z80 @p object. */ + +#define Z80_C(object) (object).bc.uint8_values.at_0 + +/** @brief Accesses the D register of a @ref Z80 @p object. */ + +#define Z80_D(object) (object).de.uint8_values.at_1 + +/** @brief Accesses the E register of a @ref Z80 @p object. */ + +#define Z80_E(object) (object).de.uint8_values.at_0 + +/** @brief Accesses the H register of a @ref Z80 @p object. */ + +#define Z80_H(object) (object).hl.uint8_values.at_1 + +/** @brief Accesses the L register of a @ref Z80 @p object. */ + +#define Z80_L(object) (object).hl.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the AF' register of a + * @ref Z80 @p object. */ + +#define Z80_A_(object) (object).af_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the AF' register of a + * @ref Z80 @p object. */ + +#define Z80_F_(object) (object).af_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the BC' register of a + * @ref Z80 @p object. */ + +#define Z80_B_(object) (object).bc_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the BC' register of a + * @ref Z80 @p object. */ + +#define Z80_C_(object) (object).bc_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the DE' register of a + * @ref Z80 @p object. */ + +#define Z80_D_(object) (object).de_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the DE' register of a + * @ref Z80 @p object. */ + +#define Z80_E_(object) (object).de_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the HL' register of a + * @ref Z80 @p object. */ + +#define Z80_H_(object) (object).hl_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the HL' register of a + * @ref Z80 @p object. */ + +#define Z80_L_(object) (object).hl_.uint8_values.at_0 + +#define Z80_WZ Z80_MEMPTR /**< @brief Same as @ref Z80_MEMPTR. */ +#define Z80_WZH Z80_MEMPTRH /**< @brief Same as @ref Z80_MEMPTRH. */ +#define Z80_WZL Z80_MEMPTRL /**< @brief Same as @ref Z80_MEMPTRL. */ + +Z_EXTERN_C_BEGIN + +/** @brief Sets the power state of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @param state + * @c Z_TRUE = power on; + * @c Z_FALSE = power off. */ + +Z80_API void z80_power(Z80 *self, zboolean state); + +/** @brief Performs an instantaneous normal RESET on a @ref Z80. + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_instant_reset(Z80 *self); + +/** @brief Sends a special RESET signal to a @ref Z80. + * + * @sa + * - http://www.primrosebank.net/computers/z80/z80_special_reset.htm + * - US Patent 4486827 + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_special_reset(Z80 *self); + +/** @brief Sets the state of the INT line of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @param state + * @c Z_TRUE = set line low; + * @c Z_FALSE = set line high. */ + +Z80_API void z80_int(Z80 *self, zboolean state); + +/** @brief Triggers the NMI line of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_nmi(Z80 *self); + +/** @brief Runs a @ref Z80 for a given number of clock @p cycles, + * executing only instructions without responding to signals. + * + * @param self Pointer to the object on which the function is called. + * @param cycles Number of clock cycles to be emulated. + * @return The actual number of clock cycles emulated. */ + +Z80_API zusize z80_execute(Z80 *self, zusize cycles); + +/** @brief Runs a @ref Z80 for a given number of clock @p cycles. + * + * @param self Pointer to the object on which the function is called. + * @param cycles Number of clock cycles to be emulated. + * @return The actual number of clock cycles emulated. */ + +Z80_API zusize z80_run(Z80 *self, zusize cycles); + + +/** @brief Ends the emulation loop of @ref z80_execute or + * @ref z80_run. + * + * This function should only be used inside callback functions. It zeroes + * @ref Z80::cycle_limit, thus breaking the emulation loop after the + * ongoing emulation step has finished executing. + * + * @param self Pointer to the object on which the function is called. */ + +static inline void z80_break(Z80 *self) + {self->cycle_limit = 0;} + + +/** @brief Gets the full value of the R register of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @return The value of the R register. */ + +static inline zuint8 z80_r(Z80 const *self) + {return (self->r & 127) | (self->r7 & 128);} + + +/** @brief Obtains the refresh address of the M1 cycle being executed by a + * @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @return The refresh address. */ + +static inline zuint16 z80_refresh_address(Z80 const *self) + { + return Z_CAST(zuint16)( + ((zuint16)self->i << 8) | + ((self->r - 1) & 127) | + (self->r7 & 128)); + } + + +/** @brief Obtains the clock cycle, relative to the start of the instruction, at + * which the I/O read M-cycle being executed by a @ref Z80 begins. + * + * @param self Pointer to the object on which the function is called. + * @return The clock cycle at which the I/O read M-cycle begins. */ + +static inline zuint8 z80_in_cycle(Z80 const *self) + { + return Z_CAST(zuint8)(self->data.uint8_array[0] == 0xDB + ? /* in a,(BYTE) : 4+3 */ + 7 + : /* in J,(c) / in (c) : 4+4 */ + 8 + + /* ini / ind / inir / indr : 4+5 */ + (self->data.uint8_array[1] >> 7)); + } + + +/** @brief Obtains the clock cycle, relative to the start of the instruction, at + * which the I/O write M-cycle being executed by a @ref Z80 begins. + * + * @param self Pointer to the object on which the function is called. + * @return The clock cycle at which the I/O write M-cycle begins. */ + +static inline zuint8 z80_out_cycle(Z80 const *self) + { + return Z_CAST(zuint8)(self->data.uint8_array[0] == 0xD3 + ? /* out (BYTE),a : 4+3 */ + 7 + : /* out (c),J / out (c),0 : 4+4 */ + 8 + + /* outi / outd / otir / otdr : 4+5+3 */ + ((self->data.uint8_array[1] >> 7) << 2)); + } + + +Z_EXTERN_C_END + +#endif /* Z80_H */ diff --git a/projects/Z80/API/Z80.h.bak b/projects/Z80/API/Z80.h.bak new file mode 100644 index 0000000..46391d1 --- /dev/null +++ b/projects/Z80/API/Z80.h.bak @@ -0,0 +1,904 @@ +/* Z80 API + ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator | +| Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. | +| | +| This emulator 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 of the License, or (at your | +| option) any later version. | +| | +| This emulator 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 emulator. If not, see . | +| | +'=============================================================================*/ + +#ifndef Z80_H + +/** @file Z80.h + * @brief Zilog Z80 CPU emulator. + * + * @details The Z80 library implements a fast, small and accurate emulator + * of the Zilog Z80 that emulates all that is known to date about this CPU, + * including the undocumented behaviors, MEMPTR, Q and the special RESET. + * + * @version 0.2 + * @date 2024 + * @author Manuel Sainz de Baranda y Goñi */ + +#ifdef Z80_DEPENDENCIES_HEADER +# define Z80_H +# include Z80_DEPENDENCIES_HEADER +# undef Z80_H +#else +# include +# include +#endif + +#ifndef Z80_API +# if defined(Z80_STATIC) || defined(__DOXYGEN__) +# define Z80_API +# else +# define Z80_API Z_API_IMPORT +# endif +#endif + +/** @brief Major version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MAJOR 0 + +/** @brief Minor version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MINOR 2 + +/** @brief Micro version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_MICRO 0 + +/** @brief String literal with the version number of the Z80 library. */ + +#define Z80_LIBRARY_VERSION_STRING "0.2" + +/** @brief Maximum number of clock cycles that @ref z80_run and + * @ref z80_execute can emulate. */ + +#define Z80_MAXIMUM_CYCLES (Z_USIZE_MAXIMUM - Z_USIZE(30)) + +/** @brief Maximum number of clock cycles that @ref z80_run will + * emulate if instructed to execute 1 clock cycle. + * + * This is the number of clock cycles it takes to execute the longest + * instruction through interrupt mode 0, not counting the M-cycle used to fetch + * a @c 0xDD or @c 0xFD prefix. For @ref z80_execute, subtract 4 clock + * cycles from this value. */ + +#define Z80_MAXIMUM_CYCLES_PER_STEP 25 + +/** @brief Minimum number of clock cycles that @ref z80_run or + * @ref z80_execute will emulate if instructed to execute 1 clock + * cycle. */ + +#define Z80_MINIMUM_CYCLES_PER_STEP 4 + +/** @brief Opcode interpreted as a trap by the Z80 library. It corresponds to + * the ld h,h instruction in the Z80 ISA. */ + +#define Z80_HOOK 0x64 + +#define Z80_SF 128 /**< @brief Bitmask of the Z80 S flag. */ +#define Z80_ZF 64 /**< @brief Bitmask of the Z80 Z flag. */ +#define Z80_YF 32 /**< @brief Bitmask of the Z80 Y flag. */ +#define Z80_HF 16 /**< @brief Bitmask of the Z80 H flag. */ +#define Z80_XF 8 /**< @brief Bitmask of the Z80 X flag. */ +#define Z80_PF 4 /**< @brief Bitmask of the Z80 P/V flag. */ +#define Z80_NF 2 /**< @brief Bitmask of the Z80 N flag. */ +#define Z80_CF 1 /**< @brief Bitmask of the Z80 C flag. */ + +typedef struct Z80 Z80; + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * perform a read operation. + * + * @param context The @ref Z80::context of the calling object. + * @param address The memory address or I/O port to read from. + * @return The byte read. */ + +typedef zuint8 (* Z80Read)(void *context, zuint16 address); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * perform a write operation. + * + * @param context The @ref Z80::context of the calling object. + * @param address The memory address or I/O port to write to. + * @param value The byte to write. */ + +typedef void (* Z80Write)(void *context, zuint16 address, zuint8 value); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * notify a signal change on the HALT line. + * + * @param context The @ref Z80::context of the calling object. + * @param signal A code specifying the type of signal change. */ + +typedef void (* Z80Halt)(void *context, zuint8 signal); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * notify an event. + * + * @param context The @ref Z80::context of the calling object. */ + +typedef void (* Z80Notify)(void *context); + +/** @brief Defines a pointer to a @ref Z80 callback function invoked to + * delegate the emulation of an illegal instruction. + * + * @param cpu The calling object. + * @param opcode The illegal opcode. + * @return The number of clock cycles consumed by the instruction. */ + +typedef zuint8 (* Z80Illegal)(Z80 *cpu, zuint8 opcode); + +/** @struct Z80 Z80.h + * + * @brief A Z80 CPU emulator. + * + * A @c Z80 object contains the state of an emulated Z80 CPU, pointers to + * callback functions that interconnect the emulator with the external logic + * and a context that is passed to these functions. + * + * Because no constructor function is provided, it is mandatory to directly + * initialize all callback pointers and @ref Z80::options before using + * an object of this type. Optional callbacks must be set to @c Z_NULL when not + * in use. */ + +struct Z80 { + + /** @brief Number of clock cycles already executed. */ + + zusize cycles; + + /** @brief Maximum number of clock cycles to be executed. */ + + zusize cycle_limit; + + /** @brief Pointer to pass as the first argument to all callback + * functions. + * + * This member is intended to hold a reference to the context to which + * the object belongs. It is safe not to initialize it when this is not + * necessary. */ + + void *context; + + /** @brief Invoked to perform an opcode fetch. + * + * This callback indicates the beginning of an opcode fetch M-cycle. + * The function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read fetch_opcode; + + /** @brief Invoked to perform a memory read on instruction data. + * + * This callback indicates the beginning of a memory read M-cycle + * during which the CPU fetches one byte of instruction data (i.e., one + * byte of the instruction that is neither a prefix nor an opcode). The + * function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read fetch; + + /** @brief Invoked to perform a memory read. + * + * This callback indicates the beginning of a memory read M-cycle. The + * function must return the byte located at the memory address + * specified by the second argument. */ + + Z80Read read; + + /** @brief Invoked to perform a memory write. + * + * This callback indicates the beginning of a memory write M-cycle. The + * function must write the third argument into the memory location + * specified by the second argument. */ + + Z80Write write; + + /** @brief Invoked to perform an I/O port read. + * + * This callback indicates the beginning of an I/O read M-cycle. The + * function must return the byte read from the I/O port specified by + * the second argument. */ + + Z80Read in; + + /** @brief Invoked to perform an I/O port write. + * + * This callback indicates the beginning of an I/O write M-cycle. The + * function must write the third argument to the I/O port specified by + * the second argument. */ + + Z80Write out; + + /** @brief Invoked to notify a signal change on the HALT line. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. Its invocation is always deferred until the next emulation step + * so that the emulator can abort the signal change if any invalidating + * condition occurs, such as the acceptance of an interrupt during the + * execution of a @c halt instruction. + * + * The second parameter of the function specifies the type of signal + * change and can only contain a boolean value if the Z80 library has + * not been built with special RESET support: + * + * - @c 1 indicates that the HALT line is going low during the last + * clock cycle of a @c halt instruction, which means that the CPU + * is entering the HALT state. + * + * - @c 0 indicates that the HALT line is going high during the last + * clock cycle of an internal NOP executed during the HALT state, + * i.e., the CPU is exiting the HALT state due to an interrupt or + * normal RESET. + * + * If the library has been built with special RESET support, the values + * @ref Z80_HALT_EXIT_EARLY and @ref Z80_HALT_CANCEL + * are also possible for the second parameter. */ + + Z80Halt halt; + + /** @brief Invoked to perform an opcode fetch that corresponds to an + * internal NOP. + * + * This callback indicates the beginning of an opcode fetch M-cycle of + * 4 clock cycles that is generated in the following two cases: + * + * - During the HALT state, the CPU repeatedly executes an internal NOP + * that fetches the next opcode after the @c halt instruction without + * incrementing the PC register. This opcode is read again and again + * until an exit condition occurs (i.e., NMI, INT or RESET). + * + * - After detecting a special RESET signal, the CPU completes the + * ongoing instruction or interrupt response and then zeroes the PC + * register during the first clock cycle of the next M1 cycle. If no + * interrupt has been accepted at the end of the instruction or + * interrupt response, the CPU produces an internal NOP to allow for + * the fetch-execute overlap to take place, during which it fetches + * the next opcode and zeroes PC. + * + * This callback is optional but note that setting it to @c Z_NULL is + * equivalent to enabling @ref Z80_OPTION_HALT_SKIP. */ + + Z80Read nop; + + /** @brief Invoked to perform an opcode fetch that corresponds to a + * non-maskable interrupt acknowledge M-cycle. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It indicates the beginning of an NMI acknowledge M-cycle. The + * value returned by the function is ignored. */ + + Z80Read nmia; + + /** @brief Invoked to perform a data bus read that corresponds to a + * maskable interrupt acknowledge M-cycle. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It indicates the beginning of an INT acknowledge M-cycle. The + * function must return the byte that the interrupting I/O device + * supplies to the CPU via the data bus during this M-cycle. + * + * When this callback is @c Z_NULL, the emulator assumes that the value + * read from the data bus is @c 0xFF. */ + + Z80Read inta; + + /** @brief Invoked to perform a memory read on instruction data during a + * maskable interrupt response in mode 0. + * + * The role of this callback is analogous to that of + * @ref Z80::fetch, but it is specific to the INT response in + * mode 0. Ideally, the function should return a byte of instruction + * data that the interrupting I/O device supplies to the CPU via the + * data bus, but depending on the emulated hardware, the device may not + * be able to do this during a memory read M-cycle because the memory + * is addressed instead, in which case the function must return the + * byte located at the memory address specified by the second + * parameter. + * + * This callback will only be invoked if @ref Z80::inta is not + * @c Z_NULL and returns an opcode that implies subsequent memory read + * M-cycles to fetch the non-opcode bytes of the instruction, so it is + * safe not to initialize it or set it to @c Z_NULL if such a scenario + * is not possible. */ + + Z80Read int_fetch; + + /** @brief Invoked to notify that an ld i,a instruction has + * been fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify ld_i_a; + + /** @brief Invoked to notify that an ld r,a instruction has + * been fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify ld_r_a; + + /** @brief Invoked to notify that a @c reti instruction has been + * fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify reti; + + /** @brief Invoked to notify that a @c retn instruction has been + * fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. It is invoked before executing the instruction. */ + + Z80Notify retn; + + /** @brief Invoked when a trap is fetched. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use, in which case the opcode of the trap will be executed normally. + * The function receives the memory address of the trap as the second + * parameter and must return the opcode to be executed instead of the + * trap. If the function returns a trap (i.e., @ref Z80_HOOK), + * the emulator will do nothing, so the trap will be fetched again + * unless the function has modified @ref Z80::pc or replaced + * the trap in memory with another opcode. Also note that returning a + * trap does not revert the increment of @ref Z80::r performed + * before each opcode fetch. */ + + Z80Read hook; + + /** @brief Invoked to delegate the execution of an illegal instruction. + * + * This callback is optional and must be set to @c Z_NULL when not in + * use. Only those instructions with the @c 0xED prefix that behave the + * same as two consecutive @c nop instructions are considered illegal. + * The function receives the illegal opcode as the second parameter and + * must return the number of clock cycles taken by the instruction. + * + * At the time of invoking this callback, and relative to the start of + * the instruction, only @ref Z80::r has been incremented + * (twice), so @ref Z80::pc still contains the memory address + * of the @c 0xED prefix. */ + + Z80Illegal illegal; + + /** @brief Temporary storage used for instruction fetch. */ + + ZInt32 data; + + ZInt16 ix_iy[2]; /**< @brief Index registers, IX and IY. */ + ZInt16 pc; /**< @brief Register PC (program counter). */ + ZInt16 sp; /**< @brief Register SP (stack pointer). */ + + /** @brief Temporary index register. + * + * All instructions with the @c 0xDD prefix behave exactly the same as + * their counterparts with the @c 0xFD prefix, differing only in the + * index register: the former use IX, whereas the latter use IY. When + * one of these prefixes is fetched, the corresponding index register + * is copied into this member; the instruction logic is then executed + * and finally this member is copied back into the index register. */ + + ZInt16 xy; + + ZInt16 memptr; /**< @brief Register MEMPTR, also known as WZ. */ + ZInt16 af; /**< @brief Register pair AF (accumulator and flags). */ + ZInt16 bc; /**< @brief Register pair BC. */ + ZInt16 de; /**< @brief Register pair DE. */ + ZInt16 hl; /**< @brief Register pair HL. */ + ZInt16 af_; /**< @brief Register pair AF'. */ + ZInt16 bc_; /**< @brief Register pair BC'. */ + ZInt16 de_; /**< @brief Register pair DE'. */ + ZInt16 hl_; /**< @brief Register pair HL'. */ + zuint8 r; /**< @brief Register R (memory refresh). */ + zuint8 i; /**< @brief Register I (interrupt vector base). */ + + /** @brief Backup of bit 7 of the R register. + * + * The Z80 CPU increments the R register during each M1 cycle without + * altering its most significant bit, commonly known as R7. However, + * the emulator only performs normal full-byte increments for speed + * reasons, which eventually corrupts R7. + * + * Before entering the execution loop, both @ref z80_execute + * and @ref z80_run copy @ref Z80::r into this member + * to preserve the value of R7, so that they can restore it before + * returning. The emulation of the ld r, a instruction also + * updates the value of this member. */ + + zuint8 r7; + + /** @brief Maskable interrupt mode. + * + * Contains the number of the maskable interrupt mode in use: @c 0, + * @c 1 or @c 2. */ + + zuint8 im; + + /** @brief Requests pending to be responded. */ + + zuint8 request; + + /** @brief Type of unfinished operation to be resumed. */ + + zuint8 resume; + + zuint8 iff1; /**< @brief Interrupt enable flip-flop #1 (IFF1). */ + zuint8 iff2; /**< @brief Interrupt enable flip-flop #2 (IFF2). */ + zuint8 q; /**< @brief Pseudo-register Q. */ + + /** @brief Emulation options. + * + * This member specifies the different emulation options that are + * enabled. It is mandatory to initialize it before using the emulator. + * Setting it to @c 0 disables all options. */ + + zuint8 options; + + /** @brief State of the INT line. + * + * The value of this member is @c 1 if the INT line is low; otherwise, + * @c 0. */ + + zuint8 int_line; + + /** @brief State of the HALT line. + * + * The value of this member is @c 1 if the HALT line is low; otherwise, + * @c 0. The emulator updates this member before invoking + * @ref Z80::halt, not after. */ + + zuint8 halt_line; +}; + +/** @brief @ref Z80::options bitmask that enables emulation of the + * out (c),255 instruction, specific to the Zilog Z80 CMOS. */ + +#define Z80_OPTION_OUT_VC_255 1 + +/** @brief @ref Z80::options bitmask that enables emulation of the bug + * affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a + * maskable interrupt is accepted during the execution of the + * ld a,{i|r} instructions. */ + +#define Z80_OPTION_LD_A_IR_BUG 2 + +/** @brief @ref Z80::options bitmask that enables the HALTskip + * optimization. */ + +#define Z80_OPTION_HALT_SKIP 4 + +/** @brief @ref Z80::options bitmask that enables the XQ factor in the + * emulation of the @c ccf and @c scf instructions. */ + +#define Z80_OPTION_XQ 8 + +/** @brief @ref Z80::options bitmask that enables notifications for any + * @c reti or @c retn instruction executed during the interrupt mode 0 + * response. */ + +#define Z80_OPTION_IM0_RETX_NOTIFICATIONS 16 + +/** @brief @ref Z80::options bitmask that enables the YQ factor in the + * emulation of the @c ccf and @c scf instructions. */ + +#define Z80_OPTION_YQ 32 + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * Zilog NMOS models. */ + +#define Z80_MODEL_ZILOG_NMOS \ + (Z80_OPTION_LD_A_IR_BUG | Z80_OPTION_XQ | Z80_OPTION_YQ) + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * Zilog CMOS models. */ + +#define Z80_MODEL_ZILOG_CMOS \ + (Z80_OPTION_OUT_VC_255 | Z80_OPTION_XQ | Z80_OPTION_YQ) + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * NEC NMOS models. */ + +#define Z80_MODEL_NEC_NMOS \ + Z80_OPTION_LD_A_IR_BUG + +/** @brief @ref Z80::options bitmask that enables full emulation of the + * ST CMOS models. */ + +#define Z80_MODEL_ST_CMOS \ + (Z80_OPTION_OUT_VC_255 | Z80_OPTION_LD_A_IR_BUG | Z80_OPTION_YQ) + +/** @brief @ref Z80::request bitmask that prevents the NMI signal from + * being accepted. */ + +#define Z80_REQUEST_REJECT_NMI 2 + +/** @brief @ref Z80::request bitmask indicating that an NMI signal has + * been received. */ + +#define Z80_REQUEST_NMI 4 + +/** @brief @ref Z80::request bitmask indicating that the INT line is + * low and interrupts are enabled. */ + +#define Z80_REQUEST_INT 8 + +/** @brief @ref Z80::request bitmask indicating that a special RESET + * signal has been received. */ + +#define Z80_REQUEST_SPECIAL_RESET 16 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles during the HALT state. */ + +#define Z80_RESUME_HALT 1 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles by fetching a prefix @c 0xDD or @c 0xFD. */ + +#define Z80_RESUME_XY 2 + +/** @brief @ref Z80::resume value indicating that the emulator ran out + * of clock cycles by fetching a prefix @c 0xDD or @c 0xFD, during a maskable + * interrupt response in mode 0. */ + +#define Z80_RESUME_IM0_XY 3 + +/** @brief Value of the second parameter of @ref Z80::halt when the + * HALT line goes high due to a special RESET signal. */ + +#define Z80_HALT_EXIT_EARLY 2 + +/** @brief Value of the second paratemer of @ref Z80::halt when the + * HALT line goes low and then high due to a special RESET signal during the + * execution of a @c halt instruction. */ + +#define Z80_HALT_CANCEL 3 + +/** @brief Accesses the MEMPTR register of a @ref Z80 @p object. */ + +#define Z80_MEMPTR(object) (object).memptr.uint16_value + +/** @brief Accesses the PC register of a @ref Z80 @p object. */ + +#define Z80_PC(object) (object).pc.uint16_value + +/** @brief Accesses the SP register of a @ref Z80 @p object. */ + +#define Z80_SP(object) (object).sp.uint16_value + +/** @brief Accesses the temporary index register of a @ref Z80 @p + * object */ + +#define Z80_XY(object) (object).xy.uint16_value + +/** @brief Accesses the IX register of a @ref Z80 @p object. */ + +#define Z80_IX(object) (object).ix_iy[0].uint16_value + +/** @brief Accesses the IY register of a @ref Z80 @p object. */ + +#define Z80_IY(object) (object).ix_iy[1].uint16_value + +/** @brief Accesses the AF register of a @ref Z80 @p object. */ + +#define Z80_AF(object) (object).af.uint16_value + +/** @brief Accesses the BC register of a @ref Z80 @p object. */ + +#define Z80_BC(object) (object).bc.uint16_value + +/** @brief Accesses the DE register of a @ref Z80 @p object. */ + +#define Z80_DE(object) (object).de.uint16_value + +/** @brief Accesses the HL register of a @ref Z80 @p object. */ + +#define Z80_HL(object) (object).hl.uint16_value + +/** @brief Accesses the AF' register of a @ref Z80 @p object. */ + +#define Z80_AF_(object) (object).af_.uint16_value + +/** @brief Accesses the BC' register of a @ref Z80 @p object. */ + +#define Z80_BC_(object) (object).bc_.uint16_value + +/** @brief Accesses the DE' register of a @ref Z80 @p object. */ + +#define Z80_DE_(object) (object).de_.uint16_value + +/** @brief Accesses the HL' register of a @ref Z80 @p object. */ + +#define Z80_HL_(object) (object).hl_.uint16_value + +/** @brief Accesses the most significant byte of the MEMPTR register of a + * @ref Z80 @p object. */ + +#define Z80_MEMPTRH(object) (object).memptr.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the MEMPTR register of a + * @ref Z80 @p object. */ + +#define Z80_MEMPTRL(object) (object).memptr.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the PC register of a + * @ref Z80 @p object. */ + +#define Z80_PCH(object) (object).pc.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the PC register of a + * @ref Z80 @p object. */ + +#define Z80_PCL(object) (object).pc.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the SP register of a + * @ref Z80 @p object. */ + +#define Z80_SPH(object) (object).sp.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the SP register of a + * @ref Z80 @p object. */ + +#define Z80_SPL(object) (object).sp.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the temporary index register + * of a @ref Z80 @p object. */ + +#define Z80_XYH(object) (object).xy.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the temporary index register + * of a @ref Z80 @p object. */ + +#define Z80_XYL(object) (object).xy.uint8_values.at_0 + +/** @brief Accesses the IXH register of a @ref Z80 @p object. */ + +#define Z80_IXH(object) (object).ix_iy[0].uint8_values.at_1 + +/** @brief Accesses the IXL register of a @ref Z80 @p object. */ + +#define Z80_IXL(object) (object).ix_iy[0].uint8_values.at_0 + +/** @brief Accesses the IYH register of a @ref Z80 @p object. */ + +#define Z80_IYH(object) (object).ix_iy[1].uint8_values.at_1 + +/** @brief Accesses the IYL register of a @ref Z80 @p object. */ + +#define Z80_IYL(object) (object).ix_iy[1].uint8_values.at_0 + +/** @brief Accesses the A register of a @ref Z80 @p object. */ + +#define Z80_A(object) (object).af.uint8_values.at_1 + +/** @brief Accesses the F register of a @ref Z80 @p object. */ + +#define Z80_F(object) (object).af.uint8_values.at_0 + +/** @brief Accesses the B register of a @ref Z80 @p object. */ + +#define Z80_B(object) (object).bc.uint8_values.at_1 + +/** @brief Accesses the C register of a @ref Z80 @p object. */ + +#define Z80_C(object) (object).bc.uint8_values.at_0 + +/** @brief Accesses the D register of a @ref Z80 @p object. */ + +#define Z80_D(object) (object).de.uint8_values.at_1 + +/** @brief Accesses the E register of a @ref Z80 @p object. */ + +#define Z80_E(object) (object).de.uint8_values.at_0 + +/** @brief Accesses the H register of a @ref Z80 @p object. */ + +#define Z80_H(object) (object).hl.uint8_values.at_1 + +/** @brief Accesses the L register of a @ref Z80 @p object. */ + +#define Z80_L(object) (object).hl.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the AF' register of a + * @ref Z80 @p object. */ + +#define Z80_A_(object) (object).af_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the AF' register of a + * @ref Z80 @p object. */ + +#define Z80_F_(object) (object).af_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the BC' register of a + * @ref Z80 @p object. */ + +#define Z80_B_(object) (object).bc_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the BC' register of a + * @ref Z80 @p object. */ + +#define Z80_C_(object) (object).bc_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the DE' register of a + * @ref Z80 @p object. */ + +#define Z80_D_(object) (object).de_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the DE' register of a + * @ref Z80 @p object. */ + +#define Z80_E_(object) (object).de_.uint8_values.at_0 + +/** @brief Accesses the most significant byte of the HL' register of a + * @ref Z80 @p object. */ + +#define Z80_H_(object) (object).hl_.uint8_values.at_1 + +/** @brief Accesses the least significant byte of the HL' register of a + * @ref Z80 @p object. */ + +#define Z80_L_(object) (object).hl_.uint8_values.at_0 + +#define Z80_WZ Z80_MEMPTR /**< @brief Same as @ref Z80_MEMPTR. */ +#define Z80_WZH Z80_MEMPTRH /**< @brief Same as @ref Z80_MEMPTRH. */ +#define Z80_WZL Z80_MEMPTRL /**< @brief Same as @ref Z80_MEMPTRL. */ + +Z_EXTERN_C_BEGIN + +/** @brief Sets the power state of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @param state + * @c Z_TRUE = power on; + * @c Z_FALSE = power off. */ + +Z80_API void z80_power(Z80 *self, zboolean state); + +/** @brief Performs an instantaneous normal RESET on a @ref Z80. + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_instant_reset(Z80 *self); + +/** @brief Sends a special RESET signal to a @ref Z80. + * + * @sa + * - http://www.primrosebank.net/computers/z80/z80_special_reset.htm + * - US Patent 4486827 + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_special_reset(Z80 *self); + +/** @brief Sets the state of the INT line of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @param state + * @c Z_TRUE = set line low; + * @c Z_FALSE = set line high. */ + +Z80_API void z80_int(Z80 *self, zboolean state); + +/** @brief Triggers the NMI line of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. */ + +Z80_API void z80_nmi(Z80 *self); + +/** @brief Runs a @ref Z80 for a given number of clock @p cycles, + * executing only instructions without responding to signals. + * + * @param self Pointer to the object on which the function is called. + * @param cycles Number of clock cycles to be emulated. + * @return The actual number of clock cycles emulated. */ + +Z80_API zusize z80_execute(Z80 *self, zusize cycles); + +/** @brief Runs a @ref Z80 for a given number of clock @p cycles. + * + * @param self Pointer to the object on which the function is called. + * @param cycles Number of clock cycles to be emulated. + * @return The actual number of clock cycles emulated. */ + +Z80_API zusize z80_run(Z80 *self, zusize cycles); + + +/** @brief Ends the emulation loop of @ref z80_execute or + * @ref z80_run. + * + * This function should only be used inside callback functions. It zeroes + * @ref Z80::cycle_limit, thus breaking the emulation loop after the + * ongoing emulation step has finished executing. + * + * @param self Pointer to the object on which the function is called. */ + +static Z_ALWAYS_INLINE void z80_break(Z80 *self) + {self->cycle_limit = 0;} + + +/** @brief Gets the full value of the R register of a @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @return The value of the R register. */ + +static Z_ALWAYS_INLINE zuint8 z80_r(Z80 const *self) + {return (self->r & 127) | (self->r7 & 128);} + + +/** @brief Obtains the refresh address of the M1 cycle being executed by a + * @ref Z80. + * + * @param self Pointer to the object on which the function is called. + * @return The refresh address. */ + +static Z_ALWAYS_INLINE zuint16 z80_refresh_address(Z80 const *self) + { + return Z_CAST(zuint16)( + ((zuint16)self->i << 8) | + ((self->r - 1) & 127) | + (self->r7 & 128)); + } + + +/** @brief Obtains the clock cycle, relative to the start of the instruction, at + * which the I/O read M-cycle being executed by a @ref Z80 begins. + * + * @param self Pointer to the object on which the function is called. + * @return The clock cycle at which the I/O read M-cycle begins. */ + +static Z_ALWAYS_INLINE zuint8 z80_in_cycle(Z80 const *self) + { + return Z_CAST(zuint8)(self->data.uint8_array[0] == 0xDB + ? /* in a,(BYTE) : 4+3 */ + 7 + : /* in J,(c) / in (c) : 4+4 */ + 8 + + /* ini / ind / inir / indr : 4+5 */ + (self->data.uint8_array[1] >> 7)); + } + + +/** @brief Obtains the clock cycle, relative to the start of the instruction, at + * which the I/O write M-cycle being executed by a @ref Z80 begins. + * + * @param self Pointer to the object on which the function is called. + * @return The clock cycle at which the I/O write M-cycle begins. */ + +static Z_ALWAYS_INLINE zuint8 z80_out_cycle(Z80 const *self) + { + return Z_CAST(zuint8)(self->data.uint8_array[0] == 0xD3 + ? /* out (BYTE),a : 4+3 */ + 7 + : /* out (c),J / out (c),0 : 4+4 */ + 8 + + /* outi / outd / otir / otdr : 4+5+3 */ + ((self->data.uint8_array[1] >> 7) << 2)); + } + + +Z_EXTERN_C_END + +#endif /* Z80_H */ diff --git a/projects/Z80/AUTHORS b/projects/Z80/AUTHORS new file mode 100644 index 0000000..779ef3a --- /dev/null +++ b/projects/Z80/AUTHORS @@ -0,0 +1,6 @@ +Original author: + Sainz de Baranda y Goñi, Manuel + +Contributors: + Ortega Sosa, Sofía + Vučenović, Zoran diff --git a/projects/Z80/CITATION.cff b/projects/Z80/CITATION.cff new file mode 100644 index 0000000..7cbb8c0 --- /dev/null +++ b/projects/Z80/CITATION.cff @@ -0,0 +1,22 @@ +abstract: Zilog Z80 CPU emulator. +authors: + - family-names: 'Sainz de Baranda y Goñi' + given-names: Manuel + orcid: 'https://orcid.org/0000-0001-6326-3519' + email: 'manuel@zxe.io' + website: 'https://zxe.io' +cff-version: '1.2.0' +date-released: '2024-04-18' +keywords: + - CPU + - LLE + - Z80 + - Zilog + - emulator +license: LGPL-3.0-or-later +message: If you use this software, please cite it using these metadata. +repository-code: 'https://github.com/redcode/Z80' +title: Z80 +type: software +version: '0.2-pre-2024-04-18' +url: 'https://zxe.io/software/Z80' diff --git a/projects/Z80/CMake/FindBreathe.cmake b/projects/Z80/CMake/FindBreathe.cmake new file mode 100644 index 0000000..ec2d8ca --- /dev/null +++ b/projects/Z80/CMake/FindBreathe.cmake @@ -0,0 +1,31 @@ +# FindBreathe.cmake +# Copyright (C) 2021-2023 Manuel Sainz de Baranda y Goñi. +# This "find module" is DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +include(FindPackageHandleStandardArgs) + +find_program( + BREATHE_APIDOC_EXECUTABLE + NAMES breathe-apidoc + DOC "Breathe extension for Sphinx") + +if(BREATHE_APIDOC_EXECUTABLE) + execute_process( + COMMAND "${BREATHE_APIDOC_EXECUTABLE}" --version + OUTPUT_VARIABLE _output) + + if("${_output}" MATCHES ".* ([^\n]+)\n") + set(BREATHE_APIDOC_VERSION "${CMAKE_MATCH_1}") + endif() + + unset(_output) +endif() + +find_package_handle_standard_args( + Breathe + REQUIRED_VARS BREATHE_APIDOC_EXECUTABLE + VERSION_VAR BREATHE_APIDOC_VERSION) + +mark_as_advanced(BREATHE_APIDOC_EXECUTABLE) + +# FindBreathe.cmake EOF diff --git a/projects/Z80/CMake/FindSphinx.cmake b/projects/Z80/CMake/FindSphinx.cmake new file mode 100644 index 0000000..fe2aeab --- /dev/null +++ b/projects/Z80/CMake/FindSphinx.cmake @@ -0,0 +1,31 @@ +# FindSphinx.cmake +# Copyright (C) 2021-2023 Manuel Sainz de Baranda y Goñi. +# This "find module" is DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +include(FindPackageHandleStandardArgs) + +find_program( + SPHINX_BUILD_EXECUTABLE + NAMES sphinx-build + DOC "Sphinx Documentation Builder") + +if(SPHINX_BUILD_EXECUTABLE) + execute_process( + COMMAND "${SPHINX_BUILD_EXECUTABLE}" --version + OUTPUT_VARIABLE _output) + + if("${_output}" MATCHES ".* ([^\n]+)\n") + set(SPHINX_BUILD_VERSION "${CMAKE_MATCH_1}") + endif() + + unset(_output) +endif() + +find_package_handle_standard_args( + Sphinx + REQUIRED_VARS SPHINX_BUILD_EXECUTABLE + VERSION_VAR SPHINX_BUILD_VERSION) + +mark_as_advanced(SPHINX_BUILD_EXECUTABLE) + +# FindSphinx.cmake EOF diff --git a/projects/Z80/CMake/FindZeta.cmake b/projects/Z80/CMake/FindZeta.cmake new file mode 100644 index 0000000..6210f93 --- /dev/null +++ b/projects/Z80/CMake/FindZeta.cmake @@ -0,0 +1,108 @@ +# Zeta - FindZeta.cmake +# ______ ______________ ___ +# |__ / | ___|___ ___|/ \ +# / /__| __| | | / - \ +# /______|_____| |__| /__/ \__\ +# Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +# This "find module" is DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +include(FindPackageHandleStandardArgs) + +if(NOT DEFINED Zeta_FIND_RELATIVE OR Zeta_FIND_RELATIVE) + find_path( + Zeta_INCLUDE_DIR "Z/version.h" + PATHS "${PROJECT_BINARY_DIR}/Zeta/API" + "${PROJECT_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}/Zeta/API" + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/3rd/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rd" + "${PROJECT_SOURCE_DIR}/3rd-party/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rd-party" + "${PROJECT_SOURCE_DIR}/3rd-parties/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rd-parties" + "${PROJECT_SOURCE_DIR}/3rd_party/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rd_party" + "${PROJECT_SOURCE_DIR}/3rd_parties/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rd_parties" + "${PROJECT_SOURCE_DIR}/3rdparty/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rdparty" + "${PROJECT_SOURCE_DIR}/3rdparties/Zeta/API" + "${PROJECT_SOURCE_DIR}/3rdparties" + "${PROJECT_SOURCE_DIR}/third-party/Zeta/API" + "${PROJECT_SOURCE_DIR}/third-party" + "${PROJECT_SOURCE_DIR}/third-parties/Zeta/API" + "${PROJECT_SOURCE_DIR}/third-parties" + "${PROJECT_SOURCE_DIR}/third_party/Zeta/API" + "${PROJECT_SOURCE_DIR}/third_party" + "${PROJECT_SOURCE_DIR}/third_parties/Zeta/API" + "${PROJECT_SOURCE_DIR}/third_parties" + "${PROJECT_SOURCE_DIR}/thirdparty/Zeta/API" + "${PROJECT_SOURCE_DIR}/thirdparty" + "${PROJECT_SOURCE_DIR}/thirdparties/Zeta/API" + "${PROJECT_SOURCE_DIR}/thirdparties" + "${PROJECT_SOURCE_DIR}/dependencies/Zeta/API" + "${PROJECT_SOURCE_DIR}/dependencies" + "${PROJECT_SOURCE_DIR}/deps/Zeta/API" + "${PROJECT_SOURCE_DIR}/deps" + "${PROJECT_SOURCE_DIR}/extern/Zeta/API" + "${PROJECT_SOURCE_DIR}/extern" + "${PROJECT_SOURCE_DIR}/external/Zeta/API" + "${PROJECT_SOURCE_DIR}/external" + "${PROJECT_SOURCE_DIR}/externals/Zeta/API" + "${PROJECT_SOURCE_DIR}/externals" + "${PROJECT_SOURCE_DIR}/../zeta-src/API" + "${PROJECT_SOURCE_DIR}/../Zeta/API" + "${PROJECT_SOURCE_DIR}/.." + NO_DEFAULT_PATH) +endif() + +find_path( + Zeta_INCLUDE_DIR "Z/version.h" + HINTS ENV CPATH + ENV C_INCLUDE_PATH + ENV CPLUS_INCLUDE_PATH + ENV OBJC_INCLUDE_PATH) + +if(Zeta_INCLUDE_DIR AND EXISTS "${Zeta_INCLUDE_DIR}/Z/version.h") + file(READ "${Zeta_INCLUDE_DIR}/Z/version.h" _) + + if(_ MATCHES ".*Z_LIBRARY_VERSION_STRING \"([^\n]*)\".*") + set(Zeta_VERSION ${CMAKE_MATCH_1}) + + if(Zeta_VERSION MATCHES "^([0-9]+)\\.([0-9]+)") + set(Zeta_VERSION_MAJOR ${CMAKE_MATCH_1}) + set(Zeta_VERSION_MINOR ${CMAKE_MATCH_2}) + + if(Zeta_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(Zeta_VERSION_PATCH ${CMAKE_MATCH_3}) + else() + set(Zeta_VERSION_PATCH 0) + endif() + endif() + endif() + + unset(_) +endif() + +find_package_handle_standard_args( + Zeta + FOUND_VAR Zeta_FOUND + REQUIRED_VARS Zeta_INCLUDE_DIR Zeta_VERSION + VERSION_VAR Zeta_VERSION) + +if(Zeta_FOUND AND NOT TARGET Zeta) + add_library(Zeta INTERFACE IMPORTED) + + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS 3.11) + set_property( + TARGET Zeta + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Zeta_INCLUDE_DIR}") + else() + target_include_directories(Zeta INTERFACE "${Zeta_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(Zeta_INCLUDE_DIR) + +# FindZeta.cmake EOF diff --git a/projects/Z80/CMakeLists.txt b/projects/Z80/CMakeLists.txt new file mode 100644 index 0000000..785299f --- /dev/null +++ b/projects/Z80/CMakeLists.txt @@ -0,0 +1,435 @@ +# Z80 - CMakeLists.txt +# ______ ______ ______ +# /\___ \/\ __ \\ __ \ +# \/__/ /\_\ __ \\ \/\ \ +# /\_____\\_____\\_____\ +# Zilog \/_____//_____//_____/ CPU Emulator +# Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. +# Released under the terms of the GNU Lesser General Public License v3. + +cmake_minimum_required( + # 3.14: install(TARGETS ARCHIVE [DESTINATION]) + VERSION 3.14...${CMAKE_VERSION}) + +if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR AND + NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES +) + set(CMAKE_BUILD_TYPE Release) +endif() + +add_compile_options(-Wall + -Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int + -Wno-unused-function # we have some for the docs that aren't called + -Ofast + ) + +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/API/Z80.h" _) +string(REGEX MATCH ".*Z80_LIBRARY_VERSION_STRING \"([^\n]*)\".*" _ ${_}) + +project(Z80 + VERSION ${CMAKE_MATCH_1} + LANGUAGES C + DESCRIPTION "Zilog Z80 CPU emulator" + HOMEPAGE_URL "https://zxe.io/software/Z80") + +unset(_) +message("${PROJECT_NAME} v${PROJECT_VERSION}") + +include(GNUInstallDirs) + +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard") +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mcpu=cortex-m33 -mthumb") + +set(${PROJECT_NAME}_DEPOT_LOCATION +"http://zxe.io/depot" CACHE STRING +"${PROJECT_NAME}: \ +Directory or URL of the depot containing the test files.") + +option(${PROJECT_NAME}_FETCH_TEST_FILES +"${PROJECT_NAME}: \ +Copy or download the test files from the depot to the build directory." +NO) + +set(${PROJECT_NAME}_INSTALL_CMAKEDIR +"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING +"${PROJECT_NAME}: \ +Directory in which to install the CMake config-file package.") + +set(${PROJECT_NAME}_INSTALL_PKGCONFIGDIR +"${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE STRING +"${PROJECT_NAME}: \ +Directory in which to install the pkg-config file.") + +set(${PROJECT_NAME}_NOSTDLIB_FLAGS +"Auto" CACHE STRING +"${PROJECT_NAME}: \ +Linker flags used to avoid linking against system libraries.") + +option(${PROJECT_NAME}_OBJECT_LIBS +"${PROJECT_NAME}: \ +Build the emulator as an object library." +NO) + +set(${PROJECT_NAME}_SPHINX_HTML_THEME +"" CACHE STRING +"${PROJECT_NAME}: \ +Sphinx theme for the documentation in HTML format.") + +option(${PROJECT_NAME}_WITH_CMAKE_SUPPORT +"${PROJECT_NAME}: \ +Generate and install the CMake config-file package." +NO) + +option(${PROJECT_NAME}_WITH_HTML_DOCUMENTATION +"${PROJECT_NAME}: \ +Build and install the documentation in HTML format." +NO) + +option(${PROJECT_NAME}_WITH_PDF_DOCUMENTATION +"${PROJECT_NAME}: \ +Build and install the documentation in PDF format." +NO) + +option(${PROJECT_NAME}_WITH_PKGCONFIG_SUPPORT +"${PROJECT_NAME}: \ +Generate and install the pkg-config file." +NO) + +option(${PROJECT_NAME}_WITH_STANDARD_DOCUMENTS +"${PROJECT_NAME}: \ +Install the standard text documents distributed with the package: \ +AUTHORS, COPYING, COPYING.LESSER, HISTORY, README and THANKS." +NO) + +option(${PROJECT_NAME}_WITH_TESTS +"${PROJECT_NAME}: \ +Build the testing tool." +NO) + +option(${PROJECT_NAME}_WITH_EXECUTE +"${PROJECT_NAME}: \ +Build the implementation of the `z80_execute` function." +NO) + +option(${PROJECT_NAME}_WITH_FULL_IM0 +"${PROJECT_NAME}: \ +Build the full implementation of the interrupt mode 0 rather than the \ +reduced one." +NO) + +option(${PROJECT_NAME}_WITH_IM0_RETX_NOTIFICATIONS +"${PROJECT_NAME}: \ +Enable optional notifications for any `reti` or `retn` instruction \ +executed during the interrupt mode 0 response." +NO) + +option(${PROJECT_NAME}_WITH_PARITY_COMPUTATION +"${PROJECT_NAME}: \ +Enable actual parity calculation for the P/V flag instead of using a \ +table of precomputed values (this is for benchmarks, DO NOT ENABLE in \ +production builds)." +NO) + +option(${PROJECT_NAME}_WITH_Q +"${PROJECT_NAME}: \ +Build the implementation of Q." +NO) + +option(${PROJECT_NAME}_WITH_SPECIAL_RESET +"${PROJECT_NAME}: \ +Build the implementation of the special RESET." +NO) + +option(${PROJECT_NAME}_WITH_UNOFFICIAL_RETI +"${PROJECT_NAME}: \ +Configure the undocumented instructions ED5Dh, ED6Dh and ED7Dh as `reti` \ +instead of `retn`." +NO) + +option(${PROJECT_NAME}_WITH_ZILOG_NMOS_LD_A_IR_BUG +"${PROJECT_NAME}: \ +Build the implementation of the bug affecting the Zilog Z80 NMOS, which \ +causes the P/V flag to be reset when a maskable interrupt is accepted \ +during the execution of the `ld a,{i|r}` instructions." +NO) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") +find_package(Zeta REQUIRED) + +if(${PROJECT_NAME}_OBJECT_LIBS) + add_library(${PROJECT_NAME} OBJECT) +else() + if(DEFINED ${PROJECT_NAME}_SHARED_LIBS) + set(BUILD_SHARED_LIBS ${${PROJECT_NAME}_SHARED_LIBS}) + endif() + + add_library(${PROJECT_NAME}) +endif() + +target_sources( + ${PROJECT_NAME} PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/API/Z80.h" + "${CMAKE_CURRENT_SOURCE_DIR}/sources/Z80.c") + +set_target_properties( + ${PROJECT_NAME} PROPERTIES + C_STANDARD 99 + C_STANDARD_REQUIRED NO + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + DEBUG_POSTFIX "-debug" + PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/API/Z80.h") + +target_link_libraries(${PROJECT_NAME} PUBLIC Zeta) + +target_include_directories( + ${PROJECT_NAME} PUBLIC + "$" + "$") + +if(${PROJECT_NAME}_OBJECT_LIBS OR NOT BUILD_SHARED_LIBS) + target_compile_definitions(${PROJECT_NAME} PUBLIC Z80_STATIC) +else() + if(WIN32) + if(PROJECT_VERSION_PATCH STREQUAL "") + set(PROJECT_VERSION_PATCH 0) + endif() + + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/sources/Z80.rc.in" + "${CMAKE_CURRENT_BINARY_DIR}/Z80.rc" + @ONLY) + + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/Z80.rc") + endif() + + if(${PROJECT_NAME}_NOSTDLIB_FLAGS STREQUAL "Auto") + if(MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE Z80_WITH_WINDOWS_DLL_MAIN) + target_link_options(${PROJECT_NAME} PRIVATE "/NODEFAULTLIB") + elseif(APPLE) + if(CMAKE_C_COMPILER_ID MATCHES "^(AppleClang|Clang|GNU)$") + target_link_options(${PROJECT_NAME} PRIVATE "LINKER:-dead_strip_dylibs") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "^(ARMClang|Clang|GNU|Intel|TinyCC|XL|XLClang)$") + target_link_options(${PROJECT_NAME} PRIVATE "-nostdlib") + elseif(CMAKE_C_COMPILER_ID MATCHES "PGI") + target_link_options(${PROJECT_NAME} PRIVATE "-Mnostdlib") + elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro") + target_link_options(${PROJECT_NAME} PRIVATE "-xnolib") + endif() + elseif(NOT ${PROJECT_NAME}_NOSTDLIB_FLAGS STREQUAL "") + target_link_options(${PROJECT_NAME} PRIVATE ${${PROJECT_NAME}_NOSTDLIB_FLAGS}) + endif() +endif() + +target_compile_definitions( + ${PROJECT_NAME} PRIVATE + $<$:Z80_WITH_EXECUTE> + $<$:Z80_WITH_FULL_IM0> + $<$:Z80_WITH_IM0_RETX_NOTIFICATIONS> + $<$:Z80_WITH_PARITY_COMPUTATION> + $<$:Z80_WITH_Q> + $<$:Z80_WITH_SPECIAL_RESET> + $<$:Z80_WITH_UNOFFICIAL_RETI> + $<$:Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG>) + +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}_Targets + RUNTIME COMPONENT ${PROJECT_NAME}_Runtime + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT ${PROJECT_NAME}_Runtime + NAMELINK_COMPONENT ${PROJECT_NAME}_Development + ARCHIVE COMPONENT ${PROJECT_NAME}_Development + PUBLIC_HEADER + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT ${PROJECT_NAME}_Development) + +if( NOT ${PROJECT_NAME}_OBJECT_LIBS AND + (${PROJECT_NAME}_WITH_CMAKE_SUPPORT OR ${PROJECT_NAME}_WITH_PKGCONFIG_SUPPORT) +) + include(CMakePackageConfigHelpers) + + if(${PROJECT_NAME}_WITH_CMAKE_SUPPORT) + if(BUILD_SHARED_LIBS) + set(_type Shared) + else() + set(_type Static) + endif() + + install(EXPORT ${PROJECT_NAME}_Targets + DESTINATION "${${PROJECT_NAME}_INSTALL_CMAKEDIR}" + FILE ${PROJECT_NAME}${_type}Targets.cmake + COMPONENT ${PROJECT_NAME}_Development) + + unset(_type) + + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) + + configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/support/${PROJECT_NAME}Config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${${PROJECT_NAME}_INSTALL_CMAKEDIR}") + + install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION "${${PROJECT_NAME}_INSTALL_CMAKEDIR}" + COMPONENT ${PROJECT_NAME}_Development) + endif() + + if(${PROJECT_NAME}_WITH_PKGCONFIG_SUPPORT) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/support/${PROJECT_NAME}.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + @ONLY) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + DESTINATION "${${PROJECT_NAME}_INSTALL_PKGCONFIGDIR}" + COMPONENT ${PROJECT_NAME}_Development) + endif() +endif() + +if(${PROJECT_NAME}_WITH_STANDARD_DOCUMENTS) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS" + "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" + "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER" + "${CMAKE_CURRENT_SOURCE_DIR}/HISTORY" + "${CMAKE_CURRENT_SOURCE_DIR}/README" + "${CMAKE_CURRENT_SOURCE_DIR}/THANKS" + DESTINATION "${CMAKE_INSTALL_DOCDIR}" + COMPONENT ${PROJECT_NAME}_Runtime) +endif() + +if(${PROJECT_NAME}_WITH_HTML_DOCUMENTATION OR ${PROJECT_NAME}_WITH_PDF_DOCUMENTATION) + add_subdirectory(documentation) +endif() + +if(${PROJECT_NAME}_WITH_TESTS) + include(CTest) + + find_package(ZLIB QUIET) + find_package(libzip QUIET) + + add_executable(test-${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/sources/test-Z80.c") + target_link_libraries(test-${PROJECT_NAME} PRIVATE ${PROJECT_NAME}) + + if(ZLIB_FOUND AND libzip_FOUND) + target_link_libraries(test-${PROJECT_NAME} PRIVATE ZLIB::ZLIB libzip::zip) + target_compile_definitions(test-${PROJECT_NAME} PRIVATE TEST_Z80_WITH_ARCHIVE_EXTRACTION) + endif() + + if(${PROJECT_NAME}_WITH_EXECUTE) + target_compile_definitions(test-${PROJECT_NAME} PRIVATE TEST_Z80_WITH_EXECUTE) + endif() + + if(${PROJECT_NAME}_FETCH_TEST_FILES) + function(_fetch_files _file_list _location _destination_dir) + file(STRINGS "${_file_list}" _lines) + + if(_location MATCHES ".*://.*") + set(_message_action "Downloading") + else() + set(_message_action "Copying") + get_filename_component(_location "${_location}" ABSOLUTE) + set(_location "file://${_location}") + endif() + + foreach(_line ${_lines}) + string(STRIP "${_line}" _line) + string(SUBSTRING "${_line}" 0 128 _file_hash) + string(SUBSTRING "${_line}" 130 -1 _file_path) + get_filename_component(_file_name "${_file_path}" NAME) + + set(_file_url "${_location}/${_file_path}") + string(REPLACE " " "%20" _file_url "${_file_url}") + string(REPLACE "!" "%21" _file_url "${_file_url}") + string(REPLACE "(" "%28" _file_url "${_file_url}") + string(REPLACE ")" "%29" _file_url "${_file_url}") + string(REPLACE "," "%2C" _file_url "${_file_url}") + string(REPLACE "[" "%5B" _file_url "${_file_url}") + string(REPLACE "]" "%5D" _file_url "${_file_url}") + + message(STATUS "${_message_action} \"${_file_name}\"") + + file( DOWNLOAD + "${_file_url}" + "${_destination_dir}/${_file_path}" + EXPECTED_HASH SHA3_512=${_file_hash}) + + if( NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS 3.18 AND + (NOT ZLIB_FOUND OR NOT libzip_FOUND) + ) + get_filename_component(_file_extension "${_file_name}" LAST_EXT) + + if(_file_extension STREQUAL ".gz" OR _file_extension STREQUAL ".zip") + get_filename_component(_subdirectory "${_file_path}" DIRECTORY) + + if(_file_extension STREQUAL ".gz") + set(_extract_pattern "*zex*.com") + else() + set(_extract_pattern "*.tap") + endif() + + file( ARCHIVE_EXTRACT + INPUT "${_destination_dir}/${_file_path}" + DESTINATION "${_destination_dir}/${_subdirectory}" + PATTERNS "${_extract_pattern}" + VERBOSE) + endif() + endif() + endforeach() + endfunction() + + _fetch_files( + "${CMAKE_CURRENT_SOURCE_DIR}/support/firmware.sha3-512" + "${${PROJECT_NAME}_DEPOT_LOCATION}/firmware" + "${CMAKE_CURRENT_BINARY_DIR}/depot/firmware") + + _fetch_files( + "${CMAKE_CURRENT_SOURCE_DIR}/support/software.sha3-512" + "${${PROJECT_NAME}_DEPOT_LOCATION}/software" + "${CMAKE_CURRENT_BINARY_DIR}/depot/software") + + if( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS 3.18 AND + (NOT ZLIB_FOUND OR NOT libzip_FOUND) + ) + message(WARNING + "libzip or zlib were not found on your system, which will cause the " + "test-Z80 tool to be built without archive extraction support. When " + "this happens, the build script extracts those test files that are " + "compressed so that test-Z80 can use them later, but this has failed " + "because the version of CMake you are using is too old and does not " + "support archive extraction.\n" + "To fix this, extract all files with `.tar.gz` or `.zip` extension " + "located in " + "`${CMAKE_CURRENT_BINARY_DIR}/depot/software/**/`") + endif() + endif() + + if(${PROJECT_NAME}_FETCH_TEST_FILES OR ${PROJECT_NAME}_DEPOT_LOCATION MATCHES ".*://.*") + set(_depot_dir "${CMAKE_CURRENT_BINARY_DIR}/depot") + else() + set(_depot_dir "${${PROJECT_NAME}_DEPOT_LOCATION}") + endif() + + add_test( + NAME test-${PROJECT_NAME} + COMMAND test-${PROJECT_NAME} + --path "${_depot_dir}/firmware" + --path "${_depot_dir}/software/POSIX" + --path "${_depot_dir}/software/ZX Spectrum" + --all + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + + unset(_depot_dir) +endif() + +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + message("${PROJECT_NAME} END") +endif() + +# CMakeLists.txt EOF diff --git a/projects/Z80/COPYING b/projects/Z80/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/projects/Z80/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/projects/Z80/COPYING.LESSER b/projects/Z80/COPYING.LESSER new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/projects/Z80/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/projects/Z80/HISTORY b/projects/Z80/HISTORY new file mode 100644 index 0000000..a6f6eea --- /dev/null +++ b/projects/Z80/HISTORY @@ -0,0 +1,111 @@ +Z80 v0.2-pre (2024-04-18) +========================= + +This is an important update that addresses a number of issues and also includes +new features. Please note that the changes introduced in this release break the +binary compatibility with the previous version. + +Changes: + 1. Changed the license from GPL to LGPL (by popular request). + 2. Moved the public header from to . + 3. Removed the Xcode project. + 4. Switched the build system from Premake to CMake. + 5. Switched to Zeta v0.1. + 6. Added pkg-config support. + 7. Added the following files to the project: .vimrc, CITATION.cff, file_id.diz + and THANKS. + 8. Added detailed documentation. + 9. Added Pascal binding, courtesy of Zoran Vučenović. +10. Added tests. +11. Added public macros for checking the library version, working with flags, + accessing the 16-bit registers and other purposes. +12. Added the ability to end the emulation loop immediately, and the `z80_break` + function. +13. Added the `z80_execute` function for running a simplified emulation without + RESET and interrupts. +14. Added the `z80_refresh_address` function for getting the refresh address of + the current M1 cycle. +15. Added the `z80_in_cycle` and `z80_out_cycle` functions for obtaining the + clock cycle at which the I/O M-cycle begins, relative to the start of the + instruction. +16. Renamed the `z80_reset` function to `z80_instant_reset`. +17. Added optional emulation of the special RESET, and the `z80_special_reset` + function. +18. Added the `Z80::fetch_opcode` and `Z80::fetch` callbacks for performing + opcode fetch operations and memory read operations on instruction data + respectively. +19. Added the `Z80::nop` callback for performing disregarded opcode fetch + operations during internal NOP M-cycles. +20. Added emulation of the NMI acknowledge M-cycle through the new `Z80::nmia` + callback. +21. Added emulation of the INT acknowledge M-cycle through the new `Z80::inta` + callback, which replaces `Z80::int_data`. +22. Added optional full emulation of the interrupt mode 0, along with the new + `Z80::int_fetch` callback for performing bus read operations on instruction + data. If not enabled at compile-time, the old simplified emulation is built, + which supports only the most typical instructions. +23. Added four callbacks for notifying the execution of important instructions: + `Z80::ld_i_a`, `Z80::ld_r_a`, `Z80::reti` and `Z80::retn`. +24. Added hooking functionality through the `ld h,h` instruction and the new + `Z80::hook` callback. +25. Added the `Z80::illegal` callback for delegating the emulation of illegal + instructions. +26. Added emulation options that can be configured at runtime. +27. Removed `Z80::state`. Replaced with individual members for the registers, + the interrupt enable flip-flops and the interrupt mode. +28. Removed the superfluous EI flag. The previous opcode is checked instead, + which is faster and makes the `Z80` object smaller. +29. Removed all module-related stuff. +30. Added emulation of the additional flag changes performed during the extra 5 + clock cycles of the following instructions: `ldir`, `lddr`, `cpir`, `cpdr`, + `inir`, `indr`, `otir` and `otdr`. +31. Added emulation of the interrupt acceptance deferral that occurs during the + `reti` and `retn` instructions. +32. Added MEMPTR emulation. The `bit N,(hl)` instruction now produces a correct + value of F. +33. Added optional emulation of Q. If enabled at compile-time, the `ccf` and + `scf` instructions will produce a correct value of F. +34. Added emulation of the `out (c),255` instruction (Zilog Z80 CMOS). +35. Added optional emulation of the bug affecting the `ld a,{i|r}` instructions + (Zilog Z80 NMOS). If enabled at compile-time and configured at runtime, the + P/V flag will be reset if an INT is accepted during the execution of these + instructions. +36. Increased granularity. The emulator can now stop directly after fetching a + prefix DDh or FDh if it runs out of clock cycles. This also works during the + INT response in mode 0. +37. Reimplemented the HALT state. The emulation should now be fully accurate. + HALTskip optimization is also supported. +38. Fixed a bug in the `sll` instruction. +39. Fixed a bug in the `INX` and `OUTX` macros affecting the S and N flags. +40. Fixed a bug in the `OUTX` macro affecting the MSByte of the port number. +41. Fixed the clock cycles of the `dec XY` and `in (c)` instructions. +42. Fixed the `read_16` function so that the order of the memory read operations + is not determined by the order in which the compiler evaluates expressions. +43. Fixed the order in which the memory write operations are performed when the + SP register is involved. This affects the NMI response, the INT response in + modes 1 and 2, and the following instructions: `ex (sp),{hl|XY}`, `push TT`, + `push XY`, `call WORD`, `call Z,WORD` and `rst N`. +44. Fixed the handling of illegal instructions to avoid stack overflows in long + sequences of DDh/FDh prefixes. +45. Fixed several implicit conversions to avoid warnings about loss of sign and + precision. +46. Fixed some bitwise operations to avoid undefined behavior and arithmetic + right shifts on signed integers. +47. Fixed violations of the C standard in several identifiers. +48. Renamed the 8-bit register lists: X/Y to J/K; J/K and P/Q to O/P. +49. Replaced all P/V overflow computation functions with a single, faster macro. +50. Replaced all register resolution functions with macros. +51. Replaced all `ld {J,K|O,P}` instructions that have the same destination and + source register with NOPs. In addition, the "illegal" forms of the following + instructions are now executed without using the illegal instruction handler: + `ld O,P`, `ld O,BYTE`, `U [a,]P` and `V O`. +52. Optimizations in flag computation and condition evaluation. +53. New source code comments and improvements to existing ones. +54. Improved code aesthetics. +55. Other improvements, optimizations and minor changes. + + +Z80 v0.1 (2018-11-10) +===================== + +Initial public release. diff --git a/projects/Z80/README b/projects/Z80/README new file mode 100644 index 0000000..fdb2b7d --- /dev/null +++ b/projects/Z80/README @@ -0,0 +1,339 @@ + + ________________ ________________ _________________ + | /\ | || | + |_______ / / | ____ || ____ | + \_____/ / / | |____| || |___/| | + / / / | || | | | | + / / / | ____ || | | | | + / /_/_____| |____| || |__|_| | + / || || | + /_______________||________________||________________| + \________________\\______________//________________/ + + ______________________________________________________________________________ +| | +| Zilog Z80 CPU Emulator | +| version 0.2 | +| | +| Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi | +| Released under the terms of the GNU Lesser General Public License v3 | +| | +| https://zxe.io/software/Z80 | +| | +'==============================================================================' + + +1. Introduction +================ + +The Z80 library implements a fast, small and accurate emulator of the Zilog Z80. +It emulates all that is known to date about this CPU, including the undocumented +behaviors, MEMPTR, Q and the special RESET. It also has the honor of having been +the first open-source project to provide full emulation of the interrupt mode 0. + +The source code is written in ANSI C for maximum portability and is extensively +commented. The aim has been to write a well-structured, easy-to-understand piece +of software; something solid and elegant that can stand the test of time with no +need for major changes. + + +2. Accuracy +============ + +This Z80 CPU emulator has a classic design with instruction-level granularity +that delivers the best performance, whilst offering a reasonable flexibility to +achieve precision down to the T-state level. + +Instruction-level granularity implies that, except in a few well-defined cases, +the execution of a given instruction cannot stop until all its internal M-cycles +have been processed (i.e., instructions are not divided into micro-operations). +Moreover, registers are modified only once per instruction and the T-state +counter is normally updated after a full instruction has been executed. + +That said, instructions, flags, memory accesses, interrupts, clock cycles, etc., +are accurately emulated according to the available technical documentation, the +findings made after decades of research on the Z80 and electronic simulations. +And, of course, the emulator passes the most exhaustive tests written to date, +such as Frank D. Cringle's "Z80 Instruction Set Exerciser", Mark Woodmass' "Z80 +Test Suite", Patrik Rak's "Zilog Z80 CPU Test Suite" and Peter Helcmanovsky's +"Z80 Block Flags Test", to name a few. + + +3. Installation +================ + +You will need CMake v3.14 or later to build the package and, optionally, recent +versions of Doxygen, Sphinx and Breathe to compile the documentation. Also, make +sure that you have LaTeX with PDF support installed on your system if you want +to generate the documentation in PDF format. + +The emulator requires some types and macros included in Zeta (https://zeta.st), +a dependency-free, header-only library used to retain compatibility with most C +compilers. Install Zeta or extract its source code tarball to the root directory +of the Z80 project or its parent directory. Zeta is the sole dependency; the +emulator is a freestanding implementation and as such does not depend on the C +standard library. + +Once the prerequisites are met, create a directory and run cmake from there to +prepare the build system: + + $ mkdir build + $ cd build + $ cmake [options] + +The resulting build files can be configured by passing options to cmake. To show +a complete list of those available along with their current settings, type the +following: + + $ cmake -LAH + +If in doubt, read the CMake documentation for more information on configuration +options. The following are some of the most relevant standard options of CMake: + + -DBUILD_SHARED_LIBS=(YES|NO) + Generate shared libraries rather than static libraries. + The default is `NO`. + + -DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel) + Choose the type of build (configuration) to generate. + The default is `Release`. + + -DCMAKE_INSTALL_PREFIX="" + Specify the installation prefix. + The default is `/usr/local` (on UNIX and UNIX-like operating systems). + +Package-specific options are prefixed with `Z80_` and can be divided into two +groups. The first one controls aspects not related to the source code of the +library: + + -DZ80_DEPOT_LOCATION="" + Specify the directory or URL of the depot containing the test files + (i.e., the firmware and software required by the testing tool). + The default is `http://zxe.io/depot`. + + -DZ80_FETCH_TEST_FILES=(YES|NO) + Copy or download the test files from the depot to the build directory. + The default is `NO`. + + -DZ80_INSTALL_CMAKEDIR="" + Specify the directory in which to install the CMake config-file package. + The default is `"${CMAKE_INSTALL_LIBDIR}/cmake/Z80"`. + + -DZ80_INSTALL_PKGCONFIGDIR="" + Specify the directory in which to install the pkg-config file. + The default is `"${CMAKE_INSTALL_LIBDIR}/pkgconfig"`. + + -DZ80_NOSTDLIB_FLAGS=(Auto|"[[;...]]") + Specify the linker flags used to avoid linking against system libraries. + The default is `Auto` (autoconfigure flags). If you get linker errors, + set this option to `""`. + + -DZ80_OBJECT_LIBS=(YES|NO) + Build the emulator as an object library. + This option takes precedence over `BUILD_SHARED_LIBS` and + `Z80_SHARED_LIBS`. If enabled, the build system will ignore + `Z80_WITH_CMAKE_SUPPORT` and `Z80_WITH_PKGCONFIG_SUPPORT`, as no + libraries or support files will be installed. + The default is `NO`. + + -DZ80_SHARED_LIBS=(YES|NO) + Build the emulator as a shared library, rather than static. + This option takes precedence over `BUILD_SHARED_LIBS`. + Not defined by default. + + -DZ80_SPHINX_HTML_THEME="[]" + Specify the Sphinx theme for the documentation in HTML format. + The default is `""` (use the default theme). + + -DZ80_WITH_CMAKE_SUPPORT=(YES|NO) + Generate and install the CMake config-file package. + The default is `NO`. + + -DZ80_WITH_HTML_DOCUMENTATION=(YES|NO) + Build and install the documentation in HTML format. + It requires Doxygen, Sphinx and Breathe. + The default is `NO`. + + -DZ80_WITH_PDF_DOCUMENTATION=(YES|NO) + Build and install the documentation in PDF format. + It requires Doxygen, Sphinx, Breathe, and LaTeX with PDF support. + The default is `NO`. + + -DZ80_WITH_PKGCONFIG_SUPPORT=(YES|NO) + Generate and install the pkg-config file. + The default is `NO`. + + -DZ80_WITH_STANDARD_DOCUMENTS=(YES|NO) + Install the standard text documents distributed with the package: + AUTHORS, COPYING, COPYING.LESSER, HISTORY, README and THANKS. + The default is `NO`. + + -DZ80_WITH_TESTS=(YES|NO) + Build the testing tool. + The default is `NO`. + +The second group of package-specific options configures the source code of the +library by predefining macros that enable optional features: + + -DZ80_WITH_EXECUTE=(YES|NO) + Build the implementation of the `z80_execute` function. + The default is `NO`. + + -DZ80_WITH_FULL_IM0=(YES|NO) + Build the full implementation of the interrupt mode 0 rather than the + reduced one. + The default is `NO`. + + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=(YES|NO) + Enable optional notifications for any `reti` or `retn` instruction + executed during the interrupt mode 0 response. + The default is `NO`. + + -DZ80_WITH_Q=(YES|NO) + Build the implementation of Q. + The default is `NO`. + + -DZ80_WITH_SPECIAL_RESET=(YES|NO) + Build the implementation of the special RESET. + The default is `NO`. + + -DZ80_WITH_UNOFFICIAL_RETI=(YES|NO) + Configure the undocumented instructions ED5Dh, ED6Dh and ED7Dh as `reti` + instead of `retn`. + The default is `NO`. + + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=(YES|NO) + Build the implementation of the bug affecting the Zilog Z80 NMOS, which + causes the P/V flag to be reset when a maskable interrupt is accepted + during the execution of the `ld a,{i|r}` instructions. + The default is `NO`. + +Package maintainers are encouraged to use at least the following options for the +shared library: + + -DZ80_WITH_EXECUTE=YES + -DZ80_WITH_FULL_IM0=YES + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=YES + -DZ80_WITH_Q=YES + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES + +Finally, once the build system is configured according to your needs, build and +install the package: + + $ cmake --build . [--config (Debug|Release|RelWithDebInfo|MinSizeRel)] + # cmake --install . [--config ] [--strip] + +The `--config` option is only necessary for those CMake generators that ignore +`CMAKE_BUILD_TYPE` (e.g., Xcode and Visual Studio). Use `--strip` to remove +debugging information and non-public symbols when installing non-debug builds of +the shared library. + + +4. Integration +=============== + +4.1. As an external dependency in CMake-based projects + +The Z80 library includes a config-file package for integration into CMake-based +projects that must be installed for development. Use `find_package` to find the +`Z80` package. This creates the `Z80` imported library target, which carries the +necessary transitive link dependencies. Optionally, the linking method can be +selected by specifying either the `Shared` or `Static` component. + +Example: + + find_package(Z80 REQUIRED Shared) + target_link_libraries(your-target Z80) + +When not specified as a component, the linking method is selected according to +`Z80_SHARED_LIBS`. If this option is not defined, the config-file uses the type +of library that is installed on the system and, if it finds both the shared and +the static versions, `BUILD_SHARED_LIBS` determines which one to link against. + +4.2. As a CMake subproject + +To embed the Z80 library as a CMake subproject, extract the source code tarballs +of Zeta (https://zeta.st) and Z80 (or clone their respective repositories) into +a subdirectory of another project. Then use `add_subdirectory` in the parent +project to add the Z80 source code tree to the build process (N.B., the Z80 +subproject will automatically find Zeta and import it as an interface library). + +It is advisable to configure the Z80 library in the CMakeLists.txt of the parent +project. This will prevent the user from having to specify configuration options +for the Z80 subproject through the command line when building the main project. + +Example: + + set(Z80_SHARED_LIBS NO CACHE BOOL "") + set(Z80_WITH_Q YES CACHE BOOL "") + set(Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG YES CACHE BOOL "") + + add_subdirectory(dependencies/Z80) + target_link_libraries(your-target Z80) + +It is important to set the `Z80_SHARED_LIBS` option. Otherwise, CMake will build +the library type indicated by `BUILD_SHARED_LIBS`, which may not be the desired +one. + +4.3. Non-CMake-based projects + +The source code of the emulator can be configured at compile time by predefining +a series of macros. Both Z80.h and Z80.c obey the first two explained below. The +rest of the macros are only relevant when compiling Z80.c: + + #define Z80_DEPENDENCIES_HEADER "header-name.h" + Specifies the only external header to `#include`, replacing all others. + Predefine this macro to provide a header file that defines the external + types and macros used by the emulator, thus preventing your project from + depending on Zeta. You can use this when compiling Z80.c as a part of + your project or (if your types do not break the binary compatibility) + when including `` and linking against a pre-built Z80 library. + + #define Z80_STATIC + Restricts the visibility of public symbols. + This macro is required if you are building Z80.c as a static library, + compiling it directly as a part of your project, or linking your program + against the static version of the Z80 library. In either of these cases, + make sure this macro is defined before including `"Z80.h"` or ``. + + #define Z80_WITH_LOCAL_HEADER + Tells Z80.c to `#include "Z80.h"` instead of ``. + +The optional features of the emulator mentioned in section 3 of this document +are disabled by default. If you compile Z80.c as a part of your project, enable +those features you need by predefining their respective activation macros. They +have the same name as their CMake equivalents: + + #define Z80_WITH_EXECUTE + #define Z80_WITH_FULL_IM0 + #define Z80_WITH_IM0_RETX_NOTIFICATIONS + #define Z80_WITH_Q + #define Z80_WITH_SPECIAL_RESET + #define Z80_WITH_UNOFFICIAL_RETI + #define Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG + +Except for `Z80_DEPENDENCIES_HEADER`, the above macros can be empty; the source +code only checks whether they are defined. + +Please note that the activation of some of the optional features affects the +speed of the emulator due to various factors (read the documentation for more +details). + + +5. License +=========== + +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 of the License, or (at your option) any +later version. + +This library is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this library. If not, see . + +________________________________________________________________________________ +Last update: 2023-12-31 README EOF diff --git a/projects/Z80/README.md b/projects/Z80/README.md new file mode 100644 index 0000000..a20a691 --- /dev/null +++ b/projects/Z80/README.md @@ -0,0 +1,881 @@ +# Zilog Z80 CPU Emulator + +[![](https://zxe.io/software/Z80/assets/images/documentation-badge.svg)](https://zxe.io/software/Z80/documentation/latest) +[![](https://github.com/redcode/Z80/actions/workflows/build-and-test-library.yml/badge.svg)](https://github.com/redcode/Z80/actions/workflows/build-and-test-library.yml) +[![](https://github.com/redcode/Z80/actions/workflows/build-documentation.yml/badge.svg)](https://github.com/redcode/Z80/actions/workflows/build-documentation.yml) +[![](https://zxe.io/software/Z80/assets/images/chat-badge.svg)](https://zxe.io/software/Z80/chat) +![](https://zxe.io/software/Z80/assets/images/mentioned-in-awesome-badge.svg) + +## Introduction + + + +The [Z80 library](https://zxe.io/software/Z80) implements a fast, small and accurate [emulator](https://en.wikipedia.org/wiki/Emulator) of the [Zilog Z80](https://en.wikipedia.org/wiki/Zilog_Z80). It emulates all that is known to date about this CPU, including the undocumented behaviors, [MEMPTR](https://zxpress.ru/zxnet/zxnet.pc/5909), [Q](https://worldofspectrum.org/forums/discussion/41704) and the [special RESET](http://www.primrosebank.net/computers/z80/z80_special_reset.htm). It also has the honor of having been the first open-source project to provide full emulation of the interrupt mode 0. + +The source code is written in [ANSI C](https://en.wikipedia.org/wiki/ANSI_C) for maximum portability and is extensively commented. The aim has been to write a well-structured, easy-to-understand piece of software; something solid and elegant that can [stand the test of time](https://web.archive.org/web/20231101002815/https://josem.co/the-beauty-of-finished-software/) with no need for major changes. + +## Accuracy + +This Z80 CPU emulator has a classic design with instruction-level granularity that delivers the best performance, whilst offering a reasonable flexibility to achieve [precision down to the T-state level](https://github.com/agaxia/Z80InsnClock). + +Instruction-level granularity implies that, except in a few well-defined cases, the execution of a given instruction cannot stop until all its internal M-cycles have been processed (i.e., instructions are not divided into micro-operations). Moreover, registers are modified only once per instruction and the [T-state counter](https://zxe.io/software/Z80/documentation/latest/APIReference.html#c.Z80.cycles) is normally updated after a full instruction has been executed. + +That said, instructions, flags, memory accesses, interrupts, clock cycles, etc., are accurately emulated according to the available [technical documentation](https://github.com/redcode/Z80/wiki/Technical-literature), the findings made after decades of research on the Z80 and [electronic simulations](https://github.com/redcode/Z80/wiki/Simulators). And, of course, the emulator passes the most exhaustive [tests](https://github.com/redcode/Z80/wiki/Tests) written to date, including all three major test suites: + +### [Zilog Z80 CPU Test Suite](https://github.com/raxoft/z80test), by [Patrik Rak](https://github.com/raxoft) + +This set of programs is intended to help the emulator authors to reach the desired level of the CPU emulation authenticity. Each of the included programs performs an exhaustive computation using each of the tested Z80 instructions, compares the results with values obtained from a real [Sinclair ZX Spectrum 48K](https://en.wikipedia.org/wiki/ZX_Spectrum) with Zilog Z80 CPU, and reports any deviations detected. + +
+ Results (v1.0) + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ z80full.tap +
+
+ Tests all flags and registers. +
+ +
+ z80doc.tap +
+
+ Tests all registers, but only officially documented flags. +
+ + + +
+ +
+ z80flags.tap +
+
+ Tests all flags, ignores registers. +
+ +
+ z80docflags.tap +
+
+ Tests documented flags only, ignores registers. +
+ + + +
+ +
+ z80ccf.tap +
+
+ Tests all flags after executing ccf after each instruction tested. +
+ +
+ z80memptr.tap +
+
+ Tests all flags after executing bit N,(hl) after each instruction tested. +
+ + + +
+
+
+ Results (v1.2a) + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ z80full.tap +
+
+ Tests all flags and registers. +
+ +
+ z80doc.tap +
+
+ Tests all registers, but only officially documented flags. +
+ + + +
+ +
+ z80flags.tap +
+
+ Tests all flags, ignores registers. +
+ +
+ z80docflags.tap +
+
+ Tests documented flags only, ignores registers. +
+ + + +
+ +
+ z80ccf.tap +
+
+ Tests all flags after executing ccf after each instruction tested. +
+ +
+ z80memptr.tap +
+
+ Tests all flags after executing bit N,(hl) after each instruction tested. +
+ + + +
+
+ +### Z80 Test Suite, by Mark Woodmass + +This suite performs a series of tests to verify the MEMPTR documents _([English](https://zx-pk.ru/attachment.php?attachmentid=2989), [Russian](https://zx-pk.ru/attachment.php?attachmentid=2984))_, which are spot on, as well as a brief run through several of the `CBh/DDh/FDh` opcode ranges. The test results in the program are compared against those from a [NEC D780C-1](https://www.cpu-world.com/CPUs/Z80/NEC-D780C-1.html) CPU, but Simon Conway kindly tested several other Z80 clones, confirming the same results. + +
+ Results + + + + + + + + +
+ +
+ z80tests.tap +
+
+ + + +
+
+ +### Z80 Instruction Set Exerciser, by Frank D. Cringle + +Frank Cringle's _Z80 Instruction Set Exerciser_ attempts to execute every Z80 opcode, putting them through a cycle of tests and comparing the results to actual results from running the code on a real Z80. The exerciser is supplied with Frank's [Yaze](ftp://ftp.ping.de/pub/misc/emulators/yaze-1.10.tar.gz) (Yet Another Z80 Emulator). It is often difficult to track down, so [Jonathan Graham Harston](https://mdfs.net/User/JGH) put it together [here](https://mdfs.net/Software/Z80/Exerciser), as well as [some conversions](https://mdfs.net/Software/Z80/Exerciser/Spectrum). The latest release of Yaze is available at [Andreas Gerlich's website](https://www.mathematik.uni-ulm.de/users/ag/yaze-ag). + +
+ Results (Jonathan Graham Harston's version) + + + + + + + + + +
+ +
+ zexdoc.tap +
+
+ Tests officially documented flag effects. +
+ +
+ zexall.tap +
+
+ Tests all flag changes. +
+ + + +
+
+
+ Results (Jan Bobrowski's version) + + + + + + + + + +
+ +
+ zexfix.tap +
+
+ Tests all flag changes. +
+ +
+ zexbit.tap +
+
+ Tests all flag changes of the bit instructions. +
+ + + +
+
+
+ Results (Patrik Rak's version) + + + + + + + +
+ +
+ zexall2.tap +
+
+ +
+
+ +## Installation + +### Debian, Ubuntu and other Debian-based Linux distributions + +First, add the `zxe` repository and update the package index: + +```shell +sudo mkdir -pm700 /root/.gnupg +sudo mkdir -pm755 /etc/apt/keyrings +sudo gpg --no-default-keyring --keyring /etc/apt/keyrings/zxe-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FE214A38D6A0C01D9AF514EE841EA3BD3A7E1487 +echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/zxe-archive-keyring.gpg] https://zxe.io/repos/apt stable main" | sudo tee /etc/apt/sources.list.d/zxe.list +sudo apt update +``` + +Next, install the library package: + +```shell +sudo apt install libz80 +``` + +In case you need to build software that requires the Z80 library, install the development package too: + +```shell +sudo apt install libz80-dev +``` + +### Gentoo + +First, add and sync the [`zxe`](https://github.com/redcode/zxe-gentoo-overlay) overlay: + +```shell +eselect repository add zxe git https://github.com/redcode/zxe-gentoo-overlay.git +emaint sync --repo zxe +``` + +Then install the library: + +```shell +emerge emulation-libs/z80 +``` + +### Homebrew + +```shell +brew install redcode/zxe/z80 +``` + +### Windows + +Pre-built binaries for Windows are available on the [download](https://zxe.io/software/Z80/download) page. + +## Installation from sources + +You will need [CMake](https://cmake.org) v3.14 or later to build the package and, optionally, recent versions of [Doxygen](https://www.doxygen.nl), [Sphinx](https://www.sphinx-doc.org) and [Breathe](https://www.breathe-doc.org) to compile the documentation. Also, make sure that you have [LaTeX](https://www.latex-project.org) with PDF support installed on your system if you want to generate the documentation in PDF format. + +The emulator requires some types and macros included in [Zeta](https://zeta.st), a dependency-free, [header-only](https://en.wikipedia.org/wiki/Header-only) library used to retain compatibility with most C compilers. Install Zeta or extract its [source code tarball](https://zeta.st/download) to the root directory of the Z80 project or its parent directory. Zeta is the sole dependency; the emulator is a freestanding implementation and as such does not depend on the [C standard library](https://en.wikipedia.org/wiki/C_standard_library). + +Once the prerequisites are met, create a directory and run `cmake` from there to prepare the build system: + +```shell +mkdir build +cd build +cmake [options] +``` + +The resulting build files can be configured by passing options to `cmake`. To show a complete list of those available along with their current settings, type the following: + +```shell +cmake -LAH +``` + +If in doubt, read the [CMake documentation](https://cmake.org/documentation/) for more information on configuration options. The following are some of the most relevant standard options of CMake: + +* **-D[BUILD_SHARED_LIBS](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html)=(YES|NO)** + Generate shared libraries rather than static libraries. + The default is `NO`. + +* **-D[CMAKE_BUILD_TYPE](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html)=(Debug|Release|RelWithDebInfo|MinSizeRel)** + Choose the type of build (configuration) to generate. + The default is `Release`. + +* **-D[CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html)="\"** + Specify the installation prefix. + The default is `"/usr/local"` (on [UNIX](https://en.wikipedia.org/wiki/Unix) and [UNIX-like](https://en.wikipedia.org/wiki/Unix-like) operating systems). + +Package-specific options are prefixed with `Z80_` and can be divided into two groups. The first one controls aspects not related to the source code of the library: + +* **`-DZ80_DEPOT_LOCATION=""`** + Specify the directory or URL of the depot containing the test files (i.e., the firmware and software required by the [testing tool](#running-the-tests)). + The default is `"http://zxe.io/depot"`. + +* **`-DZ80_FETCH_TEST_FILES=(YES|NO)`** + Copy or download the test files from the depot to the build directory. + The default is `NO`. + +* **`-DZ80_INSTALL_CMAKEDIR=""`** + Specify the directory in which to install the CMake [config-file package](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages). + The default is "${[CMAKE_INSTALL_LIBDIR](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)}/cmake/Z80". + +* **`-DZ80_INSTALL_PKGCONFIGDIR=""`** + Specify the directory in which to install the [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config) [file](https://people.freedesktop.org/~dbn/pkg-config-guide.html). + The default is "${[CMAKE_INSTALL_LIBDIR](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)}/pkgconfig". + +* **`-DZ80_NOSTDLIB_FLAGS=(Auto|"[[;...]]")`** + Specify the linker flags used to avoid linking against system libraries. + The default is `Auto` (autoconfigure flags). If you get linker errors, set this option to `""`. + +* **`-DZ80_OBJECT_LIBS=(YES|NO)`** + Build the emulator as an [object library](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#object-libraries). + This option takes precedence over [`BUILD_SHARED_LIBS`](#cmake_option_build_shared_libs) and [`Z80_SHARED_LIBS`](#cmake_option_z80_shared_libs). If enabled, the build system will ignore [`Z80_WITH_CMAKE_SUPPORT`](#cmake_option_z80_with_cmake_support) and [`Z80_WITH_PKGCONFIG_SUPPORT`](#cmake_option_z80_with_pkgconfig_support), as no libraries or support files will be installed. + The default is `NO`. + +* **`-DZ80_SHARED_LIBS=(YES|NO)`** + Build the emulator as a shared library, rather than static. + This option takes precedence over [`BUILD_SHARED_LIBS`](#cmake_option_build_shared_libs). + Not defined by default. + +* **`-DZ80_SPHINX_HTML_THEME="[]"`** + Specify the Sphinx theme for the documentation in HTML format. + The default is `""` (use the default theme). + +* **`-DZ80_WITH_CMAKE_SUPPORT=(YES|NO)`** + Generate and install the CMake [config-file package](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages). + The default is `NO`. + +* **`-DZ80_WITH_HTML_DOCUMENTATION=(YES|NO)`** + Build and install the documentation in HTML format. + It requires Doxygen, Sphinx and Breathe. + The default is `NO`. + +* **`-DZ80_WITH_PDF_DOCUMENTATION=(YES|NO)`** + Build and install the documentation in PDF format. + It requires Doxygen, Sphinx, Breathe, and LaTeX with PDF support. + The default is `NO`. + +* **`-DZ80_WITH_PKGCONFIG_SUPPORT=(YES|NO)`** + Generate and install the [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config) [file](https://people.freedesktop.org/~dbn/pkg-config-guide.html). + The default is `NO`. + +* **`-DZ80_WITH_STANDARD_DOCUMENTS=(YES|NO)`** + Install the standard text documents distributed with the package: [`AUTHORS`](AUTHORS), [`COPYING`](COPYING), [`COPYING.LESSER`](COPYING.LESSER), [`HISTORY`](HISTORY), [`README`](README) and [`THANKS`](THANKS). + The default is `NO`. + +* **`-DZ80_WITH_TESTS=(YES|NO)`** + Build the [testing tool](#running-the-tests). + The default is `NO`. + +The second group of package-specific options configures the source code of the library by predefining macros that enable [optional features](https://zxe.io/software/Z80/documentation/latest/Introduction.html#optional-features): + +* **`-DZ80_WITH_EXECUTE=(YES|NO)`** + Build the implementation of the [`z80_execute`](https://zxe.io/software/Z80/documentation/latest/APIReference.html#c.z80_execute) function. + The default is `NO`. + +* **`-DZ80_WITH_FULL_IM0=(YES|NO)`** + Build the full implementation of the interrupt mode 0 rather than the reduced one. + The default is `NO`. + +* **`-DZ80_WITH_IM0_RETX_NOTIFICATIONS=(YES|NO)`** + Enable optional notifications for any `reti` or `retn` instruction executed during the interrupt mode 0 response. + The default is `NO`. + +* **`-DZ80_WITH_Q=(YES|NO)`** + Build the implementation of [Q](https://worldofspectrum.org/forums/discussion/41704). + The default is `NO`. + +* **`-DZ80_WITH_SPECIAL_RESET=(YES|NO)`** + Build the implementation of the [special RESET](http://www.primrosebank.net/computers/z80/z80_special_reset.htm). + The default is `NO`. + +* **`-DZ80_WITH_UNOFFICIAL_RETI=(YES|NO)`** + Configure the undocumented instructions `ED5Dh`, `ED6Dh` and `ED7Dh` as `reti` instead of `retn`. + The default is `NO`. + +* **`-DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=(YES|NO)`** + Build the implementation of the bug affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a maskable interrupt is accepted during the execution of the ld a,{i|r} instructions. + The default is `NO`. + +Package maintainers are encouraged to use at least the following options for the shared library: + +``` +-DZ80_WITH_EXECUTE=YES +-DZ80_WITH_FULL_IM0=YES +-DZ80_WITH_IM0_RETX_NOTIFICATIONS=YES +-DZ80_WITH_Q=YES +-DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES +``` + +Finally, once the build system is configured according to your needs, build and install the package: + +```shell +cmake --build . [--config (Debug|Release|RelWithDebInfo|MinSizeRel)] +cmake --install . [--config ] [--strip] +``` + +The [`--config`](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-config) option is only necessary for those [CMake generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) that ignore [`CMAKE_BUILD_TYPE`](#cmake_option_cmake_build_type) (e.g., Xcode and Visual Studio). Use [`--strip`](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-install-strip) to remove debugging information and non-public symbols when installing non-debug builds of the shared library. + +### TL;DR + +Use the following to build the emulator as a shared library and install it along with the development files into `$HOME/.local`: + +```shell +mkdir work && cd work +git clone https://github.com/redcode/Zeta.git +git clone https://github.com/redcode/Z80.git +cd Zeta +mkdir build && cd build +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$HOME/.local \ + -DZeta_WITH_CMAKE_SUPPORT=YES \ + -DZeta_WITH_PKGCONFIG_SUPPORT=YES \ + .. +cmake --install . --config Release +cd ../../Z80 +mkdir build && cd build +cmake \ + -DBUILD_SHARED_LIBS=YES \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$HOME/.local \ + -DZ80_WITH_CMAKE_SUPPORT=YES \ + -DZ80_WITH_PKGCONFIG_SUPPORT=YES \ + -DZ80_WITH_EXECUTE=YES \ + -DZ80_WITH_FULL_IM0=YES \ + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=YES \ + -DZ80_WITH_Q=YES \ + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES \ + .. +cmake --build . --config Release +cmake --install . --config Release --strip +``` + +**[ build-and-install-Z80.sh](https://zxe.io/software/Z80/scripts/build-and-install-Z80.sh)** + +## Running the tests + +The package includes a tool called [`test-Z80`](sources/test-Z80.c) capable of running the most relevant [CP/M](https://en.wikipedia.org/wiki/CP/M) and [ZX Spectrum](https://en.wikipedia.org/wiki/ZX_Spectrum) versions of the [major test suites](#major_test_suites). Configure the build system with -D[Z80_WITH_TESTS](#cmake_option_z80_with_tests)=YES to enable its compilation and -D[Z80_FETCH_TEST_FILES](#cmake_option_z80_fetch_test_files)=YES to download the firmware and software required. Also note that the Z80 library must be built with -D[Z80_WITH_Q](#cmake_option_z80_with_q)=YES to be able to pass [Patrik Rak's tests](#zilog-z80-cpu-test-suite-by-patrik-rak). + +Once you have built the package, type the following to run all tests: + +```shell +./test-Z80 -p depot/firmware -p depot/software/POSIX -p "depot/software/ZX Spectrum" -a +``` + +The tool supports options and can run the tests individually (type ./test-Z80 -h for help). If you prefer to run all tests through [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html), use this command: + +```shell +ctest --verbose --build-config (Debug|Release|RelWithDebInfo|MinSizeRel) +``` + +The complete logs generated by `test-Z80` emulating different CPU variants are available here: + +* [Zilog NMOS](https://zxe.io/software/Z80/tests/logs/test-Z80%20v0.2%20Results%20-%20Zilog%20NMOS.txt) +* [Zilog CMOS](https://zxe.io/software/Z80/tests/logs/test-Z80%20v0.2%20Results%20-%20Zilog%20CMOS.txt) +* [NEC NMOS](https://zxe.io/software/Z80/tests/logs/test-Z80%20v0.2%20Results%20-%20NEC%20NMOS.txt) +* [ST CMOS](https://zxe.io/software/Z80/tests/logs/test-Z80%20v0.2%20Results%20-%20ST%20CMOS.txt) + +> [!NOTE] +> The CRC errors in the logs of the NEC NMOS variant **are normal** and match the [values obtained on real hardware](https://jisanchez.com/test-a-dos-placas-de-zx-spectrum). The ST CMOS variant is currently [under investigation](https://github.com/redcode/Z80_XCF_Flavor/issues/2). + +### TL;DR + +Use the following to build and test the emulator: + +```shell +mkdir work && cd work +git clone https://github.com/redcode/Zeta.git +git clone https://github.com/redcode/Z80.git +cd Z80 +mkdir build && cd build +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DZ80_FETCH_TEST_FILES=YES \ + -DZ80_WITH_TESTS=YES \ + -DZ80_WITH_EXECUTE=YES \ + -DZ80_WITH_FULL_IM0=YES \ + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=YES \ + -DZ80_WITH_Q=YES \ + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES \ + .. +cmake --build . --config Release +ctest --verbose --build-config Release +``` + +**[ build-and-test-Z80.sh](https://zxe.io/software/Z80/scripts/build-and-test-Z80.sh)    [ build-and-test-Z80.bat](https://zxe.io/software/Z80/scripts/build-and-test-Z80.bat)** + +## Integration + +### As an external dependency in CMake-based projects + +The Z80 library [includes](#cmake_option_z80_with_cmake_support) a [config-file package](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages) for integration into CMake-based projects that must be installed for development. Use [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) to find the `Z80` package. This creates the `Z80` imported library target, which carries the necessary transitive link dependencies. Optionally, the linking method can be selected by specifying either the `Shared` or `Static` component. + +Example: + +```cmake +find_package(Z80 REQUIRED Shared) +target_link_libraries(your-target Z80) +``` + +When not specified as a component, the linking method is selected according to [`Z80_SHARED_LIBS`](#cmake_option_z80_shared_libs). If this option is not defined, the config-file uses the type of library that is installed on the system and, if it finds both the shared and the static versions, [`BUILD_SHARED_LIBS`](#cmake_option_build_shared_libs) determines which one to link against. + +### As a CMake subproject + +To embed the Z80 library as a CMake subproject, extract the source code tarballs of [Zeta](https://zeta.st/download) and [Z80](https://zxe.io/software/Z80/download) (or clone their respective repositories) into a subdirectory of another project. Then use [`add_subdirectory`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an [interface library](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries)). + +It is advisable to configure the Z80 library in the `CMakeLists.txt` of the parent project. This will prevent the user from having to specify [configuration options for the Z80 subproject](#cmake_package_options) through the command line when building the main project. + +Example: + +```cmake +set(Z80_SHARED_LIBS NO CACHE BOOL "") +set(Z80_WITH_Q YES CACHE BOOL "") +set(Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG YES CACHE BOOL "") + +add_subdirectory(dependencies/Z80) +target_link_libraries(your-target Z80) +``` + +It is important to set the [`Z80_SHARED_LIBS`](#cmake_option_z80_shared_libs) option. Otherwise, CMake will build the library type indicated by [`BUILD_SHARED_LIBS`](#cmake_option_build_shared_libs), which may not be the desired one. + +### Non-CMake-based projects + +The source code of the emulator can be configured at compile time by predefining a series of macros. Both [`Z80.h`](API/Z80.h) and [`Z80.c`](sources/Z80.c) obey the first two explained below. The rest of the macros are only relevant when compiling `Z80.c`: + +* **`#define Z80_DEPENDENCIES_HEADER "header-name.h"`** + Specifies the only external header to `#include`, replacing all others. + Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on [Zeta](https://zeta.st). You can use this when compiling `Z80.c` as a part of your project or (if your types do not break the binary compatibility) when including `` and linking against a pre-built Z80 library. + +* **`#define Z80_STATIC`** + Restricts the visibility of public symbols. + This macro is required if you are building `Z80.c` as a static library, compiling it directly as a part of your project, or linking your program against the static version of the Z80 library. In either of these cases, make sure this macro is defined before including `"Z80.h"` or ``. + +* **`#define Z80_WITH_LOCAL_HEADER`** + Tells `Z80.c` to #include "Z80.h" instead of ``. + +The optional features of the emulator mentioned in "[Installation from sources](#installation-from-sources)" are disabled by default. If you compile `Z80.c` as a part of your project, enable those features you need by predefining their respective activation macros. They have the same name as their [CMake equivalents](#cmake_package_source_code_options): + +* **#define [Z80_WITH_EXECUTE](#cmake_option_z80_with_execute)** +* **#define [Z80_WITH_FULL_IM0](#cmake_option_z80_with_full_im0)** +* **#define [Z80_WITH_IM0_RETX_NOTIFICATIONS](#cmake_option_z80_with_im0_retx_notifications)** +* **#define [Z80_WITH_Q](#cmake_option_z80_with_q)** +* **#define [Z80_WITH_SPECIAL_RESET](#cmake_option_z80_with_special_reset)** +* **#define [Z80_WITH_UNOFFICIAL_RETI](#cmake_option_z80_with_unofficial_reti)** +* **#define [Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG](#cmake_option_z80_with_zilog_nmos_ld_a_ir_bug)** + +Except for [`Z80_DEPENDENCIES_HEADER`](#macro_z80_dependencies_header), the above macros can be empty; the source code only checks whether they are defined. + +> [!NOTE] +> The activation of some of the optional features affects the speed of the emulator due to various factors (read the [documentation](https://zxe.io/software/Z80/documentation/latest/Introduction.html#optional-features) for more details). + +## Showcase + +This emulator has been used by the following projects (listed in alphabetical order): + +* **[Augmentinel](https://simonowen.com/spectrum/augmentinel/)** _by [Simon Owen](https://simonowen.com)_ ⟩ [GitHub](https://github.com/simonowen/augmentinel) +* **CPM-Emulator** _by [Marc Sibert](https://github.com/Marcussacapuces91)_ ⟩ [GitHub](https://github.com/Marcussacapuces91/CPM-Emulator) +* **F80: simple Z80 system running on an FPGA** _by [Richard J. Prinz](https://www.min.at/prinz)_ ⟩ [GitHub](https://github.com/rprinz08/f80) +* **[Google Capture the Flag (2021)](https://capturetheflag.withgoogle.com)** _by [Google](https://www.google.com)_ ⟩ [GitHub](https://github.com/google/google-ctf) +* **pico-sorcerer-2** _by [fruit-bat](https://github.com/fruit-bat)_ ⟩ [GitHub](https://github.com/fruit-bat/pico-sorcerer-2) +* **pico-zxspectrum** _by [fruit-bat](https://github.com/fruit-bat)_ ⟩ [GitHub](https://github.com/fruit-bat/pico-zxspectrum) +* **[tihle: a unique TI calculator emulator](https://www.taricorp.net/2020/introducing-tihle/)** _by [Peter Marheine](https://www.taricorp.net/about/)_ ⟩ [GitHub](https://github.com/tari/tihle) · [GitLab](https://gitlab.com/taricorp/tihle) +* **[TileMap](https://simonowen.com/spectrum/tilemap/)** _by [Simon Owen](https://simonowen.com/)_ ⟩ [GitHub](https://github.com/simonowen/tilemap) +* **tranZPUterFusionX** _by [Philip Smart](https://eaw.app/about/)_ ⟩ [GitHub](https://github.com/pdsmart/tzpuFusionX) +* **Zemu** _by [Jay Valentine](https://jayvalentine.github.io/)_ ⟩ [GitHub](https://github.com/jayvalentine/zemu) · [RubyGems](https://rubygems.org/gems/zemu) + +## Thanks + +Many thanks to the following individuals (in alphabetical order): + +* **Akimov, Vadim (lvd)** + * For testing the library on many different platforms and CPU architectures. +* **azesmbog** :trophy: + 1. For validating tests on real hardware. [1](#r1) + 2. For discovering the unstable behavior of the `ccf/scf` instructions. + 3. For his invaluable help. +* **Banks, David (hoglet)** :trophy: + 1. For cracking the flag behavior of the block instructions. [2](#r2), [3](#r3) + 2. For his research on the behavior of the `ccf/scf` instructions. [3](#r3) +* **Beliansky, Anatoly (Tolik_Trek)** + * For validating tests on real hardware. [4](#r4) +* **Bobrowski, Jan** + * For fixing the _"Z80 Full Instruction Set Exerciser for Spectrum"_. [5](#r5) +* **boo_boo** :trophy: + * For cracking the behavior of the MEMPTR register. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Brady, Stuart** + * For his research on the behavior of the `ccf/scf` instructions. [10](#r10) +* **Brewer, Tony** :trophy: + 1. For his research on the special RESET. [11](#r11), [12](#r12) + 2. For helping to crack the flag behavior of the block instructions. [2](#r2) + 3. For conducting low-level tests on real hardware. [2](#r2) + 4. For helping me to test different undocumented behaviors of the Zilog Z80. +* **Bystrov, Dmitry (Alone Coder)** + * For validating tests on real hardware. [4](#r4) +* **Chandler, Richard** + 1. For his corrections to the documentation. + 2. For validating tests on real hardware. [13](#r13) +* **Chunin, Roman (CHRV)** + * For testing the behavior of the MEMPTR register on real Z80 chips. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Conway, Simon (BadBeard)** + * For validating the _"Z80 Test Suite"_ on several Z80 clones. [14](#r14) +* **Cooke, Simon** :trophy: + * For discovering how the out (c),0 instruction behaves on the Zilog Z80 CMOS. [15](#r15) +* **Cringle, Frank D.** + * For writing the _"Z80 Instruction Set Exerciser"_. [16](#r16) +* **Devic, Goran** + * For his research on undocumented behaviors of the Z80 CPU. [17](#r17) +* **Dunn, Paul (ZXDunny)** + * For his corrections to the documentation. +* **Equinox** + * For his corrections to the documentation. +* **Flammenkamp, Achim** + * For his article on Z80 interrupts. [18](#r18) +* **Gimeno Fortea, Pedro** :trophy: + 1. For his research work. [19](#r19) + 2. For writing the first-ever ZX Spectrum emulator. [20](#r20), [21](#r21) +* **goodboy** + * For testing the behavior of the MEMPTR register on real Z80 chips. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Greenway, Ian** + * For testing the behavior of the `ccf/scf` instructions on real hardware. [10](#r10), [22](#r22) +* **Harston, Jonathan Graham** + 1. For his research work. + 2. For his technical documents about the Zilog Z80. [23](#r23), [24](#r24), [25](#r25) + 3. For porting the _"Z80 Instruction Set Exerciser"_ to the ZX Spectrum. [26](#r26) +* **Helcmanovsky, Peter (Ped7g)** :medal_military: + 1. For helping me to write the _"IN-MEMPTR"_ test. + 2. For writing the _"Z80 Block Flags Test"_. [27](#r27), [28](#r28) + 3. For writing the _"Z80 CCF SCF Outcome Stability"_ test. [28](#r28) + 4. For writing the _"Z80 INT Skip"_ test. [28](#r28) + 5. For his research on the unstable behavior of the `ccf/scf` instructions. + 6. For his invaluable help. +* **Iborra Debón, Víctor (Eremus)** + * For validating tests on real hardware. +* **icebear** + * For testing the behavior of the MEMPTR register on real Z80 chips. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **ICEknight** + * For validating tests on real hardware. +* **Kladov, Vladimir** :trophy: + * For cracking the behavior of the MEMPTR register. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Krook, Magnus** + * For validating tests on real hardware. [29](#r29) +* **London, Matthew (mattinx)** + * For validating tests on real hardware. +* **Martínez Cantero, Ricardo (Kyp)** + * For validating tests on real hardware. +* **Molodtsov, Aleksandr** + * For testing the behavior of the MEMPTR register on real Z80 chips. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Nair, Arjun** + * For validating tests on real hardware. [27](#r27) +* **Nicolás-González, César** + * For helping me to investigate the unstable behavior of the `ccf/scf` instructions. +* **Ortega Sosa, Sofía** + 1. For optimizing the emulator. + 2. For her support. +* **Owen, Simon** + * For the idea of the hooking method used in this emulator. +* **Ownby, Matthew P.** + * For his research on the state of the registers after POWER-ON. [30](#r30) +* **Rak, Patrik** :trophy: + 1. For improving the _"Z80 Instruction Set Exerciser for Spectrum"_. [31](#r31) + 2. For cracking the behavior of the `ccf/scf` instructions. [14](#r14), [31](#r31) + 3. For writing the _"Zilog Z80 CPU Test Suite"_. [31](#r31), [32](#r32) + 4. For his research on the unstable behavior of the `ccf/scf` instructions. +* **Rodríguez Jódar, Miguel Ángel (mcleod_ideafix)** + * For his research on the state of the registers after POWER-ON/RESET. [33](#r33) +* **Rodríguez Palomino, Mario (r-lyeh)** + * For teaching me how emulators work. +* **Sainz de Baranda y Romero, Manuel** + * For teaching me programming and giving me my first computer. +* **Sánchez Ordiñana, José Ismael (Vaporatorius)** + * For validating tests on real hardware. [34](#r34), [35](#r35) +* **Sevillano Mancilla, Marta (TheMartian)** + * For validating tests on real hardware. [13](#r13) +* **Stevenson, Dave** + 1. For testing the special RESET on real hardware. [11](#r11) + 2. For conducting low-level tests on real hardware. [36](#r36) +* **Vučenović, Zoran** + * For writing the [Pascal binding](sources/Z80.pas). +* **Weissflog, Andre (Floh)** :trophy: + 1. For discovering that the `reti/retn` instructions defer the acceptance of the maskable interrupt. [37](#r37) + 2. For writing the _"Visual Z80 Remix"_ simulator. [38](#r38) +* **Wilkinson, Oli (evolutional)** + * For validating tests on real hardware. [27](#r27) +* **Wlodek** + * For testing the behavior of the MEMPTR register on real Z80 chips. [6](#r6), [7](#r7), [8](#r8), [9](#r9) +* **Woodmass, Mark (Woody)** :medal_military: + 1. For his invaluable contributions to the emuscene. + 2. For writing the _"Z80 Test Suite"_. [14](#r14) + 3. For his research on the behavior of the `ccf/scf` instructions. [39](#r39) + 4. For writing the _"HALT2INT"_ test. + 5. For writing the _"EIHALT"_ test. +* **Young, Sean** :trophy: + 1. For his research work. + 2. For his technical documents about the Zilog Z80. [19](#r19), [30](#r30), [40](#r40) +* **ZXGuesser** + * For validating tests on real hardware. + +### References + +1. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83384#p83384 +2. https://stardot.org.uk/forums/viewtopic.php?t=15464 + * https://stardot.org.uk/forums/viewtopic.php?p=211042#p211042 + * https://stardot.org.uk/forums/viewtopic.php?p=212021#p212021 +3. Banks, David (2018-08-21). _"Undocumented Z80 Flags"_ rev. 1.0. + * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags + * https://stardot.org.uk/forums/download/file.php?id=39831 +4. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83041#p83041 +5. http://wizard.ae.krakow.pl/~jb/qaop/tests.html +6. https://zxpress.ru/zxnet/zxnet.pc/5909 +7. https://zx-pk.ru/threads/2506-komanda-bit-n-(hl).html +8. https://zx-pk.ru/threads/2586-prosba-realshchikam-ot-emulyatorshchikov.html +9. boo_boo; Kladov, Vladimir (2006-03-29). _"MEMPTR, Esoteric Register of the Zilog Z80 CPU"_. + * https://zx-pk.ru/showpost.php?p=43688 + * https://zx-pk.ru/attachment.php?attachmentid=2984 + * https://zx-pk.ru/showpost.php?p=43800 + * https://zx-pk.ru/attachment.php?attachmentid=2989 +10. https://sourceforge.net/p/fuse-emulator/mailman/message/6929573 +11. Brewer, Tony (2014-12). _"Z80 Special Reset"_. + * http://primrosebank.net/computers/z80/z80_special_reset.htm +12. https://stardot.org.uk/forums/viewtopic.php?p=357136#p357136 +13. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=10555 +14. https://worldofspectrum.org/forums/discussion/20345 +15. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ +16. Cringle, Frank D. (1998-01-28). _"Yaze - Yet Another Z80 Emulator"_ v1.10. + * ftp://ftp.ping.de/pub/misc/emulators/yaze-1.10.tar.gz +17. https://baltazarstudios.com/zilog-z80-undocumented-behavior +18. Flammenkamp, Achim. _"Interrupt Behaviour of the Z80 CPU"_. + * http://z80.info/interrup.htm +19. Young, Sean (1998-10). _"Z80 Undocumented Features (in Software Behaviour)"_ v0.3. + * http://www.msxnet.org/tech/Z80/z80undoc.txt +20. https://elmundodelspectrum.com/desenterrando-el-primer-emulador-de-spectrum +21. https://elmundodelspectrum.com/con-vosotros-el-emulador-de-pedro-gimeno-1989 +22. https://sourceforge.net/p/fuse-emulator/mailman/message/4502844 +23. Harston, Jonathan Graham (2008). _"Full Z80 Opcode List Including Undocumented Opcodes"_ v0.11 (revised). + * https://mdfs.net/Docs/Comp/Z80/OpList +24. Harston, Jonathan Graham (2012). _"Z80 Microprocessor Undocumented Instructions"_ v0.15. + * https://mdfs.net/Docs/Comp/Z80/UnDocOps +25. Harston, Jonathan Graham (2014). _"Z80 Opcode Map"_ v0.10 (revised). + * https://mdfs.net/Docs/Comp/Z80/OpCodeMap +26. https://mdfs.net/Software/Z80/Exerciser/Spectrum +27. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=6102 +28. https://github.com/MrKWatkins/ZXSpectrumNextTests +29. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83157#p83157 +30. Young, Sean (2005-09-18). _"Undocumented Z80 Documented, The"_ v0.91. + * http://www.myquest.nl/z80undocumented + * http://www.myquest.nl/z80undocumented/z80-documented-v0.91.pdf +31. https://worldofspectrum.org/forums/discussion/41704 + * http://zxds.raxoft.cz/taps/misc/zexall2.zip +32. https://worldofspectrum.org/forums/discussion/41834 + * http://zxds.raxoft.cz/taps/misc/z80test-1.0.zip + * https://github.com/raxoft/z80test +33. https://worldofspectrum.org/forums/discussion/34574 +34. https://worldofspectrum.org/forums/discussion/comment/668760/#Comment_668760 +35. https://jisanchez.com/test-a-dos-placas-de-zx-spectrum +36. https://stardot.org.uk/forums/viewtopic.php?p=212360#p212360 +37. Weissflog, Andre (2021-12-17). _"New Cycle-Stepped Z80 Emulator, A"_. + * https://floooh.github.io/2021/12/17/cycle-stepped-z80.html +38. https://github.com/floooh/v6502r +39. https://groups.google.com/g/comp.sys.sinclair/c/WPsPr6j6w5k/m/O_u1zNQf3VYJ +40. Young, Sean (1997-09-21). _"Zilog Z80 CPU Specifications"_. + * http://www.msxnet.org/tech/Z80/z80.zip + +## License + +Copyright © 1999-2024 Manuel Sainz de Baranda y Goñi. + + + +This library is [free software](https://www.gnu.org/philosophy/free-sw.html): you can redistribute it and/or modify it under the terms of the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.html) as published by the [Free Software Foundation](https://www.fsf.org), either version 3 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](COPYING.LESSER) of the GNU Lesser General Public License along with this library. If not, see . + +## Special licensing + +Projects where the terms of the GNU Lesser General Public License prevent the use of this library, or require unwanted publication of the source code of commercial products, may [apply for a special license](mailto:manuel@zxe.io?subject=Z80). diff --git a/projects/Z80/THANKS b/projects/Z80/THANKS new file mode 100644 index 0000000..869636c --- /dev/null +++ b/projects/Z80/THANKS @@ -0,0 +1,203 @@ +Many thanks to the following individuals (in alphabetical order): + +* Akimov, Vadim (lvd) + For testing the library on many different platforms and CPU architectures. +* azesmbog + 1. For validating tests on real hardware [1]. + 2. For discovering the unstable behavior of the `ccf/scf` instructions. + 3. For his invaluable help. +* Banks, David (hoglet) + 1. For cracking the flag behavior of the block instructions [2,3]. + 2. For his research on the behavior of the `ccf/scf` instructions [3]. +* Beliansky, Anatoly (Tolik_Trek) + For validating tests on real hardware [4]. +* Bobrowski, Jan + For fixing the "Z80 Full Instruction Set Exerciser for Spectrum" [5]. +* boo_boo + For cracking the behavior of the MEMPTR register [6,7,8,9]. +* Brady, Stuart + For his research on the behavior of the `ccf/scf` instructions [10]. +* Brewer, Tony + 1. For his research on the special RESET [11,12]. + 2. For helping to crack the flag behavior of the block instructions [2]. + 3. For conducting low-level tests on real hardware [2]. + 4. For helping me to test different undocumented behaviors of the Zilog Z80. +* Bystrov, Dmitry (Alone Coder) + For validating tests on real hardware [4]. +* Chandler, Richard + 1. For his corrections to the documentation. + 2. For validating tests on real hardware [13]. +* Chunin, Roman (CHRV) + For testing the behavior of the MEMPTR register on real Z80 chips [6,7,8,9]. +* Conway, Simon (BadBeard) + For validating the "Z80 Test Suite" on several Z80 clones [14]. +* Cooke, Simon + For discovering how the `out (c),0` instruction behaves on the Zilog Z80 + CMOS [15]. +* Cringle, Frank D. + For writing the "Z80 Instruction Set Exerciser" [16]. +* Devic, Goran + For his research on undocumented behaviors of the Z80 CPU [17]. +* Dunn, Paul (ZXDunny) + For his corrections to the documentation. +* Equinox + For his corrections to the documentation. +* Flammenkamp, Achim + For his article on Z80 interrupts [18]. +* Gimeno Fortea, Pedro + 1. For his research work [19]. + 2. For writing the first-ever ZX Spectrum emulator [20,21]. +* goodboy + For testing the behavior of the MEMPTR register on real Z80 chips [6,7,8,9]. +* Greenway, Ian + For testing the behavior of the `ccf/scf` instructions on real hardware [10, + 22]. +* Harston, Jonathan Graham + 1. For his research work. + 2. For his technical documents about the Zilog Z80 [23,24,25]. + 3. For porting the "Z80 Instruction Set Exerciser" to the ZX Spectrum [26]. +* Helcmanovsky, Peter (Ped7g) + 1. For helping me to write the "IN-MEMPTR" test. + 2. For writing the "Z80 Block Flags Test" [27,28]. + 3. For writing the "Z80 CCF SCF Outcome Stability" test [28]. + 4. For writing the "Z80 INT Skip" test [28]. + 5. For his research on the unstable behavior of the `ccf/scf` instructions. + 6. For his invaluable help. +* Iborra Debón, Víctor (Eremus) + For validating tests on real hardware. +* icebear + For testing the behavior of the MEMPTR register on real Z80 chips [6,7,8,9]. +* ICEknight + For validating tests on real hardware. +* Kladov, Vladimir + For cracking the behavior of the MEMPTR register [6,7,8,9]. +* Krook, Magnus + For validating tests on real hardware [29]. +* London, Matthew (mattinx) + For validating tests on real hardware. +* Martínez Cantero, Ricardo (Kyp) + For validating tests on real hardware. +* Molodtsov, Aleksandr + For testing the behavior of the MEMPTR register on real Z80 chips [6,7,8,9]. +* Nair, Arjun + For validating tests on real hardware [27]. +* Nicolás-González, César + For helping me to investigate the unstable behavior of the `ccf/scf` + instructions. +* Ortega Sosa, Sofía + 1. For optimizing the emulator. + 2. For her help and support. +* Owen, Simon + For the idea of the hooking method used in this emulator. +* Ownby, Matthew P. + For his research on the state of the registers after POWER-ON [30]. +* Rak, Patrik + 1. For improving the "Z80 Instruction Set Exerciser for Spectrum" [31]. + 2. For cracking the behavior of the `ccf/scf` instructions [14,31]. + 3. For writing the "Zilog Z80 CPU Test Suite" [31,32]. + 4. For his research on the unstable behavior of the `ccf/scf` instructions. +* Rodríguez Jódar, Miguel Ángel (mcleod_ideafix) + For his research on the state of the registers after POWER-ON/RESET [33]. +* Rodríguez Palomino, Mario (r-lyeh) + For teaching me how emulators work. +* Sainz de Baranda y Romero, Manuel + For teaching me programming and giving me my first computer. +* Sánchez Ordiñana, José Ismael (Vaporatorius) + For validating tests on real hardware [34,35]. +* Sevillano Mancilla, Marta (TheMartian) + For validating tests on real hardware [13]. +* Stevenson, Dave + 1. For testing the special RESET on real hardware [11]. + 2. For conducting low-level tests on real hardware [36]. +* Vučenović, Zoran + For writing the Pascal binding. +* Weissflog, Andre (Floh) + 1. For discovering that the `reti/retn` instructions defer the acceptance of + the maskable interrupt [37]. + 2. For writing the "Visual Z80 Remix" simulator [38]. +* Wilkinson, Oli (evolutional) + For validating tests on real hardware [27]. +* Wlodek + For testing the behavior of the MEMPTR register on real Z80 chips [6,7,8,9]. +* Woodmass, Mark (Woody) + 1. For his invaluable contributions to the emuscene. + 2. For writing the "Z80 Test Suite" [14]. + 3. For his research on the behavior of the `ccf/scf` instructions [39]. + 4. For writing the "HALT2INT" test. + 5. For writing the "EIHALT" test. +* Young, Sean + 1. For his research work. + 2. For his technical documents about the Zilog Z80 [19,30,40]. +* ZXGuesser + For validating tests on real hardware. + + +References +========== + + 1. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83384#p83384 + 2. https://stardot.org.uk/forums/viewtopic.php?t=15464 + * https://stardot.org.uk/forums/viewtopic.php?p=211042#p211042 + * https://stardot.org.uk/forums/viewtopic.php?p=212021#p212021 + 3. Banks, David (2018-08-21). "Undocumented Z80 Flags" rev. 1.0. + * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags + * https://stardot.org.uk/forums/download/file.php?id=39831 + 4. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83041#p83041 + 5. http://wizard.ae.krakow.pl/~jb/qaop/tests.html + 6. https://zxpress.ru/zxnet/zxnet.pc/5909 + 7. https://zx-pk.ru/threads/2506-komanda-bit-n-(hl).html + 8. https://zx-pk.ru/threads/2586-prosba-realshchikam-ot-emulyatorshchikov.html + 9. boo_boo; Kladov, Vladimir (2006-03-29). "MEMPTR, Esoteric Register of the + Zilog Z80 CPU". + * https://zx-pk.ru/showpost.php?p=43688 + * https://zx-pk.ru/attachment.php?attachmentid=2984 + * https://zx-pk.ru/showpost.php?p=43800 + * https://zx-pk.ru/attachment.php?attachmentid=2989 +10. https://sourceforge.net/p/fuse-emulator/mailman/message/6929573 +11. Brewer, Tony (2014-12). "Z80 Special Reset". + * http://primrosebank.net/computers/z80/z80_special_reset.htm +12. https://stardot.org.uk/forums/viewtopic.php?p=357136#p357136 +13. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=10555 +14. https://worldofspectrum.org/forums/discussion/20345 +15. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ +16. Cringle, Frank D. (1998-01-28). "Yaze - Yet Another Z80 Emulator" v1.10. + * ftp://ftp.ping.de/pub/misc/emulators/yaze-1.10.tar.gz +17. https://baltazarstudios.com/zilog-z80-undocumented-behavior +18. Flammenkamp, Achim. "Interrupt Behaviour of the Z80 CPU". + * http://z80.info/interrup.htm +19. Young, Sean (1998-10). "Z80 Undocumented Features (in Software Behaviour)" + v0.3. + * http://www.msxnet.org/tech/Z80/z80undoc.txt +20. https://elmundodelspectrum.com/desenterrando-el-primer-emulador-de-spectrum +21. https://elmundodelspectrum.com/con-vosotros-el-emulador-de-pedro-gimeno-1989 +22. https://sourceforge.net/p/fuse-emulator/mailman/message/4502844 +23. Harston, Jonathan Graham (2008). "Full Z80 Opcode List Including + Undocumented Opcodes" v0.11 (revised). + * https://mdfs.net/Docs/Comp/Z80/OpList +24. Harston, Jonathan Graham (2012). "Z80 Microprocessor Undocumented + Instructions" v0.15. + * https://mdfs.net/Docs/Comp/Z80/UnDocOps +25. Harston, Jonathan Graham (2014). "Z80 Opcode Map" v0.10 (revised). + * https://mdfs.net/Docs/Comp/Z80/OpCodeMap +26. https://mdfs.net/Software/Z80/Exerciser/Spectrum +27. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=6102 +28. https://github.com/MrKWatkins/ZXSpectrumNextTests +29. https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83157#p83157 +30. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" v0.91. + * http://www.myquest.nl/z80undocumented + * http://www.myquest.nl/z80undocumented/z80-documented-v0.91.pdf +31. https://worldofspectrum.org/forums/discussion/41704 + * http://zxds.raxoft.cz/taps/misc/zexall2.zip +32. https://worldofspectrum.org/forums/discussion/41834 + * http://zxds.raxoft.cz/taps/misc/z80test-1.0.zip + * https://github.com/raxoft/z80test +33. https://worldofspectrum.org/forums/discussion/34574 +34. https://worldofspectrum.org/forums/discussion/comment/668760/#Comment_668760 +35. https://jisanchez.com/test-a-dos-placas-de-zx-spectrum +36. https://stardot.org.uk/forums/viewtopic.php?p=212360#p212360 +37. Weissflog, Andre (2021-12-17). "New Cycle-Stepped Z80 Emulator, A". + * https://floooh.github.io/2021/12/17/cycle-stepped-z80.html +38. https://github.com/floooh/v6502r +39. https://groups.google.com/g/comp.sys.sinclair/c/WPsPr6j6w5k/m/O_u1zNQf3VYJ +40. Young, Sean (1997-09-21). "Zilog Z80 CPU Specifications". + * http://www.msxnet.org/tech/Z80/z80.zip diff --git a/projects/Z80/documentation/APIReference.rst b/projects/Z80/documentation/APIReference.rst new file mode 100644 index 0000000..3076c20 --- /dev/null +++ b/projects/Z80/documentation/APIReference.rst @@ -0,0 +1,181 @@ +============= +API reference +============= + +.. code-block:: c + + #include + +Types +===== + +Callback pointers +----------------- + +.. doxygentypedef:: Z80Read +.. doxygentypedef:: Z80Write +.. doxygentypedef:: Z80Halt +.. doxygentypedef:: Z80Notify +.. doxygentypedef:: Z80Illegal + +Emulator object +--------------- + +.. doxygenstruct:: Z80 + :members: + +Functions +========= + +Powering the CPU +---------------- + +.. doxygenfunction:: z80_power + +Running the emulation +--------------------- + +.. doxygenfunction:: z80_execute +.. doxygenfunction:: z80_run + +Stopping the emulation +---------------------- + +.. doxygenfunction:: z80_break + +Requesting interrupts +--------------------- + +.. doxygenfunction:: z80_int +.. doxygenfunction:: z80_nmi +.. doxygenfunction:: z80_instant_reset +.. doxygenfunction:: z80_special_reset + +Obtaining information +--------------------- + +.. doxygenfunction:: z80_in_cycle +.. doxygenfunction:: z80_out_cycle +.. doxygenfunction:: z80_r +.. doxygenfunction:: z80_refresh_address + +Macros +====== + +Library version +--------------- + +.. doxygendefine:: Z80_LIBRARY_VERSION_MAJOR +.. doxygendefine:: Z80_LIBRARY_VERSION_MINOR +.. doxygendefine:: Z80_LIBRARY_VERSION_MICRO +.. doxygendefine:: Z80_LIBRARY_VERSION_STRING + +Limits +------ + +.. doxygendefine:: Z80_MAXIMUM_CYCLES +.. doxygendefine:: Z80_MAXIMUM_CYCLES_PER_STEP +.. doxygendefine:: Z80_MINIMUM_CYCLES_PER_STEP + +Opcodes +------- + +.. doxygendefine:: Z80_HOOK + +Flags +----- + +.. doxygendefine:: Z80_SF +.. doxygendefine:: Z80_ZF +.. doxygendefine:: Z80_YF +.. doxygendefine:: Z80_HF +.. doxygendefine:: Z80_XF +.. doxygendefine:: Z80_PF +.. doxygendefine:: Z80_NF +.. doxygendefine:: Z80_CF + +Configuration +------------- + +.. doxygendefine:: Z80_OPTION_HALT_SKIP +.. doxygendefine:: Z80_OPTION_IM0_RETX_NOTIFICATIONS +.. doxygendefine:: Z80_OPTION_LD_A_IR_BUG +.. doxygendefine:: Z80_OPTION_OUT_VC_255 +.. doxygendefine:: Z80_OPTION_XQ +.. doxygendefine:: Z80_OPTION_YQ +.. doxygendefine:: Z80_MODEL_ZILOG_NMOS +.. doxygendefine:: Z80_MODEL_ZILOG_CMOS +.. doxygendefine:: Z80_MODEL_NEC_NMOS +.. doxygendefine:: Z80_MODEL_ST_CMOS + +Requests +-------- + +.. doxygendefine:: Z80_REQUEST_INT +.. doxygendefine:: Z80_REQUEST_NMI +.. doxygendefine:: Z80_REQUEST_REJECT_NMI +.. doxygendefine:: Z80_REQUEST_SPECIAL_RESET + +Resume codes +------------ + +Sometimes the emulator runs out of clock cycles while performing long tasks that can exceed :c:macro:`Z80_MAXIMUM_CYCLES_PER_STEP`. In these cases, the emulation stops and :c:data:`Z80::resume` is set to one of the following values: + +.. doxygendefine:: Z80_RESUME_HALT +.. doxygendefine:: Z80_RESUME_XY +.. doxygendefine:: Z80_RESUME_IM0_XY + +HALT state codes +---------------- + +.. doxygendefine:: Z80_HALT_EXIT_EARLY +.. doxygendefine:: Z80_HALT_CANCEL + +Register accessors +------------------ + +.. doxygendefine:: Z80_MEMPTR +.. doxygendefine:: Z80_WZ +.. doxygendefine:: Z80_PC +.. doxygendefine:: Z80_SP +.. doxygendefine:: Z80_XY +.. doxygendefine:: Z80_IX +.. doxygendefine:: Z80_IY +.. doxygendefine:: Z80_AF +.. doxygendefine:: Z80_BC +.. doxygendefine:: Z80_DE +.. doxygendefine:: Z80_HL +.. doxygendefine:: Z80_AF_ +.. doxygendefine:: Z80_BC_ +.. doxygendefine:: Z80_DE_ +.. doxygendefine:: Z80_HL_ +.. doxygendefine:: Z80_MEMPTRH +.. doxygendefine:: Z80_MEMPTRL +.. doxygendefine:: Z80_WZH +.. doxygendefine:: Z80_WZL +.. doxygendefine:: Z80_PCH +.. doxygendefine:: Z80_PCL +.. doxygendefine:: Z80_SPH +.. doxygendefine:: Z80_SPL +.. doxygendefine:: Z80_XYH +.. doxygendefine:: Z80_XYL +.. doxygendefine:: Z80_IXH +.. doxygendefine:: Z80_IXL +.. doxygendefine:: Z80_IYH +.. doxygendefine:: Z80_IYL +.. doxygendefine:: Z80_A +.. doxygendefine:: Z80_F +.. doxygendefine:: Z80_B +.. doxygendefine:: Z80_C +.. doxygendefine:: Z80_D +.. doxygendefine:: Z80_E +.. doxygendefine:: Z80_H +.. doxygendefine:: Z80_L +.. doxygendefine:: Z80_A_ +.. doxygendefine:: Z80_F_ +.. doxygendefine:: Z80_B_ +.. doxygendefine:: Z80_C_ +.. doxygendefine:: Z80_D_ +.. doxygendefine:: Z80_E_ +.. doxygendefine:: Z80_H_ +.. doxygendefine:: Z80_L_ diff --git a/projects/Z80/documentation/CMakeLists.txt b/projects/Z80/documentation/CMakeLists.txt new file mode 100644 index 0000000..b35bbae --- /dev/null +++ b/projects/Z80/documentation/CMakeLists.txt @@ -0,0 +1,128 @@ +# Z80 - documentation/CMakeLists.txt +# ______ ______ ______ +# /\___ \/\ __ \\ __ \ +# \/__/ /\_\ __ \\ \/\ \ +# /\_____\\_____\\_____\ +# Zilog \/_____//_____//_____/ CPU Emulator +# Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. +# Released under the terms of the GNU Lesser General Public License v3. + +find_package(Doxygen REQUIRED) +find_package(Sphinx REQUIRED) +find_package(Breathe REQUIRED) + +set(_api_xml_output "${CMAKE_CURRENT_BINARY_DIR}/API-XML") + +set(DOXYGEN_BRIEF_MEMBER_DESC YES ) +set(DOXYGEN_ENABLE_PREPROCESSING YES ) +set(DOXYGEN_EXPAND_ONLY_PREDEF NO ) +set(DOXYGEN_FILE_PATTERNS "*.h" ) +set(DOXYGEN_FULL_PATH_NAMES YES ) +set(DOXYGEN_GENERATE_DOCBOOK NO ) +set(DOXYGEN_GENERATE_HTML NO ) +set(DOXYGEN_GENERATE_LATEX NO ) +set(DOXYGEN_GENERATE_MAN NO ) +set(DOXYGEN_GENERATE_RTF NO ) +set(DOXYGEN_GENERATE_XML YES ) +set(DOXYGEN_INLINE_INFO YES ) +set(DOXYGEN_INPUT_ENCODING "UTF-8" ) +set(DOXYGEN_MACRO_EXPANSION YES ) +set(DOXYGEN_MARKDOWN_SUPPORT YES ) +set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES ) +set(DOXYGEN_PREDEFINED "Z_ALWAYS_INLINE=inline" ) +set(DOXYGEN_REPEAT_BRIEF YES ) +set(DOXYGEN_SEARCH_INCLUDES YES ) +set(DOXYGEN_SHOW_INCLUDE_FILES YES ) +set(DOXYGEN_SKIP_FUNCTION_MACROS NO ) +set(DOXYGEN_STRIP_FROM_PATH "${PROJECT_SOURCE_DIR}/API") +set(DOXYGEN_WARN_IF_DOC_ERROR YES ) +set(DOXYGEN_WARN_IF_UNDOCUMENTED YES ) +set(DOXYGEN_WARNINGS YES ) +set(DOXYGEN_XML_OUTPUT "API-XML" ) +set(DOXYGEN_XML_PROGRAMLISTING YES ) + +get_target_property(DOXYGEN_INCLUDE_PATH Zeta INTERFACE_INCLUDE_DIRECTORIES) + +doxygen_add_docs( + ${PROJECT_NAME}-API-XML + "${PROJECT_SOURCE_DIR}/API" + ALL + COMMENT "Extracting API reference from ${PROJECT_NAME}") + +if(${PROJECT_NAME}_WITH_HTML_DOCUMENTATION) + set(_html_documentation_output "${CMAKE_CURRENT_BINARY_DIR}/HTML") + + if(${PROJECT_NAME}_SPHINX_HTML_THEME STREQUAL "") + set(_html_theme_option "") + else() + set(_html_theme_option "-Dhtml_theme=${${PROJECT_NAME}_SPHINX_HTML_THEME}") + endif() + + add_custom_command( + OUTPUT "${_html_documentation_output}" + COMMAND "${SPHINX_BUILD_EXECUTABLE}" + -b html + ${_html_theme_option} + -Dbreathe_projects.${PROJECT_NAME}="${_api_xml_output}" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${_html_documentation_output}" + DEPENDS ${PROJECT_NAME}-API-XML + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Generating documentation in HTML format for ${PROJECT_NAME}") + + add_custom_target( + ${PROJECT_NAME}-Documentation-HTML ALL + DEPENDS "${_html_documentation_output}") + + add_dependencies(${PROJECT_NAME}-Documentation-HTML ${PROJECT_NAME}-API-XML) + + install(DIRECTORY "${_html_documentation_output}/" + DESTINATION "${CMAKE_INSTALL_DOCDIR}/documentation" + COMPONENT ${PROJECT_NAME}_Documentation) +endif() + +if(${PROJECT_NAME}_WITH_PDF_DOCUMENTATION) + find_package(LATEX REQUIRED COMPONENTS PDFLATEX) + + set(_latex_documentation_output "${CMAKE_CURRENT_BINARY_DIR}/LaTeX") + + add_custom_command( + OUTPUT "${_latex_documentation_output}" + COMMAND "${SPHINX_BUILD_EXECUTABLE}" + -b latex + -Dbreathe_projects.${PROJECT_NAME}="${_api_xml_output}" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${_latex_documentation_output}" + DEPENDS ${PROJECT_NAME}-API-XML + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Generating documentation in LaTeX format for ${PROJECT_NAME}") + + add_custom_target( + ${PROJECT_NAME}-Documentation-LaTeX ALL + DEPENDS "${_latex_documentation_output}") + + add_dependencies(${PROJECT_NAME}-Documentation-LaTeX ${PROJECT_NAME}-API-XML) + + string(TOLOWER ${PROJECT_NAME} _pdf_documentation_output) + set(_pdf_documentation_output "${_latex_documentation_output}/${_pdf_documentation_output}.pdf") + + add_custom_command( + OUTPUT "${_pdf_documentation_output}" + COMMAND "${CMAKE_MAKE_PROGRAM}" + MAIN_DEPENDENCY "${_latex_documentation_output}" + WORKING_DIRECTORY "${_latex_documentation_output}" + COMMENT "Generating documentation in PDF format for ${PROJECT_NAME}") + + add_custom_target( + ${PROJECT_NAME}-Documentation-PDF ALL + DEPENDS "${_pdf_documentation_output}") + + add_dependencies(${PROJECT_NAME}-Documentation-PDF ${PROJECT_NAME}-Documentation-LaTeX) + + install(FILES "${_pdf_documentation_output}" + DESTINATION "${CMAKE_INSTALL_DOCDIR}" + RENAME "${PROJECT_NAME} v${PROJECT_VERSION}.pdf" + COMPONENT ${PROJECT_NAME}_Documentation) +endif() + +# documentation/CMakeLists.txt EOF diff --git a/projects/Z80/documentation/Installation.rst b/projects/Z80/documentation/Installation.rst new file mode 100644 index 0000000..186c3a0 --- /dev/null +++ b/projects/Z80/documentation/Installation.rst @@ -0,0 +1,223 @@ +============ +Installation +============ + +.. only:: html + + .. |br| raw:: html + +
+ +.. only:: latex + + .. |nl| raw:: latex + + \newline + +.. |cmake_option_build_config| replace:: ``--config`` +.. _cmake_option_build_config: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-config + +.. |cmake_option_install_strip| replace:: ``--strip`` +.. _cmake_option_install_strip: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-install-strip + +.. |cmake_option_install_component| replace:: ``--component`` +.. _cmake_option_install_component: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-install-component + +Prerequisites +============= + +You will need `CMake `_ v3.14 or later to build the package and, optionally, recent versions of `Doxygen `_, `Sphinx `_ and `Breathe `_ to compile the documentation. Also, make sure that you have `LaTeX `_ with PDF support installed on your system if you want to generate the documentation in PDF format. + +The emulator requires some types and macros included in `Zeta `_, a dependency-free, `header-only `_ library used to retain compatibility with most C compilers. Install Zeta or extract its `source code tarball `_ to the root directory of the Z80 project or its parent directory. Zeta is the sole dependency; the emulator is a freestanding implementation and as such does not depend on the `C standard library `_. + +Configure +========= + +Once the prerequisites are met, create a directory and run ``cmake`` from there to prepare the build system: + +.. code-block:: sh + + mkdir build + cd build + cmake [options] + +The resulting build files can be configured by passing options to ``cmake``. To show a complete list of those available along with their current settings, type the following: + +.. code-block:: sh + + cmake -LAH + +If in doubt, read the `CMake documentation `_ for more information on configuration options. The following are some of the most relevant standard options of CMake: + +.. option:: -DBUILD_SHARED_LIBS=(YES|NO) + + Generate shared libraries rather than static libraries. |br| |nl| + The default is ``NO``. + +.. option:: -DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel) + + Choose the type of build (configuration) to generate. |br| |nl| + The default is ``Release``. + +.. option:: -DCMAKE_INSTALL_PREFIX="" + + Specify the installation prefix. |br| |nl| + The default is ``"/usr/local"`` (on `UNIX `_ and `UNIX-like `_ operating systems). + +.. _cmake_package_options: + +Package-specific options are prefixed with ``Z80_`` and can be divided into two groups. The first one controls aspects not related to the source code of the library: + +.. option:: -DZ80_DEPOT_LOCATION="" + + Specify the directory or URL of the depot containing the test files (i.e., the firmware and software required by the :doc:`testing tool `). |br| |nl| + The default is ``"http://zxe.io/depot"``. + +.. option:: -DZ80_FETCH_TEST_FILES=(YES|NO) + + Copy or download the test files from the depot to the build directory. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_INSTALL_CMAKEDIR="" + + Specify the directory in which to install the CMake `config-file package `_. |br| |nl| + The default is ``"${CMAKE_INSTALL_LIBDIR}/cmake/Z80"``. + +.. option:: -DZ80_INSTALL_PKGCONFIGDIR="" + + Specify the directory in which to install the `pkg-config `_ `file `_. |br| |nl| + The default is ``"${CMAKE_INSTALL_LIBDIR}/pkgconfig"``. + +.. option:: -DZ80_NOSTDLIB_FLAGS=(Auto|"[[;...]]") + + Specify the linker flags used to avoid linking against system libraries. |br| |nl| + The default is ``Auto`` (autoconfigure flags). If you get linker errors, set this option to ``""``. + +.. option:: -DZ80_OBJECT_LIBS=(YES|NO) + + Build the emulator as an `object library `_. |br| |nl| + This option takes precedence over :option:`BUILD_SHARED_LIBS<-DBUILD_SHARED_LIBS>` and :option:`Z80_SHARED_LIBS<-DZ80_SHARED_LIBS>`. If enabled, the build system will ignore :option:`Z80_WITH_CMAKE_SUPPORT<-DZ80_WITH_CMAKE_SUPPORT>` and :option:`Z80_WITH_PKGCONFIG_SUPPORT<-DZ80_WITH_PKGCONFIG_SUPPORT>`, as no libraries or support files will be installed. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_SHARED_LIBS=(YES|NO) + + Build the emulator as a shared library, rather than static. |br| |nl| + This option takes precedence over :option:`BUILD_SHARED_LIBS<-DBUILD_SHARED_LIBS>`. |br| |nl| + Not defined by default. + +.. option:: -DZ80_SPHINX_HTML_THEME="[]" + + Specify the Sphinx theme for the documentation in HTML format. |br| |nl| + The default is ``""`` (use the default theme). + +.. option:: -DZ80_WITH_CMAKE_SUPPORT=(YES|NO) + + Generate and install the CMake `config-file package `_. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_HTML_DOCUMENTATION=(YES|NO) + + Build and install the documentation in HTML format. |br| |nl| + It requires Doxygen, Sphinx and Breathe. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_PDF_DOCUMENTATION=(YES|NO) + + Build and install the documentation in PDF format. |br| |nl| + It requires Doxygen, Sphinx, Breathe, and LaTeX with PDF support. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_PKGCONFIG_SUPPORT=(YES|NO) + + Generate and install the `pkg-config `_ `file `_. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_STANDARD_DOCUMENTS=(YES|NO) + + Install the standard text documents distributed with the package: :file:`AUTHORS`, :file:`COPYING`, :file:`COPYING.LESSER`, :file:`HISTORY`, :file:`README` and :file:`THANKS`. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_TESTS=(YES|NO) + + Build the :doc:`testing tool `. |br| |nl| + The default is ``NO``. + +.. _cmake_package_source_code_options: + +The second group of package-specific options configures the source code of the library by predefining macros that enable :ref:`optional features `: + +.. option:: -DZ80_WITH_EXECUTE=(YES|NO) + + Build the implementation of the :c:func:`z80_execute` function. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_FULL_IM0=(YES|NO) + + Build the full implementation of the interrupt mode 0 rather than the reduced one. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_IM0_RETX_NOTIFICATIONS=(YES|NO) + + Enable optional notifications for any ``reti`` or ``retn`` instruction executed during the interrupt mode 0 response. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_Q=(YES|NO) + + Build the implementation of `Q `_. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_SPECIAL_RESET=(YES|NO) + + Build the implementation of the `special RESET `_. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_UNOFFICIAL_RETI=(YES|NO) + + Configure the undocumented instructions ``ED5Dh``, ``ED6Dh`` and ``ED7Dh`` as ``reti`` instead of ``retn``. |br| |nl| + The default is ``NO``. + +.. option:: -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=(YES|NO) + + Build the implementation of the bug affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a maskable interrupt is accepted during the execution of the ``ld a,{i|r}`` instructions. |br| |nl| + The default is ``NO``. + +Package maintainers are encouraged to use at least the following options for the shared library: + +.. code-block:: sh + + -DZ80_WITH_EXECUTE=YES + -DZ80_WITH_FULL_IM0=YES + -DZ80_WITH_IM0_RETX_NOTIFICATIONS=YES + -DZ80_WITH_Q=YES + -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES + +Build and install +================= + +Finally, once the build system is configured according to your needs, build and install the package: + +.. code-block:: sh + + cmake --build . [--config (Debug|Release|RelWithDebInfo|MinSizeRel)] + cmake --install . [--config ] [--strip] [--component ] + +The |cmake_option_build_config|_ option is only necessary for those `CMake generators `_ that ignore :option:`CMAKE_BUILD_TYPE<-DCMAKE_BUILD_TYPE>` (e.g., Xcode and Visual Studio). Use |cmake_option_install_strip|_ to remove debugging information and non-public symbols when installing non-debug builds of the shared library. To install only a specific component of the package, use the |cmake_option_install_component|_ option. The project defines the following components: + +.. option:: Z80_Runtime + + * Shared library. + * Symbolic link for the compatibility version of the shared library. + * Standard text documents. + +.. option:: Z80_Development + + * Static library. + * Unversioned symbolic link of the shared library. + * Public header. + * CMake config-file package. + * pkg-config file. + +.. option:: Z80_Documentation + + * Documentation in HTML format. + * Documentation in PDF format. diff --git a/projects/Z80/documentation/Integration.rst b/projects/Z80/documentation/Integration.rst new file mode 100644 index 0000000..cdbf677 --- /dev/null +++ b/projects/Z80/documentation/Integration.rst @@ -0,0 +1,105 @@ +=========== +Integration +=========== + +.. |BUILD_SHARED_LIBS| replace:: ``BUILD_SHARED_LIBS`` +.. _BUILD_SHARED_LIBS: https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html + +.. |find_package| replace:: ``find_package`` +.. _find_package: https://cmake.org/cmake/help/latest/command/find_package.html + +.. |add_subdirectory| replace:: ``add_subdirectory`` +.. _add_subdirectory: https://cmake.org/cmake/help/latest/command/add_subdirectory.html + +As an external dependency in CMake-based projects +================================================= + +The Z80 library includes a `config-file package `_ for integration into CMake-based projects that must be installed for development. Use |find_package|_ to find the ``Z80`` package. This creates the ``Z80`` imported library target, which carries the necessary transitive link dependencies. Optionally, the linking method can be selected by specifying either the ``Shared`` or ``Static`` component. + +Example: + +.. code-block:: cmake + + find_package(Z80 REQUIRED Shared) + target_link_libraries(your-target Z80) + +When not specified as a component, the linking method is selected according to :option:`Z80_SHARED_LIBS<-DZ80_SHARED_LIBS>`. If this option is not defined, the config-file uses the type of library that is installed on the system and, if it finds both the shared and the static versions, |BUILD_SHARED_LIBS|_ determines which one to link against. + +As a CMake subproject +===================== + +To embed the Z80 library as a CMake subproject, extract the source code tarballs of `Zeta `_ and `Z80 `_ (or clone their respective repositories) into a subdirectory of another project. Then use |add_subdirectory|_ in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an `interface library `_). + +It is advisable to configure the Z80 library in the :file:`CMakeLists.txt` of the parent project. This will prevent the user from having to specify :ref:`configuration options for the Z80 subproject ` through the command line when building the main project. + +Example: + +.. code-block:: cmake + + set(Z80_SHARED_LIBS NO CACHE BOOL "") + set(Z80_WITH_Q YES CACHE BOOL "") + set(Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG YES CACHE BOOL "") + + add_subdirectory(dependencies/Z80) + target_link_libraries(your-target Z80) + +It is important to set the :option:`Z80_SHARED_LIBS<-DZ80_SHARED_LIBS>` option. Otherwise, CMake will build the library type indicated by |BUILD_SHARED_LIBS|_, which may not be the desired one. + +Non-CMake-based projects +======================== + +The source code of the emulator can be configured at compile time by predefining a series of macros. Both :file:`Z80.h` and :file:`Z80.c` obey the first two explained below. The rest of the macros are only relevant when compiling :file:`Z80.c`: + +.. c:macro:: Z80_DEPENDENCIES_HEADER + + Specifies the only external header to ``#include``, replacing all others. + + Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on `Zeta `_: + + * Macros: ``Z_ALWAYS_INLINE``, ``Z_API_EXPORT``, ``Z_API_IMPORT``, ``Z_CAST``, ``Z_EMPTY``, ``Z_EXTERN_C_BEGIN``, ``Z_EXTERN_C_END``, ``Z_MEMBER_OFFSET``, ``Z_NULL``, ``Z_UINT8_ROTATE_LEFT``, ``Z_UINT8_ROTATE_RIGHT``, ``Z_UINT16``, ``Z_UINT16_BIG_ENDIAN``, ``Z_UINT32``, ``Z_UINT32_BIG_ENDIAN``, ``Z_UNUSED``, ``Z_USIZE`` and ``Z_USIZE_MAXIMUM``. + + * Types: ``zboolean``, ``zchar``, ``zsint``, ``zsint8``, ``zuint``, ``zuint8``, ``zuint16``, ``zuint32``, ``zusize``, ``ZInt16`` and ``ZInt32``. + + You can use this macro when compiling :file:`Z80.c` as a part of your project or (if your types do not break the binary compatibility) when including ```` and linking against a pre-built Z80 library. + +.. c:macro:: Z80_STATIC + + Restricts the visibility of public symbols. + + This macro is required if you are building :file:`Z80.c` as a static library, compiling it directly as a part of your project, or linking your program against the static version of the Z80 library. In either of these cases, make sure this macro is defined before including ``"Z80.h"`` or ````. + +.. c:macro:: Z80_WITH_LOCAL_HEADER + + Tells :file:`Z80.c` to ``#include "Z80.h"`` instead of ````. + +The :ref:`optional features ` of the emulator mentioned in the ":doc:`Installation`" section are disabled by default. If you compile :file:`Z80.c` as a part of your project, enable those features you need by predefining their respective activation macros. They have the same name as their :ref:`CMake equivalents `: + +.. c:macro:: Z80_WITH_EXECUTE + + Enables the implementation of the :c:func:`z80_execute` function. + +.. c:macro:: Z80_WITH_FULL_IM0 + + Enables the full implementation of the interrupt mode 0. + +.. c:macro:: Z80_WITH_IM0_RETX_NOTIFICATIONS + + Enables optional notifications for any ``reti`` or ``retn`` instruction executed during the interrupt mode 0 response. + +.. c:macro:: Z80_WITH_Q + + Enables the implementation of `Q `_. + +.. c:macro:: Z80_WITH_SPECIAL_RESET + + Enables the implementation of the `special RESET `_. + +.. c:macro:: Z80_WITH_UNOFFICIAL_RETI + + Configures the undocumented instructions ``ED5Dh``, ``ED6Dh`` and ``ED7Dh`` as ``reti`` instead of ``retn``. + +.. c:macro:: Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG + + Enables the implementation of the bug affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a maskable interrupt is accepted during the execution of the ``ld a,{i|r}`` instructions. + +Except for :c:macro:`Z80_DEPENDENCIES_HEADER`, the above macros can be empty; the source code only checks whether they are defined. diff --git a/projects/Z80/documentation/Introduction.rst b/projects/Z80/documentation/Introduction.rst new file mode 100644 index 0000000..5d436a5 --- /dev/null +++ b/projects/Z80/documentation/Introduction.rst @@ -0,0 +1,92 @@ +============ +Introduction +============ + +The Z80 library implements a fast, small and accurate `emulator `_ of the `Zilog Z80 `_. It emulates all that is known to date about this CPU, including the undocumented behaviors, `MEMPTR `_, `Q `_ and the `special RESET `_. It also has the honor of having been the first open-source project to provide full emulation of the interrupt mode 0. + +Limitations +=========== + +Granularity +----------- + +Fetch/execute overlapping +------------------------- + +Real Z80 CPUs overlap some operations of certain instructions with the fetch phase of the next instruction or interrupt response. For example, the effective modification of registers A and F. The library does not emulate this feature for speed reasons and only guarantees register coherence at the instruction level, not at the T-state level. + +Normal RESET +------------ + +BUSREQ and WAIT +--------------- + +Optional features +================= + +:c:func:`z80_execute` +--------------------- + +This function performs a partial emulation of the Z80 CPU that ignores interrupts and the special RESET. It is somewhat faster than :c:func:`z80_run`, since the emulation loop does not have to check each iteration for pending interrupts before executing the instruction. + +Not enabling the implementation of this function allows a slight reduction in the size of the library, but it is usually marginal. + +Package maintainers should enable the implementation of the :c:func:`z80_execute` function. + +Interrupt mode 0 +---------------- + +The interrupt mode 0 executes an instruction supplied to the CPU via the data bus. Real Z80 chips can execute any instruction, even illegal ones, and also long sequences of ``DDh/FDh`` prefixes, although most existing hardware only uses a few instructions from the control transfer groups. + +The Z80 library includes two different implementations of this interrupt mode: full, which emulates everything; and reduced, which emulates only the ``jp WORD``, ``call WORD`` and ``rst N`` instructions. + +Enabling the full implementation of the interrupt mode 0 can increase the size of the library by 1 or 2 KB approximately (depending on the target ISA and the executable format). + +Package maintainers should enable the full implementation of the interrupt mode 0. + +Notifications of ``reti`` and ``retn`` in the interrupt mode 0 +-------------------------------------------------------------- + +The Z80 emulator notifies the fetch of the instructions ``reti`` and ``retn`` through the callbacks :c:data:`Z80::reti` and :c:data:`Z80::retn`. This simplifies the emulation of chips such as the Zilog Z80 CTC, which monitors the appearance of the ``reti`` instruction on the data bus to evaluate whether the CPU is returning from an ISR. + +It is presumed that the Z80 CTC is not capable of detecting ``reti`` when executed through interrupt mode 0. Furthermore, there is no known hardware that supplies these instructions to the CPU during the interrupt response. However, the notifications of ``reti`` and ``retn`` in the interrupt mode 0 have no impact on speed, the increase in the size of the library is minimal, and they can be disabled at runtime anyway. + +Package maintainers should enable notifications of ``reti`` and ``retn`` in the interrupt mode 0, just in case. + +Q +- + +Q is an abstraction of certain ALU latches related to flag computation. The state of Q affects the undocumented flags X and Y in the ``ccf`` and ``scf`` instructions of Z80 CPUs from Zilog and other manufacturers. + +Enabling the implementation of this feature adds code to update the value of Q in each instruction and interrupt response, which slightly increases the size of the library and, depending on the target ISA and the specific microarchitecture of the host CPU, can result in a performance loss of up to 2.4%. + +Package maintainers should, however, enable the implementation of Q, as it is necessary for the emulator to pass all tests. + +Special RESET +------------- + +The special RESET is a little-known pseudo-interrupt described in U.S. Patent No. `4,486,827 `_. It was first `documented `_ in detail by Tony Brewer. It is not of particular interest for the emulation of commercial systems, as no machine is known to make use of it except for a few development boards such as the Zilog In-Circuit Emulator (ICE). + +Enabling the implementation of the special RESET is discouraged because it adds extra operations that slightly affect the speed of interrupt responses and the resumption of the HALT state. + +Package maintainers **should not enable** the implementation of the special RESET. + +Unofficial ``reti`` opcodes +--------------------------- + +The ``retn`` instruction has 8 different opcodes: 1 documented, 6 undocumented and ``reti``, which is just the specific ``retn`` opcode whose execution is monitored by the Z80 CTC chip to know whether the CPU is returning from an ISR. + +Some Z80 CPU emulators assign the 4 opcodes whose bit 3 is ``0`` to ``retn``, and the other 4 to ``reti``. However, as far as is known, the Z80 CTC and other similar circuits only monitor the execution of the two-byte instruction ``ED4Dh`` (i.e. the instruction that the official documentation designates as ``reti``). + +Enabling unofficial ``reti`` opcodes will configure the instructions ``ED5Dh``, ``ED6Dh`` and ``ED7Dh`` as ``reti``, causing their execution to be notified through the :c:data:`Z80::reti` callback rather than :c:data:`Z80::retn`. + +Package maintainers should **never enable** unofficial ``reti`` opcodes. + +Zilog NMOS bug of the ``ld a,i`` and ``ld a,r`` instructions +------------------------------------------------------------ + +The Z80 CPU models that use NMOS technology have a bug that causes the P/V flag to be reset when a maskable interrupt is accepted during the execution of these instructions. This affects processors manufactured by Zilog, second sources, NEC and can also be found in CMOS models from SGS-Thomson (and possibly other companies). + +Enabling the implementation of this bug adds code in the maskable interrupt response to check whether or not the previous instruction was ``ld a,i`` or ``ld a,r``, thus making the interrupt response slightly slower. + +Package maintainers should, however, enable the implementation of this bug, as there is firmware and software that depend on it. diff --git a/projects/Z80/documentation/License.rst b/projects/Z80/documentation/License.rst new file mode 100644 index 0000000..1a18021 --- /dev/null +++ b/projects/Z80/documentation/License.rst @@ -0,0 +1,11 @@ +======= +License +======= + +Copyright © 1999-2024 Manuel Sainz de Baranda y Goñi. + +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 of the License, or (at your option) any later version. + +**This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE**. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . diff --git a/projects/Z80/documentation/Makefile b/projects/Z80/documentation/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/projects/Z80/documentation/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/projects/Z80/documentation/Tests.rst b/projects/Z80/documentation/Tests.rst new file mode 100644 index 0000000..9591137 --- /dev/null +++ b/projects/Z80/documentation/Tests.rst @@ -0,0 +1,3 @@ +===== +Tests +===== diff --git a/projects/Z80/documentation/Thanks.rst b/projects/Z80/documentation/Thanks.rst new file mode 100644 index 0000000..34e2280 --- /dev/null +++ b/projects/Z80/documentation/Thanks.rst @@ -0,0 +1,532 @@ +====== +Thanks +====== + +.. only:: html + + .. |re| raw:: html + + + + .. |ren| raw:: html + + + +.. only:: latex + + .. |fe| raw:: latex + + \textsuperscript{ + + .. |ces| raw:: latex + + } + +Many thanks to the following individuals (in alphabetical order): + +* **Akimov, Vadim (lvd)** + + * For testing the library on many different platforms and CPU architectures. + +* **azesmbog** + + 1. For validating tests on real hardware. |re| |fe| :ref:`1` |ren| |ces| + 2. For discovering the unstable behavior of the ``ccf/scf`` instructions. + 3. For his invaluable help. + +* **Banks, David (hoglet)** + + 1. For cracking the flag behavior of the block instructions. |re| |fe| :ref:`2`, :ref:`3` |ren| |ces| + 2. For his research on the behavior of the ``ccf/scf`` instructions. |re| |fe| :ref:`3` |ren| |ces| + +* **Beliansky, Anatoly (Tolik_Trek)** + + * For validating tests on real hardware. |re| |fe| :ref:`4` |ren| |ces| + +* **Bobrowski, Jan** + + * For fixing the *"Z80 Full Instruction Set Exerciser for Spectrum"*. |re| |fe| :ref:`5` |ren| |ces| + +* **boo_boo** + + * For cracking the behavior of the MEMPTR register. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Brady, Stuart** + + * For his research on the behavior of the ``ccf/scf`` instructions. |re| |fe| :ref:`10` |ren| |ces| + +* **Brewer, Tony** + + 1. For his research on the special RESET. |re| |fe| :ref:`11`, :ref:`12` |ren| |ces| + 2. For helping to crack the flag behavior of the block instructions. |re| |fe| :ref:`2` |ren| |ces| + 3. For conducting low-level tests on real hardware. |re| |fe| :ref:`2` |ren| |ces| + 4. For helping me to test different undocumented behaviors of the Zilog Z80. + +* **Bystrov, Dmitry (Alone Coder)** + + * For validating tests on real hardware. |re| |fe| :ref:`4` |ren| |ces| + +* **Chandler, Richard** + + 1. For his corrections to the documentation. + 2. For validating tests on real hardware. |re| |fe| :ref:`13` |ren| |ces| + +* **Chunin, Roman (CHRV)** + + * For testing the behavior of the MEMPTR register on real Z80 chips. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Conway, Simon (BadBeard)** + + * For validating the *"Z80 Test Suite"* on several Z80 clones. |re| |fe| :ref:`14` |ren| |ces| + +* **Cooke, Simon** + + * For discovering how the ``out (c),0`` instruction behaves on the Zilog Z80 CMOS. |re| |fe| :ref:`15` |ren| |ces| + +* **Cringle, Frank D.** + + * For writing the *"Z80 Instruction Set Exerciser"*. |re| |fe| :ref:`16` |ren| |ces| + +* **Devic, Goran** + + * For his research on undocumented behaviors of the Z80 CPU. |re| |fe| :ref:`17` |ren| |ces| + +* **Dunn, Paul (ZXDunny)** + + * For his corrections to the documentation. + +* **Equinox** + + * For his corrections to the documentation. + +* **Flammenkamp, Achim** + + * For his article on Z80 interrupts. |re| |fe| :ref:`18` |ren| |ces| + +* **Gimeno Fortea, Pedro** + + 1. For his research work. |re| |fe| :ref:`19` |ren| |ces| + 2. For writing the first-ever ZX Spectrum emulator. |re| |fe| :ref:`20`, :ref:`21` |ren| |ces| + +* **goodboy** + + * For testing the behavior of the MEMPTR register on real Z80 chips. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Greenway, Ian** + + * For testing the behavior of the ``ccf/scf`` instructions on real hardware. |re| |fe| :ref:`10`, :ref:`22` |ren| |ces| + +* **Harston, Jonathan Graham** + + 1. For his research work. + 2. For his technical documents about the Zilog Z80. |re| |fe| :ref:`23`, :ref:`24`, :ref:`25` |ren| |ces| + 3. For porting the *"Z80 Instruction Set Exerciser"* to the ZX Spectrum. |re| |fe| :ref:`26` |ren| |ces| + +* **Helcmanovsky, Peter (Ped7g)** + + 1. For helping me to write the *"IN-MEMPTR"* test. + 2. For writing the *"Z80 Block Flags Test"*. |re| |fe| :ref:`27`, :ref:`28` |ren| |ces| + 3. For writing the *"Z80 CCF SCF Outcome Stability"* test. |re| |fe| :ref:`28` |ren| |ces| + 4. For writing the *"Z80 INT Skip"* test. |re| |fe| :ref:`28` |ren| |ces| + 5. For his research on the unstable behavior of the ``ccf/scf`` instructions. + 6. For his invaluable help. + +* **Iborra Debón, Víctor (Eremus)** + + * For validating tests on real hardware. + +* **icebear** + + * For testing the behavior of the MEMPTR register on real Z80 chips. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **ICEknight** + + * For validating tests on real hardware. + +* **Kladov, Vladimir** + + * For cracking the behavior of the MEMPTR register. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Krook, Magnus** + + * For validating tests on real hardware. |re| |fe| :ref:`29` |ren| |ces| + +* **London, Matthew (mattinx)** + + * For validating tests on real hardware. + +* **Martínez Cantero, Ricardo (Kyp)** + + * For validating tests on real hardware. + +* **Molodtsov, Aleksandr** + + * For testing the behavior of the MEMPTR register on real Z80 chips. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Nair, Arjun** + + * For validating tests on real hardware. |re| |fe| :ref:`27` |ren| |ces| + +* **Nicolás-González, César** + + * For helping me to investigate the unstable behavior of the ``ccf/scf`` instructions. + +* **Ortega Sosa, Sofía** + + 1. For optimizing the emulator. + 2. For her help and support. + +* **Owen, Simon** + + * For the idea of the hooking method used in this emulator. + +* **Ownby, Matthew P.** + + * For his research on the state of the registers after POWER-ON. |re| |fe| :ref:`30` |ren| |ces| + +* **Rak, Patrik** + + 1. For improving the *"Z80 Instruction Set Exerciser for Spectrum"*. |re| |fe| :ref:`31` |ren| |ces| + 2. For cracking the behavior of the ``ccf/scf`` instructions. |re| |fe| :ref:`14`, :ref:`31` |ren| |ces| + 3. For writing the *"Zilog Z80 CPU Test Suite"*. |re| |fe| :ref:`31`, :ref:`32` |ren| |ces| + 4. For his research on the unstable behavior of the ``ccf/scf`` instructions. + +* **Rodríguez Jódar, Miguel Ángel (mcleod_ideafix)** + + * For his research on the state of the registers after POWER-ON/RESET. |re| |fe| :ref:`33` |ren| |ces| + +* **Rodríguez Palomino, Mario (r-lyeh)** + + * For teaching me how emulators work. + +* **Sainz de Baranda y Romero, Manuel** + + * For teaching me programming and giving me my first computer. + +* **Sánchez Ordiñana, José Ismael (Vaporatorius)** + + * For validating tests on real hardware. |re| |fe| :ref:`34`, :ref:`35` |ren| |ces| + +* **Sevillano Mancilla, Marta (TheMartian)** + + * For validating tests on real hardware. |re| |fe| :ref:`13` |ren| |ces| + +* **Stevenson, Dave** + + 1. For testing the special RESET on real hardware. |re| |fe| :ref:`11` |ren| |ces| + 2. For conducting low-level tests on real hardware. |re| |fe| :ref:`36` |ren| |ces| + +* **Vučenović, Zoran** + + * For writing the Pascal binding. + +* **Weissflog, Andre (Floh)** + + 1. For discovering that the ``reti/retn`` instructions defer the acceptance of the maskable interrupt. |re| |fe| :ref:`37` |ren| |ces| + 2. For writing the *"Visual Z80 Remix"* simulator. |re| |fe| :ref:`38` |ren| |ces| + +* **Wilkinson, Oli (evolutional)** + + * For validating tests on real hardware. |re| |fe| :ref:`27` |ren| |ces| + +* **Wlodek** + + * For testing the behavior of the MEMPTR register on real Z80 chips. |re| |fe| :ref:`6`, :ref:`7`, :ref:`8`, :ref:`9` |ren| |ces| + +* **Woodmass, Mark (Woody)** + + 1. For his invaluable contributions to the emuscene. + 2. For writing the *"Z80 Test Suite"*. |re| |fe| :ref:`14` |ren| |ces| + 3. For his research on the behavior of the `ccf/scf` instructions. |re| |fe| :ref:`39` |ren| |ces| + 4. For writing the *"HALT2INT"* test. + 5. For writing the *"EIHALT"* test. + +* **Young, Sean** + + 1. For his research work. + 2. For his technical documents about the Zilog Z80. |re| |fe| :ref:`19`, :ref:`30`, :ref:`40` |ren| |ces| + +* **ZXGuesser** + + * For validating tests on real hardware. + + +References +========== + +1. + + .. _r1: + + https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83384#p83384 + +2. + + .. _r2: + + https://stardot.org.uk/forums/viewtopic.php?t=15464 + + * https://stardot.org.uk/forums/viewtopic.php?p=211042#p211042 + * https://stardot.org.uk/forums/viewtopic.php?p=212021#p212021 + +3. + + .. _r3: + + Banks, David (2018-08-21). *"Undocumented Z80 Flags"* rev. 1.0. + + * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags + * https://stardot.org.uk/forums/download/file.php?id=39831 + +4. + + .. _r4: + + https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83041#p83041 + +5. + + .. _r5: + + http://wizard.ae.krakow.pl/~jb/qaop/tests.html + +6. + + .. _r6: + + https://zxpress.ru/zxnet/zxnet.pc/5909 + +7. + + .. _r7: + + https://zx-pk.ru/threads/2506-komanda-bit-n-(hl).html + +8. + + .. _r8: + + https://zx-pk.ru/threads/2586-prosba-realshchikam-ot-emulyatorshchikov.html + +9. + + .. _r9: + + boo_boo; Kladov, Vladimir (2006-03-29). *"MEMPTR, Esoteric Register of the Zilog Z80 CPU"*. + + * https://zx-pk.ru/showpost.php?p=43688 + * https://zx-pk.ru/attachment.php?attachmentid=2984 + * https://zx-pk.ru/showpost.php?p=43800 + * https://zx-pk.ru/attachment.php?attachmentid=2989 + +10. + + .. _r10: + + https://sourceforge.net/p/fuse-emulator/mailman/message/6929573 + +11. + + .. _r11: + + Brewer, Tony (2014-12). *"Z80 Special Reset"*. + + * http://primrosebank.net/computers/z80/z80_special_reset.htm + +12. + + .. _r12: + + https://stardot.org.uk/forums/viewtopic.php?p=357136#p357136 + +13. + + .. _r13: + + https://spectrumcomputing.co.uk/forums/viewtopic.php?t=10555 + +14. + + .. _r14: + + https://worldofspectrum.org/forums/discussion/20345 + +15. + + .. _r15: + + https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ + +16. + + .. _r16: + + Cringle, Frank D. (1998-01-28). *"Yaze - Yet Another Z80 Emulator"* v1.10. + + * ftp://ftp.ping.de/pub/misc/emulators/yaze-1.10.tar.gz + +17. + + .. _r17: + + https://baltazarstudios.com/zilog-z80-undocumented-behavior + +18. + + .. _r18: + + Flammenkamp, Achim. *"Interrupt Behaviour of the Z80 CPU"*. + + * http://z80.info/interrup.htm + +19. + + .. _r19: + + Young, Sean (1998-10). *"Z80 Undocumented Features (in Software Behaviour)"* v0.3. + + * http://www.msxnet.org/tech/Z80/z80undoc.txt + +20. + + .. _r20: + + https://elmundodelspectrum.com/desenterrando-el-primer-emulador-de-spectrum + +21. + + .. _r21: + + https://elmundodelspectrum.com/con-vosotros-el-emulador-de-pedro-gimeno-1989 + +22. + + .. _r22: + + https://sourceforge.net/p/fuse-emulator/mailman/message/4502844 + +23. + + .. _r23: + + Harston, Jonathan Graham (2008). *"Full Z80 Opcode List Including Undocumented Opcodes"* v0.11 (revised). + + * https://mdfs.net/Docs/Comp/Z80/OpList + +24. + + .. _r24: + + Harston, Jonathan Graham (2012). *"Z80 Microprocessor Undocumented Instructions"* v0.15. + + * https://mdfs.net/Docs/Comp/Z80/UnDocOps + +25. + + .. _r25: + + Harston, Jonathan Graham (2014). *"Z80 Opcode Map"* v0.10 (revised). + + * https://mdfs.net/Docs/Comp/Z80/OpCodeMap + +26. + + .. _r26: + + https://mdfs.net/Software/Z80/Exerciser/Spectrum + +27. + + .. _r27: + + https://spectrumcomputing.co.uk/forums/viewtopic.php?t=6102 + +28. + + .. _r28: + + https://github.com/MrKWatkins/ZXSpectrumNextTests + +29. + + .. _r29: + + https://spectrumcomputing.co.uk/forums/viewtopic.php?p=83157#p83157 + +30. + + .. _r30: + + Young, Sean (2005-09-18). *"Undocumented Z80 Documented, The"* v0.91. + + * http://www.myquest.nl/z80undocumented + * http://www.myquest.nl/z80undocumented/z80-documented-v0.91.pdf + +31. + + .. _r31: + + https://worldofspectrum.org/forums/discussion/41704 + + * http://zxds.raxoft.cz/taps/misc/zexall2.zip + +32. + + .. _r32: + + https://worldofspectrum.org/forums/discussion/41834 + + * http://zxds.raxoft.cz/taps/misc/z80test-1.0.zip + * https://github.com/raxoft/z80test + +33. + + .. _r33: + + https://worldofspectrum.org/forums/discussion/34574 + +34. + + .. _r34: + + https://worldofspectrum.org/forums/discussion/comment/668760/#Comment_668760 + +35. + + .. _r35: + + https://jisanchez.com/test-a-dos-placas-de-zx-spectrum + +36. + + .. _r36: + + https://stardot.org.uk/forums/viewtopic.php?p=212360#p212360 + +37. + + .. _r37: + + Weissflog, Andre (2021-12-17). *"New Cycle-Stepped Z80 Emulator, A"*. + + * https://floooh.github.io/2021/12/17/cycle-stepped-z80.html + +38. + + .. _r38: + + https://github.com/floooh/v6502r + +39. + + .. _r39: + + https://groups.google.com/g/comp.sys.sinclair/c/WPsPr6j6w5k/m/O_u1zNQf3VYJ + +40. + + .. _r40: + + Young, Sean (1997-09-21). *"Zilog Z80 CPU Specifications"*. + + * http://www.msxnet.org/tech/Z80/z80.zip diff --git a/projects/Z80/documentation/Usage.rst b/projects/Z80/documentation/Usage.rst new file mode 100644 index 0000000..a69bc5a --- /dev/null +++ b/projects/Z80/documentation/Usage.rst @@ -0,0 +1,131 @@ +===== +Usage +===== + +.. code-block:: c + + #include /* Z_NULL */ + #include + + #define CYCLES_PER_FRAME 69888 + #define CYCLES_AT_INT 24 + #define CYCLES_PER_INT 32 + #define ROM_SIZE 0x4000 /* 16 KiB */ + #define MEMORY_SIZE 0x8000 /* 32 KiB */ + + typedef struct { + void* context; + zuint8 (* read)(void *context); + void (* write)(void *context, zuint8 value); + zuint16 assigned_port; + } Device; + + typedef struct { + zusize cycles; + zuint8 memory[65536]; + Z80 cpu; + Device* devices; + zusize device_count; + } Machine; + + + Device *machine_find_device(Machine *self, zuint16 port) + { + zusize index = 0; + + for (; index < device_count; index++) + if (self->devices[index]->assigned_port == port) + return &self->devices[index]; + + return Z_NULL; + } + + + static zuint8 machine_cpu_read(Machine *self, zuint16 address) + { + return address < MEMORY_SIZE ? self->memory[address] : 0xFF; + } + + + static void machine_cpu_write(Machine *self, zuint16 address, zuint8 value) + { + if (address >= ROM_SIZE && address < MEMORY_SIZE) + self->memory[address] = value; + } + + + static zuint8 machine_cpu_in(Machine *self, zuint16 port) + { + Device *device = machine_find_device(self, port); + + return device != Z_NULL ? device->read(device->context) : 0xFF; + } + + + static void machine_cpu_out(Machine *self, zuint16 port, zuint8 value) + { + Device *device = machine_find_device(self, port); + + if (device != Z_NULL) device->write(device->context, value); + } + + + void machine_initialize(Machine *self) + { + self->cpu.context = self; + self->cpu.fetch_opcode = + self->cpu.fetch = + self->cpu.nop = + self->cpu.read = (Z80Read )machine_cpu_read; + self->cpu.write = (Z80Write)machine_cpu_write; + self->cpu.in = (Z80Read )machine_cpu_in; + self->cpu.out = (Z80Write)machine_cpu_out; + self->cpu.halt = Z_NULL; + self->cpu.nmia = Z_NULL; + self->cpu.inta = Z_NULL; + self->cpu.int_fetch = Z_NULL; + self->cpu.ld_i_a = Z_NULL; + self->cpu.ld_r_a = Z_NULL; + self->cpu.reti = Z_NULL; + self->cpu.retn = Z_NULL; + self->cpu.hook = Z_NULL; + self->cpu.illegal = Z_NULL; + self->cpu.options = Z80_MODEL_ZILOG_NMOS; + + /* Create and initialize devices... */ + } + + + void machine_power(Machine *self, zboolean state) + { + if (state) + { + self->cycles = 0; + memset(self->memory, 0, 65536); + } + + z80_power(&self->cpu, state); + } + + + void machine_reset(Machine *self) + { + z80_instant_reset(&self->cpu); + } + + + void machine_run_frame(Machine *self) + { + /* CPU cycles before the INT signal */ + self->cycles += z80_execute(&self->cpu, CYCLES_AT_INT - self->cycles); + + /* CPU cycles during the INT signal */ + z80_int(&self->cpu, Z_TRUE); + self->cycles += z80_run(&self->cpu, (CYCLES_AT_INT + CYCLES_PER_INT) - self->cycles); + z80_int(&self->cpu, Z_FALSE); + + /* CPU cycles after the INT signal */ + self->cycles += z80_execute(&self->cpu, CYCLES_PER_FRAME - self->cycles); + + self->cycles -= CYCLES_PER_FRAME; + } diff --git a/projects/Z80/documentation/VersionHistory.rst b/projects/Z80/documentation/VersionHistory.rst new file mode 100644 index 0000000..d2b3996 --- /dev/null +++ b/projects/Z80/documentation/VersionHistory.rst @@ -0,0 +1,75 @@ +=============== +Version history +=============== + +Z80 v0.2-pre +============ + +*Released on 2024-04-18* + +This is an important update that addresses a number of issues and also includes new features. Please note that the changes introduced in this release break the binary compatibility with the previous version. + +**Changes:** + +1. Changed the :doc:`license ` from GPL to LGPL (by popular request). +2. Moved the public header from ```` to ````. +3. Removed the Xcode project. +4. Switched the build system from Premake to `CMake `_. +5. Switched to `Zeta `_ v0.1. +6. Added `pkg-config `_ support. +7. Added the following files to the project: :file:`.vimrc`, :file:`CITATION.cff`, :file:`file_id.diz` and :file:`THANKS`. +8. Added detailed documentation. +9. Added Pascal binding, courtesy of Zoran Vučenović. +10. Added tests. +11. Added :ref:`public macros ` for checking the library version, working with flags, accessing the 16-bit registers and other purposes. +12. Added the ability to end the emulation loop immediately, and the :c:func:`z80_break` function. +13. Added the :c:func:`z80_execute` function for running a simplified emulation without RESET and interrupts. +14. Added the :c:func:`z80_refresh_address` function for getting the refresh address of the current M1 cycle. +15. Added the :c:func:`z80_in_cycle` and :c:func:`z80_out_cycle` functions for obtaining the clock cycle at which the I/O M-cycle begins, relative to the start of the instruction. +16. Renamed the ``z80_reset`` function to :c:func:`z80_instant_reset`. +17. Added optional emulation of the special RESET, and the :c:func:`z80_special_reset` function. +18. Added the :c:data:`Z80::fetch_opcode` and :c:data:`Z80::fetch` callbacks for performing opcode fetch operations and memory read operations on instruction data, respectively. +19. Added the :c:data:`Z80::nop` callback for performing disregarded opcode fetch operations during internal NOP M-cycles. +20. Added emulation of the NMI acknowledge M-cycle through the new :c:data:`Z80::nmia` callback. +21. Added emulation of the INT acknowledge M-cycle through the new :c:data:`Z80::inta` callback, which replaces ``Z80::int_data``. +22. Added optional full emulation of the interrupt mode 0, along with the new :c:data:`Z80::int_fetch` callback for performing bus read operations on instruction data. If not enabled at compile-time, the old simplified emulation is built, which supports only the most typical instructions. +23. Added four callbacks for notifying the execution of important instructions: :c:data:`Z80::ld_i_a`, :c:data:`Z80::ld_r_a`, :c:data:`Z80::reti` and :c:data:`Z80::retn`. +24. Added hooking functionality through the ``ld h,h`` instruction and the new :c:data:`Z80::hook` callback. +25. Added the :c:data:`Z80::illegal` callback for delegating the emulation of illegal instructions. +26. Added :ref:`emulation options ` that can be configured at runtime. +27. Removed ``Z80::state``. Replaced with individual members for the registers, the interrupt enable flip-flops and the interrupt mode. +28. Removed the superfluous EI flag. The previous opcode is checked instead, which is faster and makes the :c:type:`Z80` object smaller. +29. Removed all module-related stuff. +30. Added emulation of the additional flag changes performed during the extra 5 clock cycles of the following instructions: ``ldir``, ``lddr``, ``cpir``, ``cpdr``, ``inir``, ``indr``, ``otir`` and ``otdr``. +31. Added emulation of the interrupt acceptance deferral that occurs during the ``reti`` and ``retn`` instructions. +32. Added MEMPTR emulation. The ``bit N,(hl)`` instruction now produces a correct value of F. +33. Added optional emulation of Q. If enabled at compile-time, the ``ccf`` and ``scf`` instructions will produce a correct value of F. +34. Added emulation of the ``out (c),255`` instruction (Zilog Z80 CMOS). +35. Added optional emulation of the bug affecting the ``ld a,{i|r}`` instructions (Zilog Z80 NMOS). If enabled at compile-time and configured at runtime, the P/V flag will be reset if an INT is accepted during the execution of these instructions. +36. Increased granularity. The emulator can now stop directly after fetching a prefix ``DDh`` or ``FDh`` if it runs out of clock cycles. This also works during the INT response in mode 0. +37. Reimplemented the HALT state. The emulation should now be fully accurate. HALTskip optimization is also supported. +38. Fixed a bug in the ``sll`` instruction. +39. Fixed a bug in the ``INX`` and ``OUTX`` macros affecting the S and N flags. +40. Fixed a bug in the ``OUTX`` macro affecting the MSByte of the port number. +41. Fixed the clock cycles of the ``dec XY`` and ``in (c)`` instructions. +42. Fixed the ``read_16`` function so that the order of the memory read operations is not determined by the order in which the compiler evaluates expressions. +43. Fixed the order in which the memory write operations are performed when the SP register is involved. This affects the NMI response, the INT response in modes 1 and 2, and the following instructions: ``ex (sp),{hl|XY}``, ``push TT``, ``push XY``, ``call WORD``, ``call Z,WORD`` and ``rst N``. +44. Fixed the handling of illegal instructions to avoid stack overflows in long sequences of ``DDh/FDh`` prefixes. +45. Fixed several implicit conversions to avoid warnings about loss of sign and precision. +46. Fixed some bitwise operations to avoid undefined behavior and arithmetic right shifts on signed integers. +47. Fixed violations of the C standard in several identifiers. +48. Renamed the 8-bit register lists: ``X/Y`` to ``J/K``; ``J/K`` and ``P/Q`` to ``O/P``. +49. Replaced all P/V overflow computation functions with a single, faster macro. +50. Replaced all register resolution functions with macros. +51. Replaced all ``ld {J,K|O,P}`` instructions that have the same destination and source register with NOPs. In addition, the "illegal" forms of the following instructions are now executed without using the illegal instruction handler: ``ld O,P``, ``ld O,BYTE``, ``U [a,]P`` and ``V O``. +52. Optimizations in flag computation and condition evaluation. +53. New source code comments and improvements to existing ones. +54. Improved code aesthetics. +55. Other improvements, optimizations and minor changes. + +Z80 v0.1 +======== + +*Released on 2018-11-10* + +Initial public release. diff --git a/projects/Z80/documentation/conf.py b/projects/Z80/documentation/conf.py new file mode 100644 index 0000000..63e322b --- /dev/null +++ b/projects/Z80/documentation/conf.py @@ -0,0 +1,56 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- Project information ----------------------------------------------------- + +project = 'Z80' +copyright = u'1999-2024 Manuel Sainz de Baranda y Goñi' +author = u'Manuel Sainz de Baranda y Goñi' +version = '0.2' + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autosectionlabel', 'breathe'] + +# sphinx.ext.autosectionlabel +autosectionlabel_prefix_document = True + +# Breathe +breathe_default_project = 'Z80' +breathe_domain_by_extension = {'h': 'c'} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +#html_theme = 'haiku' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/projects/Z80/documentation/index.rst b/projects/Z80/documentation/index.rst new file mode 100644 index 0000000..8979801 --- /dev/null +++ b/projects/Z80/documentation/index.rst @@ -0,0 +1,34 @@ +.. Z80 documentation master file, created by + sphinx-quickstart on Wed Feb 24 06:49:20 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +=== +Z80 +=== + +.. toctree:: + :maxdepth: 2 + :caption: Contents + + Introduction + Installation + Tests + Integration + Usage + APIReference + +.. toctree:: + :maxdepth: 2 + :caption: Project + + Thanks + VersionHistory + License + +.. toctree:: + :maxdepth: 2 + :caption: Indices and tables + + genindex + search diff --git a/projects/Z80/documentation/make.bat b/projects/Z80/documentation/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/projects/Z80/documentation/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/projects/Z80/file_id.diz b/projects/Z80/file_id.diz new file mode 100644 index 0000000..b6080ca --- /dev/null +++ b/projects/Z80/file_id.diz @@ -0,0 +1,5 @@ +Z80 v0.2 - Fast, small and accurate emulator +of the Zilog Z80. Version 0.2 implements all +that is known to date about this CPU, passes +all test suites and is carefully designed to +fit most use cases. diff --git a/projects/Z80/sources/Z80.c b/projects/Z80/sources/Z80.c new file mode 100644 index 0000000..8db84f1 --- /dev/null +++ b/projects/Z80/sources/Z80.c @@ -0,0 +1,2766 @@ +/* Z80 v0.2 + ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator | +| Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. | +| | +| This emulator 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 of the License, or (at your | +| option) any later version. | +| | +| This emulator 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 emulator. If not, see . | +| | +| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | +| | +| A NOTE FROM THE ORIGINAL AUTHOR | +| | +| Those familiar with the official documentation of the Zilog Z80 CPU will | +| find this source code quite intuitive. The purpose has not been to write | +| the fastest possible emulator, although the speed aspect is not neglected, | +| but a portable, hackable and well- | +| .----._.----. structured piece of software; | +| A11 <-01--|1 o|--40-> A10 something small, solid and elegant | +| A12 <-02--| |--39-> A09 that can stand the test of time | +| A13 <-03--| |--38-> A08 with no need for major changes. | +| A14 <-04--| |--37-> A07 | +| A15 <-05--| |--36-> A06 Some of the main design decisions | +| CLK --06->| |--35-> A05 have been the following: | +| D4 <-07->| |--34-> A04 | +| D3 <-08->|.---------.|--33-> A03 1. Opcode partial decoding keeps | +| D5 <-09->|| ZILOG ||--32-> A02 the code small and maintainable. | +| D6 <-10->|| Z80 ||--31-> A01 | +| +5V --11--|| CPU ||--30-> A00 2. Function pointer tables for | +| D2 <-12->|| ||--29-- GND opcode selection allow easy reuse | +| D7 <-13->|'---------'|--28-> RFSH of almost all instruction code | +| D0 <-14->| |--27-> M1 in the interrupt mode 0. | +| D1 <-15->| |<-26-- RESET | +| INT --16->| |<-25-- BUSREQ 3. Avoiding conditional statements | +| NMI --17->| |<-24-- WAIT as much as possible reduces the | +| HALT <-18--| |--23-> BUSACK branch penalty in modern pipelined | +| MREQ <-19--| |--22-> WR processors. | +| IORQ <-20--| |--21-> RD | +| '-----------' | +| Zilog Z80 CPU, May 1976 version | +| 40-pin ceramic DIP pinout Manuel | +| | +'=============================================================================*/ + +#ifndef Z80_DEPENDENCIES_HEADER +# include +# include +# include +#endif + +#ifdef Z80_STATIC +# define Z80_API +#else +# define Z80_API Z_API_EXPORT +#endif + +#ifdef Z80_WITH_LOCAL_HEADER +# include "Z80.h" +#else +# include +#endif + + +/* MARK: - Types */ + +typedef zuint8 (* Insn)(Z80 *self); + +#ifdef Z80_WITH_FULL_IM0 + typedef struct { + Z80* z80; + void* context; + Z80Read fetch; + Z80Read read; + Z80Write write; + Z80Read in; + Z80Write out; + Z80Notify ld_i_a; + Z80Notify ld_r_a; + Z80Notify reti; + Z80Notify retn; + zuint16 pc; + } IM0; +#endif + + +/* MARK: - Instance Variable and Callback Shortcuts */ + +#define MEMPTR self->memptr.uint16_value +#define PC self->pc.uint16_value +#define SP self->sp.uint16_value +#define XY self->xy.uint16_value +#define IX self->ix_iy[0].uint16_value +#define IY self->ix_iy[1].uint16_value +#define AF self->af.uint16_value +#define BC self->bc.uint16_value +#define DE self->de.uint16_value +#define HL self->hl.uint16_value +#define AF_ self->af_.uint16_value +#define BC_ self->bc_.uint16_value +#define DE_ self->de_.uint16_value +#define HL_ self->hl_.uint16_value +#define MEMPTRH self->memptr.uint8_values.at_1 +#define MEMPTRL self->memptr.uint8_values.at_0 +#define PCH self->pc.uint8_values.at_1 +#define A self->af.uint8_values.at_1 +#define F self->af.uint8_values.at_0 +#define B self->bc.uint8_values.at_1 +#define C self->bc.uint8_values.at_0 +#define E self->de.uint8_values.at_0 +#define L self->hl.uint8_values.at_0 +#define I self->i +#define R self->r +#define R7 self->r7 +#define Q self->q +#define IFF1 self->iff1 +#define IFF2 self->iff2 +#define IM self->im +#define HALT_LINE self->halt_line +#define INT_LINE self->int_line +#define DATA self->data.uint8_array +#define REQUEST self->request +#define RESUME self->resume +#define OPTIONS self->options +#define CONTEXT self->context + +#define FETCH_OPCODE(address) self->fetch_opcode(CONTEXT, address) +#define FETCH(address) self->fetch (CONTEXT, address) +#define READ(address) self->read (CONTEXT, address) +#define WRITE(address, value) self->write (CONTEXT, address, value) +#define IN(port) self->in (CONTEXT, port) +#define OUT(port, value) self->out (CONTEXT, port, value) +#define NOTIFY(callback) if (self->callback != Z_NULL) self->callback(CONTEXT) + + +/* MARK: - Callbacks: 16-bit Operations */ + +static inline zuint16 fetch_16(Z80 *self, zuint16 address) + { + zuint8 l = FETCH(address); + return (zuint16)(l | ((zuint16)FETCH(address + 1) << 8)); + } + + +static inline zuint16 read_16(Z80 *self, zuint16 address) + { + zuint8 l = READ(address); + return (zuint16)(l | ((zuint16)READ(address + 1) << 8)); + } + + +static inline void write_16f(Z80 *self, zuint16 address, zuint16 value) + { + WRITE(address, (zuint8)value); + WRITE(address + 1, (zuint8)(value >> 8)); + } + + +static inline void write_16b(Z80 *self, zuint16 address, zuint16 value) + { + WRITE(address + 1, (zuint8)(value >> 8)); + WRITE(address, (zuint8)value); + } + + +#ifndef Z80_WITH_FULL_IM0 + static inline zuint16 int_fetch_16(Z80 *self) + { + zuint8 l = self->int_fetch(CONTEXT, PC); + return (zuint16)(l | ((zuint16)self->int_fetch(CONTEXT, PC) << 8)); + } +#endif + + +#define FETCH_16(address) fetch_16 (self, address) +#define READ_16(address) read_16 (self, address) +#define WRITE_16F(address, value) write_16f(self, address, value) +#define WRITE_16B(address, value) write_16b(self, address, value) + + +/* MARK: - Flags */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +| S Z Y H X P N C | +'-|-|-|-|-|-|-|-|-' + | | | | | | | '-- carry / borrow + | | | | | | '---- addition / subtraction + | | | | | '------ parity (P) / two's complement signed overflow (V) + | | | | '-------- result's bit 3 (undocumented) + | | | '---------- half carry / half borrow + | | '------------ result's bit 5 (undocumented) + | '-------------- zero + '---------------- sign */ + +#define SF 128 +#define ZF 64 +#define YF 32 +#define HF 16 +#define XF 8 +#define PF 4 +#define NF 2 +#define CF 1 + +#define SZPCF (SF | ZF | PF | CF) +#define SZPF (SF | ZF | PF ) +#define SZCF (SF | ZF | CF ) +#define SYXF (SF | YF | XF ) +#define ZPF (ZF | PF ) +#define YXCF (YF | XF | CF ) +#define YXF (YF | XF ) +#define HCF (HF | CF ) + +#define F_SZPC (F & SZPCF) +#define F_SZP (F & SZPF) +#define F_SZC (F & SZCF) +#define F_C (F & CF) +#define A_SYX (A & SYXF) +#define A_YX (A & YXF) + +#define ZF_ZERO(value) (!(value) << 6) + +#ifdef Z80_WITH_PARITY_COMPUTATION + static inline zuint8 pf_parity(zuint8 value) + {return (((0x9669U >> ((value ^ (value >> 4)) & 0xF)) & 1) << 2);} + +# define PF_PARITY pf_parity +#else + static zuint8 const pf_parity_table[256] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* 0 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 1 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 2 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 3 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 4 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 5 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 6 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 7 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 8 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 9 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* A */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* B */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* C */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* D */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* E */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* F */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4}; + +# define PF_PARITY(value) pf_parity_table[value] +#endif + +/*-----------------------------------------------------------------------------. +| `PF_OVERFLOW` computes PF according to whether signed overflow occurs in the | +| addition or subtraction of two integers. For additions, `rhs` must be passed | +| bit-wise ~inverted. For an explanation of the formula, check: | +| * https://stackoverflow.com/a/199668 | +| * http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/Comb/overflow.html | +'=============================================================================*/ + +#define PF_OVERFLOW(width, result, lhs, rhs) \ + (((zuint##width)((lhs ^ rhs) & (lhs ^ result)) >> (width - 3)) & PF) + +/*-----------------------------------------------------------------------------. +| Q serves as an abstraction for a set of latches related to flag computation. | +| From an emulation perspective, instructions that affect the flags copy the | +| final value of F to Q, whereas instructions that do not affect the flags | +| (including `ex af,af'`, `pop af`, internal NOPs and interrupt responses) set | +| Q to 0. Q is used to compute YF and XF in the `ccf` and `scf` instructions. | +| | +| References: | +| * https://worldofspectrum.org/forums/discussion/20345 | +| * https://worldofspectrum.org/forums/discussion/41704 | +'=============================================================================*/ + +#ifdef Z80_WITH_Q +# define FLAGS Q = F +# define Q_0 Q = 0; +#else +# define FLAGS F +# define Q_0 +#endif + + +/* MARK: - Bit Rotation */ + +#define ROL(value) Z_UINT8_ROTATE_LEFT (value, 1) +#define ROR(value) Z_UINT8_ROTATE_RIGHT(value, 1) + + +/* MARK: - 8-Bit Register Resolution */ + +/*---------. .---------------------. +| 76543210 | | J / K | O / P | +|----------| |---------+-----------| +| __jjj___ | | 000 = b | 000 = b | +| _____kkk | | 001 = c | 001 = c | +| __ooo___ | | 010 = d | 010 = d | +| _____ppp | | 011 = e | 011 = e | +'----------' | 100 = h | 100 = XYh | + | 101 = l | 101 = XYl | + | 111 = a | 111 = a | + '--------------------*/ + +static zusize const j_k_table[8] = { + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, hl.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, hl.uint8_values.at_0), + 0, + Z_MEMBER_OFFSET(Z80, af.uint8_values.at_1)}; + +static zusize const o_p_table[8] = { + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, xy.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, xy.uint8_values.at_0), + 0, + Z_MEMBER_OFFSET(Z80, af.uint8_values.at_1)}; + +#define REGISTER_8(table, offset, shift) \ + *((zuint8 *)self + table[(DATA[offset] shift) & 7]) + +#define J0 REGISTER_8(j_k_table, 0, >> 3 ) +#define J1 REGISTER_8(j_k_table, 1, >> 3 ) +#define K0 REGISTER_8(j_k_table, 0, Z_EMPTY) +#define K1 REGISTER_8(j_k_table, 1, Z_EMPTY) +#define K3 REGISTER_8(j_k_table, 3, Z_EMPTY) +#define O REGISTER_8(o_p_table, 1, >> 3 ) +#define P REGISTER_8(o_p_table, 1, Z_EMPTY) + + +/* MARK: - 16-Bit Register Resolution */ + +/*---------. .-----------------------------. +| 76543210 | | S | T | W | +|----------| |---------+---------+---------| +| __ss____ | | 00 = bc | 00 = bc | 00 = bc | +| __tt____ | | 01 = de | 01 = de | 01 = de | +| __ww____ | | 10 = hl | 10 = hl | 10 = XY | +'----------' | 11 = sp | 11 = af | 11 = sp | + '----------------------------*/ + +static zusize const s_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, hl.uint16_value), + Z_MEMBER_OFFSET(Z80, sp.uint16_value)}; + +static zusize const t_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, hl.uint16_value), + Z_MEMBER_OFFSET(Z80, af.uint16_value)}; + +static zusize const w_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, xy.uint16_value), + Z_MEMBER_OFFSET(Z80, sp.uint16_value)}; + +#define REGISTER_16(table, offset) \ + *(zuint16 *)(void *)((zchar *)self + table[(DATA[offset] >> 4) & 3]) + +#define SS0 REGISTER_16(s_table, 0) +#define SS1 REGISTER_16(s_table, 1) +#define TT REGISTER_16(t_table, 0) +#define WW REGISTER_16(w_table, 1) + + +/* MARK: - Condition Evaluation */ + +/*---------. .----------. +| 76543210 | | Z | +|----------| |----------| +| __zzz___ | | 000 = nz | +| ___zz___ | | 001 = z | +'----------' | 010 = nc | + | 011 = c | + | 100 = po | + | 101 = pe | + | 110 = p | + | 111 = m | + '---------*/ + +static zuint8 const z_table[8] = {ZF, ZF, CF, CF, PF, PF, SF, SF}; + + +static inline zsint zzz(Z80 const *self, zuint8 mask) + { + zsint z = (DATA[0] >> 3) & mask; + + return !(F & z_table[z]) ^ (z & 1); + } + + +/* MARK: - 8-Bit Arithmetic and Logical Operations */ + +/*---------. .---------------------. +| 76543210 | | U SZYHXPNC | +|----------| |---------------------| +| __uuu___ | | 000 = add szycxv0c | +| _____10v | | 001 = adc szycxv0c | +'----------' | 010 = sub szybxv1b | + | 011 = sbc szybxv1b | + | 100 = and szy1xp00 | + | 101 = xor szy0xp00 | + | 110 = or szy0xp00 | + | 111 = cp sz*b*v1b | + |---------------------| + | V SZYHXPNC | + |---------------------| + | 100 = inc szycxv0. | + | 101 = dec szybxv1. | + '--------------------*/ + +static void uuu(Z80 *self, zuint8 offset, zuint8 rhs) + { + zuint8 t, f; + + switch ((DATA[offset] >> 3) & 7) + { + case 0: /* add */ + t = A + rhs; + + f = ((zuint)A + rhs > 255) | /* CF = carry */ + PF_OVERFLOW(8, t, A, ~rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-carry */ + /* NF = 0 */ + A = t; + break; + + case 1: /* adc */ + t = A + rhs + (f = F_C); + + f = ((zuint)A + rhs + f > 255) | /* CF = carry */ + PF_OVERFLOW(8, t, A, ~rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-carry */ + /* NF = 0 */ + A = t; + break; + + case 2: /* sub */ + t = A - rhs; + + f = (A < rhs) | /* CF = borrow */ + NF | /* NF = 1 */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-borrow */ + + A = t; + break; + + case 3: /* sbc */ + t = A - rhs - (f = F_C); + + f = ((zsint)A - rhs - f < 0) | /* CF = borrow */ + NF | /* NF = 1 */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-borrow */ + + A = t; + break; + + case 4: /* and */ + A &= rhs; + f = HF | PF_PARITY(A); /* HF = 1; PF = parity */ + break; /* NF, CF = 0 */ + + case 5: /* xor */ + A ^= rhs; + f = PF_PARITY(A); /* PF = parity */ + break; /* HF, NF, CF = 0 */ + + case 6: /* or */ + A |= rhs; + f = PF_PARITY(A); /* PF = parity */ + break; /* HF, NF, CF = 0 */ + + case 7: /* cp */ + t = A - rhs; + + FLAGS = (zuint8)( + (t & SF) | /* SF = sign */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ rhs ^ t) & HF) | /* HF = half-borrow */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + (A < rhs) | /* CF = borrow */ + (rhs & YXF) | /* YF = rhs.5; XF = rhs.3 */ + NF); /* NF = 1 */ + + return; + } + + FLAGS = (zuint8)( + f | /* HF, PF, NF and CF already computed */ + A_SYX | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(A)); /* ZF = zero */ + } + + +static zuint8 vvv(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 dec = DATA[offset] & 1; + zuint8 nf = (zuint8)(dec << 1); + zuint8 t = value + 1 - nf; + + FLAGS = (zuint8)( + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((value ^ t) & HF) | /* HF = half-carry/borrow */ + ((value == 127 + dec) << 2) | /* PF = overflow */ + nf | /* NF = 0 (inc), 1 (dec) */ + F_C); /* CF unchanged */ + + return t; + } + + +/* MARK: - Rotation and Shift Operations */ + +/*---------. .-----------. +| 76543210 | | G | +|----------| |-----------| +| __ggg___ | | 000 = rlc | +'----------' | 001 = rrc | + | 010 = rl | + | 011 = rr | + | 100 = sla | + | 101 = sra | + | 110 = sll | + | 111 = srl | + '----------*/ + +static zuint8 ggg(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 cf; + + switch ((DATA[offset] >> 3) & 7) + { + /* rlc .----------------. + .----. | .---------. | + | CF |<-----| 7 <-- 0 |<--' + '----' '--------*/ + case 0: + cf = (value = ROL(value)) & 1; + break; + + /* rrc .----------------. + | .---------. | .----. + '-->| 7 --> 0 |----->| CF | + '---------' '---*/ + case 1: + cf = value & 1; + value = ROR(value); + break; + + /* rl .-------------------------. + | .----. .---------. | + '--| CF |<--| 7 <-- 0 |<--' + '----' '--------*/ + case 2: + cf = value >> 7; + value = (zuint8)((value << 1) | F_C); + break; + + /* rr .-------------------------. + | .---------. .----. | + '-->| 7 --> 0 |-->| CF |--' + '---------' '---*/ + case 3: + cf = value & 1; + value = (zuint8)((value >> 1) | ((zuint8)F_C << 7)); + break; + + /* sla .----. .---------. + | CF |<--| 7 <-- 0 |<-- 0 + '----' '--------*/ + case 4: + cf = value >> 7; + value <<= 1; + break; + + /* sra .---------. .----. + .-->| 7 --> 0 |-->| CF | + | '-|-------' '----' + '----*/ + case 5: + cf = value & 1; + value = (zuint8)((value & 128) | (value >> 1)); + break; + + /* sll .----. .---------. + | CF |<--| 7 <-- 0 |<-- 1 + '----' '--------*/ + case 6: + cf = value >> 7; + value = (zuint8)((value << 1) | 1); + break; + + /* srl .---------. .----. + 0 -->| 7 --> 0 |-->| CF | + '---------' '---*/ + case 7: + cf = value & 1; + value >>= 1; + break; + + /* Uncoment to avoid compiler warnings */ + /*default: cf = 0;*/ + } + + FLAGS = (zuint8)( /* HF, NF = 0 */ + (value & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(value) | /* ZF = zero */ + PF_PARITY(value) | /* PF = parity */ + cf); /* CF already computed */ + + return value; + } + + +/* MARK: - Bit Set and Reset Operations */ + +/*---------. .---------. +| 76543210 | | M | +|----------| |---------| +| _m______ | | 0 = res | +'----------' | 1 = set | + '--------*/ + +static inline zuint8 m(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 t; + + Q_0 + t = DATA[offset]; + + return (zuint8)((t & 64) + ? value | (1U << ((t >> 3) & 7)) + : value & ~(1U << ((t >> 3) & 7))); + } + + +/* MARK: - Function Shortcuts and Reusable Code */ + +#define INSN(name) static zuint8 name(Z80 *self) +#define N(offset) ((DATA[offset] >> 3) & 7) +#define Z(mask) zzz(self, mask) +#define U0(value) uuu(self, 0, value) +#define U1(value) uuu(self, 1, value) +#define V0(value) vvv(self, 0, value) +#define V1(value) vvv(self, 1, value) +#define G1(value) ggg(self, 1, value) +#define G3(value) ggg(self, 3, value) +#define M1(value) m (self, 1, value) +#define M3(value) m (self, 3, value) +#define PUSH(value) WRITE_16B(SP -= 2, value) +#define R_ALL ((R & 127) | (R7 & 128)) +#define RET MEMPTR = PC = READ_16(SP); SP += 2 +#define FETCH_XY_EA(address) MEMPTR = (zuint16)(XY + (zsint8)FETCH(address)) +#define IS_XY_PREFIX(opcode) ((opcode) & 0xDF) == 0xDD +#define EX(a, b) t = a; a = b; b = t + + +#define LD_A_IR(rhs) \ + A = rhs; \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + A_SYX | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(A) | /* ZF = zero */ \ + (IFF2 << 2) | /* PF = IFF2 */ \ + F_C); /* CF unchanged */ \ + \ + PC += 2; \ + return 9 + + +#define LDX(operator) \ + zuint8 t = READ(HL operator); \ + \ + WRITE(DE operator, t); \ + t += A; \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + F_SZC | /* SF, ZF, CF unchanged */ \ + ((t & 2) << 4) | /* YF = (A + [HLi]).1 */ \ + (t & XF) | /* XF = (A + [HLi]).3 */ \ + (!!(--BC) << 2)); /* PF = !!BCo */ \ + \ + PC += 2; \ + return 16 + + +#define LDXR(operator) \ + zuint8 t = READ(HL operator); \ + \ + WRITE(DE operator, t); \ + t += A; \ + \ + if (--BC) \ + { /* HF, NF = 0 */ \ + FLAGS = F_SZC | /* SF, ZF, CF unchanged */ \ + ((PC >> 8) & YXF) | /* YF = PCi.13; XF = PCi.11 */ \ + PF; /* PF = 1 */ \ + \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = (zuint8)( /* HF, PF, NF = 0 */ \ + F_SZC | /* SF, ZF, CF unchanged */ \ + ((t & 2) << 4) | /* YF = (A + [HLi]).1 */ \ + (t & XF)); /* XF = (A + [HLi]).3 */ \ + \ + PC += 2; \ + return 16 + + +#define CPX(operator) \ + zuint8 n = READ(HL operator); \ + zuint8 t0 = A - n; \ + zuint8 hf = (A ^ n ^ t0) & HF; \ + zuint8 t1 = t0 - (hf >> 4); \ + \ + FLAGS = (zuint8)( \ + (t0 & SF) | /* SF = sign */ \ + ZF_ZERO(t0) | /* ZF = zero */ \ + hf | /* HF = half-borrow */ \ + ((t1 & 2) << 4) | /* YF = (A - [HLi] - HFo).1 */ \ + (t1 & XF) | /* XF = (A - [HLi] - HFo).3 */ \ + (!!(--BC) << 2) | /* PF = !!BCo */ \ + NF | /* NF = 1 */ \ + F_C); /* CF unchanged */ \ + \ + MEMPTR operator; \ + PC += 2; \ + return 16 + + +#define CPXR(operator) \ + zuint8 n = READ(HL operator); \ + zuint8 t0 = A - n; \ + zuint8 hf = (A ^ n ^ t0) & HF; \ + zuint8 t1 = t0 - (hf >> 4); \ + \ + zuint8 f = (zuint8)( \ + (t0 & SF) | /* SF = sign */ \ + ZF_ZERO(t0) | /* ZF = zero */ \ + hf | /* HF = half-borrow */ \ + (!!(--BC) << 2) | /* PF = !!BCo */ \ + NF | /* NF = 1 */ \ + F_C); /* CF unchanged */ \ + \ + if (t0 && BC) \ + { \ + /* YF = PCi.13; XF = PCi.11 */ \ + FLAGS = f | ((PC >> 8) & YXF); \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = (zuint8)( \ + f | \ + ((t1 & 2) << 4) | /* YF = (A - [HLi] - HFo).1 */ \ + (t1 & XF)); /* XF = (A - [HLi] - HFo).3 */ \ + \ + MEMPTR operator; \ + PC += 2; \ + return 16 + + +#define ADD_16(lhs, rhs, pc_increment) \ + zuint16 n = rhs; \ + zuint32 t = lhs + n; \ + \ + FLAGS = (zuint8)( /* NF = 0 */ \ + F_SZP | /* SF, ZF, PF unchanged */ \ + ((t >> 8) & YXF) | /* YF = high-Y; XF = high-X */ \ + (((lhs ^ n ^ t) >> 8) & HF) | /* HF = high-half-carry */ \ + ((t >> 16) & 1)); /* CF = carry */ \ + \ + MEMPTR = lhs + 1; \ + lhs = (zuint16)t; \ + pc_increment; \ + return 11 + + +#define ADC_SBC_HL_SS(operator, pf_overflow_rhs, or_nf) \ + zuint16 ss = SS1; \ + zuint32 t = HL operator ss operator F_C; \ + \ + FLAGS = (zuint8)( \ + ((t >> 8) & SYXF) /* SF = sign; YF = high-Y; XF = high-X */ \ + | (zuint8)ZF_ZERO((zuint16)t) /* ZF = zero */ \ + /* HF = high-half-carry (adc), high-half-borrow (sbc) */ \ + | (((HL ^ ss ^ t) >> 8) & HF) \ + /* PF = overflow */ \ + | PF_OVERFLOW(16, t, HL, pf_overflow_rhs) \ + | ((t >> 16) & 1) /* CF = carry (adc), borrow (sbc) */ \ + or_nf); /* NF = 0 (adc), 1 (sbc) */ \ + \ + MEMPTR = HL + 1; \ + HL = (zuint16)t; \ + PC += 2; \ + return 15 + + +/* rla .-------------------------. rra .-------------------------. + | .----. .----A----. | | .----A----. .----. | + '--| CF |<--| 7 <-- 0 |<--' '-->| 7 --> 0 |-->| CF |--' + '----' '---------' '---------' '---*/ + +#define RXA(a_to_cf, operator, fc_to_a) \ + zuint8 cf = a_to_cf; \ + \ + A = (zuint8)((A operator 1) | fc_to_a); \ + \ + FLAGS = F_SZP | /* SF, ZF, PF unchanged */ \ + A_YX | /* YF = Y; XF = X */ \ + cf; /* CF = Ai.7 (rla), Ai.0 (rra) */ \ + /* HF, NF = 0 */ \ + PC++; \ + return 4 + + +/* rld .------------------------. rrd .------------------------. + | | | | +.--------|--. .-------------. | .--------V--. .-------------. | +| 7-4 | 3-0 |<--| 7-4 <-- 3-0 |<--' | 7-4 | 3-0 |-->| 7-4 --> 3-0 |---' +'-----A-----' '----(HL)-----' '-----A-----' '----(HL)----*/ + +#define RXD(vhl_to_vhl, a_to_vhl, vhl_to_a) \ + zuint8 t = READ(HL); \ + \ + MEMPTR = HL + 1; \ + WRITE(HL, (zuint8)((t vhl_to_vhl) | (A a_to_vhl))); \ + A = (A & 0xF0) | (t vhl_to_a); \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + A_SYX | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(A) | /* ZF = zero */ \ + PF_PARITY(A) | /* PF = parity */ \ + F_C); /* CF unchanged */ \ + \ + PC += 2; \ + return 18 + + +#define DJNZ_JR_Z_OFFSET(condition, cycles_if_true, cycles_if_false) \ + zsint8 offset; \ + \ + Q_0 \ + offset = (zsint8)FETCH(PC + 1); /* Always read */ \ + \ + if (condition) \ + { \ + MEMPTR = (PC += 2 + offset); \ + return cycles_if_true; \ + } \ + \ + PC += 2; \ + return cycles_if_false + + +#define RETX(mnemonic) \ + DATA[2] = IFF1; \ + NOTIFY(mnemonic); \ + Q_0 \ + RET; \ + if ((IFF1 = IFF2) && INT_LINE) REQUEST |= Z80_REQUEST_INT; \ + return 14 + + +#define IN_VC(set_lhs) \ + zuint8 t; \ + \ + MEMPTR = BC + 1; \ + t = IN(BC); \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(t) | /* ZF = zero */ \ + PF_PARITY(t) | /* PF = parity */ \ + F_C); /* CF unchanged */ \ + \ + set_lhs \ + PC += 2; \ + return 12 + + +#define INX_OUTX_COMMON(io) \ + FLAGS = (zuint8)( \ + (B & SYXF) | /* SF = Bo.7; YF = Bo.5; XF = Bo.3 */ \ + ZF_ZERO(B) | /* ZF = !Bo */ \ + PF_PARITY((t & 7) ^ B) | /* PF = ((T & 7) ^ Bo).parity */ \ + ((t > 255) ? HCF : 0) | /* HF, CF = T > 255 */ \ + ((io >> 6) & NF)); /* NF = IO.7 */ \ + \ + PC += 2; \ + return 16 + + +#define INX(hl_operator, memptr_operator) \ + zuint8 io = IN(BC); \ + zuint t = (zuint)io + (zuint8)(C memptr_operator 1); \ + \ + WRITE(HL hl_operator, io); \ + MEMPTR = BC memptr_operator 1; \ + B--; \ + INX_OUTX_COMMON(io) + + +#define OUTX(hl_operator, memptr_operator) \ + zuint8 io = READ(HL hl_operator); \ + zuint t = (zuint)io + L; \ + \ + B--; \ + MEMPTR = BC memptr_operator 1; \ + OUT(BC, io); \ + INX_OUTX_COMMON(io) + + +/*-----------------------------------------------------------------------------. +| Block instructions produce an extra M-cycle of 5 T-states to decrement PC if | +| the loop condition is met. In 2018, David Banks (AKA hoglet) discovered that | +| the Z80 CPU performs additional flag changes during this M-cycle and managed | +| to decipher the behaviors. All block instructions copy bits 13 and 11 of PCi | +| to YF and XF, respectively [1.1], but `inir`, `indr`, `otir` and `otdr` also | +| modify HF and PF in a very complicated way [1.2]. These latter two flags are | +| not commented here because the explanation would not be simpler than the | +| code itself, so please refer to David Banks' paper [2] for more information. | +| | +| David Banks' discoveries have been corroborated thanks to Peter Helcmanovsky | +| (AKA Ped7g), who wrote a test that covers most of the cases that can be | +| verified on a ZX Spectrum [3]. | +| | +| In 2022, rofl0r discovered that the instructions `otir` and `otdr` also set | +| MEMPTR to `PCi + 1` during the extra M-cycle [4]. However, this information | +| was not announced anywhere and went unnoticed by the emulation community | +| until 2023, when Manuel Sainz de Baranda y Goñi rediscovered the same | +| behaviour in all four I/O block instructions: `inir`, `indr`, `otir` and | +| `otdr` [5]. | +| | +| References: | +| 1. https://stardot.org.uk/forums/viewtopic.php?t=15464 | +| 1. https://stardot.org.uk/forums/viewtopic.php?p=211042#p211042 | +| 2. https://stardot.org.uk/forums/viewtopic.php?p=212021#p212021 | +| 2. Banks, David (2018-08-21). "Undocumented Z80 Flags" rev. 1.0. | +| * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags | +| * https://stardot.org.uk/forums/download/file.php?id=39831 | +| 3. Helcmanovsky, Peter (2021/2022). "Z80 Block Flags Test". | +| * https://github.com/MrKWatkins/ZXSpectrumNextTests | +| 4. https://github.com/hoglet67/Z80Decoder/issues/2 | +| 5. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=10555 | +'=============================================================================*/ + +#define INXR_OTXR_COMMON \ + if (B) { \ + FLAGS = (zuint8)( /* ZF = 0 */ \ + (B & SF) | /* SF = Bo.7 */ \ + (PCH & YXF) | /* YF = PCi.13; XF = PCi.11 */ \ + nf | /* NF = IO.7 */ \ + (hcf ? /* CF = T > 255 */ \ + CF | \ + (nf ? \ + (!(B & 0xF) << 4) | \ + PF_PARITY(p ^ ((B - 1) & 7)) \ + : \ + (((B & 0xF) == 0xF) << 4) | \ + PF_PARITY(p ^ ((B + 1) & 7))) \ + : PF_PARITY(p ^ (B & 7)))); \ + \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = ZF | /* ZF = 1; SF, YF, XF = 0 */ \ + hcf | /* HF, CF = T > 255 */ \ + PF_PARITY(p) | /* PF = ((T & 7) ^ Bo).parity */ \ + nf /* NF = IO.7 */ + + +#define INXR(hl_operator, memptr_operator) \ + zuint8 io = IN(BC); \ + zuint8 nf = (io >> 6) & NF; \ + zuint t; \ + zuint8 hcf, p; \ + \ + WRITE(HL hl_operator, io); \ + t = (zuint)io + (zuint8)(MEMPTR = BC memptr_operator 1); \ + hcf = (t > 255) ? HCF : 0; \ + p = (t & 7) ^ --B; \ + INXR_OTXR_COMMON; \ + PC += 2; \ + return 16 + + +#define OTXR(hl_operator, memptr_operator) \ + zuint8 io = READ(HL hl_operator); \ + zuint8 nf = (io >> 6) & NF; \ + zuint t = (zuint)io + L; \ + zuint8 hcf = (t > 255) ? HCF : 0; \ + zuint8 p = (t & 7) ^ --B; \ + \ + OUT(BC, io); \ + INXR_OTXR_COMMON; \ + MEMPTR = BC memptr_operator 1; \ + PC += 2; \ + return 16 + + +#define EXIT_HALT \ + HALT_LINE = 0; \ + if (self->halt != Z_NULL) self->halt(CONTEXT, 0) + + +/* MARK: - Instructions: 8-Bit Load Group */ +/*----------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 12345 | +| ------------------- -------------------------------- -------- -------- | +| ld J,K 01jjjkkk ........ 4:4 | +|* ld O,P <--XY-->01oooppp ........ 8:44 | +| ld J,BYTE 00jjj110<-BYTE-> ........ 7:43 | +|* ld O,BYTE <--XY-->00ooo110<-BYTE-> ........ 11:443 | +| ld J,(hl) 01jjj110 ........ 7:43 | +| ld J,(XY+OFFSET) <--XY-->01jjj110 ........ 19:44353 | +| ld (hl),K 01110kkk ........ 7:43 | +| ld (XY+OFFSET),K <--XY-->01110kkk ........ 19:44353 | +| ld (hl),BYTE <--36--><-BYTE-> ........ 10:433 | +| ld (XY+OFFSET),BYTE <--XY--><--36--><-BYTE-> ........ 19:44353 | +| ld a,(bc) <--0A--> ........ 7:43 | +| ld a,(de) <--1A--> ........ 7:43 | +| ld a,(WORD) <--3A--><-----WORD-----> ........ 13:4333 | +| ld (bc),a <--02--> ........ 7:43 | +| ld (de),a <--12--> ........ 7:43 | +| ld (WORD),a <--32--><-----WORD-----> ........ 13:4333 | +| ld a,i <--ED--><--57--> szy0x*0. 9:45 | +| ld a,r <--ED--><--5F--> szy0x*0. 9:45 | +| ld i,a <--ED--><--47--> ........ 9:45 | +| ld r,a <--ED--><--4F--> ........ 9:45 | +|-----------------------------------------------------------------------------| +| (*) Undocumented instruction. | +'============================================================================*/ + +INSN(ld_J_K ) {Q_0 J0 = K0; PC++; return 4;} +INSN(ld_O_P ) {Q_0 O = P; PC += 2; return 4;} +INSN(ld_J_BYTE ) {Q_0 J0 = FETCH((PC += 2) - 1); return 7;} +INSN(ld_O_BYTE ) {Q_0 O = FETCH((PC += 3) - 1); return 7;} +INSN(ld_J_vhl ) {Q_0 J0 = READ(HL); PC++; return 7;} +INSN(ld_J_vXYpOFFSET) {Q_0 J1 = READ(FETCH_XY_EA((PC += 3) - 1)); return 15;} +INSN(ld_vhl_K ) {Q_0 WRITE(HL, K0); PC++; return 7;} +INSN(ld_vXYpOFFSET_K) {Q_0 WRITE(FETCH_XY_EA((PC += 3) - 1), K1); return 15;} +INSN(ld_vhl_BYTE ) {Q_0 WRITE(HL, FETCH((PC += 2) - 1)); return 10;} +INSN(ld_a_vbc ) {Q_0 MEMPTR = BC + 1; A = READ(BC); PC++; return 7;} +INSN(ld_a_vde ) {Q_0 MEMPTR = DE + 1; A = READ(DE); PC++; return 7;} +INSN(ld_a_vWORD ) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); A = READ(MEMPTR++); return 13;} +INSN(ld_vbc_a ) {Q_0 MEMPTRL = C + 1; WRITE(BC, MEMPTRH = A); PC++; return 7;} +INSN(ld_vde_a ) {Q_0 MEMPTRL = E + 1; WRITE(DE, MEMPTRH = A); PC++; return 7;} +INSN(ld_a_i ) {LD_A_IR(I); } +INSN(ld_a_r ) {LD_A_IR(R_ALL); } +INSN(ld_i_a ) {NOTIFY(ld_i_a); Q_0 I = A; PC += 2; return 9;} +INSN(ld_r_a ) {NOTIFY(ld_r_a); Q_0 R = R7 = A; PC += 2; return 9;} + + +INSN(ld_vXYpOFFSET_BYTE) + { + zuint16 ea; + + Q_0 + ea = FETCH_XY_EA((PC += 4) - 2); + WRITE(ea, FETCH(PC - 1)); + return 15; + } + + +INSN(ld_vWORD_a) + { + zuint16 ea; + + Q_0 + MEMPTRL = (zuint8)((ea = FETCH_16((PC += 3) - 2)) + 1); + WRITE(ea, MEMPTRH = A); + return 13; + } + + +/* MARK: - Instructions: 16-Bit Load Group */ +/*----------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| ------------ -------------------------------- -------- --------- | +| ld SS,WORD 00ss0001<-----WORD-----> ........ 10:433 [1] +| ld XY,WORD <--XY--><--21--><-----WORD-----> ........ 14:4433 | +| ld hl,(WORD) <--2A--><-----WORD-----> ........ 16:43333 | +| ld SS,(WORD) <--ED-->01ss1011<-----WORD-----> ........ 20:443333 | +| ld XY,(WORD) <--XY--><--2A--><-----WORD-----> ........ 20:443333 | +| ld (WORD),hl <--22--><-----WORD-----> ........ 16:43333 | +| ld (WORD),SS <--ED-->01ss0011<-----WORD-----> ........ 20:443333 | +| ld (WORD),XY <--XY--><--22--><-----WORD-----> ........ 20:443333 | +| ld sp,hl <--F9--> ........ 6:6 | +| ld sp,XY <--XY--><--F9--> ........ 10:46 | +| push TT 11tt0101 ........ 11:533 | +| push XY <--XY--><--E5--> ........ 15:4533 | +| pop TT 11tt0001 ........ 10:433 | +| pop XY <--XY--><--E1--> ........ 14:4433 | +|-----------------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have a typo in the | +| M-cycles of the instruction. | +'======================================================================*/ + +INSN(ld_SS_WORD ) {Q_0 SS0 = FETCH_16((PC += 3) - 2); return 10;} +INSN(ld_XY_WORD ) {Q_0 XY = FETCH_16((PC += 4) - 2); return 10;} +INSN(ld_hl_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); HL = READ_16(MEMPTR++); return 16;} +INSN(ld_SS_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); SS1 = READ_16(MEMPTR++); return 20;} +INSN(ld_XY_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); XY = READ_16(MEMPTR++); return 16;} +INSN(ld_vWORD_hl) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); WRITE_16F(MEMPTR++, HL ); return 16;} +INSN(ld_vWORD_SS) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); WRITE_16F(MEMPTR++, SS1); return 20;} +INSN(ld_vWORD_XY) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); WRITE_16F(MEMPTR++, XY ); return 16;} +INSN(ld_sp_hl ) {Q_0 SP = HL; PC++; return 6;} +INSN(ld_sp_XY ) {Q_0 SP = XY; PC += 2; return 6;} +INSN(push_TT ) {Q_0 PUSH(TT); PC++; return 11;} +INSN(push_XY ) {Q_0 PUSH(XY); PC += 2; return 11;} +INSN(pop_TT ) {Q_0 TT = READ_16(SP); SP += 2; PC++; return 10;} +INSN(pop_XY ) {Q_0 XY = READ_16(SP); SP += 2; PC += 2; return 10;} + + +/* MARK: - Instructions: Exchange, Block Transfer and Search Groups */ +/*-------------------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC !0 123456 =0 1234 | +| ---------- ---------------- -------- ------------------ | +| ex de,hl <--EB--> ........ 4:4 | +| ex af,af' <--08--> ........ 4:4 | +| exx <--D9--> ........ 4:4 | +| ex (sp),hl <--E3--> ........ 19:43435 | +| ex (sp),XY <--XY--><--E3--> ........ 23:443435 | +| ldi <--ED--><--A0--> ..*0**0. 16:4435 | +| ldir <--ED--><--B0--> ..*0*00. 21:44355 16:4435 | +| ldd <--ED--><--A8--> ..*0**0. 16:4435 | +| lddr <--ED--><--B8--> ..*0*00. 21:44355 16:4435 | +| cpi <--ED--><--A1--> sz*b**1. 16:4435 | +| cpir <--ED--><--B1--> sz*b**1. 21:44355 16:4435 | +| cpd <--ED--><--A9--> sz*b**1. 16:4435 | +| cpdr <--ED--><--B9--> sz*b**1. 21:44355 16:4435 | +'=============================================================*/ + +INSN(ex_de_hl ) {zuint16 t; Q_0 EX(DE, HL ); PC++; return 4;} +INSN(ex_af_af_) {zuint16 t; Q_0 EX(AF, AF_); PC++; return 4;} +INSN(exx ) {zuint16 t; Q_0 EX(BC, BC_); EX(DE, DE_); EX(HL, HL_); PC++; return 4;} +INSN(ex_vsp_hl) {Q_0 MEMPTR = READ_16(SP); WRITE_16B(SP, HL); HL = MEMPTR; PC++; return 19;} +INSN(ex_vsp_XY) {Q_0 MEMPTR = READ_16(SP); WRITE_16B(SP, XY); XY = MEMPTR; PC += 2; return 19;} +INSN(ldi ) {LDX (++); } +INSN(ldir ) {LDXR(++); } +INSN(ldd ) {LDX (--); } +INSN(lddr ) {LDXR(--); } +INSN(cpi ) {CPX (++); } +INSN(cpir ) {CPXR(++); } +INSN(cpd ) {CPX (--); } +INSN(cpdr ) {CPXR(--); } + + +/* MARK: - Instructions: 8-Bit Arithmetic and Logical Group */ +/*-------------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC 123456 | +| ----------------- ------------------------ -------- --------- | +| U [a,]K 10uuukkk sz|||||| 4:4 | +|* U [a,]P <--XY-->10uuuppp sz|||||| 8:44 | +| U [a,]BYTE 11uuu110<-BYTE-> sz|||||| 7:43 | +| U [a,](hl) 10uuu110 sz|||||| 7:43 | +| U [a,](XY+OFFSET) <--XY-->10uuu110 sz|||||| 19:44353 | +| V J 00jjj10v szy|xv|. 4:4 | +|* V O <--XY-->00ooo10v szy|xv|. 8:44 | +| V (hl) 0011010v szy|xv|. 11:443 | +| V (XY+OFFSET) <--XY-->0011010v szy|xv|. 23:443543 | +|--------------------------------------------------------------------| +| (*) Undocumented instruction. | +| (|) The flag is explained in table U/V. | +'===================================================================*/ + +INSN(U_a_K ) {U0(K0); PC++; return 4;} +INSN(U_a_P ) {U1(P); PC += 2; return 4;} +INSN(U_a_BYTE ) {U0(FETCH((PC += 2) - 1)); return 7;} +INSN(U_a_vhl ) {U0(READ(HL)); PC++; return 7;} +INSN(U_a_vXYpOFFSET) {U1(READ(FETCH_XY_EA((PC += 3) - 1))); return 15;} +INSN(V_J ) {zuint8 *j = &J0; *j = V0(*j); PC++; return 4;} +INSN(V_O ) {zuint8 *o = &O; *o = V1(*o); PC += 2; return 4;} +INSN(V_vhl ) {WRITE(HL, V0(READ(HL))); PC++; return 11;} +INSN(V_vXYpOFFSET ) {zuint16 ea = FETCH_XY_EA((PC += 3) - 1); WRITE(ea, V1(READ(ea))); return 19;} + + +/* MARK: - Instructions: General-Purpose Arithmetic and CPU Control Groups */ +/*-------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC 12 | +| -------- ---------------- -------- -------- | +| daa <--27--> szy^xp.* 4:4 | +| cpl <--2F--> ..y1x.1. 4:4 | +|- neg <--ED-->01***100 szybxv1b 8:44 | +| ccf <--3F--> ..***.0~ 4:4 | +| scf <--37--> ..*0*.01 4:4 | +| nop <--00--> ........ 4:4 | +| halt <--76--> ........ 4:4 | +| di <--F3--> ........ 4:4 | +| ei <--FB--> ........ 4:4 | +|- im 0 <--ED-->01*0*110 ........ 8:44 | +|- im 1 <--ED-->01*10110 ........ 8:44 | +|- im 2 <--ED-->01*11110 ........ 8:44 | +|--------------------------------------------------| +| (-) The instruction has undocumented opcodes. | +'=================================================*/ + +INSN(nop ) {Q_0 PC++; return 4;} +INSN(im_0) {Q_0 IM = 0; PC += 2; return 8;} +INSN(im_1) {Q_0 IM = 1; PC += 2; return 8;} +INSN(im_2) {Q_0 IM = 2; PC += 2; return 8;} + + +INSN(daa) + { + zuint8 cf = A > 0x99, t = ((F & HF) || (A & 0xF) > 9) ? 6 : 0; + + if (F_C || cf) t |= 0x60; + t = (F & NF) ? A - t : A + t; + + FLAGS = (zuint8)( + (F & (NF | CF)) | /* NF unchanged; CF dominant */ + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ t) & HF) | /* HF = Ai.4 != Ao.4 */ + PF_PARITY(t) | /* PF = parity */ + cf); /* CF |= 1 (if BCD carry) */ + + A = t; + PC++; + return 4; + } + + +INSN(cpl) + { + FLAGS = F_SZPC | /* SF, ZF, PF, CF unchanged */ + ((A = ~A) & YXF) | /* YF = Y; XF = X */ + HF | NF; /* HF, NF = 1 */ + + PC++; + return 4; + } + + +INSN(neg) + { + zuint8 t = (zuint8)-A; + + FLAGS = (zuint8)( + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ t) & HF) | /* HF = half-borrow */ + ((t == 128) << 2) | /* PF = overflow */ + NF | /* NF = 1 */ + !!A); /* CF = borrow (not 0) */ + + A = t; + PC += 2; + return 8; + } + + +/*---------------------------------------------------------------------------. +| `ccf` and `scf` are the only instructions in which Q affects the flags. | +| Patrik Rak cracked the behavior of YF and XF in 2012, confirming that they | +| are taken, respectively, from bits 5 and 3 of the result of `(Q ^ F) | A` | +| [1,2]. This applies to all Zilog Z80 models, both NMOS and CMOS. In 2018, | +| David Banks (AKA hoglet) discovered that at least some ST CMOS models do | +| not set XF according to this formula and instead take this flag from bit 3 | +| of A, whereas NEC NMOS models take both flags from A [3]. | +| | +| References: | +| 1. https://worldofspectrum.org/forums/discussion/20345 | +| 2. https://worldofspectrum.org/forums/discussion/41704 | +| 3. Banks, David (2018-08-21). "Undocumented Z80 Flags" rev. 1.0. | +| * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags | +| * https://stardot.org.uk/forums/download/file.php?id=39831 | +'===========================================================================*/ + +INSN(ccf) + { + FLAGS = (zuint8)( + (F_SZPC ^ CF) | /* SF, ZF, PF unchanged; CF = ~CFi */ + /* Zilog: YF = A.5 | (YFi ^ YQi); XF = A.3 | (XFi ^ XQi) */ + /* ST CMOS: YF = A.5 | (YFi ^ YQi); XF = A.3 */ + /* NEC NMOS: YF = A.5; XF = A.3 */ +# ifdef Z80_WITH_Q + ((((F ^ Q) & OPTIONS) | A) & YXF) | +# else + (A & YXF) | +# endif + (F_C << 4)); /* HF = CFi */ + /* NF = 0 */ + PC++; + return 4; + } + + +INSN(scf) + { + FLAGS = F_SZP | /* SF, ZF, PF unchanged */ + /* Zilog: YF = A.5 | (YFi ^ YQi); XF = A.3 | (XFi ^ XQi) */ + /* ST CMOS: YF = A.5 | (YFi ^ YQi); XF = A.3 */ + /* NEC NMOS: YF = A.5; XF = A.3 */ +# ifdef Z80_WITH_Q + ((((F ^ Q) & OPTIONS) | A) & YXF) | +# else + (A & YXF) | +# endif + CF; /* CF = 1 */ + /* HF, NF = 0 */ + PC++; + return 4; + } + + +/*-----------------------------------------------------------------------------. +| The `halt` instruction enables the HALT state after PC is incremented during | +| the opcode fetch. The CPU neither decrements nor avoids incrementing PC "so | +| that the instruction is re-executed" as Sean Young writes in section 5.4 of | +| "The Undocumented Z80 Documented". During the HALT state, the CPU repeatedly | +| executes an internal NOP operation. Each NOP consists of 1 M1 cycle of 4 | +| T-states that fetches and disregards the next opcode after `halt` without | +| incrementing PC. This opcode is read again and again until an exit condition | +| occurs (i.e., INT, NMI or RESET). | +| | +| This was first documented by Tony Brewer in 2014, and was later re-confirmed | +| by the HALT2INT test written by Mark Woodmass (AKA Woody) in 2021. | +| | +| References: | +| * Brewer, Tony (2014-12). "Z80 Special Reset". | +| * http://primrosebank.net/computers/z80/z80_special_reset.htm | +| * https://stardot.org.uk/forums/viewtopic.php?p=357136#p357136 | +'=============================================================================*/ + +#ifdef Z80_WITH_SPECIAL_RESET + static Insn const insn_table[256]; +#endif + +INSN(halt) + { + if (!HALT_LINE) + { + if (!RESUME) + { + Q_0 + PC++; + + if ((self->cycles += 4) >= self->cycle_limit) + { + RESUME = Z80_RESUME_HALT; + return 0; + } + + if (REQUEST) return 0; + RESUME = Z80_RESUME_HALT; + } + + HALT_LINE = 1; + + if (self->halt != Z_NULL) + { + self->halt(CONTEXT, 1); + if (self->cycles >= self->cycle_limit) return 0; + } + } + + if (self->nop == Z_NULL || (OPTIONS & Z80_OPTION_HALT_SKIP)) + { + zusize nop_cycles = self->cycle_limit - self->cycles; + + nop_cycles += (4 - (nop_cycles & 3)) & 3; + R += (zuint8)(nop_cycles >> 2); + self->cycles += nop_cycles; + } + +# ifdef Z80_WITH_SPECIAL_RESET + else { + zuint8 opcode; + + do { + R++; + opcode = self->nop(CONTEXT, PC); + self->cycles += 4; + + if (REQUEST) + { + RESUME = 0; + + if (REQUEST & Z80_REQUEST_SPECIAL_RESET) + { + HALT_LINE = 0; + + if (self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_EXIT_EARLY); + + if ((DATA[0] = opcode) != 0x76) + { + self->cycles -= 4; + PC--; + return insn_table[opcode](self); + } + } + + return 0; + } + } + while (self->cycles < self->cycle_limit); + + DATA[2] = opcode; + } + +# else + else do { + R++; + (void)self->nop(CONTEXT, PC); + self->cycles += 4; + + if (REQUEST) + { + RESUME = 0; + return 0; + } + } + while (self->cycles < self->cycle_limit); +# endif + + return 0; + } + + +INSN(di) + { + Q_0 + IFF1 = IFF2 = 0; + REQUEST &= ~(zuint8)Z80_REQUEST_INT; + PC++; + return 4; + } + + +INSN(ei) + { + Q_0 + IFF1 = IFF2 = 1; + if (INT_LINE) REQUEST |= Z80_REQUEST_INT; + PC++; + return 4; + } + + +/* MARK: - Instructions: 16-Bit Arithmetic Group */ +/*--------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC 1234 | +| --------- ---------------- -------- -------- | +| add hl,SS 00ss1001 ..YCX.0c 11:443 | +| adc hl,SS <--ED-->01ss1010 szYCXv0c 15:4443 | +| sbc hl,SS <--ED-->01ss0010 szYBXv1b 15:4443 | +| add XY,WW <--XY-->00ww1001 ..YCX.0c 15:4443 | +| inc SS 00ss0011 ........ 6:6 | +| inc XY <--XY--><--23--> ........ 10:46 | +| dec SS 00ss1011 ........ 6:6 | +| dec XY <--XY--><--2B--> ........ 10:46 | +'==================================================*/ + +INSN(add_hl_SS) {ADD_16(HL, SS0, PC++); } +INSN(adc_hl_SS) {ADC_SBC_HL_SS(+, ~ss, Z_EMPTY);} +INSN(sbc_hl_SS) {ADC_SBC_HL_SS(-, ss, | NF );} +INSN(add_XY_WW) {ADD_16(XY, WW, PC += 2); } +INSN(inc_SS ) {Q_0 (SS0)++; PC++; return 6;} +INSN(inc_XY ) {Q_0 XY++; PC += 2; return 6;} +INSN(dec_SS ) {Q_0 (SS0)--; PC++; return 6;} +INSN(dec_XY ) {Q_0 XY--; PC += 2; return 6;} + + +/* MARK: - Instructions: Rotate and Shift Group */ +/*-------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| --------------- -------------------------------- -------- --------- | +| rlca <--07--> ..y0x.0= 4:4 | +| rla <--17--> ..y0x.0= 4:4 | +| rrca <--0F--> ..y0x.0= 4:4 | +| rra <--1F--> ..y0x.0= 4:4 | +|- G K <--CB-->00gggkkk szy0xp0= 8:44 | +|- G (hl) <--CB-->00ggg110 szy0xp0= 15:4443 | +|- G (XY+OFFSET) <--XY--><--CB-->00ggg110 szy0xp0= 23:443543 | +|* G (XY+OFFSET),K <--XY--><--CB-->00gggkkk szy0xp0= 23:443543 | +| rld <--ED--><--6F--> szy0xp0. 18:44343 | +| rrd <--ED--><--67--> szy0xp0. 18:44343 | +|--------------------------------------------------------------------------| +| (-) The instruction has undocumented [pseudo-]opcodes. | +| (*) Undocumented instruction. | +'=========================================================================*/ + +INSN(rlca ) {A = ROL(A); FLAGS = F_SZP | (A & YXCF); PC++; return 4;} +INSN(rla ) {RXA(A >> 7, <<, F_C); } +INSN(rrca ) {A = ROR(A); FLAGS = F_SZP | A_YX | (A >> 7); PC++; return 4;} +INSN(rra ) {RXA(A & 1, >>, (F << 7)); } +INSN(G_K ) {zuint8 *k = &K1; *k = G1(*k); return 8;} +INSN(G_vhl ) {WRITE(HL, G1(READ(HL))); return 15;} +INSN(G_vXYpOFFSET ) {zuint16 ea = MEMPTR; WRITE(ea, G3(READ(ea))); return 19;} +INSN(G_vXYpOFFSET_K) {zuint16 ea = MEMPTR; WRITE(ea, K3 = G3(READ(ea))); return 19;} +INSN(rld ) {RXD(<< 4, & 0xF, >> 4); } +INSN(rrd ) {RXD(>> 4, << 4, & 0xF); } + + +/* MARK: - Instructions: Bit Set, Reset and Test Group */ +/*---------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| ----------------- -------------------------------- -------- --------- | +| bit N,K <--CB-->01nnnkkk sz*1*z0. 8:44 | +| bit N,(hl) <--CB-->01nnn110 sz*1*z0. 12:444 [1] +|- bit N,(XY+OFFSET) <--XY--><--CB-->01nnn*** sz*1*z0. 20:44354 | +| M N,K <--CB-->1mnnnkkk ........ 8:44 | +| M N,(hl) <--CB-->1mnnn110 ........ 15:4443 | +| M N,(XY+OFFSET) <--XY--><--CB-->1mnnn110 ........ 23:443543 | +|* M N,(XY+OFFSET),K <--XY--><--CB-->1mnnnkkk ........ 23:443543 | +|----------------------------------------------------------------------------| +| (-) The instruction has undocumented pseudo-opcodes. | +| (*) Undocumented instruction. | +|----------------------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have a typo in the | +| T-states of the instruction. | +'===========================================================================*/ + +INSN(M_N_K ) {zuint8 *k = &K1; *k = M1(*k); return 8;} +INSN(M_N_vhl ) {WRITE(HL, M1(READ(HL))); return 15;} +INSN(M_N_vXYpOFFSET ) {zuint16 ea = MEMPTR; WRITE(ea, M3(READ(ea))); return 19;} +INSN(M_N_vXYpOFFSET_K) {zuint16 ea = MEMPTR; WRITE(ea, K3 = M3(READ(ea))); return 19;} + + +INSN(bit_N_K) + { + zuint8 k = K1; + zuint8 t = k & (1U << N(1)); + + /*----------------------------------------------------------. + | In section 4.1 of "The Undocumented Z80 Documented" (all | + | versions), Sean Young says that YF and XF are taken from | + | the value resulting from the bit test operation, but this | + | seems not to be true. They are copies of bits 5 and 3 of | + | the register containing the value to be tested (K). | + '==========================================================*/ + FLAGS = (t ? t & SF : ZPF) | /* SF = sign; ZF, PF = zero */ + (k & YXF) | /* YF = K.5; XF = K.3 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 8; + } + + +INSN(bit_N_vhl) + { + zuint8 t = READ(HL) & (1U << N(1)); + + /*----------------------------------------------------------------. + | This is the only instruction in which MEMPTR affects the flags. | + | YF and XF are taken, respectively, from bits 13 and 11 of this | + | internal register whose behavior was cracked in 2006 by boo_boo | + | and Vladimir Kladov. Official schematics refer to this register | + | as WZ, but this emulator uses the name "MEMPTR" to honor those | + | who cracked it. | + | | + | References: | + | * https://zxpress.ru/zxnet/zxnet.pc/5909 | + | * boo_boo; Kladov, Vladimir (2006-03-29). "MEMPTR, Esoteric | + | Register of the Zilog Z80 CPU". | + | * https://zx-pk.ru/showpost.php?p=43688 | + | * https://zx-pk.ru/attachment.php?attachmentid=2984 | + | * https://zx-pk.ru/showpost.php?p=43800 | + | * https://zx-pk.ru/attachment.php?attachmentid=2989 | + '================================================================*/ + FLAGS = (t ? t & SF : ZPF) | /* SF = sign; ZF, PF = zero */ + (MEMPTRH & YXF) | /* YF = MEMPTRH.5; XF = MEMPTRH.3 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 12; + } + + +INSN(bit_N_vXYpOFFSET) + { + zuint8 t = READ(MEMPTR) & (1U << N(3)); + + FLAGS = (t ? t & SF : ZPF) | /* SF sign; ZF, PF = zero */ + (MEMPTRH & YXF) | /* YF = EA.13; XF = EA.11 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 16; + } + + +/* MARK: - Instructions: Jump Group */ +/*----------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC Y 123 N 12 | +| ----------- ------------------------ -------- ------------ | +| jp WORD <--C3--><-----WORD-----> ........ 10:433 | +| jp Z,WORD 11zzz010<-----WORD-----> ........ 10:433 | +| jr OFFSET <--18--> ........ 12:435 | +| jr Z,OFFSET 001zz000 ........ 12:435 7:43 | +| jp (hl) <--E9--> ........ 4:4 | +| jp (XY) <--XY--><--E9--> ........ 8:44 | +| djnz OFFSET <--10--> ........ 13:535 8:53 | +'================================================================*/ + +INSN(jp_WORD ) {Q_0 MEMPTR = PC = FETCH_16(PC + 1); return 10;} +INSN(jp_Z_WORD ) {Q_0 MEMPTR = FETCH_16(PC + 1); PC = Z(7) ? MEMPTR : PC + 3; return 10;} +INSN(jr_OFFSET ) {Q_0 MEMPTR = (PC += 2 + (zsint8)FETCH(PC + 1)); return 12;} +INSN(jr_Z_OFFSET) {DJNZ_JR_Z_OFFSET(Z(3), 12, 7); } +INSN(jp_hl ) {Q_0 PC = HL; return 4;} +INSN(jp_XY ) {Q_0 PC = XY; return 4;} +INSN(djnz_OFFSET) {DJNZ_JR_Z_OFFSET(--B, 13, 8); } + + +/* MARK: - Instructions: Call and Return Group */ +/*--------------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC Y 123 N 123 | +| ----------- ------------------------ -------- ---------------- | +| call WORD <--CD--><-----WORD-----> ........ 17:43433 | +| call Z,WORD 11zzz100<-----WORD-----> ........ 17:43433 10:433 | +| ret <--C9--> ........ 10:433 | +| ret Z 11zzz000 ........ 11:533 5:5 | +|- reti/retn <--ED-->01***101 ........ 14:4433 | +| rst N 11nnn111 ........ 11:533 | +|---------------------------------------------------------------------| +| (-) The instruction has undocumented opcodes. The `reti` mnemonic | +| is used to represent the ED4Dh opcode, which is recognized by | +| the Z80 CTC chip. All other opcodes are represented as `retn`. | +'====================================================================*/ + +INSN(call_WORD) {Q_0 MEMPTR = FETCH_16(PC + 1); PUSH(PC + 3); PC = MEMPTR; return 17;} +INSN(ret ) {Q_0 RET; return 10;} +INSN(ret_Z ) {Q_0 if (Z(7)) {RET; return 11;} PC++; return 5;} +INSN(reti ) {RETX(reti); } +INSN(retn ) {RETX(retn); } +INSN(rst_N ) {Q_0 PUSH(PC + 1); MEMPTR = PC = DATA[0] & 56; return 11;} + + +INSN(call_Z_WORD) + { + Q_0 + MEMPTR = FETCH_16(PC + 1); /* Always read */ + + if (Z(7)) + { + PUSH(PC + 3); + PC = MEMPTR; + return 17; + } + + PC += 3; + return 10; + } + + +/* MARK: - Instructions: Input and Output Group */ +/*--------------------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC !0 12345 =0 1234 | +| ------------ ---------------- -------- ----------------- | +| in a,(BYTE) <--DB--><-BYTE-> ........ 11:434 | +| in J,(c) <--ED-->01jjj000 szy0xp0. 12:444 | +|* in (c) <--ED--><--70--> szy0xp0. 12:444 | +| ini <--ED--><--A2--> ******** 16:4543 [1] +| inir <--ED--><--B2--> ******** 21:45435 16:4543 [1] +| ind <--ED--><--AA--> ******** 16:4543 [1] +| indr <--ED--><--BA--> ******** 21:45435 16:4543 [1] +| out (BYTE),a <--D3--><-BYTE-> ........ 11:434 | +| out (c),J <--ED-->01jjj001 ........ 12:444 | +|* out (c),0 <--ED--><--71--> ........ 12:444 | +| outi <--ED--><--A3--> ******** 16:4534 | +| otir <--ED--><--B3--> ******** 21:45345 16:4534 | +| outd <--ED--><--AB--> ******** 16:4534 | +| otdr <--ED--><--BB--> ******** 21:45345 16:4534 | +|---------------------------------------------------------------| +| (*) Undocumented instruction. | +|---------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have typos | +| in the T-states of the instruction. | +'==============================================================*/ + +INSN(in_J_vc ) {IN_VC(J1 = t;); } +INSN(in_vc ) {IN_VC(Z_EMPTY); } +INSN(ini ) {INX (++, +); } +INSN(inir ) {INXR(++, +); } +INSN(ind ) {INX (--, -); } +INSN(indr ) {INXR(--, -); } +INSN(out_vc_J) {Q_0 MEMPTR = BC + 1; OUT(BC, J1); PC += 2; return 12;} +INSN(outi ) {OUTX(++, +); } +INSN(otir ) {OTXR(++, +); } +INSN(outd ) {OUTX(--, -); } +INSN(otdr ) {OTXR(--, -); } + + +INSN(in_a_vBYTE) + { + zuint16 t; + + Q_0 + + /*--------------------------------------------------------------------. + | In "MEMPTR, Esoteric Register of the Zilog Z80 CPU", boo_boo says | + | that MEMPTR is set to `((A << 8) | BYTE) + 1`. This causes a carry | + | from the LSbyte of the port number to MEMPTRH if BYTE is 255, which | + | differs from all other instructions where MEMPTRH is set to A, but | + | it has been verified on real hardware with the IN-MEMPTR test. | + '====================================================================*/ + MEMPTR = (t = (zuint16)(((zuint16)A << 8) | FETCH((PC += 2) - 1))) + 1; + + A = IN(t); + return 11; + } + + +INSN(out_vBYTE_a) + { + zuint8 t; + + Q_0 + MEMPTRL = (t = FETCH((PC += 2) - 1)) + 1; + MEMPTRH = A; + OUT((zuint16)(((zuint16)A << 8) | t), A); + return 11; + } + + +/*----------------------------------------------------------------------------. +| The `out (c),0` instruction behaves as `out (c),255` on the Zilog Z80 CMOS. | +| This was first discovered by Simon Cooke, who reported it on Usenet in 1996 | +| [1,2]. Later, in 2004, Colin Piggot rediscovered it with his SAM Coupé when | +| running a demo for SCPDU 6, coincidentally written by Simon Cooke [1]. In | +| 2008, this was once again rediscovered by the MSX community [1,3]. | +| | +| References: | +| 1. https://sinclair.wiki.zxnet.co.uk/wiki/Z80 | +| 2. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ | +| 3. https://msx.org/forum/development/msx-development/bug-z80-emulation-or- | +| tr-hw | +'============================================================================*/ + +INSN(out_vc_0) + { + Q_0 + PC += 2; + MEMPTR = BC + 1; + OUT(BC, (zuint8)0 - (OPTIONS & (zuint8)Z80_OPTION_OUT_VC_255)); + return 12; + } + + +/* MARK: - Instructions: Optimizations */ + +INSN(nop_nop) {Q_0; PC += 2; return 4;} + + +/* MARK: - Instruction Function Tables */ + +INSN(cb_prefix ); +INSN(ed_prefix ); +INSN(dd_prefix ); +INSN(fd_prefix ); +INSN(xy_cb_prefix); +INSN(xy_xy ); +INSN(ed_illegal ); +INSN(xy_illegal ); +INSN(hook ); + +#ifdef Z80_WITH_UNOFFICIAL_RETI +# define reti_retn reti +#else +# define reti_retn retn +#endif + +static Insn const insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ nop, ld_SS_WORD, ld_vbc_a, inc_SS, V_J, V_J, ld_J_BYTE, rlca, ex_af_af_, add_hl_SS, ld_a_vbc, dec_SS, V_J, V_J, ld_J_BYTE, rrca, +/* 1 */ djnz_OFFSET, ld_SS_WORD, ld_vde_a, inc_SS, V_J, V_J, ld_J_BYTE, rla, jr_OFFSET, add_hl_SS, ld_a_vde, dec_SS, V_J, V_J, ld_J_BYTE, rra, +/* 2 */ jr_Z_OFFSET, ld_SS_WORD, ld_vWORD_hl, inc_SS, V_J, V_J, ld_J_BYTE, daa, jr_Z_OFFSET, add_hl_SS, ld_hl_vWORD, dec_SS, V_J, V_J, ld_J_BYTE, cpl, +/* 3 */ jr_Z_OFFSET, ld_SS_WORD, ld_vWORD_a, inc_SS, V_vhl, V_vhl, ld_vhl_BYTE, scf, jr_Z_OFFSET, add_hl_SS, ld_a_vWORD, dec_SS, V_J, V_J, ld_J_BYTE, ccf, +/* 4 */ nop, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, +/* 5 */ ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, +/* 6 */ ld_J_K, ld_J_K, ld_J_K, ld_J_K, hook, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, nop, ld_J_vhl, ld_J_K, +/* 7 */ ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, halt, ld_vhl_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, nop, +/* 8 */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* 9 */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* A */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* B */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* C */ ret_Z, pop_TT, jp_Z_WORD, jp_WORD, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, ret, jp_Z_WORD, cb_prefix, call_Z_WORD, call_WORD, U_a_BYTE, rst_N, +/* D */ ret_Z, pop_TT, jp_Z_WORD, out_vBYTE_a, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, exx, jp_Z_WORD, in_a_vBYTE, call_Z_WORD, dd_prefix, U_a_BYTE, rst_N, +/* E */ ret_Z, pop_TT, jp_Z_WORD, ex_vsp_hl, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, jp_hl, jp_Z_WORD, ex_de_hl, call_Z_WORD, ed_prefix, U_a_BYTE, rst_N, +/* F */ ret_Z, pop_TT, jp_Z_WORD, di, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, ld_sp_hl, jp_Z_WORD, ei, call_Z_WORD, fd_prefix, U_a_BYTE, rst_N}; + +static Insn const cb_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 1 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 2 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 3 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 4 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 5 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 6 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 7 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 8 */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* 9 */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* A */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* B */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* C */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* D */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* E */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* F */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K}; + +static Insn const ed_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 1 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 2 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 3 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 4 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_0, ld_i_a, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti, im_0, ld_r_a, +/* 5 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_1, ld_a_i, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_2, ld_a_r, +/* 6 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_0, rrd, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_0, rld, +/* 7 */ in_vc, out_vc_0, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_1, ed_illegal, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_2, ed_illegal, +/* 8 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 9 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* A */ ldi, cpi, ini, outi, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ldd, cpd, ind, outd, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* B */ ldir, cpir, inir, otir, ed_illegal, ed_illegal, ed_illegal, ed_illegal, lddr, cpdr, indr, otdr, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* C */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* D */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* E */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* F */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal}; + +static Insn const xy_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ nop_nop, xy_illegal, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 1 */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 2 */ xy_illegal, ld_XY_WORD, ld_vWORD_XY, inc_XY, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, ld_XY_vWORD, dec_XY, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 3 */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, V_vXYpOFFSET, V_vXYpOFFSET, ld_vXYpOFFSET_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 4 */ nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, +/* 5 */ ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, +/* 6 */ ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_J_vXYpOFFSET, ld_O_P, +/* 7 */ ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, xy_illegal, ld_vXYpOFFSET_K, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, nop_nop, +/* 8 */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* 9 */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* A */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* B */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* C */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_cb_prefix, xy_illegal, xy_illegal, xy_illegal, xy_illegal, +/* D */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_xy, xy_illegal, xy_illegal, +/* E */ xy_illegal, pop_XY, xy_illegal, ex_vsp_XY, xy_illegal, push_XY, xy_illegal, xy_illegal, xy_illegal, jp_XY, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, +/* F */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, ld_sp_XY, xy_illegal, xy_illegal, xy_illegal, xy_xy, xy_illegal, xy_illegal}; + +static Insn const xy_cb_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 1 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 2 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 3 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 4 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 5 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 6 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 7 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 8 */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* 9 */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* A */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* B */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* C */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* D */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* E */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* F */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K}; + + +/* MARK: - Instructions: Prefix Handling */ + +INSN(cb_prefix) + { + R++; + return cb_insn_table[DATA[1] = FETCH_OPCODE((PC += 2) - 1)](self); + } + + +INSN(ed_prefix) + { + R++; + return ed_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + } + + +#define XY_PREFIX(index_register) \ + zuint8 cycles; \ + \ + if ((self->cycles += 4) >= self->cycle_limit) \ + { \ + RESUME = Z80_RESUME_XY; \ + return 0; \ + } \ + \ + R++; \ + XY = index_register; \ + cycles = xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); \ + index_register = XY; \ + return cycles; + + +INSN(dd_prefix) {XY_PREFIX(IX)} +INSN(fd_prefix) {XY_PREFIX(IY)} + + +/*-----------------------------------------------------------------------. +| Instructions with the two-byte prefix DDCBh or FDCBh increment R by 2, | +| as only the prefix is fetched by opcode fetch operations (M1 cycles). | +| The remaining two bytes are fetched by normal memory read operations. | +'=======================================================================*/ + +INSN(xy_cb_prefix) + { + FETCH_XY_EA((PC += 4) - 2); + return xy_cb_insn_table[DATA[3] = FETCH(PC - 1)](self); + } + + +/*-----------------------------------------------------------------------------. +| In a sequence of DDh and/or FDh prefixes, it is the last one that counts, as | +| each prefix overrides the previous one. No matter how long the sequence is, | +| interrupts can only be responded to after executing the final instruction | +| once all the prefixes have been fetched. Each prefix takes 4 T-states. | +'=============================================================================*/ + +INSN(xy_xy) + { + zuint8 cycles; + zuint8 first_prefix = DATA[0]; + + do { + PC++; + DATA[0] = DATA[1]; + + if ((self->cycles += 4) >= self->cycle_limit) + { + RESUME = Z80_RESUME_XY; + return 0; + } + + R++; + } + while (IS_XY_PREFIX(DATA[1] = FETCH_OPCODE(PC + 1))); + + if (DATA[0] == first_prefix) return xy_insn_table[DATA[1]](self); + + if (first_prefix == 0xFD) + { + XY = IX; + cycles = xy_insn_table[DATA[1]](self); + IX = XY; + XY = IY; + } + + else { + XY = IY; + cycles = xy_insn_table[DATA[1]](self); + IY = XY; + XY = IX; + } + + return cycles; + } + + +/* MARK: - Instructions: Illegal */ + +/*----------------------------------------------------------------. +| The CPU ignores illegal opcodes prefixed with EDh. In practice, | +| they are all equivalent to two `nop` instructions (8 T-states). | +'================================================================*/ + +INSN(ed_illegal) + { + if (self->illegal != Z_NULL) + { + DATA[2] = 0; + return self->illegal(self, DATA[1]); + } + + Q_0 + PC += 2; + return 8; + } + + +/*-----------------------------------------------------------------------. +| Illegal opcodes with the prefix DDh or FDh cause the CPU to ignore the | +| prefix, i.e., the byte immediately following the prefix is interpreted | +| as the first byte of a new instruction. The prefix takes 4 T-states. | +'=======================================================================*/ + +INSN(xy_illegal) + { + PC++; + return insn_table[DATA[0] = DATA[1]](self); + } + + +/* MARK: - Instructions: Hooking */ + +INSN(hook) + { + if (self->hook == Z_NULL) + { + Q_0 + PC++; + return 4; + } + + return ((DATA[0] = self->hook(CONTEXT, PC)) != Z80_HOOK) + ? insn_table[DATA[0]](self) : 0; + } + + +/* MARK: - Interrupt Mode 0: PC Decrements for Unprefixed Instructions */ + +#ifdef Z80_WITH_FULL_IM0 + static zuint8 const im0_pc_decrement_table[256] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 1 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 2 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 3 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 5 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 6 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 7 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* B */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* C */ 1, 0, 3, 3, 3, 0, 0, 1, 1, 1, 3, 0, 3, 3, 0, 1, + /* D */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 0, 3, 0, 3, 0, 0, 1, + /* E */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 1, 3, 0, 3, 0, 0, 1, + /* F */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 0, 3, 0, 3, 0, 0, 1}; +#endif + + +/* MARK: - Interrupt Mode 0: Callback Trampolines */ + +#ifdef Z80_WITH_FULL_IM0 + static zuint8 im0_fetch(IM0 const *self, zuint16 address) + { + Z_UNUSED(address) + return self->z80->int_fetch(CONTEXT, self->pc); + } + + + static zuint8 im0_read(IM0 const *self, zuint16 address) + {return READ(address);} + + + static void im0_write(IM0 const *self, zuint16 address, zuint8 value) + {WRITE(address, value);} + + + static zuint8 im0_in(IM0 const *self, zuint16 port) + {return IN(port);} + + + static void im0_out(IM0 const *self, zuint16 port, zuint8 value) + {OUT(port, value);} + + + static void im0_ld_i_a(IM0 const *self) {NOTIFY(ld_i_a);} + static void im0_ld_r_a(IM0 const *self) {NOTIFY(ld_r_a);} + + +# ifdef Z80_WITH_IM0_RETX_NOTIFICATIONS + #define IM0_NOTIFY_RETX(callback) \ + if ( self->callback != Z_NULL && \ + (self->z80->options & \ + Z80_OPTION_IM0_RETX_NOTIFICATIONS) \ + ) \ + { \ + self->z80->data.uint8_array[2] |= 2; \ + self->callback(CONTEXT); \ + } + + + static void im0_reti(IM0 const *self) {IM0_NOTIFY_RETX(reti)} + static void im0_retn(IM0 const *self) {IM0_NOTIFY_RETX(retn)} +# endif +#endif + + +/* MARK: - Public Functions */ + +/*----------------------------------------------------------------------. +| On POWER-ON, the CPU zeroes PC, I and R, sets SP, IX, IY, AF, BC, DE, | +| HL, AF', BC', DE' and HL' to FFFFh [1,2], resets the interrupt enable | +| flip-flops (IFF1 and IFF2) and selects interrupt mode 0 [3]. On Zilog | +| NMOS models, F is sometimes set to FDh (NF reset) [1]. | +| | +| There is no information about the initial state of MEMPTR and Q, so | +| they are assumed to be 0. | +| | +| References: | +| 1. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | +| 2. https://worldofspectrum.org/forums/discussion/34574 | +| 3. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" | +| v0.91, p. 20. | +'======================================================================*/ + +Z80_API void z80_power(Z80 *self, zboolean state) + { + MEMPTR = PC = R = I = IFF1 = IFF2 = IM = Q = + DATA[0] = HALT_LINE = INT_LINE = RESUME = REQUEST = 0; + + SP = IX = IY = AF = BC = DE = HL = AF_ = BC_ = DE_ = HL_ = + state ? Z_UINT16(0xFFFF) : 0; + } + + +/*-------------------------------------------------------------------------. +| The normal RESET zeroes PC, I, and R [1,2,3,4,5,6], resets the interrupt | +| enable flip-flops (IFF1 and IFF2) [1,2,3,4,5] and selects interrupt mode | +| 0 [1,2,3,4,7]. | +| | +| References: | +| 1. Zilog (2016-09). "Z80 CPU User Manual" rev. 11, p. 6. | +| 2. SGS-Thomson (1990-01). "Z80 Microprocessor Family" 1st ed., p. 33. | +| 3. Brewer, Tony (2014-12). "Z80 Special Reset". | +| * http://primrosebank.net/computers/z80/z80_special_reset.htm | +| 4. Flammenkamp, Achim. "Interrupt Behaviour of the Z80 CPU". | +| * http://z80.info/interrup.htm | +| 5. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | +| 6. https://worldofspectrum.org/forums/discussion/34574 | +| 7. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", p. 8. | +'=========================================================================*/ + +Z80_API void z80_instant_reset(Z80 *self) + { + if (HALT_LINE) {EXIT_HALT;} + + PC = R = I = IFF1 = IFF2 = IM = + DATA[0] = HALT_LINE = RESUME = REQUEST = 0; + } + + +#ifdef Z80_WITH_SPECIAL_RESET + Z80_API void z80_special_reset(Z80 *self) + {REQUEST |= Z80_REQUEST_SPECIAL_RESET;} +#endif + + +Z80_API void z80_int(Z80 *self, zboolean state) + { + if (!(INT_LINE = state)) REQUEST &= ~(zuint8)Z80_REQUEST_INT; + else if (IFF1) REQUEST |= Z80_REQUEST_INT; + } + + +Z80_API void z80_nmi(Z80 *self) + {REQUEST |= Z80_REQUEST_NMI;} + + +#ifdef Z80_WITH_EXECUTE + Z80_API zusize z80_execute(Z80 *self, zusize cycles) + { + ZInt16 *xy; + + R7 = R; + self->cycles = 0; + self->cycle_limit = cycles; + + if (RESUME && cycles) switch (RESUME) + { + case Z80_RESUME_HALT: + (void)halt(self); + break; + + case Z80_RESUME_XY: + RESUME = 0; + R++; + XY = (xy = &self->ix_iy[(DATA[0] >> 5) & 1])->uint16_value; + self->cycles += xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + xy->uint16_value = XY; + break; + } + + while (self->cycles < self->cycle_limit) + { + R++; + self->cycles += insn_table[DATA[0] = FETCH_OPCODE(PC)](self); + } + + R = R_ALL; /* Restore R7 bit */ + return self->cycles; + } +#endif + + +Z80_API zusize z80_run(Z80 *self, zusize cycles) + { + ZInt16 *xy; + zuint8 ird; + + /*---------------------------------------------------------------------. + | The CPU increments R during each M1 cycle without altering the most | + | significant bit, commonly known as R7. This behavior is not emulated | + | in every increment for obvious speed reasons. Instead, a copy of R | + | is used to preserve R7, which is restored before returning from this | + | function. The emulation of `ld {a,r|r,a}` takes this into account. | + '=====================================================================*/ + R7 = R; + + self->cycles = 0; + self->cycle_limit = cycles; + + if (RESUME && cycles) switch (RESUME) + { + /*------------------------------------------------------------. + | The CPU is halted. To avoid affecting the speed of the main | + | execution loop, this state is executed by a dedicated loop | + | in the function that emulates the `halt` instruction. | + '============================================================*/ + case Z80_RESUME_HALT: + if (REQUEST) + { + RESUME = 0; + +# ifdef Z80_WITH_SPECIAL_RESET + if ((REQUEST & Z80_REQUEST_SPECIAL_RESET) && HALT_LINE) + { + zuint8 opcode; + + HALT_LINE = 0; + + if (self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_EXIT_EARLY); + + if (IS_XY_PREFIX(DATA[0] = opcode = DATA[2])) + self->cycles += insn_table[FETCH_OPCODE(PC)](self); + + else if (opcode != 0x76) + { + PC--; + self->cycles += insn_table[opcode](self) - 4; + } + } +# endif + } + + else (void)halt(self); + break; + + /*--------------------------------------------------------------. + | The CPU is in normal operation state; the emulator ran out of | + | clock cycles by fetching a prefix DDh or FDh. | + '==============================================================*/ + case Z80_RESUME_XY: + RESUME = 0; + R++; + XY = (xy = &self->ix_iy[(DATA[0] >> 5) & 1])->uint16_value; + self->cycles += xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + xy->uint16_value = XY; + break; + + /*----------------------------------------------------------------. + | The CPU is responding to an INT in mode 0; the emulator ran out | + | of clock cycles by fetching a prefix DDh or FDh. | + '================================================================*/ +# ifdef Z80_WITH_FULL_IM0 + case Z80_RESUME_IM0_XY: + ird = DATA[0]; + goto im0_begin; +# endif + } + + while (self->cycles < self->cycle_limit) /* main execution loop */ + { + if (REQUEST) + { + /*-------------------------------------------------------------------------. + | After detecting a special RESET signal, the CPU completes the ongoing | + | instruction or interrupt response and then zeroes PC during the falling | + | edge of the next M1T1. The special RESET can be used in conjunction with | + | an interrupt, in which case PC is zeroed during the subsequent interrupt | + | acknowledge M-cycle. Otherwise, if no interrupt has been accepted at the | + | TLAST of the instruction or interrupt response in which the special | + | RESET has been detected, the CPU produces an internal NOP of 4 T-states | + | to allow for the fetch-execute overlap to take place, during which it | + | fetches the next opcode and zeroes PC. | + | | + | References: | + | * Brewer, Tony (2014-12). "Z80 Special Reset". | + | * http://primrosebank.net/computers/z80/z80_special_reset.htm | + | * US Patent 4486827. | + | * Checked with "Visual Z80 Remix". | + '=========================================================================*/ +# ifdef Z80_WITH_SPECIAL_RESET + zuint8 special_reset = REQUEST & Z80_REQUEST_SPECIAL_RESET; +# endif + + /*-------------------------------------------------------------------------. + | NMI Response: Execute `rst 66h` | T-states: 11:533 | + |--------------------------------------------------------------------------| + | The non-maskable interrupt takes priority over the maskable interrupt | + | and cannot be disabled under software control. Its usual function is to | + | provide immediate response to important signals. The CPU responds to an | + | NMI by pushing PC onto the stack and jumping to the ISR located at | + | address 0066h. The interrupt enable flip-flop #1 (IFF1) is reset to | + | prevent any maskable interrupt from being accepted during the execution | + | of this routine, which is usually exited by using a `reti` or `retn` | + | instruction to restore the original state of IFF1 [1]. | + | | + | Some technical documents from Zilog include an erroneous timing diagram | + | showing an NMI acknowledge cycle of 4 T-states. However, documents from | + | other manufacturers and third parties specify that this M-cycle has 5 | + | T-states, as has been confirmed by low-level tests [2] and electronic | + | simulations [3]. | + | | + | In 2022, Manuel Sainz de Baranda y Goñi discovered that the CPU does not | + | accept a second NMI during the NMI response [4,5]. Therefore, it is not | + | possible to chain two NMI responses in a row without executing at least | + | one instruction between them [3,4,5]. | + | | + | References: | + | 1. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", | + | pp. 4-5. | + | 2. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | + | 3. Checked with "Visual Z80 Remix". | + | 4. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=7086 | + | 5. https://stardot.org.uk/forums/viewtopic.php?t=24662 | + '=========================================================================*/ + if (REQUEST & Z80_REQUEST_REJECT_NMI) + REQUEST = 0; + + else if (REQUEST & Z80_REQUEST_NMI) + { + REQUEST = Z80_REQUEST_REJECT_NMI; + IFF1 = 0; + if (HALT_LINE) {EXIT_HALT;} + R++; + if (self->nmia != Z_NULL) (void)self->nmia(CONTEXT, PC); + DATA[0] = 0; + Q_0 + +# ifdef Z80_WITH_SPECIAL_RESET + PUSH(PC >> special_reset); +# else + PUSH(PC); +# endif + + PC = MEMPTR = 0x66; + self->cycles += 11; + continue; + } + + /*-------------------------------------------------------------------------. + | INT Response | + |--------------------------------------------------------------------------| + | The maskable interrupt is enabled and disabled by using, respectively, | + | the instructions `ei` and `di`, which control the state of the interrupt | + | enable flip-flops (IFF1 and IFF2). The CPU does not accept this kind of | + | interrupt during an `ei` instruction. This allows ISRs to return without | + | the danger of being interrupted immediately after re-enabling interrupts | + | if the /INT line is still active, which could cause a stack overflow. | + | | + | In 2021, Andre Weissflog (aka Floh) discovered that `reti` and `retn` do | + | not accept the maskable interrupt if IFF1 and IFF2 do not have the same | + | state prior to the execution of the instruction, which can only be | + | caused by an earlier NMI response [1]. This behavior was rediscovered in | + | 2022 by Manuel Sainz de Baranda y Goñi [2,3]. | + | | + | References: | + | 1. Weissflog, Andre (2021-12-17). "New Cycle-Stepped Z80 Emulator, A". | + | * https://floooh.github.io/2021/12/17/cycle-stepped-z80.html | + | 2. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=7086 | + | 3. https://stardot.org.uk/forums/viewtopic.php?t=24662 | + '=========================================================================*/ + else if ( +# ifdef Z80_WITH_SPECIAL_RESET + (REQUEST & Z80_REQUEST_INT) && +# endif + /* if the previous instruction is not `ei` */ + DATA[0] != 0xFB && + /* if the previous instruction is not `reti/retn` or IFF1 has not changed */ + (self->data.uint32_value & Z_UINT32_BIG_ENDIAN(Z_UINT32(0xFFC70100))) + != Z_UINT32_BIG_ENDIAN(Z_UINT32(0xED450000)) + ) + { +# ifdef Z80_WITH_FULL_IM0 + Z80Read hook; + IM0 im0; +# endif + + REQUEST = IFF1 = IFF2 = 0; + if (HALT_LINE) {EXIT_HALT;} + + /*-------------------------------------------------------------------. + | Due to a bug, the Zilog Z80 NMOS resets PF when an INT is accepted | + | during the execution of the `ld a,{i|r}` instructions. | + '===================================================================*/ +# ifdef Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG + if ( (OPTIONS & Z80_OPTION_LD_A_IR_BUG) && + (self->data.uint16_array[0] & Z_UINT16_BIG_ENDIAN(Z_UINT16(0xFFF7))) + == Z_UINT16_BIG_ENDIAN(Z_UINT16(0xED57)) + ) + FLAGS = F & ~(zuint8)PF; +# endif + + /*---------------------------------------------------------------------. + | The INT acknowledge cycle (INTA) indicates that the interrupting I/O | + | device can write to the data bus. 2 wait T-states are automatically | + | added to this M-cycle, allowing sufficient time to identify which | + | device must insert the interrupt response data (IRD). The first and | + | possibly sole byte of the IRD is read from the data bus during this | + | special M1 cycle. | + | | + | The value FFh is assumed when the `Z80::inta` callback is not used. | + | This is the most convenient default IRD, since an `rst 38h` will be | + | executed if the interrupt mode is 0. | + '=====================================================================*/ + R++; + ird = (self->inta != Z_NULL) ? self->inta(CONTEXT, PC) : 0xFF; + +# ifdef Z80_WITH_SPECIAL_RESET + PC >>= special_reset; +# endif + + switch (IM) /* response */ + { + /*-------------------------------------------------------------------------. + | Interrupt Mode 0: Execute Instruction | T-states: 2*n + instruction | + |--------------------------------------------------------------------------| + | An instruction supplied via the data bus is executed. Its first byte is | + | read during the INT acknowledge cycle (INTA). If it is an opcode prefix, | + | additional M-cycles of this kind are produced until the final opcode of | + | the instruction is fetched [1]. Each INTA M-cycle takes as many T-states | + | as its normal M1 counterpart (the opcode fetch M-cycle) plus the 2 wait | + | T-states mentioned above [1]. Subsequent bytes of the instruction are | + | fetched by using normal memory read M-cycles [1,2], during which the | + | interrupting I/O device must still supply the data [2]. The PC register, | + | however, remains at its pre-interrupt state, not being incremented as a | + | result of the instruction fetch [1,2]. | + | | + | References: | + | 1. Checked with "Visual Z80 Remix". | + | 2. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", | + | pp. 6, 8. | + '=========================================================================*/ + case 0: + DATA[0] = ird; + +# ifdef Z80_WITH_FULL_IM0 + im0_begin: + + /*-----------------------------------------------------. + | The `Z80::hook` callback is temporarily disabled, as | + | traps are ignored during the INT response in mode 0. | + '=====================================================*/ + hook = self->hook; + self->hook = Z_NULL; + + /*------------------------------------------------------------------------. + | The `Z80::fetch` callback is temporarily replaced by a trampoline that | + | invokes `Z80::int_fecth`. This trampoline needs to access the callback | + | pointer in addition to the initial, non-incremented value of PC, so the | + | value of `Z80::context` is temporarily replaced by a pointer to an | + | `IM0` object that holds the real context and all this data, which also | + | makes it necessary to replace other callbacks with trampolines so that | + | the real context can be passed to them. | + | | + | The main idea here is that the instruction code will invoke trampolines | + | rather than callbacks, and the one assigned to `Z80::fetch` will ignore | + | the received fetch address, passing instead to `Z80::int_fetch` the | + | initial, non-incremented value of PC. | + '========================================================================*/ + im0.z80 = self; + im0.context = CONTEXT; + im0.fetch = self->fetch; + im0.read = self->read; + im0.write = self->write; + im0.in = self->in; + im0.out = self->out; + im0.pc = PC; + self->context = &im0; + self->fetch = (Z80Read )im0_fetch; + self->read = (Z80Read )im0_read; + self->write = (Z80Write)im0_write; + self->in = (Z80Read )im0_in; + self->out = (Z80Write)im0_out; + + im0_execute: + + /*------------------------------------------------------------------------. + | `call`, `djnz`, `jr` and `rst` increment PC before pushing it onto the | + | stack or using it as the base address. This makes it necessary to | + | decrement PC before executing any of these instructions so that the | + | final address is correct. `jmp` and `ret` are handled here too because | + | in their case this pre-decrement has no effect and PC must also not be | + | corrected after executing the instruction. These groups of instructions | + | are identified by using a table of decrements. Note that `jmp (XY)` and | + | `reti/retn` are prefixed and will be handled later. | + '========================================================================*/ + if (im0_pc_decrement_table[ird]) + { + PC -= im0_pc_decrement_table[ird]; + self->cycles += 2 + insn_table[ird](self); + } + + /* halt */ + else if (ird == 0x76) HALT_LINE = 1; + + /*---------------------------------------------------------------. + | Instructions with the CBh prefix are called directly from here | + | after fetching the opcode in the 2nd INTA. This bypasses the | + | `cb_prefix` function, so PC is never incremented. | + '===============================================================*/ + else if (ird == 0xCB) + { + R++; + self->cycles += 4 + cb_insn_table[DATA[1] = self->inta(im0.context, im0.pc)](self); + } + + /* Instructions with the EDh prefix */ + else if (ird == 0xED) + { + Insn insn; + + R++; + + if ((insn = ed_insn_table[DATA[1] = ird = self->inta(im0.context, im0.pc)]) != ed_illegal) + { + im0.ld_i_a = self->ld_i_a; + im0.ld_r_a = self->ld_r_a; + im0.reti = self->reti; + im0.retn = self->retn; + self->ld_i_a = (Z80Notify)im0_ld_i_a; + self->ld_r_a = (Z80Notify)im0_ld_r_a; + +# ifdef Z80_WITH_RETX_NOTIFICATIONS_IN_IM0 + self->reti = (Z80Notify)im0_reti; + self->retn = (Z80Notify)im0_retn; +# else + self->reti = Z_NULL; + self->retn = Z_NULL; +# endif + + PC -= ((ird & 0xC7) == 0x43) + ? 4 /* `ld SS,(WORD)` and `ld (WORD),SS` */ + : 2 /* All others */; + + self->cycles += 4 + insn(self); + + self->ld_i_a = im0.ld_i_a; + self->ld_r_a = im0.ld_r_a; + self->reti = im0.reti; + self->retn = im0.retn; + } + + else if (self->illegal == Z_NULL) + self->cycles += 4 + 8; + + else { + DATA[2] = 4; + self->cycles += 4 + self->illegal(self, ird); + } + } + + /* Instructions with the prefix DDh, FDh, DDCBh or FDCBh */ + else if (IS_XY_PREFIX(ird)) + { + Insn insn; + + if (RESUME) RESUME = 0; + + else { + im0_advance_xy: + if ((self->cycles += 6) >= self->cycle_limit) + { + RESUME = Z80_RESUME_IM0_XY; + goto im0_finalize; + } + } + + R++; + + if (IS_XY_PREFIX(ird = self->inta(im0.context, im0.pc))) + { + DATA[0] = ird; + goto im0_advance_xy; + } + + if ((insn = xy_insn_table[ird]) == xy_illegal) + { + DATA[0] = ird; + PC++; + goto im0_execute; + } + + XY = (xy = &self->ix_iy[((DATA[1] = ird) >> 5) & 1])->uint16_value; + self->cycles += 2 + insn(self); + xy->uint16_value = XY; + + /* Restore PC, except for `jp (XY)` */ + if (ird != 0xE9) PC = im0.pc; + } + + else { + self->cycles += 2 + insn_table[ird](self); + PC = im0.pc; + } + + im0_finalize: + self->context = im0.context; + self->fetch = im0.fetch; + self->read = im0.read; + self->write = im0.write; + self->in = im0.in; + self->out = im0.out; + self->hook = hook; + + if (HALT_LINE) + { + if (self->halt != Z_NULL) self->halt(im0.context, 1); + RESUME = Z80_RESUME_HALT; + Q_0 + self->cycles += 6; + (void)halt(self); + } + + continue; + +# else + switch (ird) + { + case 0xC3: /* jp WORD */ + Q_0 + MEMPTR = PC = int_fetch_16(self); + self->cycles += 2 + 10; + continue; + + case 0xCD: /* call WORD */ + Q_0 + MEMPTR = int_fetch_16(self); + PUSH(PC); + PC = MEMPTR; + self->cycles += 2 + 17; + continue; + + default: /* `rst N` is assumed for all other instructions */ + Q_0 + PUSH(PC); + MEMPTR = PC = ird & 56; + self->cycles += 2 + 11; + continue; + } +# endif + + /*----------------------------------------------------------. + | Interrupt Mode 1: Execute `rst 38h` | T-states: 13:733 | + |-----------------------------------------------------------| + | An internal `rst 38h` is executed. The interrupt response | + | data read from the data bus is disregarded. | + '==========================================================*/ + case 1: + DATA[0] = 0; + Q_0 + PUSH(PC); + MEMPTR = PC = 0x38; + self->cycles += 13; + continue; + + /*---------------------------------------------------------------------. + | Interrupt Mode 2: Execute `call (i:BYTE)` | T-states: 19:73333 | + |----------------------------------------------------------------------| + | An indirect call is executed. The pointer to the ISR is loaded from | + | the memory address formed by taking the I register as the most | + | significant byte, and the interrupt response vector (IRD) read from | + | the data bus as the least significant byte. | + | | + | Zilog's official documentation states that the least significant bit | + | of the interrupt response vector "must be a zero", since the address | + | formed "is used to get two adjacent bytes to form a complete 16-bit | + | service routine starting address and the addresses must always start | + | in even locations" [1]. However, Sean Young's experiments confirmed | + | that there is no such limitation [2]; any vector works regardless of | + | whether it is even or odd. | + | | + | References: | + | 1. Zilog (2005-03). "Z80 CPU User Manual" rev. 5, pp. 25-26. | + | 2. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" | + | v0.91, p. 20. | + '=====================================================================*/ + case 2: + DATA[0] = 0; + Q_0 + PUSH(PC); + MEMPTR = PC = READ_16((zuint16)(((zuint16)I << 8) | ird)); + self->cycles += 19; + continue; + } + } + +# ifdef Z80_WITH_SPECIAL_RESET + if (special_reset) + { + REQUEST = 0; + + /*---------------------------------------------------------. + | The /HALT line goes low and then high during TLAST if a | + | special RESET is detected during the `halt` instruction. | + '=========================================================*/ + if (DATA[0] == 0x76 && self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_CANCEL); + + R++; + if (self->nop != Z_NULL) (void)self->nop(CONTEXT, PC); + DATA[0] = 0; + Q_0; + PC = 0; + self->cycles += 4; + continue; + } +# endif + } + + R++; + self->cycles += insn_table[DATA[0] = FETCH_OPCODE(PC)](self); + } + + R = R_ALL; /* Restore R7 bit */ + return self->cycles; + } + + +#ifdef Z80_WITH_WINDOWS_DLL_MAIN + int Z_MICROSOFT_STD_CALL _DllMainCRTStartup(void *hDllHandle, unsigned long dwReason, void *lpReserved) + {return 1;} +#endif + + +/* Z80.c EOF */ diff --git a/projects/Z80/sources/Z80.c.bak b/projects/Z80/sources/Z80.c.bak new file mode 100644 index 0000000..3de7ae3 --- /dev/null +++ b/projects/Z80/sources/Z80.c.bak @@ -0,0 +1,2766 @@ +/* Z80 v0.2 + ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator | +| Copyright (C) 1999-2024 Manuel Sainz de Baranda y Goñi. | +| | +| This emulator 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 of the License, or (at your | +| option) any later version. | +| | +| This emulator 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 emulator. If not, see . | +| | +| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | +| | +| A NOTE FROM THE ORIGINAL AUTHOR | +| | +| Those familiar with the official documentation of the Zilog Z80 CPU will | +| find this source code quite intuitive. The purpose has not been to write | +| the fastest possible emulator, although the speed aspect is not neglected, | +| but a portable, hackable and well- | +| .----._.----. structured piece of software; | +| A11 <-01--|1 o|--40-> A10 something small, solid and elegant | +| A12 <-02--| |--39-> A09 that can stand the test of time | +| A13 <-03--| |--38-> A08 with no need for major changes. | +| A14 <-04--| |--37-> A07 | +| A15 <-05--| |--36-> A06 Some of the main design decisions | +| CLK --06->| |--35-> A05 have been the following: | +| D4 <-07->| |--34-> A04 | +| D3 <-08->|.---------.|--33-> A03 1. Opcode partial decoding keeps | +| D5 <-09->|| ZILOG ||--32-> A02 the code small and maintainable. | +| D6 <-10->|| Z80 ||--31-> A01 | +| +5V --11--|| CPU ||--30-> A00 2. Function pointer tables for | +| D2 <-12->|| ||--29-- GND opcode selection allow easy reuse | +| D7 <-13->|'---------'|--28-> RFSH of almost all instruction code | +| D0 <-14->| |--27-> M1 in the interrupt mode 0. | +| D1 <-15->| |<-26-- RESET | +| INT --16->| |<-25-- BUSREQ 3. Avoiding conditional statements | +| NMI --17->| |<-24-- WAIT as much as possible reduces the | +| HALT <-18--| |--23-> BUSACK branch penalty in modern pipelined | +| MREQ <-19--| |--22-> WR processors. | +| IORQ <-20--| |--21-> RD | +| '-----------' | +| Zilog Z80 CPU, May 1976 version | +| 40-pin ceramic DIP pinout Manuel | +| | +'=============================================================================*/ + +#ifndef Z80_DEPENDENCIES_HEADER +# include +# include +# include +#endif + +#ifdef Z80_STATIC +# define Z80_API +#else +# define Z80_API Z_API_EXPORT +#endif + +#ifdef Z80_WITH_LOCAL_HEADER +# include "Z80.h" +#else +# include +#endif + + +/* MARK: - Types */ + +typedef zuint8 (* Insn)(Z80 *self); + +#ifdef Z80_WITH_FULL_IM0 + typedef struct { + Z80* z80; + void* context; + Z80Read fetch; + Z80Read read; + Z80Write write; + Z80Read in; + Z80Write out; + Z80Notify ld_i_a; + Z80Notify ld_r_a; + Z80Notify reti; + Z80Notify retn; + zuint16 pc; + } IM0; +#endif + + +/* MARK: - Instance Variable and Callback Shortcuts */ + +#define MEMPTR self->memptr.uint16_value +#define PC self->pc.uint16_value +#define SP self->sp.uint16_value +#define XY self->xy.uint16_value +#define IX self->ix_iy[0].uint16_value +#define IY self->ix_iy[1].uint16_value +#define AF self->af.uint16_value +#define BC self->bc.uint16_value +#define DE self->de.uint16_value +#define HL self->hl.uint16_value +#define AF_ self->af_.uint16_value +#define BC_ self->bc_.uint16_value +#define DE_ self->de_.uint16_value +#define HL_ self->hl_.uint16_value +#define MEMPTRH self->memptr.uint8_values.at_1 +#define MEMPTRL self->memptr.uint8_values.at_0 +#define PCH self->pc.uint8_values.at_1 +#define A self->af.uint8_values.at_1 +#define F self->af.uint8_values.at_0 +#define B self->bc.uint8_values.at_1 +#define C self->bc.uint8_values.at_0 +#define E self->de.uint8_values.at_0 +#define L self->hl.uint8_values.at_0 +#define I self->i +#define R self->r +#define R7 self->r7 +#define Q self->q +#define IFF1 self->iff1 +#define IFF2 self->iff2 +#define IM self->im +#define HALT_LINE self->halt_line +#define INT_LINE self->int_line +#define DATA self->data.uint8_array +#define REQUEST self->request +#define RESUME self->resume +#define OPTIONS self->options +#define CONTEXT self->context + +#define FETCH_OPCODE(address) self->fetch_opcode(CONTEXT, address) +#define FETCH(address) self->fetch (CONTEXT, address) +#define READ(address) self->read (CONTEXT, address) +#define WRITE(address, value) self->write (CONTEXT, address, value) +#define IN(port) self->in (CONTEXT, port) +#define OUT(port, value) self->out (CONTEXT, port, value) +#define NOTIFY(callback) if (self->callback != Z_NULL) self->callback(CONTEXT) + + +/* MARK: - Callbacks: 16-bit Operations */ + +static Z_ALWAYS_INLINE zuint16 fetch_16(Z80 *self, zuint16 address) + { + zuint8 l = FETCH(address); + return (zuint16)(l | ((zuint16)FETCH(address + 1) << 8)); + } + + +static Z_ALWAYS_INLINE zuint16 read_16(Z80 *self, zuint16 address) + { + zuint8 l = READ(address); + return (zuint16)(l | ((zuint16)READ(address + 1) << 8)); + } + + +static Z_ALWAYS_INLINE void write_16f(Z80 *self, zuint16 address, zuint16 value) + { + WRITE(address, (zuint8)value); + WRITE(address + 1, (zuint8)(value >> 8)); + } + + +static Z_ALWAYS_INLINE void write_16b(Z80 *self, zuint16 address, zuint16 value) + { + WRITE(address + 1, (zuint8)(value >> 8)); + WRITE(address, (zuint8)value); + } + + +#ifndef Z80_WITH_FULL_IM0 + static Z_ALWAYS_INLINE zuint16 int_fetch_16(Z80 *self) + { + zuint8 l = self->int_fetch(CONTEXT, PC); + return (zuint16)(l | ((zuint16)self->int_fetch(CONTEXT, PC) << 8)); + } +#endif + + +#define FETCH_16(address) fetch_16 (self, address) +#define READ_16(address) read_16 (self, address) +#define WRITE_16F(address, value) write_16f(self, address, value) +#define WRITE_16B(address, value) write_16b(self, address, value) + + +/* MARK: - Flags */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +| S Z Y H X P N C | +'-|-|-|-|-|-|-|-|-' + | | | | | | | '-- carry / borrow + | | | | | | '---- addition / subtraction + | | | | | '------ parity (P) / two's complement signed overflow (V) + | | | | '-------- result's bit 3 (undocumented) + | | | '---------- half carry / half borrow + | | '------------ result's bit 5 (undocumented) + | '-------------- zero + '---------------- sign */ + +#define SF 128 +#define ZF 64 +#define YF 32 +#define HF 16 +#define XF 8 +#define PF 4 +#define NF 2 +#define CF 1 + +#define SZPCF (SF | ZF | PF | CF) +#define SZPF (SF | ZF | PF ) +#define SZCF (SF | ZF | CF ) +#define SYXF (SF | YF | XF ) +#define ZPF (ZF | PF ) +#define YXCF (YF | XF | CF ) +#define YXF (YF | XF ) +#define HCF (HF | CF ) + +#define F_SZPC (F & SZPCF) +#define F_SZP (F & SZPF) +#define F_SZC (F & SZCF) +#define F_C (F & CF) +#define A_SYX (A & SYXF) +#define A_YX (A & YXF) + +#define ZF_ZERO(value) (!(value) << 6) + +#ifdef Z80_WITH_PARITY_COMPUTATION + static Z_ALWAYS_INLINE zuint8 pf_parity(zuint8 value) + {return (((0x9669U >> ((value ^ (value >> 4)) & 0xF)) & 1) << 2);} + +# define PF_PARITY pf_parity +#else + static zuint8 const pf_parity_table[256] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* 0 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 1 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 2 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 3 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 4 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 5 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 6 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* 7 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 8 */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* 9 */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* A */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* B */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* C */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + /* D */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* E */ 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + /* F */ 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4}; + +# define PF_PARITY(value) pf_parity_table[value] +#endif + +/*-----------------------------------------------------------------------------. +| `PF_OVERFLOW` computes PF according to whether signed overflow occurs in the | +| addition or subtraction of two integers. For additions, `rhs` must be passed | +| bit-wise ~inverted. For an explanation of the formula, check: | +| * https://stackoverflow.com/a/199668 | +| * http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/Comb/overflow.html | +'=============================================================================*/ + +#define PF_OVERFLOW(width, result, lhs, rhs) \ + (((zuint##width)((lhs ^ rhs) & (lhs ^ result)) >> (width - 3)) & PF) + +/*-----------------------------------------------------------------------------. +| Q serves as an abstraction for a set of latches related to flag computation. | +| From an emulation perspective, instructions that affect the flags copy the | +| final value of F to Q, whereas instructions that do not affect the flags | +| (including `ex af,af'`, `pop af`, internal NOPs and interrupt responses) set | +| Q to 0. Q is used to compute YF and XF in the `ccf` and `scf` instructions. | +| | +| References: | +| * https://worldofspectrum.org/forums/discussion/20345 | +| * https://worldofspectrum.org/forums/discussion/41704 | +'=============================================================================*/ + +#ifdef Z80_WITH_Q +# define FLAGS Q = F +# define Q_0 Q = 0; +#else +# define FLAGS F +# define Q_0 +#endif + + +/* MARK: - Bit Rotation */ + +#define ROL(value) Z_UINT8_ROTATE_LEFT (value, 1) +#define ROR(value) Z_UINT8_ROTATE_RIGHT(value, 1) + + +/* MARK: - 8-Bit Register Resolution */ + +/*---------. .---------------------. +| 76543210 | | J / K | O / P | +|----------| |---------+-----------| +| __jjj___ | | 000 = b | 000 = b | +| _____kkk | | 001 = c | 001 = c | +| __ooo___ | | 010 = d | 010 = d | +| _____ppp | | 011 = e | 011 = e | +'----------' | 100 = h | 100 = XYh | + | 101 = l | 101 = XYl | + | 111 = a | 111 = a | + '--------------------*/ + +static zusize const j_k_table[8] = { + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, hl.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, hl.uint8_values.at_0), + 0, + Z_MEMBER_OFFSET(Z80, af.uint8_values.at_1)}; + +static zusize const o_p_table[8] = { + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, bc.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, de.uint8_values.at_0), + Z_MEMBER_OFFSET(Z80, xy.uint8_values.at_1), + Z_MEMBER_OFFSET(Z80, xy.uint8_values.at_0), + 0, + Z_MEMBER_OFFSET(Z80, af.uint8_values.at_1)}; + +#define REGISTER_8(table, offset, shift) \ + *((zuint8 *)self + table[(DATA[offset] shift) & 7]) + +#define J0 REGISTER_8(j_k_table, 0, >> 3 ) +#define J1 REGISTER_8(j_k_table, 1, >> 3 ) +#define K0 REGISTER_8(j_k_table, 0, Z_EMPTY) +#define K1 REGISTER_8(j_k_table, 1, Z_EMPTY) +#define K3 REGISTER_8(j_k_table, 3, Z_EMPTY) +#define O REGISTER_8(o_p_table, 1, >> 3 ) +#define P REGISTER_8(o_p_table, 1, Z_EMPTY) + + +/* MARK: - 16-Bit Register Resolution */ + +/*---------. .-----------------------------. +| 76543210 | | S | T | W | +|----------| |---------+---------+---------| +| __ss____ | | 00 = bc | 00 = bc | 00 = bc | +| __tt____ | | 01 = de | 01 = de | 01 = de | +| __ww____ | | 10 = hl | 10 = hl | 10 = XY | +'----------' | 11 = sp | 11 = af | 11 = sp | + '----------------------------*/ + +static zusize const s_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, hl.uint16_value), + Z_MEMBER_OFFSET(Z80, sp.uint16_value)}; + +static zusize const t_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, hl.uint16_value), + Z_MEMBER_OFFSET(Z80, af.uint16_value)}; + +static zusize const w_table[4] = { + Z_MEMBER_OFFSET(Z80, bc.uint16_value), + Z_MEMBER_OFFSET(Z80, de.uint16_value), + Z_MEMBER_OFFSET(Z80, xy.uint16_value), + Z_MEMBER_OFFSET(Z80, sp.uint16_value)}; + +#define REGISTER_16(table, offset) \ + *(zuint16 *)(void *)((zchar *)self + table[(DATA[offset] >> 4) & 3]) + +#define SS0 REGISTER_16(s_table, 0) +#define SS1 REGISTER_16(s_table, 1) +#define TT REGISTER_16(t_table, 0) +#define WW REGISTER_16(w_table, 1) + + +/* MARK: - Condition Evaluation */ + +/*---------. .----------. +| 76543210 | | Z | +|----------| |----------| +| __zzz___ | | 000 = nz | +| ___zz___ | | 001 = z | +'----------' | 010 = nc | + | 011 = c | + | 100 = po | + | 101 = pe | + | 110 = p | + | 111 = m | + '---------*/ + +static zuint8 const z_table[8] = {ZF, ZF, CF, CF, PF, PF, SF, SF}; + + +static Z_ALWAYS_INLINE zsint zzz(Z80 const *self, zuint8 mask) + { + zsint z = (DATA[0] >> 3) & mask; + + return !(F & z_table[z]) ^ (z & 1); + } + + +/* MARK: - 8-Bit Arithmetic and Logical Operations */ + +/*---------. .---------------------. +| 76543210 | | U SZYHXPNC | +|----------| |---------------------| +| __uuu___ | | 000 = add szycxv0c | +| _____10v | | 001 = adc szycxv0c | +'----------' | 010 = sub szybxv1b | + | 011 = sbc szybxv1b | + | 100 = and szy1xp00 | + | 101 = xor szy0xp00 | + | 110 = or szy0xp00 | + | 111 = cp sz*b*v1b | + |---------------------| + | V SZYHXPNC | + |---------------------| + | 100 = inc szycxv0. | + | 101 = dec szybxv1. | + '--------------------*/ + +static void uuu(Z80 *self, zuint8 offset, zuint8 rhs) + { + zuint8 t, f; + + switch ((DATA[offset] >> 3) & 7) + { + case 0: /* add */ + t = A + rhs; + + f = ((zuint)A + rhs > 255) | /* CF = carry */ + PF_OVERFLOW(8, t, A, ~rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-carry */ + /* NF = 0 */ + A = t; + break; + + case 1: /* adc */ + t = A + rhs + (f = F_C); + + f = ((zuint)A + rhs + f > 255) | /* CF = carry */ + PF_OVERFLOW(8, t, A, ~rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-carry */ + /* NF = 0 */ + A = t; + break; + + case 2: /* sub */ + t = A - rhs; + + f = (A < rhs) | /* CF = borrow */ + NF | /* NF = 1 */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-borrow */ + + A = t; + break; + + case 3: /* sbc */ + t = A - rhs - (f = F_C); + + f = ((zsint)A - rhs - f < 0) | /* CF = borrow */ + NF | /* NF = 1 */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + ((A ^ rhs ^ t) & HF); /* HF = half-borrow */ + + A = t; + break; + + case 4: /* and */ + A &= rhs; + f = HF | PF_PARITY(A); /* HF = 1; PF = parity */ + break; /* NF, CF = 0 */ + + case 5: /* xor */ + A ^= rhs; + f = PF_PARITY(A); /* PF = parity */ + break; /* HF, NF, CF = 0 */ + + case 6: /* or */ + A |= rhs; + f = PF_PARITY(A); /* PF = parity */ + break; /* HF, NF, CF = 0 */ + + case 7: /* cp */ + t = A - rhs; + + FLAGS = (zuint8)( + (t & SF) | /* SF = sign */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ rhs ^ t) & HF) | /* HF = half-borrow */ + PF_OVERFLOW(8, t, A, rhs) | /* PF = overflow */ + (A < rhs) | /* CF = borrow */ + (rhs & YXF) | /* YF = rhs.5; XF = rhs.3 */ + NF); /* NF = 1 */ + + return; + } + + FLAGS = (zuint8)( + f | /* HF, PF, NF and CF already computed */ + A_SYX | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(A)); /* ZF = zero */ + } + + +static zuint8 vvv(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 dec = DATA[offset] & 1; + zuint8 nf = (zuint8)(dec << 1); + zuint8 t = value + 1 - nf; + + FLAGS = (zuint8)( + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((value ^ t) & HF) | /* HF = half-carry/borrow */ + ((value == 127 + dec) << 2) | /* PF = overflow */ + nf | /* NF = 0 (inc), 1 (dec) */ + F_C); /* CF unchanged */ + + return t; + } + + +/* MARK: - Rotation and Shift Operations */ + +/*---------. .-----------. +| 76543210 | | G | +|----------| |-----------| +| __ggg___ | | 000 = rlc | +'----------' | 001 = rrc | + | 010 = rl | + | 011 = rr | + | 100 = sla | + | 101 = sra | + | 110 = sll | + | 111 = srl | + '----------*/ + +static zuint8 ggg(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 cf; + + switch ((DATA[offset] >> 3) & 7) + { + /* rlc .----------------. + .----. | .---------. | + | CF |<-----| 7 <-- 0 |<--' + '----' '--------*/ + case 0: + cf = (value = ROL(value)) & 1; + break; + + /* rrc .----------------. + | .---------. | .----. + '-->| 7 --> 0 |----->| CF | + '---------' '---*/ + case 1: + cf = value & 1; + value = ROR(value); + break; + + /* rl .-------------------------. + | .----. .---------. | + '--| CF |<--| 7 <-- 0 |<--' + '----' '--------*/ + case 2: + cf = value >> 7; + value = (zuint8)((value << 1) | F_C); + break; + + /* rr .-------------------------. + | .---------. .----. | + '-->| 7 --> 0 |-->| CF |--' + '---------' '---*/ + case 3: + cf = value & 1; + value = (zuint8)((value >> 1) | ((zuint8)F_C << 7)); + break; + + /* sla .----. .---------. + | CF |<--| 7 <-- 0 |<-- 0 + '----' '--------*/ + case 4: + cf = value >> 7; + value <<= 1; + break; + + /* sra .---------. .----. + .-->| 7 --> 0 |-->| CF | + | '-|-------' '----' + '----*/ + case 5: + cf = value & 1; + value = (zuint8)((value & 128) | (value >> 1)); + break; + + /* sll .----. .---------. + | CF |<--| 7 <-- 0 |<-- 1 + '----' '--------*/ + case 6: + cf = value >> 7; + value = (zuint8)((value << 1) | 1); + break; + + /* srl .---------. .----. + 0 -->| 7 --> 0 |-->| CF | + '---------' '---*/ + case 7: + cf = value & 1; + value >>= 1; + break; + + /* Uncoment to avoid compiler warnings */ + /*default: cf = 0;*/ + } + + FLAGS = (zuint8)( /* HF, NF = 0 */ + (value & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(value) | /* ZF = zero */ + PF_PARITY(value) | /* PF = parity */ + cf); /* CF already computed */ + + return value; + } + + +/* MARK: - Bit Set and Reset Operations */ + +/*---------. .---------. +| 76543210 | | M | +|----------| |---------| +| _m______ | | 0 = res | +'----------' | 1 = set | + '--------*/ + +static Z_ALWAYS_INLINE zuint8 m(Z80 *self, zuint8 offset, zuint8 value) + { + zuint8 t; + + Q_0 + t = DATA[offset]; + + return (zuint8)((t & 64) + ? value | (1U << ((t >> 3) & 7)) + : value & ~(1U << ((t >> 3) & 7))); + } + + +/* MARK: - Function Shortcuts and Reusable Code */ + +#define INSN(name) static zuint8 name(Z80 *self) +#define N(offset) ((DATA[offset] >> 3) & 7) +#define Z(mask) zzz(self, mask) +#define U0(value) uuu(self, 0, value) +#define U1(value) uuu(self, 1, value) +#define V0(value) vvv(self, 0, value) +#define V1(value) vvv(self, 1, value) +#define G1(value) ggg(self, 1, value) +#define G3(value) ggg(self, 3, value) +#define M1(value) m (self, 1, value) +#define M3(value) m (self, 3, value) +#define PUSH(value) WRITE_16B(SP -= 2, value) +#define R_ALL ((R & 127) | (R7 & 128)) +#define RET MEMPTR = PC = READ_16(SP); SP += 2 +#define FETCH_XY_EA(address) MEMPTR = (zuint16)(XY + (zsint8)FETCH(address)) +#define IS_XY_PREFIX(opcode) ((opcode) & 0xDF) == 0xDD +#define EX(a, b) t = a; a = b; b = t + + +#define LD_A_IR(rhs) \ + A = rhs; \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + A_SYX | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(A) | /* ZF = zero */ \ + (IFF2 << 2) | /* PF = IFF2 */ \ + F_C); /* CF unchanged */ \ + \ + PC += 2; \ + return 9 + + +#define LDX(operator) \ + zuint8 t = READ(HL operator); \ + \ + WRITE(DE operator, t); \ + t += A; \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + F_SZC | /* SF, ZF, CF unchanged */ \ + ((t & 2) << 4) | /* YF = (A + [HLi]).1 */ \ + (t & XF) | /* XF = (A + [HLi]).3 */ \ + (!!(--BC) << 2)); /* PF = !!BCo */ \ + \ + PC += 2; \ + return 16 + + +#define LDXR(operator) \ + zuint8 t = READ(HL operator); \ + \ + WRITE(DE operator, t); \ + t += A; \ + \ + if (--BC) \ + { /* HF, NF = 0 */ \ + FLAGS = F_SZC | /* SF, ZF, CF unchanged */ \ + ((PC >> 8) & YXF) | /* YF = PCi.13; XF = PCi.11 */ \ + PF; /* PF = 1 */ \ + \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = (zuint8)( /* HF, PF, NF = 0 */ \ + F_SZC | /* SF, ZF, CF unchanged */ \ + ((t & 2) << 4) | /* YF = (A + [HLi]).1 */ \ + (t & XF)); /* XF = (A + [HLi]).3 */ \ + \ + PC += 2; \ + return 16 + + +#define CPX(operator) \ + zuint8 n = READ(HL operator); \ + zuint8 t0 = A - n; \ + zuint8 hf = (A ^ n ^ t0) & HF; \ + zuint8 t1 = t0 - (hf >> 4); \ + \ + FLAGS = (zuint8)( \ + (t0 & SF) | /* SF = sign */ \ + ZF_ZERO(t0) | /* ZF = zero */ \ + hf | /* HF = half-borrow */ \ + ((t1 & 2) << 4) | /* YF = (A - [HLi] - HFo).1 */ \ + (t1 & XF) | /* XF = (A - [HLi] - HFo).3 */ \ + (!!(--BC) << 2) | /* PF = !!BCo */ \ + NF | /* NF = 1 */ \ + F_C); /* CF unchanged */ \ + \ + MEMPTR operator; \ + PC += 2; \ + return 16 + + +#define CPXR(operator) \ + zuint8 n = READ(HL operator); \ + zuint8 t0 = A - n; \ + zuint8 hf = (A ^ n ^ t0) & HF; \ + zuint8 t1 = t0 - (hf >> 4); \ + \ + zuint8 f = (zuint8)( \ + (t0 & SF) | /* SF = sign */ \ + ZF_ZERO(t0) | /* ZF = zero */ \ + hf | /* HF = half-borrow */ \ + (!!(--BC) << 2) | /* PF = !!BCo */ \ + NF | /* NF = 1 */ \ + F_C); /* CF unchanged */ \ + \ + if (t0 && BC) \ + { \ + /* YF = PCi.13; XF = PCi.11 */ \ + FLAGS = f | ((PC >> 8) & YXF); \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = (zuint8)( \ + f | \ + ((t1 & 2) << 4) | /* YF = (A - [HLi] - HFo).1 */ \ + (t1 & XF)); /* XF = (A - [HLi] - HFo).3 */ \ + \ + MEMPTR operator; \ + PC += 2; \ + return 16 + + +#define ADD_16(lhs, rhs, pc_increment) \ + zuint16 n = rhs; \ + zuint32 t = lhs + n; \ + \ + FLAGS = (zuint8)( /* NF = 0 */ \ + F_SZP | /* SF, ZF, PF unchanged */ \ + ((t >> 8) & YXF) | /* YF = high-Y; XF = high-X */ \ + (((lhs ^ n ^ t) >> 8) & HF) | /* HF = high-half-carry */ \ + ((t >> 16) & 1)); /* CF = carry */ \ + \ + MEMPTR = lhs + 1; \ + lhs = (zuint16)t; \ + pc_increment; \ + return 11 + + +#define ADC_SBC_HL_SS(operator, pf_overflow_rhs, or_nf) \ + zuint16 ss = SS1; \ + zuint32 t = HL operator ss operator F_C; \ + \ + FLAGS = (zuint8)( \ + ((t >> 8) & SYXF) /* SF = sign; YF = high-Y; XF = high-X */ \ + | (zuint8)ZF_ZERO((zuint16)t) /* ZF = zero */ \ + /* HF = high-half-carry (adc), high-half-borrow (sbc) */ \ + | (((HL ^ ss ^ t) >> 8) & HF) \ + /* PF = overflow */ \ + | PF_OVERFLOW(16, t, HL, pf_overflow_rhs) \ + | ((t >> 16) & 1) /* CF = carry (adc), borrow (sbc) */ \ + or_nf); /* NF = 0 (adc), 1 (sbc) */ \ + \ + MEMPTR = HL + 1; \ + HL = (zuint16)t; \ + PC += 2; \ + return 15 + + +/* rla .-------------------------. rra .-------------------------. + | .----. .----A----. | | .----A----. .----. | + '--| CF |<--| 7 <-- 0 |<--' '-->| 7 --> 0 |-->| CF |--' + '----' '---------' '---------' '---*/ + +#define RXA(a_to_cf, operator, fc_to_a) \ + zuint8 cf = a_to_cf; \ + \ + A = (zuint8)((A operator 1) | fc_to_a); \ + \ + FLAGS = F_SZP | /* SF, ZF, PF unchanged */ \ + A_YX | /* YF = Y; XF = X */ \ + cf; /* CF = Ai.7 (rla), Ai.0 (rra) */ \ + /* HF, NF = 0 */ \ + PC++; \ + return 4 + + +/* rld .------------------------. rrd .------------------------. + | | | | +.--------|--. .-------------. | .--------V--. .-------------. | +| 7-4 | 3-0 |<--| 7-4 <-- 3-0 |<--' | 7-4 | 3-0 |-->| 7-4 --> 3-0 |---' +'-----A-----' '----(HL)-----' '-----A-----' '----(HL)----*/ + +#define RXD(vhl_to_vhl, a_to_vhl, vhl_to_a) \ + zuint8 t = READ(HL); \ + \ + MEMPTR = HL + 1; \ + WRITE(HL, (zuint8)((t vhl_to_vhl) | (A a_to_vhl))); \ + A = (A & 0xF0) | (t vhl_to_a); \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + A_SYX | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(A) | /* ZF = zero */ \ + PF_PARITY(A) | /* PF = parity */ \ + F_C); /* CF unchanged */ \ + \ + PC += 2; \ + return 18 + + +#define DJNZ_JR_Z_OFFSET(condition, cycles_if_true, cycles_if_false) \ + zsint8 offset; \ + \ + Q_0 \ + offset = (zsint8)FETCH(PC + 1); /* Always read */ \ + \ + if (condition) \ + { \ + MEMPTR = (PC += 2 + offset); \ + return cycles_if_true; \ + } \ + \ + PC += 2; \ + return cycles_if_false + + +#define RETX(mnemonic) \ + DATA[2] = IFF1; \ + NOTIFY(mnemonic); \ + Q_0 \ + RET; \ + if ((IFF1 = IFF2) && INT_LINE) REQUEST |= Z80_REQUEST_INT; \ + return 14 + + +#define IN_VC(set_lhs) \ + zuint8 t; \ + \ + MEMPTR = BC + 1; \ + t = IN(BC); \ + \ + FLAGS = (zuint8)( /* HF, NF = 0 */ \ + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ \ + ZF_ZERO(t) | /* ZF = zero */ \ + PF_PARITY(t) | /* PF = parity */ \ + F_C); /* CF unchanged */ \ + \ + set_lhs \ + PC += 2; \ + return 12 + + +#define INX_OUTX_COMMON(io) \ + FLAGS = (zuint8)( \ + (B & SYXF) | /* SF = Bo.7; YF = Bo.5; XF = Bo.3 */ \ + ZF_ZERO(B) | /* ZF = !Bo */ \ + PF_PARITY((t & 7) ^ B) | /* PF = ((T & 7) ^ Bo).parity */ \ + ((t > 255) ? HCF : 0) | /* HF, CF = T > 255 */ \ + ((io >> 6) & NF)); /* NF = IO.7 */ \ + \ + PC += 2; \ + return 16 + + +#define INX(hl_operator, memptr_operator) \ + zuint8 io = IN(BC); \ + zuint t = (zuint)io + (zuint8)(C memptr_operator 1); \ + \ + WRITE(HL hl_operator, io); \ + MEMPTR = BC memptr_operator 1; \ + B--; \ + INX_OUTX_COMMON(io) + + +#define OUTX(hl_operator, memptr_operator) \ + zuint8 io = READ(HL hl_operator); \ + zuint t = (zuint)io + L; \ + \ + B--; \ + MEMPTR = BC memptr_operator 1; \ + OUT(BC, io); \ + INX_OUTX_COMMON(io) + + +/*-----------------------------------------------------------------------------. +| Block instructions produce an extra M-cycle of 5 T-states to decrement PC if | +| the loop condition is met. In 2018, David Banks (AKA hoglet) discovered that | +| the Z80 CPU performs additional flag changes during this M-cycle and managed | +| to decipher the behaviors. All block instructions copy bits 13 and 11 of PCi | +| to YF and XF, respectively [1.1], but `inir`, `indr`, `otir` and `otdr` also | +| modify HF and PF in a very complicated way [1.2]. These latter two flags are | +| not commented here because the explanation would not be simpler than the | +| code itself, so please refer to David Banks' paper [2] for more information. | +| | +| David Banks' discoveries have been corroborated thanks to Peter Helcmanovsky | +| (AKA Ped7g), who wrote a test that covers most of the cases that can be | +| verified on a ZX Spectrum [3]. | +| | +| In 2022, rofl0r discovered that the instructions `otir` and `otdr` also set | +| MEMPTR to `PCi + 1` during the extra M-cycle [4]. However, this information | +| was not announced anywhere and went unnoticed by the emulation community | +| until 2023, when Manuel Sainz de Baranda y Goñi rediscovered the same | +| behaviour in all four I/O block instructions: `inir`, `indr`, `otir` and | +| `otdr` [5]. | +| | +| References: | +| 1. https://stardot.org.uk/forums/viewtopic.php?t=15464 | +| 1. https://stardot.org.uk/forums/viewtopic.php?p=211042#p211042 | +| 2. https://stardot.org.uk/forums/viewtopic.php?p=212021#p212021 | +| 2. Banks, David (2018-08-21). "Undocumented Z80 Flags" rev. 1.0. | +| * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags | +| * https://stardot.org.uk/forums/download/file.php?id=39831 | +| 3. Helcmanovsky, Peter (2021/2022). "Z80 Block Flags Test". | +| * https://github.com/MrKWatkins/ZXSpectrumNextTests | +| 4. https://github.com/hoglet67/Z80Decoder/issues/2 | +| 5. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=10555 | +'=============================================================================*/ + +#define INXR_OTXR_COMMON \ + if (B) { \ + FLAGS = (zuint8)( /* ZF = 0 */ \ + (B & SF) | /* SF = Bo.7 */ \ + (PCH & YXF) | /* YF = PCi.13; XF = PCi.11 */ \ + nf | /* NF = IO.7 */ \ + (hcf ? /* CF = T > 255 */ \ + CF | \ + (nf ? \ + (!(B & 0xF) << 4) | \ + PF_PARITY(p ^ ((B - 1) & 7)) \ + : \ + (((B & 0xF) == 0xF) << 4) | \ + PF_PARITY(p ^ ((B + 1) & 7))) \ + : PF_PARITY(p ^ (B & 7)))); \ + \ + MEMPTR = PC + 1; \ + return 21; \ + } \ + \ + FLAGS = ZF | /* ZF = 1; SF, YF, XF = 0 */ \ + hcf | /* HF, CF = T > 255 */ \ + PF_PARITY(p) | /* PF = ((T & 7) ^ Bo).parity */ \ + nf /* NF = IO.7 */ + + +#define INXR(hl_operator, memptr_operator) \ + zuint8 io = IN(BC); \ + zuint8 nf = (io >> 6) & NF; \ + zuint t; \ + zuint8 hcf, p; \ + \ + WRITE(HL hl_operator, io); \ + t = (zuint)io + (zuint8)(MEMPTR = BC memptr_operator 1); \ + hcf = (t > 255) ? HCF : 0; \ + p = (t & 7) ^ --B; \ + INXR_OTXR_COMMON; \ + PC += 2; \ + return 16 + + +#define OTXR(hl_operator, memptr_operator) \ + zuint8 io = READ(HL hl_operator); \ + zuint8 nf = (io >> 6) & NF; \ + zuint t = (zuint)io + L; \ + zuint8 hcf = (t > 255) ? HCF : 0; \ + zuint8 p = (t & 7) ^ --B; \ + \ + OUT(BC, io); \ + INXR_OTXR_COMMON; \ + MEMPTR = BC memptr_operator 1; \ + PC += 2; \ + return 16 + + +#define EXIT_HALT \ + HALT_LINE = 0; \ + if (self->halt != Z_NULL) self->halt(CONTEXT, 0) + + +/* MARK: - Instructions: 8-Bit Load Group */ +/*----------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 12345 | +| ------------------- -------------------------------- -------- -------- | +| ld J,K 01jjjkkk ........ 4:4 | +|* ld O,P <--XY-->01oooppp ........ 8:44 | +| ld J,BYTE 00jjj110<-BYTE-> ........ 7:43 | +|* ld O,BYTE <--XY-->00ooo110<-BYTE-> ........ 11:443 | +| ld J,(hl) 01jjj110 ........ 7:43 | +| ld J,(XY+OFFSET) <--XY-->01jjj110 ........ 19:44353 | +| ld (hl),K 01110kkk ........ 7:43 | +| ld (XY+OFFSET),K <--XY-->01110kkk ........ 19:44353 | +| ld (hl),BYTE <--36--><-BYTE-> ........ 10:433 | +| ld (XY+OFFSET),BYTE <--XY--><--36--><-BYTE-> ........ 19:44353 | +| ld a,(bc) <--0A--> ........ 7:43 | +| ld a,(de) <--1A--> ........ 7:43 | +| ld a,(WORD) <--3A--><-----WORD-----> ........ 13:4333 | +| ld (bc),a <--02--> ........ 7:43 | +| ld (de),a <--12--> ........ 7:43 | +| ld (WORD),a <--32--><-----WORD-----> ........ 13:4333 | +| ld a,i <--ED--><--57--> szy0x*0. 9:45 | +| ld a,r <--ED--><--5F--> szy0x*0. 9:45 | +| ld i,a <--ED--><--47--> ........ 9:45 | +| ld r,a <--ED--><--4F--> ........ 9:45 | +|-----------------------------------------------------------------------------| +| (*) Undocumented instruction. | +'============================================================================*/ + +INSN(ld_J_K ) {Q_0 J0 = K0; PC++; return 4;} +INSN(ld_O_P ) {Q_0 O = P; PC += 2; return 4;} +INSN(ld_J_BYTE ) {Q_0 J0 = FETCH((PC += 2) - 1); return 7;} +INSN(ld_O_BYTE ) {Q_0 O = FETCH((PC += 3) - 1); return 7;} +INSN(ld_J_vhl ) {Q_0 J0 = READ(HL); PC++; return 7;} +INSN(ld_J_vXYpOFFSET) {Q_0 J1 = READ(FETCH_XY_EA((PC += 3) - 1)); return 15;} +INSN(ld_vhl_K ) {Q_0 WRITE(HL, K0); PC++; return 7;} +INSN(ld_vXYpOFFSET_K) {Q_0 WRITE(FETCH_XY_EA((PC += 3) - 1), K1); return 15;} +INSN(ld_vhl_BYTE ) {Q_0 WRITE(HL, FETCH((PC += 2) - 1)); return 10;} +INSN(ld_a_vbc ) {Q_0 MEMPTR = BC + 1; A = READ(BC); PC++; return 7;} +INSN(ld_a_vde ) {Q_0 MEMPTR = DE + 1; A = READ(DE); PC++; return 7;} +INSN(ld_a_vWORD ) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); A = READ(MEMPTR++); return 13;} +INSN(ld_vbc_a ) {Q_0 MEMPTRL = C + 1; WRITE(BC, MEMPTRH = A); PC++; return 7;} +INSN(ld_vde_a ) {Q_0 MEMPTRL = E + 1; WRITE(DE, MEMPTRH = A); PC++; return 7;} +INSN(ld_a_i ) {LD_A_IR(I); } +INSN(ld_a_r ) {LD_A_IR(R_ALL); } +INSN(ld_i_a ) {NOTIFY(ld_i_a); Q_0 I = A; PC += 2; return 9;} +INSN(ld_r_a ) {NOTIFY(ld_r_a); Q_0 R = R7 = A; PC += 2; return 9;} + + +INSN(ld_vXYpOFFSET_BYTE) + { + zuint16 ea; + + Q_0 + ea = FETCH_XY_EA((PC += 4) - 2); + WRITE(ea, FETCH(PC - 1)); + return 15; + } + + +INSN(ld_vWORD_a) + { + zuint16 ea; + + Q_0 + MEMPTRL = (zuint8)((ea = FETCH_16((PC += 3) - 2)) + 1); + WRITE(ea, MEMPTRH = A); + return 13; + } + + +/* MARK: - Instructions: 16-Bit Load Group */ +/*----------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| ------------ -------------------------------- -------- --------- | +| ld SS,WORD 00ss0001<-----WORD-----> ........ 10:433 [1] +| ld XY,WORD <--XY--><--21--><-----WORD-----> ........ 14:4433 | +| ld hl,(WORD) <--2A--><-----WORD-----> ........ 16:43333 | +| ld SS,(WORD) <--ED-->01ss1011<-----WORD-----> ........ 20:443333 | +| ld XY,(WORD) <--XY--><--2A--><-----WORD-----> ........ 20:443333 | +| ld (WORD),hl <--22--><-----WORD-----> ........ 16:43333 | +| ld (WORD),SS <--ED-->01ss0011<-----WORD-----> ........ 20:443333 | +| ld (WORD),XY <--XY--><--22--><-----WORD-----> ........ 20:443333 | +| ld sp,hl <--F9--> ........ 6:6 | +| ld sp,XY <--XY--><--F9--> ........ 10:46 | +| push TT 11tt0101 ........ 11:533 | +| push XY <--XY--><--E5--> ........ 15:4533 | +| pop TT 11tt0001 ........ 10:433 | +| pop XY <--XY--><--E1--> ........ 14:4433 | +|-----------------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have a typo in the | +| M-cycles of the instruction. | +'======================================================================*/ + +INSN(ld_SS_WORD ) {Q_0 SS0 = FETCH_16((PC += 3) - 2); return 10;} +INSN(ld_XY_WORD ) {Q_0 XY = FETCH_16((PC += 4) - 2); return 10;} +INSN(ld_hl_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); HL = READ_16(MEMPTR++); return 16;} +INSN(ld_SS_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); SS1 = READ_16(MEMPTR++); return 20;} +INSN(ld_XY_vWORD) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); XY = READ_16(MEMPTR++); return 16;} +INSN(ld_vWORD_hl) {Q_0 MEMPTR = FETCH_16((PC += 3) - 2); WRITE_16F(MEMPTR++, HL ); return 16;} +INSN(ld_vWORD_SS) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); WRITE_16F(MEMPTR++, SS1); return 20;} +INSN(ld_vWORD_XY) {Q_0 MEMPTR = FETCH_16((PC += 4) - 2); WRITE_16F(MEMPTR++, XY ); return 16;} +INSN(ld_sp_hl ) {Q_0 SP = HL; PC++; return 6;} +INSN(ld_sp_XY ) {Q_0 SP = XY; PC += 2; return 6;} +INSN(push_TT ) {Q_0 PUSH(TT); PC++; return 11;} +INSN(push_XY ) {Q_0 PUSH(XY); PC += 2; return 11;} +INSN(pop_TT ) {Q_0 TT = READ_16(SP); SP += 2; PC++; return 10;} +INSN(pop_XY ) {Q_0 XY = READ_16(SP); SP += 2; PC += 2; return 10;} + + +/* MARK: - Instructions: Exchange, Block Transfer and Search Groups */ +/*-------------------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC !0 123456 =0 1234 | +| ---------- ---------------- -------- ------------------ | +| ex de,hl <--EB--> ........ 4:4 | +| ex af,af' <--08--> ........ 4:4 | +| exx <--D9--> ........ 4:4 | +| ex (sp),hl <--E3--> ........ 19:43435 | +| ex (sp),XY <--XY--><--E3--> ........ 23:443435 | +| ldi <--ED--><--A0--> ..*0**0. 16:4435 | +| ldir <--ED--><--B0--> ..*0*00. 21:44355 16:4435 | +| ldd <--ED--><--A8--> ..*0**0. 16:4435 | +| lddr <--ED--><--B8--> ..*0*00. 21:44355 16:4435 | +| cpi <--ED--><--A1--> sz*b**1. 16:4435 | +| cpir <--ED--><--B1--> sz*b**1. 21:44355 16:4435 | +| cpd <--ED--><--A9--> sz*b**1. 16:4435 | +| cpdr <--ED--><--B9--> sz*b**1. 21:44355 16:4435 | +'=============================================================*/ + +INSN(ex_de_hl ) {zuint16 t; Q_0 EX(DE, HL ); PC++; return 4;} +INSN(ex_af_af_) {zuint16 t; Q_0 EX(AF, AF_); PC++; return 4;} +INSN(exx ) {zuint16 t; Q_0 EX(BC, BC_); EX(DE, DE_); EX(HL, HL_); PC++; return 4;} +INSN(ex_vsp_hl) {Q_0 MEMPTR = READ_16(SP); WRITE_16B(SP, HL); HL = MEMPTR; PC++; return 19;} +INSN(ex_vsp_XY) {Q_0 MEMPTR = READ_16(SP); WRITE_16B(SP, XY); XY = MEMPTR; PC += 2; return 19;} +INSN(ldi ) {LDX (++); } +INSN(ldir ) {LDXR(++); } +INSN(ldd ) {LDX (--); } +INSN(lddr ) {LDXR(--); } +INSN(cpi ) {CPX (++); } +INSN(cpir ) {CPXR(++); } +INSN(cpd ) {CPX (--); } +INSN(cpdr ) {CPXR(--); } + + +/* MARK: - Instructions: 8-Bit Arithmetic and Logical Group */ +/*-------------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC 123456 | +| ----------------- ------------------------ -------- --------- | +| U [a,]K 10uuukkk sz|||||| 4:4 | +|* U [a,]P <--XY-->10uuuppp sz|||||| 8:44 | +| U [a,]BYTE 11uuu110<-BYTE-> sz|||||| 7:43 | +| U [a,](hl) 10uuu110 sz|||||| 7:43 | +| U [a,](XY+OFFSET) <--XY-->10uuu110 sz|||||| 19:44353 | +| V J 00jjj10v szy|xv|. 4:4 | +|* V O <--XY-->00ooo10v szy|xv|. 8:44 | +| V (hl) 0011010v szy|xv|. 11:443 | +| V (XY+OFFSET) <--XY-->0011010v szy|xv|. 23:443543 | +|--------------------------------------------------------------------| +| (*) Undocumented instruction. | +| (|) The flag is explained in table U/V. | +'===================================================================*/ + +INSN(U_a_K ) {U0(K0); PC++; return 4;} +INSN(U_a_P ) {U1(P); PC += 2; return 4;} +INSN(U_a_BYTE ) {U0(FETCH((PC += 2) - 1)); return 7;} +INSN(U_a_vhl ) {U0(READ(HL)); PC++; return 7;} +INSN(U_a_vXYpOFFSET) {U1(READ(FETCH_XY_EA((PC += 3) - 1))); return 15;} +INSN(V_J ) {zuint8 *j = &J0; *j = V0(*j); PC++; return 4;} +INSN(V_O ) {zuint8 *o = &O; *o = V1(*o); PC += 2; return 4;} +INSN(V_vhl ) {WRITE(HL, V0(READ(HL))); PC++; return 11;} +INSN(V_vXYpOFFSET ) {zuint16 ea = FETCH_XY_EA((PC += 3) - 1); WRITE(ea, V1(READ(ea))); return 19;} + + +/* MARK: - Instructions: General-Purpose Arithmetic and CPU Control Groups */ +/*-------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC 12 | +| -------- ---------------- -------- -------- | +| daa <--27--> szy^xp.* 4:4 | +| cpl <--2F--> ..y1x.1. 4:4 | +|- neg <--ED-->01***100 szybxv1b 8:44 | +| ccf <--3F--> ..***.0~ 4:4 | +| scf <--37--> ..*0*.01 4:4 | +| nop <--00--> ........ 4:4 | +| halt <--76--> ........ 4:4 | +| di <--F3--> ........ 4:4 | +| ei <--FB--> ........ 4:4 | +|- im 0 <--ED-->01*0*110 ........ 8:44 | +|- im 1 <--ED-->01*10110 ........ 8:44 | +|- im 2 <--ED-->01*11110 ........ 8:44 | +|--------------------------------------------------| +| (-) The instruction has undocumented opcodes. | +'=================================================*/ + +INSN(nop ) {Q_0 PC++; return 4;} +INSN(im_0) {Q_0 IM = 0; PC += 2; return 8;} +INSN(im_1) {Q_0 IM = 1; PC += 2; return 8;} +INSN(im_2) {Q_0 IM = 2; PC += 2; return 8;} + + +INSN(daa) + { + zuint8 cf = A > 0x99, t = ((F & HF) || (A & 0xF) > 9) ? 6 : 0; + + if (F_C || cf) t |= 0x60; + t = (F & NF) ? A - t : A + t; + + FLAGS = (zuint8)( + (F & (NF | CF)) | /* NF unchanged; CF dominant */ + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ t) & HF) | /* HF = Ai.4 != Ao.4 */ + PF_PARITY(t) | /* PF = parity */ + cf); /* CF |= 1 (if BCD carry) */ + + A = t; + PC++; + return 4; + } + + +INSN(cpl) + { + FLAGS = F_SZPC | /* SF, ZF, PF, CF unchanged */ + ((A = ~A) & YXF) | /* YF = Y; XF = X */ + HF | NF; /* HF, NF = 1 */ + + PC++; + return 4; + } + + +INSN(neg) + { + zuint8 t = (zuint8)-A; + + FLAGS = (zuint8)( + (t & SYXF) | /* SF = sign; YF = Y; XF = X */ + ZF_ZERO(t) | /* ZF = zero */ + ((A ^ t) & HF) | /* HF = half-borrow */ + ((t == 128) << 2) | /* PF = overflow */ + NF | /* NF = 1 */ + !!A); /* CF = borrow (not 0) */ + + A = t; + PC += 2; + return 8; + } + + +/*---------------------------------------------------------------------------. +| `ccf` and `scf` are the only instructions in which Q affects the flags. | +| Patrik Rak cracked the behavior of YF and XF in 2012, confirming that they | +| are taken, respectively, from bits 5 and 3 of the result of `(Q ^ F) | A` | +| [1,2]. This applies to all Zilog Z80 models, both NMOS and CMOS. In 2018, | +| David Banks (AKA hoglet) discovered that at least some ST CMOS models do | +| not set XF according to this formula and instead take this flag from bit 3 | +| of A, whereas NEC NMOS models take both flags from A [3]. | +| | +| References: | +| 1. https://worldofspectrum.org/forums/discussion/20345 | +| 2. https://worldofspectrum.org/forums/discussion/41704 | +| 3. Banks, David (2018-08-21). "Undocumented Z80 Flags" rev. 1.0. | +| * https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags | +| * https://stardot.org.uk/forums/download/file.php?id=39831 | +'===========================================================================*/ + +INSN(ccf) + { + FLAGS = (zuint8)( + (F_SZPC ^ CF) | /* SF, ZF, PF unchanged; CF = ~CFi */ + /* Zilog: YF = A.5 | (YFi ^ YQi); XF = A.3 | (XFi ^ XQi) */ + /* ST CMOS: YF = A.5 | (YFi ^ YQi); XF = A.3 */ + /* NEC NMOS: YF = A.5; XF = A.3 */ +# ifdef Z80_WITH_Q + ((((F ^ Q) & OPTIONS) | A) & YXF) | +# else + (A & YXF) | +# endif + (F_C << 4)); /* HF = CFi */ + /* NF = 0 */ + PC++; + return 4; + } + + +INSN(scf) + { + FLAGS = F_SZP | /* SF, ZF, PF unchanged */ + /* Zilog: YF = A.5 | (YFi ^ YQi); XF = A.3 | (XFi ^ XQi) */ + /* ST CMOS: YF = A.5 | (YFi ^ YQi); XF = A.3 */ + /* NEC NMOS: YF = A.5; XF = A.3 */ +# ifdef Z80_WITH_Q + ((((F ^ Q) & OPTIONS) | A) & YXF) | +# else + (A & YXF) | +# endif + CF; /* CF = 1 */ + /* HF, NF = 0 */ + PC++; + return 4; + } + + +/*-----------------------------------------------------------------------------. +| The `halt` instruction enables the HALT state after PC is incremented during | +| the opcode fetch. The CPU neither decrements nor avoids incrementing PC "so | +| that the instruction is re-executed" as Sean Young writes in section 5.4 of | +| "The Undocumented Z80 Documented". During the HALT state, the CPU repeatedly | +| executes an internal NOP operation. Each NOP consists of 1 M1 cycle of 4 | +| T-states that fetches and disregards the next opcode after `halt` without | +| incrementing PC. This opcode is read again and again until an exit condition | +| occurs (i.e., INT, NMI or RESET). | +| | +| This was first documented by Tony Brewer in 2014, and was later re-confirmed | +| by the HALT2INT test written by Mark Woodmass (AKA Woody) in 2021. | +| | +| References: | +| * Brewer, Tony (2014-12). "Z80 Special Reset". | +| * http://primrosebank.net/computers/z80/z80_special_reset.htm | +| * https://stardot.org.uk/forums/viewtopic.php?p=357136#p357136 | +'=============================================================================*/ + +#ifdef Z80_WITH_SPECIAL_RESET + static Insn const insn_table[256]; +#endif + +INSN(halt) + { + if (!HALT_LINE) + { + if (!RESUME) + { + Q_0 + PC++; + + if ((self->cycles += 4) >= self->cycle_limit) + { + RESUME = Z80_RESUME_HALT; + return 0; + } + + if (REQUEST) return 0; + RESUME = Z80_RESUME_HALT; + } + + HALT_LINE = 1; + + if (self->halt != Z_NULL) + { + self->halt(CONTEXT, 1); + if (self->cycles >= self->cycle_limit) return 0; + } + } + + if (self->nop == Z_NULL || (OPTIONS & Z80_OPTION_HALT_SKIP)) + { + zusize nop_cycles = self->cycle_limit - self->cycles; + + nop_cycles += (4 - (nop_cycles & 3)) & 3; + R += (zuint8)(nop_cycles >> 2); + self->cycles += nop_cycles; + } + +# ifdef Z80_WITH_SPECIAL_RESET + else { + zuint8 opcode; + + do { + R++; + opcode = self->nop(CONTEXT, PC); + self->cycles += 4; + + if (REQUEST) + { + RESUME = 0; + + if (REQUEST & Z80_REQUEST_SPECIAL_RESET) + { + HALT_LINE = 0; + + if (self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_EXIT_EARLY); + + if ((DATA[0] = opcode) != 0x76) + { + self->cycles -= 4; + PC--; + return insn_table[opcode](self); + } + } + + return 0; + } + } + while (self->cycles < self->cycle_limit); + + DATA[2] = opcode; + } + +# else + else do { + R++; + (void)self->nop(CONTEXT, PC); + self->cycles += 4; + + if (REQUEST) + { + RESUME = 0; + return 0; + } + } + while (self->cycles < self->cycle_limit); +# endif + + return 0; + } + + +INSN(di) + { + Q_0 + IFF1 = IFF2 = 0; + REQUEST &= ~(zuint8)Z80_REQUEST_INT; + PC++; + return 4; + } + + +INSN(ei) + { + Q_0 + IFF1 = IFF2 = 1; + if (INT_LINE) REQUEST |= Z80_REQUEST_INT; + PC++; + return 4; + } + + +/* MARK: - Instructions: 16-Bit Arithmetic Group */ +/*--------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC 1234 | +| --------- ---------------- -------- -------- | +| add hl,SS 00ss1001 ..YCX.0c 11:443 | +| adc hl,SS <--ED-->01ss1010 szYCXv0c 15:4443 | +| sbc hl,SS <--ED-->01ss0010 szYBXv1b 15:4443 | +| add XY,WW <--XY-->00ww1001 ..YCX.0c 15:4443 | +| inc SS 00ss0011 ........ 6:6 | +| inc XY <--XY--><--23--> ........ 10:46 | +| dec SS 00ss1011 ........ 6:6 | +| dec XY <--XY--><--2B--> ........ 10:46 | +'==================================================*/ + +INSN(add_hl_SS) {ADD_16(HL, SS0, PC++); } +INSN(adc_hl_SS) {ADC_SBC_HL_SS(+, ~ss, Z_EMPTY);} +INSN(sbc_hl_SS) {ADC_SBC_HL_SS(-, ss, | NF );} +INSN(add_XY_WW) {ADD_16(XY, WW, PC += 2); } +INSN(inc_SS ) {Q_0 (SS0)++; PC++; return 6;} +INSN(inc_XY ) {Q_0 XY++; PC += 2; return 6;} +INSN(dec_SS ) {Q_0 (SS0)--; PC++; return 6;} +INSN(dec_XY ) {Q_0 XY--; PC += 2; return 6;} + + +/* MARK: - Instructions: Rotate and Shift Group */ +/*-------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| --------------- -------------------------------- -------- --------- | +| rlca <--07--> ..y0x.0= 4:4 | +| rla <--17--> ..y0x.0= 4:4 | +| rrca <--0F--> ..y0x.0= 4:4 | +| rra <--1F--> ..y0x.0= 4:4 | +|- G K <--CB-->00gggkkk szy0xp0= 8:44 | +|- G (hl) <--CB-->00ggg110 szy0xp0= 15:4443 | +|- G (XY+OFFSET) <--XY--><--CB-->00ggg110 szy0xp0= 23:443543 | +|* G (XY+OFFSET),K <--XY--><--CB-->00gggkkk szy0xp0= 23:443543 | +| rld <--ED--><--6F--> szy0xp0. 18:44343 | +| rrd <--ED--><--67--> szy0xp0. 18:44343 | +|--------------------------------------------------------------------------| +| (-) The instruction has undocumented [pseudo-]opcodes. | +| (*) Undocumented instruction. | +'=========================================================================*/ + +INSN(rlca ) {A = ROL(A); FLAGS = F_SZP | (A & YXCF); PC++; return 4;} +INSN(rla ) {RXA(A >> 7, <<, F_C); } +INSN(rrca ) {A = ROR(A); FLAGS = F_SZP | A_YX | (A >> 7); PC++; return 4;} +INSN(rra ) {RXA(A & 1, >>, (F << 7)); } +INSN(G_K ) {zuint8 *k = &K1; *k = G1(*k); return 8;} +INSN(G_vhl ) {WRITE(HL, G1(READ(HL))); return 15;} +INSN(G_vXYpOFFSET ) {zuint16 ea = MEMPTR; WRITE(ea, G3(READ(ea))); return 19;} +INSN(G_vXYpOFFSET_K) {zuint16 ea = MEMPTR; WRITE(ea, K3 = G3(READ(ea))); return 19;} +INSN(rld ) {RXD(<< 4, & 0xF, >> 4); } +INSN(rrd ) {RXD(>> 4, << 4, & 0xF); } + + +/* MARK: - Instructions: Bit Set, Reset and Test Group */ +/*---------------------------------------------------------------------------. +| 0 1 2 3 Flags T-states | +| Assembly 76543210765432107654321076543210 SZYHXPNC 123456 | +| ----------------- -------------------------------- -------- --------- | +| bit N,K <--CB-->01nnnkkk sz*1*z0. 8:44 | +| bit N,(hl) <--CB-->01nnn110 sz*1*z0. 12:444 [1] +|- bit N,(XY+OFFSET) <--XY--><--CB-->01nnn*** sz*1*z0. 20:44354 | +| M N,K <--CB-->1mnnnkkk ........ 8:44 | +| M N,(hl) <--CB-->1mnnn110 ........ 15:4443 | +| M N,(XY+OFFSET) <--XY--><--CB-->1mnnn110 ........ 23:443543 | +|* M N,(XY+OFFSET),K <--XY--><--CB-->1mnnnkkk ........ 23:443543 | +|----------------------------------------------------------------------------| +| (-) The instruction has undocumented pseudo-opcodes. | +| (*) Undocumented instruction. | +|----------------------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have a typo in the | +| T-states of the instruction. | +'===========================================================================*/ + +INSN(M_N_K ) {zuint8 *k = &K1; *k = M1(*k); return 8;} +INSN(M_N_vhl ) {WRITE(HL, M1(READ(HL))); return 15;} +INSN(M_N_vXYpOFFSET ) {zuint16 ea = MEMPTR; WRITE(ea, M3(READ(ea))); return 19;} +INSN(M_N_vXYpOFFSET_K) {zuint16 ea = MEMPTR; WRITE(ea, K3 = M3(READ(ea))); return 19;} + + +INSN(bit_N_K) + { + zuint8 k = K1; + zuint8 t = k & (1U << N(1)); + + /*----------------------------------------------------------. + | In section 4.1 of "The Undocumented Z80 Documented" (all | + | versions), Sean Young says that YF and XF are taken from | + | the value resulting from the bit test operation, but this | + | seems not to be true. They are copies of bits 5 and 3 of | + | the register containing the value to be tested (K). | + '==========================================================*/ + FLAGS = (t ? t & SF : ZPF) | /* SF = sign; ZF, PF = zero */ + (k & YXF) | /* YF = K.5; XF = K.3 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 8; + } + + +INSN(bit_N_vhl) + { + zuint8 t = READ(HL) & (1U << N(1)); + + /*----------------------------------------------------------------. + | This is the only instruction in which MEMPTR affects the flags. | + | YF and XF are taken, respectively, from bits 13 and 11 of this | + | internal register whose behavior was cracked in 2006 by boo_boo | + | and Vladimir Kladov. Official schematics refer to this register | + | as WZ, but this emulator uses the name "MEMPTR" to honor those | + | who cracked it. | + | | + | References: | + | * https://zxpress.ru/zxnet/zxnet.pc/5909 | + | * boo_boo; Kladov, Vladimir (2006-03-29). "MEMPTR, Esoteric | + | Register of the Zilog Z80 CPU". | + | * https://zx-pk.ru/showpost.php?p=43688 | + | * https://zx-pk.ru/attachment.php?attachmentid=2984 | + | * https://zx-pk.ru/showpost.php?p=43800 | + | * https://zx-pk.ru/attachment.php?attachmentid=2989 | + '================================================================*/ + FLAGS = (t ? t & SF : ZPF) | /* SF = sign; ZF, PF = zero */ + (MEMPTRH & YXF) | /* YF = MEMPTRH.5; XF = MEMPTRH.3 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 12; + } + + +INSN(bit_N_vXYpOFFSET) + { + zuint8 t = READ(MEMPTR) & (1U << N(3)); + + FLAGS = (t ? t & SF : ZPF) | /* SF sign; ZF, PF = zero */ + (MEMPTRH & YXF) | /* YF = EA.13; XF = EA.11 */ + HF | /* HF = 1 */ + F_C; /* CF unchanged */ + /* NF = 0 */ + return 16; + } + + +/* MARK: - Instructions: Jump Group */ +/*----------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC Y 123 N 12 | +| ----------- ------------------------ -------- ------------ | +| jp WORD <--C3--><-----WORD-----> ........ 10:433 | +| jp Z,WORD 11zzz010<-----WORD-----> ........ 10:433 | +| jr OFFSET <--18--> ........ 12:435 | +| jr Z,OFFSET 001zz000 ........ 12:435 7:43 | +| jp (hl) <--E9--> ........ 4:4 | +| jp (XY) <--XY--><--E9--> ........ 8:44 | +| djnz OFFSET <--10--> ........ 13:535 8:53 | +'================================================================*/ + +INSN(jp_WORD ) {Q_0 MEMPTR = PC = FETCH_16(PC + 1); return 10;} +INSN(jp_Z_WORD ) {Q_0 MEMPTR = FETCH_16(PC + 1); PC = Z(7) ? MEMPTR : PC + 3; return 10;} +INSN(jr_OFFSET ) {Q_0 MEMPTR = (PC += 2 + (zsint8)FETCH(PC + 1)); return 12;} +INSN(jr_Z_OFFSET) {DJNZ_JR_Z_OFFSET(Z(3), 12, 7); } +INSN(jp_hl ) {Q_0 PC = HL; return 4;} +INSN(jp_XY ) {Q_0 PC = XY; return 4;} +INSN(djnz_OFFSET) {DJNZ_JR_Z_OFFSET(--B, 13, 8); } + + +/* MARK: - Instructions: Call and Return Group */ +/*--------------------------------------------------------------------. +| 0 1 2 Flags T-states | +| Assembly 765432107654321076543210 SZYHXPNC Y 123 N 123 | +| ----------- ------------------------ -------- ---------------- | +| call WORD <--CD--><-----WORD-----> ........ 17:43433 | +| call Z,WORD 11zzz100<-----WORD-----> ........ 17:43433 10:433 | +| ret <--C9--> ........ 10:433 | +| ret Z 11zzz000 ........ 11:533 5:5 | +|- reti/retn <--ED-->01***101 ........ 14:4433 | +| rst N 11nnn111 ........ 11:533 | +|---------------------------------------------------------------------| +| (-) The instruction has undocumented opcodes. The `reti` mnemonic | +| is used to represent the ED4Dh opcode, which is recognized by | +| the Z80 CTC chip. All other opcodes are represented as `retn`. | +'====================================================================*/ + +INSN(call_WORD) {Q_0 MEMPTR = FETCH_16(PC + 1); PUSH(PC + 3); PC = MEMPTR; return 17;} +INSN(ret ) {Q_0 RET; return 10;} +INSN(ret_Z ) {Q_0 if (Z(7)) {RET; return 11;} PC++; return 5;} +INSN(reti ) {RETX(reti); } +INSN(retn ) {RETX(retn); } +INSN(rst_N ) {Q_0 PUSH(PC + 1); MEMPTR = PC = DATA[0] & 56; return 11;} + + +INSN(call_Z_WORD) + { + Q_0 + MEMPTR = FETCH_16(PC + 1); /* Always read */ + + if (Z(7)) + { + PUSH(PC + 3); + PC = MEMPTR; + return 17; + } + + PC += 3; + return 10; + } + + +/* MARK: - Instructions: Input and Output Group */ +/*--------------------------------------------------------------. +| 0 1 Flags T-states | +| Assembly 7654321076543210 SZYHXPNC !0 12345 =0 1234 | +| ------------ ---------------- -------- ----------------- | +| in a,(BYTE) <--DB--><-BYTE-> ........ 11:434 | +| in J,(c) <--ED-->01jjj000 szy0xp0. 12:444 | +|* in (c) <--ED--><--70--> szy0xp0. 12:444 | +| ini <--ED--><--A2--> ******** 16:4543 [1] +| inir <--ED--><--B2--> ******** 21:45435 16:4543 [1] +| ind <--ED--><--AA--> ******** 16:4543 [1] +| indr <--ED--><--BA--> ******** 21:45435 16:4543 [1] +| out (BYTE),a <--D3--><-BYTE-> ........ 11:434 | +| out (c),J <--ED-->01jjj001 ........ 12:444 | +|* out (c),0 <--ED--><--71--> ........ 12:444 | +| outi <--ED--><--A3--> ******** 16:4534 | +| otir <--ED--><--B3--> ******** 21:45345 16:4534 | +| outd <--ED--><--AB--> ******** 16:4534 | +| otdr <--ED--><--BB--> ******** 21:45345 16:4534 | +|---------------------------------------------------------------| +| (*) Undocumented instruction. | +|---------------------------------------------------------------| +| 1. All versions of Zilog's "Z80 CPU User Manual" have typos | +| in the T-states of the instruction. | +'==============================================================*/ + +INSN(in_J_vc ) {IN_VC(J1 = t;); } +INSN(in_vc ) {IN_VC(Z_EMPTY); } +INSN(ini ) {INX (++, +); } +INSN(inir ) {INXR(++, +); } +INSN(ind ) {INX (--, -); } +INSN(indr ) {INXR(--, -); } +INSN(out_vc_J) {Q_0 MEMPTR = BC + 1; OUT(BC, J1); PC += 2; return 12;} +INSN(outi ) {OUTX(++, +); } +INSN(otir ) {OTXR(++, +); } +INSN(outd ) {OUTX(--, -); } +INSN(otdr ) {OTXR(--, -); } + + +INSN(in_a_vBYTE) + { + zuint16 t; + + Q_0 + + /*--------------------------------------------------------------------. + | In "MEMPTR, Esoteric Register of the Zilog Z80 CPU", boo_boo says | + | that MEMPTR is set to `((A << 8) | BYTE) + 1`. This causes a carry | + | from the LSbyte of the port number to MEMPTRH if BYTE is 255, which | + | differs from all other instructions where MEMPTRH is set to A, but | + | it has been verified on real hardware with the IN-MEMPTR test. | + '====================================================================*/ + MEMPTR = (t = (zuint16)(((zuint16)A << 8) | FETCH((PC += 2) - 1))) + 1; + + A = IN(t); + return 11; + } + + +INSN(out_vBYTE_a) + { + zuint8 t; + + Q_0 + MEMPTRL = (t = FETCH((PC += 2) - 1)) + 1; + MEMPTRH = A; + OUT((zuint16)(((zuint16)A << 8) | t), A); + return 11; + } + + +/*----------------------------------------------------------------------------. +| The `out (c),0` instruction behaves as `out (c),255` on the Zilog Z80 CMOS. | +| This was first discovered by Simon Cooke, who reported it on Usenet in 1996 | +| [1,2]. Later, in 2004, Colin Piggot rediscovered it with his SAM Coupé when | +| running a demo for SCPDU 6, coincidentally written by Simon Cooke [1]. In | +| 2008, this was once again rediscovered by the MSX community [1,3]. | +| | +| References: | +| 1. https://sinclair.wiki.zxnet.co.uk/wiki/Z80 | +| 2. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ | +| 3. https://msx.org/forum/development/msx-development/bug-z80-emulation-or- | +| tr-hw | +'============================================================================*/ + +INSN(out_vc_0) + { + Q_0 + PC += 2; + MEMPTR = BC + 1; + OUT(BC, (zuint8)0 - (OPTIONS & (zuint8)Z80_OPTION_OUT_VC_255)); + return 12; + } + + +/* MARK: - Instructions: Optimizations */ + +INSN(nop_nop) {Q_0; PC += 2; return 4;} + + +/* MARK: - Instruction Function Tables */ + +INSN(cb_prefix ); +INSN(ed_prefix ); +INSN(dd_prefix ); +INSN(fd_prefix ); +INSN(xy_cb_prefix); +INSN(xy_xy ); +INSN(ed_illegal ); +INSN(xy_illegal ); +INSN(hook ); + +#ifdef Z80_WITH_UNOFFICIAL_RETI +# define reti_retn reti +#else +# define reti_retn retn +#endif + +static Insn const insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ nop, ld_SS_WORD, ld_vbc_a, inc_SS, V_J, V_J, ld_J_BYTE, rlca, ex_af_af_, add_hl_SS, ld_a_vbc, dec_SS, V_J, V_J, ld_J_BYTE, rrca, +/* 1 */ djnz_OFFSET, ld_SS_WORD, ld_vde_a, inc_SS, V_J, V_J, ld_J_BYTE, rla, jr_OFFSET, add_hl_SS, ld_a_vde, dec_SS, V_J, V_J, ld_J_BYTE, rra, +/* 2 */ jr_Z_OFFSET, ld_SS_WORD, ld_vWORD_hl, inc_SS, V_J, V_J, ld_J_BYTE, daa, jr_Z_OFFSET, add_hl_SS, ld_hl_vWORD, dec_SS, V_J, V_J, ld_J_BYTE, cpl, +/* 3 */ jr_Z_OFFSET, ld_SS_WORD, ld_vWORD_a, inc_SS, V_vhl, V_vhl, ld_vhl_BYTE, scf, jr_Z_OFFSET, add_hl_SS, ld_a_vWORD, dec_SS, V_J, V_J, ld_J_BYTE, ccf, +/* 4 */ nop, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, +/* 5 */ ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, ld_J_K, ld_J_K, nop, ld_J_K, ld_J_K, ld_J_vhl, ld_J_K, +/* 6 */ ld_J_K, ld_J_K, ld_J_K, ld_J_K, hook, ld_J_K, ld_J_vhl, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, nop, ld_J_vhl, ld_J_K, +/* 7 */ ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, ld_vhl_K, halt, ld_vhl_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_K, ld_J_vhl, nop, +/* 8 */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* 9 */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* A */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* B */ U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_K, U_a_vhl, U_a_K, +/* C */ ret_Z, pop_TT, jp_Z_WORD, jp_WORD, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, ret, jp_Z_WORD, cb_prefix, call_Z_WORD, call_WORD, U_a_BYTE, rst_N, +/* D */ ret_Z, pop_TT, jp_Z_WORD, out_vBYTE_a, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, exx, jp_Z_WORD, in_a_vBYTE, call_Z_WORD, dd_prefix, U_a_BYTE, rst_N, +/* E */ ret_Z, pop_TT, jp_Z_WORD, ex_vsp_hl, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, jp_hl, jp_Z_WORD, ex_de_hl, call_Z_WORD, ed_prefix, U_a_BYTE, rst_N, +/* F */ ret_Z, pop_TT, jp_Z_WORD, di, call_Z_WORD, push_TT, U_a_BYTE, rst_N, ret_Z, ld_sp_hl, jp_Z_WORD, ei, call_Z_WORD, fd_prefix, U_a_BYTE, rst_N}; + +static Insn const cb_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 1 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 2 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 3 */ G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, G_K, G_K, G_K, G_K, G_K, G_K, G_vhl, G_K, +/* 4 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 5 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 6 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 7 */ bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_K, bit_N_vhl, bit_N_K, +/* 8 */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* 9 */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* A */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* B */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* C */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* D */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* E */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, +/* F */ M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_K, M_N_vhl, M_N_K}; + +static Insn const ed_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 1 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 2 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 3 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 4 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_0, ld_i_a, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti, im_0, ld_r_a, +/* 5 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_1, ld_a_i, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_2, ld_a_r, +/* 6 */ in_J_vc, out_vc_J, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_0, rrd, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_0, rld, +/* 7 */ in_vc, out_vc_0, sbc_hl_SS, ld_vWORD_SS, neg, retn, im_1, ed_illegal, in_J_vc, out_vc_J, adc_hl_SS, ld_SS_vWORD, neg, reti_retn, im_2, ed_illegal, +/* 8 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* 9 */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* A */ ldi, cpi, ini, outi, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ldd, cpd, ind, outd, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* B */ ldir, cpir, inir, otir, ed_illegal, ed_illegal, ed_illegal, ed_illegal, lddr, cpdr, indr, otdr, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* C */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* D */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* E */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, +/* F */ ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal, ed_illegal}; + +static Insn const xy_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ nop_nop, xy_illegal, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 1 */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 2 */ xy_illegal, ld_XY_WORD, ld_vWORD_XY, inc_XY, V_O, V_O, ld_O_BYTE, xy_illegal, xy_illegal, add_XY_WW, ld_XY_vWORD, dec_XY, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 3 */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, V_vXYpOFFSET, V_vXYpOFFSET, ld_vXYpOFFSET_BYTE, xy_illegal, xy_illegal, add_XY_WW, xy_illegal, xy_illegal, V_O, V_O, ld_O_BYTE, xy_illegal, +/* 4 */ nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, +/* 5 */ ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, +/* 6 */ ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_O_P, ld_J_vXYpOFFSET, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, nop_nop, ld_J_vXYpOFFSET, ld_O_P, +/* 7 */ ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, ld_vXYpOFFSET_K, xy_illegal, ld_vXYpOFFSET_K, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_O_P, ld_J_vXYpOFFSET, nop_nop, +/* 8 */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* 9 */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* A */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* B */ U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_P, U_a_vXYpOFFSET, U_a_P, +/* C */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_cb_prefix, xy_illegal, xy_illegal, xy_illegal, xy_illegal, +/* D */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_xy, xy_illegal, xy_illegal, +/* E */ xy_illegal, pop_XY, xy_illegal, ex_vsp_XY, xy_illegal, push_XY, xy_illegal, xy_illegal, xy_illegal, jp_XY, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, +/* F */ xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, xy_illegal, ld_sp_XY, xy_illegal, xy_illegal, xy_illegal, xy_xy, xy_illegal, xy_illegal}; + +static Insn const xy_cb_insn_table[256] = { +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +/* 0 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 1 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 2 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 3 */ G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET_K, G_vXYpOFFSET, G_vXYpOFFSET_K, +/* 4 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 5 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 6 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 7 */ bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, bit_N_vXYpOFFSET, +/* 8 */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* 9 */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* A */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* B */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* C */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* D */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* E */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, +/* F */ M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET_K, M_N_vXYpOFFSET, M_N_vXYpOFFSET_K}; + + +/* MARK: - Instructions: Prefix Handling */ + +INSN(cb_prefix) + { + R++; + return cb_insn_table[DATA[1] = FETCH_OPCODE((PC += 2) - 1)](self); + } + + +INSN(ed_prefix) + { + R++; + return ed_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + } + + +#define XY_PREFIX(index_register) \ + zuint8 cycles; \ + \ + if ((self->cycles += 4) >= self->cycle_limit) \ + { \ + RESUME = Z80_RESUME_XY; \ + return 0; \ + } \ + \ + R++; \ + XY = index_register; \ + cycles = xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); \ + index_register = XY; \ + return cycles; + + +INSN(dd_prefix) {XY_PREFIX(IX)} +INSN(fd_prefix) {XY_PREFIX(IY)} + + +/*-----------------------------------------------------------------------. +| Instructions with the two-byte prefix DDCBh or FDCBh increment R by 2, | +| as only the prefix is fetched by opcode fetch operations (M1 cycles). | +| The remaining two bytes are fetched by normal memory read operations. | +'=======================================================================*/ + +INSN(xy_cb_prefix) + { + FETCH_XY_EA((PC += 4) - 2); + return xy_cb_insn_table[DATA[3] = FETCH(PC - 1)](self); + } + + +/*-----------------------------------------------------------------------------. +| In a sequence of DDh and/or FDh prefixes, it is the last one that counts, as | +| each prefix overrides the previous one. No matter how long the sequence is, | +| interrupts can only be responded to after executing the final instruction | +| once all the prefixes have been fetched. Each prefix takes 4 T-states. | +'=============================================================================*/ + +INSN(xy_xy) + { + zuint8 cycles; + zuint8 first_prefix = DATA[0]; + + do { + PC++; + DATA[0] = DATA[1]; + + if ((self->cycles += 4) >= self->cycle_limit) + { + RESUME = Z80_RESUME_XY; + return 0; + } + + R++; + } + while (IS_XY_PREFIX(DATA[1] = FETCH_OPCODE(PC + 1))); + + if (DATA[0] == first_prefix) return xy_insn_table[DATA[1]](self); + + if (first_prefix == 0xFD) + { + XY = IX; + cycles = xy_insn_table[DATA[1]](self); + IX = XY; + XY = IY; + } + + else { + XY = IY; + cycles = xy_insn_table[DATA[1]](self); + IY = XY; + XY = IX; + } + + return cycles; + } + + +/* MARK: - Instructions: Illegal */ + +/*----------------------------------------------------------------. +| The CPU ignores illegal opcodes prefixed with EDh. In practice, | +| they are all equivalent to two `nop` instructions (8 T-states). | +'================================================================*/ + +INSN(ed_illegal) + { + if (self->illegal != Z_NULL) + { + DATA[2] = 0; + return self->illegal(self, DATA[1]); + } + + Q_0 + PC += 2; + return 8; + } + + +/*-----------------------------------------------------------------------. +| Illegal opcodes with the prefix DDh or FDh cause the CPU to ignore the | +| prefix, i.e., the byte immediately following the prefix is interpreted | +| as the first byte of a new instruction. The prefix takes 4 T-states. | +'=======================================================================*/ + +INSN(xy_illegal) + { + PC++; + return insn_table[DATA[0] = DATA[1]](self); + } + + +/* MARK: - Instructions: Hooking */ + +INSN(hook) + { + if (self->hook == Z_NULL) + { + Q_0 + PC++; + return 4; + } + + return ((DATA[0] = self->hook(CONTEXT, PC)) != Z80_HOOK) + ? insn_table[DATA[0]](self) : 0; + } + + +/* MARK: - Interrupt Mode 0: PC Decrements for Unprefixed Instructions */ + +#ifdef Z80_WITH_FULL_IM0 + static zuint8 const im0_pc_decrement_table[256] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 1 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 2 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 3 */ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + /* 4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 5 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 6 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 7 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* B */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* C */ 1, 0, 3, 3, 3, 0, 0, 1, 1, 1, 3, 0, 3, 3, 0, 1, + /* D */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 0, 3, 0, 3, 0, 0, 1, + /* E */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 1, 3, 0, 3, 0, 0, 1, + /* F */ 1, 0, 3, 0, 3, 0, 0, 1, 1, 0, 3, 0, 3, 0, 0, 1}; +#endif + + +/* MARK: - Interrupt Mode 0: Callback Trampolines */ + +#ifdef Z80_WITH_FULL_IM0 + static zuint8 im0_fetch(IM0 const *self, zuint16 address) + { + Z_UNUSED(address) + return self->z80->int_fetch(CONTEXT, self->pc); + } + + + static zuint8 im0_read(IM0 const *self, zuint16 address) + {return READ(address);} + + + static void im0_write(IM0 const *self, zuint16 address, zuint8 value) + {WRITE(address, value);} + + + static zuint8 im0_in(IM0 const *self, zuint16 port) + {return IN(port);} + + + static void im0_out(IM0 const *self, zuint16 port, zuint8 value) + {OUT(port, value);} + + + static void im0_ld_i_a(IM0 const *self) {NOTIFY(ld_i_a);} + static void im0_ld_r_a(IM0 const *self) {NOTIFY(ld_r_a);} + + +# ifdef Z80_WITH_IM0_RETX_NOTIFICATIONS + #define IM0_NOTIFY_RETX(callback) \ + if ( self->callback != Z_NULL && \ + (self->z80->options & \ + Z80_OPTION_IM0_RETX_NOTIFICATIONS) \ + ) \ + { \ + self->z80->data.uint8_array[2] |= 2; \ + self->callback(CONTEXT); \ + } + + + static void im0_reti(IM0 const *self) {IM0_NOTIFY_RETX(reti)} + static void im0_retn(IM0 const *self) {IM0_NOTIFY_RETX(retn)} +# endif +#endif + + +/* MARK: - Public Functions */ + +/*----------------------------------------------------------------------. +| On POWER-ON, the CPU zeroes PC, I and R, sets SP, IX, IY, AF, BC, DE, | +| HL, AF', BC', DE' and HL' to FFFFh [1,2], resets the interrupt enable | +| flip-flops (IFF1 and IFF2) and selects interrupt mode 0 [3]. On Zilog | +| NMOS models, F is sometimes set to FDh (NF reset) [1]. | +| | +| There is no information about the initial state of MEMPTR and Q, so | +| they are assumed to be 0. | +| | +| References: | +| 1. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | +| 2. https://worldofspectrum.org/forums/discussion/34574 | +| 3. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" | +| v0.91, p. 20. | +'======================================================================*/ + +Z80_API void z80_power(Z80 *self, zboolean state) + { + MEMPTR = PC = R = I = IFF1 = IFF2 = IM = Q = + DATA[0] = HALT_LINE = INT_LINE = RESUME = REQUEST = 0; + + SP = IX = IY = AF = BC = DE = HL = AF_ = BC_ = DE_ = HL_ = + state ? Z_UINT16(0xFFFF) : 0; + } + + +/*-------------------------------------------------------------------------. +| The normal RESET zeroes PC, I, and R [1,2,3,4,5,6], resets the interrupt | +| enable flip-flops (IFF1 and IFF2) [1,2,3,4,5] and selects interrupt mode | +| 0 [1,2,3,4,7]. | +| | +| References: | +| 1. Zilog (2016-09). "Z80 CPU User Manual" rev. 11, p. 6. | +| 2. SGS-Thomson (1990-01). "Z80 Microprocessor Family" 1st ed., p. 33. | +| 3. Brewer, Tony (2014-12). "Z80 Special Reset". | +| * http://primrosebank.net/computers/z80/z80_special_reset.htm | +| 4. Flammenkamp, Achim. "Interrupt Behaviour of the Z80 CPU". | +| * http://z80.info/interrup.htm | +| 5. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | +| 6. https://worldofspectrum.org/forums/discussion/34574 | +| 7. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", p. 8. | +'=========================================================================*/ + +Z80_API void z80_instant_reset(Z80 *self) + { + if (HALT_LINE) {EXIT_HALT;} + + PC = R = I = IFF1 = IFF2 = IM = + DATA[0] = HALT_LINE = RESUME = REQUEST = 0; + } + + +#ifdef Z80_WITH_SPECIAL_RESET + Z80_API void z80_special_reset(Z80 *self) + {REQUEST |= Z80_REQUEST_SPECIAL_RESET;} +#endif + + +Z80_API void z80_int(Z80 *self, zboolean state) + { + if (!(INT_LINE = state)) REQUEST &= ~(zuint8)Z80_REQUEST_INT; + else if (IFF1) REQUEST |= Z80_REQUEST_INT; + } + + +Z80_API void z80_nmi(Z80 *self) + {REQUEST |= Z80_REQUEST_NMI;} + + +#ifdef Z80_WITH_EXECUTE + Z80_API zusize z80_execute(Z80 *self, zusize cycles) + { + ZInt16 *xy; + + R7 = R; + self->cycles = 0; + self->cycle_limit = cycles; + + if (RESUME && cycles) switch (RESUME) + { + case Z80_RESUME_HALT: + (void)halt(self); + break; + + case Z80_RESUME_XY: + RESUME = 0; + R++; + XY = (xy = &self->ix_iy[(DATA[0] >> 5) & 1])->uint16_value; + self->cycles += xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + xy->uint16_value = XY; + break; + } + + while (self->cycles < self->cycle_limit) + { + R++; + self->cycles += insn_table[DATA[0] = FETCH_OPCODE(PC)](self); + } + + R = R_ALL; /* Restore R7 bit */ + return self->cycles; + } +#endif + + +Z80_API zusize z80_run(Z80 *self, zusize cycles) + { + ZInt16 *xy; + zuint8 ird; + + /*---------------------------------------------------------------------. + | The CPU increments R during each M1 cycle without altering the most | + | significant bit, commonly known as R7. This behavior is not emulated | + | in every increment for obvious speed reasons. Instead, a copy of R | + | is used to preserve R7, which is restored before returning from this | + | function. The emulation of `ld {a,r|r,a}` takes this into account. | + '=====================================================================*/ + R7 = R; + + self->cycles = 0; + self->cycle_limit = cycles; + + if (RESUME && cycles) switch (RESUME) + { + /*------------------------------------------------------------. + | The CPU is halted. To avoid affecting the speed of the main | + | execution loop, this state is executed by a dedicated loop | + | in the function that emulates the `halt` instruction. | + '============================================================*/ + case Z80_RESUME_HALT: + if (REQUEST) + { + RESUME = 0; + +# ifdef Z80_WITH_SPECIAL_RESET + if ((REQUEST & Z80_REQUEST_SPECIAL_RESET) && HALT_LINE) + { + zuint8 opcode; + + HALT_LINE = 0; + + if (self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_EXIT_EARLY); + + if (IS_XY_PREFIX(DATA[0] = opcode = DATA[2])) + self->cycles += insn_table[FETCH_OPCODE(PC)](self); + + else if (opcode != 0x76) + { + PC--; + self->cycles += insn_table[opcode](self) - 4; + } + } +# endif + } + + else (void)halt(self); + break; + + /*--------------------------------------------------------------. + | The CPU is in normal operation state; the emulator ran out of | + | clock cycles by fetching a prefix DDh or FDh. | + '==============================================================*/ + case Z80_RESUME_XY: + RESUME = 0; + R++; + XY = (xy = &self->ix_iy[(DATA[0] >> 5) & 1])->uint16_value; + self->cycles += xy_insn_table[DATA[1] = FETCH_OPCODE(PC + 1)](self); + xy->uint16_value = XY; + break; + + /*----------------------------------------------------------------. + | The CPU is responding to an INT in mode 0; the emulator ran out | + | of clock cycles by fetching a prefix DDh or FDh. | + '================================================================*/ +# ifdef Z80_WITH_FULL_IM0 + case Z80_RESUME_IM0_XY: + ird = DATA[0]; + goto im0_begin; +# endif + } + + while (self->cycles < self->cycle_limit) /* main execution loop */ + { + if (REQUEST) + { + /*-------------------------------------------------------------------------. + | After detecting a special RESET signal, the CPU completes the ongoing | + | instruction or interrupt response and then zeroes PC during the falling | + | edge of the next M1T1. The special RESET can be used in conjunction with | + | an interrupt, in which case PC is zeroed during the subsequent interrupt | + | acknowledge M-cycle. Otherwise, if no interrupt has been accepted at the | + | TLAST of the instruction or interrupt response in which the special | + | RESET has been detected, the CPU produces an internal NOP of 4 T-states | + | to allow for the fetch-execute overlap to take place, during which it | + | fetches the next opcode and zeroes PC. | + | | + | References: | + | * Brewer, Tony (2014-12). "Z80 Special Reset". | + | * http://primrosebank.net/computers/z80/z80_special_reset.htm | + | * US Patent 4486827. | + | * Checked with "Visual Z80 Remix". | + '=========================================================================*/ +# ifdef Z80_WITH_SPECIAL_RESET + zuint8 special_reset = REQUEST & Z80_REQUEST_SPECIAL_RESET; +# endif + + /*-------------------------------------------------------------------------. + | NMI Response: Execute `rst 66h` | T-states: 11:533 | + |--------------------------------------------------------------------------| + | The non-maskable interrupt takes priority over the maskable interrupt | + | and cannot be disabled under software control. Its usual function is to | + | provide immediate response to important signals. The CPU responds to an | + | NMI by pushing PC onto the stack and jumping to the ISR located at | + | address 0066h. The interrupt enable flip-flop #1 (IFF1) is reset to | + | prevent any maskable interrupt from being accepted during the execution | + | of this routine, which is usually exited by using a `reti` or `retn` | + | instruction to restore the original state of IFF1 [1]. | + | | + | Some technical documents from Zilog include an erroneous timing diagram | + | showing an NMI acknowledge cycle of 4 T-states. However, documents from | + | other manufacturers and third parties specify that this M-cycle has 5 | + | T-states, as has been confirmed by low-level tests [2] and electronic | + | simulations [3]. | + | | + | In 2022, Manuel Sainz de Baranda y Goñi discovered that the CPU does not | + | accept a second NMI during the NMI response [4,5]. Therefore, it is not | + | possible to chain two NMI responses in a row without executing at least | + | one instruction between them [3,4,5]. | + | | + | References: | + | 1. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", | + | pp. 4-5. | + | 2. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm | + | 3. Checked with "Visual Z80 Remix". | + | 4. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=7086 | + | 5. https://stardot.org.uk/forums/viewtopic.php?t=24662 | + '=========================================================================*/ + if (REQUEST & Z80_REQUEST_REJECT_NMI) + REQUEST = 0; + + else if (REQUEST & Z80_REQUEST_NMI) + { + REQUEST = Z80_REQUEST_REJECT_NMI; + IFF1 = 0; + if (HALT_LINE) {EXIT_HALT;} + R++; + if (self->nmia != Z_NULL) (void)self->nmia(CONTEXT, PC); + DATA[0] = 0; + Q_0 + +# ifdef Z80_WITH_SPECIAL_RESET + PUSH(PC >> special_reset); +# else + PUSH(PC); +# endif + + PC = MEMPTR = 0x66; + self->cycles += 11; + continue; + } + + /*-------------------------------------------------------------------------. + | INT Response | + |--------------------------------------------------------------------------| + | The maskable interrupt is enabled and disabled by using, respectively, | + | the instructions `ei` and `di`, which control the state of the interrupt | + | enable flip-flops (IFF1 and IFF2). The CPU does not accept this kind of | + | interrupt during an `ei` instruction. This allows ISRs to return without | + | the danger of being interrupted immediately after re-enabling interrupts | + | if the /INT line is still active, which could cause a stack overflow. | + | | + | In 2021, Andre Weissflog (aka Floh) discovered that `reti` and `retn` do | + | not accept the maskable interrupt if IFF1 and IFF2 do not have the same | + | state prior to the execution of the instruction, which can only be | + | caused by an earlier NMI response [1]. This behavior was rediscovered in | + | 2022 by Manuel Sainz de Baranda y Goñi [2,3]. | + | | + | References: | + | 1. Weissflog, Andre (2021-12-17). "New Cycle-Stepped Z80 Emulator, A". | + | * https://floooh.github.io/2021/12/17/cycle-stepped-z80.html | + | 2. https://spectrumcomputing.co.uk/forums/viewtopic.php?t=7086 | + | 3. https://stardot.org.uk/forums/viewtopic.php?t=24662 | + '=========================================================================*/ + else if ( +# ifdef Z80_WITH_SPECIAL_RESET + (REQUEST & Z80_REQUEST_INT) && +# endif + /* if the previous instruction is not `ei` */ + DATA[0] != 0xFB && + /* if the previous instruction is not `reti/retn` or IFF1 has not changed */ + (self->data.uint32_value & Z_UINT32_BIG_ENDIAN(Z_UINT32(0xFFC70100))) + != Z_UINT32_BIG_ENDIAN(Z_UINT32(0xED450000)) + ) + { +# ifdef Z80_WITH_FULL_IM0 + Z80Read hook; + IM0 im0; +# endif + + REQUEST = IFF1 = IFF2 = 0; + if (HALT_LINE) {EXIT_HALT;} + + /*-------------------------------------------------------------------. + | Due to a bug, the Zilog Z80 NMOS resets PF when an INT is accepted | + | during the execution of the `ld a,{i|r}` instructions. | + '===================================================================*/ +# ifdef Z80_WITH_ZILOG_NMOS_LD_A_IR_BUG + if ( (OPTIONS & Z80_OPTION_LD_A_IR_BUG) && + (self->data.uint16_array[0] & Z_UINT16_BIG_ENDIAN(Z_UINT16(0xFFF7))) + == Z_UINT16_BIG_ENDIAN(Z_UINT16(0xED57)) + ) + FLAGS = F & ~(zuint8)PF; +# endif + + /*---------------------------------------------------------------------. + | The INT acknowledge cycle (INTA) indicates that the interrupting I/O | + | device can write to the data bus. 2 wait T-states are automatically | + | added to this M-cycle, allowing sufficient time to identify which | + | device must insert the interrupt response data (IRD). The first and | + | possibly sole byte of the IRD is read from the data bus during this | + | special M1 cycle. | + | | + | The value FFh is assumed when the `Z80::inta` callback is not used. | + | This is the most convenient default IRD, since an `rst 38h` will be | + | executed if the interrupt mode is 0. | + '=====================================================================*/ + R++; + ird = (self->inta != Z_NULL) ? self->inta(CONTEXT, PC) : 0xFF; + +# ifdef Z80_WITH_SPECIAL_RESET + PC >>= special_reset; +# endif + + switch (IM) /* response */ + { + /*-------------------------------------------------------------------------. + | Interrupt Mode 0: Execute Instruction | T-states: 2*n + instruction | + |--------------------------------------------------------------------------| + | An instruction supplied via the data bus is executed. Its first byte is | + | read during the INT acknowledge cycle (INTA). If it is an opcode prefix, | + | additional M-cycles of this kind are produced until the final opcode of | + | the instruction is fetched [1]. Each INTA M-cycle takes as many T-states | + | as its normal M1 counterpart (the opcode fetch M-cycle) plus the 2 wait | + | T-states mentioned above [1]. Subsequent bytes of the instruction are | + | fetched by using normal memory read M-cycles [1,2], during which the | + | interrupting I/O device must still supply the data [2]. The PC register, | + | however, remains at its pre-interrupt state, not being incremented as a | + | result of the instruction fetch [1,2]. | + | | + | References: | + | 1. Checked with "Visual Z80 Remix". | + | 2. Zilog (1978-05). "Z80 Family Program Interrupt Structure, The", | + | pp. 6, 8. | + '=========================================================================*/ + case 0: + DATA[0] = ird; + +# ifdef Z80_WITH_FULL_IM0 + im0_begin: + + /*-----------------------------------------------------. + | The `Z80::hook` callback is temporarily disabled, as | + | traps are ignored during the INT response in mode 0. | + '=====================================================*/ + hook = self->hook; + self->hook = Z_NULL; + + /*------------------------------------------------------------------------. + | The `Z80::fetch` callback is temporarily replaced by a trampoline that | + | invokes `Z80::int_fecth`. This trampoline needs to access the callback | + | pointer in addition to the initial, non-incremented value of PC, so the | + | value of `Z80::context` is temporarily replaced by a pointer to an | + | `IM0` object that holds the real context and all this data, which also | + | makes it necessary to replace other callbacks with trampolines so that | + | the real context can be passed to them. | + | | + | The main idea here is that the instruction code will invoke trampolines | + | rather than callbacks, and the one assigned to `Z80::fetch` will ignore | + | the received fetch address, passing instead to `Z80::int_fetch` the | + | initial, non-incremented value of PC. | + '========================================================================*/ + im0.z80 = self; + im0.context = CONTEXT; + im0.fetch = self->fetch; + im0.read = self->read; + im0.write = self->write; + im0.in = self->in; + im0.out = self->out; + im0.pc = PC; + self->context = &im0; + self->fetch = (Z80Read )im0_fetch; + self->read = (Z80Read )im0_read; + self->write = (Z80Write)im0_write; + self->in = (Z80Read )im0_in; + self->out = (Z80Write)im0_out; + + im0_execute: + + /*------------------------------------------------------------------------. + | `call`, `djnz`, `jr` and `rst` increment PC before pushing it onto the | + | stack or using it as the base address. This makes it necessary to | + | decrement PC before executing any of these instructions so that the | + | final address is correct. `jmp` and `ret` are handled here too because | + | in their case this pre-decrement has no effect and PC must also not be | + | corrected after executing the instruction. These groups of instructions | + | are identified by using a table of decrements. Note that `jmp (XY)` and | + | `reti/retn` are prefixed and will be handled later. | + '========================================================================*/ + if (im0_pc_decrement_table[ird]) + { + PC -= im0_pc_decrement_table[ird]; + self->cycles += 2 + insn_table[ird](self); + } + + /* halt */ + else if (ird == 0x76) HALT_LINE = 1; + + /*---------------------------------------------------------------. + | Instructions with the CBh prefix are called directly from here | + | after fetching the opcode in the 2nd INTA. This bypasses the | + | `cb_prefix` function, so PC is never incremented. | + '===============================================================*/ + else if (ird == 0xCB) + { + R++; + self->cycles += 4 + cb_insn_table[DATA[1] = self->inta(im0.context, im0.pc)](self); + } + + /* Instructions with the EDh prefix */ + else if (ird == 0xED) + { + Insn insn; + + R++; + + if ((insn = ed_insn_table[DATA[1] = ird = self->inta(im0.context, im0.pc)]) != ed_illegal) + { + im0.ld_i_a = self->ld_i_a; + im0.ld_r_a = self->ld_r_a; + im0.reti = self->reti; + im0.retn = self->retn; + self->ld_i_a = (Z80Notify)im0_ld_i_a; + self->ld_r_a = (Z80Notify)im0_ld_r_a; + +# ifdef Z80_WITH_RETX_NOTIFICATIONS_IN_IM0 + self->reti = (Z80Notify)im0_reti; + self->retn = (Z80Notify)im0_retn; +# else + self->reti = Z_NULL; + self->retn = Z_NULL; +# endif + + PC -= ((ird & 0xC7) == 0x43) + ? 4 /* `ld SS,(WORD)` and `ld (WORD),SS` */ + : 2 /* All others */; + + self->cycles += 4 + insn(self); + + self->ld_i_a = im0.ld_i_a; + self->ld_r_a = im0.ld_r_a; + self->reti = im0.reti; + self->retn = im0.retn; + } + + else if (self->illegal == Z_NULL) + self->cycles += 4 + 8; + + else { + DATA[2] = 4; + self->cycles += 4 + self->illegal(self, ird); + } + } + + /* Instructions with the prefix DDh, FDh, DDCBh or FDCBh */ + else if (IS_XY_PREFIX(ird)) + { + Insn insn; + + if (RESUME) RESUME = 0; + + else { + im0_advance_xy: + if ((self->cycles += 6) >= self->cycle_limit) + { + RESUME = Z80_RESUME_IM0_XY; + goto im0_finalize; + } + } + + R++; + + if (IS_XY_PREFIX(ird = self->inta(im0.context, im0.pc))) + { + DATA[0] = ird; + goto im0_advance_xy; + } + + if ((insn = xy_insn_table[ird]) == xy_illegal) + { + DATA[0] = ird; + PC++; + goto im0_execute; + } + + XY = (xy = &self->ix_iy[((DATA[1] = ird) >> 5) & 1])->uint16_value; + self->cycles += 2 + insn(self); + xy->uint16_value = XY; + + /* Restore PC, except for `jp (XY)` */ + if (ird != 0xE9) PC = im0.pc; + } + + else { + self->cycles += 2 + insn_table[ird](self); + PC = im0.pc; + } + + im0_finalize: + self->context = im0.context; + self->fetch = im0.fetch; + self->read = im0.read; + self->write = im0.write; + self->in = im0.in; + self->out = im0.out; + self->hook = hook; + + if (HALT_LINE) + { + if (self->halt != Z_NULL) self->halt(im0.context, 1); + RESUME = Z80_RESUME_HALT; + Q_0 + self->cycles += 6; + (void)halt(self); + } + + continue; + +# else + switch (ird) + { + case 0xC3: /* jp WORD */ + Q_0 + MEMPTR = PC = int_fetch_16(self); + self->cycles += 2 + 10; + continue; + + case 0xCD: /* call WORD */ + Q_0 + MEMPTR = int_fetch_16(self); + PUSH(PC); + PC = MEMPTR; + self->cycles += 2 + 17; + continue; + + default: /* `rst N` is assumed for all other instructions */ + Q_0 + PUSH(PC); + MEMPTR = PC = ird & 56; + self->cycles += 2 + 11; + continue; + } +# endif + + /*----------------------------------------------------------. + | Interrupt Mode 1: Execute `rst 38h` | T-states: 13:733 | + |-----------------------------------------------------------| + | An internal `rst 38h` is executed. The interrupt response | + | data read from the data bus is disregarded. | + '==========================================================*/ + case 1: + DATA[0] = 0; + Q_0 + PUSH(PC); + MEMPTR = PC = 0x38; + self->cycles += 13; + continue; + + /*---------------------------------------------------------------------. + | Interrupt Mode 2: Execute `call (i:BYTE)` | T-states: 19:73333 | + |----------------------------------------------------------------------| + | An indirect call is executed. The pointer to the ISR is loaded from | + | the memory address formed by taking the I register as the most | + | significant byte, and the interrupt response vector (IRD) read from | + | the data bus as the least significant byte. | + | | + | Zilog's official documentation states that the least significant bit | + | of the interrupt response vector "must be a zero", since the address | + | formed "is used to get two adjacent bytes to form a complete 16-bit | + | service routine starting address and the addresses must always start | + | in even locations" [1]. However, Sean Young's experiments confirmed | + | that there is no such limitation [2]; any vector works regardless of | + | whether it is even or odd. | + | | + | References: | + | 1. Zilog (2005-03). "Z80 CPU User Manual" rev. 5, pp. 25-26. | + | 2. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" | + | v0.91, p. 20. | + '=====================================================================*/ + case 2: + DATA[0] = 0; + Q_0 + PUSH(PC); + MEMPTR = PC = READ_16((zuint16)(((zuint16)I << 8) | ird)); + self->cycles += 19; + continue; + } + } + +# ifdef Z80_WITH_SPECIAL_RESET + if (special_reset) + { + REQUEST = 0; + + /*---------------------------------------------------------. + | The /HALT line goes low and then high during TLAST if a | + | special RESET is detected during the `halt` instruction. | + '=========================================================*/ + if (DATA[0] == 0x76 && self->halt != Z_NULL) + self->halt(CONTEXT, Z80_HALT_CANCEL); + + R++; + if (self->nop != Z_NULL) (void)self->nop(CONTEXT, PC); + DATA[0] = 0; + Q_0; + PC = 0; + self->cycles += 4; + continue; + } +# endif + } + + R++; + self->cycles += insn_table[DATA[0] = FETCH_OPCODE(PC)](self); + } + + R = R_ALL; /* Restore R7 bit */ + return self->cycles; + } + + +#ifdef Z80_WITH_WINDOWS_DLL_MAIN + int Z_MICROSOFT_STD_CALL _DllMainCRTStartup(void *hDllHandle, unsigned long dwReason, void *lpReserved) + {return 1;} +#endif + + +/* Z80.c EOF */ diff --git a/projects/Z80/sources/Z80.pas b/projects/Z80/sources/Z80.pas new file mode 100644 index 0000000..129bfff --- /dev/null +++ b/projects/Z80/sources/Z80.pas @@ -0,0 +1,287 @@ +(* ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ______________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator - Pascal Binding | +| Copyright (C) 2022-2023 Zoran Vučenović. | +| | +| Permission to use, copy, modify, and/or distribute this software | +| for any purpose with or without fee is hereby granted. | +| | +| THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL | +| WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED | +| WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL | +| THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR | +| CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | +| LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | +| CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | +| | +'===================================================================*) + +unit Z80; + +{$mode ObjFPC}{$H+} +{$J-} +{$inline on} +{$PackRecords C} + +interface + +uses + SysUtils, + dynlibs; + +const + DefaultZ80LibPath = + {$if defined(mswindows)} + 'Z80.dll'; + {$elseif defined(darwin)} + 'libZ80.dylib'; + {$elseif defined(unix)} + 'libZ80.so'; + {$else} + ''; + {$endif} + + Z80_MAXIMUM_CYCLES = SizeUInt(SizeUInt(SizeUInt.MaxValue) - 30); + Z80_MAXIMUM_CYCLES_PER_STEP = 23; + + Z80_HOOK = $64; + + Z80_SF = 128; + Z80_ZF = 64; + Z80_YF = 32; + Z80_HF = 16; + Z80_XF = 8; + Z80_PF = 4; + Z80_NF = 2; + Z80_CF = 1; + +type + PZ80 = ^TZ80; + + TZ80RegisterPair = packed record + case Integer of + 0: (word: UInt16); + {$ifdef endian_little} + 1: (bytes: packed record low: UInt8; high: UInt8 end); + {$else} + 1: (bytes: packed record high: UInt8; low: UInt8 end); + {$endif} + end; + + Z80Read = function(context: Pointer; address: UInt16): UInt8; cdecl; + Z80Write = procedure(context: Pointer; address: UInt16; value: UInt8); cdecl; + Z80Halt = procedure(context: Pointer; state: UInt8); cdecl; + Z80Notify = procedure(context: Pointer); cdecl; + Z80Illegal = function(cpu: PZ80; opcode: UInt8): UInt8; cdecl; + + TZ80 = record + cycles: SizeUInt; + cycle_limit: SizeUInt; + context: Pointer; + fetch_opcode: Z80Read; + fetch: Z80Read; + read: Z80Read; + write: Z80Write; + input: Z80Read; + output: Z80Write; + halt: Z80Halt; + nop: Z80Read; + nmia: Z80Read; + inta: Z80Read; + int_fetch: Z80Read; + ld_i_a: Z80Notify; + ld_r_a: Z80Notify; + reti: Z80Notify; + retn: Z80Notify; + hook: Z80Read; + illegal: Z80Illegal; + data: array [0..3] of UInt8; + ix_iy: array [0..1] of TZ80RegisterPair; + pc: TZ80RegisterPair; + sp: TZ80RegisterPair; + xy: TZ80RegisterPair; + memptr: TZ80RegisterPair; + af: TZ80RegisterPair; + bc: TZ80RegisterPair; + de: TZ80RegisterPair; + hl: TZ80RegisterPair; + af_: TZ80RegisterPair; + bc_: TZ80RegisterPair; + de_: TZ80RegisterPair; + hl_: TZ80RegisterPair; + r: UInt8; + i: UInt8; + r7: UInt8; + im: UInt8; + request: UInt8; + resume: UInt8; + iff1: UInt8; + iff2: UInt8; + q: UInt8; + options: UInt8; + int_line: UInt8; + halt_line: UInt8; + end; + +const + Z80_OPTION_OUT_VC_255 = 1; + Z80_OPTION_LD_A_IR_BUG = 2; + Z80_OPTION_HALT_SKIP = 4; + Z80_OPTION_XQ = 8; + Z80_OPTION_IM0_RETX_NOTIFICATIONS = 16; + Z80_OPTION_YQ = 32; + + Z80_MODEL_ZILOG_NMOS = (Z80_OPTION_LD_A_IR_BUG or Z80_OPTION_XQ or Z80_OPTION_YQ); + Z80_MODEL_ZILOG_CMOS = (Z80_OPTION_OUT_VC_255 or Z80_OPTION_XQ or Z80_OPTION_YQ); + Z80_MODEL_NEC_NMOS = Z80_OPTION_LD_A_IR_BUG; + Z80_MODEL_ST_CMOS = (Z80_OPTION_OUT_VC_255 or Z80_OPTION_LD_A_IR_BUG or Z80_OPTION_YQ); + + Z80_REQUEST_REJECT_NMI = 2; + Z80_REQUEST_NMI = 4; + Z80_REQUEST_INT = 8; + Z80_REQUEST_SPECIAL_RESET = 16; + + Z80_RESUME_HALT = 1; + Z80_RESUME_XY = 2; + Z80_RESUME_IM0_XY = 3; + + Z80_HALT_EXIT = 0; + Z80_HALT_ENTER = 1; + Z80_HALT_EXIT_EARLY = 2; + Z80_HALT_CANCEL = 3; + +var + z80_power: procedure(self: PZ80; state: ByteBool); cdecl; + z80_instant_reset: procedure(self: PZ80); cdecl; + z80_special_reset: procedure(self: PZ80); cdecl; + z80_int: procedure(self: PZ80; state: ByteBool); cdecl; + z80_nmi: procedure(self: PZ80); cdecl; + z80_execute: function(self: PZ80; cycles: SizeUInt): SizeUInt; cdecl; + z80_run: function(self: PZ80; cycles: SizeUInt): SizeUInt; cdecl; + +function z80_r(const self: PZ80): UInt8; inline; +function z80_refresh_address(const self: PZ80): UInt16; inline; +function z80_in_cycle(const self: PZ80): UInt8; inline; +function z80_out_cycle(const self: PZ80): UInt8; inline; + +function IsLibraryLoaded: Boolean; +function LoadLibrary(const LibPath: String = ''): Boolean; +function UnloadLibrary: Boolean; + + +implementation + +procedure z80_break(self: PZ80); +begin + self^.cycle_limit := 0; +end; + + +function z80_r(const self: PZ80): UInt8; +begin + Result := (self^.r and 127) or (Self^.r7 and 128); +end; + + +function z80_refresh_address(const self: PZ80): UInt16; +begin + Result := UInt16(self^.i) shl 8; + Result := Result or ((self^.r - 1) and 127) or (self^.r7 and 128); +end; + + +function z80_in_cycle(const self: PZ80): UInt8; +begin + if self^.data[0] = $DB then begin + Result := 7; + end else begin + Result := 8 + (self^.data[1] shr 7); + end; +end; + + +function z80_out_cycle(const self: PZ80): UInt8; +begin + if self^.data[0] = $D3 then begin + Result := 7; + end else begin + Result := 8 + ((self^.data[1] shr 7) shl 2); + end; +end; + + +var + LibHandle: TLibHandle; + + +function IsLibraryLoaded: Boolean; +begin + Result := LibHandle <> NilHandle; +end; + + +function LoadLibrary(const LibPath: String): Boolean; +var + LibName: String; +begin + if LibHandle = NilHandle then begin + Result := False; + + if LibPath = '' then begin + LibName := DefaultZ80LibPath; + end else begin + LibName := LibPath; + end; + + LibHandle := SafeLoadLibrary(LibName); + if LibHandle = NilHandle then Exit; + + Pointer(z80_power) := GetProcAddress(LibHandle, 'z80_power'); + Pointer(z80_instant_reset) := GetProcAddress(LibHandle, 'z80_instant_reset'); + Pointer(z80_special_reset) := GetProcAddress(LibHandle, 'z80_special_reset'); + Pointer(z80_int) := GetProcAddress(LibHandle, 'z80_int'); + Pointer(z80_nmi) := GetProcAddress(LibHandle, 'z80_nmi'); + Pointer(z80_execute) := GetProcAddress(LibHandle, 'z80_execute'); + Pointer(z80_run) := GetProcAddress(LibHandle, 'z80_run'); + end; + + Result := True; +end; + + +function UnloadLibrary: Boolean; +begin + if IsLibraryLoaded then begin + if not dynlibs.UnloadLibrary(LibHandle) then Exit(False); + LibHandle := NilHandle; + end; + + z80_power := nil; + z80_instant_reset := nil; + z80_special_reset := nil; + z80_int := nil; + z80_nmi := nil; + z80_execute := nil; + z80_run := nil; + + Result := True; +end; + + +procedure Init; +begin + LibHandle := NilHandle; + UnloadLibrary; +end; + + +initialization + Init; + +finalization + UnloadLibrary; + +end. diff --git a/projects/Z80/sources/Z80.rc.in b/projects/Z80/sources/Z80.rc.in new file mode 100644 index 0000000..c7b5af8 --- /dev/null +++ b/projects/Z80/sources/Z80.rc.in @@ -0,0 +1,34 @@ +/* IMPORTANT: This file MUST be saved using the "UTF-8 with BOM" encoding. */ + +1 VERSIONINFO + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEFLAGSMASK 0x3FL +#ifdef NDEBUG + FILEFLAGS 0x0L +#else + FILEFLAGS 0x1L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Manuel Sainz de Baranda y Goñi" + VALUE "FileDescription", "@PROJECT_DESCRIPTION@" + VALUE "FileVersion", "@PROJECT_VERSION@" + VALUE "InternalName", "@PROJECT_NAME@" + VALUE "LegalCopyright", "Copyright © 1999-2024 Manuel Sainz de Baranda y Goñi" + VALUE "OriginalFilename", "@PROJECT_NAME@.dll" + VALUE "ProductName", "@PROJECT_NAME@" + VALUE "ProductVersion", "@PROJECT_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/projects/Z80/sources/test-Z80.c b/projects/Z80/sources/test-Z80.c new file mode 100644 index 0000000..2b10294 --- /dev/null +++ b/projects/Z80/sources/test-Z80.c @@ -0,0 +1,1012 @@ +/* test-Z80 + ______ ______ ______ + /\___ \/\ __ \\ __ \ + ____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________ +| /\_____\\_____\\_____\ | +| Zilog \/_____//_____//_____/ CPU Emulator - Testing Tool | +| Copyright (C) 2021-2024 Manuel Sainz de Baranda y Goñi. | +| | +| This program is free software: you can redistribute it and/or modify it | +| under the terms of the GNU General Public License as published by the Free | +| Software Foundation, either version 3 of the License, or (at your option) | +| any later version. | +| | +| This program is distributed in the hope that it will be useful, but | +| WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | +| or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | +| for more details. | +| | +| You should have received a copy of the GNU General Public License along | +| with this program. If not, see . | +| | +'=============================================================================*/ + +#ifdef TEST_Z80_WITH_ARCHIVE_EXTRACTION +# include +# include +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + + +/* MARK: - Macros */ + +#ifdef TEST_Z80_WITH_EXECUTE +# define RUN z80_execute +#else +# define RUN z80_run +#endif + +#define OPCODE_NOP 0x00 +#define OPCODE_RET 0xC9 +#define OPCODE_HALT 0x76 +#define OPCODE_CALL_WORD 0xCD +#define OPCODE_JP_WORD 0xC3 + +#define TEST_FORMAT_CPM 0 /* CP/M program in COM format. */ +#define TEST_FORMAT_HARSTON 1 /* Z80 Instruction Set Exerciser for Spectrum. */ +#define TEST_FORMAT_RAK 2 /* Patrik Rak's Zilog Z80 CPU Test Suite. */ +#define TEST_FORMAT_WOODMASS 3 /* Mark Woodmass' Z80 Test Suite. */ + + +/* MARK: - Types */ + +typedef struct { + /* Name of the archive if the file is compressed; `Z_NULL` otherwise. */ + char const* archive_name; + + /* Name of the file, or path to the file inside the archive if the file + is compressed. */ + char const* file_path; + + /* Total number of clock cycles executed when the test passes. */ + zusize cycles[1 + (Z_USIZE_WIDTH < 64)]; + + /* FNV-1 hash of the entire text output when the test passes + (i.e., of all bytes sent by the program to the print routine). */ + zuint32 hash; + + /* Memory address to jump to in order to start executing the program. */ + zuint16 start_address; + + /* Value of the PC register once the program completes. */ + zuint16 exit_address; + + /* Size of the file. */ + zuint16 file_size; + + /* Size of the executable code. */ + zuint16 code_size; + + /* Offset of the executable code inside the file. */ + zuint8 code_offset; + + /* Format of the program. */ + zuint8 format; + + /* Number of lines printed when the test passes. */ + zuint8 lines; + + /* Rightmost position reached by the cursor when the test passes. */ + zuint8 columns; +} Test; + + +/* MARK: - Global Variables */ + +#if Z_USIZE_WIDTH < 64 +# define CYCLES(high, low) {Z_USIZE(0x##low), Z_USIZE(0x##high)} +#else +# define CYCLES(high, low) {Z_USIZE(0x##high##low)} +#endif + +static Test const tests[22] = { + {"Yaze v1.10 (1998-01-28)(Cringle, Frank D.)(Sources)[!].tar.gz", "yaze-1.10/test/zexdoc.com", CYCLES(A, E19F287A) /* 46,734,977,146 */, Z_UINT32(0xEDE3CB62), Z_UINT16(0x0100), Z_UINT16( 0), 8704, 8704, 0, TEST_FORMAT_CPM, 68, 34}, + {Z_NULL, "Z80 Documented Instruction Set Exerciser for Spectrum (2018)(Harston, Jonathan Graham)[!].tap", CYCLES(A, E4E22836) /* 46,789,699,638 */, Z_UINT32(0x9F8B1839), Z_UINT16(0x8000), Z_UINT16(0x803D), 8716, 8624, 91, TEST_FORMAT_HARSTON, 69, 32}, + {"Yaze v1.10 (1998-01-28)(Cringle, Frank D.)(Sources)[!].tar.gz", "yaze-1.10/test/zexall.com", CYCLES(A, E19F287A) /* 46,734,977,146 */, Z_UINT32(0xEDE3CB62), Z_UINT16(0x0100), Z_UINT16( 0), 8704, 8704, 0, TEST_FORMAT_CPM, 68, 34}, + {Z_NULL, "Z80 Full Instruction Set Exerciser for Spectrum (2009)(Bobrowski, Jan)[!].tap", CYCLES(A, E4E1B837) /* 46,789,670,967 */, Z_UINT32(0xD4910BEE), Z_UINT16(0x8000), Z_UINT16(0x803D), 8656, 8547, 108, TEST_FORMAT_HARSTON, 69, 31}, + {Z_NULL, "Z80 Full Instruction Set Exerciser for Spectrum (2011)(Bobrowski, Jan)(Narrowed to BIT Instructions)[!].tap", CYCLES(0, 4F67AEDF) /* 1,332,195,039 */, Z_UINT32(0x680D4830), Z_UINT16(0x8000), Z_UINT16(0x803D), 8656, 8547, 108, TEST_FORMAT_HARSTON, 4, 31}, + {Z_NULL, "Z80 Full Instruction Set Exerciser for Spectrum (2017-0x)(Harston, Jonathan Graham)[!].tap", CYCLES(A, E4E20746) /* 46,789,691,206 */, Z_UINT32(0x9F50D128), Z_UINT16(0x8000), Z_UINT16(0x803D), 8704, 8612, 91, TEST_FORMAT_HARSTON, 69, 32}, + {Z_NULL, "Z80 Full Instruction Set Exerciser for Spectrum (2018)(Harston, Jonathan Graham)[!].tap", CYCLES(A, E4E22836) /* 46,789,699,638 */, Z_UINT32(0x9F50D128), Z_UINT16(0x8000), Z_UINT16(0x803D), 8716, 8624, 91, TEST_FORMAT_HARSTON, 69, 32}, + {"Z80 Instruction Set Exerciser for Spectrum 2 v0.1 (2012-11-27)(Rak, Patrik)[!].zip", "zexall2-0.1/zexall2.tap", CYCLES(C, 18A43876) /* 51,953,023,094 */, Z_UINT32(0x05C746F7), Z_UINT16(0x8000), Z_UINT16(0x8040), 9316, 9228, 87, TEST_FORMAT_HARSTON, 76, 31}, + {Z_NULL, "Z80 Test Suite (2008)(Woodmass, Mark)[!].tap", CYCLES(0, 9C3040EF) /* 2,620,408,047 */, Z_UINT32(0xF787CA8E), Z_UINT16(0x8057), Z_UINT16(0x80E6), 5573, 5452, 120, TEST_FORMAT_WOODMASS, 50, 32}, + {Z_NULL, "Z80 Test Suite (2008)(Woodmass, Mark)[!].tap", CYCLES(0, 0308BF63) /* 50,904,931 */, Z_UINT32(0xF5AE5140), Z_UINT16(0x8049), Z_UINT16(0x80E6), 5573, 5452, 120, TEST_FORMAT_WOODMASS, 61, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80full.tap", CYCLES(0, 4303ABF1) /* 1,124,314,097 */, Z_UINT32(0xB8707D12), Z_UINT16(0x8000), Z_UINT16(0x7003), 13758, 13666, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80doc.tap", CYCLES(0, 436E8265) /* 1,131,315,813 */, Z_UINT32(0x9E9DD1F5), Z_UINT16(0x8000), Z_UINT16(0x7003), 13758, 13666, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80flags.tap", CYCLES(0, 20ED11DC) /* 552,407,516 */, Z_UINT32(0x27CB27A2), Z_UINT16(0x8000), Z_UINT16(0x7003), 13758, 13666, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80docflags.tap", CYCLES(0, 2110B9B1) /* 554,744,241 */, Z_UINT32(0x3966C46C), Z_UINT16(0x8000), Z_UINT16(0x7003), 13758, 13666, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80ccf.tap", CYCLES(0, 23AB74CA) /* 598,439,114 */, Z_UINT32(0xB34ED107), Z_UINT16(0x8000), Z_UINT16(0x7003), 14219, 14127, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip", "z80test-1.0/z80memptr.tap", CYCLES(0, 215CF3BD) /* 559,739,837 */, Z_UINT32(0x840ACD96), Z_UINT16(0x8000), Z_UINT16(0x7003), 13758, 13666, 91, TEST_FORMAT_RAK, 156, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80full.tap", CYCLES(0, 4382DC6A) /* 1,132,649,578 */, Z_UINT32(0x4C578BC6), Z_UINT16(0x8000), Z_UINT16(0x7003), 14390, 14298, 91, TEST_FORMAT_RAK, 164, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80doc.tap", CYCLES(0, 43EE72CE) /* 1,139,700,430 */, Z_UINT32(0x02114A09), Z_UINT16(0x8000), Z_UINT16(0x7003), 14390, 14298, 91, TEST_FORMAT_RAK, 164, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80flags.tap", CYCLES(0, 212F17D5) /* 556,734,421 */, Z_UINT32(0x91826856), Z_UINT16(0x8000), Z_UINT16(0x7003), 14390, 14298, 91, TEST_FORMAT_RAK, 164, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80docflags.tap", CYCLES(0, 2152FFDA) /* 559,087,578 */, Z_UINT32(0x408190F0), Z_UINT16(0x8000), Z_UINT16(0x7003), 14390, 14298, 91, TEST_FORMAT_RAK, 164, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80ccf.tap", CYCLES(0, 23F34E43) /* 603,147,843 */, Z_UINT32(0x27FF6693), Z_UINT16(0x8000), Z_UINT16(0x7003), 14875, 14783, 91, TEST_FORMAT_RAK, 164, 32}, + {"Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip", "z80test-1.2a/z80memptr.tap", CYCLES(0, 219FC276) /* 564,118,134 */, Z_UINT32(0xDB7B18AA), Z_UINT16(0x8000), Z_UINT16(0x7003), 14390, 14298, 91, TEST_FORMAT_RAK, 164, 32}}; + +#undef CYCLES + +static struct {char const *key; zuint8 options;} const cpu_models[4] = { + {"zilog-nmos", Z80_MODEL_ZILOG_NMOS}, + {"zilog-cmos", Z80_MODEL_ZILOG_CMOS}, + {"nec-nmos", Z80_MODEL_NEC_NMOS }, + {"st-cmos", Z80_MODEL_ST_CMOS }}; + +static char const new_line[2] = "\n"; + +/*---------------------------------------------------------------------------. +| The search paths specified by using the `-p` option are collected into the | +| `search_paths` array of size `search_path_count`. `path_buffer` is used to | +| compose a complete file path consisting of "/". | +'===========================================================================*/ + +static char* path_buffer = Z_NULL; +static char** search_paths = Z_NULL; +static zuint search_path_count = 0; + +/*-----------------------------------------------------------------------------. +| `verbosity` contains the verbosity level specified by using the `-v` option; | +| `show_test_output` indicates whether to print the text output of the tests. | +'=============================================================================*/ + +static zuint8 verbosity = 4; +static zboolean show_test_output; + +/*-----------------------------------------------------------------------------. +| [0]: The byte read from even I/O ports (specified by using the `-0` option). | +| [1]: The byte read from odd I/O ports (specified by using the `-1` option). | +| The default values are those of a Sinclair ZX Spectrum 48K with no devices | +| connected. | +'=============================================================================*/ + +static zuint8 in_values[2] = {191, 255}; + +/*---------------------------------------------------. +| Instance of the Z80 emulator and 64 KiB of memory. | +'===================================================*/ + +static Z80 cpu; +static zuint8 memory[Z_USIZE(65536)]; + +/*-----------------------------------------------------------------------------. +| `completed` indicates whether the test has reached its exit address; `lines` | +| is incremented every time the test prints a new line; `cursor_x` holds the X | +| position of the cursor in the current line; `columns` contains the rightmost | +| position reached by the cursor throughout the test; and `hash` keeps a FNV-1 | +| hash of all bytes sent by the test to the print routine. | +'=============================================================================*/ + +static zboolean completed; +static zusize lines, cursor_x, columns; +static zuint32 hash; + +/*-----------------------------------------------------------------------------. +| `zx_spectrum_print_hook_address` contains the address of the hook that | +| intercepts the routine called by the test to print characters. When a | +| character (17h) is printed, the `zx_spectrum_tab` counter is set to 2 to | +| indicate that it is necessary to process the incoming and | +| bytes before continuing to print characters. `zx_spectrum_bad_character` is | +| set to `Z_TRUE` if the test prints any unsupported control characters. | +| | +| For more information about the TAB control sequence of the ZX Spectrum, see: | +| * Sinclair Research (1983). "Sinclair ZX Spectrum BASIC Programming" 2nd | +| ed., pp. 103, 196. | +| * Ardley, Neil (1984). "ZX Spectrum + User Guide" (Dorling Kindersley; | +| Sinclair Research. ISBN 0863180809), pp. 67-68. | +| | +| These three variables are only used for ZX Spectrum tests. | +'=============================================================================*/ + +static zuint16 zx_spectrum_print_hook_address; +static zuint zx_spectrum_tab; +static zboolean zx_spectrum_bad_character; + + +/* MARK: - CPU Callbacks: Common */ + +static zuint8 cpu_read(void *context, zuint16 address) + { + Z_UNUSED(context) + return memory[address]; + } + + +static zuint8 cpu_in(void *context, zuint16 port) + { + Z_UNUSED(context) + return in_values[port & 1]; + } + + +static void cpu_out(void *context, zuint16 port, zuint8 value) + {Z_UNUSED(context) Z_UNUSED(port) Z_UNUSED(value)} + + +static void cpu_halt(void *context, zuint8 state) + { + Z_UNUSED(context) Z_UNUSED(state) + completed = Z_TRUE; + z80_break(&cpu); + } + + +/* MARK: - CPU Callbacks: Auxiliary Functions */ + +static void cr(void) + { + if (show_test_output) putchar('\n'); + if (cursor_x > columns) columns = cursor_x; + cursor_x = 0; + lines++; + } + + +/* MARK: - CPU Callbacks: CP/M */ + +static void cpm_cpu_write(void *context, zuint16 address, zuint8 value) + { + Z_UNUSED(context) + memory[address] = value; + } + + +static zuint8 cpm_cpu_hook(void *context, zuint16 address) + { + zuint8 character; + + Z_UNUSED(context) + if (address != 5) return OPCODE_NOP; + + /* BDOS function 2 (C_WRITE) - Console output */ + if (Z80_C(cpu) == 2) + { + hash = Z_FNV1_32_UPDATE(hash, (character = Z80_E(cpu))); + + switch (character) + { + case 0x0A: /* LF */ cr(); + case 0x0D: /* CR */ break; + + default: + if (show_test_output) putchar(character); + cursor_x++; + } + } + + /* BDOS function 9 (C_WRITESTR) - Output string */ + else if (Z80_C(cpu) == 9) + { + zuint16 i = Z80_DE(cpu); + zuint c = 255; + + while (c--) + { + hash = Z_FNV1_32_UPDATE(hash, (character = memory[i++])); + + switch (character) + { + case 0x24: /* $ */ return OPCODE_RET; + case 0x0A: /* LF */ cr(); + case 0x0D: /* CR */ break; + + default: + if (show_test_output) putchar(character); + cursor_x++; + } + } + + if (show_test_output) puts(" [TRUNCATED]"); + } + + return OPCODE_RET; + } + + +/* MARK: - CPU Callbacks: ZX Spectrum */ + +static void zx_spectrum_cpu_write(void *context, zuint16 address, zuint8 value) + { + Z_UNUSED(context) + if (address > 0x3FFF) memory[address] = value; + } + + +static zuint8 zx_spectrum_cpu_hook(void *context, zuint16 address) + { + zuint8 character; + + Z_UNUSED(context) + if (address != zx_spectrum_print_hook_address) return OPCODE_NOP; + hash = Z_FNV1_32_UPDATE(hash, (character = Z80_A(cpu))); + + if (!zx_spectrum_tab) switch (character) + { + case 0x0D: /* CR */ + cr(); + break; + + case 0x17: /* TAB */ + zx_spectrum_tab = 2; + break; + + case 0x7F: /* © */ + if (show_test_output) printf("©"); + cursor_x++; + break; + + default: + if (character >= 32 && character < 127) + { + if (show_test_output) putchar(character); + cursor_x++; + } + + else zx_spectrum_bad_character = Z_TRUE; + } + + else if (--zx_spectrum_tab) + { + zuint c = character & (32 - 1), x = cursor_x & (32 - 1); + + if (c < x) cr(); + else cursor_x += (c -= x); + if (show_test_output) while (c--) putchar(' '); + } + + return OPCODE_RET; + } + + +/* Only needed for Woody's Z80 Test Suite. */ +static zuint8 zx_spectrum_cpu_fetch_opcode(void *context, zuint16 address) + { + Z_UNUSED(context) + + return address == 0x0D6B /* THE 'CLS' COMMAND ROUTINE */ || + address == 0x1601 /* THE 'CHAN_OPEN' SUBROUTINE */ + ? OPCODE_RET : memory[address]; + } + + +/* MARK: - Main Section */ + +static char const *compose_path(char const *base_path, char const *file_path) + { + zusize base_path_size; + + if (base_path == Z_NULL) return file_path; + base_path_size = strlen(base_path); + memcpy(path_buffer, base_path, base_path_size); + path_buffer[base_path_size] = '/'; + strcpy(path_buffer + base_path_size + 1, file_path); + return path_buffer; + } + + +static zboolean load_file( + char const* search_path, + char const* file_path, + zuint32 file_size, + zuint16 offset, + zuint16 size, + void* buffer +) + { + zboolean success = Z_FALSE; + FILE *file = fopen(compose_path(search_path, file_path), "rb"); + + if (file != Z_NULL) + { + if ( !fseek(file, 0, SEEK_END) && + ftell(file) == file_size && + !fseek(file, offset, SEEK_SET) && + fread(buffer, size, 1, file) == 1 + ) + success = Z_TRUE; + + fclose(file); + } + + return success; + } + + +static zboolean load_test(char const *search_path, Test const *test, void *buffer) + { +# ifdef TEST_Z80_WITH_ARCHIVE_EXTRACTION + zboolean success = load_file( + search_path, test->file_path, test->file_size, + test->code_offset, test->code_size, buffer); + + if (!success && test->archive_name != Z_NULL) + { + search_path = compose_path(search_path, test->archive_name); + + /* .tar.gz */ + if (strrchr(test->archive_name, '.')[1] == 'g') + { + gzFile gz = gzopen(search_path, "rb"); + + if (gz != Z_NULL) + { + union {zuint8 data[Z_TAR_BLOCK_SIZE]; Z_TARPOSIXHeader fields;} header; + + while (!gzeof(gz)) + { + char *end; + zulong file_size, block_tail_size; + + if (gzread(gz, header.data, Z_TAR_BLOCK_SIZE) != Z_TAR_BLOCK_SIZE) break; + header.fields.size[Z_ARRAY_SIZE(header.fields.size) - 1] = 0; + file_size = strtoul((char const *)header.fields.size, &end, 8); + if ((zuint8 *)end == header.fields.size || *end) break; + + if (!strcmp(test->file_path, (char const *)header.fields.name)) + { + success = + file_size == test->file_size && + gzseek(gz, test->code_offset, SEEK_CUR) != -1 && + gzread(gz, buffer, test->code_size) == test->code_size; + + break; + } + + if (-1 == gzseek(gz, (block_tail_size = (file_size % Z_TAR_BLOCK_SIZE)) + ? file_size + (Z_TAR_BLOCK_SIZE - block_tail_size) + : file_size, SEEK_CUR) + ) + break; + } + + gzclose(gz); + } + } + + /* .zip */ + else { + int error; + zip_t *zip = zip_open(search_path, ZIP_RDONLY | ZIP_CHECKCONS, &error); + + if (zip != Z_NULL) + { + zip_file_t *file; + zip_stat_t stat; + + if ( !zip_stat(zip, test->file_path, ZIP_FL_ENC_STRICT, &stat) && + (stat.valid & ZIP_STAT_SIZE) && stat.size == test->file_size && + (file = zip_fopen(zip, test->file_path, 0)) != Z_NULL + ) + { + if ( zip_fread(file, buffer, test->code_offset) == test->code_offset && + zip_fread(file, buffer, test->code_size) == test->code_size + ) + success = Z_TRUE; + + zip_fclose(file); + } + + zip_close(zip); + } + } + } + + return success; + +# else + return load_file( + search_path, test->file_path, test->file_size, + test->code_offset, test->code_size, buffer); +# endif + } + + +static zuint8 run_test(int test_index) + { + char const *failure = Z_NULL; + Test const *test = &tests[test_index]; + zuint16 start_address = test->start_address; + zusize cycles = 0; + zuint i = 0; + +# if Z_USIZE_WIDTH < 64 + zuint32 j = 0; +# endif + + if (verbosity) + { + printf("[%02d] ", test_index); + + if (verbosity >= 2) + { + if (test->archive_name == Z_NULL) printf("%s", test->file_path); + else printf("%s/%s", test->archive_name, test->file_path); + printf(verbosity == 2 ? "... " : "\n* Loading program... "); + } + } + + memset(memory, 0, Z_USIZE(65536)); + + for (; i < search_path_count && + !load_test(search_paths[i], test, memory + (start_address & Z_UINT16(0xFF00))); + i++ + ); + + if ( i == search_path_count && + !load_test(Z_NULL, test, memory + (start_address & Z_UINT16(0xFF00))) + ) + { + error_loading_file: + if (verbosity) puts(show_test_output + ? "error, test skipped\n" + : "error, test skipped"); + + return Z_FALSE; + } + + if (verbosity >= 3) puts("OK"); + z80_power(&cpu, Z_TRUE); + + if (test->format == TEST_FORMAT_CPM) + { + cpu.fetch_opcode = cpu_read; + cpu.write = cpm_cpu_write; + cpu.hook = cpm_cpu_hook; + memory[0] = OPCODE_HALT; + memory[5] = Z80_HOOK; /* PRINT */ + } + + else { + cpu.write = zx_spectrum_cpu_write; + cpu.hook = zx_spectrum_cpu_hook; + cpu.im = 1; + cpu.i = 0x3F; + + if (test->format == TEST_FORMAT_WOODMASS) + { + if (verbosity >= 3) printf("* Loading firmware... "); + + for ( i = 0; + i < search_path_count && + !load_file(search_paths[i], "ZX Spectrum.rom", 16384, 0, 16384, memory); + i++ + ); + + if ( i == search_path_count && + !load_file(Z_NULL, "ZX Spectrum.rom", 16384, 0, 16384, memory) + ) + goto error_loading_file; + + if (verbosity >= 3) puts("OK"); + Z80_SP(cpu) = 0x7FE8; + Z80_AF(cpu) = 0x3222; + + cpu.fetch_opcode = zx_spectrum_cpu_fetch_opcode; + + /* 0010: THE 'PRINT A CHARACTER' RESTART */ + memory[0x0010] = OPCODE_JP_WORD; /* jp PRINT */ + memory[0x0011] = 0xF2; + memory[0x0012] = 0x70; + + /* 70F2: PRINT */ + memory[zx_spectrum_print_hook_address = 0x70F2] = Z80_HOOK; + } + + else { + cpu.fetch_opcode = cpu_read; + + /* 0010: THE 'PRINT A CHARACTER' RESTART */ + memory[zx_spectrum_print_hook_address = 0x0010] = Z80_HOOK; + + /* 0D6B: THE 'CLS' COMMAND ROUTINE */ + memory[0x0D6B] = OPCODE_RET; + + /* 1601: THE 'CHAN_OPEN' SUBROUTINE */ + memory[0x1601] = OPCODE_RET; + + if (test->format == TEST_FORMAT_RAK) + { + /* 7000: START */ + memory[0x7000] = OPCODE_CALL_WORD; + memory[0x7001] = (zuint8)start_address; + memory[0x7002] = (zuint8)(start_address >> 8); + /*memory[0x7003] = HALT;*/ + start_address = 0x7000; + } + } + } + + memory[test->exit_address] = OPCODE_HALT; + Z80_PC(cpu) = start_address; + hash = Z_FNV1_32_INITIALIZER; + lines = + columns = + cursor_x = 0; + zx_spectrum_tab = 0; + zx_spectrum_bad_character = + completed = Z_FALSE; + + if (verbosity >= 3) printf("* Running program%s", show_test_output ? ":\n\n" : "... "); + +# if Z_USIZE_WIDTH < 64 + for (i = 0; i < test->cycles[1];) + { + cycles = RUN(&cpu, Z_UINT32_MAXIMUM / 2); + + if (completed) + { + if ((j += (zuint32)cycles) < cycles) i++; + cycles = j; + goto check_results; + } + + if ((j += (zuint32)cycles) < cycles) i++; + } + + cycles = RUN(&cpu, test->cycles[0] + Z_UINT32(0x10000000) - j) + j; + check_results: +# else + cycles = RUN(&cpu, test->cycles[0] + Z_USIZE(0x10000000)); +# endif + + if (cursor_x > columns) columns = cursor_x; + + /*--------------------------------------------------------------------. + | The test is considered passed if it has reached its exit address at | + | the correct clock cycle, has not printed any unsupported characters | + | and has printed the expected output within the correct margins. | + '====================================================================*/ + + if (!completed) failure = "clock cycle limit exceeded; program aborted"; + + else if ( + zx_spectrum_bad_character || + hash != test->hash || + lines != test->lines || + columns != test->columns + ) + failure = "incorrect behavior detected"; + + else if ( +# if Z_USIZE_WIDTH < 64 + i != test->cycles[1] || +# endif + cycles != test->cycles[0] + ) + failure = "incorrect number of clock cycles"; + + if (verbosity) + { + if (show_test_output) + { + zuint has_final_new_line = test->format == TEST_FORMAT_RAK; + + if (failure == Z_NULL) puts(&new_line[has_final_new_line]); + + else printf( + "%s>>> Test failed: %s.\n\n", + &new_line[!lines || (completed && has_final_new_line)], + failure); + } + + else { + if (failure == Z_NULL) puts ("passed"); + else printf("failed: %s\n", failure); + } + } + + return failure == Z_NULL; + } + + +static zboolean string_is_option(char const* string, char const* short_option, char const* long_option) + {return !strcmp(string, short_option) || !strcmp(string, long_option);} + + +static zboolean string_to_uint8(char const* string, zuint8 maximum, zuint8 *value) + { + char *end; + zulong parsed = strtoul(string, &end, 0); + + if (end == string || *end || parsed > maximum) return Z_FALSE; + *value = (zuint8)parsed; + return Z_TRUE; + } + + +int main(int argc, char **argv) + { + zboolean all = Z_FALSE; + zuint32 tests_run = 0; + zusize maximum_search_path_size = 0; + int j, i = 0; + + /*--------------------------------------------. + | String specifying what has been detected as | + | invalid when parsing the command line. | + '============================================*/ + char const *invalid; + + /*------------------------------. + | [0] = Number of tests failed. | + | [1] = Number of tests passed. | + '==============================*/ + zuint results[2] = {0, 0}; + + /*--------------------------------------------. + | The emulator will behave as a Zilog NMOS if | + | the user does not specify a CPU model. | + '============================================*/ + cpu.options = Z80_MODEL_ZILOG_NMOS; + + while (++i < argc && *argv[i] == '-') + { + if (string_is_option(argv[i], "-V", "--version")) + { + puts( "test-Z80 v" Z80_LIBRARY_VERSION_STRING "\n" + "Copyright (C) 2021-2024 Manuel Sainz de Baranda y Goñi.\n" + "Released under the terms of the GNU General Public License v3."); + + goto exit_without_error; + } + + else if (string_is_option(argv[i], "-h", "--help")) + { + puts( "Usage: test-Z80 [options] (--all|...)\n" + "\n" + "Options:\n" + " -V, --version Print version information and exit.\n" + " -0, --even-in (0..255) Set the byte read from even I/O ports [default: 191].\n" + " -1, --odd-in (0..255) Set the byte read from odd I/O ports [default: 255].\n" + " -a, --all Run all tests.\n" + " -h, --help Print this help message and exit.\n" + " -m, --model Specify the CPU model to emulate.\n" + " -p, --path Add a path where to look for the required files.\n" + " -v, --verbosity (0..4) Set the verbosity level [default: 4].\n" + "\n" + "CPU models:\n" + " zilog-nmos Zilog NMOS [default]\n" + " zilog-cmos Zilog CMOS\n" + " nec-nmos NEC NMOS\n" + " st-cmos SGS-Thomson CMOS\n" + "\n" + "Tests:\n" + " Versions of the Z80 Documented Instruction Set Exerciser:\n" + " 00 CP/M ~ Cringle, Frank D. (1998-01-28).\n" + " 01 ZX Spectrum ~ Harston, Jonathan Graham (2018).\n" + " Versions of the Z80 Full Instruction Set Exerciser:\n" + " 02 CP/M ~ Cringle, Frank D. (1998-01-28).\n" + " 03 ZX Spectrum ~ Bobrowski, Jan (2009).\n" + " 04 ZX Spectrum ~ Bobrowski, Jan (2011). Narrowed to `bit` instructions.\n" + " 05 ZX Spectrum ~ Harston, Jonathan Graham (2017).\n" + " 06 ZX Spectrum ~ Harston, Jonathan Graham (2018).\n" + " 07 ZX Spectrum ~ Rak, Patrik (2012-11-27).\n" + " Z80 Test Suite ~ ZX Spectrum ~ Woodmass, Mark (2008):\n" + " 08 Flags test.\n" + " 09 MEMPTR test.\n" + " Zilog Z80 CPU Test Suite v1.0 ~ ZX Spectrum ~ Rak, Patrik (2012-12-08):\n" + " 10 Tests all flags and registers.\n" + " 11 Tests all registers, but only officially documented flags.\n" + " 12 Tests all flags, ignores registers.\n" + " 13 Tests documented flags only, ignores registers.\n" + " 14 Tests all flags after executing `ccf` after each instruction.\n" + " 15 Tests all flags after executing `bit N,(hl)` after each instruction.\n" + " Zilog Z80 CPU Test Suite v1.2a ~ ZX Spectrum ~ Rak, Patrik (2023-12-02):\n" + " 16 Tests all flags and registers.\n" + " 17 Tests all registers, but only officially documented flags.\n" + " 18 Tests all flags, ignores registers.\n" + " 19 Tests documented flags only, ignores registers.\n" + " 20 Tests all flags after executing `ccf` after each instruction.\n" + " 21 Tests all flags after executing `bit N,(hl)` after each instruction.\n" + "\n" + "Email bug reports and questions to \n" + "Open issues at "); + + goto exit_without_error; + } + + else if (string_is_option(argv[i], "-0", "--even-in")) + { + if (++i == argc) goto incomplete_option; + if (!string_to_uint8(argv[i], 255, &in_values[0])) goto invalid_io_value; + } + + else if (string_is_option(argv[i], "-1", "--odd-in")) + { + if (++i == argc) goto incomplete_option; + if (!string_to_uint8(argv[i], 255, &in_values[1])) goto invalid_io_value; + } + + else if (string_is_option(argv[i], "-a", "--all")) + all = Z_TRUE; + + else if (string_is_option(argv[i], "-m", "--model")) + { + if (++i == argc) goto incomplete_option; + + for (j = 0; j < (int)Z_ARRAY_SIZE(cpu_models); j++) + if (!strcmp(argv[i], cpu_models[j].key)) + { + cpu.options = cpu_models[j].options; + goto cpu_model_found; + } + + invalid = "CPU model"; + goto invalid_argument; + cpu_model_found: continue; + } + + else if (string_is_option(argv[i], "-p", "--path")) + { + zusize s; + char **p; + + if (++i == argc) goto incomplete_option; + + if (!(s = strlen(argv[i]))) + { + invalid = "path"; + goto invalid_argument; + } + + if (s > maximum_search_path_size) maximum_search_path_size = s; + + if ((p = realloc(search_paths, (search_path_count + 1) * sizeof(char *))) == Z_NULL) + goto cannot_allocate_memory; + + search_paths = p; + search_paths[search_path_count++] = argv[i]; + } + + else if (string_is_option(argv[i], "-v", "--verbosity")) + { + if (++i == argc) goto incomplete_option; + + if (!string_to_uint8(argv[i], 4, &verbosity)) + { + invalid = "verbosity level"; + goto invalid_argument; + } + } + + else { + invalid = "option"; + goto invalid_argument; + } + } + + /*------------------------------------------------. + | The user must specify at least one test number, | + | or the `-a` option in its absence. | + '================================================*/ + if (i == argc && !all) + { + fputs("test-Z80: No test specified.\n", stderr); + goto bad_syntax; + } + + /*------------------------------------------. + | All test numbers specified must be valid. | + '==========================================*/ + for (j = i; i < argc; i++) + { + char const *string = argv[i]; + char *end; + + if (strtoul(string, &end, 10) >= Z_ARRAY_SIZE(tests) || end == string || *end) + { + invalid = "test number"; + goto invalid_argument; + } + } + + if ( search_path_count && + (path_buffer = malloc(maximum_search_path_size + 110)) == Z_NULL + ) + { + cannot_allocate_memory: + fputs("test-Z80: Cannot allocate memory.", stderr); + goto exit_with_error; + } + + /*---------------------------------------------------------------. + | Disable output buffering if verbosity is enabled, so that the | + | messages are visible immediately rather than after each ENTER. | + '===============================================================*/ + if (verbosity) setvbuf(stdout, Z_NULL, _IONBF, 0); + show_test_output = verbosity == 4; + + /* Configure the Z80 CPU emulator. */ + + /*---------------------------------------------------------------. + | No CPU context is needed, since we are using global variables. | + '===============================================================*/ + cpu.context = Z_NULL; + + /*---------------------------------------------------. + | No test program requires these optional callbacks. | + '===================================================*/ + cpu.nmia = + cpu.inta = + cpu.int_fetch = Z_NULL; + cpu.ld_i_a = + cpu.ld_r_a = + cpu.reti = + cpu.retn = Z_NULL; + cpu.illegal = Z_NULL; + + /*------------------------------------------------------------------. + | It is not necessary to distinguish between opcode fetch, internal | + | NOP and memory read, as the test programs require neither precise | + | timing nor memory contention. | + '==================================================================*/ + cpu.fetch = + cpu.read = + cpu.nop = cpu_read; + + cpu.in = cpu_in; + cpu.out = cpu_out; + + /*-------------------------------------------------------------------. + | Entering the HALT state means that the test program has completed. | + '===================================================================*/ + cpu.halt = cpu_halt; + + /*------------------------------------------------------------. + | Run the tests whose numbers have been explicitly specified. | + '============================================================*/ + while (j < argc) + { + tests_run |= Z_UINT32(1) << (i = atoi(argv[j++])); + results[run_test(i)]++; + } + + /*-----------------------------------------------------. + | If the `-a` option has been specified, run all tests | + | without repeating those that have already been run. | + '=====================================================*/ + if (all) for (i = 0; i < (int)Z_ARRAY_SIZE(tests); i++) + if (!(tests_run & (Z_UINT32(1) << i))) results[run_test(i)]++; + + /*---------------------------. + | Print the results summary. | + '===========================*/ + printf( "%sResults%s: %u test%s passed, %u failed.\n", + &new_line[!verbosity || show_test_output], + show_test_output ? " summary" : "", + results[1], + results[1] == 1 ? "" : "s", + results[0]); + + exit_without_error: + free(search_paths); + free(path_buffer); + return results[0] ? -1 : 0; + + incomplete_option: + fprintf(stderr, "test-Z80: Incomplete option: '%s'\n", argv[i - 1]); + goto bad_syntax; + + invalid_io_value: + invalid = "I/O value"; + + invalid_argument: + fprintf(stderr, "test-Z80: Invalid %s: '%s'\n", invalid, argv[i]); + + bad_syntax: + fputs("test-Z80: Type 'test-Z80 -h' for help.\n", stderr); + + exit_with_error: + free(search_paths); + free(path_buffer); + return -1; + } + + +/* test-Z80.c EOF */ diff --git a/projects/Z80/support/Z80.pc.in b/projects/Z80/support/Z80.pc.in new file mode 100644 index 0000000..0d00d78 --- /dev/null +++ b/projects/Z80/support/Z80.pc.in @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@. +URL: @PROJECT_HOMEPAGE_URL@ +Version: @PROJECT_VERSION@ +Requires: Zeta +Cflags: -I${includedir} +Cflags.private: -DZ80_STATIC +Libs: -L${libdir} -l@PROJECT_NAME@ diff --git a/projects/Z80/support/Z80Config.cmake.in b/projects/Z80/support/Z80Config.cmake.in new file mode 100644 index 0000000..ec67ebd --- /dev/null +++ b/projects/Z80/support/Z80Config.cmake.in @@ -0,0 +1,66 @@ +cmake_minimum_required( + # 3.3: IN_LIST + VERSION 3.3...${CMAKE_VERSION}) + +set(@PROJECT_NAME@_known_components Static Shared) +set(@PROJECT_NAME@_component_Static NO) +set(@PROJECT_NAME@_component_Shared NO) + +foreach(@PROJECT_NAME@_component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + if(@PROJECT_NAME@_component IN_LIST @PROJECT_NAME@_known_components) + set(@PROJECT_NAME@_component_${@PROJECT_NAME@_component} YES) + else() + set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "`${@PROJECT_NAME@_component}` is not a valid component.") + + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() + endif() +endforeach() + +if(@PROJECT_NAME@_component_Static AND @PROJECT_NAME@_component_Shared) + set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "`Static` and `Shared` are mutually exclusive.") + + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() +endif() + +set(@PROJECT_NAME@_Static_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@StaticTargets.cmake") +set(@PROJECT_NAME@_Shared_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@SharedTargets.cmake") + +macro(@PROJECT_NAME@_load_targets type) + if(NOT EXISTS "${@PROJECT_NAME@_${type}_targets}") + set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "`${type}` libraries were requested but not found.") + + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() + endif() + + include(CMakeFindDependencyMacro) + find_dependency(Zeta) + include("${@PROJECT_NAME@_${type}_targets}") +endmacro() + +if(@PROJECT_NAME@_component_Static) + @PROJECT_NAME@_load_targets(Static) +elseif(@PROJECT_NAME@_component_Shared) + @PROJECT_NAME@_load_targets(Shared) +elseif(DEFINED @PROJECT_NAME@_SHARED_LIBS AND @PROJECT_NAME@_SHARED_LIBS) + @PROJECT_NAME@_load_targets(Shared) +elseif(DEFINED @PROJECT_NAME@_SHARED_LIBS AND NOT @PROJECT_NAME@_SHARED_LIBS) + @PROJECT_NAME@_load_targets(Static) +elseif(BUILD_SHARED_LIBS) + if(EXISTS "${@PROJECT_NAME@_Shared_targets}") + @PROJECT_NAME@_load_targets(Shared) + else() + @PROJECT_NAME@_load_targets(Static) + endif() +else() + if(EXISTS "${@PROJECT_NAME@_Static_targets}") + @PROJECT_NAME@_load_targets(Static) + else() + @PROJECT_NAME@_load_targets(Shared) + endif() +endif() diff --git a/projects/Z80/support/firmware.sha3-512 b/projects/Z80/support/firmware.sha3-512 new file mode 100644 index 0000000..4a52cf3 --- /dev/null +++ b/projects/Z80/support/firmware.sha3-512 @@ -0,0 +1 @@ +B425AFB300DC7F0671E4DDAF3F13BF962D3D06FB717B8709E10F489A213E142C8D57B6973CB509A0C62F94793D476E993983276F9E10ADA705BAE5381D7A2A9B ZX Spectrum.rom diff --git a/projects/Z80/support/software.sha3-512 b/projects/Z80/support/software.sha3-512 new file mode 100644 index 0000000..ca733b7 --- /dev/null +++ b/projects/Z80/support/software.sha3-512 @@ -0,0 +1,10 @@ +CBC8F24E2696D04471F1137E5BA4D6F95B798A0B97BD811C1B2E1C362292D151BE5DB524547E4B2B6C1A248434D3FF479B5D7FB1A5C150CD7213B10794686C38 POSIX/Yaze v1.10 (1998-01-28)(Cringle, Frank D.)(Sources)[!].tar.gz +75A482EDBDEF7016FF7F9BAC8E29630B8D74A57266A7662037CDAB5CE790C7942C0E779F7C9C5C57D3A6DAF2E6293F6AD3CF40B441ED5A10B3A5CB25909F33E1 ZX Spectrum/Z80 Documented Instruction Set Exerciser for Spectrum (2018)(Harston, Jonathan Graham)[!].tap +1AA2DB065843B4A36471A2E0F8DDB61B7BD857450E867068B27829690F327C942F2552C028A397D9A7DDE7BED24D2F9782731633A9111F3F9D5612FC53088D4B ZX Spectrum/Z80 Full Instruction Set Exerciser for Spectrum (2009)(Bobrowski, Jan)[!].tap +A77946868B7DD90E7B21ACF9566399EA1929899DB3C67224A203D2BA587239A846D992E974205B2FF3398E19B5168954891FEC3E020008BBF039F540CF6F63EB ZX Spectrum/Z80 Full Instruction Set Exerciser for Spectrum (2011)(Bobrowski, Jan)(Narrowed to BIT Instructions)[!].tap +BAA29B8D799F59C4B7D485AA9CC7152172623EC4C827372F4E12CF0AB18BB7F7E7AD449BC59615F5CDD1D9908FDAB0A61158E0C543B036D27557B0D27225613D ZX Spectrum/Z80 Full Instruction Set Exerciser for Spectrum (2017-0x)(Harston, Jonathan Graham)[!].tap +5A4E247865DE5945C271A954BE7FF47E356E2002F90B6B3B3C214DCD7D1C057DB1F3F1BD11AC37EC1EA37EC5A551C3A1A0CFB20FC0BA8760646046AA594C07C3 ZX Spectrum/Z80 Full Instruction Set Exerciser for Spectrum (2018)(Harston, Jonathan Graham)[!].tap +4667E8CF1E4171842101EAC56BBB6893059E37B4B52ECA22A9C7A4DB1DB668439FA1E8BD77EFE6E9496EC7CD7B1F420BA45672D52A045E1E09C7425D9850E85A ZX Spectrum/Z80 Instruction Set Exerciser for Spectrum 2 v0.1 (2012-11-27)(Rak, Patrik)[!].zip +BB1DCE3187FBF5EA871FE41EB76AE7E0C94D08136FF4D8E756E2624DA589AAE69CAD074EB43CBFB9E2B9E0D2CC505343D9804EDCDE3CEA1FB1881DCBF5C865B0 ZX Spectrum/Z80 Test Suite (2008)(Woodmass, Mark)[!].tap +13F24211FDC8053204DC8C6224A5FE99063AEC840C9A9A0225DC1CDB20FE0C119EB570F50A5373D2F2CC22FEDB96286721DA67DBC8A9ABA8EBDE14E539EE2C43 ZX Spectrum/Zilog Z80 CPU Test Suite v1.0 (2012-12-08)(Rak, Patrik)[!].zip +DD58528572CA0BF2F0FCA6191F339A091D78CBD1A73A4FEE74726F99A6B686A27E75F9882E178015116F4AF28C7E3FF2D4557484F53D6963FE95F47F4653DC28 ZX Spectrum/Zilog Z80 CPU Test Suite v1.2a (2023-12-02)(Rak, Patrik)[!].zip diff --git a/projects/Zeta/.editorconfig b/projects/Zeta/.editorconfig new file mode 100644 index 0000000..f0afabb --- /dev/null +++ b/projects/Zeta/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 8 +indent_style = tab +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{cff,yml}] +indent_size = 2 +indent_style = space diff --git a/projects/Zeta/.github/FUNDING.yml b/projects/Zeta/.github/FUNDING.yml new file mode 100644 index 0000000..b45ed9c --- /dev/null +++ b/projects/Zeta/.github/FUNDING.yml @@ -0,0 +1,5 @@ +buy_me_a_coffee: redcode +github: redcode +ko_fi: redcode +liberapay: redcode +patreon: redcode diff --git a/projects/Zeta/.github/pull_request_template.md b/projects/Zeta/.github/pull_request_template.md new file mode 100644 index 0000000..dca4451 --- /dev/null +++ b/projects/Zeta/.github/pull_request_template.md @@ -0,0 +1,11 @@ +_Describe your pull request here._ + +--- + +### Legal notice _(do not delete)_ + +It is required that contributors assign copyright to the original author so that he retains full ownership of the project. This makes it easier for other entities to use the software because they only have to deal with one copyright holder. It also gives the original author assurance that he will be able to make decisions in the future without gathering and consulting all contributors. + +By submitting this PR, you agree to the following: + +> You hereby assign copyright in this PR's code to the original author of the Zeta library, Manuel Sainz de Baranda y Goñi, to be licensed under the same terms as the rest of the code. You agree to relinquish any and all copyright interest in the software, to the detriment of your heirs and successors. diff --git a/projects/Zeta/.gitignore b/projects/Zeta/.gitignore new file mode 100644 index 0000000..d123c79 --- /dev/null +++ b/projects/Zeta/.gitignore @@ -0,0 +1,5 @@ +.directory +.DS_Store +Thumbs.db +/build/ +/CMakeLists.txt.user diff --git a/projects/Zeta/.vimrc b/projects/Zeta/.vimrc new file mode 100644 index 0000000..361ddcf --- /dev/null +++ b/projects/Zeta/.vimrc @@ -0,0 +1,4 @@ +set noexpandtab +set shiftwidth=8 +set tabstop=8 +autocmd BufWritePre * %s/\s\+$//e diff --git a/projects/Zeta/API/Z/classes/Empty.hpp b/projects/Zeta/API/Z/classes/Empty.hpp new file mode 100644 index 0000000..8da1007 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Empty.hpp @@ -0,0 +1,14 @@ +/* Zeta API - Z/classes/Empty.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Empty_HPP +#define Z_classes_Empty_HPP + +namespace Zeta {struct Empty {};} + +#endif // Z_classes_Empty_HPP diff --git a/projects/Zeta/API/Z/classes/Functor.hpp b/projects/Zeta/API/Z/classes/Functor.hpp new file mode 100644 index 0000000..bf0df1b --- /dev/null +++ b/projects/Zeta/API/Z/classes/Functor.hpp @@ -0,0 +1,185 @@ +/* Zeta API - Z/classes/Functor.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Functor_HPP +#define Z_classes_Functor_HPP + +#include + +#if Z_HAS(ObjectMemberFunction) +# ifdef Z_WITH_OBJECTIVE_C_RUNTIME +# include +# include +# endif + +# define Z_HAS_Functor 1 + + + namespace Zeta { + + template class Functor; + + template class Functor { + + private: + typedef r (* Call)(const Functor *, typename Type

::to_forwardable...); + typedef void (* Destroy)(Functor *); + + Call call; + Destroy destroy; + + union { r (* function)(p...); + + struct {r (NaT::* function)(p...); + NaT *object; + } object_member_function; + +# if Z_HAS(ObjectSelector) + struct {SEL selector; + id object; + } object_selector; +# endif + } target; + + + struct Callers { + + static Z_INLINE Call function() Z_NOTHROW + { + return [](const Functor *functor, typename Type

::to_forwardable... arguments) -> r + {return functor->target.function(arguments...);}; + } + + + static Z_INLINE Call object_member_function() Z_NOTHROW + { + return [](const Functor *functor, typename Type

::to_forwardable... arguments) -> r + { + return (functor->target.object_member_function.object->* + functor->target.object_member_function.function) + (arguments...); + }; + } + + +# if Z_HAS(ObjectSelector) + static Z_INLINE Call object_selector() Z_NOTHROW + { + return [](const Functor *functor, typename Type

::to_forwardable... arguments) + { + return (cast(ObjectiveC::send()))( + functor->target.object_selector.object, + functor->target.object_selector.selector, + arguments...); + }; + } +# endif + }; + + + public: + + Z_CT(CPP11) Functor() Z_NOTHROW + : call(Z_NULL), destroy(Z_NULL) {} + + +# ifdef Z_NULLPTR + Z_CT(CPP11) Functor(NullPtr) Z_NOTHROW + : call(Z_NULL), destroy(Z_NULL) {} +# endif + + + Z_INLINE Functor(r (* function)(p...)) Z_NOTHROW + : call(Callers::function()), destroy(Z_NULL) + {target.function = function;} + + + template ::is_void || Type::is_class) && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE Functor(o *object, m function) Z_NOTHROW + : call(Callers::object_member_function()), destroy(Z_NULL) + { + target.object_member_function.function = reinterpret_cast(function); + target.object_member_function.object = reinterpret_cast(const_cast::to_unqualified *>(object)); + } + + + template ::is_class && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE Functor(const o &object, m function) Z_NOTHROW + : call(Callers::object_member_function()), destroy(Z_NULL) + { + target.object_member_function.function = reinterpret_cast(function); + target.object_member_function.object = reinterpret_cast(const_cast::to_unqualified *>(&object)); + } + + + Z_INLINE Functor(const ObjectMemberFunction &object_member_function) Z_NOTHROW + : call(Callers::object_member_function()), destroy(Z_NULL) + { + target.object_member_function.function = object_member_function.function; + target.object_member_function.object = object_member_function.object; + } + + +# if Z_HAS(TypeIsConvertible) + + template ::is_class && + TypeIsConvertible::value + >::type> + Z_INLINE Functor(const o &object) Z_NOTHROW + : call(Callers::function()), destroy(Z_NULL) + {target.function = (r(*)(p...))object;} // TODO: cast + +# endif + + +# if Z_HAS(ObjectSelector) + + Z_INLINE Functor(id object, SEL selector) Z_NOTHROW + : call(Callers::object_selector()), destroy(Z_NULL) + { + target.object_selector.selector = selector; + target.object_selector.object = object; + } + + + Z_INLINE Functor(const ObjectSelector &object_selector) Z_NOTHROW + : call(Callers::object_selector()), destroy(Z_NULL) + { + target.object_selector.selector = object_selector.selector; + target.object_selector.object = object_selector.object; + } + +# endif + + + Z_INLINE ~Functor() + {if (destroy) destroy(this);} + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return call != Z_NULL;} + + + Z_INLINE r operator ()(typename Type

::to_forwardable... arguments) const + {return call(this, arguments...);} + }; + } + + +#endif + +#endif // Z_classes_Functor_HPP diff --git a/projects/Zeta/API/Z/classes/InitializerList.hpp b/projects/Zeta/API/Z/classes/InitializerList.hpp new file mode 100644 index 0000000..42d7366 --- /dev/null +++ b/projects/Zeta/API/Z/classes/InitializerList.hpp @@ -0,0 +1,45 @@ +/* Zeta API - Z/classes/InitializerList.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_InitializerList_HPP +#define Z_classes_InitializerList_HPP + +#include + +#if Z_DIALECT_HAS(CPP11, INITIALIZER_LIST) +# include +# include +# include + +# define Z_HAS_InitializerList 1 + + + namespace Zeta {template class InitializerList { + public: + typedef t value_type; + typedef const t& reference; + typedef const t& const_reference; + typedef USize size_type; + typedef const t* iterator; + typedef const t* const_iterator; + + private: + const t* _data; + USize _size; + + public: + Z_CT(CPP11) InitializerList() Z_NOTHROW + : _data(Z_NULL), _size(0) {} + + Z_CT(CPP11) USize size () const Z_NOTHROW {return _size;} + Z_CT(CPP11) const t* begin() const Z_NOTHROW {return _data;} + Z_CT(CPP11) const t* end () const Z_NOTHROW {return _data + _size;} + };} +#endif + +#endif // Z_classes_InitializerList_HPP diff --git a/projects/Zeta/API/Z/classes/Iterator.hpp b/projects/Zeta/API/Z/classes/Iterator.hpp new file mode 100644 index 0000000..8aed31c --- /dev/null +++ b/projects/Zeta/API/Z/classes/Iterator.hpp @@ -0,0 +1,38 @@ +/* Zeta API - Z/classes/Iterator.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Iterator_HPP +#define Z_classes_Iterator_HPP + + +namespace Zeta{template struct Iterator { + t& data_source; + typename t::size_type index; + + + Z_CT(CPP11) Iterator(t &data_source_, typename t::size_type index_) + : data_source(data_source_), index(index_) {} + + + friend Z_CT(CPP11) Boolean operator !=(const Iterator &lhs, const Iterator &rhs) Z_NOTHROW + {return lhs.index != rhs.index;} + + + Z_CT(CPP11) const typename t::element_type &operator *() const Z_NOTHROW + {return data_source[index];} + + + Z_INLINE Iterator const &operator ++() Z_NOTHROW + { + index++; + return *this; + } +};} + + +#endif // Z_classes_Iterator_HPP diff --git a/projects/Zeta/API/Z/classes/MemberFunction.hpp b/projects/Zeta/API/Z/classes/MemberFunction.hpp new file mode 100644 index 0000000..191569e --- /dev/null +++ b/projects/Zeta/API/Z/classes/MemberFunction.hpp @@ -0,0 +1,85 @@ +/* Zeta API - Z/classes/MemberFunction.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_MemberFunction_HPP +#define Z_classes_MemberFunction_HPP + +#include + +#if Z_DIALECT_HAS(CPP98, SFINAE) && \ + Z_DIALECT_HAS(CPP11, VARIADIC_TEMPLATE) && \ + Z_DIALECT_HAS(CPP11, DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE) + +# define Z_HAS_MemberFunction 1 + +# include +# include + + + namespace Zeta { + template struct MemberFunction; + + template struct MemberFunction { + r (NaT::* function)(p...); + + + Z_INLINE MemberFunction() Z_NOTHROW + Z_DEFAULTED({}) + + +# ifdef Z_NULLPTR + Z_CT(CPP11) MemberFunction(NullPtr) Z_NOTHROW + : function(nullptr) {}; +# endif + + + template ::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE MemberFunction(m function) Z_NOTHROW + : function(reinterpret_cast(function)) {} + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return function != Z_NULL;} + + + template ::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE operator m() const Z_NOTHROW + {return reinterpret_cast(function);} + + + template + Z_INLINE typename TypeIf< + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value, + MemberFunction &>::type + operator =(m rhs) Z_NOTHROW + { + function = reinterpret_cast(rhs); + return *this; + } + + + template + Z_INLINE r operator ()(o *object, typename Type

::to_forwardable... arguments) const + {return (reinterpret_cast(object)->*function)(arguments...);} + + + template + Z_INLINE r operator ()(const o &object, typename Type

::to_forwardable... arguments) const + {return (const_cast(reinterpret_cast(&object))->*function)(arguments...);} + }; + } +#endif + +#endif // Z_classes_MemberFunction_HPP diff --git a/projects/Zeta/API/Z/classes/NaT.hpp b/projects/Zeta/API/Z/classes/NaT.hpp new file mode 100644 index 0000000..0a269bd --- /dev/null +++ b/projects/Zeta/API/Z/classes/NaT.hpp @@ -0,0 +1,30 @@ +/* Zeta API - Z/classes/NaT.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_NaT_HPP +#define Z_classes_NaT_HPP + +#include + + +namespace Zeta {struct NaT Z_FINAL { +# if Z_DIALECT_HAS(CPP11, DELETED_FUNCTION) + NaT() = delete; + NaT(const NaT &) = delete; + ~NaT() = delete; + NaT &operator =(const NaT &) = delete; + +# if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) + NaT(NaT &&) = delete; + NaT &operator =(NaT &&) = delete; +# endif +# endif +};} + + +#endif // Z_classes_NaT_HPP diff --git a/projects/Zeta/API/Z/classes/ObjectMemberFunction.hpp b/projects/Zeta/API/Z/classes/ObjectMemberFunction.hpp new file mode 100644 index 0000000..8c92186 --- /dev/null +++ b/projects/Zeta/API/Z/classes/ObjectMemberFunction.hpp @@ -0,0 +1,148 @@ +/* Zeta API - Z/classes/ObjectMemberFunction.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_ObjectMemberFunction_HPP +#define Z_classes_ObjectMemberFunction_HPP + +#include +#include + +#if Z_HAS(MemberFunction) +# define Z_HAS_ObjectMemberFunction 1 + + + namespace Zeta { + template struct ObjectMemberFunction; + + template + struct ObjectMemberFunction : MemberFunction { + NaT *object; + + + Z_INLINE ObjectMemberFunction() Z_NOTHROW + Z_DEFAULTED({}) + + +# if Z_DIALECT_HAS(CPP11, INHERITING_CONSTRUCTORS) + using MemberFunction::MemberFunction; +# else + template ::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE ObjectMemberFunction(m function) Z_NOTHROW + : MemberFunction(function) {} +# endif + + +# ifdef Z_NULLPTR + Z_CT(CPP11) ObjectMemberFunction(NullPtr) Z_NOTHROW + : MemberFunction(nullptr), object(nullptr) {}; +# endif + + + template ::is_void_pointer || + (Type::is_pointer && + Type::flow::pointee_type::is_class)) && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE ObjectMemberFunction(o object, m function) Z_NOTHROW + : MemberFunction(function), object(reinterpret_cast(object)) {} + + + template ::is_class && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value + >::type> + Z_INLINE ObjectMemberFunction(const o &object, m function) Z_NOTHROW + : MemberFunction(function), object(reinterpret_cast(&object)) {} + + + template ::is_class>::type> + Z_INLINE operator o *() const Z_NOTHROW + {return reinterpret_cast(object);} + + + template + Z_INLINE typename TypeIf::is_class, ObjectMemberFunction &>::type + operator =(o *rhs) Z_NOTHROW + { + object = reinterpret_cast(rhs); + return *this; + } + + + template + Z_INLINE typename TypeIf::is_class, ObjectMemberFunction &>::type + operator =(const o &rhs) Z_NOTHROW + { + object = reinterpret_cast(&rhs); + return *this; + } + + + template + Z_INLINE typename TypeIf< + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value, + ObjectMemberFunction &>::type + operator =(m rhs) Z_NOTHROW + { + this->function = reinterpret_cast(rhs); + return *this; + } + + + Z_INLINE r operator ()(typename Type

::to_forwardable... arguments) const + {return (object->*this->function)(arguments...);} + + + template + Z_INLINE r operator ()(o *object, typename Type

::to_forwardable... arguments) const + {return (reinterpret_cast(object)->*this->function)(arguments...);} + + + template + Z_INLINE r operator ()(const o &object, typename Type

::to_forwardable... arguments) const + {return (reinterpret_cast(&object)->*this->function)(arguments...);} + + + template + Z_INLINE typename TypeIf< + (Type::is_void || Type::is_class) && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value, + ObjectMemberFunction &>::type + set(o *object, m function) Z_NOTHROW + { + this->function = reinterpret_cast(function); + this->object = reinterpret_cast(&object); + return *this; + } + + + template + Z_INLINE typename TypeIf< + Type::is_class && + Type::is_member_function_pointer && + TypeIsSame::flow::to_function::end::to_unqualified, r(p...)>::value, + ObjectMemberFunction &>::type + set(const o &object, m function) Z_NOTHROW + { + this->function = reinterpret_cast(function); + this->object = const_cast(reinterpret_cast(&object)); + return *this; + } + }; + } +#endif + +#endif // Z_classes_ObjectMemberFunction_HPP diff --git a/projects/Zeta/API/Z/classes/ObjectSelector.hpp b/projects/Zeta/API/Z/classes/ObjectSelector.hpp new file mode 100644 index 0000000..19e4c33 --- /dev/null +++ b/projects/Zeta/API/Z/classes/ObjectSelector.hpp @@ -0,0 +1,94 @@ +/* Zeta API - Z/classes/ObjectSelector.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_ObjectSelector_HPP +#define Z_classes_ObjectSelector_HPP + +#include +#include + +#if Z_HAS(Selector) +# define Z_HAS_ObjectSelector 1 + + + namespace Zeta { + template struct ObjectSelector; + + template + struct ObjectSelector { + typedef r (* Send )(id, SEL, p...); + typedef r (* SendSuper)(struct objc_super *, SEL, p...); + + SEL selector; + id object; + + + Z_INLINE ObjectSelector() Z_NOTHROW + Z_DEFAULTED({}) + + + Z_INLINE ObjectSelector(id object_, SEL selector_) Z_NOTHROW + : object(object_), selector(selector_) {} + + + Z_INLINE operator id() const Z_NOTHROW + {return object;} + + + Z_INLINE operator SEL() const Z_NOTHROW + {return selector;} + + + Z_INLINE ObjectSelector &operator =(SEL rhs) Z_NOTHROW + {selector = rhs; return *this;} + + + Z_INLINE ObjectSelector &operator =(id rhs) Z_NOTHROW + {object = rhs; return *this;} + + + Z_INLINE r operator ()(typename Type

::to_forwardable... arguments) const Z_NOTHROW + {return (Send(ObjectiveC::send()))(object, selector, arguments...);} + + + Z_INLINE r operator ()(id object_, typename Type

::to_forwardable... arguments) const Z_NOTHROW + {return (Send(ObjectiveC::send()))(object_, selector, arguments...);} + + + Z_INLINE r super(typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + struct objc_super object_super {object, class_getSuperclass(object_getClass(object))}; + return (SendSuper(objc_msgSendSuper))(&object_super, this->selector, arguments...); + } + + + Z_INLINE r super(id object, typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + struct objc_super object_super {object, class_getSuperclass(object_getClass(object))}; + return (SendSuper(objc_msgSendSuper))(&object_super, this->selector, arguments...); + } + + + Z_INLINE r super(const struct objc_super &object_super, typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + return (SendSuper(ObjectiveC::send_super())) + (const_cast(&object_super), selector, arguments...); + } + + + Z_INLINE ObjectSelector &set(id object, SEL selector) Z_NOTHROW + { + this->selector = selector; + this->object = object; + return *this; + } + }; + } +#endif + +#endif // Z_classes_ObjectSelector_HPP diff --git a/projects/Zeta/API/Z/classes/OpaqueMemberFunctionPointer.hpp b/projects/Zeta/API/Z/classes/OpaqueMemberFunctionPointer.hpp new file mode 100644 index 0000000..50b33f7 --- /dev/null +++ b/projects/Zeta/API/Z/classes/OpaqueMemberFunctionPointer.hpp @@ -0,0 +1,30 @@ +/* Zeta API - Z/classes/OpaqueMemberFunctionPointer.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_OpaqueMemberFunctionPointer_HPP +#define Z_classes_OpaqueMemberFunctionPointer_HPP + +#include + + +namespace Zeta {struct OpaqueMemberFunctionPointer { + void (NaT::* value)(); + + + template + Z_INLINE OpaqueMemberFunctionPointer(m pointer) Z_NOTHROW + : value(reinterpret_cast(pointer)) {} + + + template + Z_INLINE operator m() const Z_NOTHROW + {return reinterpret_cast(value);} +};} + + +#endif // Z_classes_OpaqueMemberFunctionPointer_HPP diff --git a/projects/Zeta/API/Z/classes/Pair.hpp b/projects/Zeta/API/Z/classes/Pair.hpp new file mode 100644 index 0000000..3f190d1 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Pair.hpp @@ -0,0 +1,48 @@ +/* Zeta API - Z/classes/Pair.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Pair_HPP +#define Z_classes_Pair_HPP + +#include +#include + + +namespace Zeta {template struct Pair { + typedef t1 First; + typedef t2 Second; + + t1 first; + t2 second; + + Z_INLINE Pair() Z_DEFAULTED({}) + + Z_CT(CPP11) Pair( + typename Type::to_forwardable first, + typename Type::to_forwardable second + ) : first(first), second(second) {} + + + Z_CT(CPP11) Boolean operator ==(const Pair &pair) const + {return first == pair.first && second == pair.second;} + + + Z_CT(CPP11) Boolean operator !=(const Pair &pair) const + {return first != pair.first || second != pair.second;} + + + /*Z_INLINE void swap(Pair &pair) + { + Zeta::swap::to_opaque>( + reinterpret_cast::to_opaque *>(this), + reinterpret_cast::to_opaque *>(&pair)); + }*/ +};} + + +#endif // Z_classes_Pair_HPP diff --git a/projects/Zeta/API/Z/classes/Range.hpp b/projects/Zeta/API/Z/classes/Range.hpp new file mode 100644 index 0000000..cd320a4 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Range.hpp @@ -0,0 +1,135 @@ +/* Zeta API - Z/classes/Range.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Range_HPP +#define Z_classes_Range_HPP + +#include + +#if defined(Z_WITH_FOUNDATION) && Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) +# import +#endif + + +namespace Zeta {template struct Range { + t index, size; + + + Z_INLINE Range() Z_NOTHROW + Z_DEFAULTED({}) + + + Z_CT(CPP11) Range(t size_) Z_NOTHROW + : index(0), size(size_) {} + + + Z_CT(CPP11) Range(t index_, t size_) Z_NOTHROW + : index(index_), size(size_) {} + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return !!size;} + + + friend Z_CT(CPP11) Boolean operator ==(const Range &lhs, const Range &rhs) Z_NOTHROW + {return lhs.index == rhs.index && lhs.size == rhs.size;} + + + friend Z_CT(CPP11) Boolean operator !=(const Range &lhs, const Range &rhs) Z_NOTHROW + {return lhs.index != rhs.index || lhs.size != rhs.size;} + + + friend Z_CT(CPP14) Range operator &(const Range &lhs, const Range &rhs) Z_NOTHROW + { + t index = (lhs.index > rhs.index) ? lhs.index : rhs.index; + t end = minimum(lhs.end(), rhs.end()); + + return end > index ? Range(index, end - index) : Range(0); + } + + + friend Z_CT(CPP14) Range operator |(const Range &lhs, const Range &rhs) Z_NOTHROW + { + t index = (lhs.index < rhs.index) ? lhs.index : rhs.index; + t lhs_end = lhs.end(); + t rhs_end = rhs.end(); + + return Range(index, ((lhs_end > rhs_end) ? lhs_end : rhs_end) - index); + } + + + friend Z_CT(CPP11) Range operator +(const Range &lhs, t rhs) Z_NOTHROW + {return Range(lhs.index, lhs.size + rhs);} + + + friend Z_CT(CPP11) Range operator +(t lhs, const Range &rhs) Z_NOTHROW + {return Range(rhs.index, rhs.size + lhs);} + + + friend Z_CT(CPP11) Range operator -(const Range &lhs, t rhs) Z_NOTHROW + {return Range(lhs.index, lhs.size - rhs);} + + + Z_CT(CPP11) Range operator >>(t rhs) const Z_NOTHROW {return Range(index + rhs, size);} + Z_CT(CPP11) Range operator <<(t rhs) const Z_NOTHROW {return Range(index - rhs, size);} + + Z_INLINE Range &operator &=(const Range &rhs) Z_NOTHROW {return *this = *this & rhs;} + Z_INLINE Range &operator |=(const Range &rhs) Z_NOTHROW {return *this = *this | rhs;} + + Z_INLINE Range &operator +=(t rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE Range &operator -=(t rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE Range &operator >>=(t rhs) Z_NOTHROW {return *this = *this >> rhs;} + Z_INLINE Range &operator <<=(t rhs) Z_NOTHROW {return *this = *this << rhs;} + + Z_CT(CPP11) t operator [](t index_) const Z_NOTHROW {return index + index_;} + + + Z_CT(CPP11) Boolean contains(const Range &other) const Z_NOTHROW + {return other.index >= index && other.end() <= end();} + + + Z_CT(CPP11) Boolean contains(t index_) const Z_NOTHROW + {return index_ >= index && index_ < end();} + + + Z_CT(CPP11) t end() const Z_NOTHROW + {return index + size;} + + + Z_CT(CPP11) Boolean intersects(const Range &other) const Z_NOTHROW + {return index < other.end() && other.index < end();} + + + Z_CT(CPP11) Boolean is_zero() const Z_NOTHROW + {return !index && !size;} + + +# if defined(Z_WITH_FOUNDATION) && Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) + + Z_CT(CPP11) Range(const NSRange &range) Z_NOTHROW + : index(t(range.location)), size(t(range.length)) {} + + +# if Z_DIALECT_HAS(CPP11, COPY_LIST_INITIALIZATION) + + Z_CT(CPP11) operator NSRange() const Z_NOTHROW + {return {NSUInteger(index), NSUInteger(size)};} + +# else + Z_CT(CPP14) operator NSRange() const Z_NOTHROW + { + NSRange result = {NSUInteger(index), NSUInteger(size)}; + return result; + } +# endif + +# endif +};} + + +#endif // Z_classes_Range_HPP diff --git a/projects/Zeta/API/Z/classes/Rectangle.hpp b/projects/Zeta/API/Z/classes/Rectangle.hpp new file mode 100644 index 0000000..d1baae8 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Rectangle.hpp @@ -0,0 +1,736 @@ +/* Zeta API - Z/classes/Rectangle.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Rectangle_HPP +#define Z_classes_Rectangle_HPP + +#include + +#ifdef Z_WITH_COCOS2D_X +# include "cocos2d.h" +#endif + +#ifdef Z_WITH_CORE_FOUNDATION +# include +#endif + +#if defined(Z_WITH_FOUNDATION) && Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) +# import +#endif + +#ifdef Z_WITH_QT +# include +#endif + + +namespace Zeta {template struct Rectangle { + XY point, size; + + + Z_INLINE Rectangle() Z_NOTHROW + Z_DEFAULTED({}) + + + Z_CT(CPP11) Rectangle(const XY &point_, const XY &size_) Z_NOTHROW + : point(point_), size(size_) {} + + + Z_CT(CPP11) Rectangle(const XY &point_, t size_x, t size_y) Z_NOTHROW + : point(point_), size(size_x, size_y) {} + + + Z_CT(CPP11) Rectangle(const XY &point_, t size_xy) Z_NOTHROW + : point(point_), size(size_xy) {} + + + Z_CT(CPP11) Rectangle(t point_x, t point_y, const XY &size_) Z_NOTHROW + : point(point_x, point_y), size(size_) {} + + + Z_CT(CPP11) Rectangle(t point_x, t point_y, t size_x, t size_y) Z_NOTHROW + : point(point_x, point_y), size(size_x, size_y) {} + + + Z_CT(CPP11) Rectangle(t point_x, t point_y, t size_xy) Z_NOTHROW + : point(point_x, point_y), size(size_xy) {} + + + Z_CT(CPP11) Rectangle(t point_xy, const XY &size_) Z_NOTHROW + : point(point_xy), size(size_) {} + + + Z_CT(CPP11) Rectangle(const XY &size_) Z_NOTHROW + : point(t(0)), size(size_) {} + + + Z_CT(CPP11) Rectangle(t size_x, t size_y) Z_NOTHROW + : point(t(0)), size(size_x, size_y) {} + + + Z_CT(CPP11) Rectangle(t size_xy) Z_NOTHROW + : point(t(0)), size(size_xy) {} + + +# if Z_DIALECT_HAS(CPP98, SFINAE) && \ + Z_DIALECT_HAS(CPP11, DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE) + + template ::value>::type> + Z_CT(CPP11) Rectangle(const Rectangle &other) Z_NOTHROW + : point(other.point), size(other.size) {} +# endif + + + static Z_CT(CPP14) Rectangle from_vertices(const XY &a, const XY &b) Z_NOTHROW + { + XY minimum = a.minimum(b); + + return Rectangle(minimum, a.maximum(b) - minimum); + } + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return point || size;} + + + friend Z_CT(CPP11) Boolean operator ==(const Rectangle &lhs, const Rectangle &rhs) Z_NOTHROW + {return lhs.point == rhs.point && lhs.size == rhs.size;} + + + friend Z_CT(CPP11) Boolean operator !=(const Rectangle &lhs, const Rectangle &rhs) Z_NOTHROW + {return lhs.point != rhs.point || lhs.size != rhs.size;} + + + friend Z_CT(CPP14) Rectangle operator &(const Rectangle &lhs, const Rectangle &rhs) Z_NOTHROW + { + t x1, x2, y1, y2; + + return (x1 = maximum(lhs.point.x, rhs.point.x)) < + (x2 = minimum(lhs.point.x + lhs.size.x, rhs.point.x + rhs.size.x)) && + (y1 = maximum(lhs.point.y, rhs.point.y)) < + (y2 = minimum(lhs.point.y + lhs.size.y, rhs.point.y + rhs.size.y)) + + ? Rectangle(x1, y1, x2 - x1, y2 - y1) + : Rectangle(t(0)); + } + + + friend Z_CT(CPP14) Rectangle operator |(const Rectangle &lhs, const Rectangle &rhs) Z_NOTHROW + { + Rectangle result; + + result.point = lhs.point.minimum(rhs.point); + result.size = (lhs.point + lhs.size).maximum(rhs.point + rhs.size) - result.point; + return result; + } + + + friend Z_CT(CPP11) Rectangle operator +(const Rectangle &lhs, const XY &rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size + rhs);} + + + friend Z_CT(CPP11) Rectangle operator +(const XY &lhs, const Rectangle &rhs) Z_NOTHROW + {return Rectangle(rhs.point, rhs.size + lhs);} + + + friend Z_CT(CPP11) Rectangle operator +(const Rectangle &lhs, t rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size + rhs);} + + + friend Z_CT(CPP11) Rectangle operator +(t lhs, const Rectangle &rhs) Z_NOTHROW + {return Rectangle(rhs.point, rhs.size + lhs);} + + + friend Z_CT(CPP11) Rectangle operator -(const Rectangle &lhs, const XY &rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size - rhs);} + + + friend Z_CT(CPP11) Rectangle operator -(const Rectangle &lhs, t rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size - rhs);} + + + friend Z_CT(CPP11) Rectangle operator *(const Rectangle &lhs, const XY &rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size * rhs);} + + + friend Z_CT(CPP11) Rectangle operator *(const XY &lhs, const Rectangle &rhs) Z_NOTHROW + {return Rectangle(rhs.point, rhs.size * lhs);} + + + friend Z_CT(CPP11) Rectangle operator *(const Rectangle &lhs, t rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size * rhs);} + + + friend Z_CT(CPP11) Rectangle operator *(t lhs, const Rectangle &rhs) Z_NOTHROW + {return Rectangle(rhs.point, rhs.size * lhs);} + + + friend Z_CT(CPP11) Rectangle operator /(const Rectangle &lhs, const XY &rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size / rhs);} + + + friend Z_CT(CPP11) Rectangle operator /(const Rectangle &lhs, t rhs) Z_NOTHROW + {return Rectangle(lhs.point, lhs.size / rhs);} + + + Z_INLINE Rectangle &operator &=(const Rectangle &rhs) Z_NOTHROW {return *this = *this & rhs;} + Z_INLINE Rectangle &operator |=(const Rectangle &rhs) Z_NOTHROW {return *this = *this | rhs;} + + Z_INLINE Rectangle &operator +=(const XY &rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE Rectangle &operator -=(const XY &rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE Rectangle &operator *=(const XY &rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE Rectangle &operator /=(const XY &rhs) Z_NOTHROW {return *this = *this / rhs;} + + Z_INLINE Rectangle &operator +=(t rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE Rectangle &operator -=(t rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE Rectangle &operator *=(t rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE Rectangle &operator /=(t rhs) Z_NOTHROW {return *this = *this / rhs;} + + + Z_CT(CPP11) XY bottom() const Z_NOTHROW + {return XY(point.x + size.x / t(2), point.y);} + + + Z_CT(CPP11) XY bottom(t (* round)(t)) const Z_NOTHROW + {return XY(round(point.x + size.x / t(2)), point.y);} + + + Z_CT(CPP11) Rectangle bottom(const XY &size_) const Z_NOTHROW + {return Rectangle(point.x + (size.x - size_.x) / t(2), point.y, size_);} + + + Z_CT(CPP11) Rectangle bottom(const XY &size_, t (* round)(t)) const Z_NOTHROW + {return Rectangle(round(point.x + (size.x - size_.x) / t(2)), point.y, size_);} + + + Z_CT(CPP11) XY bottom_left() const Z_NOTHROW + {return point;} + + + Z_CT(CPP11) Rectangle bottom_left(const XY &size_) const Z_NOTHROW + {return Rectangle(point, size_);} + + + Z_CT(CPP11) XY bottom_right() const Z_NOTHROW + {return XY(point.x + size.x, point.y);} + + + Z_CT(CPP11) Rectangle bottom_right(const XY &size_) const Z_NOTHROW + {return Rectangle(point.x + size.x - size_.x, point.y, size_);} + + + Z_CT(CPP11) XY center() const Z_NOTHROW + {return point + size / t(2);} + + + Z_CT(CPP11) XY center(t (* round)(t)) const Z_NOTHROW + {return XY(round(point.x + size.x / t(2)), round(point.y + size.y / t(2)));} + + + Z_CT(CPP11) Rectangle center(const XY &size_) const Z_NOTHROW + {return Rectangle(point + (size - size_) / t(2), size_);} + + + Z_CT(CPP11) Rectangle center(const XY &size_, t (* round)(t)) const Z_NOTHROW + { + return Rectangle( + round(point.x + (size.x - size_.x) / t(2)), + round(point.y + (size.y - size_.y) / t(2)), + size); + } + + + Z_CT(CPP11) XY left() const Z_NOTHROW + {return XY(point.x, point.y + size.y / t(2));} + + + Z_CT(CPP11) XY left(t (* round)(t)) const Z_NOTHROW + {return XY(point.x, round(point.y + size.y / t(2)));} + + + Z_CT(CPP11) Rectangle left(const XY &size_) const Z_NOTHROW + {return Rectangle(point.x, point.y + (size.y - size_.y) / t(2), size_);} + + + Z_CT(CPP11) Rectangle left(const XY &size_, t (* round)(t)) const Z_NOTHROW + {return Rectangle(point.x, round(point.y + (size.y - size_.y) / t(2)), size_);} + + + Z_CT(CPP11) XY right() const Z_NOTHROW + {return XY(point.x + size.x, point.y + size.y / t(2));} + + + Z_CT(CPP11) XY right(t (* round)(t)) const Z_NOTHROW + {return XY(point.x + size.x, round(point.y + size.y / t(2)));} + + + Z_CT(CPP11) Rectangle right(const XY &size_) const Z_NOTHROW + { + return Rectangle( + point.x + size.x - size_.x, + point.y + (size.y - size_.y) / t(2), + size_); + } + + + Z_CT(CPP11) Rectangle right(const XY &size_, t (* round)(t)) const Z_NOTHROW + { + return Rectangle( + point.x + size.x - size_.x, + round(point.y + (size.y - size_.y) / t(2)), + size_); + } + + + Z_CT(CPP11) XY top() const Z_NOTHROW + {return XY(point.x + size.x / t(2), point.y + size.y);} + + + Z_CT(CPP11) XY top(t (* round)(t)) const Z_NOTHROW + {return XY(round(point.x + size.x / t(2)), point.y + size.y);} + + + Z_CT(CPP11) Rectangle top(const XY &size_) const Z_NOTHROW + { + return Rectangle( + point.x + (size.x - size_.x) / t(2), + point.y + size.y - size_.y, + size_); + } + + + Z_CT(CPP11) Rectangle top(const XY &size_, t (* round)(t)) const Z_NOTHROW + { + return Rectangle( + round(point.x + (size.x - size_.x) / t(2)), + point.y + size.y - size_.y, + size_); + } + + + Z_CT(CPP11) XY top_left() const Z_NOTHROW + {return XY(point.x, point.y + size.y);} + + + Z_CT(CPP11) Rectangle top_left(const XY &size_) const Z_NOTHROW + {return Rectangle(point.x, point.y + size.y - size_.y, size_);} + + + Z_CT(CPP11) XY top_right() const Z_NOTHROW + {return point + size;} + + + Z_CT(CPP11) Rectangle top_right(const XY &size_) const Z_NOTHROW + {return Rectangle(point + size - size_, size_);} + + + + + + + + + Z_CT(CPP11) Rectangle bottom_half() const Z_NOTHROW + {return Rectangle(point, size.x, size.y / t(2));} + + + Z_CT(CPP11) Rectangle bottom_left_quarter() const Z_NOTHROW + {return Rectangle(point, size / t(2));} + + + + + + + + + Z_CT(CPP11) Boolean contains(const Rectangle &other) const Z_NOTHROW + { + return !other.size.has_zero() && + other.point >= point && + other.point + other.size <= point + size; + } + + + Z_CT(CPP11) Boolean contains(const XY &point_) const Z_NOTHROW + {return point_ >= point && point_ < point + size;} + + + Z_INLINE Rectangle &correct() Z_NOTHROW + { + if (size.x < t(0)) point.x -= (size.x = -size.x); + if (size.y < t(0)) point.y -= (size.y = -size.y); + return *this; + } + + + Z_CT(CPP14) Rectangle fit_bottom(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point.x + (size.x - fitting_size.x) / t(2), point.y, fitting_size); + } + + + Z_CT(CPP11) Rectangle fit_bottom_left(const XY &size_) const Z_NOTHROW + {return Rectangle(point, size_.fit(size));} + + + Z_CT(CPP14) Rectangle fit_bottom_right(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point.x + size.x - fitting_size.x, point.y, fitting_size); + } + + + Z_CT(CPP14) Rectangle fit(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point + (size - fitting_size) / t(2), fitting_size); + } + + + Z_CT(CPP14) Rectangle fit_left(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point.x, point.y + (size.y - fitting_size.y) / t(2), fitting_size); + } + + + Z_CT(CPP14) Rectangle fit_right(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle( + point.x + size.x - fitting_size.x, + point.y + (size.y - fitting_size.y) / t(2), + fitting_size); + } + + + Z_CT(CPP14) Rectangle fit_top(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle( + point.x + (size.x - fitting_size.x) / t(2), + point.y + size.y - fitting_size.y, + fitting_size); + } + + + Z_CT(CPP14) Rectangle fit_top_left(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point.x, point.y + size.y - fitting_size.y, fitting_size); + } + + + Z_CT(CPP14) Rectangle fit_top_right(const XY &size_) const Z_NOTHROW + { + XY fitting_size = size_.fit(size); + + return Rectangle(point + size - fitting_size, fitting_size); + } + + + Z_CT(CPP11) Rectangle grow_from_bottom_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x - delta.x / t(2), point.y, size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_bottom_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point, size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_bottom_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x - delta.x, point.y, size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point - delta / t(2), size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_center_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x, point.y - delta.y / t(2), size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_center_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x - delta.x, point.y - delta.y / t(2), size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_top_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x - delta.x / t(2), point.y - delta.y, size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_top_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x, point.y - delta.y, size + delta);} + + + Z_CT(CPP11) Rectangle grow_from_top_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point - delta, size + delta);} + + + Z_CT(CPP11) Rectangle grow_in_x_from_center(t delta) const Z_NOTHROW + {return Rectangle(point.x - delta / t(2), point.y, size.x + delta, size.y);} + + + Z_CT(CPP11) Rectangle grow_in_x_from_left(t delta) const Z_NOTHROW + {return Rectangle(point, size.x + delta, size.y);} + + + Z_CT(CPP11) Rectangle grow_in_x_from_right(t delta) const Z_NOTHROW + {return Rectangle(point.x - delta, point.y, size.x + delta, size.y);} + + + Z_CT(CPP11) Rectangle grow_in_y_from_bottom(t delta) const Z_NOTHROW + {return Rectangle(point, size.x, size.y + delta);} + + + Z_CT(CPP11) Rectangle grow_in_y_from_center(t delta) const Z_NOTHROW + {return Rectangle(point.x, point.y - delta / t(2), size.x, size.y + delta);} + + + Z_CT(CPP11) Rectangle grow_in_y_from_top(t delta) const Z_NOTHROW + {return Rectangle(point.x, point.y - delta, size.x, size.y + delta);} + + + Z_CT(CPP11) Boolean intersects(const Rectangle &other) const Z_NOTHROW + { + return !size.has_zero() && + !other.size.has_zero() && + other.point + other.size > point && + other.point < point + size; + } + + + Z_CT(CPP11) Boolean is_zero() const Z_NOTHROW + {return point.is_zero() && size.is_zero();} + + + Z_CT(CPP11) Rectangle left_half () const Z_NOTHROW + {return Rectangle(point, size.x / t(2), size.y);} + + + Z_CT(CPP11) t maximum_x() const Z_NOTHROW {return point.x + size.x;} + Z_CT(CPP11) t maximum_y() const Z_NOTHROW {return point.y + size.y;} + Z_CT(CPP11) t middle_x () const Z_NOTHROW {return point.x + size.x / t(2);} + Z_CT(CPP11) t middle_y () const Z_NOTHROW {return point.y + size.y / t(2);} + Z_CT(CPP11) t minimum_x() const Z_NOTHROW {return point.x;} + Z_CT(CPP11) t minimum_y() const Z_NOTHROW {return point.y;} + + + Z_CT(CPP11) Rectangle shrink_from_bottom_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x + delta.x / t(2), point.y, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_bottom_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_bottom_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x + delta.x, point.y, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point + delta / t(2), size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_center_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x, point.y + delta.y / t(2), size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_center_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x + delta.x, point.y + delta.y / t(2), size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_top_center(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x + delta.x / t(2), point.y + delta.y, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_top_left(const XY &delta) const Z_NOTHROW + {return Rectangle(point.x, point.y + delta.y, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_from_top_right(const XY &delta) const Z_NOTHROW + {return Rectangle(point + delta, size - delta);} + + + Z_CT(CPP11) Rectangle shrink_in_x_from_center(t delta) const Z_NOTHROW + {return Rectangle(point.x + delta / t(2), point.y, size.x - delta, size.y);} + + + Z_CT(CPP11) Rectangle shrink_in_x_from_left(t delta) const Z_NOTHROW + {return Rectangle(point, size.x - delta, size.y);} + + + Z_CT(CPP11) Rectangle shrink_in_x_from_right(t delta) const Z_NOTHROW + {return Rectangle(point.x + delta, point.y, size.x - delta, size.y);} + + + Z_CT(CPP11) Rectangle shrink_in_y_from_bottom(t delta) const Z_NOTHROW + {return Rectangle(point, size.x, size.y - delta);} + + + Z_CT(CPP11) Rectangle shrink_in_y_from_center(t delta) const Z_NOTHROW + {return Rectangle(point.x, point.y + delta / t(2), size.x, size.y - delta);} + + + Z_CT(CPP11) Rectangle shrink_in_y_from_top(t delta) const Z_NOTHROW + {return Rectangle(point.x, point.y + delta, size.x, size.y - delta);} + + + + + + + + + + + + + + + + + + + + + + + + + + Z_CT(CPP11) XY absolute_point_to_unit(const XY &point_) const Z_NOTHROW + {return (point_ - point) / size;} + + + Z_CT(CPP11) Rectangle bottom_right_quarter() const Z_NOTHROW + {return Rectangle(point.x + size.x / t(2), point.y, size / t(2));} + + + Z_CT(CPP11) Rectangle right_half() const Z_NOTHROW + {return Rectangle(point.x + size.x / t(2), point.y, size.x / t(2), size.y);} + + + Z_CT(CPP11) Rectangle top_half() const Z_NOTHROW + {return Rectangle(point.x, point.y + size.y / t(2), size.x, size.y / t(2));} + + + Z_CT(CPP11) Rectangle top_left_quarter() const Z_NOTHROW + {return Rectangle(point.x, point.y + size.y / t(2), size / t(2));} + + + Z_CT(CPP11) Rectangle top_right_quarter() const Z_NOTHROW + {return Rectangle(point + size / t(2), size / t(2));} + + + Z_CT(CPP11) XY unit_point_to_absolute(const XY &point_) const Z_NOTHROW + {return point + point_ * size;} + + + +# ifdef Z_WITH_COCOS2D_X + + Z_INLINE Rectangle(const cocos2d::Rect &rectangle) + : point(rectangle.origin), size(rectangle.size) {} + + + Z_INLINE operator cocos2d::Rect() const + {return cocos2d::Rect(float(point.x), float(point.y), float(size.x), float(size.y));} + +# endif + + +# if defined(Z_WITH_CORE_FOUNDATION) || defined(Z_WITH_FOUNDATION) + +# define Z_z_APPLE_CONSTRUCTORS(Prefix) \ + \ + Z_CT(CPP11) Rectangle(const Prefix##Rect &rectangle) Z_NOTHROW \ + : point(rectangle.origin), size(rectangle.size) {} \ + \ + \ + Z_CT(CPP11) Rectangle(const Prefix##Point &point_) Z_NOTHROW \ + : point(t(0)), size(point_) {} \ + \ + \ + Z_CT(CPP11) Rectangle(const Prefix##Size &size_) Z_NOTHROW \ + : point(t(0)), size(size_) {} + + +# if Z_DIALECT_HAS(CPP11, COPY_LIST_INITIALIZATION) + +# define Z_z_APPLE_OPERATORS(Prefix) \ + \ + Z_CT(CPP11) operator Prefix##Rect() const Z_NOTHROW \ + { \ + return {{CGFloat(point.x), CGFloat(point.y)}, \ + {CGFloat(size.x), CGFloat(size.y)}}; \ + } + +# else +# define Z_z_APPLE_OPERATORS(Prefix) \ + \ + Z_CT(CPP14) operator Prefix##Rect() const Z_NOTHROW \ + { \ + Prefix##Rect result = { \ + {CGFloat(point.x), CGFloat(point.y)}, \ + {CGFloat(size.x), CGFloat(size.y)}}; \ + \ + return result; \ + } +# endif + + +# ifdef Z_WITH_CORE_FOUNDATION + Z_z_APPLE_CONSTRUCTORS(CG) + Z_z_APPLE_OPERATORS (CG) +# endif + +# if defined(Z_WITH_FOUNDATION) && \ + Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) && \ + (!defined(Z_WITH_CORE_FOUNDATION) || \ + !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) || \ + !NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) + + Z_z_APPLE_CONSTRUCTORS(NS) + Z_z_APPLE_OPERATORS (NS) +# endif + +# undef Z_z_APPLE_CONSTRUCTORS +# undef Z_z_APPLE_OPERATORS + +# endif + + +# ifdef Z_WITH_QT + + Z_CT(CPP11) Rectangle(const QRect &rectangle) Z_NOTHROW + : point(rectangle.topLeft()), size(rectangle.size()) {} + + + Z_CT(CPP11) Rectangle(const QPoint &point_) Z_NOTHROW + : point(t(0)), size(point) {} + + + Z_CT(CPP11) Rectangle(const QSize &size_) Z_NOTHROW + : point(t(0)), size(size_) {} + + + Z_CT(CPP11) operator QRect() const Z_NOTHROW + {return QRect(int(point.x), int(point.y), int(size.x), int(size.y));} + +# endif +};} + + +#endif // Z_classes_Rectangle_HPP diff --git a/projects/Zeta/API/Z/classes/Reference.hpp b/projects/Zeta/API/Z/classes/Reference.hpp new file mode 100644 index 0000000..87c1217 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Reference.hpp @@ -0,0 +1,39 @@ +/* Zeta API - Z/classes/Reference.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Reference_HPP +#define Z_classes_Reference_HPP + +#include + + +namespace Zeta {template struct Reference { + typedef t type; + + t *value; + + + Z_CT(CPP11) Reference(t &value_) Z_NOTHROW + : value(&value_) {} + + +# if Z_DIALECT_HAS(CPP11, DELETED_FUNCTION) + Z_CT(CPP11) Reference(t &&value_) = delete; +# endif + + + Z_CT(CPP11) operator t &() const Z_NOTHROW + {return *value;} + + + Z_CT(CPP11) t &get() const Z_NOTHROW + {return *value;} +};} + + +#endif // Z_classes_Span_HPP diff --git a/projects/Zeta/API/Z/classes/Selector.hpp b/projects/Zeta/API/Z/classes/Selector.hpp new file mode 100644 index 0000000..39d93a0 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Selector.hpp @@ -0,0 +1,128 @@ +/* Zeta API - Z/classes/Selector.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Selector_HPP +#define Z_classes_Selector_HPP + +#include + +#if Z_DIALECT_HAS(CPP98, SFINAE) && \ + Z_DIALECT_HAS(CPP11, VARIADIC_TEMPLATE) && \ + Z_DIALECT_HAS(CPP11, DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE) + +# include +# include + +# if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) +# include +# endif + +# define Z_HAS_Selector 1 + + + namespace Zeta { + template struct Selector; + + + template + struct Selector { + typedef r (* Send )(id, SEL, p...); + typedef r (* SendSuper)(objc_super *, SEL, p...); + + SEL selector; + + + Z_INLINE Selector() + Z_DEFAULTED({}) + + + Z_INLINE Selector(SEL selector_) + : selector(selector_) {} + + + Z_INLINE operator SEL() const Z_NOTHROW + {return selector;} + + + Z_INLINE r operator ()(id object, typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + return (Send(ObjectiveC::send())) + (object, selector, arguments...); + } + + + Z_INLINE r super(id object, typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + objc_super object_super = {object, class_getSuperclass(object_getClass(object))}; + + return (SendSuper(ObjectiveC::send_super())) + (&object_super, selector, arguments...); + } + + + Z_INLINE r super(const objc_super &object_super, typename Type

::to_forwardable... arguments) const Z_NOTHROW + { + return (SendSuper(ObjectiveC::send_super())) + (const_cast(&object_super), selector, arguments...); + } + }; + + +# if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) + template + struct Selector { + typedef r (* Send )(id, SEL, p..., ...); + typedef r (* SendSuper)(objc_super *, SEL, p..., ...); + + SEL selector; + + + Z_INLINE Selector() + Z_DEFAULTED({}) + + + Z_INLINE Selector(SEL selector) + : selector(selector) {} + + + Z_INLINE operator SEL() const Z_NOTHROW + {return selector;} + + + template + Z_INLINE r operator ()(id object, pp&&... arguments) const Z_NOTHROW + { + return (Send(ObjectiveC::send())) + (object, selector, forwardable(arguments)...); + } + + + template + Z_INLINE r super(id object, pp&&... arguments) const Z_NOTHROW + { + objc_super object_super = {object, class_getSuperclass(object_getClass(object))}; + + return (SendSuper(ObjectiveC::send_super())) + (&object_super, selector, forwardable(arguments)...); + } + + + template + Z_INLINE r super(const objc_super &object_super, pp&&... arguments) const Z_NOTHROW + { + return (SendSuper(ObjectiveC::send_super())) + (const_cast(&object_super), selector, forwardable(arguments)...); + } + }; +# endif + } + + +#endif + +#endif // Z_classes_Selector_HPP diff --git a/projects/Zeta/API/Z/classes/Shared.hpp b/projects/Zeta/API/Z/classes/Shared.hpp new file mode 100644 index 0000000..96fa8ab --- /dev/null +++ b/projects/Zeta/API/Z/classes/Shared.hpp @@ -0,0 +1,177 @@ +/* Zeta API - Z/classes/Shared.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Shared_HPP +#define Z_classes_Shared_HPP + +#include +#include +#include +#include + + +namespace Zeta {template struct Shared { + + struct Owned { + t* data; + USize owner_count; + + + Z_INLINE Owned(t *data) Z_NOTHROW + : data(data), owner_count(1) {} + + + Z_INLINE ~Owned() + {delete data;} + + }; + + Owned *owned; + + + Z_CT(CPP11) Shared() Z_NOTHROW + : owned(Z_NULL) {} + + + Z_INLINE Shared(const Shared &other) Z_NOTHROW + {if ((owned = other.owned)) owned->owner_count++;} + + + Z_INLINE Shared(t *data) Z_NOTHROW + {owned = data ? new Owned(data) : Z_NULL;} + + + Z_INLINE ~Shared() + {if (owned && !--owned->owner_count) delete owned;} + + + Z_INLINE operator Boolean() const Z_NOTHROW + {return Boolean(owned);} + + + Z_INLINE Shared &operator =(const Shared &rhs) + { + if (owned != rhs.owned) + { + if (owned && !--owned->owner_count) delete owned; + if ((owned = rhs.owned)) owned->owner_count++; + } + + return *this; + } + + + Z_INLINE Shared &operator =(t *rhs) + { + if (owned) + { + if (owned->data == rhs) return *this; + if (!--owned->owner_count) delete owned; + } + + owned = rhs ? new Owned(rhs) : Z_NULL; + return *this; + } + + + friend Z_INLINE Boolean operator ==(const Shared &lhs, const Shared &rhs) Z_NOTHROW + {return lhs.owned == rhs.owned;} + + + friend Z_INLINE Boolean operator !=(const Shared &lhs, const Shared &rhs) Z_NOTHROW + {return lhs.owned != rhs.owned;} + + + Z_INLINE t &operator *() const Z_NOTHROW + {return *owned->data;} + + + Z_INLINE t *operator ->() const Z_NOTHROW + {return owned->data;} + + + Z_INLINE t *get() const Z_NOTHROW + {return owned ? owned->data : Z_NULL;} + + + Z_INLINE USize owner_count() const Z_NOTHROW + {return owned->owner_count;} + + + Z_INLINE void reset() + { + if (owned && !--owned->owner_count) delete owned; + owned = Z_NULL; + } + + + Z_INLINE void swap(Shared &other) Z_NOTHROW + { + Owned *ex = owned; + + owned = other.owned; + other.owned = ex; + } + + +# ifdef Z_NULLPTR + + Z_CT(CPP11) Shared(NullPtr) Z_NOTHROW + : owned(nullptr) {} + + + Z_INLINE Shared &operator =(NullPtr) + { + if (owned && !--owned->owner_count) delete owned; + owned = nullptr; + return *this; + } + + + friend Z_INLINE Boolean operator ==(const Shared &lhs, NullPtr) Z_NOTHROW + {return !lhs.owned;} + + + friend Z_INLINE Boolean operator ==(NullPtr, const Shared &rhs) Z_NOTHROW + {return !rhs.owned;} + + + friend Z_INLINE Boolean operator !=(const Shared &lhs, NullPtr) Z_NOTHROW + {return !!lhs.owned;} + + + friend Z_INLINE Boolean operator !=(NullPtr, const Shared &rhs) Z_NOTHROW + {return !!rhs.owned;} + +# endif + + +# if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) + + Z_INLINE Shared(Shared &&other) Z_NOTHROW + : owned(other.owned) + {other.owned = Z_NULL;} + + + Z_INLINE Shared &operator =(Shared &&rhs) + { + if (owned != rhs.owned) + { + if (owned && !--owned->owner_count) delete owned; + owned = rhs.owned; + rhs.owned = Z_NULL; + } + + return *this; + } + +# endif +};} + + +#endif // Z_classes_Shared_HPP diff --git a/projects/Zeta/API/Z/classes/SizedString.hpp b/projects/Zeta/API/Z/classes/SizedString.hpp new file mode 100644 index 0000000..ab58095 --- /dev/null +++ b/projects/Zeta/API/Z/classes/SizedString.hpp @@ -0,0 +1,55 @@ +/* Zeta API - Z/classes/SizedString.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_SizedString_HPP +#define Z_classes_SizedString_HPP + +#include +#include + + +namespace Zeta{namespace ZetaDetail { + + template > struct SizedString; + + + template + struct SizedString > { + t data[s]; + + + Z_CT(CPP11) SizedString(const t (&string)[s]) Z_NOTHROW + : data{string[i]..., 0} {} + + + Z_CT(CPP11) SizedString(const StringView &string_view) Z_NOTHROW + : data{string_view.data[i]..., 0} {} + }; +}} + + +namespace Zeta{template struct SizedString : ZetaDetail::SizedString { + + Z_CT(CPP11) SizedString(const t (&string)[s]) Z_NOTHROW + : ZetaDetail::SizedString(string) {} + + + Z_CT(CPP11) SizedString(const StringView &string_view) Z_NOTHROW + : ZetaDetail::SizedString(string_view) {} + + + Z_CT(CPP11) operator const t *() const Z_NOTHROW + {return this->data;} + + + Z_CT(CPP11) const t &operator [](USize index) const Z_NOTHROW + {return this->data[index];} +};} + + +#endif // Z_classes_SizedString_HPP diff --git a/projects/Zeta/API/Z/classes/Span.hpp b/projects/Zeta/API/Z/classes/Span.hpp new file mode 100644 index 0000000..d25300f --- /dev/null +++ b/projects/Zeta/API/Z/classes/Span.hpp @@ -0,0 +1,78 @@ +/* Zeta API - Z/classes/Span.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Span_HPP +#define Z_classes_Span_HPP + +#include +#include +#include + + +namespace Zeta {template struct Span { + typedef const t* const_pointer; + typedef const t& const_reference; + typedef PtrDiff difference_type; + typedef t element_type; +// typedef Iterator iterator; + typedef t* pointer; + typedef t& reference; +// typedef Iterator reverse_iterator; + typedef USize size_type; + typedef typename Type::remove_const_volatile value_type; + + t* data; + USize size; + + + Z_CT(CPP11) Span(t *first, USize size_) Z_NOTHROW + : data(first), size(size_) {} + + + Z_CT(CPP11) Span(t *first, t *last) Z_NOTHROW + : data(first), size(last - first) {} + + + Z_CT(CPP11) t &operator [](USize index) const Z_NOTHROW + {return data[index];} + + + Z_CT(CPP11) t &first() const Z_NOTHROW + {return data[0];} + + + Z_CT(CPP11) t &last() const Z_NOTHROW + {return data[size - 1];} + + + Z_CT(CPP11) Span head(USize head_size) const Z_NOTHROW + {return Span(data, head_size);} + + + Z_CT(CPP11) Span tail(USize tail_size) const Z_NOTHROW + {return Span(&data[size - tail_size], tail_size);} + + + Z_CT(CPP11) Span range(USize range_index, USize range_size) const Z_NOTHROW + {return Span(&data[range_index], range_size);} + + + Z_CT(CPP11) Span range(const Range &range) const Z_NOTHROW + {return Span(&data[range.index], range.size);} + + +/* Z_CT(CPP11) Iterator begin() const Z_NOTHROW + {return Iterator(*this, 0);} + + + Z_CT(CPP11) Iterator end() const Z_NOTHROW + {return Iterator(*this, size);}*/ +};} + + +#endif // Z_classes_Span_HPP diff --git a/projects/Zeta/API/Z/classes/Strid.hpp b/projects/Zeta/API/Z/classes/Strid.hpp new file mode 100644 index 0000000..b081762 --- /dev/null +++ b/projects/Zeta/API/Z/classes/Strid.hpp @@ -0,0 +1,60 @@ +/* Zeta API - Z/classes/Strid.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Strid_HPP +#define Z_classes_Strid_HPP + +#include + + +namespace Zeta {struct Strid { + UInt64 hash; + + + Z_INLINE Strid() Z_NOTHROW + Z_DEFAULTED({}) + + + Z_CT(CPP11) Strid(UInt64 hash_) Z_NOTHROW + : hash(hash_) {} + + + Z_CT(CPP14) Strid(const Char *string) Z_NOTHROW + : hash(fnv1a_64(string)) {} + + + Z_CT(CPP11) operator UInt64() const Z_NOTHROW + {return hash;} + + + friend Z_CT(CPP11) Boolean operator ==(const Strid &lhs, const Strid &rhs) Z_NOTHROW + {return lhs.hash == rhs.hash;} + + + friend Z_CT(CPP11) Boolean operator ==(const Strid &lhs, UInt64 rhs) Z_NOTHROW + {return lhs.hash == rhs;} + + + friend Z_CT(CPP11) Boolean operator ==(UInt64 lhs, const Strid &rhs) Z_NOTHROW + {return lhs == rhs.hash;} + + + friend Z_CT(CPP11) Boolean operator !=(const Strid &lhs, const Strid &rhs) Z_NOTHROW + {return lhs.hash != rhs.hash;} + + + friend Z_CT(CPP11) Boolean operator !=(const Strid &lhs, UInt64 rhs) Z_NOTHROW + {return lhs.hash != rhs;} + + + friend Z_CT(CPP11) Boolean operator !=(UInt64 lhs, const Strid &rhs) Z_NOTHROW + {return lhs != rhs.hash;} +};} + + +#endif // Z_classes_Strid_HPP diff --git a/projects/Zeta/API/Z/classes/StringView.hpp b/projects/Zeta/API/Z/classes/StringView.hpp new file mode 100644 index 0000000..44ef887 --- /dev/null +++ b/projects/Zeta/API/Z/classes/StringView.hpp @@ -0,0 +1,112 @@ +/* Zeta API - Z/classes/StringView.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_StringView_HPP +#define Z_classes_StringView_HPP + +#include +#include +#include +#include + +#ifdef Z_WITH_STDCPP +# include +#endif + +namespace Zeta {template struct StringView { +// typedef Iterator const_iterator; +// typedef Iterator const_reverse_iterator; + typedef const t* const_pointer; + typedef const t& const_reference; + typedef PtrDiff difference_type; +// typedef Iterator iterator; + typedef t* pointer; + typedef t& reference; +// typedef Iterator reverse_iterator; + typedef USize size_type; + typedef t value_type; + + const t* data; + USize size; + + + Z_CT(CPP11) StringView() Z_NOTHROW + : data(Z_NULL), size(0) {} + + + Z_CT(CPP11) StringView(const t *data_, USize size_) Z_NOTHROW + : data(data_), size(size_) {} + + + template + Z_CT(CPP11) StringView(const t (&data_)[s]) Z_NOTHROW + : data(data_), size(s - 1) {} + + + Z_CT(CPP11) const t &operator [](USize index) const Z_NOTHROW + {return data[index];} + + +/* Z_CT(CPP11) iterator begin() const Z_NOTHROW + {} + + + Z_CT(CPP11) iterator end() const Z_NOTHROW + {}*/ + + +# ifdef Z_WITH_STDCPP + + friend Z_INLINE Boolean operator ==(const StringView &lhs, const StringView &rhs) Z_NOTHROW + {return lhs.size == rhs.size && !std::memcmp(lhs.data, rhs.data, lhs.size * sizeof(t));} + + + friend Z_INLINE Boolean operator !=(const StringView &lhs, const StringView &rhs) Z_NOTHROW + {return lhs.size != rhs.size || std::memcmp(lhs.data, rhs.data, lhs.size * sizeof(t));} + + + template + friend Z_INLINE Boolean operator ==(const StringView &lhs, const t (&rhs)[s]) Z_NOTHROW + {return lhs.size == (s - 1) && !std::memcmp(lhs.data, rhs, (s - 1) * sizeof(t));} + + + template + friend Z_INLINE Boolean operator !=(const StringView &lhs, const t (&rhs)[s]) Z_NOTHROW + {return lhs.size != (s - 1) || std::memcmp(lhs.data, rhs, (s - 1) * sizeof(t));} + + + friend Z_INLINE Boolean operator ==(const StringView &lhs, const t *rhs) Z_NOTHROW + {return lhs.size * sizeof(t) == std::strlen(rhs) && !std::memcmp(lhs.data, rhs, lhs.size * sizeof(t));} + + + friend Z_INLINE Boolean operator !=(const StringView &lhs, const t *rhs) Z_NOTHROW + {return lhs.size * sizeof(t) != std::strlen(rhs) || std::memcmp(lhs.data, rhs, lhs.size * sizeof(t));} + + + template + friend Z_INLINE Boolean operator ==(const t (&lhs)[s], const StringView &rhs) Z_NOTHROW + {return rhs.size == (s - 1) && !std::memcmp(rhs.data, lhs, (s - 1) * sizeof(t));} + + + template + friend Z_INLINE Boolean operator !=(const t (&lhs)[s], const StringView &rhs) Z_NOTHROW + {return rhs.size != (s - 1) || std::memcmp(rhs.data, lhs, (s - 1) * sizeof(t));} + + + friend Z_INLINE Boolean operator ==(const t *lhs, const StringView &rhs) Z_NOTHROW + {return rhs.size * sizeof(t) == std::strlen(lhs) && !std::memcmp(rhs.data, lhs, rhs.size * sizeof(t));} + + + friend Z_INLINE Boolean operator !=(const t *lhs, const StringView &rhs) Z_NOTHROW + {return rhs.size * sizeof(t) != std::strlen(lhs) || std::memcmp(rhs.data, lhs, rhs.size * sizeof(t));} + +# endif +};} + + +#endif // Z_classes_StringView_HPP diff --git a/projects/Zeta/API/Z/classes/TripleBuffer.hpp b/projects/Zeta/API/Z/classes/TripleBuffer.hpp new file mode 100644 index 0000000..43b9cef --- /dev/null +++ b/projects/Zeta/API/Z/classes/TripleBuffer.hpp @@ -0,0 +1,107 @@ +/* Zeta API - Z/classes/TripleBuffer.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_TripleBuffer_HPP +#define Z_classes_TripleBuffer_HPP + +#include +#include +#include +#include +#include + + +namespace Zeta {struct TripleBuffer : ZTripleBuffer { + + Z_INLINE TripleBuffer() Z_NOTHROW + Z_DEFAULTED({}) + + + Z_INLINE TripleBuffer(void *slot_0, void *slot_1, void *slot_2) Z_NOTHROW + {initialize(slot_0, slot_1, slot_2);} + + + Z_INLINE void initialize(void *slot_0, void *slot_1, void *slot_2) Z_NOTHROW + { + slots[0] = slot_0; + slots[1] = slot_1; + slots[2] = slot_2; + f = 6; + } + + + /// @brief Marks the current consumption slot as consumed. + /// + /// @return A pointer to the new consumption slot. + + Z_INLINE void *consume() Z_NOTHROW + { + UChar fi, fo; + + do { + if (!((fi = f) & 64)) return Z_NULL; + fo = UChar((fi & 48) | ((fi & 12) >> 2) | ((fi & 3) << 2)); + } + while (!z_T_atomic_set_if_equal(UCHAR)(&f, fi, fo)); + + return slots[fo & 3]; + } + + + /// @brief Gets a pointer to the current consumption slot. + /// + /// @return A pointer to the current consumption slot. + + Z_CT(CPP11) void *consumption() const Z_NOTHROW + {return slots[f & 3];} + + + /// @brief Gets the index of the current consumption slot. + /// + /// @return The index of the current consumption slot. + + Z_CT(CPP11) UChar consumption_index() const Z_NOTHROW + {return f & 3;} + + + /// @brief Marks the the current production slot as produced. + /// + /// @return A pointer to the new production slot. + + Z_INLINE void *produce() Z_NOTHROW + { + UChar fi, fo; + + do { + fi = f; + fo = UChar(64 | ((fi & 48) >> 2) | ((fi & 12) << 2) | (fi & 3)); + } + while (!z_T_atomic_set_if_equal(UCHAR)(&f, fi, fo)); + + return slots[(fo & 48) >> 4]; + } + + + /// @brief Gets a pointer to the production slot. + /// + /// @return A pointer to the current production slot. + + Z_CT(CPP11) void *production() const Z_NOTHROW + {return slots[(f & 48) >> 4];} + + + /// @brief Gets the index of the current production slot. + /// + /// @return The index of the current production slot. + + Z_CT(CPP11) UChar production_index() const Z_NOTHROW + {return (f & 48) >> 4;} +};} + + +#endif // Z_classes_TripleBuffer_HPP diff --git a/projects/Zeta/API/Z/classes/Tuple.hpp b/projects/Zeta/API/Z/classes/Tuple.hpp new file mode 100644 index 0000000..4151aac --- /dev/null +++ b/projects/Zeta/API/Z/classes/Tuple.hpp @@ -0,0 +1,143 @@ +/* Zeta API - Z/classes/Tuple.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_Tuple_HPP +#define Z_classes_Tuple_HPP + +#include + +#if Z_DIALECT_HAS(CPP11, EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS) /* ¿No es necesario, basta con VARIADIC_TEMPLATE? */ +# include + +# define Z_HAS_Tuple 1 + + + namespace Zeta {namespace ZetaDetail {namespace Tuple { + + template struct Element; + + + template struct Super { + typedef Element, 1>::type> type; + }; + + + template + struct Element > { + typedef t0 type; + + type value; + + Z_INLINE Element() + Z_DEFAULTED({}) + + + Z_CT(CPP11) Element(typename Zeta::Type::to_forwardable value) + : value(value) {} + }; + + + template + struct Element > : Super::type { + typedef tn type; + + type value; + + Z_INLINE Element() + Z_DEFAULTED({}) + + + Z_CT(CPP11) Element( + typename Zeta::Type::to_forwardable... previous, + typename Zeta::Type::to_forwardable value + ) : Super::type(previous...), value(value) {} + }; + }}} + + + namespace Zeta {template class Tuple : public ZetaDetail::Tuple::Super::type { + private: + typedef typename ZetaDetail::Tuple::Super::type Super; + + public: + template class At { + + private: + enum {tail_size = TypeCount::value - (i + 1)}; + + public: + typedef ZetaDetail::Tuple::Element, tail_size>::type, 1 + >::type> Element; + + typedef typename Element::type type; + }; + + +# if !Z_DIALECT_HAS(CPP11, INHERITING_CONSTRUCTORS) + using Super::Super; + +# else + Z_INLINE Tuple() + Z_DEFAULTED({}) + + + Z_CT(CPP11) Tuple(typename Type::to_forwardable... values) + : Super(values...) {} +# endif + + + template + Z_INLINE typename At::type &at() Z_NOTHROW + {return At::Element::value;} + + + template + Z_CT(CPP11) typename Type::type>::to_forwardable get() const Z_NOTHROW + {return At::Element::value;} + + + template + Z_INLINE Tuple &set(typename Type::type>::to_forwardable value) + { + At::Element::value = value; + return *this; + } + };} + + +# if defined(Z_WITH_STD) && \ + Z_DIALECT_HAS(CPP17, STRUCTURED_BINDING) && \ + defined(__has_include) && \ + __has_include() + +# include + +# define Z_z_IMPLEMENTATION(qualifiers) \ + \ + template \ + struct std::tuple_size > { \ + enum {value = sizeof...(t)}; \ + }; \ + \ + template \ + struct std::tuple_element > { \ + typedef typename Zeta::Type::template At::type>::add_const type; \ + }; + + Z_z_IMPLEMENTATION(Z_EMPTY ) + Z_z_IMPLEMENTATION(const ) + Z_z_IMPLEMENTATION(const volatile) + Z_z_IMPLEMENTATION( volatile) + +# undef Z_z_IMPLEMENTATION +# endif + +#endif + +#endif // Z_classes_Tuple_HPP diff --git a/projects/Zeta/API/Z/classes/XY.hpp b/projects/Zeta/API/Z/classes/XY.hpp new file mode 100644 index 0000000..ecb8edb --- /dev/null +++ b/projects/Zeta/API/Z/classes/XY.hpp @@ -0,0 +1,501 @@ +/* Zeta API - Z/classes/XY.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_XY_HPP +#define Z_classes_XY_HPP + +#include + +#ifdef Z_WITH_CORE_FOUNDATION +# include +#endif + +#if defined(Z_WITH_FOUNDATION) && Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) +# import +#endif + +#ifdef Z_WITH_COCOS2D_X +# include "cocos2d.h" +#endif + +#ifdef Z_WITH_QT +# include +# include +# include +#endif + +namespace Zeta {template struct XYZ;} + + +namespace Zeta {template struct XY { + t x, y; + + Z_INLINE XY() Z_NOTHROW Z_DEFAULTED({}) + + Z_CT(CPP11) XY(t x_, t y_) Z_NOTHROW + : x(x_), y(y_) {} + + + Z_CT(CPP11) XY(t xy) Z_NOTHROW + : x(xy), y(xy) {} + + + Z_CT(CPP11) XY(const XYZ &xy) Z_NOTHROW + : x(xy.x), y(xy.y) {} + + +# if Z_DIALECT_HAS(CPP98, SFINAE) && \ + Z_DIALECT_HAS(CPP11, DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE) + + template ::value>::type> + Z_CT(CPP11) XY(const XY &other) Z_NOTHROW + : x(t(other.x)), y(t(other.y)) {} +# endif + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return x != t(0) || y != t(0);} + + + friend Z_CT(CPP11) Boolean operator ==(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x == rhs.x && lhs.y == rhs.y;} + + + friend Z_CT(CPP11) Boolean operator !=(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x != rhs.x || lhs.y != rhs.y;} + + + friend Z_CT(CPP11) Boolean operator >=(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x >= rhs.x && lhs.y >= rhs.y;} + + + friend Z_CT(CPP11) Boolean operator <=(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x <= rhs.x && lhs.y <= rhs.y;} + + + friend Z_CT(CPP11) Boolean operator >(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x > rhs.x && lhs.y > rhs.y;} + + + friend Z_CT(CPP11) Boolean operator <(const XY &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x < rhs.x && lhs.y < rhs.y;} + + + friend Z_CT(CPP11) XY operator +(const XY &lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs.x + rhs.x, lhs.y + rhs.y);} + + + friend Z_CT(CPP11) XY operator -(const XY &lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs.x - rhs.x, lhs.y - rhs.y);} + + + friend Z_CT(CPP11) XY operator *(const XY &lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs.x * rhs.x, lhs.y * rhs.y);} + + + friend Z_CT(CPP11) XY operator /(const XY &lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs.x / rhs.x, lhs.y / rhs.y);} + + + friend Z_CT(CPP11) Boolean operator ==(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x == rhs && lhs.y == rhs;} + + + friend Z_CT(CPP11) Boolean operator !=(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x != rhs || lhs.y != rhs;} + + + friend Z_CT(CPP11) Boolean operator >=(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x >= rhs && lhs.y >= rhs;} + + + friend Z_CT(CPP11) Boolean operator <=(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x <= rhs && lhs.y <= rhs;} + + + friend Z_CT(CPP11) Boolean operator >(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x > rhs && lhs.y > rhs;} + + + friend Z_CT(CPP11) Boolean operator <(const XY &lhs, t rhs) Z_NOTHROW + {return lhs.x < rhs && lhs.y < rhs;} + + + friend Z_CT(CPP11) XY operator +(const XY &lhs, t rhs) Z_NOTHROW + {return XY(lhs.x + rhs, lhs.y + rhs);} + + + friend Z_CT(CPP11) XY operator -(const XY &lhs, t rhs) Z_NOTHROW + {return XY(lhs.x - rhs, lhs.y - rhs);} + + + friend Z_CT(CPP11) XY operator *(const XY &lhs, t rhs) Z_NOTHROW + {return XY(lhs.x * rhs, lhs.y * rhs);} + + + friend Z_CT(CPP11) XY operator /(const XY &lhs, t rhs) Z_NOTHROW + {return XY(lhs.x / rhs, lhs.y / rhs);} + + + friend Z_CT(CPP11) Boolean operator ==(t lhs, const XY &rhs) Z_NOTHROW + {return lhs == rhs.x && lhs == rhs.y;} + + + friend Z_CT(CPP11) Boolean operator !=(t lhs, const XY &rhs) Z_NOTHROW + {return lhs != rhs.x || lhs != rhs.y;} + + + friend Z_CT(CPP11) Boolean operator >=(t lhs, const XY &rhs) Z_NOTHROW + {return lhs >= rhs.x && lhs >= rhs.y;} + + + friend Z_CT(CPP11) Boolean operator <=(t lhs, const XY &rhs) Z_NOTHROW + {return lhs <= rhs.x && lhs <= rhs.y;} + + + friend Z_CT(CPP11) Boolean operator >(t lhs, const XY &rhs) Z_NOTHROW + {return lhs > rhs.x && lhs > rhs.y;} + + + friend Z_CT(CPP11) Boolean operator <(t lhs, const XY &rhs) Z_NOTHROW + {return lhs < rhs.x && lhs < rhs.y;} + + + friend Z_CT(CPP11) XY operator +(t lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs + rhs.x, lhs + rhs.y);} + + + friend Z_CT(CPP11) XY operator *(t lhs, const XY &rhs) Z_NOTHROW + {return XY(lhs * rhs.x, lhs * rhs.y);} + + + Z_INLINE XY &operator +=(const XY &rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE XY &operator -=(const XY &rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE XY &operator *=(const XY &rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE XY &operator /=(const XY &rhs) Z_NOTHROW {return *this = *this / rhs;} + + Z_INLINE XY &operator +=(t rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE XY &operator -=(t rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE XY &operator *=(t rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE XY &operator /=(t rhs) Z_NOTHROW {return *this = *this / rhs;} + + Z_INLINE t operator [](UInt index) const Z_NOTHROW {return ((t *)this)[index];} + Z_INLINE t &operator [](UInt index) Z_NOTHROW {return ((t *)this)[index];} + + Z_CT(CPP11) XY yx () const Z_NOTHROW {return XY(y, x);} + Z_CT(CPP11) XYZ nxy(t n) const Z_NOTHROW {return XYZ(n, x, y);} + Z_CT(CPP11) XYZ nyx(t n) const Z_NOTHROW {return XYZ(n, y, x);} + Z_CT(CPP11) XYZ xny(t n) const Z_NOTHROW {return XYZ(x, n, y);} + Z_CT(CPP11) XYZ xyn(t n) const Z_NOTHROW {return XYZ(x, y, n);} + Z_CT(CPP11) XYZ ynx(t n) const Z_NOTHROW {return XYZ(y, n, x);} + Z_CT(CPP11) XYZ yxn(t n) const Z_NOTHROW {return XYZ(y, x, n);} + + + Z_INLINE XY apply(t (* function)(t)) const Z_NOTHROW + {return XY(function(x), function(y));} + + + Z_CT(CPP11) XY clamp(const XY &minimum, const XY &maximum) const Z_NOTHROW + { + return XY( + Zeta::clamp(x, minimum.x, maximum.x), + Zeta::clamp(y, minimum.y, maximum.y)); + } + + + Z_CT(CPP11) XY clamp(t minimum, t maximum) const Z_NOTHROW + { + return XY( + Zeta::clamp(x, minimum, maximum), + Zeta::clamp(y, minimum, maximum)); + } + + + Z_CT(CPP11) t cross_product(const XY &other) const Z_NOTHROW + {return x * other.y - y * other.x;} + + + Z_CT(CPP11) t dot_product(const XY &other) const Z_NOTHROW + {return x * other.x + y * other.y;} + + + Z_CT(CPP11) XY fit(const XY &other) const Z_NOTHROW + { + return y / x > other.y / other.x + ? XY(x * other.y / y, other.y) + : XY(other.x, y * other.x / x); + } + + + Z_CT(CPP11) Boolean has_zero() const Z_NOTHROW + {return x == t(0) || y == t(0);} + + + Z_CT(CPP11) t inner_maximum() const Z_NOTHROW + {return Zeta::maximum(x, y);} + + + Z_CT(CPP11) t inner_middle() const Z_NOTHROW + {return (x + y) / t(2);} + + + Z_CT(CPP11) t inner_minimum() const Z_NOTHROW + {return Zeta::minimum(x, y);} + + + Z_CT(CPP11) t inner_product() const Z_NOTHROW + {return x * y;} + + + Z_CT(CPP11) t inner_sum() const Z_NOTHROW + {return x + y;} + + + Z_CT(CPP11) Boolean is_zero() const Z_NOTHROW + {return x == t(0) && y == t(0);} + + + Z_CT(CPP11) XY maximum(const XY &other) const Z_NOTHROW + {return XY(Zeta::maximum(x, other.x), Zeta::maximum(y, other.y));} + + + Z_CT(CPP11) XY middle(const XY &other) const Z_NOTHROW + {return XY((x + other.x) / t(2), (y + other.y) / t(2));} + + + Z_CT(CPP11) XY minimum(const XY &other) const Z_NOTHROW + {return XY(Zeta::minimum(x, other.x), Zeta::minimum(y, other.y));} + + + Z_CT(CPP11) t squared_length() const Z_NOTHROW + {return x * x + y * y;} + + + // MARK: - Signed + + + Z_CT(CPP11) XY absolute() const Z_NOTHROW + {return XY(Zeta::absolute(x), Zeta::absolute(y));} + + + Z_CT(CPP11) Boolean has_negative() const Z_NOTHROW + {return x < t(0) || y < t(0);} + + + Z_CT(CPP11) Boolean is_negative() const Z_NOTHROW + {return x < t(0) && y < t(0);} + + + Z_CT(CPP11) XY negative() const Z_NOTHROW + {return XY(-x, -y);} + + + // MARK: - Integer + + +// Z_CT(CPP11) Boolean is_perpendicular(const XY &other) const Z_NOTHROW +// {return !Zeta::absolute(dot_product(other));} + + + // MARK: - Real + + + Z_CT(CPP11) XY clamp_01() const Z_NOTHROW + {return XY(Zeta::clamp_01(x), Zeta::clamp_01(y));} + + + Z_CT(CPP11) Boolean has_almost_zero() const Z_NOTHROW + {return Zeta::is_almost_zero(x) || Zeta::is_almost_zero(y);} + + + Z_CT(CPP11) Boolean has_finite() const Z_NOTHROW + {return Zeta::is_finite(x) || Zeta::is_finite(y);} + + + Z_CT(CPP11) Boolean has_infinity() const Z_NOTHROW + {return Zeta::is_infinity(x) || Zeta::is_infinity(y);} + + + Z_CT(CPP11) Boolean has_nan() const Z_NOTHROW + {return Zeta::is_nan(x) || Zeta::is_nan(y);} + + + Z_CT(CPP11) XY inverse_lerp(const XY &other, t v) const Z_NOTHROW + { + return XY( + Zeta::inverse_lerp(x, other.x, v), + Zeta::inverse_lerp(y, other.y, v)); + } + + + Z_CT(CPP11) Boolean is_almost_equal(const XY &other) const Z_NOTHROW + { + return Zeta::are_almost_equal(x, other.x) && + Zeta::are_almost_equal(y, other.y); + } + + + Z_CT(CPP11) Boolean is_almost_zero() const Z_NOTHROW + {return Zeta::is_almost_zero(x) && Zeta::is_almost_zero(y);} + + + Z_CT(CPP11) Boolean is_finite() const Z_NOTHROW + {return Zeta::is_finite(x) && Zeta::is_finite(y);} + + + Z_CT(CPP11) Boolean is_infinity() const Z_NOTHROW + {return Zeta::is_infinity(x) && Zeta::is_infinity(y);} + + + Z_CT(CPP11) Boolean is_nan() const Z_NOTHROW + {return Zeta::is_nan(x) && Zeta::is_nan(y);} + + + Z_CT(CPP11) Boolean is_perpendicular(const XY &other) const Z_NOTHROW + {return Zeta::absolute(dot_product(other)) <= Type::epsilon();} + + + Z_CT(CPP11) XY lerp(const XY &other, t v) const Z_NOTHROW + { + return XY( + Zeta::lerp(x, other.x, v), + Zeta::lerp(y, other.y, v)); + } + + + Z_CT(CPP11) XY reciprocal() const Z_NOTHROW + {return XY(t(1) / x, t(1) / y);} + + +# if defined(Z_WITH_CORE_FOUNDATION) || defined(Z_WITH_FOUNDATION) + +# define Z_z_APPLE_CONSTRUCTORS(Prefix) \ + \ + Z_CT(CPP11) XY(const Prefix##Point &point) Z_NOTHROW \ + : x(t(point.x)), y(t(point.y)) {} \ + \ + \ + Z_CT(CPP11) XY(const Prefix##Size &size) Z_NOTHROW \ + : x(t(size.width)), y(t(size.height)) {} + + +# if Z_DIALECT_HAS(CPP11, COPY_LIST_INITIALIZATION) + +# define Z_z_APPLE_OPERATORS(Prefix) \ + \ + Z_CT(CPP11) operator Prefix##Point() const Z_NOTHROW \ + {return {CGFloat(x), CGFloat(y)};} \ + \ + \ + Z_CT(CPP11) operator Prefix##Size() const Z_NOTHROW \ + {return {CGFloat(x), CGFloat(y)};} \ + \ + \ + Z_CT(CPP11) operator Prefix##Rect() const Z_NOTHROW \ + {return {{0.0, 0.0}, {CGFloat(x), CGFloat(y)}};} + +# else +# define Z_z_APPLE_OPERATORS(Prefix) \ + \ + Z_CT(CPP14) operator Prefix##Point() const Z_NOTHROW \ + { \ + Prefix##Point result = {CGFloat(x), CGFloat(y)}; \ + return result; \ + } \ + \ + \ + Z_CT(CPP14) operator Prefix##Size() const Z_NOTHROW \ + { \ + Prefix##Size result = {CGFloat(x), CGFloat(y)}; \ + return result; \ + } \ + \ + \ + Z_CT(CPP14) operator Prefix##Rect() const Z_NOTHROW \ + { \ + Prefix##Rect result = {CGFloat(0), CGFloat(0), CGFloat(x), CGFloat(y)}; \ + return result; \ + } +# endif + + +# ifdef Z_WITH_CORE_FOUNDATION + Z_z_APPLE_CONSTRUCTORS(CG) + Z_z_APPLE_OPERATORS (CG) +# endif + +# if defined(Z_WITH_FOUNDATION) && \ + Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP) && \ + (!defined(Z_WITH_CORE_FOUNDATION) || \ + !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) || \ + !NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) + + Z_z_APPLE_CONSTRUCTORS(NS) + Z_z_APPLE_OPERATORS (NS) +# endif + +# undef Z_z_APPLE_CONSTRUCTORS +# undef Z_z_APPLE_OPERATORS + +# endif + + +# ifdef Z_WITH_COCOS2D_X + + Z_CT(CPP11) XY(const cocos2d::Vec2 &point) Z_NOTHROW + : x(point.x), y(point.y) {} + + + Z_CT(CPP11) XY(const cocos2d::Size &size) Z_NOTHROW + : x(size.width), y(size.height) {} + + + Z_INLINE operator cocos2d::Vec2() const Z_NOTHROW + {return cocos2d::Vec2(float(x), float(y));} + + + Z_INLINE operator cocos2d::Size() const Z_NOTHROW + {return cocos2d::Size(float(x), float(y));} + + + Z_INLINE operator cocos2d::Rect() const Z_NOTHROW + {return cocos2d::Rect(0.0f, 0.0f, float(x), float(y));} + +# endif + + +# ifdef Z_WITH_QT + + Z_CT(CPP11) XY(const QPoint &point) Z_NOTHROW + : x(t(point.x())), y(t(point.y())) {} + + + Z_CT(CPP11) XY(const QSize &size) Z_NOTHROW + : x(t(size.width())), y(t(size.height())) {} + + + Z_CT(CPP11) operator QPoint() const Z_NOTHROW + {return QPoint(int(x), int(y));} + + + Z_CT(CPP11) operator QSize() const Z_NOTHROW + {return QSize(int(x), int(y));} + + + Z_CT(CPP11) operator QRect() const Z_NOTHROW + {return QRect(0, 0, int(x), int(y));} + +# endif +};} + + +#ifndef Z_classes_XYZ_HPP +# include +#endif + +#endif // Z_classes_XY_HPP diff --git a/projects/Zeta/API/Z/classes/XYZ.hpp b/projects/Zeta/API/Z/classes/XYZ.hpp new file mode 100644 index 0000000..ddc0680 --- /dev/null +++ b/projects/Zeta/API/Z/classes/XYZ.hpp @@ -0,0 +1,522 @@ +/* Zeta API - Z/classes/XYZ.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_classes_XYZ_HPP +#define Z_classes_XYZ_HPP + +#ifndef Z_classes_XY_HPP +# include +#endif + + +namespace Zeta {template struct XYZ { + t x, y, z; + + + Z_INLINE XYZ() Z_NOTHROW Z_DEFAULTED({}) + + Z_CT(CPP11) XYZ(t x_, t y_, t z_) Z_NOTHROW + : x(x_), y(y_), z(z_) {} + + + Z_CT(CPP11) XYZ(t x_, t y_) Z_NOTHROW + : x(x_), y(y_), z(t(0)) {} + + + Z_CT(CPP11) XYZ(t xyz) Z_NOTHROW + : x(xyz), y(xyz) {} + + + Z_CT(CPP11) XYZ(const XY &xy) Z_NOTHROW + : x(xy.x), y(xy.y), z(t(0)) {} + + + Z_CT(CPP11) XYZ(const XY &xy, t z_) Z_NOTHROW + : x(xy.x), y(xy.y), z(z_) {} + + + Z_CT(CPP11) XYZ(t x_, const XY &yz) Z_NOTHROW + : x(x_), y(yz.x), z(yz.y) {} + + +# if Z_DIALECT_HAS(CPP98, SFINAE) && \ + Z_DIALECT_HAS(CPP11, DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE) + + template ::value>::type> + Z_CT(CPP11) XYZ(const XYZ &other) Z_NOTHROW + : x(t(other.x)), y(t(other.y), x(t(other.z))) {} +# endif + + + Z_CT(CPP11) operator Boolean() const Z_NOTHROW + {return x != t(0) || y != t(0) || z != t(0);} + + + friend Z_CT(CPP11) Boolean operator ==(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z;} + + + friend Z_CT(CPP11) Boolean operator !=(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z;} + + + friend Z_CT(CPP11) Boolean operator >=(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x >= rhs.x && lhs.y >= rhs.y && lhs.z >= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <=(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x <= rhs.x && lhs.y <= rhs.y && lhs.z <= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator >(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x > rhs.x && lhs.y > rhs.y && lhs.z > rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x < rhs.x && lhs.y < rhs.y && lhs.z < rhs.z;} + + + friend Z_CT(CPP11) XYZ operator +(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);} + + + friend Z_CT(CPP11) XYZ operator -(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);} + + + friend Z_CT(CPP11) XYZ operator *(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z);} + + + friend Z_CT(CPP11) XYZ operator /(const XYZ &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x / rhs.x, lhs.y / rhs.y, lhs.z / rhs.z);} + + + friend Z_CT(CPP11) Boolean operator ==(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x == rhs && lhs.y == rhs && lhs.z == rhs;} + + + friend Z_CT(CPP11) Boolean operator !=(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x != rhs || lhs.y != rhs || lhs.z != rhs;} + + + friend Z_CT(CPP11) Boolean operator >=(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x >= rhs && lhs.y >= rhs && lhs.z >= rhs;} + + + friend Z_CT(CPP11) Boolean operator <=(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x <= rhs && lhs.y <= rhs && lhs.z <= rhs;} + + + friend Z_CT(CPP11) Boolean operator >(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x > rhs && lhs.y > rhs && lhs.z > rhs;} + + + friend Z_CT(CPP11) Boolean operator <(const XYZ &lhs, t rhs) Z_NOTHROW + {return lhs.x < rhs && lhs.y < rhs && lhs.z < rhs;} + + + friend Z_CT(CPP11) XYZ operator +(const XYZ &lhs, t rhs) Z_NOTHROW + {return XYZ(lhs.x + rhs, lhs.y + rhs, lhs.z + rhs);} + + + friend Z_CT(CPP11) XYZ operator -(const XYZ &lhs, t rhs) Z_NOTHROW + {return XYZ(lhs.x - rhs, lhs.y - rhs, lhs.z - rhs);} + + + friend Z_CT(CPP11) XYZ operator *(const XYZ &lhs, t rhs) Z_NOTHROW + {return XYZ(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);} + + + friend Z_CT(CPP11) XYZ operator /(const XYZ &lhs, t rhs) Z_NOTHROW + {return XYZ(lhs.x / rhs, lhs.y / rhs, lhs.z / rhs);} + + + friend Z_CT(CPP11) Boolean operator ==(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs == rhs.x && lhs == rhs.y && lhs == rhs.z;} + + + friend Z_CT(CPP11) Boolean operator !=(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs != rhs.x || lhs != rhs.y || lhs != rhs.y;} + + + friend Z_CT(CPP11) Boolean operator >=(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs >= rhs.x && lhs >= rhs.y && lhs >= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <=(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs <= rhs.x && lhs <= rhs.y && lhs <= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator >(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs > rhs.x && lhs > rhs.y && lhs > rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <(t lhs, const XYZ &rhs) Z_NOTHROW + {return lhs < rhs.x && lhs < rhs.y && lhs < rhs.z;} + + + friend Z_CT(CPP11) XYZ operator +(t lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs + rhs.x, lhs + rhs.y, lhs + rhs.z);} + + + friend Z_CT(CPP11) XYZ operator *(t lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs * rhs.x, lhs * rhs.y, lhs * rhs.z);} + + + friend Z_CT(CPP11) Boolean operator ==(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == t(0);} + + + friend Z_CT(CPP11) Boolean operator !=(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != t(0);} + + + friend Z_CT(CPP11) Boolean operator >=(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x >= rhs.x && lhs.y >= rhs.y && lhs.z >= t(0);} + + + friend Z_CT(CPP11) Boolean operator <=(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x <= rhs.x && lhs.y <= rhs.y && lhs.z <= t(0);} + + + friend Z_CT(CPP11) Boolean operator >(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x > rhs.x && lhs.y > rhs.y && lhs.z > t(0);} + + + friend Z_CT(CPP11) Boolean operator <(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return lhs.x < rhs.x && lhs.y < rhs.y && lhs.z < t(0);} + + + friend Z_CT(CPP11) XYZ operator +(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return XYZ(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z);} + + + friend Z_CT(CPP11) XYZ operator -(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return XYZ(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z);} + + + friend Z_CT(CPP11) XYZ operator *(const XYZ &lhs, const XY &rhs) Z_NOTHROW + {return XYZ(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z, t(0));} + + + friend Z_CT(CPP11) Boolean operator ==(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x == rhs.x && lhs.y == rhs.y && rhs.z == t(0);} + + + friend Z_CT(CPP11) Boolean operator !=(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x != rhs.x || lhs.y != rhs.y || rhs.z != t(0);} + + + friend Z_CT(CPP11) Boolean operator >=(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x >= rhs.x && lhs.y >= rhs.y && t(0) >= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <=(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x <= rhs.x && lhs.y <= rhs.y && t(0) <= rhs.z;} + + + friend Z_CT(CPP11) Boolean operator >(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x > rhs.x && lhs.y > rhs.y && t(0) > rhs.z;} + + + friend Z_CT(CPP11) Boolean operator <(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return lhs.x < rhs.x && lhs.y < rhs.y && t(0) < rhs.z;} + + + friend Z_CT(CPP11) XYZ operator +(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x + rhs.x, lhs.y + rhs.y, rhs.z);} + + + friend Z_CT(CPP11) XYZ operator *(const XY &lhs, const XYZ &rhs) Z_NOTHROW + {return XYZ(lhs.x + rhs.x, lhs.y + rhs.y, rhs.z, t(0));} + + + Z_INLINE XYZ &operator +=(const XYZ &rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE XYZ &operator -=(const XYZ &rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE XYZ &operator *=(const XYZ &rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE XYZ &operator /=(const XYZ &rhs) Z_NOTHROW {return *this = *this / rhs;} + + Z_INLINE XYZ &operator +=(t rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE XYZ &operator -=(t rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE XYZ &operator *=(t rhs) Z_NOTHROW {return *this = *this * rhs;} + Z_INLINE XYZ &operator /=(t rhs) Z_NOTHROW {return *this = *this / rhs;} + + Z_INLINE XY &operator +=(XY rhs) Z_NOTHROW {return *this = *this + rhs;} + Z_INLINE XY &operator -=(XY rhs) Z_NOTHROW {return *this = *this - rhs;} + Z_INLINE XY &operator *=(XY rhs) Z_NOTHROW {return *this = *this * rhs;} + + Z_INLINE t operator [](UInt index) const Z_NOTHROW {return ((t *)this)[index];} + Z_INLINE t &operator [](UInt index) Z_NOTHROW {return ((t *)this)[index];} + + Z_CT(CPP11) XY xy () const Z_NOTHROW {return XY(x, y);} + Z_CT(CPP11) XY xz () const Z_NOTHROW {return XY(x, z);} + Z_CT(CPP11) XY yx () const Z_NOTHROW {return XY(y, x);} + Z_CT(CPP11) XY yz () const Z_NOTHROW {return XY(y, z);} + Z_CT(CPP11) XY zx () const Z_NOTHROW {return XY(z, x);} + Z_CT(CPP11) XY zy () const Z_NOTHROW {return XY(z, y);} + Z_CT(CPP11) XYZ xzy() const Z_NOTHROW {return XYZ(x, z, y);} + Z_CT(CPP11) XYZ yxz() const Z_NOTHROW {return XYZ(y, x, z);} + Z_CT(CPP11) XYZ yzx() const Z_NOTHROW {return XYZ(y, z, x);} + Z_CT(CPP11) XYZ zxy() const Z_NOTHROW {return XYZ(z, x, y);} + Z_CT(CPP11) XYZ zyx() const Z_NOTHROW {return XYZ(z, y, x);} + + + Z_INLINE XYZ apply(t (* function)(t)) const Z_NOTHROW + {return XYZ(function(x), function(y), function(z));} + + + Z_CT(CPP11) XYZ clamp(const XYZ &minimum, const XYZ &maximum) const Z_NOTHROW + { + return XYZ( + Zeta::clamp(x, minimum.x, maximum.x), + Zeta::clamp(y, minimum.y, maximum.y), + Zeta::clamp(z, minimum.z, maximum.z)); + } + + + Z_CT(CPP11) XYZ clamp(t minimum, t maximum) const Z_NOTHROW + { + return XYZ( + Zeta::clamp(x, minimum, maximum), + Zeta::clamp(y, minimum, maximum), + Zeta::clamp(z, minimum, maximum)); + } + + + Z_CT(CPP11) XYZ cross_product(const XYZ &other) const Z_NOTHROW + { + return XYZ( + y * other.z - z * other.y, + z * other.x - x * other.z, + x * other.y - y * other.x); + } + + + Z_CT(CPP11) t dot_product(const XYZ &other) const Z_NOTHROW + {return x * other.x + y * other.y + z * other.z;} + + + Z_CT(CPP11) XYZ fit(const XYZ &other) const Z_NOTHROW + {return XYZ(t(0));} /* TODO */ + + + Z_CT(CPP11) Boolean has_zero() const Z_NOTHROW + {return x == t(0) || y == t(0) || z == t(0);} + + + Z_CT(CPP11) t inner_maximum() const Z_NOTHROW + {return Zeta::maximum(Zeta::maximum(x, y), z);} + + + Z_CT(CPP11) t inner_middle() const Z_NOTHROW + {return (x + y + z) / t(3);} + + + Z_CT(CPP11) t inner_minimum() const Z_NOTHROW + {return Zeta::minimum(Zeta::minimum(x, y), z);} + + + Z_CT(CPP11) t inner_product() const Z_NOTHROW + {return x * y * z;} + + + Z_CT(CPP11) t inner_sum() const Z_NOTHROW + {return x + y + z;} + + + Z_CT(CPP11) Boolean is_zero() const Z_NOTHROW + {return x == t(0) && y == t(0) && z == t(0);} + + + Z_CT(CPP11) XYZ maximum(const XYZ &other) const Z_NOTHROW + { + return XYZ( + Zeta::maximum(x, other.x), + Zeta::maximum(y, other.y), + Zeta::maximum(z, other.z)); + } + + + Z_CT(CPP11) XYZ middle(const XYZ &other) const Z_NOTHROW + { + return XYZ( + (x + other.x) / t(2), + (y + other.y) / t(2), + (z + other.z) / t(2)); + } + + + Z_CT(CPP11) XYZ minimum(const XYZ &other) const Z_NOTHROW + { + return XYZ( + Zeta::minimum(x, other.x), + Zeta::minimum(y, other.y), + Zeta::minimum(z, other.z)); + } + + + /*Z_INLINE XYZ rotate_as_axes(XYZ rotation) const Z_NOTHROW + { + XYZ result = *this; + + if ((rotation.x % 4) & 1) Zeta::swap(&result.y, &result.z); + if ((rotation.y % 4) & 1) Zeta::swap(&result.x, &result.z); + if ((rotation.z % 4) & 1) Zeta::swap(&result.x, &result.y); + return result; + }*/ + + + Z_CT(CPP11) t squared_length() const Z_NOTHROW + {return x * x + y * y + z * z;} + + + // MARK: - Signed + + + Z_CT(CPP11) XYZ absolute() const Z_NOTHROW + { + return XYZ( + Zeta::absolute(x), + Zeta::absolute(y), + Zeta::absolute(z)); + } + + + Z_CT(CPP11) Boolean has_negative() const Z_NOTHROW + {return x < t(0) || y < t(0) || z < t(0);} + + + Z_CT(CPP11) Boolean is_negative() const Z_NOTHROW + {return x < t(0) && y < t(0) && z < t(0);} + + + Z_CT(CPP11) XYZ negative() const Z_NOTHROW + {return XYZ(-x, -y, -z);} + + + // MARK: - Integer + + + //Z_CT(CPP11) Boolean is_perpendicular(const XYZ &other) const + // {return !Zeta::absolute(dot_product(other));} + + + // MARK: - Real + + + Z_CT(CPP11) XYZ clamp_01() const Z_NOTHROW + { + return XYZ( + Zeta::clamp_01(x), + Zeta::clamp_01(y), + Zeta::clamp_01(z)); + } + + + Z_CT(CPP11) Boolean has_almost_zero() const Z_NOTHROW + { + return Zeta::is_almost_zero(x) || + Zeta::is_almost_zero(y) || + Zeta::is_almost_zero(z); + } + + + Z_CT(CPP11) Boolean has_finite() const Z_NOTHROW + { + return Zeta::is_finite(x) || + Zeta::is_finite(y) || + Zeta::is_finite(z); + } + + + Z_CT(CPP11) Boolean has_infinity() const Z_NOTHROW + { + return Zeta::is_infinity(x) || + Zeta::is_infinity(y) || + Zeta::is_infinity(z); + } + + + Z_CT(CPP11) Boolean has_nan() const Z_NOTHROW + { + return Zeta::is_nan(x) || + Zeta::is_nan(y) || + Zeta::is_nan(z); + } + + + Z_CT(CPP11) XYZ inverse_lerp(const XYZ &other, t v) const Z_NOTHROW + { + return XYZ( + Zeta::inverse_lerp(x, other.x, v), + Zeta::inverse_lerp(y, other.y, v), + Zeta::inverse_lerp(z, other.z, v)); + } + + + Z_CT(CPP11) Boolean is_almost_equal(const XYZ &other) const Z_NOTHROW + { + return Zeta::are_almost_equal(x, other.x) && + Zeta::are_almost_equal(y, other.y) && + Zeta::are_almost_equal(z, other.z); + } + + + Z_CT(CPP11) Boolean is_almost_zero() const Z_NOTHROW + { + return Zeta::is_almost_zero(x) && + Zeta::is_almost_zero(y) && + Zeta::is_almost_zero(z); + } + + + Z_CT(CPP11) Boolean is_finite() const Z_NOTHROW + { + return Zeta::is_finite(x) && + Zeta::is_finite(y) && + Zeta::is_finite(z); + } + + + Z_CT(CPP11) Boolean is_infinity() const Z_NOTHROW + { + return Zeta::is_infinity(x) && + Zeta::is_infinity(y) && + Zeta::is_infinity(z); + } + + + Z_CT(CPP11) Boolean is_nan() const Z_NOTHROW + { + return Zeta::is_nan(x) && + Zeta::is_nan(y) && + Zeta::is_nan(z); + } + + + Z_CT(CPP11) Boolean is_perpendicular(const XYZ &other) const Z_NOTHROW + {return Zeta::absolute(dot_product(other)) <= Type::epsilon();} + + + Z_CT(CPP11) XYZ lerp(const XYZ &other, t v) const Z_NOTHROW + { + return XYZ( + Zeta::lerp(x, other.x, v), + Zeta::lerp(y, other.y, v), + Zeta::lerp(z, other.z, v)); + } + + + Z_CT(CPP11) XYZ reciprocal() const Z_NOTHROW + {return XYZ(t(1) / x, t(1) / y, t(1) / z);} + }; +} + + +#endif // Z_classes_XYZ_HPP diff --git a/projects/Zeta/API/Z/constants/boolean.h b/projects/Zeta/API/Z/constants/boolean.h new file mode 100644 index 0000000..61a0b56 --- /dev/null +++ b/projects/Zeta/API/Z/constants/boolean.h @@ -0,0 +1,32 @@ +/* Zeta API - Z/constants/boolean.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_constants_boolean_H +#define Z_constants_boolean_H + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +#ifdef Z_TRUE +# undef Z_TRUE +#endif + +#define Z_TRUE 1 + +#ifdef Z_FALSE +# undef Z_FALSE +#endif + +#define Z_FALSE 0 + +#endif /* Z_constants_boolean_H */ diff --git a/projects/Zeta/API/Z/constants/build.hpp b/projects/Zeta/API/Z/constants/build.hpp new file mode 100644 index 0000000..d2b7624 --- /dev/null +++ b/projects/Zeta/API/Z/constants/build.hpp @@ -0,0 +1,47 @@ +/* Zeta API - Z/constants/build.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_constants_build_HPP +#define Z_constants_build_HPP + +#include + +#if Z_DIALECT_HAS_SPECIFIER(CPP11, CONSTEXPR) + + namespace Zeta {enum { + build_year = (__DATE__[7] - '0') * 1000 + (__DATE__[ 8] - '0') * 100 + + (__DATE__[9] - '0') * 10 + (__DATE__[10] - '0'), + + build_month = __DATE__[0] == 'J' + ? (__DATE__[1] == 'a' + ? 1 + : (__DATE__[2] == 'n' ? 6 : 7)) + : (__DATE__[0] == 'F' + ? 2 + : (__DATE__[0] == 'M' + ? (__DATE__[2] == 'r' ? 3 : 5) + : (__DATE__[0] == 'A' + ? (__DATE__[1] == 'p' ? 4 : 8) + : (__DATE__[0] == 'S' + ? 9 + : (__DATE__[0] == 'O' + ? 10 + : (__DATE__[0] == 'N' ? 11 : 12)))))), + + build_day = (__DATE__[4] == ' ' + ? 0 + : __DATE__[4] - '0') * 10 + (__DATE__[5] - '0'), + + build_hour = (__TIME__[0] - '0') * 10 + (__TIME__[1] - '0'), + build_minutes = (__TIME__[3] - '0') * 10 + (__TIME__[4] - '0'), + build_seconds = (__TIME__[6] - '0') * 10 + (__TIME__[7] - '0') + };} + +#endif + +#endif /* Z_constants_build_HPP */ diff --git a/projects/Zeta/API/Z/constants/numbers.h b/projects/Zeta/API/Z/constants/numbers.h new file mode 100644 index 0000000..3944a28 --- /dev/null +++ b/projects/Zeta/API/Z/constants/numbers.h @@ -0,0 +1,968 @@ +/* Zeta API - Z/constants/numbers.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_constants_numbers_H +#define Z_constants_numbers_H + +/* MARK: - Irrational numbers */ + +#define Z_ALPHA /* α ~ Feigenbaum's α Constant */ 2.\ +5029078750958928222839028732182157863812713767271499773361920567\ +7923546317959020670329964974643383412959523186999585472394218237\ +7785445179272863314993372578112163594879503744781260997380598671\ +2397117373289276654044010306698313834600094139322364490657889951\ +2205843172507873377463087853424285351988587500042358246918740820\ +4281700901714823051821621619413199856066129382742649709844084470\ +1008054549677936760888126446406885181552709324007542506497157047\ +0475419932831783645332562415378693957125097066387979492654623137\ +6745918909813116752434221110130913127837160951158341230841503716\ +4997020224681219644081216686527458043026245782561067150138521821\ +6449532543349873487413352795815351016583605455763513276501810781\ +1948369459574850237398235452625632779475397269902012891516645793\ +9420198920248803394051699686551494477396533876979741232354061781\ +9896112494095990353128997733611849847377946108428833293833903950\ +9008914086351525626803381414669279913310743349705143545201344643\ +4264752001621384610729922641994332772918977769053802596851 + +#define Z_DELTA /* δ ~ Feigenbaum's δ Constant */ 4.\ +6692016091029906718532038204662016172581855774757686327456513430\ +0413433021131473713868974402394801381716598485518981513440862714\ +2027932522312442988890890859944935463236713411532481714219947455\ +6443658237932020095610583305754586176522220703854106467494942849\ +8145339172620056875566595233987560382563722564800409510712838906\ +1184470277585428541980111344017500242858538249833571552205223608\ +7250291678860362674527213399057131606875345083433934446103706309\ +4520191158769724322735898389037949462572512890979489867683346116\ +2688911656312347446057517953912204556247280709520219819909455858\ +1946136877445617396074115614074243754435499204869180982648652368\ +4387027996490173977934251347238087371362116018601281861020563818\ +1835409759847796417390032893617143215987824078977661439139576403\ +7760537119096932066998361984288981837003229412030210655743295550\ +3888458497370347275321219257069584140746618419819610061296401614\ +8771294441590140546794180019813325337859249336588307045999993837\ +5411726563553016862529032210862320550634510679399023341675 + +#define Z_DELTA_S /* δs ~ Silver Ratio */ 2.\ +4142135623730950488016887242096980785696718753769480731766797379\ +9073247846210703885038753432764157 + +#define Z_E /* e ~ Euler's Number */ 2.\ +7182818284590452353602874713526624977572470936999595749669676277\ +2407663035354759457138217852516642742746639193200305992181741359\ +6629043572900334295260595630738132328627943490763233829880753195\ +2510190115738341879307021540891499348841675092447614606680822648\ +0016847741185374234544243710753907774499206955170276183860626133\ +1384583000752044933826560297606737113200709328709127443747047230\ +6969772093101416928368190255151086574637721112523897844250569536\ +9677078544996996794686445490598793163688923009879312773617821542\ +4999229576351482208269895193668033182528869398496465105820939239\ +8294887933203625094431173012381970684161403970198376793206832823\ +7646480429531180232878250981945581530175671736133206981125099618\ +1881593041690351598888519345807273866738589422879228499892086805\ +8257492796104841984443634632449684875602336248270419786232090021\ +6099023530436994184914631409343173814364054625315209618369088870\ +7016768396424378140592714563549061303107208510383750510115747704\ +1718986106873969655212671546889570350354021234078498193343210681 + +#define Z_G /* G ~ Catalan's Constant */ 0.\ +9159655941772190150546035149323841107741493742816721342664981196\ +21763019776254769479356512926115106248574 + +#define Z_GAMMA /* γ ~ Euler–Mascheroni Constant */ 0.\ +5772156649015328606065120900824024310421593359399235988057672348\ +8486772677766467093694706329174674951463144724980708248096050401\ +4486542836224173997644923536253500333742937337737673942792595258\ +2470949160087352039481656708532331517766115286211995015079847937\ +4508570574002992135478614669402960432542151905877553526733139925\ +4012967420513754139549111685102807984234877587205038431093997361\ +3725530608893312676001724795378367592713515772261027349291394079\ +8430103417771778088154957066107501016191663340152278935867965497\ +2520362128792265559536696281763887927268013243101047650596370394\ +7394957638906572967929601009015125195950922243501409349871228247\ +9497471956469763185066761290638110518241974448678363808617494551\ +6989279230187739107294578155431600500218284409605377243420328547\ +8367015177394398700302370339518328690001558193988042707411542227\ +8197165230110735658339673487176504919418123000406546931429992977\ +7956930310050308630341856980323108369164002589297089098548682577\ +73642882539549258736295961332985747393023734388470703702844129 + +#define Z_OMEGA /* Ω ~ W(1) */ 0.\ +5671432904097838729999686622103555497538157871865125081351310792\ +2304579308668456669321944696175229455763802497286678978545235846\ +5940072995608516439289994614311571492959803594376698474635606134\ +2268461356989570453977624855707865877337063566333012384304556354\ +2978608509015429081920856055752374819658465950807273089050157336\ +1831596070667108039283918360149499646349348448317465915933636893\ +3680971490856983717510093546792166747552889731475588925030572822\ +4604865124854109688318448770433467727016574464765200627013360494\ +8057883875774914635983034808686985627342099151198306130250270223\ +7292838727216542426572698430693890685874829642167823425504200307\ +1966795220895590936913343950051154949542716768789494702443830337\ +8784002606637609098563645828787818795338304237475555696975428665\ +6135480540090110477123732473016808842009334259193374301935466235\ +3076567270975761218841385994442828002635250684447525596225061138\ +7848128978427693880472920268889238516484753423844953902789609971\ +1060547842212061361983111973376227976096491011771088137407049732 + +#define Z_P2 /* P₂ ~ Universal Parabolic Constant */ 2.\ +2955871493926380740342980491894903875978322036385834839299753466\ +4410966268413312668409442623789761559175 + +#define Z_PHI /* φ ~ Divine Proportion, Golden Ratio */ 1.\ +6180339887498948482045868343656381177203091798057628621354486227\ +0526046281890244970720720418939113748475408807538689175212663386\ +2223536931793180060766726354433389086595939582905638322661319928\ +2902678806752087668925017116962070322210432162695486262963136144\ +3814975870122034080588795445474924618569536486444924104432077134\ +4947049565846788509874339442212544877066478091588460749988712400\ +7652170575179788341662562494075890697040002812104276217711177780\ +5315317141011704666599146697987317613560067087480710131795236894\ +2752194843530567830022878569978297783478458782289110976250030269\ +6156170025046433824377648610283831268330372429267526311653392473\ +1671112115881863851331620384005222165791286675294654906811317159\ +9343235973494985090409476213222981017261070596116456299098162905\ +5520852479035240602017279974717534277759277862561943208275051312\ +1815628551222480939471234145170223735805772786160086883829523045\ +9264787801788992199027077690389532196819861514378031499741106926\ +0886742962267575605231727775203536139362107673893764556060605921 + +#define Z_PI /* π */ 3.\ +1415926535897932384626433832795028841971693993751058209749445923\ +0781640628620899862803482534211706798214808651328230664709384460\ +9550582231725359408128481117450284102701938521105559644622948954\ +9303819644288109756659334461284756482337867831652712019091456485\ +6692346034861045432664821339360726024914127372458700660631558817\ +4881520920962829254091715364367892590360011330530548820466521384\ +1469519415116094330572703657595919530921861173819326117931051185\ +4807446237996274956735188575272489122793818301194912983367336244\ +0656643086021394946395224737190702179860943702770539217176293176\ +7523846748184676694051320005681271452635608277857713427577896091\ +7363717872146844090122495343014654958537105079227968925892354201\ +9956112129021960864034418159813629774771309960518707211349999998\ +3729780499510597317328160963185950244594553469083026425223082533\ +4468503526193118817101000313783875288658753320838142061717766914\ +7303598253490428755468731159562863882353787593751957781857780532\ +1712268066130019278766111959092164201989380952572010654858632788 + +#define Z_RHO /* ρ ~ Plastic Number */ 1.\ +3247179572447460259609088544780973407344040569017333645340150503\ +0282785124554759405469934798178728032991092099474220742510890263\ +9045897795594314757096723471754166839038867418751736931584253549\ +9082466223545337273504589879909568150627745509802486213012169894\ +1575245745486250756265246103689389048399322699520749759628288685\ +5690815070451369610985335257728158603344114192782827376529603299\ +3584674231028483241695239006108543338218508398101808957353870473\ +9313439673137676460210316527688939639353259439924831031095839537\ +7519426028877409271862033892820161525553218270947061305676123988\ +9204637306571962977716886308761533248001117680731166845322774315\ +6628996072663835722103634707098383715980223371021309824684908631\ +2969366344392445007154150429000819030670589845339053468872874066\ +1957756261670617642889193912308379183117162296038861476358807306\ +3150974837675824592702890131950955155601228003859576154017842151\ +7618 + +#define Z_TAU /* τ ~ Prouhet–Thue–Morse Constant */ 0.\ +412454033640107597783361 + +#define Z_ZETA_3 /* ζ(3) ~ Apéry's Constant */ 1.\ +2020569031595942853997381615114499907649862923404988817922715553\ +4183820578631309018645587360933525814619915779526071941849199599\ +8673283213776396837207900161453941782949360066719191575522242494\ +2439615639096641032911590957809655146512799184051057152559880154\ +3710978110203982753256678760352233698494166181105701471577863949\ +9737523785277937030956025701853182790003076547107563048843320869\ +7115737423807934450316076253177145354444118311781822497185263570\ +9182448998796203508335756172022603393785870328131267807990054177\ +3486911525370656237057440966221712902627320732361492242913040528\ +5553723410330775777980642420243048828152100091460265382206962715\ +5202082274335001015294801198690117625951676366998171835575234880\ +7037195557423472940835952088616662025728537558130792825864872821\ +7370556619689895266201877681062920081779233813587682842641243243\ +1480282173674506720693507626895304345939375032966363775750624733\ +2399234828831077339052768020075798435679371150509005027366047114\ +0085335034364672248565315181177661810922279191022488396800266606 + +#define Z_APERY_CONSTANT Z_ZETA_3 + +/* Bernstein's Constant */ +#define Z_BERNSTEIN_CONSTANT 0.\ +28016949902386913303643649123067200004248213981236 + +/* Cahen's constant */ +#define Z_CAHEN_CONSTANT 0.\ +6434105462883380261822543077575647632865878602682395059870309203\ +0749277646183261084844089555046343195405372900995969467846947098\ +1802430097780147073963456948247668586823491596555581306050580602\ +6256306777475500425607601960884398861769982603193090004364305280\ +6567338111342478976190975546079525373761160043883391348037160666\ +7849974184079776825402840257413825951159592097430630557408812114\ +4696101394340462070490073318995421946198637524805100624978738532\ +6841116944408820095760047244297718746082273520598185316636923727\ +6790472958772175441607432838562778155230454121621791172401531531\ +8883239557424569302059076729469550847427091071937146523382004276\ +6671376387740391112213044251840172373010457848486880087124078290\ +1457449877274770249676563130590862156100889975149986642474501700\ +5581154212587814616117557775789114686770822872829465693504467164\ +0959525956030861979618867444196869756004609746414038853402815847\ +5936540509205782123128626092476347619412226683926102068711744992\ +8500177376751575327731991603831036751803975694669235336301908766 + +/* Conway's Constant */ +#define Z_CONWAY_CONSTANT 1.\ +3035772690342963912570991121525518907307025046594048757548613906\ +2855088785246155712681576686442522555347139304709490268396284989\ +3551554347375824856691088977770216576006666613618195758149971416\ +2117477679231324299325720143046277132953880169252753163112124160\ +2789744556311221192891765945442844221050348398443048435036597886\ +1636568696122933005217967812127420727428338418585389780462975362\ +1113325713155961142841646364930650685182742924915750807604716554\ +8732899031406796262775210982301850098048676804171127036928277045\ +5569925410472532552960023967416151761300757699523941470920962729\ +7796525283812895292399842146646970063628087185984737643242596375\ +3778614871491804177943882564549629612672676317034139989238683800\ +1749933916383255041973874337640464423096341637734299996402795347\ +7812315036938111361969193101105512224328065334872949851635350180\ +0086189800442695696203908949639604105938945262628974848057200498\ +9520589408315451152746418415125180247302001937967778366214066091\ +1047529322875883638588769569619942051649976764376226646605546524 + +/* Copeland–Erdős Constant */ +#define Z_COPELAND_ERDOS_CONSTANT 0.\ +2357111317192329313741434753596167717379838997101103107109113127\ +1311371391491511571631671731791811911931971992112232272292332392\ +4125125726326927127728128329330731131331733133734734935335936737\ +3379383389397401409419421431433439443449457461463467479487491499\ +5035095215235415475575635695715775875935996016076136176196316416\ +4364765365966167367768369170170971972773373974375175776176977378\ +7797809811821823827829839853857859863877881883887907911919929937\ +9419479539679719779839919971009101310191021103110331039104910511\ +0611063106910871091109310971103110911171123112911511153116311711\ +1811187119312011213121712231229123112371249125912771279128312891\ +2911297130113031307131913211327136113671373138113991409142314271\ +4291433143914471451145314591471148114831487148914931499151115231\ +5311543154915531559156715711579158315971601160716091613161916211\ +6271637165716631667166916931697169917091721172317331741174717531\ +7591777178317871789180118111823183118471861186718711873187718791\ +8891901190719131931193319491951197319791987199319971999200320112 + +/* Dubois-Raymond Constant */ +#define Z_DUBOIS_RAYMOND_CONSTANT 0.\ +1945280494653251136152137302875039065901577852759236620435639112\ +6128689803952888169215624253956089738687658063273943306194230184\ +6390636687239196106699038887450061447803705376851195665473775341\ +0432909101348239341042021104911276174378712312707073399640646659\ +4403538165050966894987036499348004765165375766040941184234739651\ +4956779385722841561961636382301294169998230606424642604839452569\ +4123319935614068634305323678131896475911139214742172930676438469\ +3349287600077498007403753598564668470942599861444131812798597054\ +7933095739935752164198846632305117558156194995005256891703382249\ +3319463428079109321077886242460055967658105859758658736348984146\ +7259992527092431598567842973511456278699178055257489684072513882\ +2403821492552091058527972095893841735642638248904856731252070117\ +6210793704693341271357851963226482022753143890006555463250692416\ +7265132318157078023594405882897139317429953835226355968647936199\ +7993536655407480626554885296765049525164840537710545438813154286\ +2425019139361380724333725282493692938578755281217194719835697214 + +/* Fransén–Robinson Constant */ +#define Z_FRANSEN_ROBINSON_CONSTANT 2.\ +8077702420285193652215011865577729323080859209301982912200548095\ +9710088912190166551018530816819663814187416434292647678607356834\ +7830897012446742487764751667549180849932709220052990094447342952\ +0658351475152131155061828050485818763476748076712998234216343271\ +32839553888361830581061735321115429359987705 + +/* Froda Constant */ +#define Z_FRODA_CONSTANT 6.\ +5808859910179209708515424038864864915730774383480740051215126610\ +3130504039582040980102991492610759196856156668455125548138339170\ +3289202458856954899842363505373271623341799384794496221955199521\ +9817257192218388867595645961802004143922594049488307254920458946\ +8453227772258857709537332768570509596095271117425536510662899569\ +7277185088450012821602790991199992049536662057550853887690385613\ +7002632531317153051100200863766096686558637839580581513980142957\ +7334256389687241990566392949483335138446018013413478388302980462\ +1310697071249342564168139126312706622063772884318204059466632628\ +8699565585079898698033973449949718559489634828335307265242104748\ +2135319342734258054306012628140042042969387544936469490135496070\ +6954953488235435685881195896105422830179666394139001710669418514\ +8764432569707997421913960662789237104829140068449429415344843421\ +6682628035399961925125252573981078131758341309762667123525922193\ +5544343127146165493705806126785444366179457823420514254471624604\ +1373218142284623260713740224396531435039076042586205557463472653 + +/* Gauss-Kuzmin-Wirsing Constant */ +#define Z_GAUSS_KUZMIN_WIRSING_CONSTANT 0.\ +3036630028987326585974481219015562331108773522536578951882454814\ +6722699529424691098434081193436363681109827226371061693847461485\ +9745801316065265381818237879132446139896476429740950446293759490\ +4870297728772511058335175922044472408659119650778105589295791867\ +1475292565364259184412178423449205725529426910040657788006767324\ +30364396401389692767134073782286711534915435462112848419717968 + +/* Glaisher-Kinkelin Constant */ +#define Z_GLAISHER_KINKELIN_CONSTANT 1.\ +2824271291006226368753425688697917277676889273250011920637400217\ +4040630885882646112973649195820237439420646120399000748933157791\ +3627752804041590725738617275221433432714343978733506791525736685\ +6907876561146686449997784962754518174312394652761282138081802192\ +6451685154614391990108357373070350490388812341881367497813305093\ +7708336822224941158748373480643999788300701255670012869941577054\ +3205392758540581731588155481762970384743250467775147374600031616\ +0230466132963429915580958792933634388728870198895346072523318470\ +2489001091776941712153569193674967261270398013526526688689782188\ +9740172937584075016747211489528881599666874316451389030696264559\ +8704695437402530996068008424474175540614901894441393861960891296\ +8217352879862988434220366989900606980888785849587494085307347117\ +0901326675675033105234052210541417677615630819191999718523704776\ +1312315374135304725819814797451761027540834943143849652341394533\ +7306583232567395495760169225642773692635882169215987077585827469\ +575162841550648585890834128227556209758 + +/* Golomb–Dickman Constant */ +#define Z_GOLOMB_DICKMAN_CONSTANT 0.\ +6243299885435508709929363831008372441796426201805292869735519024\ +9563808885511325446246027619553986886914041039406274314156555911\ +8325420596284465847978987572474465109280189639441135184902499148\ +4947232561121165840654419399681097868927028519012517369465 + +/* Khinchin-Lévy Constant */ +#define Z_KHINCHIN_LEVY_CONSTANT 1.\ +1865691104156254528217229759472371205683565364720543359542542986\ +5280963205625444330034830110848687594663926374717514798866899462\ +8858792892048589683500305263953652862648543238996756950630481767\ +7137897971160075137260514827163656857323386723372834729020622716\ +7397717492785936707669402534024864255657756897536580928012999629\ +8097683768221776246950334807687137738646291848495287534547268657\ +5981454718758041876163312814165488785235808196886092272054841330\ +0497613271141838825016107202035985960092613178946519602806110533\ +1471179799737169111649605099218023355663781315651819442304413647\ +1107321421137880088845327720664931005413077138234468810688679034\ +4040265903168814806991853006483510887007401837153184162772458809\ +9463237501503333492577302701015075319588656808653915811854702488\ +5109994793687122151974779482404010825711270498595566342029575930\ +5048539691167157693662265797795733855688822243559909166408814653\ +6378563759581862456361968781886906440464238011566830343822036684\ +767237417945240901293641495989710341133651272953540904463262571 + +/* Lehmer's Constant */ +#define Z_LEHMER_CONSTANT 0.\ +5926327182016361971040786049957014690842754071971610710995626081\ +5824735236416000851066478429710125705118718346542386963492602972\ +0676068278560798719794374872514034030005836924869155386406146603\ +4856682341215484563644664283093780498006899118318496569617201211\ +3759470623436986514577152028677342172295805168234444776889445080\ +5416320615585123236230643791702235207816036696392763427125248854\ +5674262839723419486114155544111865660734792387798043466342553169\ +2753922997364863485871218333767125332765552976528666126066185788\ +7136229494030890319843139079584054789895099470074892500536563296\ +9001766440856359838520947830182186895213784898496770578735653738\ +5497593520672298603936207528576177510978795686629351912784453933\ +5684548746146679936886718357439373791659084376165704157947507762\ +0030956011574042760302493993921496419367417172065429695390317552\ +6951535843439567271915190168880981717597249067581873559990538542\ +6905758956901623071748479727018609084969996895767596082849838196\ +9270404195036511309800972643309599823665 + +/* Lemniscate Constant */ +#define Z_LEMNISCATE_CONSTANT 2.\ +6220575542921198104648395898911194136827549514316231628168217038\ +0079058707041425023029553296142909344613575267178321805560895690\ +1393935694701119434775235840422641497164906951936899979932146072\ +3831213908102062218974296008565545397723053695497102888883255264\ +8702132901209754083312856851172975222921429669243051396845645553\ +9432881415381331735108409226312132476667633414509988603429421479\ +2247144879639078725641895218110272525166299643333846606793336350\ +9313980852623773940914262648984803480457254147704617542125634212\ +9955863129980224054609012091499139897885645312480971101149665075\ +0605420938417238869000402747853896254830305803039463247832195583\ +2552297303719134191898359219991422953667256910686113093813498072\ +5552913015093730332611087045814240765781886530766932476940761626\ +7216362495494800667609613881223224769255910187057757436146489128\ +7983268666203073137331356210761263637924578580178136410536130609\ +3563472025022592312041202668270457723044608378953311357002940577\ +442011806826257962983642671092116198595 + +/* Lévy's Constant */ +#define Z_LEVY_CONSTANT 3.\ +2758229187218111597876818824538438636084755259823741494051989241\ +9072321564496035518127754047917452949269852624340163332818980851\ +1503417099708230466465646703708071290224186139594237720129817924\ +2510876976149300288068249261705940412908086970544412349223798884\ +4270897269164098355358548048374785828762526918445007643383703876\ +7418844594203517000037321222306241936013409165748043544702217325\ +9938222983822632339151552857798612046849447252148722901480936120\ +8904543420920995199781624005150390513815387714754291393073946178\ +0455278382777274148472215134988266729112154482704520186334876500\ +1974618041826296536528801168151105751350871152301630294274883364\ +6260993628966063363776317216508834801936111756326698411146757164\ +6737885366090624367033259688737535781426541959925075527820545637\ +1594070177616321153570559233923794384292709017743923016374406041\ +2678496160747830990299680560833690479092323361110349271473790052\ +5389549165714734199722931676646307641198327646538816962046346297\ +332994286181358520050377154266892424005731518557308952871781294 + +/* Magata's Constant */ +#define Z_MAGATA_CONSTANT 3.\ +4070691656272561422194582628271806535540344380150321161910338275\ +729699387 + +/* Mills' Constant */ +#define Z_MILLS_CONSTANT 1.\ +3063778838630806904686144926026057129167845851567136443680537599\ +66434 + +/* Alfréd Rényi's Parking Constant */ +#define Z_PARKING_CONSTANT 0.\ +7475979202534114351787309438301781730247862640742283766042291634\ +2516788160295440431243085036931411115 + +/* Porter's Constant */ +#define Z_PORTER_CONSTANT 1.\ +4670780794339754728977984847072299534499033224148877773996858176\ +1660674432904480843036932751117401521266484679045379512110834380\ +0963912989965561898768045389373100175492129255790244549548891509\ +825064836565770339644748288818978123102459699275573160698353198 + +/* Wilbraham-Gibbs Constant */ +#define Z_WILBRAHAM_GIBBS_CONSTANT 1.\ +8519370519824661703610533701579913633458097289811549098047837818\ +7698189016634835853271033650295475770168436164800715700937245079\ +9901963934227232241416503636507478802775776040700542538704594703\ +7548070012549126196000327078575312602462781280151598692712625156\ +6580378191706570498191117142153830172868690950027668919698378356\ +4878693375929431917536185883987328136153711174160053365028598892\ +8906414670095488877382247112955736673406636533206353917604135172\ +0391124030289113514513183861349292577441824075264760309052792077\ +8214856022187181490425447150146363584277794711774661377560583998\ +0813601589774035700341407559120370214113987005974964457642432794\ +5717202979146195145875005521298368008394022754407873371890776002\ +3337859174819734615441535401375520206534953637077479723223530762\ +7711101354680926841172462714308267187960091741576168508046447756\ +2945596278463818094505702063151083460862967611583842446423313950\ +2651856882443995288504068180671418260092625808323715322324469000\ +4091924289785349238396416174935955727240494968269552946845809079 + +/* MARK: - Irrational numbers (square roots) */ + +#define Z_SQUARE_ROOT_2 /* Pythagoras's Constant */ 1.\ +4142135623730950488016887242096980785696718753769480731766797379\ +9073247846210703885038753432764157273501384623091229702492483605\ +5850737212644121497099935831413222665927505592755799950501152782\ +0605714701095599716059702745345968620147285174186408891986095523\ +2923048430871432145083976260362799525140798968725339654633180882\ +9640620615258352395054745750287759961729835575220337531857011354\ +3746034084988471603868999706990048150305440277903164542478230684\ +9293691862158057846311159666871301301561856898723723528850926486\ +1249497715421833420428568606014682472077143585487415565706967765\ +3720226485447015858801620758474922657226002085584466521458398893\ +9443709265918003113882464681570826301005948587040031864803421948\ +9727829064104507263688131373985525611732204024509122770022694112\ +7573627280495738108967504018369868368450725799364729060762996941\ +3804756548237289971803268024744206292691248590521810044598421505\ +9112024944134172853147810580360337107730918286931471017111168391\ +6581726889419758716582152128229518488472089694633862891562882765 + +#define Z_SQUARE_ROOT_3 /* Theodorus' Constant */ 1.\ +7320508075688772935274463415058723669428052538103806280558069794\ +5193301690880003708114618675724857567562614141540670302996994509\ +4998952478811655512094373648528093231902305582067974820101084674\ +9232650153123432669033228866506722546689218379712270471316603678\ +6158801904998653737985938946765034750657605075661834812960610094\ +7602187190325083145829523959832997789824508288714463832917347224\ +1639845878553976679580638183536661108431737808943783161020883055\ +2490167002352071114428869599095636579708716849807289949329648428\ +3020786408603988738697537582317317831395992983007838702877053913\ +3695633121037072640192491067682311992883756411414220167427521023\ +7299427083105989845947598766428889779614783795839022885485290357\ +6033852808064381972344661059689722872865264153822664698420021195\ +4841552784411812865345070351916500166892944154808460712771439997\ +6292683462957743836189511012714863874697654598245178855097537901\ +3880664961911962222957110555242923723192197738262561631468842032\ +8537166829386496119170497388363954959381457576718533736331259108 + +#define Z_SQUARE_ROOT_5 2.\ +2360679774997896964091736687312762354406183596115257242708972454\ +1052092563780489941441440837878227496950817615077378350425326772\ +4447073863586360121533452708866778173191879165811276645322639856\ +5805357613504175337850034233924140644420864325390972525926272288\ +7629951740244068161177590890949849237139072972889848208864154268\ +9894099131693577019748678884425089754132956183176921499977424801\ +5304341150359576683325124988151781394080005624208552435422355561\ +0630634282023409333198293395974635227120134174961420263590473788\ +5504389687061135660045757139956595566956917564578221952500060539\ +2312340050092867648755297220567662536660744858535052623306784946\ +3342224231763727702663240768010444331582573350589309813622634319\ +8686471946989970180818952426445962034522141192232912598196325811\ +1041704958070481204034559949435068555518555725123886416550102624\ +3631257102444961878942468290340447471611545572320173767659046091\ +8529575603577984398054155380779064393639723028756062999482213852\ +1773485924535151210463455550407072278724215347787529112121211843 + +#define Z_SQUARE_ROOT_6 2.\ +4494897427831780981972840747058913919659474806566701284326925672\ +5096037745731502653985943310464023481859460122661418912485886545\ +9837757341625783951237278552828912747527676571247630105270911770\ +2234813106789866908536324433525456040338088089393745855678465747\ +2436130414427027021617420183830008158980783801308970072869399363\ +0837158094400800443738687549164514653939145012044726448133316293\ +5109447418135132854950444661717266314254976483181245040115660453\ +6459009343586167931983665666266909131906535863766105258156179366\ +2361791102946720883545755128835529898324100558690205006415466124\ +1173533994104310579928984673395325527873604182965517183039103678\ +0038362316629732330282904977391047426360070512637697546888677006\ +4099295592571732846450288809151442574630260295296323707552503422\ +7559915454262812980030646720799424253022878426205340679478600465\ +9693997993559754061671358654653456248208256276886369280941306372\ +4335088648015724846337232447379545488144384793363700919741014778\ +5232875591063159846078310367009535324726423167141887586237415065 + +#define Z_SQUARE_ROOT_7 2.\ +6457513110645905905016157536392604257102591830824501803683344592\ +0106882323028362776039288647454361061506457833849746309574352988\ +8627214784427390555880107722717150729728323892299689594865087260\ +7009780542037238280237159411003419391160015785255963059457410351\ +5239680271640737379907404158151990440347431945367139973059700505\ +1399692237545616097119027378154991633288287704000657570674651963\ +4977520837938181146130908764737865956243305799479812816323070548\ +3650107715617946361191553454536477494820593090494849834033989002\ +1047861667332795036939246225717053716492578754832290732492671346\ +9802989499080377482511092278955688979198088148340908316852513353\ +5829539172211770714414974576907081989444441458972284741400303502\ +3532037194870738262931851936409083228059646278376102195979419708\ +9096354695861341181793067816213608491016778353212556334634900218\ +9814604225592950366956241869273732771502208752309966469813203212\ +8189454785680209506359624466285500761905041393504474371234885223\ +3277362510045059621080672334698120004300514490251206257311759115 + +#define Z_SQUARE_ROOT_8 2.\ +8284271247461900976033774484193961571393437507538961463533594759\ +8146495692421407770077506865528314547002769246182459404984967211\ +1701474425288242994199871662826445331855011185511599901002305564\ +1211429402191199432119405490691937240294570348372817783972191046\ +5846096861742864290167952520725599050281597937450679309266361765\ +9281241230516704790109491500575519923459671150440675063714022708\ +7492068169976943207737999413980096300610880555806329084956461369\ +8587383724316115692622319333742602603123713797447447057701852972\ +2498995430843666840857137212029364944154287170974831131413935530\ +7440452970894031717603241516949845314452004171168933042916797787\ +8887418531836006227764929363141652602011897174080063729606843897\ +9455658128209014527376262747971051223464408049018245540045388225\ +5147254560991476217935008036739736736901451598729458121525993882\ +7609513096474579943606536049488412585382497181043620089196843011\ +8224049888268345706295621160720674215461836573862942034222336783\ +3163453778839517433164304256459036976944179389267725783125765531 + +#define Z_SQUARE_ROOT_10 3.\ +1622776601683793319988935444327185337195551393252168268575048527\ +9259443863923822134424810837930029518734728415284005514854885603\ +0453880014690519596700153903344921657179259940659150153474113339\ +4841240853169295770904715764610443692578790620378086099418283717\ +1154840632855299911859682456420332696160469131433612894979189026\ +6529543612676178781350061388186278580463683134952478031143769334\ +6719738195131856784032312417954022183080458728446146002535775797\ +0282864402902440797789603454398916334922265261206779265167603104\ +8436697793756926155720500369894909469421850007358348844643882731\ +1092891090423480542356534039072740197865437259396417260013069900\ +0095578446310962679069441833613018130289454170331580773162638639\ +5193793704654765220632063686587197822049312426053454111609356979\ +8281324522970007988835237595853285792513629646865114976752171234\ +5955923803937562512536985519495532509994703884399033646616547064\ +7234999796132343403021857052187836676345789510732982875157945215\ +7716521396263244383990184845609357626020316768042407958946934247 + +#define Z_SQUARE_ROOT_11 3.\ +3166247903553998491149327366706866839270885455893535970586821461\ +1648464260904384670884339912829065090701255784952745659227543978\ +4857547479779324933044728847302873974828655682577394444612098044\ +4771931123571441329715210988326604957100372485207381068208074875\ +8396589499452515931529840068271971051828955724842455676637002050\ +8129842236770597842039737427437130311226448688072317190977752062\ +9616099310799036448345876084690325051455517093627372268267160321\ +0207901919996927385750204334035187564780307139686203097819560584\ +3725362410405466369580534808247443172811968386717118059036597033\ +7448997202863169540371541080201902845827165665889629545544234863\ +9548140847137804628618335608388738384826935918833704592147012515\ +8427710904925025882797138714982167119273365512547126431962404617\ +2648548926892536495944124838553075458386858642464148905256510508\ +2976405813698950347726301882000479106251003209582933018375612614\ +1859454774457145379132752736187749409863990889436652633890856923\ +9596152811690656996164370695457708259448190021400820246857635105 + +#define Z_SQUARE_ROOT_12 3.\ +4641016151377545870548926830117447338856105076207612561116139589\ +0386603381760007416229237351449715135125228283081340605993989018\ +9997904957623311024188747297056186463804611164135949640202169349\ +8465300306246865338066457733013445093378436759424540942633207357\ +2317603809997307475971877893530069501315210151323669625921220189\ +5204374380650166291659047919665995579649016577428927665834694448\ +3279691757107953359161276367073322216863475617887566322041766110\ +4980334004704142228857739198191273159417433699614579898659296856\ +6041572817207977477395075164634635662791985966015677405754107826\ +7391266242074145280384982135364623985767512822828440334855042047\ +4598854166211979691895197532857779559229567591678045770970580715\ +2067705616128763944689322119379445745730528307645329396840042390\ +9683105568823625730690140703833000333785888309616921425542879995\ +2585366925915487672379022025429727749395309196490357710195075802\ +7761329923823924445914221110485847446384395476525123262937684065\ +7074333658772992238340994776727909918762915153437067472662518217 + +#define Z_SQUARE_ROOT_13 3.\ +6055512754639892931192212674704959462512965738452462127104530562\ +2716694829301044520461908201849071767351418202406354037603067826\ +4697807705163017166892709757742690564274152633233830394962346944\ +7962732299962880032688564272130721127331690722052975017855588384\ +4481465386892107539539248256331024468283663873252869681018926331\ +3049835539921621174410861805701512768903102881214399483179868380\ +9191329034353620627951223336511358206979573836238526577606890679\ +2609603184500630561512640198380725552254880439995068063909609144\ +6317976289163564544719685392169068915669891846759739035394769849\ +9962247909644289010644441276675481640212983715961814894472819793\ +8173214447846457811396497056952460736874807030279572211614048803\ +2881716595571961517619126745071133538732853360545103521380556650\ +2555494587073292081260347734391582994367395751429587741287176131\ +4898328491367481982288670670500887357298564518320813595755837452\ +8748997770498225074491739486122149917346314129778530567936583385\ +9084923735540651072975297023582252157988378502698942824546906255 + +#define Z_SQUARE_ROOT_14 3.\ +7416573867739413855837487323165493017560198077787269463037454673\ +2003515630693902797680989519437957150099108872775197754550656536\ +8164242592660042052551835117407401124474858631911100015230402627\ +9990638550213390300377330889721284945398105001694377593170299544\ +7319506049992643849467871984350198478834312631025757959589728144\ +9423640188510302034929081127343124602795306338103482722099939933\ +1632325073523166184196678410645529042707896011422412228117857535\ +3666229821592216114192712401401062892124966991333243644395454349\ +5761495087928623919979989096898963145846865535325529594557326107\ +0496315592433061044542370501975004465989191778372841899586982015\ +8709794801887759510441696284709199101022413286189989722195565414\ +2721715251914875629353000674583453673567421640048791525684582413\ +4590381859339872060995709667653664064804204506068932544077875384\ +0945992448071804734066289369704503299185073788343176149673387719\ +4520482494319253841618179781624882985315814656755067051262017785\ +5028030354711313419236714908509541918604246710579888794708646720 + +#define Z_SQUARE_ROOT_15 3.\ +8729833462074168851792653997823996108329217052915908265875737661\ +1348309193697903351928737685867351791630220686094964701318954043\ +9163649615679891746121203511068754791013493581283919531228889292\ +5658464170280625091931734126598648184554646285513159402626176726\ +4050864630045057781063197288093978192518830035530153001074835443\ +8098719014432460775585023104811717090606284157397581582901013330\ +3274447305580667026371791243800477125912479424727638166001355365\ +2722953567945703078465466105357724026016703376374906204296078718\ +7206146764349685215198853426648827511094432134918227578894674852\ +0940721921133583223212180500077532431298433832388736330198673631\ +2508581503502850494110642412413006178631087545427595823501050197\ +6880877132399945421214298433563187193571267457433965110883897630\ +1514122678489583087574339802329960288316221061594612915860282464\ +6477150647269610878726287509531568836209909087170850054933375711\ +4169765329150875277299737911463436952970866868642440087090506787\ +5857643721298543747329634589332214829062724155722750086355049105 + +#define Z_SQUARE_ROOT_17 4.\ +1231056256176605498214098559740770251471992253736204343986335730\ +9495434633762159358786365081068429668454404093921414161530142084\ +0415868363079548145746906977677023266436240863087790567572385708\ +2255213807325630838603091427498046719135293221479787181678157964\ +7590608056549697390076672138368921210670892102900552026497699722\ +7788461399259924591373145657819254743622377232515783073400662476\ +8914608949933141024362794433862805526374750609050808692574826754\ +0375757692746463166635103309681712291987419586443197105470595848\ +5725931943603620656058152613585046428067872150064104914222367522\ +2434867372580470377712749985665712185704321003036026065064871546\ +9069828154684645956450344184993059763950907861995904333420778303\ +6732466105002383305603648597891517738125149725101393295630516977\ +3961561344837040214695495172837747751283320867754324793019645038\ +5894596773652195702235648129282323237309165004475570946016572174\ +9143175547451122718361635317492475624065195560022755934398822460\ +4515186239457694121228445234277642559126704332598083584929486998 + +#define Z_SQUARE_ROOT_18 4.\ +2426406871192851464050661726290942357090156261308442195300392139\ +7219743538632111655116260298292471820504153869273689107477450816\ +7552211637932364491299807494239667997782516778267399851503458346\ +1817144103286799148179108236037905860441855522559226675958286569\ +8769145292614296435251928781088398575422396906176018963899542648\ +8921861845775057185164237250863279885189506725661012595571034063\ +1238102254965414811606999120970144450916320833709493627434692054\ +7881075586474173538933479000613903904685570696171170586552779458\ +3748493146265500261285705818044047416231430756462246697120903296\ +1160679456341047576404862275424767971678006256753399564375196681\ +8331127797754009341647394044712478903017845761120095594410265846\ +9183487192313521791064394121956576835196612073527368310068082338\ +2720881841487214326902512055109605105352177398094187182288990824\ +1414269644711869915409804074232618878073745771565430133795264517\ +7336074832402518559443431741081011323192754860794413051333505174\ +9745180668259276149746456384688555465416269083901588674688648297 + +#define Z_SQUARE_ROOT_19 4.\ +3588989435406735522369819838596156591370039252324449368903441381\ +5955732820315808565615915585194452690565862129827421362958399278\ +3826117012156560836417469900977752918879405890061996715663120740\ +2231024023243567359810484091999315007271878765601001355045664223\ +6597215798755072654740213348140339529383325316877083080148213289\ +2551238612636799418213993270206440885128549665158595212562962839\ +7050658074438389410005683926884800608708853847459490888521365568\ +2897687595213123671741821514292631858005215674427058607461711815\ +5313027391249683899068318958451783502733357016401652084179746424\ +9119887199195969203059693282567695404609647987775117895043783641\ +5092493623204442923896243349974708299840429604797134370576918442\ +5627972643810658724900993631178508595844998222091790883188614272\ +7181833978529354535768671044286487630521371921331655648231766597\ +9345008389213635130240253829821964016254338391921650785627655996\ +5090650060052816150475689600376677031529536405227933016338897672\ +3371709651582983076636407988920374740815704060472903563584299215 + +#define Z_SQUARE_ROOT_20 0.4\ +4721359549995793928183473374625524708812367192230514485417944908\ +2104185127560979882882881675756454993901635230154756700850653544\ +8894147727172720243066905417733556346383758331622553290645279713\ +1610715227008350675700068467848281288841728650781945051852544577\ +5259903480488136322355181781899698474278145945779696417728308537\ +9788198263387154039497357768850179508265912366353842999954849603\ +0608682300719153366650249976303562788160011248417104870844711122\ +1261268564046818666396586791949270454240268349922840527180947577\ +1008779374122271320091514279913191133913835129156443905000121078\ +4624680100185735297510594441135325073321489717070105246613569892\ +6684448463527455405326481536020888663165146701178619627245268639\ +7372943893979940361637904852891924069044282384465825196392651622\ +2083409916140962408069119898870137111037111450247772833100205248\ +7262514204889923757884936580680894943223091144640347535318092183\ +7059151207155968796108310761558128787279446057512125998964427704\ +3546971849070302420926911100814144557448430695575058224242423686 + +#define Z_SQUARE_ROOT_21 4.\ +5825756949558400065880471937280084889844565767679719026072421239\ +0686842554777088660436155949344503267760090539758574087331189917\ +0755601963573863362344755370281722824427798191940596904914344920\ +0907589407063891768364965598654748231477641506627774586518102302\ +3617481540081394241092573936592199391754224118467149808042185260\ +7864914105576957812554767761302518635256936196112241897810062910\ +4930136394500794769783448686170875778719949754100133598746930349\ +7232710675634826547407841963209655321589895494373754264061908665\ +0298094580890976956617810617911595220000768142485134230665143669\ +5554446605650313382719148849087683899267628798139136482473790088\ +8189170796483375176737417000297190682904936268171676523400834394\ +2339309104876265524351270370284614919106272664101521171992383656\ +8917367993395211009062164895819102794521088994407788913640625972\ +4578658417328751486109851757581404328234441664632974490001787377\ +2961869702397214029105976389008894920760202937832728984606379406\ +5965444919348178013459962365934780900907742704128997390722047147 + +#define Z_SQUARE_ROOT_22 4.\ +6904157598234295545656301135444662805882283534117371536057018910\ +1702463275323972148211559606154313535459589666150860748165195244\ +0782925621666958709181664447500641262161250754928188331862529999\ +9547606735605004577761471186401246176232605036362090494527493856\ +8281756795270303532693227571317120606062561691541530323494743550\ +5309200200713172534601558297417528194918298027430089141037481791\ +4120990984295018191164831945523178805176328354177778500806080498\ +3518565354318050021673153166262609016615771045384513239925669691\ +2783671255846108434988804201553172568680512142690822589008911929\ +7301919366967756643487865411179999979426852739982780774547630300\ +0579761472344263648399737905839299334981849660115492759940947126\ +7706320024001816123943437823342252060261602573061333660063214842\ +6550799462989785932504639612108923454456269629026365378382391889\ +5594959128764376806042909687553399184617386068557664784079261917\ +5504341699503617915696514044517092560612721096824920432766881292\ +5020851744085369494907976490160054424569362473428698311315235875 + +#define Z_SQUARE_ROOT_23 4.\ +7958315233127195415974380641626939199967070419041293464853091144\ +4825723590746408249219144643691886061747456324573686513392890392\ +1230265488845783794334079664727569671653494343978434561416798721\ +3151199128895631880449641132459392571845949603945392600435614646\ +0202152486503532934363086274731937668011877025054737708513330390\ +3772090443266178015016833535830415070486401794767454104791880465\ +7855465617661756852445057646538971125395858740433006194113747360\ +9109976350633040762876386724156939220008934770208711136596906907\ +1990861472258832971773823771307619381379694156308798460488452356\ +9769990440305484325289322905572397161711567767993108038428496669\ +0265902454607543365705389368190995394922917929701618373910486985\ +6969068133822070893274626509746898482482517803749584860075661414\ +0813637335815377083815895114543027468556805151334525399288480358\ +2656451880775953716880018678299314916241332339317904053586692241\ +7622541983641096572858498556893157253685192802209028187428956944\ +4281562508597976297795059510410340787752350836307895023173926977 + +#define Z_SQUARE_ROOT_24 4.\ +8989794855663561963945681494117827839318949613133402568653851345\ +0192075491463005307971886620928046963718920245322837824971773091\ +9675514683251567902474557105657825495055353142495260210541823540\ +4469626213579733817072648867050912080676176178787491711356931494\ +4872260828854054043234840367660016317961567602617940145738798726\ +1674316188801600887477375098329029307878290024089452896266632587\ +0218894836270265709900889323434532628509952966362490080231320907\ +2918018687172335863967331332533818263813071727532210516312358732\ +4723582205893441767091510257671059796648201117380410012830932248\ +2347067988208621159857969346790651055747208365931034366078207356\ +0076724633259464660565809954782094852720141025275395093777354012\ +8198591185143465692900577618302885149260520590592647415105006845\ +5119830908525625960061293441598848506045756852410681358957200931\ +9387995987119508123342717309306912496416512553772738561882612744\ +8670177296031449692674464894759090976288769586727401839482029557\ +0465751182126319692156620734019070649452846334283775172474830130 + +#define Z_SQUARE_ROOT_26 5.\ +0990195135927848300282241090227819895637709460995964075849708044\ +2593363206222419558834885109393200836119025824103991066143177934\ +1121536299802772626119936813352008233924081586515180609436925028\ +7447030884686971127028666876703708002538306916010980296796499813\ +3725782012085081891373043872791237919529532543918015594903365133\ +4616416621229877754192034707329287784925030350480663776842369164\ +2206608812846886072692694659774903784270665608067219846088576469\ +8177000874159382968970286250298437303308342881274293440653810033\ +7555839668996596880738823334427411886019717837418375236363862704\ +9538870426232971817793074424158421655398904669052096083958472252\ +7934332766274069417122115976356457683023641465745914071502665841\ +3008179744209425479832568063295040590668891451247346186873076700\ +8181285605275121624649596800874882281186312691873623153426977207\ +0381441088553192015422188300606801606467615769284725052746178827\ +1991760051314186821205851032521784571148355455157794144107701300\ +0658025436220535414630301094467472349730560558777566650504471075 + +#define Z_SQUARE_ROOT_27 5.\ +1961524227066318805823390245176171008284157614311418841674209383\ +5579905072640011124343856027174572702687842424622010908990983528\ +4996857436434966536283120945584279695706916746203924460303254024\ +7697950459370298007099686599520167640067655139136811413949811035\ +8476405714995961213957816840295104251972815226985504438881830284\ +2806561570975249437488571879498993369473524866143391498752041672\ +4919537635661930038741914550609983325295213426831349483062649165\ +7470501007056213343286608797286909739126150549421869847988945284\ +9062359225811966216092612746951953494187978949023516108631161740\ +1086899363111217920577473203046935978651269234242660502282563071\ +1898281249317969537842796299286669338844351387517068656455871072\ +8101558424193145917033983179069168618595792461467994095260063586\ +4524658353235438596035211055749500500678832464425382138314319992\ +8878050388873231508568533038144591624092963794735536565292613704\ +1641994885735886668871331665728771169576593214787684894406526098\ +5611500488159488357511492165091864878144372730155601208993777326 + +#define Z_SQUARE_ROOT_28 5.\ +2915026221291811810032315072785208514205183661649003607366689184\ +0213764646056725552078577294908722123012915667699492619148705977\ +7254429568854781111760215445434301459456647784599379189730174521\ +4019561084074476560474318822006838782320031570511926118914820703\ +0479360543281474759814808316303980880694863890734279946119401010\ +2799384475091232194238054756309983266576575408001315141349303926\ +9955041675876362292261817529475731912486611598959625632646141096\ +7300215431235892722383106909072954989641186180989699668067978004\ +2095723334665590073878492451434107432985157509664581464985342693\ +9605978998160754965022184557911377958396176296681816633705026707\ +1659078344423541428829949153814163978888882917944569482800607004\ +7064074389741476525863703872818166456119292556752204391958839417\ +8192709391722682363586135632427216982033556706425112669269800437\ +9629208451185900733912483738547465543004417504619932939626406425\ +6378909571360419012719248932571001523810082787008948742469770446\ +6554725020090119242161344669396240008601028980502412514623518230 + +#define Z_SQUARE_ROOT_29 5.\ +3851648071345040312507104915403295562951201616447888376803886700\ +1664596282765869287663378167983548441870482179394576060768862140\ +1981555626953216728208924528671722526185214681235990013052448016\ +2903887045278269438713694073940103168871959102567772596508381141\ +9495584193980826348969417532613403641636123108887427654955512364\ +7940365882555182273444125300757917124198604125931023584561198054\ +4795418813126253107293509901068873371670605812467416799303885413\ +8123742479087954547432014922688011360464232071011737861539855585\ +7102081717617603810395080111264836278444280815314492214121131843\ +6341076396213737228822837938481149242915346920084913077991373969\ +7089097190833461405997944064288657397292411152297722381325560371\ +7907312501357326363233051587278665098784329901442053725629656985\ +9172449839218439790049969327370087099206683073256802774244092317\ +5715419607139287353485337048180789528095729186886136682895069025\ +3666940455803261056985599438152074440985243814914009730255209859\ +5681681929637748409740639130952795240525758914068872104537046989 + +#define Z_SQUARE_ROOT_E 1.\ +64872127070012814684865078781416357165377610071014801157507 + +#define Z_SQUARE_ROOT_PI 1.\ +7724538509055160272981674833411451827975494561223871282138077898\ +5291128459103218137495065673854466541622682362428257066623615286\ +5724422602525093709602787068462037698653105122849925173028950826\ +2289320953792679628001746390153514797205167001901852340185854469\ +7449491264031392177552590621640541933250090639840761373347747515\ +3433667989789365851836408795451165161738760059067393431791332809\ +8548462481849020546548521956132515616474675150427387610561079961\ +2710721006037204448367236529661370809432349883166842421384570960\ +9120420427785778068694766570005218305685125413396636944654181510\ +7166938833219429293570622688652244205421499480499207564863988748\ +3850593064021821402928581123306497894520362114907896228738940324\ +5978198513134871266512506293260044656382109675026812496930595420\ +4615607619522173915250702077927580990543329006622230676144696612\ +4818874306997883520506146444385418530797357425717918563595974995\ +9952263849242203889103966406447293972841345043002140564233433039\ +26175613417633632001703765416347632066927654181283576249032690 + +/* MARK: - Irrational numbers (cube roots) */ + +#define Z_CUBE_ROOT_2 1.\ +2599210498948731647672106072782283505702514647015079800819751121\ +5529967651395948372939656243625509415431025603561566525939902404\ +0613737228459110304269355246960642616625000977474526565480306867\ +1854055186892458725167641993737096950983827831613991551293136953\ +6618394746344857657030311909589598474110598116290705359081647801\ +1473521325484771297880242208582053257972526662202669005665608199\ +4715628176405060664826773572670419486207621442965694205079319172\ +4414809204482328401274703219642820812019057141889964599983175038\ +0188868959420205592202115472997384880260736369741788779215798467\ +5099539630078260959624203483238660139857363433909737126527995991\ +9699683779131681681544288502796515292781076797140020406056748039\ +3856125171835700690798499634197629147404483454026971547622851317\ +8020643878047649322579052898467085805286258130005429388560720609\ +7472230406313572349364584065759169169167270601244028967000010690\ +8103531385290270041508423233623988938649678219414983802707295717\ +6812879001445746227147702348357151905506722084818485009287239209 + +#define Z_CUBE_ROOT_3 1.\ +4422495703074083823216383107801095883918692534993505775464161945\ +4168759682999733985475547970564525668683508085448954996642542394\ +6110259714868950157185237227090332023847598445061085540027260088\ +1454988727513673553524678660747156884392233189182017038998238223\ +3212961663550852626734913350166545489578817585527417559336313187\ +4146720060463846664756937436419755574942490682081094267123590626\ +5763689646373616178216558425874823856595235871903196104071395306\ +0281028535084436380351945501338091522239078498975091939480365311\ +9674345706233811941118355657692483200123107015915332930042827066\ +6394443820480019012241818057851180278635499201489352352796818010\ +9006236835327970373724614565173415353390990467105304156937690305\ +1494958995216166591166333801954227266482814311818441716553576688\ +1832140589503272799127928026983572135676304667631409826930968622\ +4764941404644842887133087994684187000204561876902750330462036656\ +4440717909119698039747478883802670722844748159482087239611601227\ +1067171066612781813201108139530097227226661910705939909901191206 + +/* MARK: - Irrational numbers (other roots) */ + +#define Z_12TH_ROOT_2 1.\ +0594630943592952645618252949463417007792043174941856285592084314\ +5876164606325572238376837686394556900774076432638281736624173752\ +0827851039644723985114271115432990470239714933804165425687642097\ +6329379895947129709947064800938991173847686705520689400326781575\ +1383303231319955390959014587484595500681806521772802362810455571\ +3869553201754802640057179595879584537567829830020977379250053687\ +4403398881937606323435254399006328830846125529480888721482330441\ +4074184893108198509249979986687035709497917584337029863023761262\ +5173981919008919366931298054535197982705358773565786048226460447\ +3090968624372596272293682528044863570700171131799931049836732088\ +9886403556920267157664120910549625751449398108864973818515174409\ +2025177988784831666892332928201939743642078982338822600070557879\ +0103964696887044937701555993149379866153352257152374614051434715\ +9095506342399653920121443555462612297570882130516983593531956991\ +7044 + +/* MARK: - Integer numbers */ + +#define Z_CARMACK_NUMBER 0x5F3759DF +#define Z_LOMONT_NUMBER 0x5F375A86 + +#endif /* Z_constants_numbers_H */ diff --git a/projects/Zeta/API/Z/constants/pointer.h b/projects/Zeta/API/Z/constants/pointer.h new file mode 100644 index 0000000..5fa9665 --- /dev/null +++ b/projects/Zeta/API/Z/constants/pointer.h @@ -0,0 +1,29 @@ +/* Zeta API - Z/constants/pointer.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_constants_pointer_H +#define Z_constants_pointer_H + +#ifdef Z_NULL +# undef Z_NULL +#endif + +#ifdef __cplusplus +# include + +# if Z_DIALECT_HAS_LITERAL(CPP11, NULLPTR) +# define Z_NULL nullptr +# else +# define Z_NULL 0 +# endif + +#else +# define Z_NULL ((void *)0) +#endif + +#endif /* Z_constants_pointer_H */ diff --git a/projects/Zeta/API/Z/formats/archive/TAR.h b/projects/Zeta/API/Z/formats/archive/TAR.h new file mode 100644 index 0000000..25b9ced --- /dev/null +++ b/projects/Zeta/API/Z/formats/archive/TAR.h @@ -0,0 +1,59 @@ +/* Zeta API - Z/formats/archive/TAR.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_archive_TAR_H +#define Z_formats_archive_TAR_H + +#include +#include + +/* http://www.gnu.org/software/tar/manual/html_node/Standard.html */ + +#define Z_TAR_BLOCK_SIZE 512 + +typedef Z_PACKED_STRUCTURE_BEGIN { /* byte offset */ + zuint8 name[100]; /* 0 */ + zuint8 mode[8]; /* 100 */ + zuint8 uid[8]; /* 108 */ + zuint8 gid[8]; /* 116 */ + zuint8 size[12]; /* 124 */ + zuint8 mtime[12]; /* 136 */ + zuint8 checksum[8]; /* 148 */ + zuint8 item_type; /* 156 */ + zuint8 link_name[100]; /* 157 */ + zuint8 magic[6]; /* 257 */ + zuint8 version[2]; /* 263 */ + zuint8 uname[32]; /* 265 */ + zuint8 gname[32]; /* 297 */ + zuint8 device_major[8]; /* 329 */ + zuint8 device_minor[8]; /* 337 */ + zuint8 prefix[155]; /* 345 */ + /* 500 */ +} Z_PACKED_STRUCTURE_END Z_TARPOSIXHeader; + +typedef Z_TARPOSIXHeader Z_TARHeader; + +#define Z_TAR_ITEM_TYPE_OLD_REGULAR_FILE 0 +#define Z_TAR_ITEM_TYPE_REGULAR_FILE 0x30 +#define Z_TAR_ITEM_TYPE_LINK 0x31 +#define Z_TAR_ITEM_TYPE_SYMBOLIC_LINK 0x32 +#define Z_TAR_ITEM_TYPE_CHARACTER_DEVICE 0x33 +#define Z_TAR_ITEM_TYPE_BLOCK_DEVICE 0x34 +#define Z_TAR_ITEM_TYPE_DIRECTORY 0x35 +#define Z_TAR_ITEM_TYPE_FIFO 0x36 +#define Z_TAR_ITEM_TYPE_CONTIGUOUS_FILE 0x37 + +#define Z_TAR_ITEM_TYPE_GNU_DIRECTORY_DUMP 'D' /* file names from dumped directory */ +#define Z_TAR_ITEM_TYPE_GNU_LONG_LINK 'K' /* long link name */ +#define Z_TAR_ITEM_TYPE_GNU_LONG_NAME 'L' /* long file name */ +#define Z_TAR_ITEM_TYPE_GNU_MULTIVOLUME 'M' /* continuation of file from another volume */ +#define Z_TAR_ITEM_TYPE_GNU_NAMES 'N' /* file name that does not fit into main hdr */ +#define Z_TAR_ITEM_TYPE_GNU_SPARSE 'S' /* sparse file */ +#define Z_TAR_ITEM_TYPE_GNU_VOLUME_HEADER 'V' /* tape/volume header */ + +#endif /* Z_formats_archive_TAR_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/ASCII.h b/projects/Zeta/API/Z/formats/character_set/ASCII.h new file mode 100644 index 0000000..f59ce45 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/ASCII.h @@ -0,0 +1,141 @@ +/* Zeta API - Z/formats/character_set/ASCII.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_ASCII_H +#define Z_formats_character_set_ASCII_H + +#define Z_ASCII_NULL 0x00 +#define Z_ASCII_START_OF_HEADING 0x01 +#define Z_ASCII_START_OF_TEXT 0x02 +#define Z_ASCII_END_OF_TEXT 0x03 +#define Z_ASCII_END_OF_TRANSMISSION 0x04 +#define Z_ASCII_ENQUIRY 0x05 +#define Z_ASCII_ACKNOWLEDGE 0x06 +#define Z_ASCII_BELL 0x07 +#define Z_ASCII_BACKSPACE 0x08 +#define Z_ASCII_CHARACTER_TABULATION 0x09 +#define Z_ASCII_LINE_FEED 0x0A +#define Z_ASCII_LINE_TABULATION 0x0B +#define Z_ASCII_FORM_FEED 0x0C +#define Z_ASCII_CARRIAGE_RETURN 0x0D +#define Z_ASCII_SHIFT_OUT 0x0E +#define Z_ASCII_SHIFT_IN 0x0F +#define Z_ASCII_DATA_LINK_ESCAPE 0x10 +#define Z_ASCII_DEVICE_CONTROL_ONE 0x11 +#define Z_ASCII_DEVICE_CONTROL_TWO 0x12 +#define Z_ASCII_DEVICE_CONTROL_THREE 0x13 +#define Z_ASCII_DEVICE_CONTROL_FOUR 0x14 +#define Z_ASCII_NEGATIVE_ACKNOWLEDGE 0x15 +#define Z_ASCII_SYNCHRONOUS_IDLE 0x16 +#define Z_ASCII_END_OF_TRANSMISSION_BLOCK 0x17 +#define Z_ASCII_CANCEL 0x18 +#define Z_ASCII_END_OF_MEDIUM 0x19 +#define Z_ASCII_SUBSTITUTE 0x1A +#define Z_ASCII_ESCAPE 0x1B +#define Z_ASCII_INFO_SEPARATOR_FOUR 0x1C +#define Z_ASCII_INFO_SEPARATOR_THREE 0x1D +#define Z_ASCII_INFO_SEPARATOR_TWO 0x1E +#define Z_ASCII_INFO_SEPARATOR_ONE 0x1F +#define Z_ASCII_SPACE 0x20 +#define Z_ASCII_EXCLAMATION_MARK 0x21 +#define Z_ASCII_QUOTATION_MARK 0x22 +#define Z_ASCII_NUMBER_SIGN 0x23 +#define Z_ASCII_DOLLAR_SIGN 0x24 +#define Z_ASCII_PERCENT_SIGN 0x25 +#define Z_ASCII_AMPERSAND 0x26 +#define Z_ASCII_APOSTROPHE 0x27 +#define Z_ASCII_LEFT_PARENTHESIS 0x28 +#define Z_ASCII_RIGHT_PARENTHESIS 0x29 +#define Z_ASCII_ASTERISK 0x2A +#define Z_ASCII_PLUS_SIGN 0x2B +#define Z_ASCII_COMMA 0x2C +#define Z_ASCII_HYPHEN_MINUS 0x2D +#define Z_ASCII_FULL_STOP 0x2E +#define Z_ASCII_SOLIDUS 0x2F +#define Z_ASCII_DIGIT_ZERO 0x30 +#define Z_ASCII_DIGIT_ONE 0x31 +#define Z_ASCII_DIGIT_TWO 0x32 +#define Z_ASCII_DIGIT_THREE 0x33 +#define Z_ASCII_DIGIT_FOUR 0x34 +#define Z_ASCII_DIGIT_FIVE 0x35 +#define Z_ASCII_DIGIT_SIX 0x36 +#define Z_ASCII_DIGIT_SEVEN 0x37 +#define Z_ASCII_DIGIT_EIGHT 0x38 +#define Z_ASCII_DIGIT_NINE 0x39 +#define Z_ASCII_COLON 0x3A +#define Z_ASCII_SEMICOLON 0x3B +#define Z_ASCII_LESS_THAN_SIGN 0x3C +#define Z_ASCII_EQUALS_SIGN 0x3D +#define Z_ASCII_GREATER_THAN_SIGN 0x3E +#define Z_ASCII_QUESTION_MARK 0x3F +#define Z_ASCII_COMMERCIAL_AT 0x40 +#define Z_ASCII_LATIN_CAPITAL_LETTER_A 0x41 +#define Z_ASCII_LATIN_CAPITAL_LETTER_B 0x42 +#define Z_ASCII_LATIN_CAPITAL_LETTER_C 0x43 +#define Z_ASCII_LATIN_CAPITAL_LETTER_D 0x44 +#define Z_ASCII_LATIN_CAPITAL_LETTER_E 0x45 +#define Z_ASCII_LATIN_CAPITAL_LETTER_F 0x46 +#define Z_ASCII_LATIN_CAPITAL_LETTER_G 0x47 +#define Z_ASCII_LATIN_CAPITAL_LETTER_H 0x48 +#define Z_ASCII_LATIN_CAPITAL_LETTER_I 0x49 +#define Z_ASCII_LATIN_CAPITAL_LETTER_J 0x4A +#define Z_ASCII_LATIN_CAPITAL_LETTER_K 0x4B +#define Z_ASCII_LATIN_CAPITAL_LETTER_L 0x4C +#define Z_ASCII_LATIN_CAPITAL_LETTER_M 0x4D +#define Z_ASCII_LATIN_CAPITAL_LETTER_N 0x4E +#define Z_ASCII_LATIN_CAPITAL_LETTER_O 0x4F +#define Z_ASCII_LATIN_CAPITAL_LETTER_P 0x50 +#define Z_ASCII_LATIN_CAPITAL_LETTER_Q 0x51 +#define Z_ASCII_LATIN_CAPITAL_LETTER_R 0x52 +#define Z_ASCII_LATIN_CAPITAL_LETTER_S 0x53 +#define Z_ASCII_LATIN_CAPITAL_LETTER_T 0x54 +#define Z_ASCII_LATIN_CAPITAL_LETTER_U 0x55 +#define Z_ASCII_LATIN_CAPITAL_LETTER_V 0x56 +#define Z_ASCII_LATIN_CAPITAL_LETTER_W 0x57 +#define Z_ASCII_LATIN_CAPITAL_LETTER_X 0x58 +#define Z_ASCII_LATIN_CAPITAL_LETTER_Y 0x59 +#define Z_ASCII_LATIN_CAPITAL_LETTER_Z 0x5A +#define Z_ASCII_LEFT_SQUARE_BRACKET 0x5B +#define Z_ASCII_REVERSE_SOLIDUS 0x5C +#define Z_ASCII_RIGHT_SQUARE_BRACKET 0x5D +#define Z_ASCII_CIRCUMFLEX_ACCENT 0x5E +#define Z_ASCII_LOW_LINE 0x5F +#define Z_ASCII_GRAVE_ACCENT 0x60 +#define Z_ASCII_LATIN_SMALL_LETTER_A 0x61 +#define Z_ASCII_LATIN_SMALL_LETTER_B 0x62 +#define Z_ASCII_LATIN_SMALL_LETTER_C 0x63 +#define Z_ASCII_LATIN_SMALL_LETTER_D 0x64 +#define Z_ASCII_LATIN_SMALL_LETTER_E 0x65 +#define Z_ASCII_LATIN_SMALL_LETTER_F 0x66 +#define Z_ASCII_LATIN_SMALL_LETTER_G 0x67 +#define Z_ASCII_LATIN_SMALL_LETTER_H 0x68 +#define Z_ASCII_LATIN_SMALL_LETTER_I 0x69 +#define Z_ASCII_LATIN_SMALL_LETTER_J 0x6A +#define Z_ASCII_LATIN_SMALL_LETTER_K 0x6B +#define Z_ASCII_LATIN_SMALL_LETTER_L 0x6C +#define Z_ASCII_LATIN_SMALL_LETTER_M 0x6D +#define Z_ASCII_LATIN_SMALL_LETTER_N 0x6E +#define Z_ASCII_LATIN_SMALL_LETTER_O 0x6F +#define Z_ASCII_LATIN_SMALL_LETTER_P 0x70 +#define Z_ASCII_LATIN_SMALL_LETTER_Q 0x71 +#define Z_ASCII_LATIN_SMALL_LETTER_R 0x72 +#define Z_ASCII_LATIN_SMALL_LETTER_S 0x73 +#define Z_ASCII_LATIN_SMALL_LETTER_T 0x74 +#define Z_ASCII_LATIN_SMALL_LETTER_U 0x75 +#define Z_ASCII_LATIN_SMALL_LETTER_V 0x76 +#define Z_ASCII_LATIN_SMALL_LETTER_W 0x77 +#define Z_ASCII_LATIN_SMALL_LETTER_X 0x78 +#define Z_ASCII_LATIN_SMALL_LETTER_Y 0x79 +#define Z_ASCII_LATIN_SMALL_LETTER_Z 0x7A +#define Z_ASCII_LEFT_CURLY_BRACKET 0x7B +#define Z_ASCII_VERTICAL_LINE 0x7C +#define Z_ASCII_RIGHT_CURLY_BRACKET 0x7D +#define Z_ASCII_TILDE 0x7E +#define Z_ASCII_DELETE 0x7F + +#endif /* Z_formats_character_set_ASCII_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP437.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP437.h new file mode 100644 index 0000000..2db03f3 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP437.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP437.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP437_H +#define Z_formats_character_set_DOS_CP437_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP437_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP437_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP437_LATIN_SMALL_LETTER_I_WITH_GRAVE 0x8D +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0x98 +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP437_CENT_SIGN 0x9B +#define Z_DOS_CP437_POUND_SIGN 0x9C +#define Z_DOS_CP437_YEN_SIGN 0x9D +#define Z_DOS_CP437_PESETA_SIGN 0x9E +#define Z_DOS_CP437_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP437_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP437_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP437_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP437_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP437_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP437_REVERSED_NOT_SIGN 0xA9 +#define Z_DOS_CP437_NOT_SIGN 0xAA +#define Z_DOS_CP437_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP437_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP437_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP437_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP437_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP437_LIGHT_SHADE 0xB0 +#define Z_DOS_CP437_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP437_DARK_SHADE 0xB2 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP437_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP437_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP437_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP437_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP437_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP437_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP437_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP437_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP437_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP437_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP437_FULL_BLOCK 0xDB +#define Z_DOS_CP437_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP437_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP437_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP437_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP437_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP437_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP437_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP437_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP437_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP437_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP437_MICRO_SIGN 0xE6 +#define Z_DOS_CP437_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP437_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP437_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP437_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP437_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP437_INFINITY 0xEC +#define Z_DOS_CP437_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP437_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP437_INTERSECTION 0xEF +#define Z_DOS_CP437_IDENTICAL_TO 0xF0 +#define Z_DOS_CP437_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP437_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP437_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP437_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP437_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP437_DIVISION_SIGN 0xF6 +#define Z_DOS_CP437_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP437_DEGREE_SIGN 0xF8 +#define Z_DOS_CP437_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP437_MIDDLE_DOT 0xFA +#define Z_DOS_CP437_SQUARE_ROOT 0xFB +#define Z_DOS_CP437_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP437_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP437_BLACK_SQUARE 0xFE +#define Z_DOS_CP437_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP437_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(00EC), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00F2), _(00FB), _(00F9), \ + _(00FF), _(00D6), _(00DC), _(00A2), _(00A3), _(00A5), _(20A7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(2310), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP437_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP737.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP737.h new file mode 100644 index 0000000..1b680f3 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP737.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP737.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP737_H +#define Z_formats_character_set_DOS_CP737_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_ALPHA 0x80 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_BETA 0x81 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_GAMMA 0x82 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_DELTA 0x83 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_EPSILON 0x84 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_ZETA 0x85 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_ETA 0x86 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_THETA 0x87 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_IOTA 0x88 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_KAPPA 0x89 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_LAMDA 0x8A +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_MU 0x8B +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_NU 0x8C +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_XI 0x8D +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_OMICRON 0x8E +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_PI 0x8F +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_RHO 0x90 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_SIGMA 0x91 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_TAU 0x92 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_UPSILON 0x93 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_PHI 0x94 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_CHI 0x95 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_PSI 0x96 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_OMEGA 0x97 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_ALPHA 0x98 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_BETA 0x99 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_GAMMA 0x9A +#define Z_DOS_CP737_GREEK_SMALL_LETTER_DELTA 0x9B +#define Z_DOS_CP737_GREEK_SMALL_LETTER_EPSILON 0x9C +#define Z_DOS_CP737_GREEK_SMALL_LETTER_ZETA 0x9D +#define Z_DOS_CP737_GREEK_SMALL_LETTER_ETA 0x9E +#define Z_DOS_CP737_GREEK_SMALL_LETTER_THETA 0x9F +#define Z_DOS_CP737_GREEK_SMALL_LETTER_IOTA 0xA0 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_KAPPA 0xA1 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_LAMDA 0xA2 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_MU 0xA3 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_NU 0xA4 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_XI 0xA5 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_OMICRON 0xA6 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_PI 0xA7 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_RHO 0xA8 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_SIGMA 0xA9 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_FINAL_SIGMA 0xAA +#define Z_DOS_CP737_GREEK_SMALL_LETTER_TAU 0xAB +#define Z_DOS_CP737_GREEK_SMALL_LETTER_UPSILON 0xAC +#define Z_DOS_CP737_GREEK_SMALL_LETTER_PHI 0xAD +#define Z_DOS_CP737_GREEK_SMALL_LETTER_CHI 0xAE +#define Z_DOS_CP737_GREEK_SMALL_LETTER_PSI 0xAF +#define Z_DOS_CP737_LIGHT_SHADE 0xB0 +#define Z_DOS_CP737_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP737_DARK_SHADE 0xB2 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP737_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP737_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP737_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP737_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP737_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP737_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP737_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP737_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP737_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP737_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP737_FULL_BLOCK 0xDB +#define Z_DOS_CP737_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP737_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP737_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP737_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP737_GREEK_SMALL_LETTER_OMEGA 0xE0 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_ALPHA_WITH_TONOS 0xE1 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_EPSILON_WITH_TONOS 0xE2 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_ETA_WITH_TONOS 0xE3 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_IOTA_WITH_DIALYTIKA 0xE4 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_IOTA_WITH_TONOS 0xE5 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_OMICRON_WITH_TONOS 0xE6 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_UPSILON_WITH_TONOS 0xE7 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_UPSILON_WITH_DIALYTIKA 0xE8 +#define Z_DOS_CP737_GREEK_SMALL_LETTER_OMEGA_WITH_TONOS 0xE9 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_ALPHA_WITH_TONOS 0xEA +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_EPSILON_WITH_TONOS 0xEB +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_ETA_WITH_TONOS 0xEC +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_IOTA_WITH_TONOS 0xED +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_OMICRON_WITH_TONOS 0xEE +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_UPSILON_WITH_TONOS 0xEF +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_OMEGA_WITH_TONOS 0xF0 +#define Z_DOS_CP737_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP737_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP737_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_IOTA_WITH_DIALYTIKA 0xF4 +#define Z_DOS_CP737_GREEK_CAPITAL_LETTER_UPSILON_WITH_DIALYTIKA 0xF5 +#define Z_DOS_CP737_DIVISION_SIGN 0xF6 +#define Z_DOS_CP737_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP737_DEGREE_SIGN 0xF8 +#define Z_DOS_CP737_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP737_MIDDLE_DOT 0xFA +#define Z_DOS_CP737_SQUARE_ROOT 0xFB +#define Z_DOS_CP737_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP737_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP737_BLACK_SQUARE 0xFE +#define Z_DOS_CP737_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP737_TO_UNICODE(_) \ + _(0391), _(0392), _(0393), _(0394), _(0395), _(0396), _(0397), _(0398), \ + _(0399), _(039A), _(039B), _(039C), _(039D), _(039E), _(039F), _(03A0), \ + _(03A1), _(03A3), _(03A4), _(03A5), _(03A6), _(03A7), _(03A8), _(03A9), \ + _(03B1), _(03B2), _(03B3), _(03B4), _(03B5), _(03B6), _(03B7), _(03B8), \ + _(03B9), _(03BA), _(03BB), _(03BC), _(03BD), _(03BE), _(03BF), _(03C0), \ + _(03C1), _(03C3), _(03C2), _(03C4), _(03C5), _(03C6), _(03C7), _(03C8), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03C9), _(03AC), _(03AD), _(03AE), _(03CA), _(03AF), _(03CC), _(03CD), \ + _(03CB), _(03CE), _(0386), _(0388), _(0389), _(038A), _(038C), _(038E), \ + _(038F), _(00B1), _(2265), _(2264), _(03AA), _(03AB), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP737_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP775.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP775.h new file mode 100644 index 0000000..242d4c6 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP775.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP775.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP775_H +#define Z_formats_character_set_DOS_CP775_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_C_WITH_ACUTE 0x80 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_A_WITH_MACRON 0x83 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_G_WITH_CEDILLA 0x85 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_C_WITH_ACUTE 0x87 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_L_WITH_STROKE 0x88 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_E_WITH_MACRON 0x89 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_R_WITH_CEDILLA 0x8A +#define Z_DOS_CP775_LATIN_SMALL_LETTER_R_WITH_CEDILLA 0x8B +#define Z_DOS_CP775_LATIN_SMALL_LETTER_I_WITH_MACRON 0x8C +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_Z_WITH_ACUTE 0x8D +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_O_WITH_MACRON 0x93 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_G_WITH_CEDILLA 0x95 +#define Z_DOS_CP775_CENT_SIGN 0x96 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_S_WITH_ACUTE 0x97 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_S_WITH_ACUTE 0x98 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP775_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP775_POUND_SIGN 0x9C +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP775_MULTIPLICATION_SIGN 0x9E +#define Z_DOS_CP775_CURRENCY_SIGN 0x9F +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_A_WITH_MACRON 0xA0 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_I_WITH_MACRON 0xA1 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_Z_WITH_DOT_ABOVE 0xA3 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_Z_WITH_DOT_ABOVE 0xA4 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_Z_WITH_ACUTE 0xA5 +#define Z_DOS_CP775_RIGHT_DOUBLE_QUOTATION_MARK 0xA6 +#define Z_DOS_CP775_BROKEN_BAR 0xA7 +#define Z_DOS_CP775_COPYRIGHT_SIGN 0xA8 +#define Z_DOS_CP775_REGISTERED_SIGN 0xA9 +#define Z_DOS_CP775_NOT_SIGN 0xAA +#define Z_DOS_CP775_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP775_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_L_WITH_STROKE 0xAD +#define Z_DOS_CP775_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP775_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP775_LIGHT_SHADE 0xB0 +#define Z_DOS_CP775_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP775_DARK_SHADE 0xB2 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_A_WITH_OGONEK 0xB5 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_C_WITH_CARON 0xB6 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_E_WITH_OGONEK 0xB7 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_E_WITH_DOT_ABOVE 0xB8 +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_I_WITH_OGONEK 0xBD +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_S_WITH_CARON 0xBE +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_U_WITH_OGONEK 0xC6 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_U_WITH_MACRON 0xC7 +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP775_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_Z_WITH_CARON 0xCF +#define Z_DOS_CP775_LATIN_SMALL_LETTER_A_WITH_OGONEK 0xD0 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_C_WITH_CARON 0xD1 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_E_WITH_OGONEK 0xD2 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_E_WITH_DOT_ABOVE 0xD3 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_I_WITH_OGONEK 0xD4 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_S_WITH_CARON 0xD5 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_U_WITH_OGONEK 0xD6 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_U_WITH_MACRON 0xD7 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_Z_WITH_CARON 0xD8 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP775_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP775_FULL_BLOCK 0xDB +#define Z_DOS_CP775_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP775_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP775_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP775_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xE0 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_O_WITH_MACRON 0xE2 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_N_WITH_ACUTE 0xE3 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_O_WITH_TILDE 0xE4 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_O_WITH_TILDE 0xE5 +#define Z_DOS_CP775_MICRO_SIGN 0xE6 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_N_WITH_ACUTE 0xE7 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_K_WITH_CEDILLA 0xE8 +#define Z_DOS_CP775_LATIN_SMALL_LETTER_K_WITH_CEDILLA 0xE9 +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_L_WITH_CEDILLA 0xEA +#define Z_DOS_CP775_LATIN_SMALL_LETTER_L_WITH_CEDILLA 0xEB +#define Z_DOS_CP775_LATIN_SMALL_LETTER_N_WITH_CEDILLA 0xEC +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_E_WITH_MACRON 0xED +#define Z_DOS_CP775_LATIN_CAPITAL_LETTER_N_WITH_CEDILLA 0xEE +#define Z_DOS_CP775_RIGHT_SINGLE_QUOTATION_MARK 0xEF +#define Z_DOS_CP775_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP775_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP775_LEFT_DOUBLE_QUOTATION_MARK 0xF2 +#define Z_DOS_CP775_VULGAR_FRACTION_THREE_QUARTERS 0xF3 +#define Z_DOS_CP775_PILCROW_SIGN 0xF4 +#define Z_DOS_CP775_SECTION_SIGN 0xF5 +#define Z_DOS_CP775_DIVISION_SIGN 0xF6 +#define Z_DOS_CP775_DOUBLE_LOW_9_QUOTATION_MARK 0xF7 +#define Z_DOS_CP775_DEGREE_SIGN 0xF8 +#define Z_DOS_CP775_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP775_MIDDLE_DOT 0xFA +#define Z_DOS_CP775_SUPERSCRIPT_ONE 0xFB +#define Z_DOS_CP775_SUPERSCRIPT_THREE 0xFC +#define Z_DOS_CP775_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP775_BLACK_SQUARE 0xFE +#define Z_DOS_CP775_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP775_TO_UNICODE(_) \ + _(0106), _(00FC), _(00E9), _(0101), _(00E4), _(0123), _(00E5), _(0107), \ + _(0142), _(0113), _(0156), _(0157), _(012B), _(0179), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(014D), _(00F6), _(0122), _(00A2), _(015A), \ + _(015B), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(00D7), _(00A4), \ + _(0100), _(012A), _(00F3), _(017B), _(017C), _(017A), _(201D), _(00A6), \ + _(00A9), _(00AE), _(00AC), _(00BD), _(00BC), _(0141), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(0104), _(010C), _(0118), \ + _(0116), _(2563), _(2551), _(2557), _(255D), _(012E), _(0160), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(0172), _(016A), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(017D), \ + _(0105), _(010D), _(0119), _(0117), _(012F), _(0161), _(0173), _(016B), \ + _(017E), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(00D3), _(00DF), _(014C), _(0143), _(00F5), _(00D5), _(00B5), _(0144), \ + _(0136), _(0137), _(013B), _(013C), _(0146), _(0112), _(0145), _(2019), \ + _(00AD), _(00B1), _(201C), _(00BE), _(00B6), _(00A7), _(00F7), _(201E), \ + _(00B0), _(2219), _(00B7), _(00B9), _(00B3), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP775_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP850.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP850.h new file mode 100644 index 0000000..17dea5e --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP850.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP850.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP850_H +#define Z_formats_character_set_DOS_CP850_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP850_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP850_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP850_LATIN_SMALL_LETTER_I_WITH_GRAVE 0x8D +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0x98 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP850_POUND_SIGN 0x9C +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP850_MULTIPLICATION_SIGN 0x9E +#define Z_DOS_CP850_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP850_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP850_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP850_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP850_REGISTERED_SIGN 0xA9 +#define Z_DOS_CP850_NOT_SIGN 0xAA +#define Z_DOS_CP850_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP850_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP850_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP850_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP850_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP850_LIGHT_SHADE 0xB0 +#define Z_DOS_CP850_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP850_DARK_SHADE 0xB2 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0xB5 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0xB6 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0xB7 +#define Z_DOS_CP850_COPYRIGHT_SIGN 0xB8 +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP850_CENT_SIGN 0xBD +#define Z_DOS_CP850_YEN_SIGN 0xBE +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_A_WITH_TILDE 0xC6 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_A_WITH_TILDE 0xC7 +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP850_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP850_CURRENCY_SIGN 0xCF +#define Z_DOS_CP850_LATIN_SMALL_LETTER_ETH 0xD0 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_ETH 0xD1 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX 0xD2 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS 0xD3 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_E_WITH_GRAVE 0xD4 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_DOTLESS_I 0xD5 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0xD6 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX 0xD7 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS 0xD8 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP850_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP850_FULL_BLOCK 0xDB +#define Z_DOS_CP850_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP850_BROKEN_BAR 0xDD +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_I_WITH_GRAVE 0xDE +#define Z_DOS_CP850_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xE0 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0xE2 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_GRAVE 0xE3 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_O_WITH_TILDE 0xE4 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_O_WITH_TILDE 0xE5 +#define Z_DOS_CP850_MICRO_SIGN 0xE6 +#define Z_DOS_CP850_LATIN_SMALL_LETTER_THORN 0xE7 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_THORN 0xE8 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0xE9 +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX 0xEA +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_U_WITH_GRAVE 0xEB +#define Z_DOS_CP850_LATIN_SMALL_LETTER_Y_WITH_ACUTE 0xEC +#define Z_DOS_CP850_LATIN_CAPITAL_LETTER_Y_WITH_ACUTE 0xED +#define Z_DOS_CP850_MACRON 0xEE +#define Z_DOS_CP850_ACUTE_ACCENT 0xEF +#define Z_DOS_CP850_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP850_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP850_DOUBLE_LOW_LINE 0xF2 +#define Z_DOS_CP850_VULGAR_FRACTION_THREE_QUARTERS 0xF3 +#define Z_DOS_CP850_PILCROW_SIGN 0xF4 +#define Z_DOS_CP850_SECTION_SIGN 0xF5 +#define Z_DOS_CP850_DIVISION_SIGN 0xF6 +#define Z_DOS_CP850_CEDILLA 0xF7 +#define Z_DOS_CP850_DEGREE_SIGN 0xF8 +#define Z_DOS_CP850_DIAERESIS 0xF9 +#define Z_DOS_CP850_MIDDLE_DOT 0xFA +#define Z_DOS_CP850_SUPERSCRIPT_ONE 0xFB +#define Z_DOS_CP850_SUPERSCRIPT_THREE 0xFC +#define Z_DOS_CP850_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP850_BLACK_SQUARE 0xFE +#define Z_DOS_CP850_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP850_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(00EC), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00F2), _(00FB), _(00F9), \ + _(00FF), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(00D7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(00AE), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(00C1), _(00C2), _(00C0), \ + _(00A9), _(2563), _(2551), _(2557), _(255D), _(00A2), _(00A5), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(00E3), _(00C3), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(00A4), \ + _(00F0), _(00D0), _(00CA), _(00CB), _(00C8), _(0131), _(00CD), _(00CE), \ + _(00CF), _(2518), _(250C), _(2588), _(2584), _(00A6), _(00CC), _(2580), \ + _(00D3), _(00DF), _(00D4), _(00D2), _(00F5), _(00D5), _(00B5), _(00FE), \ + _(00DE), _(00DA), _(00DB), _(00D9), _(00FD), _(00DD), _(00AF), _(00B4), \ + _(00AD), _(00B1), _(2017), _(00BE), _(00B6), _(00A7), _(00F7), _(00B8), \ + _(00B0), _(00A8), _(00B7), _(00B9), _(00B3), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP850_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP852.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP852.h new file mode 100644 index 0000000..a04c8df --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP852.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP852.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP852_H +#define Z_formats_character_set_DOS_CP852_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_U_WITH_RING_ABOVE 0x85 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_C_WITH_ACUTE 0x86 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_L_WITH_STROKE 0x88 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_O_WITH_DOUBLE_ACUTE 0x8A +#define Z_DOS_CP852_LATIN_SMALL_LETTER_O_WITH_DOUBLE_ACUTE 0x8B +#define Z_DOS_CP852_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_Z_WITH_ACUTE 0x8D +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_C_WITH_ACUTE 0x8F +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_L_WITH_ACUTE 0x91 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_L_WITH_ACUTE 0x92 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_L_WITH_CARON 0x95 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_L_WITH_CARON 0x96 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_S_WITH_ACUTE 0x97 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_S_WITH_ACUTE 0x98 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_T_WITH_CARON 0x9B +#define Z_DOS_CP852_LATIN_SMALL_LETTER_T_WITH_CARON 0x9C +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_L_WITH_STROKE 0x9D +#define Z_DOS_CP852_MULTIPLICATION_SIGN 0x9E +#define Z_DOS_CP852_LATIN_SMALL_LETTER_C_WITH_CARON 0x9F +#define Z_DOS_CP852_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_A_WITH_OGONEK 0xA4 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_A_WITH_OGONEK 0xA5 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_Z_WITH_CARON 0xA6 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_Z_WITH_CARON 0xA7 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_E_WITH_OGONEK 0xA8 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_E_WITH_OGONEK 0xA9 +#define Z_DOS_CP852_NOT_SIGN 0xAA +#define Z_DOS_CP852_LATIN_SMALL_LETTER_Z_WITH_ACUTE 0xAB +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_C_WITH_CARON 0xAC +#define Z_DOS_CP852_LATIN_SMALL_LETTER_S_WITH_CEDILLA 0xAD +#define Z_DOS_CP852_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP852_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP852_LIGHT_SHADE 0xB0 +#define Z_DOS_CP852_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP852_DARK_SHADE 0xB2 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0xB5 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0xB6 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_E_WITH_CARON 0xB7 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_S_WITH_CEDILLA 0xB8 +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_Z_WITH_DOT_ABOVE 0xBD +#define Z_DOS_CP852_LATIN_SMALL_LETTER_Z_WITH_DOT_ABOVE 0xBE +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_A_WITH_BREVE 0xC6 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_A_WITH_BREVE 0xC7 +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP852_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP852_CURRENCY_SIGN 0xCF +#define Z_DOS_CP852_LATIN_SMALL_LETTER_D_WITH_STROKE 0xD0 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_D_WITH_STROKE 0xD1 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_D_WITH_CARON 0xD2 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS 0xD3 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_D_WITH_CARON 0xD4 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_N_WITH_CARON 0xD5 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0xD6 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX 0xD7 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_E_WITH_CARON 0xD8 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP852_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP852_FULL_BLOCK 0xDB +#define Z_DOS_CP852_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_T_WITH_CEDILLA 0xDD +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_U_WITH_RING_ABOVE 0xDE +#define Z_DOS_CP852_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xE0 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0xE2 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_N_WITH_ACUTE 0xE3 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_N_WITH_ACUTE 0xE4 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_N_WITH_CARON 0xE5 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_S_WITH_CARON 0xE6 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_S_WITH_CARON 0xE7 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_R_WITH_ACUTE 0xE8 +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0xE9 +#define Z_DOS_CP852_LATIN_SMALL_LETTER_R_WITH_ACUTE 0xEA +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_U_WITH_DOUBLE_ACUTE 0xEB +#define Z_DOS_CP852_LATIN_SMALL_LETTER_Y_WITH_ACUTE 0xEC +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_Y_WITH_ACUTE 0xED +#define Z_DOS_CP852_LATIN_SMALL_LETTER_T_WITH_CEDILLA 0xEE +#define Z_DOS_CP852_ACUTE_ACCENT 0xEF +#define Z_DOS_CP852_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP852_DOUBLE_ACUTE_ACCENT 0xF1 +#define Z_DOS_CP852_OGONEK 0xF2 +#define Z_DOS_CP852_CARON 0xF3 +#define Z_DOS_CP852_BREVE 0xF4 +#define Z_DOS_CP852_SECTION_SIGN 0xF5 +#define Z_DOS_CP852_DIVISION_SIGN 0xF6 +#define Z_DOS_CP852_CEDILLA 0xF7 +#define Z_DOS_CP852_DEGREE_SIGN 0xF8 +#define Z_DOS_CP852_DIAERESIS 0xF9 +#define Z_DOS_CP852_DOT_ABOVE 0xFA +#define Z_DOS_CP852_LATIN_SMALL_LETTER_U_WITH_DOUBLE_ACUTE 0xFB +#define Z_DOS_CP852_LATIN_CAPITAL_LETTER_R_WITH_CARON 0xFC +#define Z_DOS_CP852_LATIN_SMALL_LETTER_R_WITH_CARON 0xFD +#define Z_DOS_CP852_BLACK_SQUARE 0xFE +#define Z_DOS_CP852_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP852_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(016F), _(0107), _(00E7), \ + _(0142), _(00EB), _(0150), _(0151), _(00EE), _(0179), _(00C4), _(0106), \ + _(00C9), _(0139), _(013A), _(00F4), _(00F6), _(013D), _(013E), _(015A), \ + _(015B), _(00D6), _(00DC), _(0164), _(0165), _(0141), _(00D7), _(010D), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(0104), _(0105), _(017D), _(017E), \ + _(0118), _(0119), _(00AC), _(017A), _(010C), _(015F), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(00C1), _(00C2), _(011A), \ + _(015E), _(2563), _(2551), _(2557), _(255D), _(017B), _(017C), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(0102), _(0103), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(00A4), \ + _(0111), _(0110), _(010E), _(00CB), _(010F), _(0147), _(00CD), _(00CE), \ + _(011B), _(2518), _(250C), _(2588), _(2584), _(0162), _(016E), _(2580), \ + _(00D3), _(00DF), _(00D4), _(0143), _(0144), _(0148), _(0160), _(0161), \ + _(0154), _(00DA), _(0155), _(0170), _(00FD), _(00DD), _(0163), _(00B4), \ + _(00AD), _(02DD), _(02DB), _(02C7), _(02D8), _(00A7), _(00F7), _(00B8), \ + _(00B0), _(00A8), _(02D9), _(0171), _(0158), _(0159), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP852_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP855.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP855.h new file mode 100644 index 0000000..5847056 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP855.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP855.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP855_H +#define Z_formats_character_set_DOS_CP855_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_DJE 0x80 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_DJE 0x81 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_GJE 0x82 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_GJE 0x83 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_IO 0x84 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_IO 0x85 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_UKRAINIAN_IE 0x86 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_UKRAINIAN_IE 0x87 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_DZE 0x88 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_DZE 0x89 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_BYELORUSSIAN_UKRAINIAN_I 0x8A +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_BYELORUSSIAN_UKRAINIAN_I 0x8B +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_YI 0x8C +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_YI 0x8D +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_JE 0x8E +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_JE 0x8F +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_LJE 0x90 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_LJE 0x91 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_NJE 0x92 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_NJE 0x93 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_TSHE 0x94 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_TSHE 0x95 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_KJE 0x96 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_KJE 0x97 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_SHORT_U 0x98 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_SHORT_U 0x99 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_DZHE 0x9A +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_DZHE 0x9B +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_YU 0x9C +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_YU 0x9D +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_HARD_SIGN 0x9E +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_HARD_SIGN 0x9F +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_A 0xA0 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_A 0xA1 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_BE 0xA2 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_BE 0xA3 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_TSE 0xA4 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_TSE 0xA5 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_DE 0xA6 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_DE 0xA7 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_IE 0xA8 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_IE 0xA9 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_EF 0xAA +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_EF 0xAB +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_GHE 0xAC +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_GHE 0xAD +#define Z_DOS_CP855_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP855_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP855_LIGHT_SHADE 0xB0 +#define Z_DOS_CP855_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP855_DARK_SHADE 0xB2 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_HA 0xB5 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_HA 0xB6 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_I 0xB7 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_I 0xB8 +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_SHORT_I 0xBD +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_SHORT_I 0xBE +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_KA 0xC6 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_KA 0xC7 +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP855_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP855_CURRENCY_SIGN 0xCF +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_EL 0xD0 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_EL 0xD1 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_EM 0xD2 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_EM 0xD3 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_EN 0xD4 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_EN 0xD5 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_O 0xD6 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_O 0xD7 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_PE 0xD8 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP855_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP855_FULL_BLOCK 0xDB +#define Z_DOS_CP855_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_PE 0xDD +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_YA 0xDE +#define Z_DOS_CP855_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_YA 0xE0 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_ER 0xE1 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_ER 0xE2 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_ES 0xE3 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_ES 0xE4 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_TE 0xE5 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_TE 0xE6 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_U 0xE7 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_U 0xE8 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_ZHE 0xE9 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_ZHE 0xEA +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_VE 0xEB +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_VE 0xEC +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_SOFT_SIGN 0xED +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_SOFT_SIGN 0xEE +#define Z_DOS_CP855_NUMERO_SIGN 0xEF +#define Z_DOS_CP855_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_YERU 0xF1 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_YERU 0xF2 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_ZE 0xF3 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_ZE 0xF4 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_SHA 0xF5 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_SHA 0xF6 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_E 0xF7 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_E 0xF8 +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_SHCHA 0xF9 +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_SHCHA 0xFA +#define Z_DOS_CP855_CYRILLIC_SMALL_LETTER_CHE 0xFB +#define Z_DOS_CP855_CYRILLIC_CAPITAL_LETTER_CHE 0xFC +#define Z_DOS_CP855_SECTION_SIGN 0xFD +#define Z_DOS_CP855_BLACK_SQUARE 0xFE +#define Z_DOS_CP855_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP855_TO_UNICODE(_) \ + _(0452), _(0402), _(0453), _(0403), _(0451), _(0401), _(0454), _(0404), \ + _(0455), _(0405), _(0456), _(0406), _(0457), _(0407), _(0458), _(0408), \ + _(0459), _(0409), _(045A), _(040A), _(045B), _(040B), _(045C), _(040C), \ + _(045E), _(040E), _(045F), _(040F), _(044E), _(042E), _(044A), _(042A), \ + _(0430), _(0410), _(0431), _(0411), _(0446), _(0426), _(0434), _(0414), \ + _(0435), _(0415), _(0444), _(0424), _(0433), _(0413), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(0445), _(0425), _(0438), \ + _(0418), _(2563), _(2551), _(2557), _(255D), _(0439), _(0419), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(043A), _(041A), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(00A4), \ + _(043B), _(041B), _(043C), _(041C), _(043D), _(041D), _(043E), _(041E), \ + _(043F), _(2518), _(250C), _(2588), _(2584), _(041F), _(044F), _(2580), \ + _(042F), _(0440), _(0420), _(0441), _(0421), _(0442), _(0422), _(0443), \ + _(0423), _(0436), _(0416), _(0432), _(0412), _(044C), _(042C), _(2116), \ + _(00AD), _(044B), _(042B), _(0437), _(0417), _(0448), _(0428), _(044D), \ + _(042D), _(0449), _(0429), _(0447), _(0427), _(00A7), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP855_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP857.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP857.h new file mode 100644 index 0000000..6e69b6c --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP857.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP857.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP857_H +#define Z_formats_character_set_DOS_CP857_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP857_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP857_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP857_LATIN_SMALL_LETTER_DOTLESS_I 0x8D +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_I_WITH_DOT_ABOVE 0x98 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP857_POUND_SIGN 0x9C +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_S_WITH_CEDILLA 0x9E +#define Z_DOS_CP857_LATIN_SMALL_LETTER_S_WITH_CEDILLA 0x9F +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_G_WITH_BREVE 0xA6 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_G_WITH_BREVE 0xA7 +#define Z_DOS_CP857_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP857_REGISTERED_SIGN 0xA9 +#define Z_DOS_CP857_NOT_SIGN 0xAA +#define Z_DOS_CP857_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP857_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP857_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP857_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP857_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP857_LIGHT_SHADE 0xB0 +#define Z_DOS_CP857_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP857_DARK_SHADE 0xB2 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0xB5 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0xB6 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0xB7 +#define Z_DOS_CP857_COPYRIGHT_SIGN 0xB8 +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP857_CENT_SIGN 0xBD +#define Z_DOS_CP857_YEN_SIGN 0xBE +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_A_WITH_TILDE 0xC6 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_A_WITH_TILDE 0xC7 +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP857_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP857_CURRENCY_SIGN 0xCF +#define Z_DOS_CP857_MASCULINE_ORDINAL_INDICATOR 0xD0 +#define Z_DOS_CP857_FEMININE_ORDINAL_INDICATOR 0xD1 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX 0xD2 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS 0xD3 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_E_WITH_GRAVE 0xD4 +/* D5h undefined */ +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0xD6 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX 0xD7 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS 0xD8 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP857_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP857_FULL_BLOCK 0xDB +#define Z_DOS_CP857_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP857_BROKEN_BAR 0xDD +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_I_WITH_GRAVE 0xDE +#define Z_DOS_CP857_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xE0 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0xE2 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_GRAVE 0xE3 +#define Z_DOS_CP857_LATIN_SMALL_LETTER_O_WITH_TILDE 0xE4 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_O_WITH_TILDE 0xE5 +#define Z_DOS_CP857_MICRO_SIGN 0xE6 +/* E7h undefined */ +#define Z_DOS_CP857_MULTIPLICATION_SIGN 0xE8 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0xE9 +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX 0xEA +#define Z_DOS_CP857_LATIN_CAPITAL_LETTER_U_WITH_GRAVE 0xEB +#define Z_DOS_CP857_LATIN_SMALL_LETTER_I_WITH_GRAVE 0xEC +#define Z_DOS_CP857_LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0xED +#define Z_DOS_CP857_MACRON 0xEE +#define Z_DOS_CP857_ACUTE_ACCENT 0xEF +#define Z_DOS_CP857_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP857_PLUS_MINUS_SIGN 0xF1 +/* F2h undefined */ +#define Z_DOS_CP857_VULGAR_FRACTION_THREE_QUARTERS 0xF3 +#define Z_DOS_CP857_PILCROW_SIGN 0xF4 +#define Z_DOS_CP857_SECTION_SIGN 0xF5 +#define Z_DOS_CP857_DIVISION_SIGN 0xF6 +#define Z_DOS_CP857_CEDILLA 0xF7 +#define Z_DOS_CP857_DEGREE_SIGN 0xF8 +#define Z_DOS_CP857_DIAERESIS 0xF9 +#define Z_DOS_CP857_MIDDLE_DOT 0xFA +#define Z_DOS_CP857_SUPERSCRIPT_ONE 0xFB +#define Z_DOS_CP857_SUPERSCRIPT_THREE 0xFC +#define Z_DOS_CP857_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP857_BLACK_SQUARE 0xFE +#define Z_DOS_CP857_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP857_TO_UNICODE(_, undefined) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(0131), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00F2), _(00FB), _(00F9), \ + _(0130), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(015E), _(015F), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(011E), _(011F), \ + _(00BF), _(00AE), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(00C1), _(00C2), _(00C0), \ + _(00A9), _(2563), _(2551), _(2557), _(255D), _(00A2), _(00A5), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(00E3), _(00C3), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(00A4), \ + _(00BA), _(00AA), _(00CA), _(00CB), _(00C8), undefined, _(00CD), _(00CE), \ + _(00CF), _(2518), _(250C), _(2588), _(2584), _(00A6), _(00CC), _(2580), \ + _(00D3), _(00DF), _(00D4), _(00D2), _(00F5), _(00D5), _(00B5), undefined, \ + _(00D7), _(00DA), _(00DB), _(00D9), _(00EC), _(00FF), _(00AF), _(00B4), \ + _(00AD), _(00B1), undefined, _(00BE), _(00B6), _(00A7), _(00F7), _(00B8), \ + _(00B0), _(00A8), _(00B7), _(00B9), _(00B3), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP857_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP858.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP858.h new file mode 100644 index 0000000..884d884 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP858.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP858.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP858_H +#define Z_formats_character_set_DOS_CP858_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP858_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP858_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP858_LATIN_SMALL_LETTER_I_WITH_GRAVE 0x8D +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0x98 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP858_POUND_SIGN 0x9C +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP858_MULTIPLICATION_SIGN 0x9E +#define Z_DOS_CP858_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP858_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP858_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP858_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP858_REGISTERED_SIGN 0xA9 +#define Z_DOS_CP858_NOT_SIGN 0xAA +#define Z_DOS_CP858_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP858_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP858_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP858_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP858_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP858_LIGHT_SHADE 0xB0 +#define Z_DOS_CP858_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP858_DARK_SHADE 0xB2 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0xB5 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0xB6 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0xB7 +#define Z_DOS_CP858_COPYRIGHT_SIGN 0xB8 +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP858_CENT_SIGN 0xBD +#define Z_DOS_CP858_YEN_SIGN 0xBE +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_A_WITH_TILDE 0xC6 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_A_WITH_TILDE 0xC7 +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP858_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP858_CURRENCY_SIGN 0xCF +#define Z_DOS_CP858_LATIN_SMALL_LETTER_ETH 0xD0 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_ETH 0xD1 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX 0xD2 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS 0xD3 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_E_WITH_GRAVE 0xD4 +#define Z_DOS_CP858_EURO_SIGN 0xD5 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0xD6 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX 0xD7 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS 0xD8 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP858_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP858_FULL_BLOCK 0xDB +#define Z_DOS_CP858_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP858_BROKEN_BAR 0xDD +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_I_WITH_GRAVE 0xDE +#define Z_DOS_CP858_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xE0 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0xE2 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_GRAVE 0xE3 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_O_WITH_TILDE 0xE4 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_O_WITH_TILDE 0xE5 +#define Z_DOS_CP858_MICRO_SIGN 0xE6 +#define Z_DOS_CP858_LATIN_SMALL_LETTER_THORN 0xE7 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_THORN 0xE8 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0xE9 +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX 0xEA +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_U_WITH_GRAVE 0xEB +#define Z_DOS_CP858_LATIN_SMALL_LETTER_Y_WITH_ACUTE 0xEC +#define Z_DOS_CP858_LATIN_CAPITAL_LETTER_Y_WITH_ACUTE 0xED +#define Z_DOS_CP858_MACRON 0xEE +#define Z_DOS_CP858_ACUTE_ACCENT 0xEF +#define Z_DOS_CP858_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP858_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP858_DOUBLE_LOW_LINE 0xF2 +#define Z_DOS_CP858_VULGAR_FRACTION_THREE_QUARTERS 0xF3 +#define Z_DOS_CP858_PILCROW_SIGN 0xF4 +#define Z_DOS_CP858_SECTION_SIGN 0xF5 +#define Z_DOS_CP858_DIVISION_SIGN 0xF6 +#define Z_DOS_CP858_CEDILLA 0xF7 +#define Z_DOS_CP858_DEGREE_SIGN 0xF8 +#define Z_DOS_CP858_DIAERESIS 0xF9 +#define Z_DOS_CP858_MIDDLE_DOT 0xFA +#define Z_DOS_CP858_SUPERSCRIPT_ONE 0xFB +#define Z_DOS_CP858_SUPERSCRIPT_THREE 0xFC +#define Z_DOS_CP858_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP858_BLACK_SQUARE 0xFE +#define Z_DOS_CP858_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP858_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(00EC), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00F2), _(00FB), _(00F9), \ + _(00FF), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(00D7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(00AE), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(00C1), _(00C2), _(00C0), \ + _(00A9), _(2563), _(2551), _(2557), _(255D), _(00A2), _(00A5), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(00E3), _(00C3), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(00A4), \ + _(00F0), _(00D0), _(00CA), _(00CB), _(00C8), _(20AC), _(00CD), _(00CE), \ + _(00CF), _(2518), _(250C), _(2588), _(2584), _(00A6), _(00CC), _(2580), \ + _(00D3), _(00DF), _(00D4), _(00D2), _(00F5), _(00D5), _(00B5), _(00FE), \ + _(00DE), _(00DA), _(00DB), _(00D9), _(00FD), _(00DD), _(00AF), _(00B4), \ + _(00AD), _(00B1), _(2017), _(00BE), _(00B6), _(00A7), _(00F7), _(00B8), \ + _(00B0), _(00A8), _(00B7), _(00B9), _(00B3), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP858_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP860.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP860.h new file mode 100644 index 0000000..821e6fe --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP860.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP860.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP860_H +#define Z_formats_character_set_DOS_CP860_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_A_WITH_TILDE 0x84 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0x86 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX 0x89 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0x8B +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP860_LATIN_SMALL_LETTER_I_WITH_GRAVE 0x8D +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_A_WITH_TILDE 0x8E +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0x8F +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0x91 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_E_WITH_GRAVE 0x92 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_O_WITH_TILDE 0x94 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0x96 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_I_WITH_GRAVE 0x98 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_O_WITH_TILDE 0x99 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP860_CENT_SIGN 0x9B +#define Z_DOS_CP860_POUND_SIGN 0x9C +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_U_WITH_GRAVE 0x9D +#define Z_DOS_CP860_PESETA_SIGN 0x9E +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0x9F +#define Z_DOS_CP860_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP860_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP860_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP860_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP860_LATIN_CAPITAL_LETTER_O_WITH_GRAVE 0xA9 +#define Z_DOS_CP860_NOT_SIGN 0xAA +#define Z_DOS_CP860_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP860_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP860_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP860_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP860_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP860_LIGHT_SHADE 0xB0 +#define Z_DOS_CP860_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP860_DARK_SHADE 0xB2 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP860_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP860_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP860_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP860_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP860_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP860_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP860_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP860_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP860_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP860_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP860_FULL_BLOCK 0xDB +#define Z_DOS_CP860_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP860_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP860_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP860_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP860_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP860_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP860_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP860_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP860_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP860_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP860_MICRO_SIGN 0xE6 +#define Z_DOS_CP860_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP860_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP860_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP860_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP860_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP860_INFINITY 0xEC +#define Z_DOS_CP860_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP860_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP860_INTERSECTION 0xEF +#define Z_DOS_CP860_IDENTICAL_TO 0xF0 +#define Z_DOS_CP860_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP860_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP860_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP860_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP860_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP860_DIVISION_SIGN 0xF6 +#define Z_DOS_CP860_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP860_DEGREE_SIGN 0xF8 +#define Z_DOS_CP860_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP860_MIDDLE_DOT 0xFA +#define Z_DOS_CP860_SQUARE_ROOT 0xFB +#define Z_DOS_CP860_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP860_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP860_BLACK_SQUARE 0xFE +#define Z_DOS_CP860_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP860_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E3), _(00E0), _(00C1), _(00E7), \ + _(00EA), _(00CA), _(00E8), _(00CD), _(00D4), _(00EC), _(00C3), _(00C2), \ + _(00C9), _(00C0), _(00C8), _(00F4), _(00F5), _(00F2), _(00DA), _(00F9), \ + _(00CC), _(00D5), _(00DC), _(00A2), _(00A3), _(00D9), _(20A7), _(00D3), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(00D2), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP860_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP861.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP861.h new file mode 100644 index 0000000..45eb2cd --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP861.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP861.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP861_H +#define Z_formats_character_set_DOS_CP861_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_ETH 0x8B +#define Z_DOS_CP861_LATIN_SMALL_LETTER_ETH 0x8C +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_THORN 0x8D +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_THORN 0x95 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_Y_WITH_ACUTE 0x97 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_Y_WITH_ACUTE 0x98 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP861_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP861_POUND_SIGN 0x9C +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP861_PESETA_SIGN 0x9E +#define Z_DOS_CP861_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP861_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_A_WITH_ACUTE 0xA4 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_I_WITH_ACUTE 0xA5 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_O_WITH_ACUTE 0xA6 +#define Z_DOS_CP861_LATIN_CAPITAL_LETTER_U_WITH_ACUTE 0xA7 +#define Z_DOS_CP861_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP861_REVERSED_NOT_SIGN 0xA9 +#define Z_DOS_CP861_NOT_SIGN 0xAA +#define Z_DOS_CP861_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP861_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP861_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP861_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP861_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP861_LIGHT_SHADE 0xB0 +#define Z_DOS_CP861_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP861_DARK_SHADE 0xB2 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP861_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP861_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP861_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP861_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP861_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP861_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP861_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP861_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP861_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP861_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP861_FULL_BLOCK 0xDB +#define Z_DOS_CP861_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP861_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP861_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP861_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP861_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP861_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP861_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP861_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP861_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP861_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP861_MICRO_SIGN 0xE6 +#define Z_DOS_CP861_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP861_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP861_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP861_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP861_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP861_INFINITY 0xEC +#define Z_DOS_CP861_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP861_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP861_INTERSECTION 0xEF +#define Z_DOS_CP861_IDENTICAL_TO 0xF0 +#define Z_DOS_CP861_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP861_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP861_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP861_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP861_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP861_DIVISION_SIGN 0xF6 +#define Z_DOS_CP861_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP861_DEGREE_SIGN 0xF8 +#define Z_DOS_CP861_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP861_MIDDLE_DOT 0xFA +#define Z_DOS_CP861_SQUARE_ROOT 0xFB +#define Z_DOS_CP861_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP861_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP861_BLACK_SQUARE 0xFE +#define Z_DOS_CP861_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP861_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00D0), _(00F0), _(00DE), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00FE), _(00FB), _(00DD), \ + _(00FD), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(20A7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00C1), _(00CD), _(00D3), _(00DA), \ + _(00BF), _(2310), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP861_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP862.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP862.h new file mode 100644 index 0000000..a1af323 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP862.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP862.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP862_H +#define Z_formats_character_set_DOS_CP862_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP862_HEBREW_LETTER_ALEF 0x80 +#define Z_DOS_CP862_HEBREW_LETTER_BET 0x81 +#define Z_DOS_CP862_HEBREW_LETTER_GIMEL 0x82 +#define Z_DOS_CP862_HEBREW_LETTER_DALET 0x83 +#define Z_DOS_CP862_HEBREW_LETTER_HE 0x84 +#define Z_DOS_CP862_HEBREW_LETTER_VAV 0x85 +#define Z_DOS_CP862_HEBREW_LETTER_ZAYIN 0x86 +#define Z_DOS_CP862_HEBREW_LETTER_HET 0x87 +#define Z_DOS_CP862_HEBREW_LETTER_TET 0x88 +#define Z_DOS_CP862_HEBREW_LETTER_YOD 0x89 +#define Z_DOS_CP862_HEBREW_LETTER_FINAL_KAF 0x8A +#define Z_DOS_CP862_HEBREW_LETTER_KAF 0x8B +#define Z_DOS_CP862_HEBREW_LETTER_LAMED 0x8C +#define Z_DOS_CP862_HEBREW_LETTER_FINAL_MEM 0x8D +#define Z_DOS_CP862_HEBREW_LETTER_MEM 0x8E +#define Z_DOS_CP862_HEBREW_LETTER_FINAL_NUN 0x8F +#define Z_DOS_CP862_HEBREW_LETTER_NUN 0x90 +#define Z_DOS_CP862_HEBREW_LETTER_SAMEKH 0x91 +#define Z_DOS_CP862_HEBREW_LETTER_AYIN 0x92 +#define Z_DOS_CP862_HEBREW_LETTER_FINAL_PE 0x93 +#define Z_DOS_CP862_HEBREW_LETTER_PE 0x94 +#define Z_DOS_CP862_HEBREW_LETTER_FINAL_TSADI 0x95 +#define Z_DOS_CP862_HEBREW_LETTER_TSADI 0x96 +#define Z_DOS_CP862_HEBREW_LETTER_QOF 0x97 +#define Z_DOS_CP862_HEBREW_LETTER_RESH 0x98 +#define Z_DOS_CP862_HEBREW_LETTER_SHIN 0x99 +#define Z_DOS_CP862_HEBREW_LETTER_TAV 0x9A +#define Z_DOS_CP862_CENT_SIGN 0x9B +#define Z_DOS_CP862_POUND_SIGN 0x9C +#define Z_DOS_CP862_YEN_SIGN 0x9D +#define Z_DOS_CP862_PESETA_SIGN 0x9E +#define Z_DOS_CP862_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP862_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP862_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP862_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP862_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP862_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP862_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP862_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP862_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP862_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP862_REVERSED_NOT_SIGN 0xA9 +#define Z_DOS_CP862_NOT_SIGN 0xAA +#define Z_DOS_CP862_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP862_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP862_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP862_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP862_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP862_LIGHT_SHADE 0xB0 +#define Z_DOS_CP862_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP862_DARK_SHADE 0xB2 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP862_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP862_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP862_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP862_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP862_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP862_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP862_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP862_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP862_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP862_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP862_FULL_BLOCK 0xDB +#define Z_DOS_CP862_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP862_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP862_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP862_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP862_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP862_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP862_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP862_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP862_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP862_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP862_MICRO_SIGN 0xE6 +#define Z_DOS_CP862_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP862_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP862_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP862_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP862_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP862_INFINITY 0xEC +#define Z_DOS_CP862_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP862_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP862_INTERSECTION 0xEF +#define Z_DOS_CP862_IDENTICAL_TO 0xF0 +#define Z_DOS_CP862_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP862_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP862_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP862_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP862_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP862_DIVISION_SIGN 0xF6 +#define Z_DOS_CP862_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP862_DEGREE_SIGN 0xF8 +#define Z_DOS_CP862_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP862_MIDDLE_DOT 0xFA +#define Z_DOS_CP862_SQUARE_ROOT 0xFB +#define Z_DOS_CP862_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP862_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP862_BLACK_SQUARE 0xFE +#define Z_DOS_CP862_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP862_TO_UNICODE(_) \ + _(05D0), _(05D1), _(05D2), _(05D3), _(05D4), _(05D5), _(05D6), _(05D7), \ + _(05D8), _(05D9), _(05DA), _(05DB), _(05DC), _(05DD), _(05DE), _(05DF), \ + _(05E0), _(05E1), _(05E2), _(05E3), _(05E4), _(05E5), _(05E6), _(05E7), \ + _(05E8), _(05E9), _(05EA), _(00A2), _(00A3), _(00A5), _(20A7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(2310), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP862_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP863.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP863.h new file mode 100644 index 0000000..05ab574 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP863.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP863.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP863_H +#define Z_formats_character_set_DOS_CP863_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX 0x84 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP863_PILCROW_SIGN 0x86 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP863_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP863_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP863_DOUBLE_LOW_LINE 0x8D +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0x8E +#define Z_DOS_CP863_SECTION_SIGN 0x8F +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_E_WITH_GRAVE 0x91 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX 0x92 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS 0x94 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS 0x95 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP863_CURRENCY_SIGN 0x98 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX 0x99 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP863_CENT_SIGN 0x9B +#define Z_DOS_CP863_POUND_SIGN 0x9C +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_U_WITH_GRAVE 0x9D +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX 0x9E +#define Z_DOS_CP863_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP863_BROKEN_BAR 0xA0 +#define Z_DOS_CP863_ACUTE_ACCENT 0xA1 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP863_DIAERESIS 0xA4 +#define Z_DOS_CP863_CEDILLA 0xA5 +#define Z_DOS_CP863_SUPERSCRIPT_THREE 0xA6 +#define Z_DOS_CP863_MACRON 0xA7 +#define Z_DOS_CP863_LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX 0xA8 +#define Z_DOS_CP863_REVERSED_NOT_SIGN 0xA9 +#define Z_DOS_CP863_NOT_SIGN 0xAA +#define Z_DOS_CP863_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP863_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP863_VULGAR_FRACTION_THREE_QUARTERS 0xAD +#define Z_DOS_CP863_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP863_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP863_LIGHT_SHADE 0xB0 +#define Z_DOS_CP863_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP863_DARK_SHADE 0xB2 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP863_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP863_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP863_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP863_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP863_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP863_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP863_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP863_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP863_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP863_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP863_FULL_BLOCK 0xDB +#define Z_DOS_CP863_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP863_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP863_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP863_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP863_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP863_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP863_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP863_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP863_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP863_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP863_MICRO_SIGN 0xE6 +#define Z_DOS_CP863_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP863_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP863_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP863_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP863_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP863_INFINITY 0xEC +#define Z_DOS_CP863_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP863_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP863_INTERSECTION 0xEF +#define Z_DOS_CP863_IDENTICAL_TO 0xF0 +#define Z_DOS_CP863_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP863_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP863_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP863_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP863_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP863_DIVISION_SIGN 0xF6 +#define Z_DOS_CP863_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP863_DEGREE_SIGN 0xF8 +#define Z_DOS_CP863_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP863_MIDDLE_DOT 0xFA +#define Z_DOS_CP863_SQUARE_ROOT 0xFB +#define Z_DOS_CP863_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP863_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP863_BLACK_SQUARE 0xFE +#define Z_DOS_CP863_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP863_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00C2), _(00E0), _(00B6), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(2017), _(00C0), _(00A7), \ + _(00C9), _(00C8), _(00CA), _(00F4), _(00CB), _(00CF), _(00FB), _(00F9), \ + _(00A4), _(00D4), _(00DC), _(00A2), _(00A3), _(00D9), _(00DB), _(0192), \ + _(00A6), _(00B4), _(00F3), _(00FA), _(00A8), _(00B8), _(00B3), _(00AF), \ + _(00CE), _(2310), _(00AC), _(00BD), _(00BC), _(00BE), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP863_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP864.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP864.h new file mode 100644 index 0000000..1db89f0 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP864.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP864.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP864_H +#define Z_formats_character_set_DOS_CP864_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP864_DEGREE_SIGN 0x80 +#define Z_DOS_CP864_MIDDLE_DOT 0x81 +#define Z_DOS_CP864_BULLET_OPERATOR 0x82 +#define Z_DOS_CP864_SQUARE_ROOT 0x83 +#define Z_DOS_CP864_MEDIUM_SHADE 0x84 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_HORIZONTAL 0x85 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_VERTICAL 0x86 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0x87 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0x88 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0x89 +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0x8A +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0x8B +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0x8C +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0x8D +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0x8E +#define Z_DOS_CP864_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0x8F +#define Z_DOS_CP864_GREEK_SMALL_LETTER_BETA 0x90 +#define Z_DOS_CP864_INFINITY 0x91 +#define Z_DOS_CP864_GREEK_SMALL_LETTER_PHI 0x92 +#define Z_DOS_CP864_PLUS_MINUS_SIGN 0x93 +#define Z_DOS_CP864_VULGAR_FRACTION_ONE_HALF 0x94 +#define Z_DOS_CP864_VULGAR_FRACTION_ONE_QUARTER 0x95 +#define Z_DOS_CP864_ALMOST_EQUAL_TO 0x96 +#define Z_DOS_CP864_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0x97 +#define Z_DOS_CP864_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0x98 +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_WITH_HAMZA_ABOVE_ISOLATED_FORM 0x99 +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_WITH_HAMZA_ABOVE_FINAL_FORM 0x9A +/* 9Bh undefined */ +/* 9Ch undefined */ +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_ISOLATED_FORM 0x9D +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_FINAL_FORM 0x9E +/* 9Fh undefined */ +#define Z_DOS_CP864_NO_BREAK_SPACE 0xA0 +#define Z_DOS_CP864_SOFT_HYPHEN 0xA1 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_WITH_MADDA_ABOVE_FINAL_FORM 0xA2 +#define Z_DOS_CP864_POUND_SIGN 0xA3 +#define Z_DOS_CP864_CURRENCY_SIGN 0xA4 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_WITH_HAMZA_ABOVE_FINAL_FORM 0xA5 +/* A6h undefined */ +/* A7h undefined */ +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_FINAL_FORM 0xA8 +#define Z_DOS_CP864_ARABIC_LETTER_BEH_ISOLATED_FORM 0xA9 +#define Z_DOS_CP864_ARABIC_LETTER_TEH_ISOLATED_FORM 0xAA +#define Z_DOS_CP864_ARABIC_LETTER_THEH_ISOLATED_FORM 0xAB +#define Z_DOS_CP864_ARABIC_COMMA 0xAC +#define Z_DOS_CP864_ARABIC_LETTER_JEEM_ISOLATED_FORM 0xAD +#define Z_DOS_CP864_ARABIC_LETTER_HAH_ISOLATED_FORM 0xAE +#define Z_DOS_CP864_ARABIC_LETTER_KHAH_ISOLATED_FORM 0xAF +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_ZERO 0xB0 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_ONE 0xB1 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_TWO 0xB2 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_THREE 0xB3 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_FOUR 0xB4 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_FIVE 0xB5 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_SIX 0xB6 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_SEVEN 0xB7 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_EIGHT 0xB8 +#define Z_DOS_CP864_ARABIC_INDIC_DIGIT_NINE 0xB9 +#define Z_DOS_CP864_ARABIC_LETTER_FEH_ISOLATED_FORM 0xBA +#define Z_DOS_CP864_ARABIC_SEMICOLON 0xBB +#define Z_DOS_CP864_ARABIC_LETTER_SEEN_ISOLATED_FORM 0xBC +#define Z_DOS_CP864_ARABIC_LETTER_SHEEN_ISOLATED_FORM 0xBD +#define Z_DOS_CP864_ARABIC_LETTER_SAD_ISOLATED_FORM 0xBE +#define Z_DOS_CP864_ARABIC_QUESTION_MARK 0xBF +#define Z_DOS_CP864_CENT_SIGN 0xC0 +#define Z_DOS_CP864_ARABIC_LETTER_HAMZA_ISOLATED_FORM 0xC1 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_WITH_MADDA_ABOVE_ISOLATED_FORM 0xC2 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_WITH_HAMZA_ABOVE_ISOLATED_FORM 0xC3 +#define Z_DOS_CP864_ARABIC_LETTER_WAW_WITH_HAMZA_ABOVE_ISOLATED_FORM 0xC4 +#define Z_DOS_CP864_ARABIC_LETTER_AIN_FINAL_FORM 0xC5 +#define Z_DOS_CP864_ARABIC_LETTER_YEH_WITH_HAMZA_ABOVE_INITIAL_FORM 0xC6 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_ISOLATED_FORM 0xC7 +#define Z_DOS_CP864_ARABIC_LETTER_BEH_INITIAL_FORM 0xC8 +#define Z_DOS_CP864_ARABIC_LETTER_TEH_MARBUTA_ISOLATED_FORM 0xC9 +#define Z_DOS_CP864_ARABIC_LETTER_TEH_INITIAL_FORM 0xCA +#define Z_DOS_CP864_ARABIC_LETTER_THEH_INITIAL_FORM 0xCB +#define Z_DOS_CP864_ARABIC_LETTER_JEEM_INITIAL_FORM 0xCC +#define Z_DOS_CP864_ARABIC_LETTER_HAH_INITIAL_FORM 0xCD +#define Z_DOS_CP864_ARABIC_LETTER_KHAH_INITIAL_FORM 0xCE +#define Z_DOS_CP864_ARABIC_LETTER_DAL_ISOLATED_FORM 0xCF +#define Z_DOS_CP864_ARABIC_LETTER_THAL_ISOLATED_FORM 0xD0 +#define Z_DOS_CP864_ARABIC_LETTER_REH_ISOLATED_FORM 0xD1 +#define Z_DOS_CP864_ARABIC_LETTER_ZAIN_ISOLATED_FORM 0xD2 +#define Z_DOS_CP864_ARABIC_LETTER_SEEN_INITIAL_FORM 0xD3 +#define Z_DOS_CP864_ARABIC_LETTER_SHEEN_INITIAL_FORM 0xD4 +#define Z_DOS_CP864_ARABIC_LETTER_SAD_INITIAL_FORM 0xD5 +#define Z_DOS_CP864_ARABIC_LETTER_DAD_INITIAL_FORM 0xD6 +#define Z_DOS_CP864_ARABIC_LETTER_TAH_ISOLATED_FORM 0xD7 +#define Z_DOS_CP864_ARABIC_LETTER_ZAH_ISOLATED_FORM 0xD8 +#define Z_DOS_CP864_ARABIC_LETTER_AIN_INITIAL_FORM 0xD9 +#define Z_DOS_CP864_ARABIC_LETTER_GHAIN_INITIAL_FORM 0xDA +#define Z_DOS_CP864_BROKEN_BAR 0xDB +#define Z_DOS_CP864_NOT_SIGN 0xDC +#define Z_DOS_CP864_DIVISION_SIGN 0xDD +#define Z_DOS_CP864_MULTIPLICATION_SIGN 0xDE +#define Z_DOS_CP864_ARABIC_LETTER_AIN_ISOLATED_FORM 0xDF +#define Z_DOS_CP864_ARABIC_TATWEEL 0xE0 +#define Z_DOS_CP864_ARABIC_LETTER_FEH_INITIAL_FORM 0xE1 +#define Z_DOS_CP864_ARABIC_LETTER_QAF_INITIAL_FORM 0xE2 +#define Z_DOS_CP864_ARABIC_LETTER_KAF_INITIAL_FORM 0xE3 +#define Z_DOS_CP864_ARABIC_LETTER_LAM_INITIAL_FORM 0xE4 +#define Z_DOS_CP864_ARABIC_LETTER_MEEM_INITIAL_FORM 0xE5 +#define Z_DOS_CP864_ARABIC_LETTER_NOON_INITIAL_FORM 0xE6 +#define Z_DOS_CP864_ARABIC_LETTER_HEH_INITIAL_FORM 0xE7 +#define Z_DOS_CP864_ARABIC_LETTER_WAW_ISOLATED_FORM 0xE8 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_MAKSURA_ISOLATED_FORM 0xE9 +#define Z_DOS_CP864_ARABIC_LETTER_YEH_INITIAL_FORM 0xEA +#define Z_DOS_CP864_ARABIC_LETTER_DAD_ISOLATED_FORM 0xEB +#define Z_DOS_CP864_ARABIC_LETTER_AIN_MEDIAL_FORM 0xEC +#define Z_DOS_CP864_ARABIC_LETTER_GHAIN_FINAL_FORM 0xED +#define Z_DOS_CP864_ARABIC_LETTER_GHAIN_ISOLATED_FORM 0xEE +#define Z_DOS_CP864_ARABIC_LETTER_MEEM_ISOLATED_FORM 0xEF +#define Z_DOS_CP864_ARABIC_SHADDA_MEDIAL_FORM 0xF0 +#define Z_DOS_CP864_ARABIC_SHADDA 0xF1 +#define Z_DOS_CP864_ARABIC_LETTER_NOON_ISOLATED_FORM 0xF2 +#define Z_DOS_CP864_ARABIC_LETTER_HEH_ISOLATED_FORM 0xF3 +#define Z_DOS_CP864_ARABIC_LETTER_HEH_MEDIAL_FORM 0xF4 +#define Z_DOS_CP864_ARABIC_LETTER_ALEF_MAKSURA_FINAL_FORM 0xF5 +#define Z_DOS_CP864_ARABIC_LETTER_YEH_FINAL_FORM 0xF6 +#define Z_DOS_CP864_ARABIC_LETTER_GHAIN_MEDIAL_FORM 0xF7 +#define Z_DOS_CP864_ARABIC_LETTER_QAF_ISOLATED_FORM 0xF8 +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_WITH_MADDA_ABOVE_ISOLATED_FORM 0xF9 +#define Z_DOS_CP864_ARABIC_LIGATURE_LAM_WITH_ALEF_WITH_MADDA_ABOVE_FINAL_FORM 0xFA +#define Z_DOS_CP864_ARABIC_LETTER_LAM_ISOLATED_FORM 0xFB +#define Z_DOS_CP864_ARABIC_LETTER_KAF_ISOLATED_FORM 0xFC +#define Z_DOS_CP864_ARABIC_LETTER_YEH_ISOLATED_FORM 0xFD +#define Z_DOS_CP864_BLACK_SQUARE 0xFE +/* FFh undefined */ + +#define Z_ARRAY_CONTENT_DOS_CP864_TO_UNICODE(_, undefined) \ + _(00B0), _(00B7), _(2219), _(221A), _(2592), _(2500), _(2502), _(253C), \ + _(2524), _(252C), _(251C), _(2534), _(2510), _(250C), _(2514), _(2518), \ + _(03B2), _(221E), _(03C6), _(00B1), _(00BD), _(00BC), _(2248), _(00AB), \ + _(00BB), _(FEF7), _(FEF8), undefined, undefined, _(FEFB), _(FEFC), undefined, \ + _(00A0), _(00AD), _(FE82), _(00A3), _(00A4), _(FE84), undefined, undefined, \ + _(FE8E), _(FE8F), _(FE95), _(FE99), _(060C), _(FE9D), _(FEA1), _(FEA5), \ + _(0660), _(0661), _(0662), _(0663), _(0664), _(0665), _(0666), _(0667), \ + _(0668), _(0669), _(FED1), _(061B), _(FEB1), _(FEB5), _(FEB9), _(061F), \ + _(00A2), _(FE80), _(FE81), _(FE83), _(FE85), _(FECA), _(FE8B), _(FE8D), \ + _(FE91), _(FE93), _(FE97), _(FE9B), _(FE9F), _(FEA3), _(FEA7), _(FEA9), \ + _(FEAB), _(FEAD), _(FEAF), _(FEB3), _(FEB7), _(FEBB), _(FEBF), _(FEC1), \ + _(FEC5), _(FECB), _(FECF), _(00A6), _(00AC), _(00F7), _(00D7), _(FEC9), \ + _(0640), _(FED3), _(FED7), _(FEDB), _(FEDF), _(FEE3), _(FEE7), _(FEEB), \ + _(FEED), _(FEEF), _(FEF3), _(FEBD), _(FECC), _(FECE), _(FECD), _(FEE1), \ + _(FE7D), _(0651), _(FEE5), _(FEE9), _(FEEC), _(FEF0), _(FEF2), _(FED0), \ + _(FED5), _(FEF5), _(FEF6), _(FEDD), _(FED9), _(FEF1), _(25A0), undefined + +#endif /* Z_formats_character_set_DOS_CP864_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP865.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP865.h new file mode 100644 index 0000000..2a15829 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP865.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP865.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP865_H +#define Z_formats_character_set_DOS_CP865_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_C_WITH_CEDILLA 0x80 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_U_WITH_DIAERESIS 0x81 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_E_WITH_ACUTE 0x82 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX 0x83 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_A_WITH_DIAERESIS 0x84 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_A_WITH_GRAVE 0x85 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_A_WITH_RING_ABOVE 0x86 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_C_WITH_CEDILLA 0x87 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX 0x88 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_E_WITH_DIAERESIS 0x89 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_E_WITH_GRAVE 0x8A +#define Z_DOS_CP865_LATIN_SMALL_LETTER_I_WITH_DIAERESIS 0x8B +#define Z_DOS_CP865_LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX 0x8C +#define Z_DOS_CP865_LATIN_SMALL_LETTER_I_WITH_GRAVE 0x8D +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS 0x8E +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE 0x8F +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_E_WITH_ACUTE 0x90 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_AE 0x91 +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_AE 0x92 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX 0x93 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x94 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_O_WITH_GRAVE 0x95 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX 0x96 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_U_WITH_GRAVE 0x97 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0x98 +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x99 +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS 0x9A +#define Z_DOS_CP865_LATIN_SMALL_LETTER_O_WITH_STROKE 0x9B +#define Z_DOS_CP865_POUND_SIGN 0x9C +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x9D +#define Z_DOS_CP865_PESETA_SIGN 0x9E +#define Z_DOS_CP865_LATIN_SMALL_LETTER_F_WITH_HOOK 0x9F +#define Z_DOS_CP865_LATIN_SMALL_LETTER_A_WITH_ACUTE 0xA0 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_I_WITH_ACUTE 0xA1 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_O_WITH_ACUTE 0xA2 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_U_WITH_ACUTE 0xA3 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_N_WITH_TILDE 0xA4 +#define Z_DOS_CP865_LATIN_CAPITAL_LETTER_N_WITH_TILDE 0xA5 +#define Z_DOS_CP865_FEMININE_ORDINAL_INDICATOR 0xA6 +#define Z_DOS_CP865_MASCULINE_ORDINAL_INDICATOR 0xA7 +#define Z_DOS_CP865_INVERTED_QUESTION_MARK 0xA8 +#define Z_DOS_CP865_REVERSED_NOT_SIGN 0xA9 +#define Z_DOS_CP865_NOT_SIGN 0xAA +#define Z_DOS_CP865_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP865_VULGAR_FRACTION_ONE_QUARTER 0xAC +#define Z_DOS_CP865_INVERTED_EXCLAMATION_MARK 0xAD +#define Z_DOS_CP865_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP865_CURRENCY_SIGN 0xAF +#define Z_DOS_CP865_LIGHT_SHADE 0xB0 +#define Z_DOS_CP865_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP865_DARK_SHADE 0xB2 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP865_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP865_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP865_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP865_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP865_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP865_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP865_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP865_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP865_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP865_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP865_FULL_BLOCK 0xDB +#define Z_DOS_CP865_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP865_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP865_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP865_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP865_GREEK_SMALL_LETTER_ALPHA 0xE0 +#define Z_DOS_CP865_LATIN_SMALL_LETTER_SHARP_S 0xE1 +#define Z_DOS_CP865_GREEK_CAPITAL_LETTER_GAMMA 0xE2 +#define Z_DOS_CP865_GREEK_SMALL_LETTER_PI 0xE3 +#define Z_DOS_CP865_GREEK_CAPITAL_LETTER_SIGMA 0xE4 +#define Z_DOS_CP865_GREEK_SMALL_LETTER_SIGMA 0xE5 +#define Z_DOS_CP865_MICRO_SIGN 0xE6 +#define Z_DOS_CP865_GREEK_SMALL_LETTER_TAU 0xE7 +#define Z_DOS_CP865_GREEK_CAPITAL_LETTER_PHI 0xE8 +#define Z_DOS_CP865_GREEK_CAPITAL_LETTER_THETA 0xE9 +#define Z_DOS_CP865_GREEK_CAPITAL_LETTER_OMEGA 0xEA +#define Z_DOS_CP865_GREEK_SMALL_LETTER_DELTA 0xEB +#define Z_DOS_CP865_INFINITY 0xEC +#define Z_DOS_CP865_GREEK_SMALL_LETTER_PHI 0xED +#define Z_DOS_CP865_GREEK_SMALL_LETTER_EPSILON 0xEE +#define Z_DOS_CP865_INTERSECTION 0xEF +#define Z_DOS_CP865_IDENTICAL_TO 0xF0 +#define Z_DOS_CP865_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP865_GREATER_THAN_OR_EQUAL_TO 0xF2 +#define Z_DOS_CP865_LESS_THAN_OR_EQUAL_TO 0xF3 +#define Z_DOS_CP865_TOP_HALF_INTEGRAL 0xF4 +#define Z_DOS_CP865_BOTTOM_HALF_INTEGRAL 0xF5 +#define Z_DOS_CP865_DIVISION_SIGN 0xF6 +#define Z_DOS_CP865_ALMOST_EQUAL_TO 0xF7 +#define Z_DOS_CP865_DEGREE_SIGN 0xF8 +#define Z_DOS_CP865_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP865_MIDDLE_DOT 0xFA +#define Z_DOS_CP865_SQUARE_ROOT 0xFB +#define Z_DOS_CP865_SUPERSCRIPT_LATIN_SMALL_LETTER_N 0xFC +#define Z_DOS_CP865_SUPERSCRIPT_TWO 0xFD +#define Z_DOS_CP865_BLACK_SQUARE 0xFE +#define Z_DOS_CP865_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP865_TO_UNICODE(_) \ + _(00C7), _(00FC), _(00E9), _(00E2), _(00E4), _(00E0), _(00E5), _(00E7), \ + _(00EA), _(00EB), _(00E8), _(00EF), _(00EE), _(00EC), _(00C4), _(00C5), \ + _(00C9), _(00E6), _(00C6), _(00F4), _(00F6), _(00F2), _(00FB), _(00F9), \ + _(00FF), _(00D6), _(00DC), _(00F8), _(00A3), _(00D8), _(20A7), _(0192), \ + _(00E1), _(00ED), _(00F3), _(00FA), _(00F1), _(00D1), _(00AA), _(00BA), \ + _(00BF), _(2310), _(00AC), _(00BD), _(00BC), _(00A1), _(00AB), _(00A4), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(03B1), _(00DF), _(0393), _(03C0), _(03A3), _(03C3), _(00B5), _(03C4), \ + _(03A6), _(0398), _(03A9), _(03B4), _(221E), _(03C6), _(03B5), _(2229), \ + _(2261), _(00B1), _(2265), _(2264), _(2320), _(2321), _(00F7), _(2248), \ + _(00B0), _(2219), _(00B7), _(221A), _(207F), _(00B2), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP865_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP866.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP866.h new file mode 100644 index 0000000..b1c74e7 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP866.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP866.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP866_H +#define Z_formats_character_set_DOS_CP866_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_A 0x80 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_BE 0x81 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_VE 0x82 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_GHE 0x83 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_DE 0x84 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_IE 0x85 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_ZHE 0x86 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_ZE 0x87 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_I 0x88 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_SHORT_I 0x89 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_KA 0x8A +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_EL 0x8B +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_EM 0x8C +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_EN 0x8D +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_O 0x8E +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_PE 0x8F +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_ER 0x90 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_ES 0x91 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_TE 0x92 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_U 0x93 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_EF 0x94 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_HA 0x95 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_TSE 0x96 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_CHE 0x97 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_SHA 0x98 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_SHCHA 0x99 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_HARD_SIGN 0x9A +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_YERU 0x9B +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_SOFT_SIGN 0x9C +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_E 0x9D +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_YU 0x9E +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_YA 0x9F +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_A 0xA0 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_BE 0xA1 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_VE 0xA2 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_GHE 0xA3 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_DE 0xA4 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_IE 0xA5 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_ZHE 0xA6 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_ZE 0xA7 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_I 0xA8 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_SHORT_I 0xA9 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_KA 0xAA +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_EL 0xAB +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_EM 0xAC +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_EN 0xAD +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_O 0xAE +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_PE 0xAF +#define Z_DOS_CP866_LIGHT_SHADE 0xB0 +#define Z_DOS_CP866_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP866_DARK_SHADE 0xB2 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_SINGLE_AND_LEFT_DOUBLE 0xB5 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_LEFT_SINGLE 0xB6 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_DOUBLE_AND_LEFT_SINGLE 0xB7 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_SINGLE_AND_LEFT_DOUBLE 0xB8 +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP866_BOX_DRAWINGS_UP_DOUBLE_AND_LEFT_SINGLE 0xBD +#define Z_DOS_CP866_BOX_DRAWINGS_UP_SINGLE_AND_LEFT_DOUBLE 0xBE +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_SINGLE_AND_RIGHT_DOUBLE 0xC6 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_RIGHT_SINGLE 0xC7 +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP866_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP866_BOX_DRAWINGS_UP_SINGLE_AND_HORIZONTAL_DOUBLE 0xCF +#define Z_DOS_CP866_BOX_DRAWINGS_UP_DOUBLE_AND_HORIZONTAL_SINGLE 0xD0 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE 0xD1 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_DOUBLE_AND_HORIZONTAL_SINGLE 0xD2 +#define Z_DOS_CP866_BOX_DRAWINGS_UP_DOUBLE_AND_RIGHT_SINGLE 0xD3 +#define Z_DOS_CP866_BOX_DRAWINGS_UP_SINGLE_AND_RIGHT_DOUBLE 0xD4 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_SINGLE_AND_RIGHT_DOUBLE 0xD5 +#define Z_DOS_CP866_BOX_DRAWINGS_DOWN_DOUBLE_AND_RIGHT_SINGLE 0xD6 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_DOUBLE_AND_HORIZONTAL_SINGLE 0xD7 +#define Z_DOS_CP866_BOX_DRAWINGS_VERTICAL_SINGLE_AND_HORIZONTAL_DOUBLE 0xD8 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP866_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP866_FULL_BLOCK 0xDB +#define Z_DOS_CP866_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP866_LEFT_HALF_BLOCK 0xDD +#define Z_DOS_CP866_RIGHT_HALF_BLOCK 0xDE +#define Z_DOS_CP866_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_ER 0xE0 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_ES 0xE1 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_TE 0xE2 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_U 0xE3 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_EF 0xE4 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_HA 0xE5 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_TSE 0xE6 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_CHE 0xE7 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_SHA 0xE8 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_SHCHA 0xE9 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_HARD_SIGN 0xEA +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_YERU 0xEB +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_SOFT_SIGN 0xEC +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_E 0xED +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_YU 0xEE +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_YA 0xEF +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_IO 0xF0 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_IO 0xF1 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_UKRAINIAN_IE 0xF2 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_UKRAINIAN_IE 0xF3 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_YI 0xF4 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_YI 0xF5 +#define Z_DOS_CP866_CYRILLIC_CAPITAL_LETTER_SHORT_U 0xF6 +#define Z_DOS_CP866_CYRILLIC_SMALL_LETTER_SHORT_U 0xF7 +#define Z_DOS_CP866_DEGREE_SIGN 0xF8 +#define Z_DOS_CP866_BULLET_OPERATOR 0xF9 +#define Z_DOS_CP866_MIDDLE_DOT 0xFA +#define Z_DOS_CP866_SQUARE_ROOT 0xFB +#define Z_DOS_CP866_NUMERO_SIGN 0xFC +#define Z_DOS_CP866_CURRENCY_SIGN 0xFD +#define Z_DOS_CP866_BLACK_SQUARE 0xFE +#define Z_DOS_CP866_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP866_TO_UNICODE(_) \ + _(0410), _(0411), _(0412), _(0413), _(0414), _(0415), _(0416), _(0417), \ + _(0418), _(0419), _(041A), _(041B), _(041C), _(041D), _(041E), _(041F), \ + _(0420), _(0421), _(0422), _(0423), _(0424), _(0425), _(0426), _(0427), \ + _(0428), _(0429), _(042A), _(042B), _(042C), _(042D), _(042E), _(042F), \ + _(0430), _(0431), _(0432), _(0433), _(0434), _(0435), _(0436), _(0437), \ + _(0438), _(0439), _(043A), _(043B), _(043C), _(043D), _(043E), _(043F), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(2561), _(2562), _(2556), \ + _(2555), _(2563), _(2551), _(2557), _(255D), _(255C), _(255B), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(255E), _(255F), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(2567), \ + _(2568), _(2564), _(2565), _(2559), _(2558), _(2552), _(2553), _(256B), \ + _(256A), _(2518), _(250C), _(2588), _(2584), _(258C), _(2590), _(2580), \ + _(0440), _(0441), _(0442), _(0443), _(0444), _(0445), _(0446), _(0447), \ + _(0448), _(0449), _(044A), _(044B), _(044C), _(044D), _(044E), _(044F), \ + _(0401), _(0451), _(0404), _(0454), _(0407), _(0457), _(040E), _(045E), \ + _(00B0), _(2219), _(00B7), _(221A), _(2116), _(00A4), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP866_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP869.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP869.h new file mode 100644 index 0000000..0fc23ef --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP869.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP869.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP869_H +#define Z_formats_character_set_DOS_CP869_H + +/* From 00h to 7Fh like ASCII */ +/* 80h undefined */ +/* 81h undefined */ +/* 82h undefined */ +/* 83h undefined */ +/* 84h undefined */ +/* 85h undefined */ +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_ALPHA_WITH_TONOS 0x86 +/* 87h undefined */ +#define Z_DOS_CP869_MIDDLE_DOT 0x88 +#define Z_DOS_CP869_NOT_SIGN 0x89 +#define Z_DOS_CP869_BROKEN_BAR 0x8A +#define Z_DOS_CP869_LEFT_SINGLE_QUOTATION_MARK 0x8B +#define Z_DOS_CP869_RIGHT_SINGLE_QUOTATION_MARK 0x8C +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_EPSILON_WITH_TONOS 0x8D +#define Z_DOS_CP869_HORIZONTAL_BAR 0x8E +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_ETA_WITH_TONOS 0x8F +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_IOTA_WITH_TONOS 0x90 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_IOTA_WITH_DIALYTIKA 0x91 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_OMICRON_WITH_TONOS 0x92 +/* 93h undefined */ +/* 94h undefined */ +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_UPSILON_WITH_TONOS 0x95 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_UPSILON_WITH_DIALYTIKA 0x96 +#define Z_DOS_CP869_COPYRIGHT_SIGN 0x97 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_OMEGA_WITH_TONOS 0x98 +#define Z_DOS_CP869_SUPERSCRIPT_TWO 0x99 +#define Z_DOS_CP869_SUPERSCRIPT_THREE 0x9A +#define Z_DOS_CP869_GREEK_SMALL_LETTER_ALPHA_WITH_TONOS 0x9B +#define Z_DOS_CP869_POUND_SIGN 0x9C +#define Z_DOS_CP869_GREEK_SMALL_LETTER_EPSILON_WITH_TONOS 0x9D +#define Z_DOS_CP869_GREEK_SMALL_LETTER_ETA_WITH_TONOS 0x9E +#define Z_DOS_CP869_GREEK_SMALL_LETTER_IOTA_WITH_TONOS 0x9F +#define Z_DOS_CP869_GREEK_SMALL_LETTER_IOTA_WITH_DIALYTIKA 0xA0 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_IOTA_WITH_DIALYTIKA_AND_TONOS 0xA1 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_OMICRON_WITH_TONOS 0xA2 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_UPSILON_WITH_TONOS 0xA3 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_ALPHA 0xA4 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_BETA 0xA5 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_GAMMA 0xA6 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_DELTA 0xA7 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_EPSILON 0xA8 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_ZETA 0xA9 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_ETA 0xAA +#define Z_DOS_CP869_VULGAR_FRACTION_ONE_HALF 0xAB +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_THETA 0xAC +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_IOTA 0xAD +#define Z_DOS_CP869_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP869_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP869_LIGHT_SHADE 0xB0 +#define Z_DOS_CP869_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP869_DARK_SHADE 0xB2 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_KAPPA 0xB5 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_LAMDA 0xB6 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_MU 0xB7 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_NU 0xB8 +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_XI 0xBD +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_OMICRON 0xBE +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_PI 0xC6 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_RHO 0xC7 +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP869_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_SIGMA 0xCF +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_TAU 0xD0 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_UPSILON 0xD1 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_PHI 0xD2 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_CHI 0xD3 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_PSI 0xD4 +#define Z_DOS_CP869_GREEK_CAPITAL_LETTER_OMEGA 0xD5 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_ALPHA 0xD6 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_BETA 0xD7 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_GAMMA 0xD8 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP869_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP869_FULL_BLOCK 0xDB +#define Z_DOS_CP869_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP869_GREEK_SMALL_LETTER_DELTA 0xDD +#define Z_DOS_CP869_GREEK_SMALL_LETTER_EPSILON 0xDE +#define Z_DOS_CP869_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP869_GREEK_SMALL_LETTER_ZETA 0xE0 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_ETA 0xE1 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_THETA 0xE2 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_IOTA 0xE3 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_KAPPA 0xE4 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_LAMDA 0xE5 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_MU 0xE6 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_NU 0xE7 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_XI 0xE8 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_OMICRON 0xE9 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_PI 0xEA +#define Z_DOS_CP869_GREEK_SMALL_LETTER_RHO 0xEB +#define Z_DOS_CP869_GREEK_SMALL_LETTER_SIGMA 0xEC +#define Z_DOS_CP869_GREEK_SMALL_LETTER_FINAL_SIGMA 0xED +#define Z_DOS_CP869_GREEK_SMALL_LETTER_TAU 0xEE +#define Z_DOS_CP869_GREEK_TONOS 0xEF +#define Z_DOS_CP869_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP869_PLUS_MINUS_SIGN 0xF1 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_UPSILON 0xF2 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_PHI 0xF3 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_CHI 0xF4 +#define Z_DOS_CP869_SECTION_SIGN 0xF5 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_PSI 0xF6 +#define Z_DOS_CP869_GREEK_DIALYTIKA_TONOS 0xF7 +#define Z_DOS_CP869_DEGREE_SIGN 0xF8 +#define Z_DOS_CP869_DIAERESIS 0xF9 +#define Z_DOS_CP869_GREEK_SMALL_LETTER_OMEGA 0xFA +#define Z_DOS_CP869_GREEK_SMALL_LETTER_UPSILON_WITH_DIALYTIKA 0xFB +#define Z_DOS_CP869_GREEK_SMALL_LETTER_UPSILON_WITH_DIALYTIKA_AND_TONOS 0xFC +#define Z_DOS_CP869_GREEK_SMALL_LETTER_OMEGA_WITH_TONOS 0xFD +#define Z_DOS_CP869_BLACK_SQUARE 0xFE +#define Z_DOS_CP869_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP869_TO_UNICODE(_, undefined) \ + undefined, undefined, undefined, undefined, undefined, undefined, _(0386), undefined, \ + _(00B7), _(00AC), _(00A6), _(2018), _(2019), _(0388), _(2015), _(0389), \ + _(038A), _(03AA), _(038C), undefined, undefined, _(038E), _(03AB), _(00A9), \ + _(038F), _(00B2), _(00B3), _(03AC), _(00A3), _(03AD), _(03AE), _(03AF), \ + _(03CA), _(0390), _(03CC), _(03CD), _(0391), _(0392), _(0393), _(0394), \ + _(0395), _(0396), _(0397), _(00BD), _(0398), _(0399), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(039A), _(039B), _(039C), \ + _(039D), _(2563), _(2551), _(2557), _(255D), _(039E), _(039F), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(03A0), _(03A1), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(03A3), \ + _(03A4), _(03A5), _(03A6), _(03A7), _(03A8), _(03A9), _(03B1), _(03B2), \ + _(03B3), _(2518), _(250C), _(2588), _(2584), _(03B4), _(03B5), _(2580), \ + _(03B6), _(03B7), _(03B8), _(03B9), _(03BA), _(03BB), _(03BC), _(03BD), \ + _(03BE), _(03BF), _(03C0), _(03C1), _(03C3), _(03C2), _(03C4), _(0384), \ + _(00AD), _(00B1), _(03C5), _(03C6), _(03C7), _(00A7), _(03C8), _(0385), \ + _(00B0), _(00A8), _(03C9), _(03CB), _(03B0), _(03CE), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP869_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP872.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP872.h new file mode 100644 index 0000000..5deff14 --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP872.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP872.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP872_H +#define Z_formats_character_set_DOS_CP872_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_DJE 0x80 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_DJE 0x81 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_GJE 0x82 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_GJE 0x83 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_IO 0x84 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_IO 0x85 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_UKRAINIAN_IE 0x86 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_UKRAINIAN_IE 0x87 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_DZE 0x88 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_DZE 0x89 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_BYELORUSSIAN_UKRAINIAN_I 0x8A +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_BYELORUSSIAN_UKRAINIAN_I 0x8B +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_YI 0x8C +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_YI 0x8D +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_JE 0x8E +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_JE 0x8F +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_LJE 0x90 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_LJE 0x91 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_NJE 0x92 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_NJE 0x93 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_TSHE 0x94 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_TSHE 0x95 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_KJE 0x96 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_KJE 0x97 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_SHORT_U 0x98 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_SHORT_U 0x99 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_DZHE 0x9A +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_DZHE 0x9B +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_YU 0x9C +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_YU 0x9D +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_HARD_SIGN 0x9E +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_HARD_SIGN 0x9F +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_A 0xA0 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_A 0xA1 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_BE 0xA2 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_BE 0xA3 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_TSE 0xA4 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_TSE 0xA5 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_DE 0xA6 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_DE 0xA7 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_IE 0xA8 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_IE 0xA9 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_EF 0xAA +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_EF 0xAB +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_GHE 0xAC +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_GHE 0xAD +#define Z_DOS_CP872_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAE +#define Z_DOS_CP872_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK 0xAF +#define Z_DOS_CP872_LIGHT_SHADE 0xB0 +#define Z_DOS_CP872_MEDIUM_SHADE 0xB1 +#define Z_DOS_CP872_DARK_SHADE 0xB2 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_VERTICAL 0xB3 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT 0xB4 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_HA 0xB5 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_HA 0xB6 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_I 0xB7 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_I 0xB8 +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT 0xB9 +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_VERTICAL 0xBA +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT 0xBB +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_UP_AND_LEFT 0xBC +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_SHORT_I 0xBD +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_SHORT_I 0xBE +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT 0xBF +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT 0xC0 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL 0xC1 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL 0xC2 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT 0xC3 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_HORIZONTAL 0xC4 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL 0xC5 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_KA 0xC6 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_KA 0xC7 +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT 0xC8 +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT 0xC9 +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL 0xCA +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL 0xCB +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT 0xCC +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_HORIZONTAL 0xCD +#define Z_DOS_CP872_BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL 0xCE +#define Z_DOS_CP872_EURO_SIGN 0xCF +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_EL 0xD0 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_EL 0xD1 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_EM 0xD2 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_EM 0xD3 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_EN 0xD4 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_EN 0xD5 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_O 0xD6 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_O 0xD7 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_PE 0xD8 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_UP_AND_LEFT 0xD9 +#define Z_DOS_CP872_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT 0xDA +#define Z_DOS_CP872_FULL_BLOCK 0xDB +#define Z_DOS_CP872_LOWER_HALF_BLOCK 0xDC +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_PE 0xDD +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_YA 0xDE +#define Z_DOS_CP872_UPPER_HALF_BLOCK 0xDF +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_YA 0xE0 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_ER 0xE1 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_ER 0xE2 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_ES 0xE3 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_ES 0xE4 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_TE 0xE5 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_TE 0xE6 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_U 0xE7 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_U 0xE8 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_ZHE 0xE9 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_ZHE 0xEA +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_VE 0xEB +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_VE 0xEC +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_SOFT_SIGN 0xED +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_SOFT_SIGN 0xEE +#define Z_DOS_CP872_NUMERO_SIGN 0xEF +#define Z_DOS_CP872_SOFT_HYPHEN 0xF0 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_YERU 0xF1 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_YERU 0xF2 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_ZE 0xF3 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_ZE 0xF4 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_SHA 0xF5 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_SHA 0xF6 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_E 0xF7 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_E 0xF8 +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_SHCHA 0xF9 +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_SHCHA 0xFA +#define Z_DOS_CP872_CYRILLIC_SMALL_LETTER_CHE 0xFB +#define Z_DOS_CP872_CYRILLIC_CAPITAL_LETTER_CHE 0xFC +#define Z_DOS_CP872_SECTION_SIGN 0xFD +#define Z_DOS_CP872_BLACK_SQUARE 0xFE +#define Z_DOS_CP872_NO_BREAK_SPACE 0xFF + +#define Z_ARRAY_CONTENT_DOS_CP872_TO_UNICODE(_) \ + _(0452), _(0402), _(0453), _(0403), _(0451), _(0401), _(0454), _(0404), \ + _(0455), _(0405), _(0456), _(0406), _(0457), _(0407), _(0458), _(0408), \ + _(0459), _(0409), _(045A), _(040A), _(045B), _(040B), _(045C), _(040C), \ + _(045E), _(040E), _(045F), _(040F), _(044E), _(042E), _(044A), _(042A), \ + _(0430), _(0410), _(0431), _(0411), _(0446), _(0426), _(0434), _(0414), \ + _(0435), _(0415), _(0444), _(0424), _(0433), _(0413), _(00AB), _(00BB), \ + _(2591), _(2592), _(2593), _(2502), _(2524), _(0445), _(0425), _(0438), \ + _(0418), _(2563), _(2551), _(2557), _(255D), _(0439), _(0419), _(2510), \ + _(2514), _(2534), _(252C), _(251C), _(2500), _(253C), _(043A), _(041A), \ + _(255A), _(2554), _(2569), _(2566), _(2560), _(2550), _(256C), _(20AC), \ + _(043B), _(041B), _(043C), _(041C), _(043D), _(041D), _(043E), _(041E), \ + _(043F), _(2518), _(250C), _(2588), _(2584), _(041F), _(044F), _(2580), \ + _(042F), _(0440), _(0420), _(0441), _(0421), _(0442), _(0422), _(0443), \ + _(0423), _(0436), _(0416), _(0432), _(0412), _(044C), _(042C), _(2116), \ + _(00AD), _(044B), _(042B), _(0437), _(0417), _(0448), _(0428), _(044D), \ + _(042D), _(0449), _(0429), _(0447), _(0427), _(00A7), _(25A0), _(00A0) + +#endif /* Z_formats_character_set_DOS_CP872_H */ diff --git a/projects/Zeta/API/Z/formats/character_set/DOS_CP874.h b/projects/Zeta/API/Z/formats/character_set/DOS_CP874.h new file mode 100644 index 0000000..4cf43ab --- /dev/null +++ b/projects/Zeta/API/Z/formats/character_set/DOS_CP874.h @@ -0,0 +1,160 @@ +/* Zeta API - Z/formats/character_set/DOS_CP874.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_character_set_DOS_CP874_H +#define Z_formats_character_set_DOS_CP874_H + +/* From 00h to 7Fh like ASCII */ +#define Z_DOS_CP874_EURO_SIGN 0x80 +/* 81h undefined */ +/* 82h undefined */ +/* 83h undefined */ +/* 84h undefined */ +#define Z_DOS_CP874_HORIZONTAL_ELLIPSIS 0x85 +/* 86h undefined */ +/* 87h undefined */ +/* 88h undefined */ +/* 89h undefined */ +/* 8Ah undefined */ +/* 8Bh undefined */ +/* 8Ch undefined */ +/* 8Dh undefined */ +/* 8Eh undefined */ +/* 8Fh undefined */ +/* 90h undefined */ +#define Z_DOS_CP874_LEFT_SINGLE_QUOTATION_MARK 0x91 +#define Z_DOS_CP874_RIGHT_SINGLE_QUOTATION_MARK 0x92 +#define Z_DOS_CP874_LEFT_DOUBLE_QUOTATION_MARK 0x93 +#define Z_DOS_CP874_RIGHT_DOUBLE_QUOTATION_MARK 0x94 +#define Z_DOS_CP874_BULLET 0x95 +#define Z_DOS_CP874_EN_DASH 0x96 +#define Z_DOS_CP874_EM_DASH 0x97 +/* 98h undefined */ +/* 99h undefined */ +/* 9Ah undefined */ +/* 9Bh undefined */ +/* 9Ch undefined */ +/* 9Dh undefined */ +/* 9Eh undefined */ +/* 9Fh undefined */ +#define Z_DOS_CP874_NO_BREAK_SPACE 0xA0 +#define Z_DOS_CP874_THAI_CHARACTER_KO_KAI 0xA1 +#define Z_DOS_CP874_THAI_CHARACTER_KHO_KHAI 0xA2 +#define Z_DOS_CP874_THAI_CHARACTER_KHO_KHUAT 0xA3 +#define Z_DOS_CP874_THAI_CHARACTER_KHO_KHWAI 0xA4 +#define Z_DOS_CP874_THAI_CHARACTER_KHO_KHON 0xA5 +#define Z_DOS_CP874_THAI_CHARACTER_KHO_RAKHANG 0xA6 +#define Z_DOS_CP874_THAI_CHARACTER_NGO_NGU 0xA7 +#define Z_DOS_CP874_THAI_CHARACTER_CHO_CHAN 0xA8 +#define Z_DOS_CP874_THAI_CHARACTER_CHO_CHING 0xA9 +#define Z_DOS_CP874_THAI_CHARACTER_CHO_CHANG 0xAA +#define Z_DOS_CP874_THAI_CHARACTER_SO_SO 0xAB +#define Z_DOS_CP874_THAI_CHARACTER_CHO_CHOE 0xAC +#define Z_DOS_CP874_THAI_CHARACTER_YO_YING 0xAD +#define Z_DOS_CP874_THAI_CHARACTER_DO_CHADA 0xAE +#define Z_DOS_CP874_THAI_CHARACTER_TO_PATAK 0xAF +#define Z_DOS_CP874_THAI_CHARACTER_THO_THAN 0xB0 +#define Z_DOS_CP874_THAI_CHARACTER_THO_NANGMONTHO 0xB1 +#define Z_DOS_CP874_THAI_CHARACTER_THO_PHUTHAO 0xB2 +#define Z_DOS_CP874_THAI_CHARACTER_NO_NEN 0xB3 +#define Z_DOS_CP874_THAI_CHARACTER_DO_DEK 0xB4 +#define Z_DOS_CP874_THAI_CHARACTER_TO_TAO 0xB5 +#define Z_DOS_CP874_THAI_CHARACTER_THO_THUNG 0xB6 +#define Z_DOS_CP874_THAI_CHARACTER_THO_THAHAN 0xB7 +#define Z_DOS_CP874_THAI_CHARACTER_THO_THONG 0xB8 +#define Z_DOS_CP874_THAI_CHARACTER_NO_NU 0xB9 +#define Z_DOS_CP874_THAI_CHARACTER_BO_BAIMAI 0xBA +#define Z_DOS_CP874_THAI_CHARACTER_PO_PLA 0xBB +#define Z_DOS_CP874_THAI_CHARACTER_PHO_PHUNG 0xBC +#define Z_DOS_CP874_THAI_CHARACTER_FO_FA 0xBD +#define Z_DOS_CP874_THAI_CHARACTER_PHO_PHAN 0xBE +#define Z_DOS_CP874_THAI_CHARACTER_FO_FAN 0xBF +#define Z_DOS_CP874_THAI_CHARACTER_PHO_SAMPHAO 0xC0 +#define Z_DOS_CP874_THAI_CHARACTER_MO_MA 0xC1 +#define Z_DOS_CP874_THAI_CHARACTER_YO_YAK 0xC2 +#define Z_DOS_CP874_THAI_CHARACTER_RO_RUA 0xC3 +#define Z_DOS_CP874_THAI_CHARACTER_RU 0xC4 +#define Z_DOS_CP874_THAI_CHARACTER_LO_LING 0xC5 +#define Z_DOS_CP874_THAI_CHARACTER_LU 0xC6 +#define Z_DOS_CP874_THAI_CHARACTER_WO_WAEN 0xC7 +#define Z_DOS_CP874_THAI_CHARACTER_SO_SALA 0xC8 +#define Z_DOS_CP874_THAI_CHARACTER_SO_RUSI 0xC9 +#define Z_DOS_CP874_THAI_CHARACTER_SO_SUA 0xCA +#define Z_DOS_CP874_THAI_CHARACTER_HO_HIP 0xCB +#define Z_DOS_CP874_THAI_CHARACTER_LO_CHULA 0xCC +#define Z_DOS_CP874_THAI_CHARACTER_O_ANG 0xCD +#define Z_DOS_CP874_THAI_CHARACTER_HO_NOKHUK 0xCE +#define Z_DOS_CP874_THAI_CHARACTER_PAIYANNOI 0xCF +#define Z_DOS_CP874_THAI_CHARACTER_SARA_A 0xD0 +#define Z_DOS_CP874_THAI_CHARACTER_MAI_HAN_AKAT 0xD1 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_AA 0xD2 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_AM 0xD3 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_I 0xD4 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_II 0xD5 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_UE 0xD6 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_UEE 0xD7 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_U 0xD8 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_UU 0xD9 +#define Z_DOS_CP874_THAI_CHARACTER_PHINTHU 0xDA +/* DBh undefined */ +/* DCh undefined */ +/* DDh undefined */ +/* DEh undefined */ +#define Z_DOS_CP874_THAI_CURRENCY_SYMBOL_BAHT 0xDF +#define Z_DOS_CP874_THAI_CHARACTER_SARA_E 0xE0 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_AE 0xE1 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_O 0xE2 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_AI_MAIMUAN 0xE3 +#define Z_DOS_CP874_THAI_CHARACTER_SARA_AI_MAIMALAI 0xE4 +#define Z_DOS_CP874_THAI_CHARACTER_LAKKHANGYAO 0xE5 +#define Z_DOS_CP874_THAI_CHARACTER_MAIYAMOK 0xE6 +#define Z_DOS_CP874_THAI_CHARACTER_MAITAIKHU 0xE7 +#define Z_DOS_CP874_THAI_CHARACTER_MAI_EK 0xE8 +#define Z_DOS_CP874_THAI_CHARACTER_MAI_THO 0xE9 +#define Z_DOS_CP874_THAI_CHARACTER_MAI_TRI 0xEA +#define Z_DOS_CP874_THAI_CHARACTER_MAI_CHATTAWA 0xEB +#define Z_DOS_CP874_THAI_CHARACTER_THANTHAKHAT 0xEC +#define Z_DOS_CP874_THAI_CHARACTER_NIKHAHIT 0xED +#define Z_DOS_CP874_THAI_CHARACTER_YAMAKKAN 0xEE +#define Z_DOS_CP874_THAI_CHARACTER_FONGMAN 0xEF +#define Z_DOS_CP874_THAI_DIGIT_ZERO 0xF0 +#define Z_DOS_CP874_THAI_DIGIT_ONE 0xF1 +#define Z_DOS_CP874_THAI_DIGIT_TWO 0xF2 +#define Z_DOS_CP874_THAI_DIGIT_THREE 0xF3 +#define Z_DOS_CP874_THAI_DIGIT_FOUR 0xF4 +#define Z_DOS_CP874_THAI_DIGIT_FIVE 0xF5 +#define Z_DOS_CP874_THAI_DIGIT_SIX 0xF6 +#define Z_DOS_CP874_THAI_DIGIT_SEVEN 0xF7 +#define Z_DOS_CP874_THAI_DIGIT_EIGHT 0xF8 +#define Z_DOS_CP874_THAI_DIGIT_NINE 0xF9 +#define Z_DOS_CP874_THAI_CHARACTER_ANGKHANKHU 0xFA +#define Z_DOS_CP874_THAI_CHARACTER_KHOMUT 0xFB +/* FCh undefined */ +/* FDh undefined */ +/* FEh undefined */ +/* FFh undefined */ + +#define Z_ARRAY_CONTENT_DOS_CP874_TO_UNICODE(_, undefined) \ + _(20AC), undefined, undefined, undefined, undefined, _(2026), undefined, undefined, \ + undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, \ + undefined, _(2018), _(2019), _(201C), _(201D), _(2022), _(2013), _(2014), \ + undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, \ + _(00A0), _(0E01), _(0E02), _(0E03), _(0E04), _(0E05), _(0E06), _(0E07), \ + _(0E08), _(0E09), _(0E0A), _(0E0B), _(0E0C), _(0E0D), _(0E0E), _(0E0F), \ + _(0E10), _(0E11), _(0E12), _(0E13), _(0E14), _(0E15), _(0E16), _(0E17), \ + _(0E18), _(0E19), _(0E1A), _(0E1B), _(0E1C), _(0E1D), _(0E1E), _(0E1F), \ + _(0E20), _(0E21), _(0E22), _(0E23), _(0E24), _(0E25), _(0E26), _(0E27), \ + _(0E28), _(0E29), _(0E2A), _(0E2B), _(0E2C), _(0E2D), _(0E2E), _(0E2F), \ + _(0E30), _(0E31), _(0E32), _(0E33), _(0E34), _(0E35), _(0E36), _(0E37), \ + _(0E38), _(0E39), _(0E3A), undefined, undefined, undefined, undefined, _(0E3F), \ + _(0E40), _(0E41), _(0E42), _(0E43), _(0E44), _(0E45), _(0E46), _(0E47), \ + _(0E48), _(0E49), _(0E4A), _(0E4B), _(0E4C), _(0E4D), _(0E4E), _(0E4F), \ + _(0E50), _(0E51), _(0E52), _(0E53), _(0E54), _(0E55), _(0E56), _(0E57), \ + _(0E58), _(0E59), _(0E5A), _(0E5B), undefined, undefined, undefined, undefined + +#endif /* Z_formats_character_set_DOS_CP874_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/I16LP32.h b/projects/Zeta/API/Z/formats/data_model/I16LP32.h new file mode 100644 index 0000000..7e89533 --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/I16LP32.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/I16LP32.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_I16LP32_H +#define Z_formats_data_model_I16LP32_H + +#define Z_I16LP32_WIDTH_CHAR 8 +#define Z_I16LP32_WIDTH_SHORT 16 +#define Z_I16LP32_WIDTH_INT 16 +#define Z_I16LP32_WIDTH_LONG 32 +#define Z_I16LP32_WIDTH_LLONG 32 +#define Z_I16LP32_WIDTH_SIZE 32 +#define Z_I16LP32_WIDTH_POINTER 32 + +#endif /* Z_formats_data_model_I16LP32_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/ILP32.h b/projects/Zeta/API/Z/formats/data_model/ILP32.h new file mode 100644 index 0000000..51c750a --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/ILP32.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/ILP32.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_ILP32_H +#define Z_formats_data_model_ILP32_H + +#define Z_ILP32_WIDTH_CHAR 8 +#define Z_ILP32_WIDTH_SHORT 16 +#define Z_ILP32_WIDTH_INT 32 +#define Z_ILP32_WIDTH_LONG 32 +#define Z_ILP32_WIDTH_LLONG 64 +#define Z_ILP32_WIDTH_SIZE 32 +#define Z_ILP32_WIDTH_POINTER 32 + +#endif /* Z_formats_data_model_ILP32_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/ILP64.h b/projects/Zeta/API/Z/formats/data_model/ILP64.h new file mode 100644 index 0000000..187527c --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/ILP64.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/ILP64.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_ILP64_H +#define Z_formats_data_model_ILP64_H + +#define Z_ILP64_WIDTH_CHAR 8 +#define Z_ILP64_WIDTH_SHORT 16 +#define Z_ILP64_WIDTH_INT 64 +#define Z_ILP64_WIDTH_LONG 64 +#define Z_ILP64_WIDTH_LLONG 64 +#define Z_ILP64_WIDTH_SIZE 64 +#define Z_ILP64_WIDTH_POINTER 64 + +#endif /* Z_formats_data_model_ILP64_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/IP16L32.h b/projects/Zeta/API/Z/formats/data_model/IP16L32.h new file mode 100644 index 0000000..afb627d --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/IP16L32.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/IP16L32.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_IP16L32_H +#define Z_formats_data_model_IP16L32_H + +#define Z_IP16L32_WIDTH_CHAR 8 +#define Z_IP16L32_WIDTH_SHORT 16 +#define Z_IP16L32_WIDTH_INT 16 +#define Z_IP16L32_WIDTH_LONG 32 +#define Z_IP16L32_WIDTH_LLONG 32 +#define Z_IP16L32_WIDTH_SIZE 16 +#define Z_IP16L32_WIDTH_POINTER 16 + +#endif /* Z_formats_data_model_IP16L32_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/LLP64.h b/projects/Zeta/API/Z/formats/data_model/LLP64.h new file mode 100644 index 0000000..3a50645 --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/LLP64.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/LLP64.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_LLP64_H +#define Z_formats_data_model_LLP64_H + +#define Z_LLP64_WIDTH_CHAR 8 +#define Z_LLP64_WIDTH_SHORT 16 +#define Z_LLP64_WIDTH_INT 32 +#define Z_LLP64_WIDTH_LONG 32 +#define Z_LLP64_WIDTH_LLONG 64 +#define Z_LLP64_WIDTH_SIZE 64 +#define Z_LLP64_WIDTH_POINTER 64 + +#endif /* Z_formats_data_model_LLP64_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/LP32.h b/projects/Zeta/API/Z/formats/data_model/LP32.h new file mode 100644 index 0000000..d407232 --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/LP32.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/LP32.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_LP32_H +#define Z_formats_data_model_LP32_H + +#define Z_LP32_WIDTH_CHAR 8 +#define Z_LP32_WIDTH_SHORT 16 +#define Z_LP32_WIDTH_INT 16 +#define Z_LP32_WIDTH_LONG 32 +#define Z_LP32_WIDTH_LLONG 64 +#define Z_LP32_WIDTH_SIZE 32 +#define Z_LP32_WIDTH_POINTER 32 + +#endif /* Z_formats_data_model_LP32_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/LP64.h b/projects/Zeta/API/Z/formats/data_model/LP64.h new file mode 100644 index 0000000..9c28739 --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/LP64.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/LP64.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_LP64_H +#define Z_formats_data_model_LP64_H + +#define Z_LP64_WIDTH_CHAR 8 +#define Z_LP64_WIDTH_SHORT 16 +#define Z_LP64_WIDTH_INT 32 +#define Z_LP64_WIDTH_LONG 64 +#define Z_LP64_WIDTH_LLONG 64 +#define Z_LP64_WIDTH_SIZE 64 +#define Z_LP64_WIDTH_POINTER 64 + +#endif /* Z_formats_data_model_LP64_H */ diff --git a/projects/Zeta/API/Z/formats/data_model/SILP64.h b/projects/Zeta/API/Z/formats/data_model/SILP64.h new file mode 100644 index 0000000..9e5814c --- /dev/null +++ b/projects/Zeta/API/Z/formats/data_model/SILP64.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/formats/data_model/SILP64.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_data_model_SILP64_H +#define Z_formats_data_model_SILP64_H + +#define Z_SILP64_WIDTH_CHAR 8 +#define Z_SILP64_WIDTH_SHORT 64 +#define Z_SILP64_WIDTH_INT 64 +#define Z_SILP64_WIDTH_LONG 64 +#define Z_SILP64_WIDTH_LLONG 64 +#define Z_SILP64_WIDTH_SIZE 64 +#define Z_SILP64_WIDTH_POINTER 64 + +#endif /* Z_formats_data_model_SILP64_H */ diff --git a/projects/Zeta/API/Z/formats/floating-point/Brain_Floating-Point.h b/projects/Zeta/API/Z/formats/floating-point/Brain_Floating-Point.h new file mode 100644 index 0000000..dba2393 --- /dev/null +++ b/projects/Zeta/API/Z/formats/floating-point/Brain_Floating-Point.h @@ -0,0 +1,27 @@ +/* Zeta API - Z/formats/floating-point/Brain_Floating-Point.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_floating_point_Brain_Floating_Point_H +#define Z_formats_floating_point_Brain_Floating_Point_H + +#define Z_BRAIN_FLOATING_POINT_WIDTH 16 +#define Z_BRAIN_FLOATING_POINT_BIAS 127 +#define Z_BRAIN_FLOATING_POINT_DIGITS_10 +#define Z_BRAIN_FLOATING_POINT_MAXIMUM_DIGITS_10 +#define Z_BRAIN_FLOATING_POINT_RADIX 2 +#define Z_BRAIN_FLOATING_POINT_SIGNIFICAND_DIGITS +#define Z_BRAIN_FLOATING_POINT_EXPONENT_MAXIMUM 127 +#define Z_BRAIN_FLOATING_POINT_EXPONENT_MINIMUM -126 +#define Z_BRAIN_FLOATING_POINT_EXPONENT_10_MAXIMUM +#define Z_BRAIN_FLOATING_POINT_EXPONENT_10_MINIMUM +#define Z_BRAIN_FLOATING_POINT_EPSILON +#define Z_BRAIN_FLOATING_POINT_MAXIMUM +#define Z_BRAIN_FLOATING_POINT_MINIMUM +#define Z_BRAIN_FLOATING_POINT_DENORMAL_MINIMUM + +#endif /* Z_formats_floating_point_Brain_Floating_Point_H */ diff --git a/projects/Zeta/API/Z/formats/floating-point/IBM.h b/projects/Zeta/API/Z/formats/floating-point/IBM.h new file mode 100644 index 0000000..dd940b0 --- /dev/null +++ b/projects/Zeta/API/Z/formats/floating-point/IBM.h @@ -0,0 +1,27 @@ +/* Zeta API - Z/formats/floating-point/IBM.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_floating_point_IBM_H +#define Z_formats_floating_point_IBM_H + +#define Z_IBM_EXTENDED_DOUBLE_WIDTH 128 +#define Z_IBM_EXTENDED_DOUBLE_BIAS +#define Z_IBM_EXTENDED_DOUBLE_DIGITS_10 30 /* (?) */ +#define Z_IBM_EXTENDED_DOUBLE_MAXIMUM_DIGITS_10 34 /* (?) */ +#define Z_IBM_EXTENDED_DOUBLE_RADIX 2 +#define Z_IBM_EXTENDED_DOUBLE_SIGNIFICAND_DIGITS 106 +#define Z_IBM_EXTENDED_DOUBLE_EXPONENT_MAXIMUM 1023 +#define Z_IBM_EXTENDED_DOUBLE_EXPONENT_MINIMUM -967 +#define Z_IBM_EXTENDED_DOUBLE_EXPONENT_10_MAXIMUM 308 +#define Z_IBM_EXTENDED_DOUBLE_EXPONENT_10_MINIMUM -291 +#define Z_IBM_EXTENDED_DOUBLE_EPSILON 4.94065645841246544176568792868221e-324 +#define Z_IBM_EXTENDED_DOUBLE_MAXIMUM 1.79769313486231580793728971405301e+308 +#define Z_IBM_EXTENDED_DOUBLE_MINIMUM 2.00416836000897277799610805135016e-292 +#define Z_IBM_EXTENDED_DOUBLE_DENORMAL_MINIMUM 4.94065645841246544176568792868221e-324 + +#endif /* Z_formats_floating_point_IBM_H */ diff --git a/projects/Zeta/API/Z/formats/floating-point/IEEE_754.h b/projects/Zeta/API/Z/formats/floating-point/IEEE_754.h new file mode 100644 index 0000000..cdf82b5 --- /dev/null +++ b/projects/Zeta/API/Z/formats/floating-point/IEEE_754.h @@ -0,0 +1,117 @@ +/* Zeta API - Z/formats/floating-point/IEEE 754.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_floating_point_IEEE_754_H +#define Z_formats_floating_point_IEEE_754_H + +#define Z_IEEE_754_BINARY16_WIDTH 16 +#define Z_IEEE_754_BINARY16_BIAS 15 +#define Z_IEEE_754_BINARY16_DIGITS_10 3 +#define Z_IEEE_754_BINARY16_MAXIMUM_DIGITS_10 5 +#define Z_IEEE_754_BINARY16_RADIX 2 +#define Z_IEEE_754_BINARY16_SIGNIFICAND_DIGITS 11 +#define Z_IEEE_754_BINARY16_EXPONENT_MAXIMUM 15 +#define Z_IEEE_754_BINARY16_EXPONENT_MINIMUM -14 +#define Z_IEEE_754_BINARY16_EXPONENT_10_MAXIMUM 4 +#define Z_IEEE_754_BINARY16_EXPONENT_10_MINIMUM -3 /* correct? -4? */ +#define Z_IEEE_754_BINARY16_EPSILON 9.765625e-4 /* correct? */ +#define Z_IEEE_754_BINARY16_MAXIMUM 65504.0 +#define Z_IEEE_754_BINARY16_MINIMUM 6.103515625e-5 +#define Z_IEEE_754_BINARY16_DENORMAL_MINIMUM 5.9604644775390625e-8 + +#define Z_IEEE_754_BINARY32_WIDTH 32 +#define Z_IEEE_754_BINARY32_BIAS 127 +#define Z_IEEE_754_BINARY32_DIGITS_10 6 +#define Z_IEEE_754_BINARY32_MAXIMUM_DIGITS_10 9 +#define Z_IEEE_754_BINARY32_RADIX 2 +#define Z_IEEE_754_BINARY32_SIGNIFICAND_DIGITS 24 +#define Z_IEEE_754_BINARY32_EXPONENT_MAXIMUM 127 +#define Z_IEEE_754_BINARY32_EXPONENT_MINIMUM -126 +#define Z_IEEE_754_BINARY32_EXPONENT_10_MAXIMUM 38 +#define Z_IEEE_754_BINARY32_EXPONENT_10_MINIMUM -37 +#define Z_IEEE_754_BINARY32_EPSILON 1.192092896e-7 +#define Z_IEEE_754_BINARY32_MAXIMUM 3.402823466e+38 +#define Z_IEEE_754_BINARY32_MINIMUM 1.175494351e-38 +#define Z_IEEE_754_BINARY32_DENORMAL_MINIMUM 1.401298460e-45 + +#define Z_IEEE_754_BINARY64_WIDTH 64 +#define Z_IEEE_754_BINARY64_BIAS 1023 +#define Z_IEEE_754_BINARY64_DIGITS_10 15 +#define Z_IEEE_754_BINARY64_MAXIMUM_DIGITS_10 17 +#define Z_IEEE_754_BINARY64_RADIX 2 +#define Z_IEEE_754_BINARY64_SIGNIFICAND_DIGITS 53 +#define Z_IEEE_754_BINARY64_EXPONENT_MAXIMUM 1023 +#define Z_IEEE_754_BINARY64_EXPONENT_MINIMUM -1022 +#define Z_IEEE_754_BINARY64_EXPONENT_10_MAXIMUM 308 +#define Z_IEEE_754_BINARY64_EXPONENT_10_MINIMUM -307 +#define Z_IEEE_754_BINARY64_EPSILON 2.2204460492503131e-16 +#define Z_IEEE_754_BINARY64_MAXIMUM 1.7976931348623158e+308 +#define Z_IEEE_754_BINARY64_MINIMUM 2.2250738585072014e-308 +#define Z_IEEE_754_BINARY64_DENORMAL_MINIMUM 4.9406564584124654e-324 + +#define Z_IEEE_754_BINARY128_WIDTH 128 +#define Z_IEEE_754_BINARY128_BIAS 16383 +#define Z_IEEE_754_BINARY128_DIGITS_10 33 +#define Z_IEEE_754_BINARY128_MAXIMUM_DIGITS_10 36 +#define Z_IEEE_754_BINARY128_RADIX 2 +#define Z_IEEE_754_BINARY128_SIGNIFICAND_DIGITS 113 +#define Z_IEEE_754_BINARY128_EXPONENT_MAXIMUM 16383 +#define Z_IEEE_754_BINARY128_EXPONENT_MINIMUM -16382 +#define Z_IEEE_754_BINARY128_EXPONENT_10_MAXIMUM 4932 +#define Z_IEEE_754_BINARY128_EXPONENT_10_MINIMUM -4931 +#define Z_IEEE_754_BINARY128_EPSILON 1.92592994438723585305597794258492732e-34 +#define Z_IEEE_754_BINARY128_MAXIMUM 1.18973149535723176508575932662800702e+4932 +#define Z_IEEE_754_BINARY128_MINIMUM 3.36210314311209350626267781732175260e-4932 +#define Z_IEEE_754_BINARY128_DENORMAL_MINIMUM 6.47517511943802511092443895822764655e-4966 + +#define Z_IEEE_754_DECIMAL32_WIDTH 32 +#define Z_IEEE_754_DECIMAL32_BIAS 101 +#define Z_IEEE_754_DECIMAL32_DIGITS_10 +#define Z_IEEE_754_DECIMAL32_MAXIMUM_DIGITS_10 +#define Z_IEEE_754_DECIMAL32_RADIX 10 +#define Z_IEEE_754_DECIMAL32_SIGNIFICAND_DIGITS 7 +#define Z_IEEE_754_DECIMAL32_EXPONENT_MAXIMUM 96 +#define Z_IEEE_754_DECIMAL32_EXPONENT_MINIMUM -95 +#define Z_IEEE_754_DECIMAL32_EXPONENT_10_MAXIMUM +#define Z_IEEE_754_DECIMAL32_EXPONENT_10_MINIMUM +#define Z_IEEE_754_DECIMAL32_EPSILON 1e-6 +#define Z_IEEE_754_DECIMAL32_MAXIMUM 9.999999e+96 +#define Z_IEEE_754_DECIMAL32_MINIMUM 1e-95 +#define Z_IEEE_754_DECIMAL32_DENORMAL_MINIMUM 0.000001e-95 + +#define Z_IEEE_754_DECIMAL64_WIDTH 64 +#define Z_IEEE_754_DECIMAL64_BIAS 398 +#define Z_IEEE_754_DECIMAL64_DIGITS_10 +#define Z_IEEE_754_DECIMAL64_MAXIMUM_DIGITS_10 +#define Z_IEEE_754_DECIMAL64_RADIX 10 +#define Z_IEEE_754_DECIMAL64_SIGNIFICAND_DIGITS 16 +#define Z_IEEE_754_DECIMAL64_EXPONENT_MAXIMUM 384 +#define Z_IEEE_754_DECIMAL64_EXPONENT_MINIMUM -383 +#define Z_IEEE_754_DECIMAL64_EXPONENT_10_MAXIMUM +#define Z_IEEE_754_DECIMAL64_EXPONENT_10_MINIMUM +#define Z_IEEE_754_DECIMAL64_EPSILON 1e-15 +#define Z_IEEE_754_DECIMAL64_MAXIMUM 9.999999999999999e+384 +#define Z_IEEE_754_DECIMAL64_MINIMUM 1e-383 +#define Z_IEEE_754_DECIMAL64_DENORMAL_MINIMUM 0.000000000000001e-383 + +#define Z_IEEE_754_DECIMAL128_WIDTH 128 +#define Z_IEEE_754_DECIMAL128_BIAS 6176 +#define Z_IEEE_754_DECIMAL128_DIGITS_10 +#define Z_IEEE_754_DECIMAL128_MAXIMUM_DIGITS_10 +#define Z_IEEE_754_DECIMAL128_RADIX 10 +#define Z_IEEE_754_DECIMAL128_SIGNIFICAND_DIGITS 34 +#define Z_IEEE_754_DECIMAL128_EXPONENT_MAXIMUM 6144 +#define Z_IEEE_754_DECIMAL128_EXPONENT_MINIMUM -6143 +#define Z_IEEE_754_DECIMAL128_EXPONENT_10_MAXIMUM +#define Z_IEEE_754_DECIMAL128_EXPONENT_10_MINIMUM +#define Z_IEEE_754_DECIMAL128_EPSILON 1e-33 +#define Z_IEEE_754_DECIMAL128_MAXIMUM 9.999999999999999999999999999999999e+6144 +#define Z_IEEE_754_DECIMAL128_MINIMUM 1e-6143 +#define Z_IEEE_754_DECIMAL128_DENORMAL_MINIMUM 0.000000000000000000000000000000001e-6143 + +#endif /* Z_formats_floating_point_IEEE_754_H */ diff --git a/projects/Zeta/API/Z/formats/floating-point/x87.h b/projects/Zeta/API/Z/formats/floating-point/x87.h new file mode 100644 index 0000000..af7e573 --- /dev/null +++ b/projects/Zeta/API/Z/formats/floating-point/x87.h @@ -0,0 +1,27 @@ +/* Zeta API - Z/formats/floating-point/x87.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_floating_point_x87_H +#define Z_formats_floating_point_x87_H + +#define Z_X87_DOUBLE_EXTENDED_WIDTH 80 +#define Z_X87_DOUBLE_EXTENDED_BIAS 16383 +#define Z_X87_DOUBLE_EXTENDED_DIGITS_10 19 /* 18 (?) */ +#define Z_X87_DOUBLE_EXTENDED_MAXIMUM_DIGITS_10 21 +#define Z_X87_DOUBLE_EXTENDED_RADIX 2 +#define Z_X87_DOUBLE_EXTENDED_SIGNIFICAND_DIGITS 64 +#define Z_X87_DOUBLE_EXTENDED_EXPONENT_MAXIMUM 16383 +#define Z_X87_DOUBLE_EXTENDED_EXPONENT_MINIMUM -16382 +#define Z_X87_DOUBLE_EXTENDED_EXPONENT_10_MAXIMUM 4932 +#define Z_X87_DOUBLE_EXTENDED_EXPONENT_10_MINIMUM -4931 +#define Z_X87_DOUBLE_EXTENDED_EPSILON 1.08420217248550443401e-19 +#define Z_X87_DOUBLE_EXTENDED_MAXIMUM 1.18973149535723176502e+4932 +#define Z_X87_DOUBLE_EXTENDED_MINIMUM 3.36210314311209350626e-4932 +#define Z_X87_DOUBLE_EXTENDED_DENORMAL_MINIMUM 3.64519953188247460253e-4951 + +#endif /* Z_formats_floating_point_x87_H */ diff --git a/projects/Zeta/API/Z/formats/keymap/Mac_OS.h b/projects/Zeta/API/Z/formats/keymap/Mac_OS.h new file mode 100644 index 0000000..20a4794 --- /dev/null +++ b/projects/Zeta/API/Z/formats/keymap/Mac_OS.h @@ -0,0 +1,285 @@ +/* Zeta API - Z/formats/keymap/Mac_OS.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_keymap_Mac_OS_H +#define Z_formats_keymap_Mac_OS_H + +#define Z_MAC_OS_KEY_CODE_ANSI_A 0 +#define Z_MAC_OS_KEY_CODE_ANSI_S 1 +#define Z_MAC_OS_KEY_CODE_ANSI_D 2 +#define Z_MAC_OS_KEY_CODE_ANSI_F 3 +#define Z_MAC_OS_KEY_CODE_ANSI_H 4 +#define Z_MAC_OS_KEY_CODE_ANSI_G 5 +#define Z_MAC_OS_KEY_CODE_ANSI_Z 6 +#define Z_MAC_OS_KEY_CODE_ANSI_X 7 +#define Z_MAC_OS_KEY_CODE_ANSI_C 8 +#define Z_MAC_OS_KEY_CODE_ANSI_V 9 +#define Z_MAC_OS_KEY_CODE_ISO_SECTION 10 +#define Z_MAC_OS_KEY_CODE_ANSI_B 11 +#define Z_MAC_OS_KEY_CODE_ANSI_Q 12 +#define Z_MAC_OS_KEY_CODE_ANSI_W 13 +#define Z_MAC_OS_KEY_CODE_ANSI_E 14 +#define Z_MAC_OS_KEY_CODE_ANSI_R 15 +#define Z_MAC_OS_KEY_CODE_ANSI_Y 16 +#define Z_MAC_OS_KEY_CODE_ANSI_T 17 +#define Z_MAC_OS_KEY_CODE_ANSI_1 18 +#define Z_MAC_OS_KEY_CODE_ANSI_2 19 +#define Z_MAC_OS_KEY_CODE_ANSI_3 20 +#define Z_MAC_OS_KEY_CODE_ANSI_4 21 +#define Z_MAC_OS_KEY_CODE_ANSI_6 22 +#define Z_MAC_OS_KEY_CODE_ANSI_5 23 +#define Z_MAC_OS_KEY_CODE_ANSI_EQUALS_SIGN 24 +#define Z_MAC_OS_KEY_CODE_ANSI_9 25 +#define Z_MAC_OS_KEY_CODE_ANSI_7 26 +#define Z_MAC_OS_KEY_CODE_ANSI_HYPHEN_MINUS 27 +#define Z_MAC_OS_KEY_CODE_ANSI_8 28 +#define Z_MAC_OS_KEY_CODE_ANSI_0 29 +#define Z_MAC_OS_KEY_CODE_ANSI_RIGHT_SQUARE_BRACKET 30 +#define Z_MAC_OS_KEY_CODE_ANSI_O 31 +#define Z_MAC_OS_KEY_CODE_ANSI_U 32 +#define Z_MAC_OS_KEY_CODE_ANSI_LEFT_SQUARE_BRACKET 33 +#define Z_MAC_OS_KEY_CODE_ANSI_I 34 +#define Z_MAC_OS_KEY_CODE_ANSI_P 35 +#define Z_MAC_OS_KEY_CODE_RETURN 36 +#define Z_MAC_OS_KEY_CODE_ANSI_L 37 +#define Z_MAC_OS_KEY_CODE_ANSI_J 38 +#define Z_MAC_OS_KEY_CODE_ANSI_APOSTROPHE 39 +#define Z_MAC_OS_KEY_CODE_ANSI_K 40 +#define Z_MAC_OS_KEY_CODE_ANSI_SEMICOLON 41 +#define Z_MAC_OS_KEY_CODE_ANSI_REVERSE_SOLIDUS 42 +#define Z_MAC_OS_KEY_CODE_ANSI_COMMA 43 +#define Z_MAC_OS_KEY_CODE_ANSI_SOLIDUS 44 +#define Z_MAC_OS_KEY_CODE_ANSI_N 45 +#define Z_MAC_OS_KEY_CODE_ANSI_M 46 +#define Z_MAC_OS_KEY_CODE_ANSI_FULL_STOP 47 +#define Z_MAC_OS_KEY_CODE_TAB 48 +#define Z_MAC_OS_KEY_CODE_SPACE 49 +#define Z_MAC_OS_KEY_CODE_ANSI_GRAVE_ACCENT 50 +#define Z_MAC_OS_KEY_CODE_BACKSPACE 51 +/* 52 - Unused? */ +#define Z_MAC_OS_KEY_CODE_ESCAPE 53 +#define Z_MAC_OS_KEY_CODE_RIGHT_COMMAND 54 +#define Z_MAC_OS_KEY_CODE_LEFT_COMMAND 55 +#define Z_MAC_OS_KEY_CODE_LEFT_SHIFT 56 +#define Z_MAC_OS_KEY_CODE_CAPS_LOCK 57 +#define Z_MAC_OS_KEY_CODE_LEFT_OPTION 58 +#define Z_MAC_OS_KEY_CODE_LEFT_CONTROL 59 +#define Z_MAC_OS_KEY_CODE_RIGHT_SHIFT 60 +#define Z_MAC_OS_KEY_CODE_RIGHT_OPTION 61 +#define Z_MAC_OS_KEY_CODE_RIGHT_CONTROL 62 +#define Z_MAC_OS_KEY_CODE_FUNCTION 63 +#define Z_MAC_OS_KEY_CODE_F17 64 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_DECIMAL_SEPARATOR 65 +/* 66 - Unused? */ +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_ASTERISK 67 +/* 68 - Unused? */ +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_PLUS_SIGN 69 +/* 70 - Unused? */ +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_CLEAR 71 +#define Z_MAC_OS_KEY_CODE_VOLUME_UP 72 +#define Z_MAC_OS_KEY_CODE_VOLUME_DOWN 73 +#define Z_MAC_OS_KEY_CODE_MUTE 74 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_SOLIDUS 75 /* PC keyboards */ +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_ENTER 76 +/* 77 - Unused? */ +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_HYPHEN_MINUS 78 +#define Z_MAC_OS_KEY_CODE_F18 79 +#define Z_MAC_OS_KEY_CODE_F19 80 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_EQUALS_SIGN 81 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_0 82 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_1 83 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_2 84 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_3 85 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_4 86 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_5 87 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_6 88 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_7 89 +#define Z_MAC_OS_KEY_CODE_F20 90 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_8 91 +#define Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_9 92 +#define Z_MAC_OS_KEY_CODE_JIS_YEN_SIGN 93 +#define Z_MAC_OS_KEY_CODE_JIS_LOW_LINE 94 +#define Z_MAC_OS_KEY_CODE_JIS_KEYPAD_COMMA 95 +#define Z_MAC_OS_KEY_CODE_F5 96 +#define Z_MAC_OS_KEY_CODE_F6 97 +#define Z_MAC_OS_KEY_CODE_F7 98 +#define Z_MAC_OS_KEY_CODE_F3 99 +#define Z_MAC_OS_KEY_CODE_F8 100 +#define Z_MAC_OS_KEY_CODE_F9 101 +#define Z_MAC_OS_KEY_CODE_JIS_EISU 102 /* Toggles alphanumeric characters */ +#define Z_MAC_OS_KEY_CODE_F11 103 +#define Z_MAC_OS_KEY_CODE_JIS_KANA 104 +#define Z_MAC_OS_KEY_CODE_F13 105 +#define Z_MAC_OS_KEY_CODE_F16 106 +#define Z_MAC_OS_KEY_CODE_F14 107 +/* 108 - Unused? */ +#define Z_MAC_OS_KEY_CODE_F10 109 +#define Z_MAC_OS_KEY_CODE_APPLICATION 110 /* PC/Windows keyboards */ +#define Z_MAC_OS_KEY_CODE_F12 111 +/* 112 - Unused? */ +#define Z_MAC_OS_KEY_CODE_F15 113 +#define Z_MAC_OS_KEY_CODE_HELP 114 +#define Z_MAC_OS_KEY_CODE_HOME 115 +#define Z_MAC_OS_KEY_CODE_PAGE_UP 116 +#define Z_MAC_OS_KEY_CODE_DELETE 117 +#define Z_MAC_OS_KEY_CODE_F4 118 +#define Z_MAC_OS_KEY_CODE_END 119 +#define Z_MAC_OS_KEY_CODE_F2 120 +#define Z_MAC_OS_KEY_CODE_PAGE_DOWN 121 +#define Z_MAC_OS_KEY_CODE_F1 122 +#define Z_MAC_OS_KEY_CODE_LEFT 123 +#define Z_MAC_OS_KEY_CODE_RIGHT 124 +#define Z_MAC_OS_KEY_CODE_DOWN 125 +#define Z_MAC_OS_KEY_CODE_UP 126 +/* 127 - Unused? */ + +#define Z_MAC_OS_KEY_MASK_CAPS_LOCK 0x010000 +#define Z_MAC_OS_KEY_MASK_SHIFT 0x020000 +#define Z_MAC_OS_KEY_MASK_CONTROL 0x040000 +#define Z_MAC_OS_KEY_MASK_COMMAND 0x100000 +#define Z_MAC_OS_KEY_MASK_OPTION 0x080000 +#define Z_MAC_OS_KEY_MASK_LEFT_SHIFT 0x000002 +#define Z_MAC_OS_KEY_MASK_LEFT_CONTROL 0x000001 +#define Z_MAC_OS_KEY_MASK_LEFT_COMMAND 0x000008 +#define Z_MAC_OS_KEY_MASK_LEFT_OPTION 0x000020 +#define Z_MAC_OS_KEY_MASK_RIGHT_OPTION 0x000040 +#define Z_MAC_OS_KEY_MASK_RIGHT_COMMAND 0x000010 +#define Z_MAC_OS_KEY_MASK_RIGHT_CONTROL 0x002000 +#define Z_MAC_OS_KEY_MASK_RIGHT_SHIFT 0x000004 + +#define Z_ARRAY_CONTENT_MAC_OS_KEY_CODE_TO_Z_KEY_CODE \ + Z_KEY_CODE_ANSI_A, /* 0 - Z_MAC_OS_KEY_CODE_ANSI_A */ \ + Z_KEY_CODE_ANSI_S, /* 1 - Z_MAC_OS_KEY_CODE_ANSI_S */ \ + Z_KEY_CODE_ANSI_D, /* 2 - Z_MAC_OS_KEY_CODE_ANSI_D */ \ + Z_KEY_CODE_ANSI_F, /* 3 - Z_MAC_OS_KEY_CODE_ANSI_F */ \ + Z_KEY_CODE_ANSI_H, /* 4 - Z_MAC_OS_KEY_CODE_ANSI_H */ \ + Z_KEY_CODE_ANSI_G, /* 5 - Z_MAC_OS_KEY_CODE_ANSI_G */ \ + Z_KEY_CODE_ANSI_Z, /* 6 - Z_MAC_OS_KEY_CODE_ANSI_Z */ \ + Z_KEY_CODE_ANSI_X, /* 7 - Z_MAC_OS_KEY_CODE_ANSI_X */ \ + Z_KEY_CODE_ANSI_C, /* 8 - Z_MAC_OS_KEY_CODE_ANSI_C */ \ + Z_KEY_CODE_ANSI_V, /* 9 - Z_MAC_OS_KEY_CODE_ANSI_V */ \ + Z_KEY_CODE_ISO_SECTION, /* 10 - Z_MAC_OS_KEY_CODE_ISO_SECTION */ \ + Z_KEY_CODE_ANSI_B, /* 11 - Z_MAC_OS_KEY_CODE_ANSI_B */ \ + Z_KEY_CODE_ANSI_Q, /* 12 - Z_MAC_OS_KEY_CODE_ANSI_Q */ \ + Z_KEY_CODE_ANSI_W, /* 13 - Z_MAC_OS_KEY_CODE_ANSI_W */ \ + Z_KEY_CODE_ANSI_E, /* 14 - Z_MAC_OS_KEY_CODE_ANSI_E */ \ + Z_KEY_CODE_ANSI_R, /* 15 - Z_MAC_OS_KEY_CODE_ANSI_R */ \ + Z_KEY_CODE_ANSI_Y, /* 16 - Z_MAC_OS_KEY_CODE_ANSI_Y */ \ + Z_KEY_CODE_ANSI_T, /* 17 - Z_MAC_OS_KEY_CODE_ANSI_T */ \ + Z_KEY_CODE_ANSI_1, /* 18 - Z_MAC_OS_KEY_CODE_ANSI_1 */ \ + Z_KEY_CODE_ANSI_2, /* 19 - Z_MAC_OS_KEY_CODE_ANSI_2 */ \ + Z_KEY_CODE_ANSI_3, /* 20 - Z_MAC_OS_KEY_CODE_ANSI_3 */ \ + Z_KEY_CODE_ANSI_4, /* 21 - Z_MAC_OS_KEY_CODE_ANSI_4 */ \ + Z_KEY_CODE_ANSI_6, /* 22 - Z_MAC_OS_KEY_CODE_ANSI_6 */ \ + Z_KEY_CODE_ANSI_5, /* 23 - Z_MAC_OS_KEY_CODE_ANSI_5 */ \ + Z_KEY_CODE_ANSI_EQUALS_SIGN, /* 24 - Z_MAC_OS_KEY_CODE_ANSI_EQUALS_SIGN */ \ + Z_KEY_CODE_ANSI_9, /* 25 - Z_MAC_OS_KEY_CODE_ANSI_9 */ \ + Z_KEY_CODE_ANSI_7, /* 26 - Z_MAC_OS_KEY_CODE_ANSI_7 */ \ + Z_KEY_CODE_ANSI_HYPHEN_MINUS, /* 27 - Z_MAC_OS_KEY_CODE_ANSI_HYPHEN_MINUS */ \ + Z_KEY_CODE_ANSI_8, /* 28 - Z_MAC_OS_KEY_CODE_ANSI_8 */ \ + Z_KEY_CODE_ANSI_0, /* 29 - Z_MAC_OS_KEY_CODE_ANSI_0 */ \ + Z_KEY_CODE_ANSI_RIGHT_SQUARE_BRACKET, /* 30 - Z_MAC_OS_KEY_CODE_ANSI_RIGHT_SQUARE_BRACKET */ \ + Z_KEY_CODE_ANSI_O, /* 31 - Z_MAC_OS_KEY_CODE_ANSI_O */ \ + Z_KEY_CODE_ANSI_U, /* 32 - Z_MAC_OS_KEY_CODE_ANSI_U */ \ + Z_KEY_CODE_ANSI_LEFT_SQUARE_BRACKET, /* 33 - Z_MAC_OS_KEY_CODE_ANSI_LEFT_SQUARE_BRACKET */ \ + Z_KEY_CODE_ANSI_I, /* 34 - Z_MAC_OS_KEY_CODE_ANSI_I */ \ + Z_KEY_CODE_ANSI_P, /* 35 - Z_MAC_OS_KEY_CODE_ANSI_P */ \ + Z_KEY_CODE_RETURN, /* 36 - Z_MAC_OS_KEY_CODE_RETURN */ \ + Z_KEY_CODE_ANSI_L, /* 37 - Z_MAC_OS_KEY_CODE_ANSI_L */ \ + Z_KEY_CODE_ANSI_J, /* 38 - Z_MAC_OS_KEY_CODE_ANSI_J */ \ + Z_KEY_CODE_ANSI_APOSTROPHE, /* 39 - Z_MAC_OS_KEY_CODE_ANSI_APOSTROPHE */ \ + Z_KEY_CODE_ANSI_K, /* 40 - Z_MAC_OS_KEY_CODE_ANSI_K */ \ + Z_KEY_CODE_ANSI_SEMICOLON, /* 41 - Z_MAC_OS_KEY_CODE_ANSI_SEMICOLON */ \ + Z_KEY_CODE_ANSI_REVERSE_SOLIDUS, /* 42 - Z_MAC_OS_KEY_CODE_ANSI_REVERSE_SOLIDUS */ \ + Z_KEY_CODE_ANSI_COMMA, /* 43 - Z_MAC_OS_KEY_CODE_ANSI_COMMA */ \ + Z_KEY_CODE_ANSI_SOLIDUS, /* 44 - Z_MAC_OS_KEY_CODE_ANSI_SOLIDUS */ \ + Z_KEY_CODE_ANSI_N, /* 45 - Z_MAC_OS_KEY_CODE_ANSI_N */ \ + Z_KEY_CODE_ANSI_M, /* 46 - Z_MAC_OS_KEY_CODE_ANSI_M */ \ + Z_KEY_CODE_ANSI_FULL_STOP, /* 47 - Z_MAC_OS_KEY_CODE_ANSI_FULL_STOP */ \ + Z_KEY_CODE_TAB, /* 48 - Z_MAC_OS_KEY_CODE_TAB */ \ + Z_KEY_CODE_SPACE, /* 49 - Z_MAC_OS_KEY_CODE_SPACE */ \ + Z_KEY_CODE_ANSI_GRAVE_ACCENT, /* 50 - Z_MAC_OS_KEY_CODE_ANSI_GRAVE_ACCENT */ \ + Z_KEY_CODE_BACKSPACE, /* 51 - Z_MAC_OS_KEY_CODE_BACKSPACE */ \ + Z_KEY_CODE_INVALID, /* 52 */ \ + Z_KEY_CODE_ESCAPE, /* 53 - Z_MAC_OS_KEY_CODE_ESCAPE */ \ + Z_KEY_CODE_RIGHT_COMMAND, /* 54 - Z_MAC_OS_KEY_CODE_RIGHT_COMMAND */ \ + Z_KEY_CODE_LEFT_COMMAND, /* 55 - Z_MAC_OS_KEY_CODE_LEFT_COMMAND */ \ + Z_KEY_CODE_LEFT_SHIFT, /* 56 - Z_MAC_OS_KEY_CODE_LEFT_SHIFT */ \ + Z_KEY_CODE_CAPS_LOCK, /* 57 - Z_MAC_OS_KEY_CODE_CAPS_LOCK */ \ + Z_KEY_CODE_LEFT_OPTION, /* 58 - Z_MAC_OS_KEY_CODE_LEFT_OPTION */ \ + Z_KEY_CODE_LEFT_CONTROL, /* 59 - Z_MAC_OS_KEY_CODE_LEFT_CONTROL */ \ + Z_KEY_CODE_RIGHT_SHIFT, /* 60 - Z_MAC_OS_KEY_CODE_RIGHT_SHIFT */ \ + Z_KEY_CODE_RIGHT_OPTION, /* 61 - Z_MAC_OS_KEY_CODE_RIGHT_OPTION */ \ + Z_KEY_CODE_RIGHT_CONTROL, /* 62 - Z_MAC_OS_KEY_CODE_RIGHT_CONTROL */ \ + Z_KEY_CODE_FUNCTION, /* 63 - Z_MAC_OS_KEY_CODE_FUNCTION */ \ + Z_KEY_CODE_F17, /* 64 - Z_MAC_OS_KEY_CODE_F17 */ \ + Z_KEY_CODE_ANSI_KEYPAD_DECIMAL_SEPARATOR, /* 65 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_DECIMAL_SEPARATOR */ \ + Z_KEY_CODE_INVALID, /* 66 */ \ + Z_KEY_CODE_ANSI_KEYPAD_ASTERISK, /* 67 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_ASTERISK */ \ + Z_KEY_CODE_INVALID, /* 68 */ \ + Z_KEY_CODE_ANSI_KEYPAD_PLUS_SIGN, /* 69 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_PLUS_SIGN */ \ + Z_KEY_CODE_INVALID, /* 70 */ \ + Z_KEY_CODE_ANSI_KEYPAD_NUM_LOCK, /* 71 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_CLEAR */ \ + Z_KEY_CODE_VOLUME_UP, /* 72 - Z_MAC_OS_KEY_CODE_VOLUME_UP */ \ + Z_KEY_CODE_VOLUME_DOWN, /* 73 - Z_MAC_OS_KEY_CODE_VOLUME_DOWN */ \ + Z_KEY_CODE_MUTE, /* 74 - Z_MAC_OS_KEY_CODE_MUTE */ \ + Z_KEY_CODE_ANSI_KEYPAD_SOLIDUS, /* 75 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_SOLIDUS */ \ + Z_KEY_CODE_ANSI_KEYPAD_ENTER, /* 76 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_ENTER */ \ + Z_KEY_CODE_INVALID, /* 77 */ \ + Z_KEY_CODE_ANSI_KEYPAD_HYPHEN_MINUS, /* 78 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_HYPHEN_MINUS */ \ + Z_KEY_CODE_F18, /* 79 - Z_MAC_OS_KEY_CODE_F18 */ \ + Z_KEY_CODE_F19, /* 80 - Z_MAC_OS_KEY_CODE_F19 */ \ + Z_KEY_CODE_APPLE_ANSI_KEYPAD_EQUALS_SIGN, /* 81 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_EQUALS_SIGN */ \ + Z_KEY_CODE_ANSI_KEYPAD_0, /* 82 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_0 */ \ + Z_KEY_CODE_ANSI_KEYPAD_1, /* 83 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_1 */ \ + Z_KEY_CODE_ANSI_KEYPAD_2, /* 84 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_2 */ \ + Z_KEY_CODE_ANSI_KEYPAD_3, /* 85 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_3 */ \ + Z_KEY_CODE_ANSI_KEYPAD_4, /* 86 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_4 */ \ + Z_KEY_CODE_ANSI_KEYPAD_5, /* 87 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_5 */ \ + Z_KEY_CODE_ANSI_KEYPAD_6, /* 88 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_6 */ \ + Z_KEY_CODE_ANSI_KEYPAD_7, /* 89 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_7 */ \ + Z_KEY_CODE_F20, /* 90 - Z_MAC_OS_KEY_CODE_F20 */ \ + Z_KEY_CODE_ANSI_KEYPAD_8, /* 91 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_8 */ \ + Z_KEY_CODE_ANSI_KEYPAD_9, /* 92 - Z_MAC_OS_KEY_CODE_ANSI_KEYPAD_9 */ \ + Z_KEY_CODE_JIS_YEN_SIGN, /* 93 - Z_MAC_OS_KEY_CODE_JIS_YEN_SIGN */ \ + Z_KEY_CODE_JIS_LOW_LINE, /* 94 - Z_MAC_OS_KEY_CODE_JIS_LOW_LINE */ \ + Z_KEY_CODE_JIS_KEYPAD_COMMA, /* 95 - Z_MAC_OS_KEY_CODE_JIS_KEYPAD_COMMA */ \ + Z_KEY_CODE_F5, /* 96 - Z_MAC_OS_KEY_CODE_F5 */ \ + Z_KEY_CODE_F6, /* 97 - Z_MAC_OS_KEY_CODE_F6 */ \ + Z_KEY_CODE_F7, /* 98 - Z_MAC_OS_KEY_CODE_F7 */ \ + Z_KEY_CODE_F3, /* 99 - Z_MAC_OS_KEY_CODE_F3 */ \ + Z_KEY_CODE_F8, /* 100 - Z_MAC_OS_KEY_CODE_F8 */ \ + Z_KEY_CODE_F9, /* 101 - Z_MAC_OS_KEY_CODE_F9 */ \ + Z_KEY_CODE_JIS_EISU, /* 102 - Z_MAC_OS_KEY_CODE_JIS_EISU */ \ + Z_KEY_CODE_F11, /* 103 - Z_MAC_OS_KEY_CODE_F11 */ \ + Z_KEY_CODE_JIS_KANA, /* 104 - Z_MAC_OS_KEY_CODE_JIS_KANA */ \ + Z_KEY_CODE_PRINT_SCREEN, /* 105 - Z_MAC_OS_KEY_CODE_F13 */ \ + Z_KEY_CODE_F16, /* 106 - Z_MAC_OS_KEY_CODE_F16 */ \ + Z_KEY_CODE_SCROLL_LOCK, /* 107 - Z_MAC_OS_KEY_CODE_F14 */ \ + Z_KEY_CODE_INVALID, /* 108 */ \ + Z_KEY_CODE_F10, /* 109 - Z_MAC_OS_KEY_CODE_F10 */ \ + Z_KEY_CODE_APPLICATION, /* 110 - Z_MAC_OS_KEY_CODE_APPLICATION */ \ + Z_KEY_CODE_F12, /* 111 - Z_MAC_OS_KEY_CODE_F12 */ \ + Z_KEY_CODE_INVALID, /* 112 */ \ + Z_KEY_CODE_PAUSE, /* 113 - Z_MAC_OS_KEY_CODE_F15 */ \ + Z_KEY_CODE_INSERT, /* 114 - Z_MAC_OS_KEY_CODE_HELP */ \ + Z_KEY_CODE_HOME, /* 115 - Z_MAC_OS_KEY_CODE_HOME */ \ + Z_KEY_CODE_PAGE_UP, /* 116 - Z_MAC_OS_KEY_CODE_PAGE_UP */ \ + Z_KEY_CODE_DELETE, /* 117 - Z_MAC_OS_KEY_CODE_DELETE */ \ + Z_KEY_CODE_F4, /* 118 - Z_MAC_OS_KEY_CODE_F4 */ \ + Z_KEY_CODE_END, /* 119 - Z_MAC_OS_KEY_CODE_END */ \ + Z_KEY_CODE_F2, /* 120 - Z_MAC_OS_KEY_CODE_F2 */ \ + Z_KEY_CODE_PAGE_DOWN, /* 121 - Z_MAC_OS_KEY_CODE_PAGE_DOWN */ \ + Z_KEY_CODE_F1, /* 122 - Z_MAC_OS_KEY_CODE_F1 */ \ + Z_KEY_CODE_LEFT, /* 123 - Z_MAC_OS_KEY_CODE_LEFT */ \ + Z_KEY_CODE_RIGHT, /* 124 - Z_MAC_OS_KEY_CODE_RIGHT */ \ + Z_KEY_CODE_DOWN, /* 125 - Z_MAC_OS_KEY_CODE_DOWN */ \ + Z_KEY_CODE_UP, /* 126 - Z_MAC_OS_KEY_CODE_UP */ \ + Z_KEY_CODE_INVALID /* 127 */ + +#endif /* Z_formats_keymap_Mac_OS_H */ diff --git a/projects/Zeta/API/Z/formats/keymap/USB.h b/projects/Zeta/API/Z/formats/keymap/USB.h new file mode 100644 index 0000000..3d40a0f --- /dev/null +++ b/projects/Zeta/API/Z/formats/keymap/USB.h @@ -0,0 +1,468 @@ +/* Zeta API - Z/formats/keymap/USB.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_keymap_USB_H +#define Z_formats_keymap_USB_H + +#define Z_USB_KEY_CODE_KEYBOARD_ERROR_ROLL_OVER 0x01 +#define Z_USB_KEY_CODE_KEYBOARD_POST_FAIL 0x02 +#define Z_USB_KEY_CODE_KEYBOARD_ERROR_UNDEFINED 0x03 +#define Z_USB_KEY_CODE_KEYBOARD_A 0x04 +#define Z_USB_KEY_CODE_KEYBOARD_B 0x05 +#define Z_USB_KEY_CODE_KEYBOARD_C 0x06 +#define Z_USB_KEY_CODE_KEYBOARD_D 0x07 +#define Z_USB_KEY_CODE_KEYBOARD_E 0x08 +#define Z_USB_KEY_CODE_KEYBOARD_F 0x09 +#define Z_USB_KEY_CODE_KEYBOARD_G 0x0A +#define Z_USB_KEY_CODE_KEYBOARD_H 0x0B +#define Z_USB_KEY_CODE_KEYBOARD_I 0x0C +#define Z_USB_KEY_CODE_KEYBOARD_J 0x0D +#define Z_USB_KEY_CODE_KEYBOARD_K 0x0E +#define Z_USB_KEY_CODE_KEYBOARD_L 0x0F +#define Z_USB_KEY_CODE_KEYBOARD_M 0x10 +#define Z_USB_KEY_CODE_KEYBOARD_N 0x11 +#define Z_USB_KEY_CODE_KEYBOARD_O 0x12 +#define Z_USB_KEY_CODE_KEYBOARD_P 0x13 +#define Z_USB_KEY_CODE_KEYBOARD_Q 0x14 +#define Z_USB_KEY_CODE_KEYBOARD_R 0x15 +#define Z_USB_KEY_CODE_KEYBOARD_S 0x16 +#define Z_USB_KEY_CODE_KEYBOARD_T 0x17 +#define Z_USB_KEY_CODE_KEYBOARD_U 0x18 +#define Z_USB_KEY_CODE_KEYBOARD_V 0x19 +#define Z_USB_KEY_CODE_KEYBOARD_W 0x1A +#define Z_USB_KEY_CODE_KEYBOARD_X 0x1B +#define Z_USB_KEY_CODE_KEYBOARD_Y 0x1C +#define Z_USB_KEY_CODE_KEYBOARD_Z 0x1D +#define Z_USB_KEY_CODE_KEYBOARD_1 0x1E +#define Z_USB_KEY_CODE_KEYBOARD_2 0x1F +#define Z_USB_KEY_CODE_KEYBOARD_3 0x20 +#define Z_USB_KEY_CODE_KEYBOARD_4 0x21 +#define Z_USB_KEY_CODE_KEYBOARD_5 0x22 +#define Z_USB_KEY_CODE_KEYBOARD_6 0x23 +#define Z_USB_KEY_CODE_KEYBOARD_7 0x24 +#define Z_USB_KEY_CODE_KEYBOARD_8 0x25 +#define Z_USB_KEY_CODE_KEYBOARD_9 0x26 +#define Z_USB_KEY_CODE_KEYBOARD_0 0x27 +#define Z_USB_KEY_CODE_KEYBOARD_RETURN 0x28 +#define Z_USB_KEY_CODE_KEYBOARD_ESCAPE 0x29 +#define Z_USB_KEY_CODE_KEYBOARD_BACKSPACE 0x2A +#define Z_USB_KEY_CODE_KEYBOARD_TAB 0x2B +#define Z_USB_KEY_CODE_KEYBOARD_SPACE 0x2C +#define Z_USB_KEY_CODE_KEYBOARD_HYPHEN_MINUS 0x2D +#define Z_USB_KEY_CODE_KEYBOARD_EQUALS_SIGN 0x2E +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_SQUARE_BRACKET 0x2F +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_SQUARE_BRACKET 0x30 +#define Z_USB_KEY_CODE_KEYBOARD_REVERSE_SOLIDUS 0x31 +#define Z_USB_KEY_CODE_KEYBOARD_NON_US_NUMBER_SIGN 0x32 +#define Z_USB_KEY_CODE_KEYBOARD_SEMICOLON 0x33 +#define Z_USB_KEY_CODE_KEYBOARD_APOSTROPHE 0x34 +#define Z_USB_KEY_CODE_KEYBOARD_GRAVE_ACCENT 0x35 +#define Z_USB_KEY_CODE_KEYBOARD_COMMA 0x36 +#define Z_USB_KEY_CODE_KEYBOARD_FULL_STOP 0x37 +#define Z_USB_KEY_CODE_KEYBOARD_SOLIDUS 0x38 +#define Z_USB_KEY_CODE_KEYBOARD_CAPS_LOCK 0x39 +#define Z_USB_KEY_CODE_KEYBOARD_F1 0x3A +#define Z_USB_KEY_CODE_KEYBOARD_F2 0x3B +#define Z_USB_KEY_CODE_KEYBOARD_F3 0x3C +#define Z_USB_KEY_CODE_KEYBOARD_F4 0x3D +#define Z_USB_KEY_CODE_KEYBOARD_F5 0x3E +#define Z_USB_KEY_CODE_KEYBOARD_F6 0x3F +#define Z_USB_KEY_CODE_KEYBOARD_F7 0x40 +#define Z_USB_KEY_CODE_KEYBOARD_F8 0x41 +#define Z_USB_KEY_CODE_KEYBOARD_F9 0x42 +#define Z_USB_KEY_CODE_KEYBOARD_F10 0x43 +#define Z_USB_KEY_CODE_KEYBOARD_F11 0x44 +#define Z_USB_KEY_CODE_KEYBOARD_F12 0x45 +#define Z_USB_KEY_CODE_KEYBOARD_PRINT_SCREEN 0x46 +#define Z_USB_KEY_CODE_KEYBOARD_SCROLL_LOCK 0x47 +#define Z_USB_KEY_CODE_KEYBOARD_PAUSE 0x48 +#define Z_USB_KEY_CODE_KEYBOARD_INSERT 0x49 +#define Z_USB_KEY_CODE_KEYBOARD_HOME 0x4A +#define Z_USB_KEY_CODE_KEYBOARD_PAGE_UP 0x4B +#define Z_USB_KEY_CODE_KEYBOARD_DELETE 0x4C +#define Z_USB_KEY_CODE_KEYBOARD_END 0x4D +#define Z_USB_KEY_CODE_KEYBOARD_PAGE_DOWN 0x4E +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_ARROW 0x4F +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_ARROW 0x50 +#define Z_USB_KEY_CODE_KEYBOARD_DOWN_ARROW 0x51 +#define Z_USB_KEY_CODE_KEYBOARD_UP_ARROW 0x52 +#define Z_USB_KEY_CODE_KEYPAD_NUM_LOCK 0x53 +#define Z_USB_KEY_CODE_KEYPAD_SOLIDUS 0x54 +#define Z_USB_KEY_CODE_KEYPAD_ASTERISK 0x55 +#define Z_USB_KEY_CODE_KEYPAD_HYPHEN_MINUS 0x56 +#define Z_USB_KEY_CODE_KEYPAD_PLUS_SIGN 0x57 +#define Z_USB_KEY_CODE_KEYPAD_ENTER 0x58 +#define Z_USB_KEY_CODE_KEYPAD_1 0x59 +#define Z_USB_KEY_CODE_KEYPAD_2 0x5A +#define Z_USB_KEY_CODE_KEYPAD_3 0x5B +#define Z_USB_KEY_CODE_KEYPAD_4 0x5C +#define Z_USB_KEY_CODE_KEYPAD_5 0x5D +#define Z_USB_KEY_CODE_KEYPAD_6 0x5E +#define Z_USB_KEY_CODE_KEYPAD_7 0x5F +#define Z_USB_KEY_CODE_KEYPAD_8 0x60 +#define Z_USB_KEY_CODE_KEYPAD_9 0x61 +#define Z_USB_KEY_CODE_KEYPAD_0 0x62 +#define Z_USB_KEY_CODE_KEYPAD_DECIMAL_SEPARATOR 0x63 +#define Z_USB_KEY_CODE_KEYBOARD_NON_US_REVERSE_SOLIDUS 0x64 +#define Z_USB_KEY_CODE_KEYBOARD_APPLICATION 0x65 +#define Z_USB_KEY_CODE_KEYBOARD_POWER 0x66 +#define Z_USB_KEY_CODE_KEYPAD_EQUALS_SIGN 0x67 +#define Z_USB_KEY_CODE_KEYBOARD_F13 0x68 +#define Z_USB_KEY_CODE_KEYBOARD_F14 0x69 +#define Z_USB_KEY_CODE_KEYBOARD_F15 0x6A +#define Z_USB_KEY_CODE_KEYBOARD_F16 0x6B +#define Z_USB_KEY_CODE_KEYBOARD_F17 0x6C +#define Z_USB_KEY_CODE_KEYBOARD_F18 0x6D +#define Z_USB_KEY_CODE_KEYBOARD_F19 0x6E +#define Z_USB_KEY_CODE_KEYBOARD_F20 0x6F +#define Z_USB_KEY_CODE_KEYBOARD_F21 0x70 +#define Z_USB_KEY_CODE_KEYBOARD_F22 0x71 +#define Z_USB_KEY_CODE_KEYBOARD_F23 0x72 +#define Z_USB_KEY_CODE_KEYBOARD_F24 0x73 +#define Z_USB_KEY_CODE_KEYBOARD_EXECUTE 0x74 +#define Z_USB_KEY_CODE_KEYBOARD_HELP 0x75 +#define Z_USB_KEY_CODE_KEYBOARD_MENU 0x76 +#define Z_USB_KEY_CODE_KEYBOARD_SELECT 0x77 +#define Z_USB_KEY_CODE_KEYBOARD_STOP 0x78 +#define Z_USB_KEY_CODE_KEYBOARD_AGAIN 0x79 +#define Z_USB_KEY_CODE_KEYBOARD_UNDO 0x7A +#define Z_USB_KEY_CODE_KEYBOARD_CUT 0x7B +#define Z_USB_KEY_CODE_KEYBOARD_COPY 0x7C +#define Z_USB_KEY_CODE_KEYBOARD_PASTE 0x7D +#define Z_USB_KEY_CODE_KEYBOARD_FIND 0x7E +#define Z_USB_KEY_CODE_KEYBOARD_MUTE 0x7F +#define Z_USB_KEY_CODE_KEYBOARD_VOLUME_UP 0x80 +#define Z_USB_KEY_CODE_KEYBOARD_VOLUME_DOWN 0x81 +#define Z_USB_KEY_CODE_KEYBOARD_LOCKING_CAPS_LOCK 0x82 +#define Z_USB_KEY_CODE_KEYBOARD_LOCKING_NUM_LOCK 0x83 +#define Z_USB_KEY_CODE_KEYBOARD_LOCKING_SCROLL_LOCK 0x84 +#define Z_USB_KEY_CODE_KEYPAD_COMMA 0x85 +#define Z_USB_KEY_CODE_AS_400_KEYPAD_EQUALS_SIGN 0x86 /* Used on AS/400 keyboards */ +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_1 0x87 +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_2 0x88 +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_3 0x89 +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_4 0x8A +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_5 0x8B +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_6 0x8C +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_7 0x8D +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_8 0x8E +#define Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_9 0x8F +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_1 0x90 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_2 0x91 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_3 0x92 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_4 0x93 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_5 0x94 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_6 0x95 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_7 0x96 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_8 0x97 +#define Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_9 0x98 +#define Z_USB_KEY_CODE_KEYBOARD_ALTERNATE_ERASE 0x99 +#define Z_USB_KEY_CODE_KEYBOARD_SYS_REQ_ATTENTION 0x9A +#define Z_USB_KEY_CODE_KEYBOARD_CANCEL 0x9B +#define Z_USB_KEY_CODE_KEYBOARD_CLEAR 0x9C +#define Z_USB_KEY_CODE_KEYBOARD_PRIOR 0x9D +#define Z_USB_KEY_CODE_KEYBOARD_RETURN_2 0x9E /* Duplicated? */ +#define Z_USB_KEY_CODE_KEYBOARD_SEPARATOR 0x9F +#define Z_USB_KEY_CODE_KEYBOARD_OUT 0xA0 +#define Z_USB_KEY_CODE_KEYBOARD_OPER 0xA1 +#define Z_USB_KEY_CODE_KEYBOARD_CLEAR_AGAIN 0xA2 +#define Z_USB_KEY_CODE_KEYBOARD_CR_SEL_PROPS 0xA3 +#define Z_USB_KEY_CODE_KEYBOARD_EX_SEL 0xA4 +/* A5h-AFh - Reserved */ +#define Z_USB_KEY_CODE_KEYPAD_00 0xB0 +#define Z_USB_KEY_CODE_KEYPAD_000 0xB1 +#define Z_USB_KEY_CODE_THOUSANDS_SEPARATOR 0xB2 +#define Z_USB_KEY_CODE_DECIMAL_SEPARATOR 0xB3 +#define Z_USB_KEY_CODE_CURRENCY_UNIT 0xB4 +#define Z_USB_KEY_CODE_CURRENCY_SUBUNIT 0xB5 +#define Z_USB_KEY_CODE_KEYPAD_LEFT_PARENTHESIS 0xB6 +#define Z_USB_KEY_CODE_KEYPAD_RIGHT_PARENTHESIS 0xB7 +#define Z_USB_KEY_CODE_KEYPAD_LEFT_CURLY_BRACKET 0xB8 +#define Z_USB_KEY_CODE_KEYPAD_RIGHT_CURLY_BRACKET 0xB9 +#define Z_USB_KEY_CODE_KEYPAD_TAB 0xBA +#define Z_USB_KEY_CODE_KEYPAD_BACKSPACE 0xBB +#define Z_USB_KEY_CODE_KEYPAD_A 0xBC +#define Z_USB_KEY_CODE_KEYPAD_B 0xBD +#define Z_USB_KEY_CODE_KEYPAD_C 0xBE +#define Z_USB_KEY_CODE_KEYPAD_D 0xBF +#define Z_USB_KEY_CODE_KEYPAD_E 0xC0 +#define Z_USB_KEY_CODE_KEYPAD_F 0xC1 +#define Z_USB_KEY_CODE_KEYPAD_XOR 0xC2 +#define Z_USB_KEY_CODE_KEYPAD_CIRCUMFLEX_ACCENT 0xC3 +#define Z_USB_KEY_CODE_KEYPAD_PERCENT_SIGN 0xC4 +#define Z_USB_KEY_CODE_KEYPAD_LESS_THAN_SIGN 0xC5 +#define Z_USB_KEY_CODE_KEYPAD_GREATER_THAN_SIGN 0xC6 +#define Z_USB_KEY_CODE_KEYPAD_AMPERSAND 0xC7 +#define Z_USB_KEY_CODE_KEYPAD_DOUBLE_AMPERSAND 0xC8 +#define Z_USB_KEY_CODE_KEYPAD_VERTICAL_LINE 0xC9 +#define Z_USB_KEY_CODE_KEYPAD_DOUBLE_VERTICAL_LINE 0xCA +#define Z_USB_KEY_CODE_KEYPAD_COLON 0xCB +#define Z_USB_KEY_CODE_KEYPAD_NUMBER_SIGN 0xCC +#define Z_USB_KEY_CODE_KEYPAD_SPACE 0xCD +#define Z_USB_KEY_CODE_KEYPAD_COMMERCIAL_AT 0xCE +#define Z_USB_KEY_CODE_KEYPAD_EXCLAMATION_MARK 0xCF +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_STORE 0xD0 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_RECALL 0xD1 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_CLEAR 0xD2 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_ADD 0xD3 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_SUBTRACT 0xD4 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_MULTIPLY 0xD5 +#define Z_USB_KEY_CODE_KEYPAD_MEMORY_DIVIDE 0xD6 +#define Z_USB_KEY_CODE_KEYPAD_PLUS_MINUS_SIGN 0xD7 +#define Z_USB_KEY_CODE_KEYPAD_CLEAR 0xD8 +#define Z_USB_KEY_CODE_KEYPAD_CLEAR_ENTRY 0xD9 +#define Z_USB_KEY_CODE_KEYPAD_BINARY 0xDA +#define Z_USB_KEY_CODE_KEYPAD_OCTAL 0xDB +#define Z_USB_KEY_CODE_KEYPAD_DECIMAL 0xDC +#define Z_USB_KEY_CODE_KEYPAD_HEXADECIMAL 0xDD +/* DEh-DFh - Reserved */ +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_CONTROL 0xE0 +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_SHIFT 0xE1 +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_ALT 0xE2 +#define Z_USB_KEY_CODE_KEYBOARD_LEFT_GUI 0xE3 +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_CONTROL 0xE4 +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_SHIFT 0xE5 +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_ALT 0xE6 +#define Z_USB_KEY_CODE_KEYBOARD_RIGHT_GUI 0xE7 +/* E8h-FFFFh - Reserved */ + +#define Z_ARRAY_CONTENT_USB_KEY_CODE_TO_Z_KEY_CODE \ + Z_KEY_CODE_INVALID, /* 0x00 - Unused */ \ + Z_KEY_CODE_INVALID, /* 0x01 - Z_USB_KEY_CODE_KEYBOARD_ERROR_ROLL_OVER */ \ + Z_KEY_CODE_INVALID, /* 0x02 - Z_USB_KEY_CODE_KEYBOARD_POST_FAIL */ \ + Z_KEY_CODE_INVALID, /* 0x03 - Z_USB_KEY_CODE_KEYBOARD_ERROR_UNDEFINED */ \ + Z_KEY_CODE_ANSI_A, /* 0x04 - Z_USB_KEY_CODE_KEYBOARD_A */ \ + Z_KEY_CODE_ANSI_B, /* 0x05 - Z_USB_KEY_CODE_KEYBOARD_B */ \ + Z_KEY_CODE_ANSI_C, /* 0x06 - Z_USB_KEY_CODE_KEYBOARD_C */ \ + Z_KEY_CODE_ANSI_D, /* 0x07 - Z_USB_KEY_CODE_KEYBOARD_D */ \ + Z_KEY_CODE_ANSI_E, /* 0x08 - Z_USB_KEY_CODE_KEYBOARD_E */ \ + Z_KEY_CODE_ANSI_F, /* 0x09 - Z_USB_KEY_CODE_KEYBOARD_F */ \ + Z_KEY_CODE_ANSI_G, /* 0x0A - Z_USB_KEY_CODE_KEYBOARD_G */ \ + Z_KEY_CODE_ANSI_H, /* 0x0B - Z_USB_KEY_CODE_KEYBOARD_H */ \ + Z_KEY_CODE_ANSI_I, /* 0x0C - Z_USB_KEY_CODE_KEYBOARD_I */ \ + Z_KEY_CODE_ANSI_J, /* 0x0D - Z_USB_KEY_CODE_KEYBOARD_J */ \ + Z_KEY_CODE_ANSI_K, /* 0x0E - Z_USB_KEY_CODE_KEYBOARD_K */ \ + Z_KEY_CODE_ANSI_L, /* 0x0F - Z_USB_KEY_CODE_KEYBOARD_L */ \ + Z_KEY_CODE_ANSI_M, /* 0x10 - Z_USB_KEY_CODE_KEYBOARD_M */ \ + Z_KEY_CODE_ANSI_N, /* 0x11 - Z_USB_KEY_CODE_KEYBOARD_N */ \ + Z_KEY_CODE_ANSI_O, /* 0x12 - Z_USB_KEY_CODE_KEYBOARD_O */ \ + Z_KEY_CODE_ANSI_P, /* 0x13 - Z_USB_KEY_CODE_KEYBOARD_P */ \ + Z_KEY_CODE_ANSI_Q, /* 0x14 - Z_USB_KEY_CODE_KEYBOARD_Q */ \ + Z_KEY_CODE_ANSI_R, /* 0x15 - Z_USB_KEY_CODE_KEYBOARD_R */ \ + Z_KEY_CODE_ANSI_S, /* 0x16 - Z_USB_KEY_CODE_KEYBOARD_S */ \ + Z_KEY_CODE_ANSI_T, /* 0x17 - Z_USB_KEY_CODE_KEYBOARD_T */ \ + Z_KEY_CODE_ANSI_U, /* 0x18 - Z_USB_KEY_CODE_KEYBOARD_U */ \ + Z_KEY_CODE_ANSI_V, /* 0x19 - Z_USB_KEY_CODE_KEYBOARD_V */ \ + Z_KEY_CODE_ANSI_W, /* 0x1A - Z_USB_KEY_CODE_KEYBOARD_W */ \ + Z_KEY_CODE_ANSI_X, /* 0x1B - Z_USB_KEY_CODE_KEYBOARD_X */ \ + Z_KEY_CODE_ANSI_Y, /* 0x1C - Z_USB_KEY_CODE_KEYBOARD_Y */ \ + Z_KEY_CODE_ANSI_Z, /* 0x1D - Z_USB_KEY_CODE_KEYBOARD_Z */ \ + Z_KEY_CODE_ANSI_1, /* 0x1E - Z_USB_KEY_CODE_KEYBOARD_1 */ \ + Z_KEY_CODE_ANSI_2, /* 0x1F - Z_USB_KEY_CODE_KEYBOARD_2 */ \ + Z_KEY_CODE_ANSI_3, /* 0x20 - Z_USB_KEY_CODE_KEYBOARD_3 */ \ + Z_KEY_CODE_ANSI_4, /* 0x21 - Z_USB_KEY_CODE_KEYBOARD_4 */ \ + Z_KEY_CODE_ANSI_5, /* 0x22 - Z_USB_KEY_CODE_KEYBOARD_5 */ \ + Z_KEY_CODE_ANSI_6, /* 0x23 - Z_USB_KEY_CODE_KEYBOARD_6 */ \ + Z_KEY_CODE_ANSI_7, /* 0x24 - Z_USB_KEY_CODE_KEYBOARD_7 */ \ + Z_KEY_CODE_ANSI_8, /* 0x25 - Z_USB_KEY_CODE_KEYBOARD_8 */ \ + Z_KEY_CODE_ANSI_9, /* 0x26 - Z_USB_KEY_CODE_KEYBOARD_9 */ \ + Z_KEY_CODE_ANSI_0, /* 0x27 - Z_USB_KEY_CODE_KEYBOARD_0 */ \ + Z_KEY_CODE_RETURN, /* 0x28 - Z_USB_KEY_CODE_KEYBOARD_RETURN */ \ + Z_KEY_CODE_ESCAPE, /* 0x29 - Z_USB_KEY_CODE_KEYBOARD_ESCAPE */ \ + Z_KEY_CODE_BACKSPACE, /* 0x2A - Z_USB_KEY_CODE_KEYBOARD_BACKSPACE */ \ + Z_KEY_CODE_TAB, /* 0x2B - Z_USB_KEY_CODE_KEYBOARD_TAB */ \ + Z_KEY_CODE_SPACE, /* 0x2C - Z_USB_KEY_CODE_KEYBOARD_SPACE */ \ + Z_KEY_CODE_ANSI_HYPHEN_MINUS, /* 0x2D - Z_USB_KEY_CODE_KEYBOARD_HYPHEN_MINUS */ \ + Z_KEY_CODE_ANSI_EQUALS_SIGN, /* 0x2E - Z_USB_KEY_CODE_KEYBOARD_EQUALS_SIGN */ \ + Z_KEY_CODE_ANSI_LEFT_SQUARE_BRACKET, /* 0x2F - Z_USB_KEY_CODE_KEYBOARD_LEFT_SQUARE_BRACKET */ \ + Z_KEY_CODE_ANSI_RIGHT_SQUARE_BRACKET, /* 0x30 - Z_USB_KEY_CODE_KEYBOARD_RIGHT_SQUARE_BRACKET */ \ + Z_KEY_CODE_ANSI_REVERSE_SOLIDUS, /* 0x31 - Z_USB_KEY_CODE_KEYBOARD_REVERSE_SOLIDUS */ \ + Z_KEY_CODE_INVALID, /* 0x32 - Z_USB_KEY_CODE_KEYBOARD_NON_US_NUMBER_SIGN */ \ + Z_KEY_CODE_ANSI_SEMICOLON, /* 0x33 - Z_USB_KEY_CODE_KEYBOARD_SEMICOLON */ \ + Z_KEY_CODE_ANSI_APOSTROPHE, /* 0x34 - Z_USB_KEY_CODE_KEYBOARD_APOSTROPHE */ \ + Z_KEY_CODE_ANSI_GRAVE_ACCENT, /* 0x35 - Z_USB_KEY_CODE_KEYBOARD_GRAVE_ACCENT */ \ + Z_KEY_CODE_ANSI_COMMA, /* 0x36 - Z_USB_KEY_CODE_KEYBOARD_COMMA */ \ + Z_KEY_CODE_ANSI_FULL_STOP, /* 0x37 - Z_USB_KEY_CODE_KEYBOARD_FULL_STOP */ \ + Z_KEY_CODE_ANSI_SOLIDUS, /* 0x38 - Z_USB_KEY_CODE_KEYBOARD_SOLIDUS */ \ + Z_KEY_CODE_CAPS_LOCK, /* 0x39 - Z_USB_KEY_CODE_KEYBOARD_CAPS_LOCK */ \ + Z_KEY_CODE_F1, /* 0x3A - Z_USB_KEY_CODE_KEYBOARD_F1 */ \ + Z_KEY_CODE_F2, /* 0x3B - Z_USB_KEY_CODE_KEYBOARD_F2 */ \ + Z_KEY_CODE_F3, /* 0x3C - Z_USB_KEY_CODE_KEYBOARD_F3 */ \ + Z_KEY_CODE_F4, /* 0x3D - Z_USB_KEY_CODE_KEYBOARD_F4 */ \ + Z_KEY_CODE_F5, /* 0x3E - Z_USB_KEY_CODE_KEYBOARD_F5 */ \ + Z_KEY_CODE_F6, /* 0x3F - Z_USB_KEY_CODE_KEYBOARD_F6 */ \ + Z_KEY_CODE_F7, /* 0x40 - Z_USB_KEY_CODE_KEYBOARD_F7 */ \ + Z_KEY_CODE_F8, /* 0x41 - Z_USB_KEY_CODE_KEYBOARD_F8 */ \ + Z_KEY_CODE_F9, /* 0x42 - Z_USB_KEY_CODE_KEYBOARD_F9 */ \ + Z_KEY_CODE_F10, /* 0x43 - Z_USB_KEY_CODE_KEYBOARD_F10 */ \ + Z_KEY_CODE_F11, /* 0x44 - Z_USB_KEY_CODE_KEYBOARD_F11 */ \ + Z_KEY_CODE_F12, /* 0x45 - Z_USB_KEY_CODE_KEYBOARD_F12 */ \ + Z_KEY_CODE_PRINT_SCREEN, /* 0x46 - Z_USB_KEY_CODE_KEYBOARD_PRINT_SCREEN */ \ + Z_KEY_CODE_SCROLL_LOCK, /* 0x47 - Z_USB_KEY_CODE_KEYBOARD_SCROLL_LOCK */ \ + Z_KEY_CODE_PAUSE, /* 0x48 - Z_USB_KEY_CODE_KEYBOARD_PAUSE */ \ + Z_KEY_CODE_INSERT, /* 0x49 - Z_USB_KEY_CODE_KEYBOARD_INSERT */ \ + Z_KEY_CODE_HOME, /* 0x4A - Z_USB_KEY_CODE_KEYBOARD_HOME */ \ + Z_KEY_CODE_PAGE_UP, /* 0x4B - Z_USB_KEY_CODE_KEYBOARD_PAGE_UP */ \ + Z_KEY_CODE_DELETE, /* 0x4C - Z_USB_KEY_CODE_KEYBOARD_DELETE */ \ + Z_KEY_CODE_END, /* 0x4D - Z_USB_KEY_CODE_KEYBOARD_END */ \ + Z_KEY_CODE_PAGE_DOWN, /* 0x4E - Z_USB_KEY_CODE_KEYBOARD_PAGE_DOWN */ \ + Z_KEY_CODE_RIGHT, /* 0x4F - Z_USB_KEY_CODE_KEYBOARD_RIGHT_ARROW */ \ + Z_KEY_CODE_LEFT, /* 0x50 - Z_USB_KEY_CODE_KEYBOARD_LEFT_ARROW */ \ + Z_KEY_CODE_DOWN, /* 0x51 - Z_USB_KEY_CODE_KEYBOARD_DOWN_ARROW */ \ + Z_KEY_CODE_UP, /* 0x52 - Z_USB_KEY_CODE_KEYBOARD_UP_ARROW */ \ + Z_KEY_CODE_ANSI_KEYPAD_NUM_LOCK, /* 0x53 - Z_USB_KEY_CODE_KEYPAD_NUM_LOCK */ \ + Z_KEY_CODE_ANSI_KEYPAD_SOLIDUS, /* 0x54 - Z_USB_KEY_CODE_KEYPAD_SOLIDUS */ \ + Z_KEY_CODE_ANSI_KEYPAD_ASTERISK, /* 0x55 - Z_USB_KEY_CODE_KEYPAD_ASTERISK */ \ + Z_KEY_CODE_ANSI_KEYPAD_HYPHEN_MINUS, /* 0x56 - Z_USB_KEY_CODE_KEYPAD_HYPHEN_MINUS */ \ + Z_KEY_CODE_ANSI_KEYPAD_PLUS_SIGN, /* 0x57 - Z_USB_KEY_CODE_KEYPAD_PLUS_SIGN */ \ + Z_KEY_CODE_ANSI_KEYPAD_ENTER, /* 0x58 - Z_USB_KEY_CODE_KEYPAD_ENTER */ \ + Z_KEY_CODE_ANSI_KEYPAD_1, /* 0x59 - Z_USB_KEY_CODE_KEYPAD_1 */ \ + Z_KEY_CODE_ANSI_KEYPAD_2, /* 0x5A - Z_USB_KEY_CODE_KEYPAD_2 */ \ + Z_KEY_CODE_ANSI_KEYPAD_3, /* 0x5B - Z_USB_KEY_CODE_KEYPAD_3 */ \ + Z_KEY_CODE_ANSI_KEYPAD_4, /* 0x5C - Z_USB_KEY_CODE_KEYPAD_4 */ \ + Z_KEY_CODE_ANSI_KEYPAD_5, /* 0x5D - Z_USB_KEY_CODE_KEYPAD_5 */ \ + Z_KEY_CODE_ANSI_KEYPAD_6, /* 0x5E - Z_USB_KEY_CODE_KEYPAD_6 */ \ + Z_KEY_CODE_ANSI_KEYPAD_7, /* 0x5F - Z_USB_KEY_CODE_KEYPAD_7 */ \ + Z_KEY_CODE_ANSI_KEYPAD_8, /* 0x60 - Z_USB_KEY_CODE_KEYPAD_8 */ \ + Z_KEY_CODE_ANSI_KEYPAD_9, /* 0x61 - Z_USB_KEY_CODE_KEYPAD_9 */ \ + Z_KEY_CODE_ANSI_KEYPAD_0, /* 0x62 - Z_USB_KEY_CODE_KEYPAD_0 */ \ + Z_KEY_CODE_ANSI_KEYPAD_DECIMAL_SEPARATOR, /* 0x63 - Z_USB_KEY_CODE_KEYPAD_DECIMAL_SEPARATOR */ \ + Z_KEY_CODE_ISO_SECTION, /* 0x64 - Z_USB_KEY_CODE_KEYBOARD_NON_US_REVERSE_SOLIDUS */ \ + Z_KEY_CODE_APPLICATION, /* 0x65 - Z_USB_KEY_CODE_KEYBOARD_APPLICATION */ \ + Z_KEY_CODE_INVALID, /* 0x66 - Z_USB_KEY_CODE_KEYBOARD_POWER */ \ + Z_KEY_CODE_APPLE_ANSI_KEYPAD_EQUALS_SIGN, /* 0x67 - Z_USB_KEY_CODE_KEYPAD_EQUALS_SIGN */ \ + Z_KEY_CODE_F13, /* 0x68 - Z_USB_KEY_CODE_KEYBOARD_F13 */ \ + Z_KEY_CODE_F14, /* 0x69 - Z_USB_KEY_CODE_KEYBOARD_F14 */ \ + Z_KEY_CODE_F15, /* 0x6A - Z_USB_KEY_CODE_KEYBOARD_F15 */ \ + Z_KEY_CODE_F16, /* 0x6B - Z_USB_KEY_CODE_KEYBOARD_F16 */ \ + Z_KEY_CODE_F17, /* 0x6C - Z_USB_KEY_CODE_KEYBOARD_F17 */ \ + Z_KEY_CODE_F18, /* 0x6D - Z_USB_KEY_CODE_KEYBOARD_F18 */ \ + Z_KEY_CODE_F19, /* 0x6E - Z_USB_KEY_CODE_KEYBOARD_F19 */ \ + Z_KEY_CODE_F20, /* 0x6F - Z_USB_KEY_CODE_KEYBOARD_F20 */ \ + Z_KEY_CODE_F21, /* 0x70 - Z_USB_KEY_CODE_KEYBOARD_F21 */ \ + Z_KEY_CODE_F22, /* 0x71 - Z_USB_KEY_CODE_KEYBOARD_F22 */ \ + Z_KEY_CODE_F23, /* 0x72 - Z_USB_KEY_CODE_KEYBOARD_F23 */ \ + Z_KEY_CODE_F24, /* 0x73 - Z_USB_KEY_CODE_KEYBOARD_F24 */ \ + Z_KEY_CODE_INVALID, /* 0x74 - Z_USB_KEY_CODE_KEYBOARD_EXECUTE */ \ + Z_KEY_CODE_INVALID, /* 0x75 - Z_USB_KEY_CODE_KEYBOARD_HELP */ \ + Z_KEY_CODE_INVALID, /* 0x76 - Z_USB_KEY_CODE_KEYBOARD_MENU */ \ + Z_KEY_CODE_INVALID, /* 0x77 - Z_USB_KEY_CODE_KEYBOARD_SELECT */ \ + Z_KEY_CODE_INVALID, /* 0x78 - Z_USB_KEY_CODE_KEYBOARD_STOP */ \ + Z_KEY_CODE_INVALID, /* 0x79 - Z_USB_KEY_CODE_KEYBOARD_AGAIN */ \ + Z_KEY_CODE_INVALID, /* 0x7A - Z_USB_KEY_CODE_KEYBOARD_UNDO */ \ + Z_KEY_CODE_INVALID, /* 0x7B - Z_USB_KEY_CODE_KEYBOARD_CUT */ \ + Z_KEY_CODE_INVALID, /* 0x7C - Z_USB_KEY_CODE_KEYBOARD_COPY */ \ + Z_KEY_CODE_INVALID, /* 0x7D - Z_USB_KEY_CODE_KEYBOARD_PASTE */ \ + Z_KEY_CODE_INVALID, /* 0x7E - Z_USB_KEY_CODE_KEYBOARD_FIND */ \ + Z_KEY_CODE_MUTE, /* 0x7F - Z_USB_KEY_CODE_KEYBOARD_MUTE */ \ + Z_KEY_CODE_VOLUME_UP, /* 0x80 - Z_USB_KEY_CODE_KEYBOARD_VOLUME_UP */ \ + Z_KEY_CODE_VOLUME_DOWN, /* 0x81 - Z_USB_KEY_CODE_KEYBOARD_VOLUME_DOWN */ \ + Z_KEY_CODE_INVALID, /* 0x82 - Z_USB_KEY_CODE_KEYBOARD_LOCKING_CAPS_LOCK */ \ + Z_KEY_CODE_INVALID, /* 0x83 - Z_USB_KEY_CODE_KEYBOARD_LOCKING_NUM_LOCK */ \ + Z_KEY_CODE_INVALID, /* 0x84 - Z_USB_KEY_CODE_KEYBOARD_LOCKING_SCROLL_LOCK */ \ + Z_KEY_CODE_INVALID, /* 0x85 - Z_USB_KEY_CODE_KEYPAD_COMMA */ \ + Z_KEY_CODE_INVALID, /* 0x86 - Z_USB_KEY_CODE_AS_400_KEYPAD_EQUALS_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0x87 - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_1 */ \ + Z_KEY_CODE_INVALID, /* 0x88 - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_2 */ \ + Z_KEY_CODE_INVALID, /* 0x89 - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_3 */ \ + Z_KEY_CODE_INVALID, /* 0x8A - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_4 */ \ + Z_KEY_CODE_INVALID, /* 0x8B - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_5 */ \ + Z_KEY_CODE_INVALID, /* 0x8C - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_6 */ \ + Z_KEY_CODE_INVALID, /* 0x8D - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_7 */ \ + Z_KEY_CODE_INVALID, /* 0x8E - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_8 */ \ + Z_KEY_CODE_INVALID, /* 0x8F - Z_USB_KEY_CODE_KEYBOARD_INTERNATIONAL_9 */ \ + Z_KEY_CODE_INVALID, /* 0x90 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_1 */ \ + Z_KEY_CODE_INVALID, /* 0x91 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_2 */ \ + Z_KEY_CODE_INVALID, /* 0x92 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_3 */ \ + Z_KEY_CODE_INVALID, /* 0x93 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_4 */ \ + Z_KEY_CODE_INVALID, /* 0x94 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_5 */ \ + Z_KEY_CODE_INVALID, /* 0x95 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_6 */ \ + Z_KEY_CODE_INVALID, /* 0x96 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_7 */ \ + Z_KEY_CODE_INVALID, /* 0x97 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_8 */ \ + Z_KEY_CODE_INVALID, /* 0x98 - Z_USB_KEY_CODE_KEYBOARD_LANGUAGE_9 */ \ + Z_KEY_CODE_INVALID, /* 0x99 - Z_USB_KEY_CODE_KEYBOARD_ALTERNATE_ERASE */ \ + Z_KEY_CODE_INVALID, /* 0x9A - Z_USB_KEY_CODE_KEYBOARD_SYS_REQ_ATTENTION */ \ + Z_KEY_CODE_INVALID, /* 0x9B - Z_USB_KEY_CODE_KEYBOARD_CANCEL */ \ + Z_KEY_CODE_INVALID, /* 0x9C - Z_USB_KEY_CODE_KEYBOARD_CLEAR */ \ + Z_KEY_CODE_INVALID, /* 0x9D - Z_USB_KEY_CODE_KEYBOARD_PRIOR */ \ + Z_KEY_CODE_INVALID, /* 0x9E - Z_USB_KEY_CODE_KEYBOARD_RETURN_2 */ \ + Z_KEY_CODE_INVALID, /* 0x9F - Z_USB_KEY_CODE_KEYBOARD_SEPARATOR */ \ + Z_KEY_CODE_INVALID, /* 0xA0 - Z_USB_KEY_CODE_KEYBOARD_OUT */ \ + Z_KEY_CODE_INVALID, /* 0xA1 - Z_USB_KEY_CODE_KEYBOARD_OPER */ \ + Z_KEY_CODE_INVALID, /* 0xA2 - Z_USB_KEY_CODE_KEYBOARD_CLEAR_AGAIN */ \ + Z_KEY_CODE_INVALID, /* 0xA3 - Z_USB_KEY_CODE_KEYBOARD_CR_SEL_PROPS */ \ + Z_KEY_CODE_INVALID, /* 0xA4 - Z_USB_KEY_CODE_KEYBOARD_EX_SEL */ \ + Z_KEY_CODE_INVALID, /* 0xA5 - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xA6 - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xA7 - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xA8 - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xA9 - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAA - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAB - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAC - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAD - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAE - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xAF - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xB0 - Z_USB_KEY_CODE_KEYPAD_00 */ \ + Z_KEY_CODE_INVALID, /* 0xB1 - Z_USB_KEY_CODE_KEYPAD_000 */ \ + Z_KEY_CODE_INVALID, /* 0xB2 - Z_USB_KEY_CODE_THOUSANDS_SEPARATOR */ \ + Z_KEY_CODE_INVALID, /* 0xB3 - Z_USB_KEY_CODE_DECIMAL_SEPARATOR */ \ + Z_KEY_CODE_INVALID, /* 0xB4 - Z_USB_KEY_CODE_CURRENCY_UNIT */ \ + Z_KEY_CODE_INVALID, /* 0xB5 - Z_USB_KEY_CODE_CURRENCY_SUBUNIT */ \ + Z_KEY_CODE_INVALID, /* 0xB6 - Z_USB_KEY_CODE_KEYPAD_LEFT_PARENTHESIS */ \ + Z_KEY_CODE_INVALID, /* 0xB7 - Z_USB_KEY_CODE_KEYPAD_RIGHT_PARENTHESIS */ \ + Z_KEY_CODE_INVALID, /* 0xB8 - Z_USB_KEY_CODE_KEYPAD_LEFT_CURLY_BRACKET */ \ + Z_KEY_CODE_INVALID, /* 0xB9 - Z_USB_KEY_CODE_KEYPAD_RIGHT_CURLY_BRACKET */ \ + Z_KEY_CODE_INVALID, /* 0xBA - Z_USB_KEY_CODE_KEYPAD_TAB */ \ + Z_KEY_CODE_INVALID, /* 0xBB - Z_USB_KEY_CODE_KEYPAD_BACKSPACE */ \ + Z_KEY_CODE_INVALID, /* 0xBC - Z_USB_KEY_CODE_KEYPAD_A */ \ + Z_KEY_CODE_INVALID, /* 0xBD - Z_USB_KEY_CODE_KEYPAD_B */ \ + Z_KEY_CODE_INVALID, /* 0xBE - Z_USB_KEY_CODE_KEYPAD_C */ \ + Z_KEY_CODE_INVALID, /* 0xBF - Z_USB_KEY_CODE_KEYPAD_D */ \ + Z_KEY_CODE_INVALID, /* 0xC0 - Z_USB_KEY_CODE_KEYPAD_E */ \ + Z_KEY_CODE_INVALID, /* 0xC1 - Z_USB_KEY_CODE_KEYPAD_F */ \ + Z_KEY_CODE_INVALID, /* 0xC2 - Z_USB_KEY_CODE_KEYPAD_XOR */ \ + Z_KEY_CODE_INVALID, /* 0xC3 - Z_USB_KEY_CODE_KEYPAD_CIRCUMFLEX_ACCENT */ \ + Z_KEY_CODE_INVALID, /* 0xC4 - Z_USB_KEY_CODE_KEYPAD_PERCENT_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0xC5 - Z_USB_KEY_CODE_KEYPAD_LESS_THAN_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0xC6 - Z_USB_KEY_CODE_KEYPAD_GREATER_THAN_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0xC7 - Z_USB_KEY_CODE_KEYPAD_AMPERSAND */ \ + Z_KEY_CODE_INVALID, /* 0xC8 - Z_USB_KEY_CODE_KEYPAD_DOUBLE_AMPERSAND */ \ + Z_KEY_CODE_INVALID, /* 0xC9 - Z_USB_KEY_CODE_KEYPAD_VERTICAL_LINE */ \ + Z_KEY_CODE_INVALID, /* 0xCA - Z_USB_KEY_CODE_KEYPAD_DOUBLE_VERTICAL_LINE */ \ + Z_KEY_CODE_INVALID, /* 0xCB - Z_USB_KEY_CODE_KEYPAD_COLON */ \ + Z_KEY_CODE_INVALID, /* 0xCC - Z_USB_KEY_CODE_KEYPAD_NUMBER_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0xCD - Z_USB_KEY_CODE_KEYPAD_SPACE */ \ + Z_KEY_CODE_INVALID, /* 0xCE - Z_USB_KEY_CODE_KEYPAD_COMMERCIAL_AT */ \ + Z_KEY_CODE_INVALID, /* 0xCF - Z_USB_KEY_CODE_KEYPAD_EXCLAMATION_MARK */ \ + Z_KEY_CODE_INVALID, /* 0xD0 - Z_USB_KEY_CODE_KEYPAD_MEMORY_STORE */ \ + Z_KEY_CODE_INVALID, /* 0xD1 - Z_USB_KEY_CODE_KEYPAD_MEMORY_RECALL */ \ + Z_KEY_CODE_INVALID, /* 0xD2 - Z_USB_KEY_CODE_KEYPAD_MEMORY_CLEAR */ \ + Z_KEY_CODE_INVALID, /* 0xD3 - Z_USB_KEY_CODE_KEYPAD_MEMORY_ADD */ \ + Z_KEY_CODE_INVALID, /* 0xD4 - Z_USB_KEY_CODE_KEYPAD_MEMORY_SUBTRACT */ \ + Z_KEY_CODE_INVALID, /* 0xD5 - Z_USB_KEY_CODE_KEYPAD_MEMORY_MULTIPLY */ \ + Z_KEY_CODE_INVALID, /* 0xD6 - Z_USB_KEY_CODE_KEYPAD_MEMORY_DIVIDE */ \ + Z_KEY_CODE_INVALID, /* 0xD7 - Z_USB_KEY_CODE_KEYPAD_PLUS_MINUS_SIGN */ \ + Z_KEY_CODE_INVALID, /* 0xD8 - Z_USB_KEY_CODE_KEYPAD_CLEAR */ \ + Z_KEY_CODE_INVALID, /* 0xD9 - Z_USB_KEY_CODE_KEYPAD_CLEAR_ENTRY */ \ + Z_KEY_CODE_INVALID, /* 0xDA - Z_USB_KEY_CODE_KEYPAD_BINARY */ \ + Z_KEY_CODE_INVALID, /* 0xDB - Z_USB_KEY_CODE_KEYPAD_OCTAL */ \ + Z_KEY_CODE_INVALID, /* 0xDC - Z_USB_KEY_CODE_KEYPAD_DECIMAL */ \ + Z_KEY_CODE_INVALID, /* 0xDD - Z_USB_KEY_CODE_KEYPAD_HEXADECIMAL */ \ + Z_KEY_CODE_INVALID, /* 0xDE - Reserved */ \ + Z_KEY_CODE_INVALID, /* 0xDF - Reserved */ \ + Z_KEY_CODE_LEFT_CONTROL, /* 0xE0 - Z_USB_KEY_CODE_KEYBOARD_LEFT_CONTROL */ \ + Z_KEY_CODE_LEFT_SHIFT, /* 0xE1 - Z_USB_KEY_CODE_KEYBOARD_LEFT_SHIFT */ \ + Z_KEY_CODE_LEFT_OPTION, /* 0xE2 - Z_USB_KEY_CODE_KEYBOARD_LEFT_ALT */ \ + Z_KEY_CODE_LEFT_COMMAND, /* 0xE3 - Z_USB_KEY_CODE_KEYBOARD_LEFT_GUI */ \ + Z_KEY_CODE_RIGHT_CONTROL, /* 0xE4 - Z_USB_KEY_CODE_KEYBOARD_RIGHT_CONTROL */ \ + Z_KEY_CODE_RIGHT_SHIFT, /* 0xE5 - Z_USB_KEY_CODE_KEYBOARD_RIGHT_SHIFT */ \ + Z_KEY_CODE_RIGHT_OPTION, /* 0xE6 - Z_USB_KEY_CODE_KEYBOARD_RIGHT_ALT */ \ + Z_KEY_CODE_RIGHT_COMMAND /* 0xE7 - Z_USB_KEY_CODE_KEYBOARD_RIGHT_GUI */ + +#endif /* Z_formats_keymap_USB_H */ diff --git a/projects/Zeta/API/Z/formats/keymap/Z.h b/projects/Zeta/API/Z/formats/keymap/Z.h new file mode 100644 index 0000000..d8fdb8e --- /dev/null +++ b/projects/Zeta/API/Z/formats/keymap/Z.h @@ -0,0 +1,142 @@ +/* Zeta API - Z/formats/keymap/Z.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_formats_keymap_Z_H +#define Z_formats_keymap_Z_H + +#define Z_KEY_CODE_UP 0 +#define Z_KEY_CODE_RIGHT 1 +#define Z_KEY_CODE_DOWN 2 +#define Z_KEY_CODE_LEFT 3 +#define Z_KEY_CODE_HOME 4 +#define Z_KEY_CODE_END 5 +#define Z_KEY_CODE_PAGE_UP 6 +#define Z_KEY_CODE_PAGE_DOWN 7 +#define Z_KEY_CODE_BACKSPACE 8 /* Like ASCII */ +#define Z_KEY_CODE_TAB 9 /* Like ASCII */ +#define Z_KEY_CODE_RETURN 10 /* Like ASCII */ +#define Z_KEY_CODE_F1 11 +#define Z_KEY_CODE_F2 12 +#define Z_KEY_CODE_F3 13 +#define Z_KEY_CODE_F4 14 +#define Z_KEY_CODE_F5 15 +#define Z_KEY_CODE_F6 16 +#define Z_KEY_CODE_F7 17 +#define Z_KEY_CODE_F8 18 +#define Z_KEY_CODE_F9 19 +#define Z_KEY_CODE_F10 20 +#define Z_KEY_CODE_F11 21 +#define Z_KEY_CODE_F12 22 +#define Z_KEY_CODE_PRINT_SCREEN 23 +#define Z_KEY_CODE_SCROLL_LOCK 24 +#define Z_KEY_CODE_PAUSE 25 +#define Z_KEY_CODE_CAPS_LOCK 26 +#define Z_KEY_CODE_ESCAPE 27 /* Like ASCII */ +#define Z_KEY_CODE_LEFT_SHIFT 28 +#define Z_KEY_CODE_LEFT_CONTROL 29 +#define Z_KEY_CODE_LEFT_COMMAND 30 +#define Z_KEY_CODE_LEFT_OPTION 31 +#define Z_KEY_CODE_SPACE 32 /* Like ASCII */ +#define Z_KEY_CODE_RIGHT_OPTION 33 +#define Z_KEY_CODE_RIGHT_COMMAND 34 +#define Z_KEY_CODE_APPLICATION 35 +#define Z_KEY_CODE_RIGHT_CONTROL 36 +#define Z_KEY_CODE_RIGHT_SHIFT 37 +#define Z_KEY_CODE_INSERT 38 +#define Z_KEY_CODE_ANSI_APOSTROPHE 39 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_SOLIDUS 40 +#define Z_KEY_CODE_ANSI_KEYPAD_HYPHEN_MINUS 41 +#define Z_KEY_CODE_ANSI_KEYPAD_ASTERISK 42 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_PLUS_SIGN 43 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_COMMA 44 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_HYPHEN_MINUS 45 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_FULL_STOP 46 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_SOLIDUS 47 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_0 48 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_1 49 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_2 50 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_3 51 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_4 52 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_5 53 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_6 54 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_7 55 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_8 56 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_9 57 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_ENTER 58 +#define Z_KEY_CODE_ANSI_SEMICOLON 59 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_DECIMAL_SEPARATOR 60 +#define Z_KEY_CODE_ANSI_EQUALS_SIGN 61 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_NUM_LOCK 62 +#define Z_KEY_CODE_ANSI_KEYPAD_0 63 +#define Z_KEY_CODE_ANSI_KEYPAD_1 64 +#define Z_KEY_CODE_ANSI_A 65 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_B 66 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_C 67 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_D 68 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_E 69 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_F 70 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_G 71 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_H 72 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_I 73 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_J 74 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_K 75 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_L 76 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_M 77 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_N 78 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_O 79 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_P 80 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_Q 81 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_R 82 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_S 83 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_T 84 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_U 85 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_V 86 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_W 87 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_X 88 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_Y 89 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_Z 90 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_LEFT_SQUARE_BRACKET 91 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_REVERSE_SOLIDUS 92 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_RIGHT_SQUARE_BRACKET 93 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_2 94 +#define Z_KEY_CODE_ANSI_KEYPAD_3 95 +#define Z_KEY_CODE_ANSI_GRAVE_ACCENT 96 /* Like ASCII */ +#define Z_KEY_CODE_ANSI_KEYPAD_4 97 +#define Z_KEY_CODE_ANSI_KEYPAD_5 98 +#define Z_KEY_CODE_ANSI_KEYPAD_6 99 +#define Z_KEY_CODE_ANSI_KEYPAD_7 100 +#define Z_KEY_CODE_ANSI_KEYPAD_8 101 +#define Z_KEY_CODE_ANSI_KEYPAD_9 102 +#define Z_KEY_CODE_APPLE_ANSI_KEYPAD_EQUALS_SIGN 103 /* Apple keyboards */ +#define Z_KEY_CODE_F13 104 +#define Z_KEY_CODE_F14 105 +#define Z_KEY_CODE_F15 106 +#define Z_KEY_CODE_F16 107 +#define Z_KEY_CODE_F17 108 +#define Z_KEY_CODE_F18 109 +#define Z_KEY_CODE_F19 110 +#define Z_KEY_CODE_F20 111 +#define Z_KEY_CODE_F21 112 +#define Z_KEY_CODE_F22 113 +#define Z_KEY_CODE_F23 114 +#define Z_KEY_CODE_F24 115 +#define Z_KEY_CODE_JIS_EISU 116 /* Japanese keyboards */ +#define Z_KEY_CODE_JIS_KANA 117 /* Japanese keyboards */ +#define Z_KEY_CODE_JIS_LOW_LINE 118 /* Japanese keyboards */ +#define Z_KEY_CODE_JIS_YEN_SIGN 119 /* Japanese keyboards */ +#define Z_KEY_CODE_JIS_KEYPAD_COMMA 120 /* Japanese keyboards */ +#define Z_KEY_CODE_ISO_SECTION 121 /* ISO keyboards */ +#define Z_KEY_CODE_VOLUME_UP 122 +#define Z_KEY_CODE_VOLUME_DOWN 123 +#define Z_KEY_CODE_MUTE 124 +#define Z_KEY_CODE_UNUSED_0 125 +#define Z_KEY_CODE_FUNCTION 126 +#define Z_KEY_CODE_DELETE 127 /* Similar to ASCII */ +#define Z_KEY_CODE_INVALID Z_KEY_CODE_UNUSED_0 + +#endif /* Z_formats_keymap_Z_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/+D.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/+D.h new file mode 100644 index 0000000..1dea599 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/+D.h @@ -0,0 +1,46 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/+D.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.PlusD | +| Author: Samir, Ribic | +| Extensions: .plusd | +| Endianness: Little? | +| Supports: | +| Used by: | +| | +| Reference: | +| | +'========================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_PlusD_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_PlusD_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 iy, ix, de_, bc_, hl_, af_, de, bc, hl; + zuint8 i_junk; + zuint8 i; + ZInt16 sp; +} Z_PACKED_STRUCTURE_END Z_PlusDCPU; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_PlusDCPU cpu; + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; +} Z_PACKED_STRUCTURE_END Z_PlusDv48K; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_PlusDCPU cpu; + Z_ZXSpectrumPlus128KBankSwitch bank_switch; + zuint8 ram[Z_ZX_SPECTRUM_PLUS_128K_SIZE_RAM]; +} Z_PACKED_STRUCTURE_END Z_PlusDv128K; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_PlusD_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ACH.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ACH.h new file mode 100644 index 0000000..00b9d1c --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ACH.h @@ -0,0 +1,54 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ACH.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _______________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ACH | +| Author: Witt, Carsten | +| Extensions: .ach, .archimedes | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: !Speccy (RISC OS) | +| | +| Reference: | +| http://rk.nvg.ntnu.no/sinclair/faq/fileform.html | +| http://www.zx-modules.de/fileformats/achformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'======================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ACH_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ACH_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 a; zuint8 zero_00[ 3]; + zuint8 f; zuint8 zero_01[ 3]; + zuint8 b; zuint8 zero_02[ 3]; + zuint8 c; zuint8 zero_03[ 3]; + zuint8 d; zuint8 zero_04[ 3]; + zuint8 e; zuint8 zero_05[ 3]; + zuint8 h; zuint8 zero_06[ 3]; + zuint8 l; zuint8 zero_07[ 3]; + ZInt16 pc; zuint8 zero_08[ 6]; + ZInt16 sp; zuint8 zero_09[106]; + zuint8 r; zuint8 zero_10[ 7]; + zuint8 border_color; zuint8 zero_11[ 7]; + zuint8 im; zuint8 zero_12[ 25]; + zuint8 i, iff2; zuint8 zero_13[ 44]; + zuint8 a_, f_; zuint8 zero_14[ 2]; + zuint8 b_, c_; zuint8 zero_15[ 2]; + zuint8 d_, e_, h_, l_; + ZInt16 ix; zuint8 zero_16[ 2]; + ZInt16 iy; zuint8 zero_17[ 2]; + zuint8 memory[Z_ZX_SPECTRUM_48K_SIZE_MEMORY]; +} Z_PACKED_STRUCTURE_END Z_ACH; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ACH_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/FRZ.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/FRZ.h new file mode 100644 index 0000000..4adeb8e --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/FRZ.h @@ -0,0 +1,68 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/FRZ.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.FRZ | +| Authors: Code Busters (Iwamoto, Max - alias Rst7) | +| Extensions: .frz | +| Endianness: Big | +| Supports: ZX Spectrum + 128K | +| Used by: CBSpeccy (AmigaOS) | +| | +| | +| Reference: | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +| Special thanks to Dmitriy Zhivilov and Ian Greenway, who | +| reverse-engineered and shared the description of this format. | +| | +'================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_FRZ_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_FRZ_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 zero_0; + + Z_ZXSpectrumPlus128KBankSwitch bank_switch; + + ZInt16 hl_, hl, de_, de, bc_, bc, af_, af; + zuint8 disk_and_t_states[7]; + zuint8 r; + ZInt16 pc, sp; + zuint8 i; + zuint8 reserved; /* must be FFh */ + zuint8 zero_1; + zuint8 im; + zuint8 zero_2[3]; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 3) ( + zuint8 unused_1 :5, + zuint8 iff1 :1, + zuint8 unused_0 :2 + )} fields; + } interrupt; + + ZInt16 iy, ix; + + zuint8 ram_bank_5[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_2[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_0[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_1[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_3[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_4[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_6[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_7[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; +} Z_PACKED_STRUCTURE_END Z_FRZ; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_FRZ_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/PRG.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/PRG.h new file mode 100644 index 0000000..a7c1304 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/PRG.h @@ -0,0 +1,59 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/PRG.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _______________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.PRG | +| Author: Phair, Kevin J. | +| Extensions: .prg | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: Spectrum Emulator, The (MS-DOS) | +| | +| | +| Reference: | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'======================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_PRG_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_PRG_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 file_type; /* 05h */ + zuint8 program_name[10]; + zuint16 file_sector_count; /* big endian */ + zuint8 file_track_index; + zuint8 file_sector_index; + zuint8 sector_allocation_bitmap[195]; + zuint8 zero_0[10]; + Z_PlusDCPU cpu; + zuint8 zero_1[14]; + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; +} Z_PACKED_STRUCTURE_END Z_PRG; + +typedef Z_PACKED_STRUCTURE_BEGIN { + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 3) ( + zuint8 unused_1 :5, + zuint8 iff1 :1, + zuint8 unused_0 :2 + )} fields; + } interrupt; + + zuint8 r; + ZInt16 af; + zuint16 pc; +} Z_PACKED_STRUCTURE_END Z_PRGStack; + +#define Z_PRG_FILE_TYPE_48K 0x05 + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_PRG_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SEM.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SEM.h new file mode 100644 index 0000000..b3b9397 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SEM.h @@ -0,0 +1,54 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SEM.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _______________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SEM | +| Author: Waschke, Bernd | +| Extensions: .sem | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: ZX Spectrum-Emulator / SpecEmu (MS-DOS) | +| | +| Reference: | +| http://www.zx-modules.de/fileformats/semformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'======================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SEM_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SEM_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 signature_size; /* 5 */ + zuint8 signature[5]; /* 'SPEC1' */ + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; + ZInt16 af, bc, de, hl, af_, bc_, de_, hl_, pc, sp, ix, iy; + zuint8 i, zero_0; + zuint8 r, zero_1; + zuint8 iff1, zero_2; + zuint8 iff2, zero_3; + zuint8 im, zero_4; +} Z_PACKED_STRUCTURE_END Z_SEMSnapshot; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 address; + zuint8 value; + zuint8 unused; +} Z_PACKED_STRUCTURE_END Z_SEMPoke; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_SEMSnapshot snapshot; + Z_SEMPoke poke; /* Optional */ + zuint16 speed_factor; /* Optional (only if poke included) */ +} Z_PACKED_STRUCTURE_END Z_SEM; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SEM_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SIT.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SIT.h new file mode 100644 index 0000000..4ae19f2 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SIT.h @@ -0,0 +1,40 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SIT.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ____________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SIT | +| Author: Rodríguez Salas, Pedro Manuel | +| Extensions: .sit | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: Sinclair (MS-DOS) | +| | +| | +| Reference: | +| http://www.zx-modules.de/fileformats/sitformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'===================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SIT_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SIT_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 bc, de, hl, af, ix, iy, sp, pc; + zuint8 r, i; + ZInt16 bc_, de_, hl_, af_; + zuint8 im; + zuint8 border_color; + zuint8 memory[Z_ZX_SPECTRUM_48K_SIZE_MEMORY]; +} Z_PACKED_STRUCTURE_END Z_SIT; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SIT_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SLT.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SLT.h new file mode 100644 index 0000000..e69de29 diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNA.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNA.h new file mode 100644 index 0000000..12ecd19 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNA.h @@ -0,0 +1,131 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SNA.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SNA | +| Extensions: .sna, .snap, .snapshot | +| Endianness: Little | +| | +| Reference: | +| http://rk.nvg.ntnu.no/sinclair/faq/fileform.html | +| http://www.worldofspectrum.org/faq/reference/formats.htm | +| http://www.zx-modules.de/fileformats/snaformat.html | +| MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +| This format is based on the format used by the Mirage Microdriver, | +| a backup device manufactured by Mirage Microcomputers Ltd. | +| Reference: http://www.worldofspectrum.org/infoseekid.cgi?id=1000266 | +| | +'=======================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SNA_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SNA_H + +#include +#include + +/* v48K + ______________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SNA[48K] | +| Author: Gulbrandsen, Arnt | +| Supports: ZX Spectrum 48K | +| Used by: JPP (MS-DOS) | +| | +| From comp.sys.sinclair Sinclair ZX Spectrum FAQ: | +| | +| This format is one of the most well-supported of all snapshot formats | +| (for the ZX Spectrum), but has a drawback: | +| | +| As the program counter is pushed onto the stack so that a RETN | +| instruction can restart the program, 2 bytes of memory are overwritten. | +| This will usually not matter; the game (or whatever) will have stack space | +| that can be used for this. However, if this space is all in use when the | +| snap is made, memory below the stack space will be corrupted. According to | +| Rui Ribeiro, the effects of this can sometimes be avoided by replacing the | +| corrupted bytes with zeros; e.g. take the PC from the, stack pointer, | +| replace that word with 0000h and then increment SP. This worked with | +| snapshots of Batman, Bounder and others which had been saved at critical | +| points. Theoretically, this problem could cause a complete crash on a real | +| Spectrum if the stack pointer happened to be at address 4000h; the push | +| would try and write to the ROM. | +| | +| When the registers have been loaded, a RETN command is required to start | +| the program. IFF2 is short for interrupt flip-flop 2, and for all | +| practical purposes is the interrupt-enabled flag. Set means enabled. | +| | +'=============================================================================*/ + +#define Z_SNA_V48K_PC_VALUE 0x72 + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 i; + ZInt16 hl_, de_, bc_, af_, hl, de, bc, iy, ix; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 unused_1 :5, + zuint8 iff2 :1, + zuint8 unused_0 :1, + zuint8 iff1 :1 + )} fields; + } interrupt; + + zuint8 r; + ZInt16 af, sp; + zuint8 im; + zuint8 border_color; +} Z_PACKED_STRUCTURE_END Z_SNA; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_SNA sna; + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; +} Z_PACKED_STRUCTURE_END Z_SNAv48K; + +/* v128K + ______________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SNA[128K] | +| Author: McGavin, Peter | +| Supports: ZX Spectrum + 128K | +| Used by: Spectrum (AmigaOS) | +| | +| From comp.sys.sinclair Sinclair ZX Spectrum FAQ: | +| | +| The 128K version of the SNA format is the same as above, with extensions | +| to include the extra memory banks of the 128K/+2 machines, and fixes the | +| problem with the PC being pushed onto the stack - now it is located in an | +| extra variable in the file (and is not pushed onto the stack at all). The | +| first 49179 bytes of the snapshot are otherwise exactly as described | +| above. | +| | +| The third RAM bank saved is always the one currently paged, even if this | +| is page 5 or 2 - in this case, the bank is actually included twice. The | +| remaining RAM banks are saved in ascending order - e.g. if RAM bank 4 is | +| paged in, the snapshot is made up of banks 5, 2 and 4 to start with, and | +| banks 0, 1, 3, 6 and 7 afterwards. If RAM bank 5 is paged in, the snapshot | +| is made up of banks 5, 2 and 5 again, followed by banks 0, 1, 3, 4, 6 and | +| 7. | +| | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_SNA sna; + zuint8 ram_bank_5[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_2[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + zuint8 ram_bank_n[Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; + ZInt16 pc; + + Z_ZXSpectrumPlus128KBankSwitch bank_switch; + + zuint8 tr_dos_rom_is_paged; /* boolean */ + zuint8 remaining_ram_banks[5][Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK]; +} Z_PACKED_STRUCTURE_END Z_SNAv128K; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SNA_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNP.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNP.h new file mode 100644 index 0000000..609b801 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNP.h @@ -0,0 +1,45 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SNP.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ___________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SNP | +| Authors: Garabik, Radovan | +| Salanci, Lubomir | +| Extensions: .snp | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: Nuclear ZX (MS-DOS) | +| | +| | +| Reference: | +| http://www.zx-modules.de/fileformats/snpformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'==================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SNP_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SNP_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; + ZInt16 af; + zuint8 border_color; + zuint8 zero; + ZInt16 bc, de, hl, pc, sp, ix, iy; + zuint8 not_iff2; /* Not used (must be 0?) */ + zuint8 iff1; + zuint8 im; + zuint8 r, i; + ZInt16 af_, bc_, de_, hl_; +} Z_PACKED_STRUCTURE_END Z_SNP; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SNP_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNX.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNX.h new file mode 100644 index 0000000..5b5c92c --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SNX.h @@ -0,0 +1,72 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SNX.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ______________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SNX | +| Author: Gandler, Christian | +| Extensions: .snx | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: ZX-Spectrum Emulator (aka Specci) (Atari ST) | +| | +| Reference: | +| http://cd.textfiles.com/crawlycrypt1/apps/misc/zx_sp207/specci.doc | +| http://www.zx-modules.de/fileformats/snxformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +'=====================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SNX_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SNX_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt32 signature; /* 'XSNA' */ + zuint16 header_size; /* 37, big endian */ + Z_SNA sna; + zuint8 emulate_interface_1; + zuint8 emulate_flash; + zuint8 emulate_vram_attributes; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 keyboard :1, + zuint8 emulate_ula :1, + zuint8 unused :4, + zuint8 joystick :2 + )} fields; + } settings_0; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 3) ( + zuint8 ear_mode :1, + zuint8 unused :6, + zuint8 emulate_r :1 + )} fields; + } settings_1; + + zuint8 int_hz; + zuint8 rs232_mode; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 2) ( + zuint8 hz :4, + zuint8 emulation_mode :1 + )} fields; + } sound; + + zuint8 border_emulation_mode; + zuint8 im2_pointer; +} Z_PACKED_STRUCTURE_END Z_SNX; + +#define Z_SNX_RS232_REDIRECTION_RS232 0 +#define Z_SNX_RS232_REDIRECTION_CENTRONICS 1 + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SNX_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SP.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SP.h new file mode 100644 index 0000000..f5c5c88 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/SP.h @@ -0,0 +1,85 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/SP.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ______________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.SP | +| Author: Gimeno Fortea, Pedro | +| Extensions: .sp | +| Endianness: Little | +| Supports: ZX Spectrum 48K | +| Used by: Spectrum / VGASpec (MS-DOS) | +| | +| | +| Reference: | +| http://www.zx-modules.de/fileformats/spformat.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +| From the sources of MESS: | +| | +| There are two kinds of .sp files: 'old' and 'new'. | +| | +| The old version is always 49184 bytes long and is created by a leaked copy | +| of the VGASpec emulator. | +| | +| Subsequently Pedro Gimeno (the author of VGASpec) renamed it to 'Spectrum' | +| (but it's colloquially known as the 'Spanish Spectrum emulator') and added | +| a header in the snapshot to break backward compatibility: the new format | +| supports both 16K and 48K images and it's 16422 or 49190 bytes long. | +| | +'=============================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_SP_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_SP_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 signature; /* ['S', 'P'] */ + zuint16 ram_size; /* 16384 or 49152 */ + zuint16 ram_load_address; /* 16384 */ +} Z_PACKED_STRUCTURE_END Z_SPHeader; + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 bc, de, hl, af, ix, iy, bc_, de_, hl_, af_; + zuint8 r, i; + ZInt16 sp, pc; + zuint16 zero_0; /* reserved for future use */ + zuint8 border_color; + zuint8 zero_1; /* reserved for future use */ + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 7) ( + zuint8 zero :2, /* reserved for internal use */ + zuint8 flash :1, /* boolean */ + zuint8 int_line :1, + zuint8 im0 :1, + zuint8 iff2 :1, /* Added in v0.99C, always 0 in previous versions. */ + zuint8 im :1, + zuint8 iff1 :1 + )} fields; + } status; + + zuint8 zero_2; /* reserved for future use */ + zuint8 ram[Z_ZX_SPECTRUM_16K_SIZE_RAM]; /* 16384 or 49152 */ +} Z_PACKED_STRUCTURE_END Z_SPSnapshot; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_SPHeader header; + Z_SPSnapshot snapshot; +} Z_PACKED_STRUCTURE_END Z_SP; + +#define Z_SP_IM(p) ((p)->bits.im0 ? 0 : ((p)->bits.im + 1)) + +/* 0 1000 + 1 0000 + 2 0010 +*/ + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_SP_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/Z80.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/Z80.h new file mode 100644 index 0000000..578dc4a --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/Z80.h @@ -0,0 +1,172 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/Z80.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _______________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.Z80 | +| Author: Lunter, Gerton | +| Extensions: .z80 | +| Endianness: Little | +| Supports: | +| Used by: Z80 (MS-DOS) | +| | +| Reference: | +| http://www.zx-modules.de/fileformats/z80format.html | +| | +'======================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_Z80_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_Z80_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 af; /* big endian */ + ZInt16 bc, hl, pc, sp; + zuint8 i, r; + + /* Additional info; if the byte= 255, it has to be + interpreted as being = 1 */ + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 5) ( + zuint8 unused :2, + zuint8 ram_is_compressed :1, + zuint8 emulate_basic_samrom :1, + zuint8 border_color :3, + zuint8 r7 :1 + )} fields; + } flags_0; + + ZInt16 de, bc_, de_, hl_; + ZInt16 af_; /* big endian */ + ZInt16 iy, ix; + zuint8 iff1, iff2; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 5) ( + zuint8 joystick_type :2, + zuint8 video_synchronization :2, + zuint8 double_int_frequency :1, + zuint8 emulate_issue_2 :1, + zuint8 im :2 + )} fields; + } flags_1; +} Z_PACKED_STRUCTURE_END Z_Z80v1Header; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 header_extension_size; + zuint16 pc; + zuint8 hardware; + zuint8 state_0; + zuint8 state_1; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 6) ( + zuint8 modify_hardware :1, + zuint8 emulate_fuller_box_ay :1, + zuint8 unused :3, + zuint8 emulate_psg :1, + zuint8 emulate_ldir :1, + zuint8 emulate_r :1 + )} fields; + } flags; + + zuint8 psg_register_index; + zuint8 psg_registers[16]; +} Z_PACKED_STRUCTURE_END Z_Z80v2HeaderExtension; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 t_states_low; + zuint8 t_states_high; + zuint8 zero; + zuint8 mgt_rom_is_paged; + zuint8 multiface_rom_is_paged; + zuint8 page_0l_memory_type; + zuint8 page_0h_memory_type; + zuint16 keyboard_mappings[5]; + zuint16 ascii_values[5]; + zuint8 mgt_type; + zuint8 disciple_inhibitor_button_state; + zuint8 disciple_inhibitor_flag; + zuint8 control; +} Z_PACKED_STRUCTURE_END Z_Z80v3HeaderExtension; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_Z80v1Header v1; +} Z_PACKED_STRUCTURE_END Z_Z80v1; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_Z80v1Header v1; + Z_Z80v2HeaderExtension v2; +} Z_PACKED_STRUCTURE_END Z_Z80v2; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_Z80v1Header v1; + Z_Z80v2HeaderExtension v2; + Z_Z80v3HeaderExtension v3; +} Z_PACKED_STRUCTURE_END Z_Z80v3; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 size; + zuint8 page; +} Z_PACKED_STRUCTURE_END Z_Z80DataBlockHeader; + +/* TODO: Homogeneizar los joysticks con los de TZX. */ +#define Z_Z80_JOYSTICK_TYPE_CURSOR_PROTEK_AGF 0 +#define Z_Z80_JOYSTICK_TYPE_KEMPSTON 1 +#define Z_Z80_JOYSTICK_TYPE_SINCLAIR_2_LEFT 2 +#define Z_Z80_JOYSTICK_TYPE_SINCLAIR_2_RIGHT 3 + +#define Z_Z80_VIDEO_SYNCHRONIZATION_NORMAL_1 0 +#define Z_Z80_VIDEO_SYNCHRONIZATION_HIGH 1 +#define Z_Z80_VIDEO_SYNCHRONIZATION_NORMAL_2 2 +#define Z_Z80_VIDEO_SYNCHRONIZATION_LOW 3 + +#define Z_Z80_HARDWARE_SAM_RAM 2 +#define Z_Z80_HARDWARE_PENTAGON_128 9 +#define Z_Z80_HARDWARE_SCORPION_ZS_256 10 +#define Z_Z80_HARDWARE_DIDAKTIK_KOMPAKT 11 +#define Z_Z80_HARDWARE_ZX_SPECTRUM_PLUS2 12 +#define Z_Z80_HARDWARE_ZX_SPECTRUM_PLUS2A 13 +#define Z_Z80_HARDWARE_TIMEX_COMPUTER_2048 14 +#define Z_Z80_HARDWARE_TIMEX_COMPUTER_2068 15 +#define Z_Z80_HARDWARE_TIMEX_SINCLAIR_2068 128 + +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_48K 0 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_48K_AND_IF1 1 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_128K_AND_IF1 5 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_128K_AND_MGT 6 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_PLUS3 7 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_PLUS3_ 8 + +#define Z_Z80_HARDWARE_B_ZX_SPECTRUM_16K 0 +#define Z_Z80_HARDWARE_B_ZX_SPECTRUM_16K_AND_IF1 1 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_PLUS2_AND_IF1 5 +#define Z_Z80_HARDWARE_A_ZX_SPECTRUM_PLUS2_AND_MGT 6 +#define Z_Z80_HARDWARE_B_ZX_SPECTRUM_PLUS2A 7 +#define Z_Z80_HARDWARE_B_ZX_SPECTRUM_PLUS2A_ 8 + +#define Z_Z80_V2_HARDWARE_A_ZX_SPECTRUM_128K 3 +#define Z_Z80_V2_HARDWARE_A_ZX_SPECTRUM_128K_AND_IF1 4 + +#define Z_Z80_V2_HARDWARE_B_ZX_SPECTRUM_PLUS2 3 +#define Z_Z80_V2_HARDWARE_B_ZX_SPECTRUM_PLUS2_AND_IF1 4 + +#define Z_Z80_V3_HARDWARE_A_ZX_SPECTRUM_48K_AND_MGT 3 +#define Z_Z80_V3_HARDWARE_A_ZX_SPECTRUM_128K 4 + +#define Z_Z80_V3_HARDWARE_B_ZX_SPECTRUM_PLUS2_AND_MGT 3 +#define Z_Z80_V3_HARDWARE_B_ZX_SPECTRUM_PLUS2 4 + +/* EDEDxxyy... 00EDED00 */ +#define Z_Z80_MINIMUM_SIZE (sizeof(Z_Z80v1Header) + ((1024 * 48) / 256) + 4) + +#define Z_Z80_DATA_BLOCK_MINIMUM_SIZE (sizeof(Z_Z80DataBlockHeader) + (1024 * 16) / 256) + + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_Z80_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZLS.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZLS.h new file mode 100644 index 0000000..d8c6138 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZLS.h @@ -0,0 +1,44 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ZLS.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Information contributed by Troels Norgaard. +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ___________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ZLS | +| Author: Zhivilov, Dmitriy Vladimirovich | +| Extensions: .zls | +| Endianness: Big | +| Supports: | +| Used by: ZX-Live | +| | +'==================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ZLS_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ZLS_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt64 signature; /* 'ZX-Live!' */ + ZInt16 af, bc, de, hl, ix, iy, af_, bc_, de_, hl_; + zuint8 i, r; + ZInt16 sp, pc; + + union { zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 unused :6, + zuint8 iff2 :1, + zuint8 iff1 :1, + zuint8 im :2 + )} fields; + } interrupt; + + zuint8 halt_line; +} Z_PACKED_STRUCTURE_END Z_ZLS; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ZLS_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX-State.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX-State.h new file mode 100644 index 0000000..fe6829d --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX-State.h @@ -0,0 +1,683 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX-State.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _______________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ZXState | +| Author: Needle, Jonathan | +| Extensions: .szx | +| Endianness: Little | +| Supports: | +| Used by: Spectaculator | +| | +| Reference: | +| https://www.spectaculator.com/docs/zx-state/intro.shtml | +| https://www.spectaculator.com/docs/svn/zx-state/intro.shtml | +| https://sinclair.wiki.zxnet.co.uk/wiki/ZX-State_format | +| | +'==============================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_State_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_State_H + +#include +#include + +#define Z_ZX_STATE_BLOCK_ID_ZX_SPECTRUM_PLUS3 Z_UINT32_STRING('+','3', 0 , 0 ) +#define Z_ZX_STATE_BLOCK_ID_MOUSE Z_UINT32_STRING('A','M','X','M') +#define Z_ZX_STATE_BLOCK_ID_ZXATASP_RAM Z_UINT32_STRING('A','T','R','P') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_AY Z_UINT32_STRING('A','Y', 0 , 0 ) /* updated in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_BETA_128_DISK_INTERFACE Z_UINT32_STRING('B','1','2','8') /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_BETA_128_DISK_INTERFACE_DISK Z_UINT32_STRING('B','D','S','K') /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_ZXCF_RAM Z_UINT32_STRING('C','F','R','P') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_COVOX Z_UINT32_STRING('C','O','V','X') /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_CREATOR Z_UINT32_STRING('C','R','T','R') /* added in v1.1 */ +#define Z_ZX_STATE_BLOCK_ID_DOCK Z_UINT32_STRING('D','O','C','K') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_SPECDRUM Z_UINT32_STRING('D','R','U','M') +#define Z_ZX_STATE_BLOCK_ID_DISK Z_UINT32_STRING('D','S','K', 0 ) +#define Z_ZX_STATE_BLOCK_ID_GENERAL_SOUND Z_UINT32_STRING('G','S', 0 , 0 ) /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_GENERAL_SOUND_RAM_PAGE Z_UINT32_STRING('G','S','R','P') /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_ZX_INTERFACE_1 Z_UINT32_STRING('I','F','1', 0 ) +#define Z_ZX_STATE_BLOCK_ID_ZX_INTERFACE_2_ROM Z_UINT32_STRING('I','F','2','R') +#define Z_ZX_STATE_BLOCK_ID_JOYSTICK Z_UINT32_STRING('J','O','Y', 0 ) /* added in v1.1 */ +#define Z_ZX_STATE_BLOCK_ID_KEYBOARD Z_UINT32_STRING('K','E','Y','B') +#define Z_ZX_STATE_BLOCK_ID_LEC_MEMORY_EXTENSION_RAM_PAGE Z_UINT32_STRING('L','C','R','P') /* added in v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_LEC_MEMORY_EXTENSION Z_UINT32_STRING('L','E','C', 0 ) /* added in v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_ZX_MICRODRIVE_TAPE Z_UINT32_STRING('M','D','R','V') +#define Z_ZX_STATE_BLOCK_ID_MULTIFACE Z_UINT32_STRING('M','F','C','E') +#define Z_ZX_STATE_BLOCK_ID_OPUS_DISCOVERY_1_DISK Z_UINT32_STRING('O','D','S','K') /* added in v1.4 */ +#define Z_ZX_STATE_BLOCK_ID_OPUS_DISCOVERY_1 Z_UINT32_STRING('O','P','U','S') /* added in v1.4 */ +#define Z_ZX_STATE_BLOCK_ID_PLUSD_DISK Z_UINT32_STRING('P','D','S','K') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_PLUSD Z_UINT32_STRING('P','L','S','D') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_RAM_PAGE Z_UINT32_STRING('R','A','M','P') +#define Z_ZX_STATE_BLOCK_ID_ROM Z_UINT32_STRING('R','O','M', 0 ) +#define Z_ZX_STATE_BLOCK_ID_TIMEX Z_UINT32_STRING('S','C','L','D') /* added in v1.2 */ +#define Z_ZX_STATE_BLOCK_ID_SIMPLE_8BIT_INTERFACE Z_UINT32_STRING('S','I','D','E') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_SPECTRANET_FLASH_PAGE Z_UINT32_STRING('S','N','E','F') /* added in v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_SPECTRANET_RAM_PAGE Z_UINT32_STRING('S','N','E','R') /* added in v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_SPECTRANET Z_UINT32_STRING('S','N','E','T') /* added in v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_ZX_SPECTRUM Z_UINT32_STRING('S','P','C','R') /* updated in v1.1 and v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_TAPE Z_UINT32_STRING('T','A','P','E') +#define Z_ZX_STATE_BLOCK_ID_CURRAH_MICROSPEECH Z_UINT32_STRING('U','S','P','E') +#define Z_ZX_STATE_BLOCK_ID_Z80 Z_UINT32_STRING('Z','8','0','R') /* updated in v1.1, v1.4 and v1.5 */ +#define Z_ZX_STATE_BLOCK_ID_ZXATASP Z_UINT32_STRING('Z','X','A','T') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_ZXCF Z_UINT32_STRING('Z','X','C','F') /* added in v1.3 */ +#define Z_ZX_STATE_BLOCK_ID_ZX_PRINTER Z_UINT32_STRING('Z','X','P','R') + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 signature; + zuint8 version_major; + zuint8 version_minor; + zuint8 machine_id; + zuint8 flags; +} Z_PACKED_STRUCTURE_END Z_ZXStateHeader; + +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_16K 0 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_48K 1 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_PLUS_128K 2 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_PLUS2 3 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_PLUS2A 4 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_PLUS3 5 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_PLUS3E 6 +#define Z_ZX_STATE_MACHINE_ID_PENTAGON_128 7 +#define Z_ZX_STATE_MACHINE_ID_TIMEX_COMPUTER_2048 8 +#define Z_ZX_STATE_MACHINE_ID_TIMEX_COMPUTER_2068 9 +#define Z_ZX_STATE_MACHINE_ID_SCORPION 10 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_SE 11 +#define Z_ZX_STATE_MACHINE_ID_TIMEX_SINCLAIR_2068 12 +#define Z_ZX_STATE_MACHINE_ID_PENTAGON_512 13 +#define Z_ZX_STATE_MACHINE_ID_PENTAGON_1024 14 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_48K_NTSC 15 +#define Z_ZX_STATE_MACHINE_ID_ZX_SPECTRUM_128KE 16 + +#define ZX_STATE_FLAG_LATE_TIMINGS 1 + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 id; + zuint32 body_size; +} Z_PACKED_STRUCTURE_END Z_ZXStateBlockHeader; + +/* MARK: - ID {'+', '3', 0, 0} - ZX Spectrum +3 */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 drive_count; + zuint8 motor_is_on; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXSpectrumPlus3; + +/* MARK: - ID {'A', 'M', 'X', 'M'} - Mouse */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 type; + zuint8 ctrl_a_registers[3]; + zuint8 ctrl_b_registers[3]; +} Z_PACKED_STRUCTURE_END Z_ZXStateMouse; + +#define Z_ZX_STATE_MOUSE_TYPE_NONE 0 +#define Z_ZX_STATE_MOUSE_TYPE_AMX 1 +#define Z_ZX_STATE_MOUSE_TYPE_KEMPSTON 2 + +/* MARK: - ID {'A', 'T', 'R', 'P'} - ZXATASP RAM (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 page_index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXATASPRAM; + +#define Z_ZX_STATE_ZXATASP_RAM_FLAG_COMPRESSED 1 + +/* MARK: - ID {'A', 'Y', 0, 0} - AY chip */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 flags; + zuint8 current_register; + zuint8 registers[16]; +} Z_PACKED_STRUCTURE_END Z_ZXStateAY; + +#define Z_ZX_STATE_AY_FLAG_FULLER_BOX 1 +#define Z_ZX_STATE_AY_FLAG_128K 2 + +/* MARK: - ID {'B', '1', '2', '8'} - Beta 128 Disk Interface (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 drive_count; + zuint8 system_register; + zuint8 track_register; + zuint8 sector_register; + zuint8 data_register; + zuint8 satus_register; + zuint8 rom_data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateBeta128DiskInterface; + +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_CONNECTED 1 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_CUSTOM_ROM 2 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_PAGED 4 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_AUTOBOOT 8 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_SEEK_LOWER 16 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_FLAG_COMPRESSED 32 + +/* MARK: - ID {'B', 'D', 'S', 'K'} - Beta Disk (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 drive_index; + zuint8 cylinder; + zuint8 format; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateBeta128DiskInterfaceDisk; + +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_EMBEDDED 1 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_WRITE_PROTECT 4 + +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FORMAT_TRD 0 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FORMAT_SCL 1 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FORMAT_FDI 2 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FORMAT_UDI 3 + +/* MARK: - ID {'C', 'F', 'R', 'P'} - ZXCF RAM (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 page_index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXCFRAM; + +#define Z_ZX_STATE_ZXCF_RAM_FLAG_COMPRESSED 1 + +/* MARK: - ID {'C', 'O', 'V', 'X'} - Covox (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 volume; + zuint8 reserved[3]; +} Z_PACKED_STRUCTURE_END Z_ZXStateCovox; + +/* MARK: - ID {'C', 'R', 'T', 'R'} - Beta Disk (added in v1.1) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + char name[32]; + zuint16 major_version; + zuint16 minor_version; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateCreator; + +/* MARK: - ID {'D', 'O', 'C', 'K'} - Dock (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 page_index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateDock; + +#define Z_ZX_STATE_DOCK_FLAG_COMPRESSED 1 +#define Z_ZX_STATE_DOCK_FLAG_RAM 2 +#define Z_ZX_STATE_DOCK_FLAG_EX_ROM_DOCK 3 /* TODO: Rename this */ + +/* MARK: - ID {'D', 'R', 'U', 'M'} - SpecDrum */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 volume; +} Z_PACKED_STRUCTURE_END Z_ZXStateSpecDrum; + +/* MARK: - ID {'D', 'S', 'K', 0} - Disk */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 drive_index; + zuint32 uncompressed_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateDisk; + +#define Z_ZX_STATE_DISK_FLAG_COMPRESSED 1 +#define Z_ZX_STATE_DISK_FLAG_EMBEDDED 2 +#define Z_ZX_STATE_DISK_FLAG_SIDE_B 4 + +/* MARK: - ID {'G', 'S', 0, 0'} - General Sound (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 model; + zuint8 uppper_page_index; + zuint8 volume_level[4]; + zuint8 output_level[4]; + zuint8 flags; + ZInt16 af, bc, de, hl; + ZInt16 af_, bc_, de_, hl_; + ZInt16 ix, iy, sp, pc; + zuint8 i; + zuint8 r; + zuint8 iff1, iff2; + zuint8 im; + zuint32 cycles_start; + zuint8 hold_int_cycles; + zuint8 memptrl; + zuint8 rom[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateGeneralSound; + +#define Z_ZX_STATE_GENERAL_SOUND_FLAG_EI_LAST 1 +#define Z_ZX_STATE_GENERAL_SOUND_FLAG_HALTED 2 +#define Z_ZX_STATE_GENERAL_SOUND_FLAG_GSF_CUSTOMROM 64 +#define Z_ZX_STATE_GENERAL_SOUND_FLAG_GSF_COMPRESSED 128 + +#define Z_ZX_STATE_GENERAL_SOUND_MODEL_128 0 +#define Z_ZX_STATE_GENERAL_SOUND_MODEL_512 1 + +/* MARK: - ID {'G', 'S', 'R', 'P'} - General Sound RAM Page (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateGeneralSoundRAMPage; + +#define Z_ZXS_TATE_GENERAL_SOUND_RAM_PAGE_FLAG_COMPRESSED 1 + +/* MARK: - ID {'I', 'F', '1', 0} - ZX Interface 1 */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 microdrive_count; + zuint8 reserved_1[3]; + zuint32 reserved_2[8]; + zuint16 rom_size; + zuint8 rom[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXInterface1; + +#define Z_ZX_STATE_ZX_INTERFACE_1_FLAG_ENABLED 1 +#define Z_ZX_STATE_ZX_INTERFACE_1_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_ZX_INTERFACE_1_FLAG_PAGED 4 + +/* MARK: - ID {'I', 'F', '2', 'R'} - ZX Interface 2 ROM */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 rom_size; + zuint8 rom[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXInterface2ROM; + +/* MARK: - ID {'J', 'O', 'Y', 0} - Joystick (added in v1.1) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 type_player_1; + zuint8 type_player_2; +} Z_PACKED_STRUCTURE_END Z_ZXStateJoystick; + +#define Z_ZX_STATE_JOYSTICK_FLAG_ALWAYS_PORT_31 1 /* Deprecated */ + +#define Z_ZX_STATE_JOYSTICK_TYPE_KEMPSTON 0 +#define Z_ZX_STATE_JOYSTICK_TYPE_FULLER 1 +#define Z_ZX_STATE_JOYSTICK_TYPE_CURSOR 2 +#define Z_ZX_STATE_JOYSTICK_TYPE_SINCLAIR_1 3 +#define Z_ZX_STATE_JOYSTICK_TYPE_SINCLAIR_2 4 +#define Z_ZX_STATE_JOYSTICK_TYPE_COMCOM 5 +#define Z_ZX_STATE_JOYSTICK_TYPE_TIMEX1 6 +#define Z_ZX_STATE_JOYSTICK_TYPE_TIMEX2 7 +#define Z_ZX_STATE_JOYSTICK_TYPE_DISABLED 8 + +/* MARK: - ID {'K', 'E', 'Y', 'B'} - Keyboard */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 joystick; /* added in v1.1 */ +} Z_PACKED_STRUCTURE_END Z_ZXStateKeyboard; + +/* Keyboard state */ +#define Z_ZX_STATE_KEYBOARD_FLAG_ISSUE_2 1 + +/* Supported joystick types */ +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_KEMPSTON 0 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_FULLER 1 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_CURSOR 2 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_SINCLAIR1 3 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_SINCLAIR2 4 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_SPECTRUMPLUS 5 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_TIMEX1 6 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_TIMEX2 7 +#define Z_ZX_STATE_KEYBOARD_JOYSTICK_NONE 8 + +/* MARK: - ID {'L', 'C', 'R','P'} - LEC Memory Extension RAM Page (added in v1.5) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateLECMemoryExtensionRAMPage; + +#define Z_ZX_STATE_LEC_MEMORY_EXTENSION_RAM_PAGE_FLAG_COMPRESSED 1 + +/* MARK: - ID {'L', 'E', 'C', 0} - LEC Memory Extension (added in v1.5) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 page_index; + zuint8 ram_page_count; +} Z_PACKED_STRUCTURE_END Z_ZXStateLECMemoryExtension; + +#define Z_ZX_STATE_LEC_MEMORY_EXTENSION_FLAG_PAGED 1 + +/* MARK: - ID {'M', 'D', 'R', 'V'} - ZX Microdrive Tape */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 drive_index; + zuint8 drive_is_running; + zuint16 drive_position; + zuint16 preamble; + zuint32 uncompressed_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXMicrodriveTape; + +#define Z_ZX_STATE_ZX_MICRODRIVE_TAPE_FLAG_COMPRESSED 1 +#define Z_ZX_STATE_ZX_MICRODRIVE_TAPE_FLAG_EMBEDDED 2 + +/* MARK: - ID {'M', 'F', 'C', 'E'} - Multiface */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 model_48k; + zuint8 flags; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateMultiface; + +#define Z_ZX_STATE_MULTIFACE_FLAG_PAGEDIN 0x01 +#define Z_ZX_STATE_MULTIFACE_FLAG_COMPRESSED 0x02 +#define Z_ZX_STATE_MULTIFACE_FLAG_SOFTWARE_LOCKOUT 0x04 +#define Z_ZX_STATE_MULTIFACE_FLAG_RED_BUTTON_DISABLED 0x08 +#define Z_ZX_STATE_MULTIFACE_FLAG_DISABLED 0x10 +#define Z_ZX_STATE_MULTIFACE_FLAG_16K_RAM_MODE 0x20 + +#define Z_ZX_STATE_MULTIFACE_MODEL_MULTIFACE_ONE 0 +#define Z_ZX_STATE_MULTIFACE_MODEL_MULTIFACE_128 1 + +/* MARK: - ID {'O', 'D', 'S', 'K'} - Opus Discovery 1 Disk (added in v1.4) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 drive_index; + zuint8 cylinder; + zuint8 type; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateOpusDiscovery1Disk; + +#define Z_ZX_STATE_OPUS_DISCOVERY_1_DISK_TYPE_OPD 0 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_DISK_TYPE_OPU 1 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_DISK_TYPE_FLOPPY_0 2 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_DISK_TYPE_FLOPPY_1 3 + +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_EMBEDDED 1 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_BETA_128_DISK_INTERFACE_DISK_FLAG_WRITEPROTECT 4 + +/* MARK: - ID {'O', 'P', 'U', 'S'} - Opus Discovery 1 (added in v1.4) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint32 ram_size; + zuint32 rom_size; + zuint8 control_register_a; + zuint8 peripheral_register_a; + zuint8 data_direction_register_a; + zuint8 control_register_b; + zuint8 peripheral_register_b; + zuint8 data_direction_register_b; + zuint8 drive_count; + zuint8 track_register; + zuint8 sector_register; + zuint8 data_register; + zuint8 status_register; + zuint8 ram[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateOpusDiscovery1; + +#define Z_ZX_STATE_OPUS_DISCOVERY_1_FLAG_PAGED 1 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_FLAG_SEEK_LOWER 4 +#define Z_ZX_STATE_OPUS_DISCOVERY_1_FLAG_CUSTOMROM 8 + +/* MARK: - ID {'P', 'D', 'S', 'K'} - +D Disk (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 drive_index; + zuint8 cylinder; + zuint8 type; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStatePlusDDisk; + +#define Z_ZX_STATE_PLUSD_DISK_TYPE_MGT 0 +#define Z_ZX_STATE_PLUSD_DISK_TYPE_IMG 1 +#define Z_ZX_STATE_PLUSD_DISK_TYPE_FLOPPY_0 2 +#define Z_ZX_STATE_PLUSD_DISK_TYPE_FLOPPY_1 3 + +#define Z_ZX_STATE_PLUSD_DISK_FLAG_EMBEDDED 1 +#define Z_ZX_STATE_PLUSD_DISK_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_PLUSD_DISK_FLAG_WRITEP_ROTECT 4 + +/* MARK: - ID {'P', 'L', 'S', 'D'} - +D (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint32 ram_size; + zuint32 rom_size; + zuint8 rom_type; + zuint8 control_register; + zuint8 drive_count; + zuint8 track_register; + zuint8 sector_register; + zuint8 data_register; + zuint8 status_register; + zuint8 ram[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStatePlusD; + +#define Z_ZX_STATE_PLUSD_FLAG_PAGED 1 +#define Z_ZX_STATE_PLUSD_FLAG_COMPRESSED 2 +#define Z_ZX_STATE_PLUSD_FLAG_SEEK_LOWER 4 + +#define Z_ZX_STATE_PLUSD_ROM_TYPE_GDOS 0 +#define Z_ZX_STATE_PLUSD_ROM_TYPE_UNIDOS 1 +#define Z_ZX_STATE_PLUSD_ROM_TYPE_CUSTOM 2 + +/* MARK: - ID {'R', 'A', 'M', 'P'} - RAM Page */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 index; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateRAMPage; + +#define Z_ZX_STATE_RAM_PAGE_FLAG_COMPRESSED 1 + +/* MARK: - ID {'R', 'O', 'M', 0} - ROM */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint32 uncompressed_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END ZXSTROM; + +#define Z_ZX_STATE_ROM_FLAG_COMPRESSED 1 + +/* MARK: - ID {'S', 'C', 'L', 'D'} - Timex (added in v1.2) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 port_f4; + zuint8 port_ff; +} Z_PACKED_STRUCTURE_END Z_ZXStateTimex; + +/* MARK: - ID {'S', 'I', 'D', 'E'} - Simple 8-bit Interface (added in v1.3) */ + +/* https://worldofspectrum.org/zxplus3e/interface.html#simple */ + +/*typedef Z_PACKED_STRUCTURE_BEGIN { +} Z_PACKED_STRUCTURE_END Z_ZXStateSimple8BitInterface;*/ + +/* MARK: - ID {'S','N','E','F'} - Spectranet Flash Page (added in v1.5) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 flags; + zuint32 unused; + zuint32 data_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateSpectranetFlashPage; + +#define Z_ZX_STATE_SPECTRANET_FLASH_PAGE_FLAG_COMPRESSED 1 + +/* MARK: - ID {'S','N','E','R'} - Spectranet RAM Page (added in v1.5) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 flags; + zuint32 unused; + zuint32 data_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateSpectranetRAMPage; + +#define Z_ZX_STATE_SPECTRANET_RAM_PAGE_FLAG_COMPRESSED 1 + +/* MARK: - ID {'S', 'N', 'E', 'T'} - Spectranet (added in v1.5) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 flags; + zuint8 page_a; + zuint8 page_b; + zuint16 trap; + zuint8 registers[0x30]; +} Z_PACKED_STRUCTURE_END Z_ZXStateSpectranet; + +#define Z_ZX_STATE_SPECTRANET_FLAG_PAGED 0x01 +#define Z_ZX_STATE_SPECTRANET_FLAG_PAGED_VIA_IO 0x02 +#define Z_ZX_STATE_SPECTRANET_FLAG_PROGRAMMABLE_TRAP_ACTIVE 0x04 +#define Z_ZX_STATE_SPECTRANET_FLAG_PROGRAMMABLE_TRAP_MSB 0x08 +#define Z_ZX_STATE_SPECTRANET_FLAG_ALL_DISABLED 0x10 +#define Z_ZX_STATE_SPECTRANET_FLAG_RST8_DISABLED 0x20 +#define Z_ZX_STATE_SPECTRANET_FLAG_DENY_DOWNSTREAM_A15 0x40 +#define Z_ZX_STATE_SPECTRANET_FLAG_NMI_FLIPFLOP 0x80 + +/* MARK: - ID {'S', 'P', 'C', 'R'} - ZX Spectrum */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 border_color; + zuint8 port_7ffd; + zuint8 port_1ffd_eff7; /* EFF7h added in v1.3 */ + zuint8 port_fe; /* added in v1.1 */ + zuint8 reserved[4]; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXSpectrum; + +/* MARK: - ID {'T', 'A', 'P', 'E'} - Tape */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 block_index; + zuint16 flags; + zuint32 uncompressed_size; + zuint32 compressed_size; + char file_extension[16]; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXStateTape; + +#define Z_ZX_STATE_TAPE_FLAG_EMBEDDED 1 +#define Z_ZX_STATE_TAPE_FLAG_COMPRESSED 2 + +/* MARK: - ID {'U', 'S', 'P', 'E'} - Currah μSpeech */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 rom_is_paged_in; +} Z_PACKED_STRUCTURE_END Z_ZXStateCurrahMicroSpeech; + +/* MARK: - ID {'Z', '8', '0', 'R'} - Z80 */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 af, bc, de, hl, af_, bc_, de_, hl_, ix, iy, sp, pc; + zuint8 i, r; + zuint8 iff1, iff2; + zuint8 im; + zuint32 frame_cycles; + zuint8 hold_int_cycles; + zuint8 flags; /* added in v1.1 (size unchanged) */ + ZInt16 memptr; /* added in v1.4 (size unchanged) */ +} Z_PACKED_STRUCTURE_END Z_ZXStateZ80; + +#define Z_ZX_STATE_Z80_FLAG_EI_LAST 1 +#define Z_ZX_STATE_Z80_FLAG_HALTED 2 +#define Z_ZX_STATE_Z80_FLAG_F_SET 4 /* added in v1.5 */ + +/* MARK: - ID {'Z', 'X', 'A', 'T'} - ZXATASP (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 port_a; + zuint8 port_b; + zuint8 port_c; + zuint8 control_port; + zuint8 ram_page_count; + zuint8 active_page; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXATASP; + +#define Z_ZX_STATE_ZXATASP_FLAG_UPLOAD_JUMPER 1 +#define Z_ZX_STATE_ZXATASP_FLAG_WRITE_PROTECT 2 + +/* MARK: - ID {'Z', 'X', 'C', 'F'} - ZXCF (added in v1.3) */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; + zuint8 memory_control_register; + zuint8 ram_page_count; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXCF; + +#define Z_ZX_STATE_ZXCF_FLAG_UPLOAD_JUMPER 1 + +/* MARK: - ID {'Z', 'X', 'P', 'R'} - ZX Printer */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 flags; +} Z_PACKED_STRUCTURE_END Z_ZXStateZXPrinter; + +#define Z_ZX_STATE_ZX_PRINTER_FLAG_ENABLED 1 + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_ZXStateBlockHeader header; + + union { Z_ZXStateAY ay; + Z_ZXStateBeta128DiskInterface beta_128_disk_interface; + Z_ZXStateBeta128DiskInterfaceDisk beta_128_disk_interface_disk; + Z_ZXStateCovox covox; + Z_ZXStateCreator creator; + Z_ZXStateCurrahMicroSpeech currah_microspeech; + Z_ZXStateDisk disk; + Z_ZXStateDock dock; + Z_ZXStateGeneralSound general_sound; + Z_ZXStateGeneralSoundRAMPage general_sound_ram_page; + Z_ZXStateJoystick joystick; + Z_ZXStateKeyboard keyboard; + Z_ZXStateLECMemoryExtension lec_memory_extension; + Z_ZXStateLECMemoryExtensionRAMPage lec_memory_extension_page; + Z_ZXStateMouse mouse; + Z_ZXStateMultiface multiface; + Z_ZXStateOpusDiscovery1 opus_discovery_1; + Z_ZXStateOpusDiscovery1Disk opus_discovery_1_disk; + Z_ZXStatePlusD plusd; + Z_ZXStatePlusDDisk plusd_disk; + Z_ZXStateRAMPage ram_page; + /*Z_ZXStateSimple8BitInterface simple_8bit_interface;*/ + Z_ZXStateSpecDrum specdrum; + Z_ZXStateSpectranet spectranet; + Z_ZXStateSpectranetFlashPage spectranet_flash_page; + Z_ZXStateSpectranetRAMPage spectranet_ram_page; + Z_ZXStateTape zx_tape; + Z_ZXStateTimex timex; + Z_ZXStateZ80 z80; + Z_ZXStateZXATASP zxatasp; + Z_ZXStateZXATASPRAM zxatasp_ram; + Z_ZXStateZXCF zxcf; + Z_ZXStateZXCFRAM zxcf_ram; + Z_ZXStateZXInterface1 zx_interface_1; + Z_ZXStateZXInterface2ROM zx_interface_2_rom; + Z_ZXStateZXMicrodriveTape zx_microdrive_tape; + Z_ZXStateZXPrinter zx_printer; + Z_ZXStateZXSpectrum zx_spectrum; + Z_ZXStateZXSpectrumPlus3 zx_spectrum_plus3; + } body; +} Z_PACKED_STRUCTURE_END Z_ZXStateBlock; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_State_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX.h new file mode 100644 index 0000000..ad9fecb --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX.h @@ -0,0 +1,70 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Information contributed by Troels Norgaard. +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + _________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ZX | +| Author: Noerdergard, Troels | +| Extensions: .zx | +| Endianness: Big | +| Supports: ZX Spectrum 48K | +| Used by: KGB Spectrum Emulator (AmigaOS) | +| | +| | +| Reference: | +| http://rk.nvg.ntnu.no/sinclair/faq/fileform.html | +| [MAME sources]/src/mame/machine/spec_snqk.cpp | +| | +| Thanks to Troels Norgaard for sharing the description of this format. | +| | +'========================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 rom_tail[132]; /* last 132 bytes of ROM */ + zuint8 ram[Z_ZX_SPECTRUM_48K_SIZE_RAM]; + zuint8 zero_0[132]; + zuint16 settings[5]; /* KGB settings, usually = {10, 10, 4, 1, 1} */ + zuint8 iff; /* IFF1 and IFF2 */ + zuint8 constants[2]; /* must be {0, 3} */ + zuint8 color_mode; + zuint32 zero_1; + ZInt16 bc, bc_, de, de_, hl, hl_, ix, iy; + zuint8 i, r; + zuint16 zero_2; + zuint8 zero_3, a_; + zuint8 zero_4, a; + zuint8 zero_5, f_; + zuint8 zero_6, f; + ZInt16 zero_7, pc; + ZInt16 zero_8, sp; + zuint16 sound_mode; + zuint8 zero_9; + zuint8 halt_line; /* boolean */ + zsint16 im; + zuint8 zero_10[10]; +} Z_PACKED_STRUCTURE_END Z_ZX; + +#define Z_ZX_COLOR_MODE_BW 0 +#define Z_ZX_COLOR_MODE_COLOR 1 + +#define Z_ZX_SOUND_MODE_SIMPLE 0 +#define Z_ZX_SOUND_MODE_PITCH 1 +#define Z_ZX_SOUND_MODE_ROM_ONLY 2 + +#define Z_ZX_IM_0 -1 +#define Z_ZX_IM_1 0 +#define Z_ZX_IM_2 1 + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX82.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX82.h new file mode 100644 index 0000000..147985f --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX82.h @@ -0,0 +1,77 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ZX82.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ______________________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ZX82 | +| Author: James, William | +| Extensions: .zx82 | +| Endianness: Big | +| Supports: ZX Spectrum 48K | +| Used by: Speculator '97 (AmigaOS) | +| | +| Reference: | +| http://rk.nvg.ntnu.no/sinclair/faq/fileform.html | +| | +| IMPORTANT NOTICE: This format is not well known at all, so the types and | +| constants declared here may be useless. | +| | +| From comp.sys.sinclair Sinclair ZX Spectrum FAQ: | +| | +| -- Amiga Speculator has its own file format which I have called ZX82 | +| format because it contains a file identifier in the first four bytes | +| consisting of the ASCII characters 'ZX82'. The format has a 12 byte header | +| which contains the normal Spectrum type file information like length, | +| type, start etc. as well as a compression flag which is set if the file is | +| byte run compressed. Snapshot files have a further 32 bytes of register | +| values and border colour information. | +| | +| The data_type field is derived from the MGT disciple directory MGT_Type-1, | +| so further file types may be supported in this way in the future. | +| | +| The compression used is the standard byte run compression as used by ILBM | +| IFF files. The whole 48k data block is compressed as if it were one long | +| row. -- | +| | +| See: Amiga ROM Kernel Reference Manual: Devices (Third Edition) | +| - Appendix A - IFF Specification (Page 347) | +| - Appendix C - Example Packer C code (Page 538) | +| | +'=============================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX82_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX82_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 signature[4]; /* {'Z', 'X', '8', '2'} */ + zuint8 data_type; + zuint8 data_compressed; /* boolean */ + zuint16 data_size; /* file length up to 64k (ELINE-PROG for BASIC) */ + zuint16 start_address; /* start address for code (AUTOSTART for BASIC) */ + zuint16 program_size; +} Z_PACKED_STRUCTURE_END Z_ZX82Header; + +#define Z_ZX82_DATA_TYPE_BASIC 0 +#define Z_ZX82_DATA_TYPE_NUMERIC 1 +#define Z_ZX82_DATA_TYPE_STRING 2 +#define Z_ZX82_DATA_TYPE_CODE 3 +#define Z_ZX82_DATA_TYPE_SNAPSHOT 4 + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 border_color; + zuint8 im; /* (0 = use I register, 1 = IM 1 and 2 = IM 2) (?) */ + ZInt16 iy, ix, de, bc, hl, af, de_, bc_, hl_, af_, sp; + zuint8 zero_0, i; + zuint8 zero_1, r; + ZInt16 pc; + Z_FAM(zuint8 memory[];) +} Z_PACKED_STRUCTURE_END Z_ZX82Snapshot; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ZX82_H */ diff --git a/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZXS.h b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZXS.h new file mode 100644 index 0000000..bada252 --- /dev/null +++ b/projects/Zeta/API/Z/formats/snapshot/machine/computer/ZX_Spectrum/ZXS.h @@ -0,0 +1,155 @@ +/* Zeta API - Z/formats/snapshot/machine/computer/ZX_Spectrum/ZXS.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + __________________________________________________________________ +| | +| Daft: Public.Snapshot.Computer.ZXSpectrum.ZXS | +| Author: Kapartzianis, Vaggelis | +| Extensions: .zxs | +| Endianness: Little | +| Supports: | +| Used by: zx32 (Windows) | +| | +| Fuse | +| | +| Reference: | +| http://www.geocities.com/SiliconValley/Bay/9932/ | +| | +'=================================================================*/ + +#ifndef Z_formats_snapshot_machine_computer_ZX_Spectrum_ZXS_H +#define Z_formats_snapshot_machine_computer_ZX_Spectrum_ZXS_H + +#include +#include + +#define Z_ZXS_MACHINE_DEFAULT 0 +#define Z_ZXS_MACHINE_48K_ISSUE_2 0x10 // ZX Spectrum 48K (Issue 2) +#define Z_ZXS_MACHINE_PLUS 0x20 // ZX Spectrum + (Model 3) +#define Z_ZXS_MACHINE_PLUS_128K 0x30 // ZX Spectrum 128 +#define Z_ZXS_MACHINE_PLUS2 0x40 // ZX Spectrum +2 +#define Z_ZXS_MACHINE_PLUS2A 0x50 // ZX Spectrum +2A +#define Z_ZXS_MACHINE_PLUS3 0x60 // ZX Spectrum +3 + +#define ZXH_NONSTANDARD 0x0001 // peripheral hardware + +#define Z_ZXS_ZIP_METHOD_STORE 0 // compression methods +#define Z_ZXS_ZIP_METHOD_SHRINK 0x0001 +#define Z_ZXS_ZIP_METHOD_REDUCE_1 0x0002 +#define Z_ZXS_ZIP_METHOD_REDUCE_2 0x0003 +#define Z_ZXS_ZIP_METHOD_REDUCE_3 0x0004 +#define Z_ZXS_ZIP_METHOD_REDUCE_4 0x0005 +#define Z_ZXS_ZIP_METHOD_IMPLODE 0x0006 +#define Z_ZXS_ZIP_METHOD_TOKENIZE 0x0007 +#define Z_ZXS_ZIP_METHOD_DEFLATE 0x0008 +#define Z_ZXS_ZIP_METHOD_NONE 0xFFFF + +#if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_UINT16_STRING(_1, _0) \ + (((zuint16)(_0) << 8) | (zuint16)(_1)) + + +# define Z_UINT32_STRING(_3, _2, _1, _0) ( \ + ((zuint32)(_0) << 24) | \ + ((zuint32)(_1) << 16) | \ + ((zuint32)(_2) << 8) | \ + (zuint32)(_3)) + +#else +# define Z_UINT16_STRING(_1, _0) \ + (((zuint16)(_1) << 8) | (zuint16)(_0)) + +# define Z_UINT32_STRING(_3, _2, _1, _0) ( \ + ((zuint32)(_3) << 24) | \ + ((zuint32)(_2) << 16) | \ + ((zuint32)(_1) << 8) | \ + (zuint32)(_0)) +#endif + +#define Z_ZXS_FORM_TYPE Z_UINT32_STRING('S','N','A','P') +#define Z_ZXS_CHUNK_ID_DISK_0 Z_UINT32_STRING('d','s','k','0') +#define Z_ZXS_CHUNK_ID_DISK_1 Z_UINT32_STRING('d','s','k','1') +#define Z_ZXS_CHUNK_ID_FORMAT_INFO Z_UINT32_STRING('f','m','t','z') +#define Z_ZXS_CHUNK_ID_CPU Z_UINT32_STRING('r','Z','8','0') +#define Z_ZXS_CHUNK_ID_ZX_SPECTRUM_PLUS3_IO Z_UINT32_STRING('r','+','3',' ') +#define Z_ZXS_CHUNK_ID_ZX_SPECTRUM_48K_IO Z_UINT32_STRING('r','0','4','8') +#define Z_ZXS_CHUNK_ID_ZX_SPECTRUM_PLUS_128K_IO Z_UINT32_STRING('r','1','2','8') +#define Z_ZXS_CHUNK_ID_RAM_0 Z_UINT32_STRING('r','a','m','0') +#define Z_ZXS_CHUNK_ID_RAM_1 Z_UINT32_STRING('r','a','m','1') +#define Z_ZXS_CHUNK_ID_RAM_2 Z_UINT32_STRING('r','a','m','2') +#define Z_ZXS_CHUNK_ID_RAM_3 Z_UINT32_STRING('r','a','m','3') +#define Z_ZXS_CHUNK_ID_RAM_4 Z_UINT32_STRING('r','a','m','4') +#define Z_ZXS_CHUNK_ID_RAM_5 Z_UINT32_STRING('r','a','m','5') +#define Z_ZXS_CHUNK_ID_RAM_6 Z_UINT32_STRING('r','a','m','6') +#define Z_ZXS_CHUNK_ID_RAM_7 Z_UINT32_STRING('r','a','m','7') +#define Z_ZXS_CHUNK_ID_TAPE Z_UINT32_STRING('t','a','p','e') +#define Z_ZXS_CHUNK_ID_ZX32 Z_UINT32_STRING('z','x','3','2') + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 structure_size; // structure size + zuint32 crc32; // crc + zuint32 uncompressed_size; // uncompressed size + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXSZip; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint16 version; + zuint16 machine_model; + zuint16 machine_flags; + zuint16 zip_method; +} Z_PACKED_STRUCTURE_END Z_ZXSFormatInfo; + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt16 af; /* big endian */ + ZInt16 bc, de, hl; + ZInt16 af_; /* big endian */ + ZInt16 bc_, de_, hl_, ix, iy, pc, sp; + zuint8 i, r; + zuint8 iff1, iff2; + zuint8 im; + zuint32 t_states; +} Z_PACKED_STRUCTURE_END Z_ZXSCPU; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 port_1ffd; +} Z_PACKED_STRUCTURE_END Z_ZXSZXSpectrumPlus3IO; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_ZXSpectrumULAIO ula_io; + ZInt64 keyboard; +} Z_PACKED_STRUCTURE_END Z_ZXSZXSpectrum48KIO; + +typedef Z_PACKED_STRUCTURE_BEGIN { + Z_ZXSpectrumPlus128KBankSwitch bank_switch; + zuint8 port_fffd; + zuint8 psg[16]; +} Z_PACKED_STRUCTURE_END Z_ZXSZXSpectrumPlus128KIO; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 current_position; + zuint32 remain_block_size; + zuint32 data_size; + zuint8 data[1]; +} Z_PACKED_STRUCTURE_END Z_ZXSTape; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint32 id; + zuint32 body_size; + + union { zuint32 type; + Z_ZXSCPU cpu; + Z_ZXSFormatInfo format_info; + Z_ZXSTape tape; + Z_ZXSZip zip; + Z_ZXSZXSpectrum48KIO zx_spectrum_48k_io; + Z_ZXSZXSpectrumPlus128KIO zx_spectrum_plus_128k_io; + Z_ZXSZXSpectrumPlus3IO zx_spectrum_plus3_io; + } body; +} Z_PACKED_STRUCTURE_END Z_ZXSChunk; + +#endif /* Z_formats_snapshot_machine_computer_ZX_Spectrum_ZXS_H */ diff --git a/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/TNES.h b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/TNES.h new file mode 100644 index 0000000..4d6f97a --- /dev/null +++ b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/TNES.h @@ -0,0 +1,59 @@ +/* Zeta API - Z/formats/storage_medium_image/NES_Game_Pak/TNES.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ____________________________________________ +| | +| Extensions: ? | +| Created by: Nintendo | +| | +| Reference: | +| https://wiki.nesdev.com/w/index.php/TNES | +| | +'===========================================*/ + +#ifndef Z_formats_storage_medium_image_NES_Game_Pak_TNES_H +#define Z_formats_storage_medium_image_NES_Game_Pak_TNES_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { +/* 0 */ ZInt32 signature; /* 54h, 4Eh, 45h, 53h ('TNES') */ +/* 4 */ zuint8 mapper; +/* 5 */ zuint8 prg_rom_size; +/* 6 */ zuint8 chr_rom_size; +/* 7 */ zuint8 has_wram; +/* 8 */ zuint8 mirroring; +/* 9 */ zuint8 has_battery; +/* A */ zuint8 unknown[2]; +/* C */ zuint8 zero[4]; +} Z_PACKED_STRUCTURE_END Z_TNESHeader; + +#if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_TNES_SIGNATURE 0x53454E54 +#else +# define Z_TNES_SIGNATURE 0x544E4553 +#endif + +#define Z_TNES_ROM_SIZE_UNIT 8192 + +#define Z_TNES_MIRRORING_MAPPER_CONTROLLED 0 +#define Z_TNES_MIRRORING_HORIZONTAL 1 +#define Z_TNES_MIRRORING_VERTICAL 2 + +#define Z_TNES_MAPPER_NROM 0 +#define Z_TNES_MAPPER_SXROM_MMC1 1 +#define Z_TNES_MAPPER_PNROM_MMC2 2 +#define Z_TNES_MAPPER_TXROM_MMC3 3 +#define Z_TNES_MAPPER_FXROM_MMC4 4 +#define Z_TNES_MAPPER_EXROM_MMC5 5 +#define Z_TNES_MAPPER_UXROM 6 +#define Z_TNES_MAPPER_CNROM 7 +#define Z_TNES_MAPPER_AXROM 9 +#define Z_TNES_MAPPER_FDS 100 + +#endif /* Z_formats_storage_medium_image_NES_Game_Pak_TNES_H */ diff --git a/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/UNIF.h b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/UNIF.h new file mode 100644 index 0000000..2697796 --- /dev/null +++ b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/UNIF.h @@ -0,0 +1,36 @@ +/* Zeta API - Z/formats/storage_medium_image/NES_Game_Pak/UNIF.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ____________________________________________ +| | +| Extensions: unf, unif | +| Created by: Carmel-Veilleux, Tennessee | +| | +| Reference: | +| https://wiki.nesdev.com/w/index.php/UNIF | +| | +'===========================================*/ + +#ifndef Z_formats_storage_medium_image_NES_Game_Pak_UNIF_H +#define Z_formats_storage_medium_image_NES_Game_Pak_UNIF_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + ZInt32 signature; /* 55h, 4Eh, 49h, 46h ('UNIF') */ + zuint32 minimum_version_required; + zuint8 zero[24]; +} Z_PACKED_STRUCTURE_END Z_UNIFHeader; + +#if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_UNIF_SIGNATURE 0x46494E55 +#else +# define Z_UNIF_SIGNATURE 0x554E4946 +#endif + +#endif /* Z_formats_storage_medium_image_NES_Game_Pak_UNIF_H */ diff --git a/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/iNES.h b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/iNES.h new file mode 100644 index 0000000..7334e5e --- /dev/null +++ b/projects/Zeta/API/Z/formats/storage_medium_image/NES_Game_Pak/iNES.h @@ -0,0 +1,134 @@ +/* Zeta API - Z/formats/storage_medium_image/NES_Game_Pak/iNES.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + ___________________________________________________________ +| | +| Daft: Public.StorageMediumImage.NESGamePak.iNES | +| Author: Fayzullin, Marat | +| Extensions: .nes | +| Created by: aka kevtris | +| aka NewRisingSun | +| Used by: Any NES emulator | +| | +| Reference: | +| https://wiki.nesdev.com/w/index.php/INES | +| http://forums.nesdev.com/viewtopic.php?p=17727#p17727 | +| http://forums.nesdev.com/viewtopic.php?p=220624#p220624 | +| | +'==========================================================*/ + +#ifndef Z_formats_storage_medium_image_NES_Game_Pak_iNES_H +#define Z_formats_storage_medium_image_NES_Game_Pak_iNES_H + +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { +/* 0 */ ZInt32 signature; /* 4Eh, 45h, 53h, 1Ah ('NES' + MS-DOS EOF) */ +/* 4 */ zuint8 prg_rom_page_count; +/* 5 */ zuint8 chr_rom_page_count; + +/* 6 */ struct {Z_BIT_FIELD_MEMBERS(8, 5) ( + zuint8 mapper_index_low_nibble :4, + zuint8 has_4_screen_vram_layout :1, + zuint8 has_trainer :1, + zuint8 has_persistent_wram :1, + zuint8 mirroring :1 + )} flags_6; + + union { struct { + /* 7 */ struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 mapper_index_high_nibble :4, + zuint8 rom_image_format :1, + zuint8 is_play_choice_10 :1, + zuint8 is_vs_system :1 + )} flags_7; + + /*----------------------------------------. + | This field was a later extension to the | + | iNES format. It is not widely used. | + '========================================*/ + /* 8 */ zuint8 wram_size; + + /*--------------------------------------------. + | Though in the official specification, very | + | few programs honor yhis field, as virtually | + | no ROM images in circulation make use of it.| + '============================================*/ + /* 9 */ struct {Z_BIT_FIELD_MEMBERS(8, 2) ( + zuint8 zero :7, + zuint8 is_pal :1 + )} flags_9; + + /* A */ zuint8 unused[6]; + } v1; + + struct { + } v2; + } as; +} Z_PACKED_STRUCTURE_END Z_iNESHeader; + +#if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_INES_SIGNATURE 0x1A53454E +#else +# define Z_INES_SIGNATURE 0x4E45531A +#endif + +#define Z_INES_PRG_ROM_SIZE_UNIT 16384 +#define Z_INES_CHR_ROM_SIZE_UNIT 8192 +#define Z_INES_WRAM_SIZE_UNIT 8192 + +/* ZiNESHeader::flags_6.mirroring */ + +#define Z_INES_MIRRORING_VERTICAL 0 +#define Z_INES_MIRRORING_HORIZONTAL 1 + +#define Z_INES_TV_SYSTEM_NTSC 0 +#define Z_INES_TV_SYSTEM_DUAL_1 1 +#define Z_INES_TV_SYSTEM_PAL 2 +#define Z_INES_TV_SYSTEM_DUAL_3 3 + + +/*#define Z_INES_MAPPER_NONE 0 +#define Z_INES_MAPPER_NINTENDO_MMC1 1 +#define Z_INES_MAPPER_PRG_ROM_SWITCH 2 +#define Z_INES_MAPPER_CHR_VROM_SWITCH 3 +#define Z_INES_MAPPER_NINTENDO_MMC3 4 +#define Z_INES_MAPPER_NINTENDO_MMC5 5 +#define Z_INES_MAPPER_FFE_F4XXX_GAMES 6 +#define Z_INES_MAPPER_32K_PRG_ROM_SWITCH 7 +#define Z_INES_MAPPER_FFE_F3XXX_GAMES 8 +#define Z_INES_MAPPER_NINTENDO_MMC2 9 +#define Z_INES_MAPPER_NINTENDO_MMC4 10 +#define Z_INES_MAPPER_COLOR_DREAMS_CHIPSET 11 +#define Z_INES_MAPPER_FFE_F6XXX_GAMES 12 +#define Z_INES_MAPPER_100_IN_1_CART_SWITCH 15 +#define Z_INES_MAPPER_BAN_DAI_CHIPSET 16 +#define Z_INES_MAPPER_FFE_F8XXX_GAMES 17 +#define Z_INES_MAPPER_JALECO_SS8806_CHIPSET 18 +#define Z_INES_MAPPER_NAMCOT_106_CHIPSET 19 +#define Z_INES_MAPPER_FAMICOM_DISK_SYSTEM 20 +#define Z_INES_MAPPER_KONAMI_VRC4_2A_CHIPSET 21 +#define Z_INES_MAPPER_KONAMI_VRC4_1B_CHIPSET 22 +#define Z_INES_MAPPER_KONAMI_VRC4_1A_CHIPSET 23 +#define Z_INES_MAPPER_KONAMI_VRC6_CHIPSET 24 +#define Z_INES_MAPPER_KONAMI_VRC4_CHIPSET 25 +#define Z_INES_MAPPER_IREM_G_101_CHIPSET 32 +#define Z_INES_MAPPER_TAITO_TC0190_TC0350 33 +#define Z_INES_MAPPER_32K_PRG_ROM_SWITCH 34 +#define Z_INES_MAPPER_IREM_H3001_CHIPSET 65 +#define Z_INES_MAPPER_74161_32_CHIPSET 66 +#define Z_INES_MAPPER_SUNSOFT_MAPPER_3 67 +#define Z_INES_MAPPER_SUNSOFT_MAPPER_4 69 +#define Z_INES_MAPPER_74161_32_CHIPSET 70 +#define Z_INES_MAPPER_X_005_CHIPSET 80 +#define Z_INES_MAPPER_C075_CHIPSET 81 +#define Z_INES_MAPPER_X1_17_CHIPSET 82 +#define Z_INES_MAPPER_CONY_MAPPER 83 +#define Z_INES_MAPPER_PASOFAMI_MAPPER 84*/ + +#endif /* Z_formats_storage_medium_image_NES_Game_Pak_iNES_H */ diff --git a/projects/Zeta/API/Z/formats/storage_medium_image/audio/TZX.h b/projects/Zeta/API/Z/formats/storage_medium_image/audio/TZX.h new file mode 100644 index 0000000..a84bba9 --- /dev/null +++ b/projects/Zeta/API/Z/formats/storage_medium_image/audio/TZX.h @@ -0,0 +1,1274 @@ +/* Zeta API - Z/formats/storage_medium_image/audio/TZX.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + +.------------------------------------------------------------------------------. +| Extensions: .tzx, .cdt | +| Endianness: Little | +| Created by: Kac, Tomaz | +| Reference: | +| | +| | +| 1. Introduction | +| =============== | +| | +| TZX is a file format designed to preserve all (hopefully) of the tapes with | +| turbo or custom loading routines. Even though some of the newer and smarter | +| emulators can find most of the information about the loader from the code | +| itself, this isn't possible if you want to save the file to tape, or to a | +| real ZX Spectrum. With all this information in the file, the emulators don't | +| have to bother with finding out the timings and other things. | +| | +| This file format is explicitly targeted to the ZX Spectrum compatible | +| computers only. Specialized versions of the TZX format have been defined for | +| other machines too, e.g. the Amstrad CPC and Commodore 64, but they are now | +| available as distinct file formats with other filename extensions. | +| | +| If you're looking for TZX files, you can find an extensive collection at | +| Martijn van der Heide's 'World of Spectrum': http://www.worldofspectrum.org | +| | +| The format was first started off by Tomaz Kac who was maintainer until | +| revision v1.13, and then passed to Martijn v.d. Heide. After that, Ramsoft | +| were the maintainers for a brief period during which the v1.20 revision was | +| put together. If you have any questions about the format, visit the forums | +| at World of Spectrum and ask. | +| | +| The default format file extension is "TZX" and hopefully this won't have to | +| change in the future. Amstrad CPC files should use the extension "CDT" to | +| distinguish them from the ZX Spectrum files. | +| | +| | +| 2. Rules and definitions | +| ======================== | +| | +| - Any value requiring more than one byte is stored in little endian-format | +| (i.e. LSB first). | +| | +| - All unused bits should be set to zero. | +| | +| - The timings are given in Z80 clock cycles unless otherwise stated. | +| 1 cycle = (1 / 3500000) s | +| | +| - All ASCII texts use the ISO 8859-1 (Latin 1) encoding; some of them can | +| have several lines, which should be separated by ASCII code 0Dh. | +| | +| - You might interpret 'wave' as --__ or __--, and 'pulse' as -- or __. | +| | +| - The values in brackets are the default values that are used in the ROM | +| routines of the machine. Curly {} for the ZX Spectrum and square [] for | +| the Commodore 64. | +| | +| - If there is no pause between two data blocks then the second one should | +| follow immediately; not even so much as one CPU cycle between them. | +| | +| - This document refers to 'HIGH' and 'LOW' pulse levels. Whether this is | +| implemented as EAR=1 and EAR=0 respectively or the other way around is not | +| important, as long as it is done consistently. | +| | +| - The 'current pulse level' after playing the blocks ID 10,11,12,13,14 or 19 | +| is the opposite of the last pulse level played, so that a subsequent pulse | +| will produce an edge. | +| | +| - A 'Pause' block consists of a LOW pulse level of some duration. | +| To ensure that the last edge produced is properly finished there should be | +| at least 1ms pause of the opposite level and only after that the pulse | +| should go to LOW. At the end of a 'Pause' block the 'current pulse level' | +| is low (note that the first pulse will therefore not immediately produce | +| an edge). A 'Pause' block of zero duration is completely ignored, so the | +| 'current pulse level' will NOT change in this case. This also applies to | +| 'Data' blocks that have some pause duration included in them. | +| | +| - An emulator should put the 'current pulse level' to LOW when starting to | +| play a TZX file, either from the start or from a certain position. The | +| writer of a TZX file should ensure that the 'current pulse level' is | +| well-defined in every sequence of blocks where this is important, i.e. in | +| any sequence that includes a 'Direct recording' block, or that depends on | +| edges generated by 'Pause' blocks. The recommended way of doing this is to | +| include a Pause after each sequence of blocks. | +| | +| - General extension rule: ALL custom blocks that will be added after v1.10 | +| will contain the size of the block in the first 4 bytes (this size does | +| not include these 4 bytes). This should enable programs that can only | +| handle older versions to skip that block. | +| | +| | +| 3. Fields common to more than 1 type of block | +| ============================================= | +| | +| block_size | +| The size (in bytes) of the whole block (without this field). | +| | +| data | +| Data as in .TAP files. | +| | +| data_size | +| The size in bytes of the data following this field. | +| | +| general_purpose.data_bit_order | +| The order in which the bits of the data bytes must be played. | +| | +| last_byte_bit_count | +| Bits used in the last byte of the data (the remaining ones should be 0). | +| e.g. if this is 6, then the bits used "X" in the last byte are: XXXXXX00, | +| where MSb is the leftmost bit and LSb is the rightmost bit. | +| | +| pause_duration_ms | +| The duration of the period of silence after block playback in milliseconds | +| (usually 1000). | +| | +| xor_checksum_bit | +| The XOR checksum (if applicable, i.e. if different than FFh) is a XOR of | +| all bits in the data byte XORed with the value in this field as the start | +| value. | +| | +| | +| 4. REVISION HISTORY | +| ------------------- | +| | +| v1.20 (2006-12-19) | +| | +| Changes: | +| 1. The following blocks have been deprecated and should not appear in TZX | +| files v1.20 and above: 16h, 17h, 34h, 40h. Their IDs are now reserved. | +| All Custom information (block ID 35h) types standardized up to v1.13 are | +| now deprecated. | +| 2. The following new blocks have been introduced: 18h, 19h, 2Bh. | +| Newly added blocks follow the general extension rule. | +| 3. Added new entries to the hardware ID list: 00h/1Eh-2Dh, 01h/12h-17h, | +| 02h/06h-0Ah, 03h/06h-0Ch, 06h/03h, 0Bh/03h, 10h/00h-03h. | +| | +| v1.13 (1998-11-02) | +| | +| Changes: | +| 1. The following new blocks have been introduced: 16h, 17h. | +| 2. Added new entries to the hardware ID list: 00h/1Ch,1Dh. | +| | +| v1.12 | +| | +| Changes: | +| 1. Added the following fields to the block ID 32h: 05h-08h. | +| 2. Added two new types of 'Custom Information' (ID 35h) block: | +| 'ZX-Edit document' - for .ZED files generated by the great ZX-Editor! | +| 'Picture' - for .GIF and .JPEG (.JPG) pictures. | +| 3. Added new entries to the hardware ID list: 00h/1Ah,1Bh. | +| | +| v1.10 | +| | +| Changes: | +| 1. The following new blocks have been introduced: 24h, 25h, 26h, 27h, 28h, | +| 40h. | +| 2. Allowed multiple lines in the block ID 32h. Also added field 04h. | +| 3. First three types of 'Custom information' (ID 35h) block standardized: | +| 'POKEs', 'Instructions' and 'Screen'. | +| | +| v1.02 | +| | +| Changes: | +| 1. Added new entries to the hardware ID list: 00h/15h-19h. | +| | +| v1.01 | +| | +| Changes: | +| 1. The Length of ASCII content ID in 'Custom Information' (ID 35h) block | +| should be 16 and not 15 bytes - even Tomaz Kac doesn't remember if it | +| concerns only documentation or also the implementation; to be sure | +| consider the block ID 35h as newly added in v1.01. | +| | +| v1.00 | +| | +| Initial version. | +'=============================================================================*/ + +#ifndef Z_formats_storage_medium_image_audio_TZX_H +#define Z_formats_storage_medium_image_audio_TZX_H + +#include +#include +#include + +/* MARK: - File Header */ +/*-----------------------------------------------------------------------------. +| The file is identified with the first 8 bytes being 'ZXTape!' plus the EOF | +| byte 26 (1Ah). This is followed by two bytes containing the major and minor | +| version numbers. | +| | +| To be able to use a TZX file, your program must be able to handle files of | +| at least its major version number. If your program can handle (say) version | +| 1.05 and you encounter a file with version number 1.06, your program must be | +| able to handle it, even if it cannot handle all the data in the file. | +| | +| Then the main body of the file follows. It consists of a mixture of blocks, | +| each preceded and identified by an ID byte. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 signature[7]; /* 'ZXTape!' */ + zuint8 eof_marker; /* 1Ah */ + zuint8 major_version; + zuint8 minor_version; +} Z_PACKED_STRUCTURE_END Z_TZXHeader; + +/* MARK: - Block ID */ + +typedef zuint8 Z_TZXBlockID; + +#define Z_TZX_BLOCK_ID_STD_SPEED_DATA 0x10 +#define Z_TZX_BLOCK_ID_TURBO_SPEED_DATA 0x11 +#define Z_TZX_BLOCK_ID_PURE_TONE 0x12 +#define Z_TZX_BLOCK_ID_PULSE_SEQUENCE 0x13 +#define Z_TZX_BLOCK_ID_PURE_DATA 0x14 +#define Z_TZX_BLOCK_ID_DIRECT_RECORDING 0x15 +#define Z_TZX_BLOCK_ID_C64_ROM_TYPE_DATA 0x16 /* added in v1.13, deprecated in v1.20 */ +#define Z_TZX_BLOCK_ID_C64_TURBO_TAPE_DATA 0x17 /* added in v1.13, deprecated in v1.20 */ +#define Z_TZX_BLOCK_ID_CSW_RECORDING 0x18 /* added in v1.20 */ +#define Z_TZX_BLOCK_ID_GENERALIZED_DATA 0x19 /* added in v1.20 */ +#define Z_TZX_BLOCK_ID_PAUSE 0x20 +#define Z_TZX_BLOCK_ID_GROUP_START 0x21 +#define Z_TZX_BLOCK_ID_GROUP_END 0x22 +#define Z_TZX_BLOCK_ID_JUMP 0x23 +#define Z_TZX_BLOCK_ID_LOOP_START 0x24 /* added in v1.10 */ +#define Z_TZX_BLOCK_ID_LOOP_END 0x25 /* added in v1.10 */ +#define Z_TZX_BLOCK_ID_CALL_SEQUENCE 0x26 /* added in v1.10 */ +#define Z_TZX_BLOCK_ID_RETURN 0x27 /* added in v1.10 */ +#define Z_TZX_BLOCK_ID_SELECT 0x28 /* added in v1.10 */ +#define Z_TZX_BLOCK_ID_STOP_IF_48K 0x2A +#define Z_TZX_BLOCK_ID_SET_SIGNAL_LEVEL 0x2B /* added in v1.20 */ +#define Z_TZX_BLOCK_ID_SECTION_DESCRIPTION 0x30 +#define Z_TZX_BLOCK_ID_MESSAGE 0x31 +#define Z_TZX_BLOCK_ID_INFO 0x32 +#define Z_TZX_BLOCK_ID_HARDWARE_INFO 0x33 +#define Z_TZX_BLOCK_ID_EMULATION_INFO 0x34 /* deprecated in v1.20 */ +#define Z_TZX_BLOCK_ID_CUSTOM_INFO 0x35 /* "added" in v1.01, deprecated in v1.20 */ +#define Z_TZX_BLOCK_ID_SNAPSHOT 0x40 /* added in v1.10, deprecated in v1.20 */ +#define Z_TZX_BLOCK_ID_GLUE 0x5A + +/* MARK: - ID 10h - Standard Speed Data */ +/*-----------------------------------------------------------------------------. +| This block must be played using the standard Spectrum ROM timings (see the | +| values in curly brackets in block ID 11). The initial pilot tone consists in | +| 8063 pulses if the first data byte (flag byte) is < 128, 3223 otherwise. | +| This block can be used for the ROM loading routines and for custom loading | +| routines that use the same timings as ROM ones do. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 pause_duration_ms; + zuint16 data_size; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXStdSpeedData; + +/* MARK: - ID 11h - Turbo Speed Data */ +/*-----------------------------------------------------------------------------. +| This block is very similar to the normal TAP block but with some additional | +| information on the timings and other important differences. The same tape | +| encoding is used as for the standard speed data block. If a block should use | +| some non-standard sync or pilot tones (i.e. all sorts of protection schemes) | +| then use the next three blocks to describe it. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN{ + zuint8 block_id; + zuint16 cycles_per_pilot_pulse; /* {2168} */ + zuint16 cycles_per_sync_high_pulse; /* {667} */ + zuint16 cycles_per_sync_low_pulse; /* {735} */ + zuint16 cycles_per_bit_0_pulse; /* {855} */ + zuint16 cycles_per_bit_1_pulse; /* {1710} */ + zuint16 pilot_tone_pulse_count; /* {8063 header (flag < 128), 3223 data (flag >= 128)} */ + zuint8 last_byte_bit_count; + zuint16 pause_duration_ms; + zuint8 data_size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXTurboSpeedData; + +/* MARK: - ID 12h - Pure Tone */ +/*---------------------------------------------------------------------------. +| This will produce a tone which is basically the same as the pilot tone in | +| the ID 10, ID 11 blocks. You can define how long the pulse is and how many | +| pulses are in the tone. | +'===========================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 cycles_per_pulse; + zuint16 pulse_count; +} Z_PACKED_STRUCTURE_END Z_TZXPureTone; + +/* MARK: - ID 13h - Pulse Sequence */ +/*-----------------------------------------------------------------------------. +| This will produce N pulses, each having its own timing. Up to 255 pulses can | +| be stored in this block; this is useful for non-standard sync tones used by | +| some protection schemes. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 pulse_count; + Z_FAM(zuint16 pulse_cycles[];) +} Z_PACKED_STRUCTURE_END Z_TZXPulseSequence; + +/* MARK: - ID 14h - Pure Data */ +/*-----------------------------------------------------------------------------. +| This is the same as in the turbo loading data block (ID 11h), except that it | +| has no pilot or sync pulses. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 cycles_per_bit_0_pulse; + zuint16 cycles_per_bit_1_pulse; + zuint8 last_byte_bit_count; + zuint16 pause_duration_ms; + zuint8 data_size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXPureData; + +/* MARK: - ID 15h - Direct Recording */ +/*-----------------------------------------------------------------------------. +| This block is used for tapes which have some parts in a format such that the | +| turbo loader block cannot be used. This is not like a VOC file, since the | +| information is much more compact. Each sample value is represented by one | +| bit only (0 for LOW, 1 for HIGH) which means that the block will be at most | +| 1/8 the size of the equivalent VOC. | +| | +| The 'current pulse level' after playing this type of block is the last level | +| played. | +| | +| When creating a block of this type please stick to the standard sampling | +| frequencies of 22050 or 44100 Hz (158 or 79 cycles per pulse). This will | +| ensure correct playback when using modern soundcards. | +| | +| If you can, don't use other sampling frequencies and only use this block if | +| you cannot use any other one. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 cycles_per_pulse; + zuint16 pause_duration_ms; + zuint8 last_byte_bit_count; + zuint8 data_size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXDirectRecording; + +/* MARK: - ID 16h - C64 ROM Type Data (added in v1.13, deprecated in v1.20) */ +/*-----------------------------------------------------------------------------. +| This block was created to support the Commodore 64 standard ROM and similar | +| tape blocks. It is made so basically anything that uses two or four pulses | +| (which are the same in pairs) per bit can be written with it. | +| | +| The replay procedure looks like this: | +| | +| 1) Pilot Tone | +| 2) x1 sync wave | +| 3) For each byte in data: | +| 1) x8 bit waves (1 wave for each bit of the byte) | +| 2) x1 XOR wave (optional) | +| 3) x1 finish byte wave (except in the last byte) | +| 4) x1 finish data wave | +| 5) Trailing tone (optional) | +| 6) Pause | +| | +| Some explanation: | +| | +| - A wave consists of 2 pulses: first LOW then HIGH. | +| | +| - If the cycles of any pulse are 0 then the wave must be skipped. | +| This applies to DATA too. | +| | +| - Finish byte wave should be played after each byte EXCEPT last one. | +| | +| - Finish data wave should be ONLY played after last byte of data. | +| | +| - When all the data has finished there is an optional trailing tone, which | +| is standard for the repeated blocks in the Commodore 64 ROM Loader. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint16 cycles_per_pilot_pulse; /* [616] */ + zuint16 pilot_wave_count; + zuint16 cycles_per_sync_low_pulse; /* [1176] */ + zuint16 cycles_per_sync_high_pulse; /* [896] */ + zuint16 cycles_per_bit_0_low_pulse; /* [616] */ + zuint16 cycles_per_bit_0_high_pulse; /* [896] */ + zuint16 cycles_per_bit_1_low_pulse; /* [896] */ + zuint16 cycles_per_bit_1_high_pulse; /* [616] */ + zuint8 xor_checksum_bit; + zuint16 cycles_per_finish_byte_low_pulse; /* [1176] */ + zuint16 cycles_per_finish_byte_high_pulse; /* [896] */ + zuint16 cycles_per_finish_data_low_pulse; /* [1176] */ + zuint16 cycles_per_finish_data_high_pulse; /* [616] */ + zuint16 cycles_per_trailing_tone_pulse; /* [616] */ + zuint16 trailing_tone_wave_count; + zuint8 last_byte_bit_count; + + struct {Z_BIT_FIELD_MEMBERS(8, 2) ( + zuint8 unused :7, + zuint8 data_bit_order :1 + )} general_purpose; + + zuint16 pause_duration_ms; + zuint8 data_size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXC64ROMTypeData; + +#define Z_TZX_C64_XOR_CHECKSUM_BIT_START_WITH_0 0x00 +#define Z_TZX_C64_XOR_CHECKSUM_BIT_START_WITH_1 0x01 +#define Z_TZX_C64_XOR_CHECKSUM_BIT_NONE 0xFF + +#define Z_TZX_C64_DATA_BIT_ORDER_LSB 0 /* LSB first */ +#define Z_TZX_C64_DATA_BIT_ORDER_MSB 1 /* MSB first */ + +/* MARK: - ID 17h - C64 Turbo Tape Data (added in v1.13, deprecated in v1.20) */ +/*-----------------------------------------------------------------------------. +| This block is made to support another type of encoding that is commonly used | +| by the Commodore 64. Most of the commercial software uses this encoding, | +| i.e. the pilot tone is not made from one type of wave only, but it is made | +| from actual data byte which is repeated many times. As the sync value | +| another, different, data byte is sent to signal the start of the data. The | +| data bits are made from ONE wave only and there is NO XOR checksum either. | +| The trailing byte is played one or more times AFTER the DATA has ended. | +| | +| The replay procedure looks like this: | +| | +| 1) Pilot bytes | +| 2) For each byte in data: | +| 1) Padding bits (only if padding position is BEFORE) | +| 2) x8 bit waves (1 wave for each bit of the byte) | +| 3) Padding bits (only if padding position is AFTER) | +| 3) Trailing bytes | +| 4) Pause | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint16 cycles_per_bit_0_pulse; + zuint16 cycles_per_bit_1_pulse; + + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 unused :3, + zuint8 position :1, + zuint8 value :1, + zuint8 count :3 + )} padding_bits; + + zuint16 pilot_byte_count; + zuint8 pilot_byte; + zuint8 last_byte_bit_count; + + struct {Z_BIT_FIELD_MEMBERS(8, 2) ( + zuint8 unused :7, + zuint8 data_bit_order :1 + )} general_purpose; + + zuint16 trailing_byte_count; + zuint8 trailing_byte; + zuint16 pause_duration_ms; + zuint8 data_size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXC64TurboTapeData; + +#define Z_TZX_C64_PADDING_BITS_POSITION_BEFORE 0 +#define Z_TZX_C64_PADDING_BITS_POSITION_AFTER 1 + +/* MARK: - ID 18h - CSW Recording (added in v1.20) */ +/*-----------------------------------------------------------------------------. +| This block contains a sequence of raw pulses encoded in CSW format v2. See | +| details of this format in | +| | +| The 'current pulse level' after playing this type of block is the last level | +| played. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint16 pause_duration_ms; + zuint8 sampling_rate[3]; + zuint8 compression_type; + zuint32 pulse_count; /* After decompression, for validation purposes */ + Z_FAM(zuint8 csw_data[];) +} Z_PACKED_STRUCTURE_END Z_TZXCSWRecording; + +#define Z_TZX_CSW_COMPRESSION_TYPE_RLE 1 +#define Z_TZX_CSW_COMPRESSION_TYPE_Z_RLE 2 + +/* MARK: - ID 19h - Generalized Data (added in v1.20) */ +/*-----------------------------------------------------------------------------. +| This block has been specifically developed to represent an extremely wide | +| range of data encoding techniques. The basic idea is that each loading | +| component (pilot tone, sync, data) is associated to a specific sequence of | +| pulses, where each sequence (wave) can contain a different number of pulses | +| from the others. e.g. we can represent bit 0 with 4 pulses and bit 1 with 8 | +| pulses. | +| | +| The symbols definitions are stored using a table where each symbol is a row | +| of pulses. The number of columns (i.e. pulses) of the table is the maximum | +| number of pulses per symbol (amongst pilot/sync and data symbols); shorter | +| waves are terminated by a zero-length pulse in the sequence. | +| | +| Any number of data symbols is allowed, so we can have more than two distinct | +| waves; for example, imagine a loader which writes two bits at a time by | +| encoding them with four distinct pulse lengths: this loader would have a | +| symbols definition table of four symbols, each associated to a specific | +| sequence of pulses (wave). | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint16 pause_duration_ms; + zuint32 pilot_sync_symbol_count; + zuint8 pulses_per_pilot_sync_symbol_maximum; + zuint8 pilot_sync_symbol_definition_count; + zuint32 data_symbol_count; + zuint8 pulses_per_data_symbol_maximum; + zuint8 data_symbol_definition_count; + /* Pilot/sync symbols definition table */ + /* Pilot/sync stream */ + /* Data symbols definition table */ + /* Data stream */ +} Z_PACKED_STRUCTURE_END Z_TZXGeneralizedData; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 polarity; + Z_FAM(zuint16 pulse_durations[];) +} Z_PACKED_STRUCTURE_END Z_TZXSymbolDefinition; + +#define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_OPPOSITE 0 +#define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_CURRENT 1 +#define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_LOW 2 +#define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_HIGH 3 + +/*----------------------------------------------------------------------------. +| Most commonly, pilot and sync are repetitions of the same pulse, thus they | +| are represented using a very simple RLE encoding structure which stores the | +| symbol and the number of times it must be repeated. | +| | +| Each symbol in the data stream is represented by a string of NB bits of the | +| block data, where NB = ceil(log2(ASD)). Thus the length of the whole data | +| stream in bits is NB * TOTD, or in bytes DS = ceil(NB * TOTD / 8). | +'============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 symbol; + zuint16 repetitions; +} Z_PACKED_STRUCTURE_END Z_TZXPulseRLE; + +/* MARK: EXAMPLE */ + +/* +A typical Spectrum's standard loading header can be represented like this: + +Offset Value Description +.----+-----------------+----------------------------------------------. +| 00 | 59 (3Bh) | Total block length | +|----+-----------------+----------------------------------------------| +| 04 | 1000 (03E8h) | Pause after this block (ms.) | +|----+-----------------+----------------------------------------------| +| 06 | 2 | Total number of symbols in pilot/sync block | +|----+-----------------+----------------------------------------------| +| 0A | 2 | Maximum pulses per symbol | +|----+-----------------+----------------------------------------------| +| 0B | 2 | Number of symbols in pilot/sync alphabet | +|----+-----------------+----------------------------------------------| +| 0C | 152 (98h) | Total number of symbols (bits, in this case) | +| | | in data stream | +|----+-----------------+----------------------------------------------| +| 10 | 2 | Max pulses per data symbol | +|----+-----------------+----------------------------------------------| +| 11 | 2 | Number of symbols in data alphabet | +|----+-----------------+----------------------------------------------| +| 12 | (0, 2168, 0) | Pilot/sync symbol definitions | +| | (0, 667, 735) | | +|----+-----------------+----------------------------------------------| +| 1C | (0, 8063) | Pilot/sync data block | +| | (1, 1) | | +|----+-----------------+----------------------------------------------| +| 22 | (0, 855, 855) | Data symbol definitions | +| | (0, 1710, 1710) | | +|----+-----------------+----------------------------------------------| +| 2C | 00000000b (00h) --- Loading flag (00h = header) | +| | 00000011b (03h) --- Data type (03h = "Bytes:") | +| | 01001010b (4Ah) -. | +| | 01010000b (50h) | | +| | 01010011b (53h) | | +| | 01010000b (50h) | | +| | 00100000b (20h) |- File name ("JPSP") | +| | 00100000b (20h) | | +| | 00100000b (20h) | | +| | 00100000b (20h) | | +| | 00100000b (20h) | | +| | 00100000b (20h) -' | +| | 00000000b (00h) \__ Data length | +| | 00011011b (1Bh) / | +| | 00000000b (00h) \__ Start address | +| | 01000000b (40h) / | +| | 00000000b (00h) \__ Autostart (no meaning here) | +| | 10000000b (80h) / | +| | 11000001b (C1h) --- Checksum | +'====================================================================*/ + +/* MARK: - ID 20h - Pause (Silence) or 'Stop the Tape' Command */ +/*-----------------------------------------------------------------------------. +| This will make a silence (LOW pulses) for a given time. If the duration is 0 | +| then the emulator or utility should (in effect) STOP THE TAPE, i.e. should | +| not continue loading until the user or emulator requests it. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 duration_ms; +} Z_PACKED_STRUCTURE_END Z_TZXPause; + +/* MARK: - ID 21h - Group Start */ +/*----------------------------------------------------------------------------. +| This block marks the start of a group of blocks which are to be treated as | +| one single (composite) block. This is very handy for tapes that use lots of | +| blocks like Bleepload (which may well have over 160 custom loading blocks). | +| You can also give the group a name (example 'Bleepload Block 1'). | +| | +| For each group start block, there must be a group end block. Nesting of | +| groups is not allowed. | +| | +| Please keep the group name under 30 characters long. | +'============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 name_size; + Z_FAM(zuint8 name[];) +} Z_PACKED_STRUCTURE_END Z_TZXGroupStart; + +/* MARK: - ID 22h - Group End */ +/*-----------------------------------------------------------. +| This indicates the end of a group. This block has no body. | +'===========================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; +} Z_PACKED_STRUCTURE_END Z_TZXGroupEnd; + +/* MARK: - ID 23h - Jump */ +/*--------------------------------------------------------------------. +| This block will enable you to jump from one block to another within | +| the file. Some examples: | +| | +| Jump 0 = 'Loop Forever' - this should never happen | +| Jump 1 = 'Go to the next block' - it is like NOP in assembler ;) | +| Jump 2 = 'Skip one block' | +| Jump -1 = 'Go to the previous block' | +| | +| All blocks are included in the block count! | +'====================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zsint16 relative_offset; +} Z_PACKED_STRUCTURE_END Z_TZXJump; + +/* MARK: - ID 24h - Loop Start (added in v1.10) */ +/*-----------------------------------------------------------------------------. +| If you have a sequence of identical blocks or groups of blocks, you can use | +| this block to tell how many times they should be repeated. This block is the | +| same as the FOR statement in BASIC. | +| | +| For simplicity reasons don't nest loop blocks! | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 count; /* Greater than 1 */ +} Z_PACKED_STRUCTURE_END Z_TZXLoopStart; + +/* MARK: - ID 25h - Loop End (added in v1.10) */ +/*-----------------------------------------------------------------------------. +| This is the same as BASIC's NEXT statement. It means that the utility should | +| jump back to the start of the loop if it hasn't been run for the specified | +| number of times. | +| | +| This block has no body. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; +} Z_PACKED_STRUCTURE_END Z_TZXLoopEnd; + +/* MARK: - ID 26h - Call Sequence (added in v1.10) */ +/*-----------------------------------------------------------------------------. +| This block is an analogue of the CALL Subroutine statement. It basically | +| executes a sequence of blocks that are somewhere else and then goes back to | +| the next block. Because more than one call can be normally used you can | +| include a list of sequences to be called. The 'nesting' of call blocks is | +| also not allowed for the simplicity reasons. You can, of course, use the | +| CALL blocks in the LOOP sequences and vice versa. The value is relative for | +| the obvious reasons: so that you can add some blocks in the beginning of the | +| file without disturbing the call values. Please take a look at block ID 23h | +| for reference on the values. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint16 count; + Z_FAM(zsint16 relative_offsets[];) +} Z_PACKED_STRUCTURE_END Z_TZXCallSequence; + +/* MARK: - ID 27h - Return (added in v1.10) */ +/*---------------------------------------------------------------------------. +| This block indicates the end of the Called Sequence. The next block played | +| will be the block after the last CALL block (or the next Call, if the Call | +| block had multiple calls). | +| | +| This block has no body. | +'===========================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; +} Z_PACKED_STRUCTURE_END Z_TZXReturn; + +/* MARK: - ID 28h - Select (added in v1.10) */ +/*-----------------------------------------------------------------------------. +| This block is useful when the tape consists of two or more separately | +| loadable parts. With this block, you are able to select one of the parts and | +| the emulator/utility will start loading from that block. For example you can | +| use it when the game has a separate Trainer or when it is a multiload. | +| Of course, to make some use of it the emulator/utility has to show a menu | +| with the selections when it encounters such a block. | +| | +| Please use single line and maximum of 30 characters for description texts. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint8 item_count; + Z_FAM(zuint8 items[];) /* Z_TZXSelectItem */ +} Z_PACKED_STRUCTURE_END Z_TZXSelect; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zsint16 relative_offset; + zuint8 description_size; + Z_FAM(zuint8 description[];) +} Z_PACKED_STRUCTURE_END Z_TZXSelectItem; + +/* MARK: - ID 2Ah - Stop if 48K */ +/*-----------------------------------------------------------------------------. +| When this block is encountered, the tape will stop ONLY if the machine is a | +| 48K ZX Spectrum. This block is to be used for multiloading games that load | +| one level at a time in 48K mode, but load the entire tape at once if in 128K | +| mode. | +| | +| This block has no body of its own, but follows the extension rule. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; /* 0 */ +} Z_PACKED_STRUCTURE_END Z_TZXStopIf48K; + +/* MARK: - ID 2Bh - Set Signal Level (added in v1.20) */ +/*---------------------------------------------------------------------. +| This block sets the 'current pulse level' to the specified value | +| (HIGH or LOW). It should be used whenever it is necessary to avoid | +| any ambiguities, e.g. with custom loaders which are level-sensitive. | +'=====================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint8 level; +} Z_PACKED_STRUCTURE_END Z_TZXSetSignalLevel; + +#define Z_TZX_SIGNAL_LEVEL_LOW 0 +#define Z_TZX_SIGNAL_LEVEL_HIGH 1 + +/* MARK: - ID 30h - Section Description */ +/*-----------------------------------------------------------------------------. +| This is meant to identify parts of the tape, so you know where level 1 | +| starts, where to rewind to when the game ends, etc. This description is not | +| guaranteed to be shown while the tape is playing, but can be read while | +| browsing the tape or changing the tape pointer. | +| | +| The description can be up to 255 characters long but please keep it down to | +| about 30 so the program can show it in one line (where this is appropriate). | +| | +| Please use block ID 32h for title, authors, publisher, etc. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 text_size; + Z_FAM(zuint8 text[];) +} Z_PACKED_STRUCTURE_END Z_TZXSectionDescription; + +/* MARK: - ID 31h - Message */ +/*---------------------------------------------------------------------------. +| This will enable the emulators to display a message for a given time. This | +| should not stop the tape and it should not make silence. If the time is 0 | +| then the emulator should wait for the user to press a key. | +| | +| The text message should: | +| - Stick to a maximum of 30 characters per line. | +| - Stick to a maximum of 8 lines. | +| - Use single 0Dh (13 decimal) to separate lines. | +| | +| If you do not obey these rules, emulators may display your message in any | +| way they like. | +'===========================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 duration_s; /* Seconds */ + zuint8 text_size; + Z_FAM(zuint8 text[];) +} Z_PACKED_STRUCTURE_END Z_TZXMessage; + +/* MARK: - ID 32h - Information */ +/*-----------------------------------------------------------------------------. +| Use this block at the beginning of the tape to identify the title of the | +| game, author, publisher, year of publication, price (including the | +| currency), type of software (arcade adventure, puzzle, word processor, ...), | +| loader/protection scheme it uses (Speedlock 1, Alkatraz, ...) and its origin | +| (Original, Budget re-release, ...), etc. This block is built in a way that | +| allows easy future expansion. The block consists of a series of fields. Each | +| one has its identification number (which tells us what the field means) and | +| then the ASCII text. To make it possible to skip this block, if needed, the | +| length of the whole block is at the beginning of it. | +| | +| If all texts on the tape are in English language then you don't have to | +| supply the language field. | +| | +| The information about what hardware the tape uses is in the block ID 33h, so | +| no need for it here. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; + zuint8 field_count; + Z_FAM(zuint8 fields[];) /* Z_TZXInfoField */ +} Z_PACKED_STRUCTURE_END Z_TZXInfo; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 field_id; + zuint8 text_size; + Z_FAM(zuint8 text[];) +} Z_PACKED_STRUCTURE_END Z_TZXInfoField; + +#define Z_TZX_INFO_FIELD_FULL_TITLE 0x00 +#define Z_TZX_INFO_FIELD_PUBLISHER 0x01 +#define Z_TZX_INFO_FIELD_AUTHORS 0x02 +#define Z_TZX_INFO_FIELD_YEAR 0x03 +#define Z_TZX_INFO_FIELD_LANGUAGE 0x04 /* Added in v1.10 */ +#define Z_TZX_INFO_FIELD_TYPE 0x05 /* Added in v1.12 */ +#define Z_TZX_INFO_FIELD_PRICE 0x06 /* Added in v1.12 */ +#define Z_TZX_INFO_FIELD_LOADER 0x07 /* Added in v1.12 */ +#define Z_TZX_INFO_FIELD_ORIGIN 0x08 /* Added in v1.12 */ +#define Z_TZX_INFO_FIELD_COMMENT 0xFF + +/* MARK: - ID 33h - Hardware Information */ +/*---------------------------------------------------------------------------. +| This blocks contains information about the hardware that the programs on | +| this tape use. Please include only machines and hardware for which you are | +| 100% sure that it either runs (or doesn't run) on or with, or you know it | +| uses (or doesn't use) the hardware or special features of that machine. | +| | +| If the tape runs only on the ZX81 (and TS1000, etc.) then it clearly won't | +| work on any Spectrum or Spectrum variant, so there's no need to list this | +| information. | +| | +| If you are not sure or you haven't tested a tape on some particular | +| machine/hardware combination then do not include it in the list. | +'===========================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 type; + zuint8 id; + zuint8 compatibility; +} Z_PACKED_STRUCTURE_END Z_TZXHardware; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 hardware_count; + Z_FAM(Z_TZXHardware hardware[];) /* Z_TZXHardware */ +} Z_PACKED_STRUCTURE_END Z_TZXHardwareInfo; + +#define Z_TZX_HARDWARE_TYPE_MACHINE 0x00 +#define Z_TZX_HARDWARE_TYPE_STORAGE 0x01 +#define Z_TZX_HARDWARE_TYPE_MEMORY 0x02 +#define Z_TZX_HARDWARE_TYPE_SOUND 0x03 +#define Z_TZX_HARDWARE_TYPE_JOYSTICK 0x04 +#define Z_TZX_HARDWARE_TYPE_MICE 0x05 +#define Z_TZX_HARDWARE_TYPE_OTHER 0x06 +#define Z_TZX_HARDWARE_TYPE_SERIAL_PORT 0x07 +#define Z_TZX_HARDWARE_TYPE_PARALLEL_PORT 0x08 +#define Z_TZX_HARDWARE_TYPE_PRINTER 0x09 +#define Z_TZX_HARDWARE_TYPE_MODEM 0x0A +#define Z_TZX_HARDWARE_TYPE_DIGITIZER 0x0B +#define Z_TZX_HARDWARE_TYPE_NETWORK_ADAPTER 0x0C +#define Z_TZX_HARDWARE_TYPE_KEYBOARD 0x0D +#define Z_TZX_HARDWARE_TYPE_ADC_DAC 0x0E +#define Z_TZX_HARDWARE_TYPE_EPROM_PROGRAMMER 0x0F +#define Z_TZX_HARDWARE_TYPE_GRAPHICS 0x10 + +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_16K 0x00 +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_48K_PLUS 0x01 +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_48K_ISSUE_1 0x02 +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_128K_SINCLAIR 0x03 +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS2 0x04 +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS2A_PLUS3 0x05 +#define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_2048 0x06 +#define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_2068 0x07 +#define Z_TZX_MACHINE_ID_PENTAGON_128 0x08 +#define Z_TZX_MACHINE_ID_SAM_COUPE 0x09 +#define Z_TZX_MACHINE_ID_DIDAKTIK_M 0x0A +#define Z_TZX_MACHINE_ID_DIDAKTIK_GAMA 0x0B +#define Z_TZX_MACHINE_ID_ZX80 0x0C +#define Z_TZX_MACHINE_ID_ZX81 0x0D +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_128K_ES 0x0E +#define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS2_AR 0x0F +#define Z_TZX_MACHINE_ID_MICRODIGITAL_TK_90X 0x10 +#define Z_TZX_MACHINE_ID_MICRODIGITAL_TK_95 0x11 +#define Z_TZX_MACHINE_ID_BAJT 0x12 +#define Z_TZX_MACHINE_ID_ELWRO_800_3_JUNIOR 0x13 +#define Z_TZX_MACHINE_ID_SCORPION_ZS_256 0x14 +#define Z_TZX_MACHINE_ID_CPC_464 0x15 /* added in v1.02 */ +#define Z_TZX_MACHINE_ID_CPC_664 0x16 /* added in v1.02 */ +#define Z_TZX_MACHINE_ID_CPC_6128 0x17 /* added in v1.02 */ +#define Z_TZX_MACHINE_ID_CPC_464_PLUS 0x18 /* added in v1.02 */ +#define Z_TZX_MACHINE_ID_CPC_6128_PLUS 0x19 /* added in v1.02 */ +#define Z_TZX_MACHINE_ID_JUPITER_ACE 0x1A /* added in v1.12 */ +#define Z_TZX_MACHINE_ID_ENTERPRISE 0x1B /* added in v1.12 */ +#define Z_TZX_MACHINE_ID_COMMODORE_64 0x1C /* added in v1.13 */ +#define Z_TZX_MACHINE_ID_COMMODORE_128 0x1D /* added in v1.13 */ +#define Z_TZX_MACHINE_ID_INVES_SPECTRUM_PLUS 0x1E /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_PROFI 0x1F /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_GRANDROMMAX 0x20 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_KAY_1024 0x21 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_HC_91 0x22 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_HC_2000 0x23 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_MISTRUM 0x24 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_QUORUM_128 0x25 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_ATM 0x26 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_ATM_TURBO_2 0x27 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_CHROME 0x28 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_ZX_BADA_LOC 0x29 /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_1500 0x2A /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_PC_8300 0x2B /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_TK95 0x2C /* added in v1.20 */ +#define Z_TZX_MACHINE_ID_ZX97_LITE 0x2D /* added in v1.20 */ + +#define Z_TZX_STORAGE_ID_ZX_MICRODRIVE 0x00 +#define Z_TZX_STORAGE_ID_OPUS_DISCOVERY_1 0x01 +#define Z_TZX_STORAGE_ID_DISCIPLE 0x02 +#define Z_TZX_STORAGE_ID_PLUSD 0x03 +#define Z_TZX_STORAGE_ID_WAFADRIVE 0x04 +#define Z_TZX_STORAGE_ID_BETA_DISK_INTERFACE 0x05 +#define Z_TZX_STORAGE_ID_BYTE_DRIVE_500 0x06 +#define Z_TZX_STORAGE_ID_WATFORD /* What model? */ 0x07 +#define Z_TZX_STORAGE_ID_FIZ 0x08 +#define Z_TZX_STORAGE_ID_TRITON_QUICK_DISK 0x09 +#define Z_TZX_STORAGE_ID_DIDAKTIK_40_80 0x0A +#define Z_TZX_STORAGE_ID_MB_02_PLUS 0x0B +#define Z_TZX_STORAGE_ID_ZX_SPECTRUM_PLUS3_DISK_DRIVE 0x0C +#define Z_TZX_STORAGE_ID_OLIGER_DISK_INTERFACE 0x0D +#define Z_TZX_STORAGE_ID_TIMEX_FDD_3000 0x0E +#define Z_TZX_STORAGE_ID_ZEBRA_FLOPPY_DISK_DRIVE 0x0F +#define Z_TZX_STORAGE_ID_MILLENA_K 0x10 +#define Z_TZX_STORAGE_ID_LARKEN 0x11 +#define Z_TZX_STORAGE_ID_KEMPSTON_DISC_INTERFACE 0x12 /* added in v1.20 */ +#define Z_TZX_STORAGE_ID_SANDY 0x13 /* added in v1.20 */ +#define Z_TZX_STORAGE_ID_ZX_SPECTRUM_PLUS3E_HDD 0x14 /* added in v1.20 */ +#define Z_TZX_STORAGE_ID_ZXATASP 0x15 /* added in v1.20 */ +#define Z_TZX_STORAGE_ID_DIVIDE 0x16 /* added in v1.20 */ +#define Z_TZX_STORAGE_ID_ZXCF 0x17 /* added in v1.20 */ + +#define Z_TZX_MEMORY_ID_SAM_RAM 0x00 +#define Z_TZX_MEMORY_ID_MULTIFACE_ONE 0x01 +#define Z_TZX_MEMORY_ID_MULTIFACE_128 0x02 +#define Z_TZX_MEMORY_ID_MULTIFACE_3 0x03 +#define Z_TZX_MEMORY_ID_MULTIPRINT 0x04 +#define Z_TZX_MEMORY_ID_MB_02_PLUS 0x05 +#define Z_TZX_MEMORY_ID_SOFT_ROM 0x06 /* added in v1.20 */ +#define Z_TZX_MEMORY_ID_1K 0x07 /* added in v1.20 */ +#define Z_TZX_MEMORY_ID_16K 0x08 /* added in v1.20 */ +#define Z_TZX_MEMORY_ID_48K 0x09 /* added in v1.20 */ +#define Z_TZX_MEMORY_ID_8K_16K_USED 0x0A /* added in v1.20 */ + +#define Z_TZX_SOUND_ID_CLASSIC_AY 0x00 /* (compatible with 128K ZXs) */ +#define Z_TZX_SOUND_ID_FULLER_BOX_AY 0x01 +#define Z_TZX_SOUND_ID_CURRAH_MICROSPEECH 0x02 +#define Z_TZX_SOUND_ID_SPECDRUM 0x03 +#define Z_TZX_SOUND_ID_AY_ACB_STEREO_MELODIK 0x04 +#define Z_TZX_SOUND_ID_AY_ABC_STEREO 0x05 +#define Z_TZX_SOUND_ID_MUSIC_MACHINE 0x06 /* added in v1.20 */ +#define Z_TZX_SOUND_ID_COVOX 0x07 /* added in v1.20 */ +#define Z_TZX_SOUND_ID_GENERAL_SOUND 0x08 /* added in v1.20 */ +#define Z_TZX_SOUND_ID_DIGITAL_INTERFACE_B8001 0x09 /* added in v1.20 */ +#define Z_TZX_SOUND_ID_ZON_X_AY 0x0A /* added in v1.20 */ +#define Z_TZX_SOUND_ID_QUICKSILVA_AY 0x0B /* added in v1.20 */ +#define Z_TZX_SOUND_ID_JUPITER_ACE 0x0C /* added in v1.20 */ + +#define Z_TZX_JOYSTICK_ID_KEMPSTON 0x00 +#define Z_TZX_JOYSTICK_ID_STAR_CURSOR_PROTEK_AGF 0x01 +#define Z_TZX_JOYSTICK_ID_ZX_INTERFACE_2_LEFT 0x02 +#define Z_TZX_JOYSTICK_ID_ZX_INTERFACE_2_RIGHT 0x03 +#define Z_TZX_JOYSTICK_ID_FULLER 0x04 + +#define Z_TZX_MICE_ID_AMX_MOUSE 0x00 +#define Z_TZX_MICE_ID_KEMPSTON_MOUSE 0x01 + +#define Z_TZX_HARDWARE_ID_TRICKSTICK 0x00 +#define Z_TZX_HARDWARE_ID_SINCLAIR_LIGHT_GUN 0x01 +#define Z_TZX_HARDWARE_ID_ZEBRA_GRAPHICS_TABLET /* correct name? */ 0x02 +#define Z_TZX_HARDWARE_ID_DEFENDER_LIGHT_GUN 0x03 /* added in v1.20 */ + +#define Z_TZX_SERIAL_PORT_ID_ZX_INTERFACE_1 0x00 +#define Z_TZX_SERIAL_PORT_ID_ZX_SPECTRUM_PLUS_128K 0x01 + +#define Z_TZX_PARALLEL_PORT_ID_KEMPSTON_CENTRONICS_INTERFACE_S 0x00 +#define Z_TZX_PARALLEL_PORT_ID_KEMPSTON_CENTRONICS_INTERFACE_E 0x01 +#define Z_TZX_PARALLEL_PORT_ID_ZX_SPECTRUM_PLUS3 0x02 +#define Z_TZX_PARALLEL_PORT_ID_TASMAN_PARALLEL_PRINTER_INTERFACE 0x03 +#define Z_TZX_PARALLEL_PORT_ID_DKTRONICS_PARALLEL_CENTRONICS_INTERFACE 0x04 +#define Z_TZX_PARALLEL_PORT_ID_HILDERBAY_INTERFACE 0x05 +#define Z_TZX_PARALLEL_PORT_ID_INES_PRINTERFACE /* ? */ 0x06 +#define Z_TZX_PARALLEL_PORT_ID_ZX_LPRINT_III 0x07 +#define Z_TZX_PARALLEL_PORT_ID_MULTIPRINT 0x08 +#define Z_TZX_PARALLEL_PORT_ID_OPUS_DISCOVERY_1 0x09 +#define Z_TZX_PARALLEL_PORT_ID_STD_8255_IC_WITH_PORTS_31_63_95 0x0A + +#define Z_TZX_PRINTER_ID_ZX_PRINTER_COMPATIBLE 0x00 +#define Z_TZX_PRINTER_ID_GENERIC_PRINTER 0x01 +#define Z_TZX_PRINTER_ID_EPSON_COMPATIBLE 0x02 + +#define Z_TZX_MODEM_ID_PRISM_VTX5000 0x00 +#define Z_TZX_MODEM_ID_TS_2050 0x01 + +#define Z_TZX_DIGITIZER_ID_RD_DIGITAL_TRACER 0x00 +#define Z_TZX_DIGITIZER_ID_DKTRONICS_LIGHT_PEN 0x01 +#define Z_TZX_DIGITIZER_ID_GRAFPAD 0x02 +#define Z_TZX_DIGITIZER_ID_VIDEOFACE 0x03 /* added in v1.20 */ + +#define Z_TZX_NETWORK_ADAPTER_ID_ZX_INTERFACE_1 0x00 + +#define Z_TZX_KEYBOARD_ID_ZX_SPECTRUM_PLUS_128K_KEYPAD 0x00 + +#define Z_TZX_ADC_DAC_ID_ADC8 0x00 +#define Z_TZX_ADC_DAC_ID_BLACKBOARD_ELECTRONICS /* ? */ 0x01 + +#define Z_TZX_EPROM_PROGRAMMER_ID_ORME_EPROM_CARD 0x00 + +#define Z_TZX_GRAPHICS_ID_WRX_HI_RES /* correct name? */ 0x00 /* added in v1.20 */ +#define Z_TZX_GRAPHICS_ID_G007 0x01 /* added in v1.20 */ +#define Z_TZX_GRAPHICS_ID_MEMOTECH /* Memopak HRG? */ 0x02 /* added in v1.20 */ +#define Z_TZX_GRAPHICS_ID_LAMBDA_8300 0x03 /* added in v1.20 */ + +#define Z_TZX_HARDWARE_COMPATIBILITY_COMPATIBLE 0 +#define Z_TZX_HARDWARE_COMPATIBILITY_NEEDED 1 +#define Z_TZX_HARDWARE_COMPATIBILITY_UNNEEDED 2 +#define Z_TZX_HARDWARE_COMPATIBILITY_INCOMPATIBLE 3 + +/* MARK: - ID 34h - Emulation Information (deprecated in v1.20) */ +/*-----------------------------------------------------------------------------. +| This is a special block that would normally be generated only by emulators. | +| For now it contains information on everything the authors could find that | +| other formats support. Please inform them of any additions/corrections since | +| this is a very important part for emulators. | +| Those bits that are not used by the emulator that stored the info, should be | +| left at their DEFAULT values. | +'==============================================================================' + +Flags (16-bit little-endian): + + loading_ _featatures__ +.-/ \-/ \-. +| 15..10 9 8 7 6 5 4 3 2 1 0 | +'-\____/-|-|-|-|-|-\_/-|-|-|-' + unused | | | | | | | | '-- R register emulation + | | | | | | | '---- LDIR instruction emulation + | | | | | | '------ high resolution colour emulation with + | | | | | | true interrupt frequency + | | | | | '--------- video synchronisation + | | | | | (1 = high, 3 = low, 0 or 2 = normal) + | | | | '------------ fast loading when ROM load routine is used + | | | '-------------- border emulation + | | '---------------- screen refresh mode (1 = ON, 0 = OFF) + | '------------------ start playing the tape immediately + '-------------------- auto type LOAD"" or press ENTER when in 128K mode */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + + struct {Z_BIT_FIELD_MEMBERS(8, 7)( + zuint8 screen_refresh_mode :1, + zuint8 screen_border :1, + zuint8 fast_loading :1, + zuint8 vsync :2, + zuint8 hrc_with_true_frequency :1, + zuint8 ldir_instruction :1, + zuint8 r_register :1 + )} features; + + struct {Z_BIT_FIELD_MEMBERS(8, 3)( + zuint8 unused :6, + zuint8 type_load_or_press_enter_if_128k :1, + zuint8 autoplay :1 + )} loading; + + zuint8 screen_refresh_delay; /* 1 - 255 */ + zuint16 interrupt_hz; /* 0 - 999 */ + zuint8 reserved[3]; +} Z_PACKED_STRUCTURE_END Z_TZXEmulationInfo; + +#define Z_TZX_EMULATION_INFO_VSYNC_HIGH 0 +#define Z_TZX_EMULATION_INFO_VSYNC_LOW 1 +#define Z_TZX_EMULATION_INFO_VSYNC_NORMAL 2 + +/* MARK: - ID 35h - Custom Information ("added" in v1.01, deprecated in v1.20) */ +/*-----------------------------------------------------------------------------. +| This block can be used to save any information you want. For example, it | +| might contain some information written by a utility, extra settings required | +| by a particular emulator, or even poke data. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 content_id[16]; + zuint32 data_size; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXCustomInfo; + +#define Z_TZX_CUSTOM_INFO_CONTENT_ID_POKES \ + 'P','O','K','E','s',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' + +#define Z_TZX_CUSTOM_INFO_CONTENT_ID_INSTRUCTIONS \ + 'I','n','s','t','r','u','c','t','i','o','n','s',' ',' ',' ',' ' + +#define Z_TZX_CUSTOM_INFO_CONTENT_ID_SCREEN \ + 'S','p','e','c','t','r','u','m',' ','S','c','r','e','e','n',' ' + +#define Z_TZX_CUSTOM_INFO_CONTENT_ID_ZX_EDIT_DOCUMENT \ + 'Z','X','-','E','d','i','t',' ','d','o','c','u','m','e','n','t' + +#define Z_TZX_CUSTOM_INFO_CONTENT_ID_PICTURE \ + 'P','i','c','t','u','r','e',' ',' ',' ',' ',' ',' ',' ',' ',' ' + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 description_size; + Z_FAM(zuint8 description[];) +} Z_PACKED_STRUCTURE_END Z_TZXPOKEs; + +/*typedef Z_PACKED_STRUCTURE_BEGIN { +} Z_PACKED_STRUCTURE_END Z_TZXTrainer;*/ + +/*typedef Z_PACKED_STRUCTURE_BEGIN { +} Z_PACKED_STRUCTURE_END Z_TZXInstructions;*/ + +/*typedef Z_PACKED_STRUCTURE_BEGIN { +} Z_PACKED_STRUCTURE_END Z_TZXScreen;*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 description_size; /* if 0 then handle description as 'Instructions' */ + Z_FAM(zuint8 description[];) + /* ZX-Editor document (.ZED file) data */ +} Z_PACKED_STRUCTURE_END Z_TZXZXEditDocument; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 format; + zuint8 description_size; /* if 0 then handle description as 'Inlay Card' */ + Z_FAM(zuint8 description[];) + /* Picture data */ +} Z_PACKED_STRUCTURE_END Z_TZXPicture; + +#define Z_TZX_PICTURE_FORMAT_GIF 0x00 +#define Z_TZX_PICTURE_FORMAT_JPG 0x01 + +/* MARK: - ID 40h - Snapshot (added in v1.10, deprecated in v1.20) */ +/*-----------------------------------------------------------------------------. +| This would enable one to snapshot the prgram at the start and still have all | +| the tape blocks in the same file. Only .Z80 and .SNA snapshots are supported | +| for compatibility reasons! | +| The emulator should take care of that the snapshot is not taken while the | +| actual tape loading is taking place (which doesn't do much sense). When an | +| emulator encounters the snapshot block it should load it and then continue | +| with the next block. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 format; + zuint8 size[3]; + Z_FAM(zuint8 data[];) +} Z_PACKED_STRUCTURE_END Z_TZXSnapshot; + +#define Z_TZX_SNAPSHOT_FORMAT_Z80 0 +#define Z_TZX_SNAPSHOT_FORMAT_SNA 1 + +/* MARK: - ID 5Ah - "Glue" */ +/*-----------------------------------------------------------------------------. +| This block is generated when you merge two ZX Tape files together. It is | +| here so that you can easily copy the files together and use them. Of course, | +| this means that resulting file would be 10 bytes longer than if this block | +| was not used. All you have to do if you encounter this block ID is to skip | +| next 9 bytes. | +| If you can avoid using this block for this purpose, then do so; it is | +| preferable to use a utility to join the two files and ensure that they are | +| both of the higher version number. | +'=============================================================================*/ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint8 signature[6]; /* 'XTape!' */ + zuint8 eof_marker; /* 1Ah */ + zuint8 major_version; + zuint8 minor_version; +} Z_PACKED_STRUCTURE_END Z_TZXGlue; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 block_id; + zuint32 block_size; +} Z_PACKED_STRUCTURE_END Z_TZXUnknown; + +/* MARK: - Block union */ + +typedef union { + zuint8 id; + Z_TZXStdSpeedData std_speed_data; + Z_TZXTurboSpeedData turbo_speed_data; + Z_TZXPureTone pure_tone; + Z_TZXPulseSequence pulse_sequence; + Z_TZXPureData pure_data; + Z_TZXDirectRecording direct_recording; + Z_TZXC64ROMTypeData c64_rom_type_data; + Z_TZXC64TurboTapeData c64_turbo_tape_data; + Z_TZXCSWRecording csw_recording; + Z_TZXGeneralizedData generalized_data; + Z_TZXSymbolDefinition symbol_definition; + Z_TZXPause pause; + Z_TZXGroupStart group_start; + Z_TZXJump jump; + Z_TZXLoopStart loop_start; + Z_TZXCallSequence call_sequence; + Z_TZXSelect select; + Z_TZXStopIf48K stop_if_48k; + Z_TZXSetSignalLevel set_signal_level; + Z_TZXSectionDescription section_description; + Z_TZXMessage message; + Z_TZXInfo info; + Z_TZXHardwareInfo hardware_info; + Z_TZXEmulationInfo emulation_info; + Z_TZXCustomInfo custom_info; + Z_TZXSnapshot snapshot; + Z_TZXGlue glue; + Z_TZXUnknown unknown; +} Z_TZXBlock; + +#endif /* Z_formats_storage_medium_image_audio_TZX_H */ diff --git a/projects/Zeta/API/Z/formats/storage_medium_image/audio/Warajevo_TAP.h b/projects/Zeta/API/Z/formats/storage_medium_image/audio/Warajevo_TAP.h new file mode 100644 index 0000000..c23e12d --- /dev/null +++ b/projects/Zeta/API/Z/formats/storage_medium_image/audio/Warajevo_TAP.h @@ -0,0 +1,34 @@ +/* Zeta API - Z/formats/storage_medium_image/audio/Warajevo TAP.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + +.------------------------------------------------------------------. +| Extensions: tap | +| Endianness: Little | +| Created by: Juric, Zeljko - Ribic, Samir (aka Megaribi) | +| Used by: Warajevo [MS-DOS] and some old ZX Spectrum emulators | +'=================================================================*/ + +#ifndef Z_formats_storage_medium_image_audio_Warajevo_TAP_H +#define Z_formats_storage_medium_image_audio_Warajevo_TAP_H + +#include +#include + +typedef Z_PACKED_STRUCTURE_BEGIN { + zsint32 first_block_offset; + zsint32 last_block_offset; + zuint32 eof_marker; +} Z_PACKED_STRUCTURE_END Z_WarajevoTAPHeader; + +typedef Z_PACKED_STRUCTURE_BEGIN { + zsint32 previous_block_offset; + zsint32 next_block_offset; + zuint16 data_size; +} Z_PACKED_STRUCTURE_END Z_WarajevoTAPBlockHeader; + +#endif /* Z_formats_storage_medium_image_audio_Warajevo_TAP_H */ diff --git a/projects/Zeta/API/Z/functions/Objective-C.hpp b/projects/Zeta/API/Z/functions/Objective-C.hpp new file mode 100644 index 0000000..12d49f2 --- /dev/null +++ b/projects/Zeta/API/Z/functions/Objective-C.hpp @@ -0,0 +1,41 @@ +/* Zeta API - Z/functions/Objective-C.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_Objective_C_HPP +#define Z_functions_Objective_C_HPP + +#include +#include +#include + + +namespace Zeta {namespace ObjectiveC { +/* +# if Z_ISA_IS(X86_64) + template + Z_INLINE typename TypeIf::is_class, rr>::type +# elif Z_ISA_IS(X86_32) + template + Z_INLINE typename TypeIf::is_class && !Type::is_real, rr>::type +# elif Z_ISA_IS(AARCH64) + Z_INLINE r +# endif*/ + + + template + static Z_CT(CPP11) decltype(objc_msgSend) *send() Z_NOTHROW + {return objc_msgSend;} + + + template + static Z_CT(CPP11) decltype(objc_msgSendSuper) *send_super() Z_NOTHROW + {return objc_msgSendSuper;} +}} + + +#endif // Z_functions_Objective_C_HPP diff --git a/projects/Zeta/API/Z/functions/atomic.h b/projects/Zeta/API/Z/functions/atomic.h new file mode 100644 index 0000000..b83911b --- /dev/null +++ b/projects/Zeta/API/Z/functions/atomic.h @@ -0,0 +1,651 @@ +/* Zeta API - Z/functions/atomic.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_atomic_H +#define Z_functions_atomic_H + +#include + +/* MARK: - uint8 */ + +#ifdef Z_UINT8 + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_ADD_THEN_GET) +# define z_uint8_atomic_add_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_AND_THEN_GET) +# define z_uint8_atomic_and_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_ADD) +# define z_uint8_atomic_get_then_add Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_AND) +# define z_uint8_atomic_get_then_and Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_NAND) +# define z_uint8_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_OR) +# define z_uint8_atomic_get_then_or Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_uint8_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_SUBTRACT) +# define z_uint8_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_XOR) +# define z_uint8_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_NAND_THEN_GET) +# define z_uint8_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_OR_THEN_GET) +# define z_uint8_atomic_or_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_SET_IF_EQUAL) +# define z_uint8_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT8_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_SUBTRACT_THEN_GET) +# define z_uint8_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_XOR_THEN_GET) +# define z_uint8_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - sint8 */ + +#ifdef Z_SINT8 + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_ADD_THEN_GET) +# define z_sint8_atomic_add_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_AND_THEN_GET) +# define z_sint8_atomic_and_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_ADD) +# define z_sint8_atomic_get_then_add Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_AND) +# define z_sint8_atomic_get_then_and Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_NAND) +# define z_sint8_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_OR) +# define z_sint8_atomic_get_then_or Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_sint8_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_SUBTRACT) +# define z_sint8_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_XOR) +# define z_sint8_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_NAND_THEN_GET) +# define z_sint8_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_OR_THEN_GET) +# define z_sint8_atomic_or_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_SET_IF_EQUAL) +# define z_sint8_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT8_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_SUBTRACT_THEN_GET) +# define z_sint8_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_XOR_THEN_GET) +# define z_sint8_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - uint16 */ + +#ifdef Z_UINT16 + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_ADD_THEN_GET) +# define z_uint16_atomic_add_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_AND_THEN_GET) +# define z_uint16_atomic_and_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_ADD) +# define z_uint16_atomic_get_then_add Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_AND) +# define z_uint16_atomic_get_then_and Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_NAND) +# define z_uint16_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_OR) +# define z_uint16_atomic_get_then_or Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_uint16_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_SUBTRACT) +# define z_uint16_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_XOR) +# define z_uint16_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_NAND_THEN_GET) +# define z_uint16_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_OR_THEN_GET) +# define z_uint16_atomic_or_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_SET_IF_EQUAL) +# define z_uint16_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT16_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_SUBTRACT_THEN_GET) +# define z_uint16_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_XOR_THEN_GET) +# define z_uint16_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - sint16 */ + +#ifdef Z_SINT16 + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_ADD_THEN_GET) +# define z_sint16_atomic_add_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_AND_THEN_GET) +# define z_sint16_atomic_and_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_ADD) +# define z_sint16_atomic_get_then_add Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_AND) +# define z_sint16_atomic_get_then_and Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_NAND) +# define z_sint16_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_OR) +# define z_sint16_atomic_get_then_or Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_sint16_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_SUBTRACT) +# define z_sint16_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_XOR) +# define z_sint16_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_NAND_THEN_GET) +# define z_sint16_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_OR_THEN_GET) +# define z_sint16_atomic_or_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_SET_IF_EQUAL) +# define z_sint16_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT16_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_SUBTRACT_THEN_GET) +# define z_sint16_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_XOR_THEN_GET) +# define z_sint16_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - uint32 */ + +#ifdef Z_UINT32 + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_ADD_THEN_GET) +# define z_uint32_atomic_add_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_AND_THEN_GET) +# define z_uint32_atomic_and_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_ADD) +# define z_uint32_atomic_get_then_add Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_AND) +# define z_uint32_atomic_get_then_and Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_NAND) +# define z_uint32_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_OR) +# define z_uint32_atomic_get_then_or Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_uint32_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_SUBTRACT) +# define z_uint32_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_XOR) +# define z_uint32_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_NAND_THEN_GET) +# define z_uint32_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_OR_THEN_GET) +# define z_uint32_atomic_or_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_SET_IF_EQUAL) +# define z_uint32_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT32_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_SUBTRACT_THEN_GET) +# define z_uint32_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_XOR_THEN_GET) +# define z_uint32_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - sint32 */ + +#ifdef Z_SINT32 + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_ADD_THEN_GET) +# define z_sint32_atomic_add_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_AND_THEN_GET) +# define z_sint32_atomic_and_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_ADD) +# define z_sint32_atomic_get_then_add Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_AND) +# define z_sint32_atomic_get_then_and Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_NAND) +# define z_sint32_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_OR) +# define z_sint32_atomic_get_then_or Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_sint32_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_SUBTRACT) +# define z_sint32_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_XOR) +# define z_sint32_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_NAND_THEN_GET) +# define z_sint32_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_OR_THEN_GET) +# define z_sint32_atomic_or_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_SET_IF_EQUAL) +# define z_sint32_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT32_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_SUBTRACT_THEN_GET) +# define z_sint32_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_XOR_THEN_GET) +# define z_sint32_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - uint64 */ + +#ifdef Z_UINT64 + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_ADD_THEN_GET) +# define z_uint64_atomic_add_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_AND_THEN_GET) +# define z_uint64_atomic_and_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_ADD) +# define z_uint64_atomic_get_then_add Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_AND) +# define z_uint64_atomic_get_then_and Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_NAND) +# define z_uint64_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_OR) +# define z_uint64_atomic_get_then_or Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_uint64_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_SUBTRACT) +# define z_uint64_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_XOR) +# define z_uint64_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_NAND_THEN_GET) +# define z_uint64_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_OR_THEN_GET) +# define z_uint64_atomic_or_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_SET_IF_EQUAL) +# define z_uint64_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT64_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_SUBTRACT_THEN_GET) +# define z_uint64_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_SUBTRACT_THEN_GET) +# endif + +#endif + +/* MARK: - sint64 */ + +#ifdef Z_SINT64 + +# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_XOR_THEN_GET) +# define z_uint64_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_XOR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_ADD_THEN_GET) +# define z_sint64_atomic_add_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_AND_THEN_GET) +# define z_sint64_atomic_and_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_ADD) +# define z_sint64_atomic_get_then_add Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_AND) +# define z_sint64_atomic_get_then_and Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_NAND) +# define z_sint64_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_OR) +# define z_sint64_atomic_get_then_or Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_sint64_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_SUBTRACT) +# define z_sint64_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_XOR) +# define z_sint64_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_NAND_THEN_GET) +# define z_sint64_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_OR_THEN_GET) +# define z_sint64_atomic_or_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_SET_IF_EQUAL) +# define z_sint64_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT64_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_SUBTRACT_THEN_GET) +# define z_sint64_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_XOR_THEN_GET) +# define z_sint64_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - uint128 */ + +#ifdef Z_UINT128 + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_ADD_THEN_GET) +# define z_uint128_atomic_add_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_AND_THEN_GET) +# define z_uint128_atomic_and_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_ADD) +# define z_uint128_atomic_get_then_add Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_AND) +# define z_uint128_atomic_get_then_and Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_NAND) +# define z_uint128_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_OR) +# define z_uint128_atomic_get_then_or Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_uint128_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_SUBTRACT) +# define z_uint128_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_XOR) +# define z_uint128_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_NAND_THEN_GET) +# define z_uint128_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_OR_THEN_GET) +# define z_uint128_atomic_or_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_SET_IF_EQUAL) +# define z_uint128_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT128_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_SUBTRACT_THEN_GET) +# define z_uint128_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_XOR_THEN_GET) +# define z_uint128_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - sint128 */ + +#ifdef Z_SINT128 + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_ADD_THEN_GET) +# define z_sint128_atomic_add_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_ADD_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_AND_THEN_GET) +# define z_sint128_atomic_and_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_AND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_ADD) +# define z_sint128_atomic_get_then_add Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_ADD) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_AND) +# define z_sint128_atomic_get_then_and Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_AND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_NAND) +# define z_sint128_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_NAND) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_OR) +# define z_sint128_atomic_get_then_or Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_OR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL) +# define z_sint128_atomic_get_then_set_if_equal Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_SUBTRACT) +# define z_sint128_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_SUBTRACT) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_XOR) +# define z_sint128_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_XOR) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_NAND_THEN_GET) +# define z_sint128_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_NAND_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_OR_THEN_GET) +# define z_sint128_atomic_or_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_OR_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_SET_IF_EQUAL) +# define z_sint128_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT128_ATOMIC_SET_IF_EQUAL) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_SUBTRACT_THEN_GET) +# define z_sint128_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_SUBTRACT_THEN_GET) +# endif + +# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_XOR_THEN_GET) +# define z_sint128_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_XOR_THEN_GET) +# endif + +#endif + +/* MARK: - Function selectors */ + +#define z_T_atomic_add_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_add_then_get ) +#define z_T_atomic_and_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_and_then_get ) +#define z_T_atomic_get_then_add( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_add ) +#define z_T_atomic_get_then_and( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_and ) +#define z_T_atomic_get_then_nand( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_nand ) +#define z_T_atomic_get_then_or( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_or ) +#define z_T_atomic_get_then_set_if_equal(T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_set_if_equal) +#define z_T_atomic_get_then_subtract( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_subtract ) +#define z_T_atomic_get_then_xor( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_get_then_xor ) +#define z_T_atomic_nand_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_nand_then_get ) +#define z_T_atomic_or_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_or_then_get ) +#define z_T_atomic_set_if_equal( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_set_if_equal ) +#define z_T_atomic_subtract_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_subtract_then_get ) +#define z_T_atomic_xor_then_get( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _atomic_xor_then_get ) + +#endif /* Z_functions_atomic_H */ diff --git a/projects/Zeta/API/Z/functions/bitwise.h b/projects/Zeta/API/Z/functions/bitwise.h new file mode 100644 index 0000000..2063098 --- /dev/null +++ b/projects/Zeta/API/Z/functions/bitwise.h @@ -0,0 +1,144 @@ +/* Zeta API - Z/functions/bitwise.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_bitwise_H +#define Z_functions_bitwise_H + +#include +#include + + +#define Z_z_NATURAL_FLIP(type, TYPE, chunk_bits) \ + \ + static Z_INLINE \ + z##type z_##type##_flip_##chunk_bits(z##type value) \ + {return Z_##TYPE##_FLIP_##chunk_bits(value);} + + +#define Z_z_NATURAL_REVERSE(type, TYPE, chunk_bits) \ + \ + static Z_INLINE \ + z##type z_##type##_reverse_##chunk_bits(z##type value) \ + {return Z_##TYPE##_REVERSE_##chunk_bits(value);} + + +#define Z_z_NATURAL_ROTATE(type, TYPE) \ + \ + static Z_INLINE \ + z##type z_##type##_rotate_left(z##type value, zuint rotation) \ + {return Z_##TYPE##_ROTATE_LEFT(value, rotation);} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_rotate_right(z##type value, zuint rotation) \ + {return Z_##TYPE##_ROTATE_RIGHT(value, rotation);} + + +#ifdef Z_UINT8 + Z_z_NATURAL_REVERSE(uint8, UINT8, 4) + Z_z_NATURAL_ROTATE (uint8, UINT8) + +# define z_uint8_reverse Z_SAME +# define z_uint8_little_endian Z_SAME +# define z_uint8_big_endian Z_SAME +# define z_uint8_pdp_endian Z_SAME +#endif + +#ifdef Z_UINT16 + Z_z_NATURAL_REVERSE(uint16, UINT16, 8) + Z_z_NATURAL_ROTATE (uint16, UINT16) + +# if Z_ISA_INTEGRAL_ENDIANNESS != Z_ENDIANNESS_BIG +# define z_uint16_little_endian Z_SAME +# define z_uint16_big_endian z_uint16_reverse_8 +# define z_uint16_pdp_endian Z_SAME +# else +# define z_uint16_little_endian z_uint16_reverse_8 +# define z_uint16_big_endian Z_SAME +# define z_uint16_pdp_endian z_uint16_reverse_8 +# endif +#endif + +#ifdef Z_UINT32 + Z_z_NATURAL_FLIP (uint32, UINT32, 8) + Z_z_NATURAL_REVERSE(uint32, UINT32, 8) + Z_z_NATURAL_REVERSE(uint32, UINT32, 16) + Z_z_NATURAL_ROTATE (uint32, UINT32) + +# if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define z_uint32_little_endian Z_SAME +# define z_uint32_big_endian z_uint32_reverse_8 +# define z_uint32_pdp_endian z_uint32_reverse_16 +# elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define z_uint32_little_endian z_uint32_reverse_8 +# define z_uint32_big_endian Z_SAME +# define z_uint32_pdp_endian z_uint32_flip_8 +# else +# define z_uint32_little_endian z_uint32_reverse_16 +# define z_uint32_big_endian z_uint32_flip_8 +# define z_uint32_pdp_endian Z_SAME +# endif +#endif + +#ifdef Z_UINT64 + Z_z_NATURAL_FLIP (uint64, UINT64, 8) + Z_z_NATURAL_REVERSE(uint64, UINT64, 8) + Z_z_NATURAL_REVERSE(uint64, UINT64, 16) + Z_z_NATURAL_REVERSE(uint64, UINT64, 32) + Z_z_NATURAL_ROTATE (uint64, UINT64) + +# if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define z_uint64_little_endian Z_SAME +# define z_uint64_big_endian z_uint64_reverse_8 +# define z_uint64_pdp_endian z_uint64_reverse_16 +# elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define z_uint64_little_endian z_uint64_reverse_8 +# define z_uint64_big_endian Z_SAME +# define z_uint64_pdp_endian z_uint64_flip_8 +# else +# define z_uint64_little_endian z_uint64_reverse_16 +# define z_uint64_big_endian z_uint64_flip_8 +# define z_uint64_pdp_endian Z_SAME +# endif +#endif + +#ifdef Z_UINT128 + Z_z_NATURAL_FLIP (uint128, UINT128, 8) + Z_z_NATURAL_REVERSE(uint128, UINT128, 8) + Z_z_NATURAL_REVERSE(uint128, UINT128, 16) + Z_z_NATURAL_REVERSE(uint128, UINT128, 32) + Z_z_NATURAL_REVERSE(uint128, UINT128, 64) + Z_z_NATURAL_ROTATE (uint128, UINT128) + +# if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define z_uint128_little_endian Z_SAME +# define z_uint128_big_endian z_uint128_reverse_8 +# define z_uint128_pdp_endian z_uint128_reverse_16 + +# elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define z_uint128_little_endian z_uint128_reverse_8 +# define z_uint128_big_endian Z_SAME +# define z_uint128_pdp_endian z_uint128_flip_8 +# else +# define z_uint128_little_endian z_uint128_reverse_16 +# define z_uint128_big_endian z_uint128_flip_8 +# define z_uint128_pdp_endian Z_SAME +# endif +#endif + +#undef Z_z_NATURAL_FLIP +#undef Z_z_NATURAL_REVERSE +#undef Z_z_NATURAL_ROTATE + +#define z_T_little_endian(T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _little_endian) +#define z_T_big_endian( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _big_endian ) +#define z_T_pdp_endian( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _pdp_endian ) +#define z_T_rotate_left( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _rotate_left ) +#define z_T_rotate_right( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _rotate_right ) + +#endif /* Z_functions_bitwise_H */ diff --git a/projects/Zeta/API/Z/functions/buffer.h b/projects/Zeta/API/Z/functions/buffer.h new file mode 100644 index 0000000..8d6a38e --- /dev/null +++ b/projects/Zeta/API/Z/functions/buffer.h @@ -0,0 +1,84 @@ +/* Zeta API - Z/functions/buffer.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2012 Remis. +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_buffer_H +#define Z_functions_buffer_H + +#include +#include +#include +#include + + +static Z_INLINE +void z_triple_buffer_initialize( + ZTripleBuffer* self, + void* slot_0, + void* slot_1, + void* slot_2 +) + { + self->slots[0] = slot_0; + self->slots[1] = slot_1; + self->slots[2] = slot_2; + self->f = 6; + } + + +static Z_INLINE +void *z_triple_buffer_consume(ZTripleBuffer *self) + { + zuchar fi, fo; + + do { + if (!((fi = self->f) & 64)) return Z_NULL; + fo = (zuchar)((fi & 48) | ((fi & 12) >> 2) | ((fi & 3) << 2)); + } + while (!z_T_atomic_set_if_equal(UCHAR)(&self->f, fi, fo)); + + return self->slots[fo & 3]; + } + + +static Z_INLINE +void *z_triple_buffer_consumption(ZTripleBuffer const *self) + {return self->slots[self->f & 3];} + + +static Z_INLINE +zuchar z_triple_buffer_consumption_index(ZTripleBuffer const *self) + {return self->f & 3;} + + +static Z_INLINE +void *z_triple_buffer_produce(ZTripleBuffer *self) + { + zuchar fi, fo; + + do { + fi = self->f; + fo = (zuchar)(64 | ((fi & 48) >> 2) | ((fi & 12) << 2) | (fi & 3)); + } + while (!z_T_atomic_set_if_equal(UCHAR)(&self->f, fi, fo)); + + return self->slots[(fo & 48) >> 4]; + } + + +static Z_INLINE +void *z_triple_buffer_production(ZTripleBuffer const *self) + {return self->slots[(self->f & 48) >> 4];} + + +static Z_INLINE +zuchar z_triple_buffer_production_index(ZTripleBuffer const *self) + {return (self->f & 48) >> 4;} + + +#endif /* Z_functions_buffer_H */ diff --git a/projects/Zeta/API/Z/functions/calendar.h b/projects/Zeta/API/Z/functions/calendar.h new file mode 100644 index 0000000..8f5a7ad --- /dev/null +++ b/projects/Zeta/API/Z/functions/calendar.h @@ -0,0 +1,36 @@ +/* Zeta API - Z/functions/calendar.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_calendar_H +#define Z_functions_calendar_H + +#include +#include + + +static Z_INLINE +boolean z_gregorian_year_is_leap(zulong year) + {return Z_GREGORIAN_YEAR_IS_LEAP(year);} + + +static Z_INLINE +zuint8 z_gregorian_year_days_in_month(zulong year, zuint8 month) + { + return month == 2 + ? (Z_GREGORIAN_YEAR_IS_LEAP(year) ? 29 : 28) + : (month == 4 || month == 6 || month == 9 || month == 11 + ? 30 : 31); + } + + +static Z_INLINE +boolean z_julian_year_is_leap(zulong year) + {return Z_JULIAN_YEAR_IS_LEAP(year);} + + +#endif /* Z_functions_calendar_H */ diff --git a/projects/Zeta/API/Z/functions/casting.hpp b/projects/Zeta/API/Z/functions/casting.hpp new file mode 100644 index 0000000..bab92de --- /dev/null +++ b/projects/Zeta/API/Z/functions/casting.hpp @@ -0,0 +1,58 @@ +/* Zeta API - Z/functions/casting.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_casting_HPP +#define Z_functions_casting_HPP + +#include + +#if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) +# define Z_HAS_forwardable 1 +# define Z_HAS_movable 1 + + + namespace Zeta { + template + static Z_CT(CPP11) t &&forwardable(typename Type::remove_reference &what) Z_NOTHROW + {return static_cast(what);} + + + template + static Z_CT(CPP11) t &&forwardable(typename Type::remove_reference &&what) Z_NOTHROW + {return static_cast(what);} + + + template + static Z_CT(CPP11) typename Type::remove_reference &&movable(t &&what) Z_NOTHROW + {return static_cast::remove_reference &&>(what);} + } + + +# if Z_HAS_MEMBER(Type, is_copy_constructible) && \ + Z_HAS_MEMBER(Type, is_nothrow_move_constructible) + +# include + +# define Z_HAS_movable_if_nothrow 1 + + namespace Zeta { + // TODO: Revisar + template + static Z_CT(CPP11) typename TernaryType< + Type::is_copy_constructible && !Type::is_nothrow_move_constructible, + const t&, t&& + >::type + movable_if_nothrow(t &what) Z_NOTHROW + {return movable(what);} + } + + +# endif +#endif + +#endif // Z_functions_casting_HPP diff --git a/projects/Zeta/API/Z/functions/character.h b/projects/Zeta/API/Z/functions/character.h new file mode 100644 index 0000000..7efbcbd --- /dev/null +++ b/projects/Zeta/API/Z/functions/character.h @@ -0,0 +1,85 @@ +/* Zeta API - Z/functions/character.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_character_H +#define Z_functions_character_H + +#include +#include +#include + + +static Z_INLINE zboolean z_char_is_alphanumeric(zchar value) + {return Z_CHAR_IS_ALPHANUMERIC(value);} + + +static Z_INLINE zboolean z_char_is_ascii(zchar value) + {return Z_CHAR_IS_ASCII(value);} + + +static Z_INLINE zboolean z_char_is_base_2_digit(zchar value) + {return Z_CHAR_IS_BASE_2_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_base_8_digit(zchar value) + {return Z_CHAR_IS_BASE_8_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_base_10_digit(zchar value) + {return Z_CHAR_IS_BASE_10_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_base_16_digit(zchar value) + {return Z_CHAR_IS_BASE_16_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_base_16_lowercase_digit(zchar value) + {return Z_CHAR_IS_BASE_16_LOWERCASE_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_base_16_uppercase_digit(zchar value) + {return Z_CHAR_IS_BASE_16_UPPERCASE_DIGIT(value);} + + +static Z_INLINE zboolean z_char_is_blank(zchar value) + {return Z_CHAR_IS_BLANK(value);} + + +static Z_INLINE zboolean z_char_is_control(zchar value) + {return Z_CHAR_IS_CONTROL(value);} + + +static Z_INLINE zboolean z_char_is_graphical(zchar value) + {return Z_CHAR_IS_GRAPHICAL(value);} + + +static Z_INLINE zboolean z_char_is_letter(zchar value) + {return Z_CHAR_IS_LETTER(value);} + + +static Z_INLINE zboolean z_char_is_lowercase_letter(zchar value) + {return Z_CHAR_IS_LOWERCASE_LETTER(value);} + + +static Z_INLINE zboolean z_char_is_printable(zchar value) + {return Z_CHAR_IS_PRINTABLE(value);} + + +static Z_INLINE zboolean z_char_is_uppercase_letter(zchar value) + {return Z_CHAR_IS_UPPERCASE_LETTER(value);} + + +static Z_INLINE zchar z_char_lowercase(zchar value) + {return Z_CHAR_LOWERCASE(value);} + + +static Z_INLINE zchar z_char_uppercase(zchar value) + {return Z_CHAR_UPPERCASE(value);} + + +#endif /* Z_functions_character_H */ diff --git a/projects/Zeta/API/Z/functions/class.hpp b/projects/Zeta/API/Z/functions/class.hpp new file mode 100644 index 0000000..29159bd --- /dev/null +++ b/projects/Zeta/API/Z/functions/class.hpp @@ -0,0 +1,83 @@ +/* Zeta API - Z/functions/class.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_class_HPP +#define Z_functions_class_HPP + +#include +#include +#include +#include +namespace Zeta { + + + template + static Z_INLINE USize member_offset(t c::*member) Z_NOTHROW + { + return (&reinterpret_cast(reinterpret_cast(sizeof(c))->*member) - + reinterpret_cast(sizeof(c))); + } + + + typedef void *(* DefaultInstantiator)(); + typedef void (* DefaultConstructor )(void *object); + typedef void (* Deleter )(void *object); + typedef void (* Destructor )(void *object); + + +# if Z_DIALECT_HAS(CPP11, LAMBDA) + + template + static Z_CT(CPP11) typename TypeIf< + Type::is_class && Type::is_default_constructible, + DefaultConstructor + >::type + default_constructor() Z_NOTHROW + {return [](void *object) -> void {new (object) t;};} + + + template + static Z_CT(CPP11) typename TypeIf< + !Type::is_class || !Type::is_default_constructible, + DefaultConstructor + >::type + default_constructor() Z_NOTHROW + {return Z_NULL;} + + + template + static Z_CT(CPP11) typename TypeIf< + Type::is_class && Type::is_default_constructible, + DefaultInstantiator + >::type + default_instantiator() Z_NOTHROW + {return []() -> void* {return new t();};} + + + template + static Z_CT(CPP11) typename TypeIf< + !Type::is_class || !Type::is_default_constructible, + DefaultInstantiator + >::type + default_instantiator() Z_NOTHROW + {return Z_NULL;} + + + template + static Z_CT(CPP11) Destructor destructor() Z_NOTHROW + {return [](void *object) -> void {reinterpret_cast(object)->~t();};} + + + template + static Z_CT(CPP11) Deleter deleter() Z_NOTHROW + {return [](void *object) -> void {delete reinterpret_cast(object);};} + +# endif +} + +#endif // Z_functions_class_HPP diff --git a/projects/Zeta/API/Z/functions/hash.hpp b/projects/Zeta/API/Z/functions/hash.hpp new file mode 100644 index 0000000..fca6c97 --- /dev/null +++ b/projects/Zeta/API/Z/functions/hash.hpp @@ -0,0 +1,56 @@ +/* Zeta API - Z/functions/hash.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_hash_HPP +#define Z_functions_hash_HPP + +#include +#include +#include + + +#define Z_z_FNV(type, hash_function, HASH_FUNCTION) \ + \ + Z_CT(CPP14) type hash_function(const Char *string) Z_NOTHROW \ + { \ + type hash = Z_##HASH_FUNCTION##_INITIALIZER; \ + \ + while (*string) hash = Z_##HASH_FUNCTION##_UPDATE(hash, *string++); \ + return hash; \ + } \ + \ + \ + Z_CT(CPP14) type hash_function(const Char *string, USize size) Z_NOTHROW \ + { \ + type hash = Z_##HASH_FUNCTION##_INITIALIZER; \ + \ + while (size--) hash = Z_##HASH_FUNCTION##_UPDATE(hash, *string++); \ + return hash; \ + } + + +namespace Zeta { + Z_z_FNV(UInt32, fnv0_32, FNV0_32) + Z_z_FNV(UInt32, fnv1_32, FNV1_32) + Z_z_FNV(UInt32, fnv1a_32, FNV1A_32) + +# ifdef Z_UINT64 +# define Z_HAS_fnv0_64 1 +# define Z_HAS_fnv1_64 1 +# define Z_HAS_fnv1a_64 1 + + Z_z_FNV(UInt64, fnv0_64, FNV0_64) + Z_z_FNV(UInt64, fnv1_64, FNV1_64) + Z_z_FNV(UInt64, fnv1a_64, FNV1A_64) +# endif +} + + +#undef Z_z_FNV + +#endif // Z_functions_hash_HPP diff --git a/projects/Zeta/API/Z/functions/math.h b/projects/Zeta/API/Z/functions/math.h new file mode 100644 index 0000000..9d41e4c --- /dev/null +++ b/projects/Zeta/API/Z/functions/math.h @@ -0,0 +1,768 @@ +/* Zeta API - Z/functions/math.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_math_H +#define Z_functions_math_H + +#include + + +/* MARK: - Common implementation */ + +#define Z_z_IMPLEMENTATION_COMMON(type) \ + \ + static Z_INLINE \ + z##type z_##type##_maximum(z##type a, z##type b) \ + {return Z_MAXIMUM(a, b);} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_minimum(z##type a, z##type b) \ + {return Z_MINIMUM(a, b);} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_clamp(z##type value, z##type minimum, z##type maximum) \ + {return z_##type##_minimum(z_##type##_maximum(value, minimum), maximum);} + + +#define z_T_clamp( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _clamp ) +#define z_T_maximum(T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _maximum) +#define z_T_minimum(T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL)(z_, _minimum) + + +/* MARK: - Partial implementation for signed types */ + +#define Z_z_IMPLEMENTATION_SIGNED(type) \ + \ + static Z_INLINE \ + z##type z_##type##_absolute(z##type value) \ + {return value < (z##type)0 ? -value : value;} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_sign(z##type value) \ + {return value >= (z##type)0 ? (z##type)1 : -(z##type)1;} + + +#define z_T_absolute(T) Z_INSERT_type(Z_##TYPE##_FIXED_FUNDAMENTAL(z_, _absolute) +#define z_T_sign( T) Z_INSERT_type(Z_##TYPE##_FIXED_FUNDAMENTAL(z_, _sign ) + + +/* MARK: - Implementation for real types */ + +#define Z_z_IMPLEMENTATION_REAL(type, _, epsilon, infinity) \ + \ + static Z_INLINE \ + zboolean z_##type##_are_almost_equal(z##type a, z##type b) \ + {return z_##type##_absolute(a - b) <= epsilon;} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_clamp_01(z##type value) \ + {return z_##type##_minimum(z_##type##_maximum(value, _(0.0)), _(1.0));} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_inverse_lerp(z##type a, z##type b, z##type t) \ + {return (t - a) / (b - a);} \ + \ + \ + static Z_INLINE \ + zboolean z_##type##_is_almost_zero(z##type value) \ + {return z_##type##_absolute(value) <= epsilon;} \ + \ + \ + static Z_INLINE \ + zboolean z_##type##_is_finite(z##type value) \ + {return value == value && value != infinity && value != -infinity;} \ + \ + \ + static Z_INLINE \ + zboolean z_##type##_is_infinity(z##type value) \ + {return value == infinity || value == -infinity;} \ + \ + \ + static Z_INLINE \ + zboolean z_##type##_is_nan(z##type value) \ + {return !(value == value);} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_lerp(z##type a, z##type b, z##type t) \ + {return a + t * (b - a);} \ + \ + \ + static Z_INLINE \ + z##type z_##type##_sign_or_zero(z##type value) \ + { \ + return z_##type##_absolute(value) <= epsilon \ + ? _(0.0) \ + : z_##type##_sign(value); \ + } \ + \ + \ + static Z_INLINE \ + z##type z_##type##_smootherstep(z##type a, z##type b, z##type t) \ + { \ + if (t <= a) return _(0.0); \ + if (t >= b) return _(1.0); \ + t = (t - a) / (b - a); \ + return t * t * t * (t * (t * _(6.0) - _(15.0)) + _(10.0)); \ + } \ + \ + \ + static Z_INLINE \ + z##type z_##type##_smoothstep(z##type a, z##type b, z##type t) \ + { \ + if (t <= a) return _(0.0); \ + if (t >= b) return _(1.0); \ + t = (t - a) / (b - a); \ + return t * t * (_(3.0) - _(2.0) * t); \ + } + + +#define z_T_are_almost_equal(T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _are_almost_equal) +#define z_T_clamp_01( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _clamp_01 ) +#define z_T_inverse_lerp( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _inverse_lerp ) +#define z_T_is_almost_zero( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _is_almost_zero ) +#define z_T_is_finite( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _is_finite ) +#define z_T_is_infinity( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _is_infinity ) +#define z_T_is_nan( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _is_nan ) +#define z_T_lerp( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _lerp ) +#define z_T_sign_or_zero( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _sign_or_zero ) +#define z_T_smootherstep( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _smootherstep ) +#define z_T_smoothstep( T) Z_INSERT_type(Z_##T##_FIXED_FUNDAMENTAL(z_, _smoothstep ) + + +/* MARK: - uint8 */ + +Z_z_IMPLEMENTATION_COMMON(uint8) + + +static Z_INLINE +zboolean z_uint8_addition_overflows(zuint8 a, zuint8 b) + {return (zuint16)a + (zuint16)b > Z_UINT8_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint8_addition_overflows_3(zuint8 a, zuint8 b, zuint8 c) + {return (zuint16)a + (zuint16)b + (zuint16)c > Z_UINT8_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint8_addition_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d) + {return (zuint16)a + (zuint16)b + (zuint16)c + (zuint16)d > Z_UINT8_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint8_multiplication_overflows(zuint8 a, zuint8 b) + {return (zuint16)a * (zuint16)b > Z_UINT8_MAXIMUM;} + + +/*static Z_INLINE +zboolean z_uint8_multiplication_overflows_3(zuint8 a, zuint8 b, zuint8 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint8_multiplication_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d) + {return Z_FALSE;}*/ + + +static Z_INLINE +zboolean z_uint8_subtraction_overflows(zuint8 a, zuint8 b) + {return b > a;} + + +/*static Z_INLINE +zboolean z_uint8_subtraction_overflows_3(zuint8 a, zuint8 b, zuint8 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint8_subtraction_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d) + {return Z_FALSE;}*/ + + +/* MARK: - sint8 */ + +Z_z_IMPLEMENTATION_COMMON(sint8) +Z_z_IMPLEMENTATION_SIGNED(sint8) + + +/*static Z_INLINE +zboolean z_sint8_addition_overflows(zsint8 a, zsint8 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_addition_overflows_3(zsint8 a, zsint8 b, zsint8 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_addition_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_multiplication_overflows(zsint8 a, zsint8 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_multiplication_overflows_3(zsint8 a, zsint8 b, zsint8 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_multiplication_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_subtraction_overflows(zsint8 a, zsint8 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_subtraction_overflows_3(zsint8 a, zsint8 b, zsint8 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint8_subtraction_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d) + {return Z_FALSE;}*/ + + +/* MARK: - uint16 */ + +Z_z_IMPLEMENTATION_COMMON(uint16) + + +static Z_INLINE +zboolean z_uint16_addition_overflows(zuint16 a, zuint16 b) + {return (zuint32)a + (zuint32)b > Z_UINT16_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint16_addition_overflows_3(zuint16 a, zuint16 b, zuint16 c) + {return (zuint32)a + (zuint32)b + (zuint32)c > Z_UINT16_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint16_addition_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d) + {return (zuint32)a + (zuint32)b + (zuint32)c + (zuint32)d > Z_UINT16_MAXIMUM;} + + +static Z_INLINE +zboolean z_uint16_multiplication_overflows(zuint16 a, zuint16 b) + {return (zuint32)a * (zuint32)b > Z_UINT16_MAXIMUM;} + + +/*static Z_INLINE +zboolean z_uint16_multiplication_overflows_3(zuint16 a, zuint16 b, zuint16 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint16_multiplication_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d) + {return Z_FALSE;}*/ + + +static Z_INLINE +zboolean z_uint16_subtraction_overflows(zuint16 a, zuint16 b) + {return b > a;} + + +/*static Z_INLINE +zboolean z_uint16_subtraction_overflows_3(zuint16 a, zuint16 b, zuint16 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint16_subtraction_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d) + {return Z_FALSE;}*/ + + +/* MARK: - sint16 */ + +Z_z_IMPLEMENTATION_COMMON(sint16) +Z_z_IMPLEMENTATION_SIGNED(sint16) + + +/*static Z_INLINE +zboolean z_sint16_addition_overflows(zsint16 a, zsint16 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_addition_overflows_3(zsint16 a, zsint16 b, zsint16 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_addition_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_multiplication_overflows(zsint16 a, zsint16 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_multiplication_overflows_3(zsint16 a, zsint16 b, zsint16 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_multiplication_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_subtraction_overflows(zsint16 a, zsint16 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_subtraction_overflows_3(zsint16 a, zsint16 b, zsint16 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint16_subtraction_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d) + {return Z_FALSE;}*/ + + +/* MARK: - uint32 */ + +Z_z_IMPLEMENTATION_COMMON(uint32) + + +/*static Z_INLINE +zboolean z_uint32_addition_overflows(zuint32 a, zuint32 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_addition_overflows_3(zuint32 a, zuint32 b, zuint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_addition_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_multiplication_overflows(zuint32 a, zuint32 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_multiplication_overflows_3(zuint32 a, zuint32 b, zuint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_multiplication_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_subtraction_overflows(zuint32 a, zuint32 b) + {return b > a;} + + +static Z_INLINE +zboolean z_uint32_subtraction_overflows_3(zuint32 a, zuint32 b, zuint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_uint32_subtraction_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d) + {return Z_FALSE;}*/ + + +/* MARK: - sint32 */ + +Z_z_IMPLEMENTATION_COMMON(sint32) +Z_z_IMPLEMENTATION_SIGNED(sint32) + + +/*static Z_INLINE +zboolean z_sint32_addition_overflows(zsint32 a, zsint32 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_addition_overflows_3(zsint32 a, zsint32 b, zsint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_addition_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_multiplication_overflows(zsint32 a, zsint32 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_multiplication_overflows_3(zsint32 a, zsint32 b, zsint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_multiplication_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_subtraction_overflows(zsint32 a, zsint32 b) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_subtraction_overflows_3(zsint32 a, zsint32 b, zsint32 c) + {return Z_FALSE;} + + +static Z_INLINE +zboolean z_sint32_subtraction_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d) + {return Z_FALSE;}*/ + + +/* MARK: - uint64 */ + +#ifdef Z_UINT64 + + Z_z_IMPLEMENTATION_COMMON(uint64) + + + /*static Z_INLINE + zboolean z_uint64_addition_overflows(zuint64 a, zuint64 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_addition_overflows_3(zuint64 a, zuint64 b, zuint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_addition_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_multiplication_overflows(zuint64 a, zuint64 b) + {return Z_FALSE;} + + static Z_INLINE + zboolean z_uint64_multiplication_overflows_3(zuint64 a, zuint64 b, zuint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_multiplication_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_subtraction_overflows(zuint64 a, zuint64 b) + {return b > a;} + + + static Z_INLINE + zboolean z_uint64_subtraction_overflows_3(zuint64 a, zuint64 b, zuint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint64_subtraction_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d) + {return Z_FALSE;}*/ + +#endif + + +/* MARK: - sint64 */ + +#ifdef Z_SINT64 + + Z_z_IMPLEMENTATION_COMMON(sint64) + Z_z_IMPLEMENTATION_SIGNED(sint64) + + + /*static Z_INLINE + zboolean z_sint64_addition_overflows(zsint64 a, zsint64 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_addition_overflows_3(zsint64 a, zsint64 b, zsint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_addition_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_multiplication_overflows(zsint64 a, zsint64 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_multiplication_overflows_3(zsint64 a, zsint64 b, zsint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_multiplication_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_subtraction_overflows(zsint64 a, zsint64 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_subtraction_overflows_3(zsint64 a, zsint64 b, zsint64 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint64_subtraction_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d) + {return Z_FALSE;}*/ + +#endif + + +/* MARK: - uint128 */ + +#ifdef Z_UINT128 + + Z_z_IMPLEMENTATION_COMMON (uint128) + + + /*static Z_INLINE + zboolean z_uint128_addition_overflows(zuint128 a, zuint128 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_addition_overflows_3(zuint128 a, zuint128 b, zuint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_addition_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_multiplication_overflows(zuint128 a, zuint128 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_multiplication_overflows_3(zuint128 a, zuint128 b, zuint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_multiplication_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_subtraction_overflows(zuint128 a, zuint128 b) + {return b > a;} + + + static Z_INLINE + zboolean z_uint128_subtraction_overflows_3(zuint128 a, zuint128 b, zuint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_uint128_subtraction_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d) + {return Z_FALSE;}*/ + +#endif + + +/* MARK: - sint128 */ + +#ifdef Z_SINT128 + + Z_z_IMPLEMENTATION_COMMON (sint128) + Z_z_IMPLEMENTATION_SIGNED (sint128) + + + /*static Z_INLINE + zboolean z_sint128_addition_overflows(zsint128 a, zsint128 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_addition_overflows_3(zsint128 a, zsint128 b, zsint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_addition_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_multiplication_overflows(zsint128 a, zsint128 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_multiplication_overflows_3(zsint128 a, zsint128 b, zsint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_multiplication_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_subtraction_overflows(zsint128 a, zsint128 b) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_subtraction_overflows_3(zsint128 a, zsint128 b, zsint128 c) + {return Z_FALSE;} + + + static Z_INLINE + zboolean z_sint128_subtraction_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d) + {return Z_FALSE;}*/ + +#endif + + +/* MARK: - float16 */ + +#ifdef Z_FLOAT16 + Z_z_IMPLEMENTATION_COMMON(float16) + Z_z_IMPLEMENTATION_SIGNED(float16) + Z_z_IMPLEMENTATION_REAL (float16, Z_FLOAT16, Z_FLOAT16_EPSILON, Z_FLOAT16_INFINITY) +#endif + + +/* MARK: - float32 */ + +#ifdef Z_FLOAT32 + Z_z_IMPLEMENTATION_COMMON(float32) + Z_z_IMPLEMENTATION_SIGNED(float32) + Z_z_IMPLEMENTATION_REAL (float32, Z_FLOAT32, Z_FLOAT32_EPSILON, Z_FLOAT32_INFINITY) +#endif + +/* MARK: - float64 */ + +#ifdef Z_FLOAT64 + Z_z_IMPLEMENTATION_COMMON(float64) + Z_z_IMPLEMENTATION_SIGNED(float64) + Z_z_IMPLEMENTATION_REAL (float64, Z_FLOAT64, Z_FLOAT64_EPSILON, Z_FLOAT64_INFINITY) +#endif + + +/* MARK: - float128 */ + +#ifdef Z_FLOAT128 + Z_z_IMPLEMENTATION_COMMON(float128) + Z_z_IMPLEMENTATION_SIGNED(float128) + Z_z_IMPLEMENTATION_REAL (float128, Z_FLOAT128, Z_FLOAT128_EPSILON, Z_FLOAT128_INFINITY) +#endif + + +/* MARK: - float80_x87 */ + +#ifdef Z_FLOAT80_X87 + Z_z_IMPLEMENTATION_COMMON(float80_x87) + Z_z_IMPLEMENTATION_SIGNED(float80_x87) + Z_z_IMPLEMENTATION_REAL (float80_x87, Z_FLOAT80_X87, Z_FLOAT80_X87_EPSILON, Z_FLOAT80_X87_INFINITY) +#endif + + +/* MARK: - float96_x87 */ + +#ifdef Z_FLOAT96_X87 + Z_z_IMPLEMENTATION_COMMON(float96_x87) + Z_z_IMPLEMENTATION_SIGNED(float96_x87) + Z_z_IMPLEMENTATION_REAL (float96_x87, Z_FLOAT96_X87, Z_FLOAT96_X87_EPSILON, Z_FLOAT96_X87_INFINITY) +#endif + + +/* MARK: - float128_x87 */ + +#ifdef Z_FLOAT128_X87 + Z_z_IMPLEMENTATION_COMMON(float128_x87) + Z_z_IMPLEMENTATION_SIGNED(float128_x87) + Z_z_IMPLEMENTATION_REAL (float128_x87, Z_FLOAT128_X87, Z_FLOAT128_X87_EPSILON, Z_FLOAT128_X87_INFINITY) +#endif + + +/* MARK: - Cleanup */ + +#undef Z_z_IMPLEMENTATION_COMMON +#undef Z_z_IMPLEMENTATION_SIGNED +#undef Z_z_IMPLEMENTATION_REAL + + +/* MARK: - Function selectors */ + + +#define z_T_addition_overflows( TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows ) +#define z_T_addition_overflows_3( TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows_3 ) +#define z_T_addition_overflows_4( TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows_4 ) +#define z_T_multiplication_overflows( TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows ) +#define z_T_multiplication_overflows_3(TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows_3 ) +#define z_T_multiplication_overflows_4(TYPE) Z_INSERT_##T##_fixed_type(z_, _addition_overflows_4 ) +#define z_T_subtraction_overflows( TYPE) Z_INSERT_##T##_fixed_type(z_, _subtraction_overflows ) +#define z_T_subtraction_overflows_3( TYPE) Z_INSERT_##T##_fixed_type(z_, _subtraction_overflows_3) +#define z_T_subtraction_overflows_4( TYPE) Z_INSERT_##T##_fixed_type(z_, _subtraction_overflows_4) + + +/* MARK: - Default real type definitions */ + +#ifdef Z_REAL +# define z_absolute z_T_absolute (REAL) +# define z_are_almost_equal z_T_are_almost_equal(REAL) +# define z_clamp z_T_clamp (REAL) +# define z_clamp_01 z_T_clamp_01 (REAL) +# define z_inverse_lerp z_T_inverse_lerp (REAL) +# define z_is_almost_zero z_T_is_almost_zero (REAL) +# define z_is_finite z_T_is_finite (REAL) +# define z_is_infinity z_T_is_infinity (REAL) +# define z_is_nan z_T_is_nan (REAL) +# define z_lerp z_T_lerp (REAL) +# define z_maximum z_T_maximum (REAL) +# define z_minimum z_T_minimum (REAL) +# define z_sign z_T_sign (REAL) +# define z_sign_or_zero z_T_sign_or_zero (REAL) +# define z_smootherstep z_T_smootherstep (REAL) +# define z_smoothstep z_T_smoothstep (REAL) +#endif + + +#endif /* Z_functions_math_H */ diff --git a/projects/Zeta/API/Z/functions/math.hpp b/projects/Zeta/API/Z/functions/math.hpp new file mode 100644 index 0000000..e432b91 --- /dev/null +++ b/projects/Zeta/API/Z/functions/math.hpp @@ -0,0 +1,124 @@ +/* Zeta API - Z/functions/math.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_math_HPP +#define Z_functions_math_HPP + +#include + + +namespace Zeta { + + template + static Z_CT(CPP11) t maximum(t a, t b) Z_NOTHROW + {return a > b ? a : b;} + + + template + static Z_CT(CPP11) t minimum(t a, t b) Z_NOTHROW + {return a < b ? a : b;} + + + template + static Z_CT(CPP11) t clamp(t value, t minimum, t maximum) Z_NOTHROW + {return Zeta::minimum(Zeta::maximum(value, minimum), maximum);} + + + // MARK: - Functions for signed types + + + template + static Z_CT(CPP11) t absolute(t value) Z_NOTHROW + {return value < t(0) ? -value : value;} + + + template + static Z_CT(CPP11) t sign(t value) Z_NOTHROW + {return value >= t(0) ? t(1) : -t(1);} + + + // MARK: - Functions for real types + + + template + static Z_CT(CPP11) Boolean are_almost_equal(t a, t b) Z_NOTHROW + {return absolute(a - b) <= Type::epsilon();} + + + template + static Z_CT(CPP11) t clamp_01(t value) Z_NOTHROW + {return minimum(maximum(value, t(0.0)), t(1.0));} + + + template + static Z_CT(CPP11) t inverse_lerp(t a, t b, t x) Z_NOTHROW + {return (x - a) / (b - a);} + + + template + static Z_CT(CPP11) Boolean is_almost_zero(t value) Z_NOTHROW + {return absolute(value) <= Type::epsilon();} + + + template + static Z_CT(CPP11) Boolean is_finite(t value) Z_NOTHROW + { + return value == value && + value != Type::infinity() && + value != -Type::infinity(); + } + + + template + static Z_CT(CPP11) Boolean is_infinity(t value) Z_NOTHROW + { + return value == Type::infinity() || + value == -Type::infinity();} + + + template + static Z_CT(CPP11) Boolean is_nan(t value) Z_NOTHROW + {return !(value == value);} + + + template + static Z_CT(CPP11) t lerp(t a, t b, t x) Z_NOTHROW + {return a + x * (b - a);} + + + template + static Z_CT(CPP11) t sign_or_zero(t value) Z_NOTHROW + { + return absolute(value) <= Type::epsilon() + ? t(0.0) + : sign(value); + } + + + template + static Z_CT(CPP14) t smootherstep(t a, t b, t x) Z_NOTHROW + { + if (x <= a) return t(0.0); + if (x >= b) return t(1.0); + x = (x - a) / (b - a); + return x * x * x * (x * (x * t(6.0) - t(15.0)) + t(10.0)); + } + + + template + static Z_CT(CPP14) t smoothstep(t a, t b, t x) Z_NOTHROW + { + if (x <= a) return t(0.0); + if (x >= b) return t(1.0); + x = (x - a) / (b - a); + return x * x * (t(3.0) - t(2.0) * x); + } +} + + +#endif // Z_functions_math_HPP diff --git a/projects/Zeta/API/Z/functions/type.hpp b/projects/Zeta/API/Z/functions/type.hpp new file mode 100644 index 0000000..8639f18 --- /dev/null +++ b/projects/Zeta/API/Z/functions/type.hpp @@ -0,0 +1,54 @@ +/* Zeta API - Z/functions/type.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_type_HPP +#define Z_functions_type_HPP + +#include + + +namespace Zeta { + +# if Z_COMPILER_IS(GCC) || Z_COMPILER_IS(CLANG) || Z_COMPILER_IS(APPLE_CLANG) + + template + static Z_CT(CPP14) USize type_string_size() Z_NOTHROW + { + const Char *input = __PRETTY_FUNCTION__; + USize size = 0; + USize bracket_count = 0; + + while (*input++ != '='); + while (*++input != ']' || bracket_count) + { + if (*input == '[') bracket_count++; else + if (*input == ']') bracket_count--; + size++; + } + + return size; + } + + + template () + 1> + static Z_CT(CPP14) SizedString type_string() Z_NOTHROW + { + const Char *input = __PRETTY_FUNCTION__; + + while (*input++ != '='); + return SizedString(StringView(input + 1, s)); + } + + +# elif Z_COMPILER_IS(MSVC) + +# endif +} + + +#endif // Z_functions_type_HPP diff --git a/projects/Zeta/API/Z/functions/unevaluated.hpp b/projects/Zeta/API/Z/functions/unevaluated.hpp new file mode 100644 index 0000000..8941d50 --- /dev/null +++ b/projects/Zeta/API/Z/functions/unevaluated.hpp @@ -0,0 +1,19 @@ +/* Zeta API - Z/functions/unevaluated.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_functions_unevaluated_HPP +#define Z_functions_unevaluated_HPP + + +namespace Zeta { + template + t fake() Z_NOTHROW; +} + + +#endif // Z_functions_unevaluated_HPP diff --git a/projects/Zeta/API/Z/hardware/ISA/6502.h b/projects/Zeta/API/Z/hardware/ISA/6502.h new file mode 100644 index 0000000..dd43dfa --- /dev/null +++ b/projects/Zeta/API/Z/hardware/ISA/6502.h @@ -0,0 +1,18 @@ +/* Zeta API - Z/hardware/ISA/6502.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_hardware_ISA_6502_H +#define Z_hardware_ISA_6502_H + +#define Z_6502_ADDRESS_NMI_POINTER 0xFFFA +#define Z_6502_ADDRESS_RESET_POINTER 0XFFFC +#define Z_6502_ADDRESS_IRQ_POINTER 0xFFFE +#define Z_6502_ADDRESS_BRK_POINTER 0xFFFE +#define Z_6502_ADDRESS_STACK 0x0100 + +#endif /* Z_hardware_ISA_6502_H */ diff --git a/projects/Zeta/API/Z/hardware/ISA/RISC-V.h b/projects/Zeta/API/Z/hardware/ISA/RISC-V.h new file mode 100644 index 0000000..a92a787 --- /dev/null +++ b/projects/Zeta/API/Z/hardware/ISA/RISC-V.h @@ -0,0 +1,368 @@ +/* Zeta API - Z/hardware/ISA/RISC-V.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_hardware_ISA_RISC_V_H +#define Z_hardware_ISA_RISC_V_H + +/* Unprivileged Floating-Point CSRs */ +#define Z_RISC_V_CSR_FFLAGS 0x001 +#define Z_RISC_V_CSR_FRM 0x002 +#define Z_RISC_V_CSR_FCSR 0x003 + +/* Unprivileged Counter/Timers */ +#define Z_RISC_V_CSR_CYCLE 0xC00 +#define Z_RISC_V_CSR_TIME 0xC00 +#define Z_RISC_V_CSR_INSTRET 0xC02 +#define Z_RISC_V_CSR_HPMCOUNTER3 0xC03 +#define Z_RISC_V_CSR_HPMCOUNTER4 0xC04 +#define Z_RISC_V_CSR_HPMCOUNTER5 0xC05 +#define Z_RISC_V_CSR_HPMCOUNTER6 0xC06 +#define Z_RISC_V_CSR_HPMCOUNTER7 0xC07 +#define Z_RISC_V_CSR_HPMCOUNTER8 0xC08 +#define Z_RISC_V_CSR_HPMCOUNTER9 0xC09 +#define Z_RISC_V_CSR_HPMCOUNTER10 0xC0A +#define Z_RISC_V_CSR_HPMCOUNTER11 0xC0B +#define Z_RISC_V_CSR_HPMCOUNTER12 0xC0C +#define Z_RISC_V_CSR_HPMCOUNTER13 0xC0D +#define Z_RISC_V_CSR_HPMCOUNTER14 0xC0E +#define Z_RISC_V_CSR_HPMCOUNTER15 0xC0F +#define Z_RISC_V_CSR_HPMCOUNTER16 0xC10 +#define Z_RISC_V_CSR_HPMCOUNTER17 0xC11 +#define Z_RISC_V_CSR_HPMCOUNTER18 0xC12 +#define Z_RISC_V_CSR_HPMCOUNTER19 0xC13 +#define Z_RISC_V_CSR_HPMCOUNTER20 0xC14 +#define Z_RISC_V_CSR_HPMCOUNTER21 0xC15 +#define Z_RISC_V_CSR_HPMCOUNTER22 0xC16 +#define Z_RISC_V_CSR_HPMCOUNTER23 0xC17 +#define Z_RISC_V_CSR_HPMCOUNTER24 0xC18 +#define Z_RISC_V_CSR_HPMCOUNTER25 0xC19 +#define Z_RISC_V_CSR_HPMCOUNTER26 0xC1A +#define Z_RISC_V_CSR_HPMCOUNTER27 0xC1B +#define Z_RISC_V_CSR_HPMCOUNTER28 0xC1C +#define Z_RISC_V_CSR_HPMCOUNTER29 0xC1D +#define Z_RISC_V_CSR_HPMCOUNTER30 0xC1E +#define Z_RISC_V_CSR_HPMCOUNTER31 0xC1F +#define Z_RISC_V_CSR_CYCLEH 0xC80 +#define Z_RISC_V_CSR_TIMEH 0xC81 +#define Z_RISC_V_CSR_INSTRETH 0xC82 +#define Z_RISC_V_CSR_HPMCOUNTER3H 0xC83 +#define Z_RISC_V_CSR_HPMCOUNTER4H 0xC84 +#define Z_RISC_V_CSR_HPMCOUNTER5H 0xC85 +#define Z_RISC_V_CSR_HPMCOUNTER6H 0xC86 +#define Z_RISC_V_CSR_HPMCOUNTER7H 0xC87 +#define Z_RISC_V_CSR_HPMCOUNTER8H 0xC88 +#define Z_RISC_V_CSR_HPMCOUNTER9H 0xC89 +#define Z_RISC_V_CSR_HPMCOUNTER10H 0xC8A +#define Z_RISC_V_CSR_HPMCOUNTER11H 0xC8B +#define Z_RISC_V_CSR_HPMCOUNTER12H 0xC8C +#define Z_RISC_V_CSR_HPMCOUNTER13H 0xC8D +#define Z_RISC_V_CSR_HPMCOUNTER14H 0xC8E +#define Z_RISC_V_CSR_HPMCOUNTER15H 0xC8F +#define Z_RISC_V_CSR_HPMCOUNTER16H 0xC90 +#define Z_RISC_V_CSR_HPMCOUNTER17H 0xC91 +#define Z_RISC_V_CSR_HPMCOUNTER18H 0xC92 +#define Z_RISC_V_CSR_HPMCOUNTER19H 0xC93 +#define Z_RISC_V_CSR_HPMCOUNTER20H 0xC94 +#define Z_RISC_V_CSR_HPMCOUNTER21H 0xC95 +#define Z_RISC_V_CSR_HPMCOUNTER22H 0xC96 +#define Z_RISC_V_CSR_HPMCOUNTER23H 0xC97 +#define Z_RISC_V_CSR_HPMCOUNTER24H 0xC98 +#define Z_RISC_V_CSR_HPMCOUNTER25H 0xC99 +#define Z_RISC_V_CSR_HPMCOUNTER26H 0xC9A +#define Z_RISC_V_CSR_HPMCOUNTER27H 0xC9B +#define Z_RISC_V_CSR_HPMCOUNTER28H 0xC9C +#define Z_RISC_V_CSR_HPMCOUNTER29H 0xC9D +#define Z_RISC_V_CSR_HPMCOUNTER30H 0xC9E +#define Z_RISC_V_CSR_HPMCOUNTER31H 0xC9F + +/* Supervisor Trap Setup */ +#define Z_RISC_V_CSR_SSTATUS 0x100 +#define Z_RISC_V_CSR_SIE 0x104 +#define Z_RISC_V_CSR_STVEC 0x105 +#define Z_RISC_V_CSR_SCOUNTEREN 0x106 + +/* Supervisor Configuration */ +#define Z_RISC_V_CSR_SENVCFG 0x10A + +/* Supervisor Trap Handling */ +#define Z_RISC_V_CSR_SSCRATCH 0x140 +#define Z_RISC_V_CSR_SEPC 0x141 +#define Z_RISC_V_CSR_SCAUSE 0x142 +#define Z_RISC_V_CSR_STVAL 0x143 +#define Z_RISC_V_CSR_SIP 0x144 + +/* Supervisor Protection and Translation */ +#define Z_RISC_V_CSR_SATP 0x180 + +/* Debug/Trace Registers */ +#define Z_RISC_V_CSR_SCONTEXT 0x5A8 + +/* Hypervisor Trap Setup */ +#define Z_RISC_V_CSR_HSTATUS 0x600 +#define Z_RISC_V_CSR_HEDELEG 0x602 +#define Z_RISC_V_CSR_HIDELEG 0x603 +#define Z_RISC_V_CSR_HIE 0x604 +#define Z_RISC_V_CSR_HCOUNTEREN 0x606 +#define Z_RISC_V_CSR_HGEIE 0x607 + +/* Hypervisor Trap Handling */ +#define Z_RISC_V_CSR_HTVAL 0x643 +#define Z_RISC_V_CSR_HIP 0x644 +#define Z_RISC_V_CSR_HVIP 0x645 +#define Z_RISC_V_CSR_HTINST 0x64A +#define Z_RISC_V_CSR_HGEIP 0xE12 + +/* Hypervisor Configuration */ +#define Z_RISC_V_CSR_HENVCFG 0x60A +#define Z_RISC_V_CSR_HENVCFGH 0x61A + +/* Hypervisor Protection and Translation */ +#define Z_RISC_V_CSR_HGATP 0x680 + +/* Debug/Trace Registers */ +#define Z_RISC_V_CSR_hcontext 0x6A8 + +/* Hypervisor Counter/Timer Virtualization Registers */ +#define Z_RISC_V_CSR_htimedelta 0x605 +#define Z_RISC_V_CSR_htimedeltah 0x615 + +/* Virtual Supervisor Registers */ +#define Z_RISC_V_CSR_VSSTATUS 0x200 +#define Z_RISC_V_CSR_VSIE 0x204 +#define Z_RISC_V_CSR_VSTVEC 0x205 +#define Z_RISC_V_CSR_VSSCRATCH 0x240 +#define Z_RISC_V_CSR_VSEPC 0x241 +#define Z_RISC_V_CSR_VSCAUSE 0x242 +#define Z_RISC_V_CSR_VSTVAL 0x243 +#define Z_RISC_V_CSR_VSIP 0x244 +#define Z_RISC_V_CSR_VSATP 0x280 + +/* Machine Information Registers */ +#define Z_RISC_V_CSR_MVENDORID 0xF11 +#define Z_RISC_V_CSR_MARCHID 0xF12 +#define Z_RISC_V_CSR_MIMPID 0xF13 +#define Z_RISC_V_CSR_MHARTID 0xF14 +#define Z_RISC_V_CSR_MCONFIGPTR 0xF15 + +/* Machine Trap Setup */ +#define Z_RISC_V_CSR_MSTATUS 0x300 +#define Z_RISC_V_CSR_MISA 0x301 +#define Z_RISC_V_CSR_MEDELEG 0x302 +#define Z_RISC_V_CSR_MIDELEG 0x303 +#define Z_RISC_V_CSR_MIE 0x304 +#define Z_RISC_V_CSR_MTVEC 0x305 +#define Z_RISC_V_CSR_MCOUNTEREN 0x306 +#define Z_RISC_V_CSR_MSTATUSH 0x310 + +/* Machine Trap Handling */ +#define Z_RISC_V_CSR_MSCRATCH 0x340 +#define Z_RISC_V_CSR_MEPC 0x341 +#define Z_RISC_V_CSR_MCAUSE 0x342 +#define Z_RISC_V_CSR_MTVAL 0x343 +#define Z_RISC_V_CSR_MIP 0x344 +#define Z_RISC_V_CSR_MTINST 0x34A +#define Z_RISC_V_CSR_MTVAL2 0x34B + +/* Machine Configuration */ +#define Z_RISC_V_CSR_MENVCFG 0x30A +#define Z_RISC_V_CSR_MENVCFGH 0x31A +#define Z_RISC_V_CSR_MSECCFG 0x747 +#define Z_RISC_V_CSR_MSECCFGH 0x757 + +/* Machine Memory Protection */ +#define Z_RISC_V_CSR_PMPCFG0 0x3A0 +#define Z_RISC_V_CSR_PMPCFG1 0x3A1 +#define Z_RISC_V_CSR_PMPCFG2 0x3A2 +#define Z_RISC_V_CSR_PMPCFG3 0x3A3 +#define Z_RISC_V_CSR_PMPCFG4 0x3A4 +#define Z_RISC_V_CSR_PMPCFG5 0x3A5 +#define Z_RISC_V_CSR_PMPCFG6 0x3A6 +#define Z_RISC_V_CSR_PMPCFG7 0x3A7 +#define Z_RISC_V_CSR_PMPCFG8 0x3A8 +#define Z_RISC_V_CSR_PMPCFG9 0x3A9 +#define Z_RISC_V_CSR_PMPCFG10 0x3AA +#define Z_RISC_V_CSR_PMPCFG11 0x3AB +#define Z_RISC_V_CSR_PMPCFG12 0x3AC +#define Z_RISC_V_CSR_PMPCFG13 0x3AD +#define Z_RISC_V_CSR_PMPCFG14 0x3AE +#define Z_RISC_V_CSR_PMPCFG15 0x3AF +#define Z_RISC_V_CSR_PMPADDR0 0x3B0 +#define Z_RISC_V_CSR_PMPADDR1 0x3B1 +#define Z_RISC_V_CSR_PMPADDR2 0x3B2 +#define Z_RISC_V_CSR_PMPADDR3 0x3B3 +#define Z_RISC_V_CSR_PMPADDR4 0x3B4 +#define Z_RISC_V_CSR_PMPADDR5 0x3B5 +#define Z_RISC_V_CSR_PMPADDR6 0x3B6 +#define Z_RISC_V_CSR_PMPADDR7 0x3B7 +#define Z_RISC_V_CSR_PMPADDR8 0x3B8 +#define Z_RISC_V_CSR_PMPADDR9 0x3B9 +#define Z_RISC_V_CSR_PMPADDR10 0x3BA +#define Z_RISC_V_CSR_PMPADDR11 0x3BB +#define Z_RISC_V_CSR_PMPADDR12 0x3BC +#define Z_RISC_V_CSR_PMPADDR13 0x3BD +#define Z_RISC_V_CSR_PMPADDR14 0x3BE +#define Z_RISC_V_CSR_PMPADDR15 0x3BF +#define Z_RISC_V_CSR_PMPADDR16 0x3C0 +#define Z_RISC_V_CSR_PMPADDR17 0x3C1 +#define Z_RISC_V_CSR_PMPADDR18 0x3C2 +#define Z_RISC_V_CSR_PMPADDR19 0x3C3 +#define Z_RISC_V_CSR_PMPADDR20 0x3C4 +#define Z_RISC_V_CSR_PMPADDR21 0x3C5 +#define Z_RISC_V_CSR_PMPADDR22 0x3C6 +#define Z_RISC_V_CSR_PMPADDR23 0x3C7 +#define Z_RISC_V_CSR_PMPADDR24 0x3C8 +#define Z_RISC_V_CSR_PMPADDR25 0x3C9 +#define Z_RISC_V_CSR_PMPADDR26 0x3CA +#define Z_RISC_V_CSR_PMPADDR27 0x3CB +#define Z_RISC_V_CSR_PMPADDR28 0x3CC +#define Z_RISC_V_CSR_PMPADDR29 0x3CD +#define Z_RISC_V_CSR_PMPADDR30 0x3CE +#define Z_RISC_V_CSR_PMPADDR31 0x3CF +#define Z_RISC_V_CSR_PMPADDR32 0x3D0 +#define Z_RISC_V_CSR_PMPADDR33 0x3D1 +#define Z_RISC_V_CSR_PMPADDR34 0x3D2 +#define Z_RISC_V_CSR_PMPADDR35 0x3D3 +#define Z_RISC_V_CSR_PMPADDR36 0x3D4 +#define Z_RISC_V_CSR_PMPADDR37 0x3D5 +#define Z_RISC_V_CSR_PMPADDR38 0x3D6 +#define Z_RISC_V_CSR_PMPADDR39 0x3D7 +#define Z_RISC_V_CSR_PMPADDR40 0x3D8 +#define Z_RISC_V_CSR_PMPADDR41 0x3D9 +#define Z_RISC_V_CSR_PMPADDR42 0x3DA +#define Z_RISC_V_CSR_PMPADDR43 0x3DB +#define Z_RISC_V_CSR_PMPADDR44 0x3DC +#define Z_RISC_V_CSR_PMPADDR45 0x3DD +#define Z_RISC_V_CSR_PMPADDR46 0x3DE +#define Z_RISC_V_CSR_PMPADDR47 0x3DF +#define Z_RISC_V_CSR_PMPADDR48 0x3E0 +#define Z_RISC_V_CSR_PMPADDR49 0x3E1 +#define Z_RISC_V_CSR_PMPADDR50 0x3E2 +#define Z_RISC_V_CSR_PMPADDR51 0x3E3 +#define Z_RISC_V_CSR_PMPADDR52 0x3E4 +#define Z_RISC_V_CSR_PMPADDR53 0x3E5 +#define Z_RISC_V_CSR_PMPADDR54 0x3E6 +#define Z_RISC_V_CSR_PMPADDR55 0x3E7 +#define Z_RISC_V_CSR_PMPADDR56 0x3E8 +#define Z_RISC_V_CSR_PMPADDR57 0x3E9 +#define Z_RISC_V_CSR_PMPADDR58 0x3EA +#define Z_RISC_V_CSR_PMPADDR59 0x3EB +#define Z_RISC_V_CSR_PMPADDR60 0x3EC +#define Z_RISC_V_CSR_PMPADDR61 0x3ED +#define Z_RISC_V_CSR_PMPADDR62 0x3EE +#define Z_RISC_V_CSR_PMPADDR63 0x3EF + +/* Machine Counter/Timers */ +#define Z_RISC_V_CSR_MCYCLE 0xB00 +#define Z_RISC_V_CSR_MINSTRET 0xB02 +#define Z_RISC_V_CSR_MHPMCOUNTER3 0xB03 +#define Z_RISC_V_CSR_MHPMCOUNTER4 0xB04 +#define Z_RISC_V_CSR_MHPMCOUNTER5 0xB05 +#define Z_RISC_V_CSR_MHPMCOUNTER6 0xB06 +#define Z_RISC_V_CSR_MHPMCOUNTER7 0xB07 +#define Z_RISC_V_CSR_MHPMCOUNTER8 0xB08 +#define Z_RISC_V_CSR_MHPMCOUNTER9 0xB09 +#define Z_RISC_V_CSR_MHPMCOUNTER10 0xB0A +#define Z_RISC_V_CSR_MHPMCOUNTER11 0xB0B +#define Z_RISC_V_CSR_MHPMCOUNTER12 0xB0C +#define Z_RISC_V_CSR_MHPMCOUNTER13 0xB0D +#define Z_RISC_V_CSR_MHPMCOUNTER14 0xB0E +#define Z_RISC_V_CSR_MHPMCOUNTER15 0xB0F +#define Z_RISC_V_CSR_MHPMCOUNTER16 0xB10 +#define Z_RISC_V_CSR_MHPMCOUNTER17 0xB11 +#define Z_RISC_V_CSR_MHPMCOUNTER18 0xB12 +#define Z_RISC_V_CSR_MHPMCOUNTER19 0xB13 +#define Z_RISC_V_CSR_MHPMCOUNTER20 0xB14 +#define Z_RISC_V_CSR_MHPMCOUNTER21 0xB15 +#define Z_RISC_V_CSR_MHPMCOUNTER22 0xB16 +#define Z_RISC_V_CSR_MHPMCOUNTER23 0xB17 +#define Z_RISC_V_CSR_MHPMCOUNTER24 0xB18 +#define Z_RISC_V_CSR_MHPMCOUNTER25 0xB19 +#define Z_RISC_V_CSR_MHPMCOUNTER26 0xB1A +#define Z_RISC_V_CSR_MHPMCOUNTER27 0xB1B +#define Z_RISC_V_CSR_MHPMCOUNTER28 0xB1C +#define Z_RISC_V_CSR_MHPMCOUNTER29 0xB1D +#define Z_RISC_V_CSR_MHPMCOUNTER30 0xB1E +#define Z_RISC_V_CSR_MHPMCOUNTER31 0xB1F +#define Z_RISC_V_CSR_MCYCLEH 0xB80 +#define Z_RISC_V_CSR_MINSTRETH 0xB82 +#define Z_RISC_V_CSR_MHPMCOUNTER3H 0xB83 +#define Z_RISC_V_CSR_MHPMCOUNTER4H 0xB84 +#define Z_RISC_V_CSR_MHPMCOUNTER5H 0xB85 +#define Z_RISC_V_CSR_MHPMCOUNTER6H 0xB86 +#define Z_RISC_V_CSR_MHPMCOUNTER7H 0xB87 +#define Z_RISC_V_CSR_MHPMCOUNTER8H 0xB88 +#define Z_RISC_V_CSR_MHPMCOUNTER9H 0xB89 +#define Z_RISC_V_CSR_MHPMCOUNTER10H 0xB8A +#define Z_RISC_V_CSR_MHPMCOUNTER11H 0xB8B +#define Z_RISC_V_CSR_MHPMCOUNTER12H 0xB8C +#define Z_RISC_V_CSR_MHPMCOUNTER13H 0xB8D +#define Z_RISC_V_CSR_MHPMCOUNTER14H 0xB8E +#define Z_RISC_V_CSR_MHPMCOUNTER15H 0xB8F +#define Z_RISC_V_CSR_MHPMCOUNTER16H 0xB90 +#define Z_RISC_V_CSR_MHPMCOUNTER17H 0xB91 +#define Z_RISC_V_CSR_MHPMCOUNTER18H 0xB92 +#define Z_RISC_V_CSR_MHPMCOUNTER19H 0xB93 +#define Z_RISC_V_CSR_MHPMCOUNTER20H 0xB94 +#define Z_RISC_V_CSR_MHPMCOUNTER21H 0xB95 +#define Z_RISC_V_CSR_MHPMCOUNTER22H 0xB96 +#define Z_RISC_V_CSR_MHPMCOUNTER23H 0xB97 +#define Z_RISC_V_CSR_MHPMCOUNTER24H 0xB98 +#define Z_RISC_V_CSR_MHPMCOUNTER25H 0xB99 +#define Z_RISC_V_CSR_MHPMCOUNTER26H 0xB9A +#define Z_RISC_V_CSR_MHPMCOUNTER27H 0xB9B +#define Z_RISC_V_CSR_MHPMCOUNTER28H 0xB9C +#define Z_RISC_V_CSR_MHPMCOUNTER29H 0xB9D +#define Z_RISC_V_CSR_MHPMCOUNTER30H 0xB9E +#define Z_RISC_V_CSR_MHPMCOUNTER31H 0xB9F + +/* Machine Counter Setup */ +#define Z_RISC_V_CSR_MCOUNTINHIBIT 0x320 +#define Z_RISC_V_CSR_MHPMEVENT3 0x323 +#define Z_RISC_V_CSR_MHPMEVENT4 0x324 +#define Z_RISC_V_CSR_MHPMEVENT5 0x325 +#define Z_RISC_V_CSR_MHPMEVENT6 0x326 +#define Z_RISC_V_CSR_MHPMEVENT7 0x327 +#define Z_RISC_V_CSR_MHPMEVENT8 0x328 +#define Z_RISC_V_CSR_MHPMEVENT9 0x329 +#define Z_RISC_V_CSR_MHPMEVENT10 0x32A +#define Z_RISC_V_CSR_MHPMEVENT11 0x32B +#define Z_RISC_V_CSR_MHPMEVENT12 0x32C +#define Z_RISC_V_CSR_MHPMEVENT13 0x32D +#define Z_RISC_V_CSR_MHPMEVENT14 0x32E +#define Z_RISC_V_CSR_MHPMEVENT15 0x32F +#define Z_RISC_V_CSR_MHPMEVENT16 0x320 +#define Z_RISC_V_CSR_MHPMEVENT17 0x321 +#define Z_RISC_V_CSR_MHPMEVENT18 0x332 +#define Z_RISC_V_CSR_MHPMEVENT19 0x333 +#define Z_RISC_V_CSR_MHPMEVENT20 0x334 +#define Z_RISC_V_CSR_MHPMEVENT21 0x335 +#define Z_RISC_V_CSR_MHPMEVENT22 0x336 +#define Z_RISC_V_CSR_MHPMEVENT23 0x337 +#define Z_RISC_V_CSR_MHPMEVENT24 0x338 +#define Z_RISC_V_CSR_MHPMEVENT25 0x339 +#define Z_RISC_V_CSR_MHPMEVENT26 0x33A +#define Z_RISC_V_CSR_MHPMEVENT27 0x33B +#define Z_RISC_V_CSR_MHPMEVENT28 0x33C +#define Z_RISC_V_CSR_MHPMEVENT29 0x33D +#define Z_RISC_V_CSR_MHPMEVENT30 0x33E +#define Z_RISC_V_CSR_MHPMEVENT31 0x33F + +/* Debug/Trace Registers (shared with Debug Mode) */ +#define Z_RISC_V_CSR_TSELECT 0x7A0 +#define Z_RISC_V_CSR_TDATA1 0x7A1 +#define Z_RISC_V_CSR_TDATA2 0x7A2 +#define Z_RISC_V_CSR_TDATA3 0x7A3 +#define Z_RISC_V_CSR_MCONTEXT 0x7A8 + +/* Debug Mode Registers */ +#define Z_RISC_V_CSR_DCSR 0x7B0 +#define Z_RISC_V_CSR_DPC 0x7B1 +#define Z_RISC_V_CSR_DSCRATCH0 0x7B2 +#define Z_RISC_V_CSR_DSCRATCH1 0x7B3 + +#endif /* Z_hardware_ISA_RISC_V_H */ diff --git a/projects/Zeta/API/Z/hardware/ISA/Z80.h b/projects/Zeta/API/Z/hardware/ISA/Z80.h new file mode 100644 index 0000000..8c90012 --- /dev/null +++ b/projects/Zeta/API/Z/hardware/ISA/Z80.h @@ -0,0 +1,14 @@ +/* Zeta API - Z/hardware/ISA/Z80.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_hardware_ISA_Z80_H +#define Z_hardware_ISA_Z80_H + +#define Z_Z80_NMI_POINTER 0x0066 + +#endif /* Z_hardware_ISA_Z80_H */ diff --git a/projects/Zeta/API/Z/hardware/bus/USB.h b/projects/Zeta/API/Z/hardware/bus/USB.h new file mode 100644 index 0000000..22c6b86 --- /dev/null +++ b/projects/Zeta/API/Z/hardware/bus/USB.h @@ -0,0 +1,57 @@ +/* Zeta API - Z/hardware/bus/USB.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_hardware_bus_USB_H +#define Z_hardware_bus_USB_H + +/* MARK: - HID Device Usage Pages */ + +#define Z_USB_HID_USAGE_PAGE_UNDEFINED 0x00 +#define Z_USB_HID_USAGE_PAGE_GENERIC_DESKTOP_CONTROLS 0x01 +#define Z_USB_HID_USAGE_PAGE_SIMULATION_CONTROLS 0x02 +#define Z_USB_HID_USAGE_PAGE_VR_CONTROLS 0x03 +#define Z_USB_HID_USAGE_PAGE_SPORT_CONTROLS 0x04 +#define Z_USB_HID_USAGE_PAGE_GAME_CONTROLS 0x05 +#define Z_USB_HID_USAGE_PAGE_GENERIC_DEVICE_CONTROLS 0x06 +#define Z_USB_HID_USAGE_PAGE_KEYBOARD_KEYPAD 0x07 +#define Z_USB_HID_USAGE_PAGE_LEDS 0x08 +#define Z_USB_HID_USAGE_PAGE_BUTTON 0x09 +#define Z_USB_HID_USAGE_PAGE_ORDINAL 0x0A +#define Z_USB_HID_USAGE_PAGE_TELEPHONY 0x0B +#define Z_USB_HID_USAGE_PAGE_CONSUMER 0x0C +#define Z_USB_HID_USAGE_PAGE_DIGITIZER 0x0D +#define Z_USB_HID_USAGE_PAGE_RESERVED 0x0E +#define Z_USB_HID_USAGE_PAGE_PID 0x0F +#define Z_USB_HID_USAGE_PAGE_UNICODE 0x10 +/* 11h-13h - Reserved */ +#define Z_USB_HID_USAGE_PAGE_ALPHANUMERIC_DISPLAY 0x14 +/* Reserved 0x15 - 0x3F */ +#define Z_USB_HID_USAGE_PAGE_MEDICAL_INSTRUMENTS 0x40 +/* 41h-7Fh - Reserved */ +#define Z_USB_HID_USAGE_PAGE_MONITOR_0 0x80 +#define Z_USB_HID_USAGE_PAGE_MONITOR_1 0x81 +#define Z_USB_HID_USAGE_PAGE_MONITOR_2 0x82 +#define Z_USB_HID_USAGE_PAGE_MONITOR_3 0x83 +#define Z_USB_HID_USAGE_PAGE_POWER_0 0x84 +#define Z_USB_HID_USAGE_PAGE_POWER_1 0x85 +#define Z_USB_HID_USAGE_PAGE_POWER_2 0x86 +#define Z_USB_HID_USAGE_PAGE_POWER_3 0x87 +/* 88h-8Bh - Reserved */ +#define Z_USB_HID_USAGE_PAGE_BAR_CODE_SCANNER 0x8C +#define Z_USB_HID_USAGE_PAGE_SCALE_PAGE 0x8D +#define Z_USB_HID_USAGE_PAGE_MSR_DEVICES 0x8E +#define Z_USB_HID_USAGE_PAGE_RESERVED_POINT_OF_SALE 0x8F +#define Z_USB_HID_USAGE_PAGE_CAMERA_CONTROL 0x90 +#define Z_USB_HID_USAGE_PAGE_ARCADE 0x91 +#define Z_USB_HID_USAGE_PAGE_VENDOR_DEFINED_START 0xFF00 + +/* MARK: - HID Usage Page 07h - Keyboard/Keypad */ + +#include + +#endif /* Z_hardware_bus_USB_H */ diff --git a/projects/Zeta/API/Z/hardware/machine/computer/ZX_Spectrum.h b/projects/Zeta/API/Z/hardware/machine/computer/ZX_Spectrum.h new file mode 100644 index 0000000..ed9085b --- /dev/null +++ b/projects/Zeta/API/Z/hardware/machine/computer/ZX_Spectrum.h @@ -0,0 +1,947 @@ +/* Zeta API - Z/hardware/machine/computer/ZX_Spectrum.h + _ _ _ + ___________ |_| ___________ ___________ | | ___________ |_| ___________ +| _________|| || _______ || _________]| |[_________ || || _________] +| |_________ | || | | || | | | _________| || || | +|_________ || || | | || | | || _______ || || | + _________| || || | | || |_________ | || |_______| || || | +[___________||_||_| |_||___________]|_||___________||_||_| + ______ _ __ _____ _ +/___ /\ \ / / / ____| _____ ____ ______| |________ _ _ ___ ___ + / / \ \/ / | |____ | __ \ / __ \ / ___|_ _| __| | | | `_ `_ : + / / > < \____ \| | \ | |__] | | | | | | | | | | | | | | | + / /___ / /\ \ _____| | |__/ | ___/| |___ | | | | | |__| | | | | | | +/______/_/ \_\ |______/| ___/ \____/ \____| |_| |_| |____,_|_| |_| |_| + |_| + +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + + + _________________________________ +| | +| Name: ZX Spectrum | +| Vendor: Sinclair Research | +| Released: 1982-04-23 | +| CPU: Zilog Z80 @ 3.5 MHz | +| ROM: 16 KiB | +| RAM: 16 KiB / 48 KiB | +| Audio: Internal speaker | +| | +'=================================' + + + __________________________________________________ +| ___. __ _ __ . __ | +| __\ || ||__|__|--||| | +| ZX Spectrum | +| | +| ________________________________________________ | +|/________________________________________________\| +| _ _ _ _ _ _ _ _ _ _ | +| [1] [2] [3] [4] [5] [6] [7] [8] [9] [0] | +| _ _ _ _ _ _ _ _ _ _ | +| [Q] [W] [E] [R] [T] [Y] [U] [I] [O] [P] /| +| _ _ _ _ _ _ _ _ _ _____//| +| [A] [S] [D] [F] [G] [H] [J] [K] [L] [ENTER]/| +| _____ _ _ _ _ _ _ _ __ ___////| +| [SHIFT] [Z] [X] [C] [V] [B] [N] [M] [SS] [SPACE] | +|____________________________________________////__| +(__________________________________________________) + + + _________________________________ +| | +| Name: ZX Spectrum + | +| Vendor: Sinclair Research | +| Released: 1984-10 | +| CPU: Zilog Z80 @ 3.5 MHz | +| ROM: 16 KiB | +| RAM: 48 KiB | +| Audio: Internal speaker | +| | +'=================================' + + + ____________________________ ___________ +| ___. __ _ __ . __ ''''''''''''''''''''''''''''' | +| __\ || ||__|__|--||| | +|--------------------------------------------------------------------| +| ZX Spectrum + | +|--.-----------------------------------------------------.-----------| +| |( )|( )|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0)|(BRK)| | +|--|-----------------------------------------------------|-----------| +| |(DEL)|(1)|(Q)|(W)|(E)|(R)|(T)|(Y)|(U)|(I)|(O)|(P)|.-.| | +|--|-------------------------------------------------'| ||-----------| +| |(EXT)|(ED)|(A)|(S)|(D)|(F)|(G)|(H)|(J)|(K)|(L)|(____'| | +|--|-----------------------------------------------------|-----------| +| |(CAPS S)|( )|(Z)|(X)|(C)|(V)|(B)|(N)|(M)|(.)|(CAPS S)| | +|--|-----------------------------------------------------|-----------| +| |( )|(;)|(")|(_)|(_)|(_______________)|(_)|(_)|(,)|(_)| //// | +|--'-----------------------------------------------------'-----------| +|____________________________________________________________________| + + + ________________________________________________ +| | +| Name: ZX Spectrum + 128K | +| Vendor: Sinclair Research - Investronica | +| Released: 1985-09 | +| CPU: Zilog Z80 @ 3.5469 MHz | +| ROM: 48 KiB | +| RAM: 128 KiB | +| Audio: General Instrument AY-3-8912 (PSG) | +| | +'================================================' + + + _____________________________ ________________ +| ___. __ _ __ . __ '''''''''''''''''''''''''''' |====| +| __\ || ||__|__|--||| |====| +|--------------------------------------------------------------------|====| +| ZX Spectrum + |====| +|--.-----------------------------------------------------.-----------|====| +| |( )|( )|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0)|(BRK)| |====| +|--|-----------------------------------------------------|-----------|====| +| |(DEL)|(1)|(Q)|(W)|(E)|(R)|(T)|(Y)|(U)|(I)|(O)|(P)|.-.| |====| +|--|-------------------------------------------------'| ||-----------|====| +| |(EXT)|(ED)|(A)|(S)|(D)|(F)|(G)|(H)|(J)|(K)|(L)|(____'| |====| +|--|-----------------------------------------------------|-----------|====| +| |(CAPS S)|( )|(Z)|(X)|(C)|(V)|(B)|(N)|(M)|(.)|(CAPS S)| |====| +|--|-----------------------------------------------------|-----------|====| +| |( )|(;)|(")|(_)|(_)|(_______________)|(_)|(_)|(,)|(_)| 128K//// |====| +|--'-----------------------------------------------------'-----------|====| +|____________________________________________________________________|====| + + + ________________________________________________ +| | +| Name: ZX Spectrum +2 | +| Vendor: Amstrad | +| Released: 1985-09 | +| CPU: Zilog Z80 @ 3.5469 MHz | +| ROM: 48 KiB | +| RAM: 128 KiB | +| Audio: General Instrument AY-3-8912 (PSG) | +| | +'================================================' + + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +| ___. __ _ __ . __ | +| __\ || ||__|__|--||| ___________________________128K = ZX_Spectrum_+2_________ | +| | +|=======================================================================================| +| | | | +|__.---.---.---.---.---.---.---.---.---.---.---.---.-----.___| ___ |__| +| |TRV|INV| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BRK | | (O)|___|(O) | | +|__.-----.---.---.---.---.---.---.---.---.---.---.---.---.___| --------------------- |__| +| | DEL | GR| Q | W | E | R | T | Y | U | I | O | P | | | _____________________ | | +|__.------.---.---.---.---.---.---.---.---.---.---.--' |___| D A T A C O R D E R |__| +| | EXT | ED| A | S | D | F | G | H | J | K | L | ENTER| '-----------------------' | +|__.--------.---.---.---.---.---.---.---.---.---.--------._____________o________________| +| | C SHIFT| CL| Z | X | C | V | B | N | M | . | C SHIFT| | +|__.---.---.---.---.---.-----------------.---.---.---.---.___.---.---.---.---.---.---.__| +| | SS| ; | " | < | > | | /\| \/| , | SS| | O | > | <<|>> |/\ ||| | | +|__|---|---|---|---|---|-----------------|---|---|---|---|___|---|---|---|---|---|---|__| +| '-----------------------------------------------------' '-----------------------' | +|_______________________________________________________________________________________| + + + ________________________________________________ +| | +| Name: ZX Spectrum +2A | +| Vendor: Amstrad | +| Released: 1985-09 | +| CPU: Zilog Z80 @ 3.5469 MHz | +| ROM: 48 KiB | +| RAM: 128 KiB | +| Audio: General Instrument AY-3-8912 (PSG) | +| | +'================================================' + + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +| ___. __ _ __ . __ | +| __\ || ||__|__|--||| ___________________________128K = ZX_Spectrum_+2_________ | +| | +|=======================================================================================| +| | | | +|__.---.---.---.---.---.---.---.---.---.---.---.---.-----.___| ___ |__| +| |TRV|INV| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BRK | | (O)|___|(O) | | +|__.-----.---.---.---.---.---.---.---.---.---.---.---.---.___| --------------------- |__| +| | DEL | GR| Q | W | E | R | T | Y | U | I | O | P | | | _____________________ | | +|__.------.---.---.---.---.---.---.---.---.---.---.--' |___| D A T A C O R D E R |__| +| | EXT | ED| A | S | D | F | G | H | J | K | L | ENTER| '-----------------------' | +|__.--------.---.---.---.---.---.---.---.---.---.--------._____________o________________| +| | C SHIFT| CL| Z | X | C | V | B | N | M | . | C SHIFT| O > << >> /\ || | +|__.---.---.---.---.---.-----------------.---.---.---.---.___.---.---.---.---.---.---.__| +| | SS| ; | " | < | > | | /\| \/| , | SS| | | | | | | | | +|__|---|---|---|---|---|-----------------|---|---|---|---|___|---|---|---|---|---|---|__| +| '-----------------------------------------------------' '-----------------------' | +|_______________________________________________________________________________________| + + + ________________________________________________ +| | +| Name: ZX Spectrum +3 | +| Vendor: Amstrad | +| Released: 1985-09 | +| CPU: Zilog Z80 @ 3.5469 MHz | +| ROM: 48 KiB | +| RAM: 128 KiB | +| Audio: General Instrument AY-3-8912 (PSG) | +| | +'================================================' + + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +| ___. __ _ __ . __ | +| __\ || ||__|__|--||| _______________________________128K = __ZX_Spectrum_+3__ | +| | +|=======================================================================================| +| | | +|______.---.---.---.---.---.---.---.---.---.---.---.---.-----.___|_ __________________ _| +| |TRV|INV| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BRK | | | _ _ | | +|______.-----.---.---.---.---.---.---.---.---.---.---.---.---.___|_| /|' ](_)|_/ |_| +| | DEL | GR| Q | W | E | R | T | Y | U | I | O | P | | | | | /_(_)| \ | | +|______.------.---.---.---.---.---.---.---.---.---.---.--' |___|_| |_| +| | EXT | ED| A | S | D | F | G | H | J | K | L | ENTER| | | | | +|______.--------.---.---.---.---.---.---.---.---.---.--------.___|_| |_| +| | C SHIFT| CL| Z | X | C | V | B | N | M | . | C SHIFT| | | | | +|______.---.---.---.---.---.-----------------.---.---.---.---.___|_|____ _ _ _ ____|_| +| | SS| ; | " | < | > | | /\| \/| , | SS| | |____|- |_) |_)____| | +|______|---|---|---|---|---|-----------------|---|---|---|---|___|_| FLOPPY DISC DRIVE|_| +| '-----------------------------------------------------' | '------------------' | +|________________________________________________________________|______________________| + + + ______________________________________ +| | +| Name: Inves Spectrum + | +| Vendor: Investronica | +| Released: 1986 | +| CPU: Zilog Z80-A @ 3.5469 MHz | +| ROM: 48 KiB | +| RAM: 128 KiB | +| Audio: Internal speaker | +| | +'======================================' + + + _____________________________ ___________ +| o _ _ __ '''''''''''''''''''''''''''' | +| ---'\__| |\/|/_\ | +|--------------------------------------------------------------------| +| Spectrum + | +|--.-----------------------------------------------------.-----------| +| |( )|( )|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(1)|(1)|(1)|(BRK)| | +|--|-----------------------------------------------------|-----------| +| |(DEL)|(1)|(Q)|(W)|(E)|(R)|(T)|(Y)|(U)|(I)|(O)|(P)|.-.| | +|--|-------------------------------------------------'| ||-----------| +| |(EXT)|(ED)|(A)|(S)|(D)|(F)|(G)|(H)|(J)|(K)|(L)|(____'| | +|--|-----------------------------------------------------|-----------| +| |( /\ )|( )|(Z)|(X)|(C)|(V)|(B)|(N)|(M)|(.)|( /\ )| | +|--|-----------------------------------------------------|-----------| +| |( )|(;)|(")|(<)|(>)|(_______________)|(A)|(V)|(,)|(_)| | +|--'-----------------------------------------------------'-----------| +|____________________________________________________________________| */ + + +#ifndef Z_hardware_machine_computer_ZX_Spectrum_H +#define Z_hardware_machine_computer_ZX_Spectrum_H + +#include +#include +#include + +/* MARK: - Memory map */ + +/*-------------------------------------------------. +| Region | Size | Type | R/W | Content | +|-----------+------+------+-----+------------------| +| 0000-3FFF | 4000 | ROM | R | Firmware | +|-----------+------+------+-----+------------------| +| 4000-57FF | 1800 | VRAM | R/W | Video characters | +| 5800-5AFF | 300 | VRAM | R/W | Video attributes | +|-----------+------+------+-----+------------------| +| 5B00-FFFF | A500 | RAM | R/W | User programs | +'==================================================' + + +.-----------------------. +| 0000-3FFF | ROM | ROM | +| Firmware | 0 | 1 | +|-----------|-----+=====' +| 4000-7FFF | RAM | +| Screen 1 | 5 | +|-----------|-----| +| 8000-BFFF | RAM | +| | 2 | Screen 2 +|-----------|-----+--------------------------------------|--. +| C000-FFFF | RAM | RAM | RAM | RAM | RAM | RAM | RAM | RAM | +| User | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +'===========================================================' + + +.-----------------------------------. +| 0000-3FFF | RAM | RAM | RAM | RAM | +| User | 0 | 4 | 4 | 4 | +|-----------|-----+-----+-----+-----| +| 4000-7FFF | RAM | RAM | RAM | RAM | +| User | 1 | 5 | 5 | 7 | +|-----------|-----+-----+-----+-----| +| 8000-BFFF | RAM | RAM | RAM | RAM | +| User | 2 | 6 | 6 | 6 | +|-----------|-----+-----+-----+-----| +| C000-FFFF | RAM | RAM | RAM | RAM | +| User | 3 | 7 | 3 | 3 | +'===================================' +*/ + +#define Z_ZX_SPECTRUM_ADDRESS_ROM 0x0000 +#define Z_ZX_SPECTRUM_ADDRESS_RAM 0x4000 +#define Z_ZX_SPECTRUM_ADDRESS_VRAM 0x4000 +#define Z_ZX_SPECTRUM_ADDRESS_CHARACTER_VRAM 0x4000 +#define Z_ZX_SPECTRUM_ADDRESS_ATTRIBUTE_VRAM 0x5800 +#define Z_ZX_SPECTRUM_ADDRESS_USER_PROGRAMS 0x5B00 + +#define Z_ZX_SPECTRUM_SIZE_ROM 0x4000 /* 16 KiB */ +#define Z_ZX_SPECTRUM_SIZE_VRAM 0x1B00 +#define Z_ZX_SPECTRUM_SIZE_CHARACTER_VRAM 0x1800 +#define Z_ZX_SPECTRUM_SIZE_ATTRIBUTE_VRAM 0x300 + +#define Z_ZX_SPECTRUM_16K_SIZE_MEMORY 0x8000 /* 32 KiB */ +#define Z_ZX_SPECTRUM_16K_SIZE_ROM 0x4000 /* 16 KiB */ +#define Z_ZX_SPECTRUM_16K_SIZE_RAM 0x4000 /* 16 KiB */ + +#define Z_ZX_SPECTRUM_48K_SIZE_MEMORY 0x10000 /* 64 KiB */ +#define Z_ZX_SPECTRUM_48K_SIZE_ROM 0x4000 /* 16 KiB */ +#define Z_ZX_SPECTRUM_48K_SIZE_RAM 0xC000 /* 48 KiB */ + +#define Z_ZX_SPECTRUM_PLUS_128K_SIZE_MEMORY 0x28000 /* 160 KiB */ +#define Z_ZX_SPECTRUM_PLUS_128K_SIZE_ROM 0x8000 /* 32 KiB */ +#define Z_ZX_SPECTRUM_PLUS_128K_SIZE_RAM 0x20000 /* 128 KiB */ +#define Z_ZX_SPECTRUM_PLUS_128K_SIZE_BANK 0x4000 /* 16 KiB */ + +#define Z_ZX_SPECTRUM_PLUS3_SIZE_MEMORY 0x30000 /* 160 KiB */ +#define Z_ZX_SPECTRUM_PLUS3_SIZE_RAM 0x20000 /* 128 KiB */ +#define Z_ZX_SPECTRUM_PLUS3_SIZE_ROM 0x10000 /* 64 KiB */ + +#define Z_INVES_SPECTRUM_PLUS_SIZE_MEMORY 0x10000 /* 64 KiB */ +#define Z_INVES_SPECTRUM_PLUS_SIZE_ROM 0x4000 /* 16 KiB */ +#define Z_INVES_SPECTRUM_PLUS_SIZE_RAM 0xC000 /* 48 KiB */ + +#define Z_TIMEX_SINCLAIR_2068_SIZE_MEMORY 0x12000 /* 72 KiB */ +#define Z_TIMEX_SINCLAIR_2068_SIZE_ROM 0x6000 /* 24 KiB */ +#define Z_TIMEX_SINCLAIR_2068_SIZE_RAM 0xC000 /* 48 KiB */ + +#define Z_TIMEX_COMPUTER_2048_SIZE_MEMORY 0x10000 /* 64 KiB */ +#define Z_TIMEX_COMPUTER_2048_SIZE_ROM 0x4000 /* 16 KiB */ +#define Z_TIMEX_COMPUTER_2048_SIZE_RAM 0xC000 /* 48 KiB */ + +/* MARK: - Video: Color Attribute */ +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-|-|-\___/-\___/-' + | | | '---- ink ----------------. + | | '---------- paper --------. | + | '-------------- bright ---. | | + '---------------- flash | | | + | | | | + .----------------' | | | + | .---------' | | + | | | | +.---------. .------------. .---------------. +| 0 = no | | 0 = normal | | 000 = black | +| 1 = yes | | 1 = bright | | 001 = blue | +'---------' '------------' | 010 = red | + | 011 = magenta | + | 100 = green | + | 101 = cyan | + | 110 = yellow | + | 111 = white | + '--------------*/ + +#define Z_ZX_SPECTRUM_COLOR_BLACK 0 +#define Z_ZX_SPECTRUM_COLOR_BLUE 1 +#define Z_ZX_SPECTRUM_COLOR_RED 2 +#define Z_ZX_SPECTRUM_COLOR_MAGENTA 3 +#define Z_ZX_SPECTRUM_COLOR_GREEN 4 +#define Z_ZX_SPECTRUM_COLOR_CYAN 5 +#define Z_ZX_SPECTRUM_COLOR_YELLOW 6 +#define Z_ZX_SPECTRUM_COLOR_WHITE 7 + +typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 flash :1, + zuint8 bright :1, + zuint8 paper :3, + zuint8 ink :3 + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumColorAttribute; + +#define Z_ZX_SPECTRUM_ATTRIBUTE_SQUARE_WIDTH 8 +#define Z_ZX_SPECTRUM_ATTRIBUTE_SQUARE_HEIGHT 8 + +#define Z_ZX_SPECTRUM_BRIGHT_COLOR_PALETTE(rgb) \ + rgb(0.0, 0.0, 0.0), /* bright black */ \ + rgb(0.0, 0.0, 1.0), /* bright blue */ \ + rgb(1.0, 0.0, 0.0), /* bright red */ \ + rgb(1.0, 0.0, 1.0), /* bright magenta */ \ + rgb(0.0, 1.0, 0.0), /* bright green */ \ + rgb(0.0, 1.0, 1.0), /* bright cyan */ \ + rgb(1.0, 1.0, 0.0), /* bright yellow */ \ + rgb(1.0, 1.0, 1.0) /* bright white */ + +#define Z_ZX_SPECTRUM_BASIC_COLOR_PALETTE(rgb) \ + rgb(0.0, 0.0, 0.0 ), /* black */ \ + rgb(0.0, 0.0, 0.84), /* basic blue */ \ + rgb(0.84, 0.0, 0.0 ), /* basic red */ \ + rgb(0.84, 0.0, 0.84), /* basic magenta */ \ + rgb(0.0, 0.84, 0.0 ), /* basic green */ \ + rgb(0.0, 0.84, 0.84), /* basic cyan */ \ + rgb(0.84, 0.84, 0.0 ), /* basic yellow */ \ + rgb(0.84, 0.84, 0.84) /* basic white */ + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 characters[Z_ZX_SPECTRUM_SIZE_CHARACTER_VRAM]; + Z_ZXSpectrumColorAttribute attributes[Z_ZX_SPECTRUM_SIZE_ATTRIBUTE_VRAM]; +} Z_PACKED_STRUCTURE_END Z_ZXSpectrumVRAM; + +/* MARK: - I/O ports */ + +#define Z_ZX_SPECTRUM_PMIO_ULA 0x00FE /* R/W */ +#define Z_ZX_SPECTRUM_PLUS_128K_PMIO_BANK_SWITCH 0x7FFD /* W */ +#define Z_ZX_SPECTRUM_PLUS_128K_PMIO_PSG_DATA_OUTPUT 0xBFFD /* W */ +#define Z_ZX_SPECTRUM_PLUS_128K_PMIO_PSG_DATA_INPUT 0xFFFD /* R */ +#define Z_ZX_SPECTRUM_PLUS_128K_PMIO_PSG_REGISTER_INDEX 0xFFFD /* W */ +#define Z_ZX_SPECTRUM_PLUS2_PMIO_JOYSTICK_1 0xEFFE /* R */ +#define Z_ZX_SPECTRUM_PLUS2_PMIO_JOYSTICK_2 0xF7FE /* R */ +#define Z_ZX_SPECTRUM_PLUS3_PMIO_CONTROL 0x1FFD /* W */ +#define Z_ZX_SPECTRUM_PLUS3_PMIO_FDD_STATUS 0x2FFD /* R */ +#define Z_ZX_SPECTRUM_PLUS3_PMIO_FDD_DATA 0x3FFD /* R/W */ +#define Z_ZX_SPECTRUM_PLUS3_PMIO_PSG_REGISTER_INDEX_MIRROR 0xBFFD /* ? */ + + +#define Z_ZX_SPECTRUM_UNASSIGNED_PMIO_INPUT 0xFF + + +/* MARK: - ULA I/O port */ + +/* HIGH BYTE LOW BYTE +.-----------------.-----------------. +| 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 | +'-\_____________/-'-\___/-|-|-\___/-' + | unused | | '---- border color + keyboard (read) | '-------- MIC / tape output + | '---------- EAR output / speaker + '-------. + | + 76543210 0 1 2 3 4 + .--------------------------------------------------. + .--------| _______0 | SHIFT | Z | X | C | V | + | |----------+-------+-------+-------+-------+-------| + | .------| ______0_ | A | S | D | F | G | + | | |----------+-------+-------+-------+-------+-------| + | | .----| _____0__ | Q | W | E | R | T | + | | | |----------+-------+-------+-------+-------+-------| + | | | .--| ____0___ | 1 | 2 | 3 | 4 | 5 | + | | | | |----------+-------+-------+-------+-------+-------| + | | | | | ___0____ | 0 | 9 | 8 | 7 | 6 |-------------. + N | | | | |----------+-------+-------+-------+-------+-------| | R + O | | | | | __0_____ | P | O | I | U | Y |-----------. | E + R | | | | |----------+-------+-------+-------+-------+-------| | | V + M | | | | | _0______ | ENTER | L | K | J | H |---------. | | E + A | | | | |----------+-------+-------+-------+-------+-------| | | | R + L | | | | | 0_______ | SPACE | SY/SH | M | N | B |-------. | | | S + | | | | '==================================================' | | | | E + M | | | | | | | | D + A | | | | ____________________________ _______________________ | | | | + T | | | | | ___. __ _ __ . __ /\ / | | | | | M + R | | | | | __\ || ||__|__|--||| / / / | | | | | A + I | | | | | ZX Spectrum / / / | | | | | T + X | | | | | / / / | | | | | R + | | | | | ______________________/ / /__________________________ | | | | | I + | | | | |/_____________________/ / /___________________________\| | | | | I + | | | | | _ _ _ _ _ / / / _ _ _ _ _ | | | | | X + | | | '--> [1] [2] [3] [4] [5] \/ \[6] [7] [8] [9] [0] <-----------------' + | | | | _ _ _ _ _\ \ _ _ _ _ _ | | | | + | | '-------> [Q] [W] [E] [R] [T]\ \ [Y] [U] [I] [O] [P] <------------' + | | | _ _ _ _ _\ \ _ _ _ _ _____//| | | + | '-----------> [A] [S] [D] [F] [G]\ \ [H] [J] [K] [L] [ENTER] <----' + | | _____ _ _ _ _ /\ / _ _ _ __ ___////| | + '--------> [SHIFT] [Z] [X] [C] [V]/ / / [B] [N] [M] [SS] [SPACE] <--' + |_______________________/ / /_____________________////__| + (_______________________\/ \___________________________) */ + +typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 4) ( + zuint8 unused :3, + zuint8 mic :1, + zuint8 ear :1, + zuint8 border_color :3 + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumULAIO; + +/* MARK: - ULA I/O port: input value */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-|-|-\_________/-' + 1 | key mask + EAR input + +.------------------------------------. +| Special keys | +|------------------------------------| +| DELETE = SHIFT + 0 | +| EDIT = SHIFT + 1 | +| CAPS LOCK = SHIFT + 2 | +| TRUE VIDEO = SHIFT + 3 | +| INV VIDEO = SHIFT + 4 | +| ↑ = SHIFT + 7 | +| ↓ = SHIFT + 6 | +| → = SHIFT + 5 | +| ← = SHIFT + 8 | +| GRAPH = SHIFT + 9 | +| BREAK = SHIFT + SPACE | +| EXTEND MODE = SHIFT + SYMBOL SHIFT | +| . = SYMBOL SHIFT + M | +| , = SYMBOL SHIFT + N | +| ; = SYMBOL SHIFT + O | +| " = SYMBOL SHIFT + P | +'===================================*/ + +typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 3) ( + zuint8 one :1, + zuint8 ear :1, + zuint8 key_mask :6 + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumULAInput; + +#define Z_ZX_SPECTRUM_KEY_MASK_ENTER 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_SHIFT 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_SPACE 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_0 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_1 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_2 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_3 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_4 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_5 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_6 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_7 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_8 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_9 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_A 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_B 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_C 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_D 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_E 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_F 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_G 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_H 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_I 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_J 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_K 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_L 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_M 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_N 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_O 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_P 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_Q 0x0F +#define Z_ZX_SPECTRUM_KEY_MASK_R 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_S 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_T 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_U 0x1D +#define Z_ZX_SPECTRUM_KEY_MASK_V 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_W 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_X 0x1B +#define Z_ZX_SPECTRUM_KEY_MASK_Y 0x1E +#define Z_ZX_SPECTRUM_KEY_MASK_Z 0x17 +#define Z_ZX_SPECTRUM_KEY_MASK_SYMBOL_SHIFT 0x17 + +#define Z_ZX_SPECTRUM_KEY_ROW_ENTER 6 +#define Z_ZX_SPECTRUM_KEY_ROW_SHIFT 0 +#define Z_ZX_SPECTRUM_KEY_ROW_SPACE 7 +#define Z_ZX_SPECTRUM_KEY_ROW_0 4 +#define Z_ZX_SPECTRUM_KEY_ROW_1 3 +#define Z_ZX_SPECTRUM_KEY_ROW_2 3 +#define Z_ZX_SPECTRUM_KEY_ROW_3 3 +#define Z_ZX_SPECTRUM_KEY_ROW_4 3 +#define Z_ZX_SPECTRUM_KEY_ROW_5 3 +#define Z_ZX_SPECTRUM_KEY_ROW_6 4 +#define Z_ZX_SPECTRUM_KEY_ROW_7 4 +#define Z_ZX_SPECTRUM_KEY_ROW_8 4 +#define Z_ZX_SPECTRUM_KEY_ROW_9 4 +#define Z_ZX_SPECTRUM_KEY_ROW_A 1 +#define Z_ZX_SPECTRUM_KEY_ROW_B 7 +#define Z_ZX_SPECTRUM_KEY_ROW_C 0 +#define Z_ZX_SPECTRUM_KEY_ROW_D 1 +#define Z_ZX_SPECTRUM_KEY_ROW_E 2 +#define Z_ZX_SPECTRUM_KEY_ROW_F 1 +#define Z_ZX_SPECTRUM_KEY_ROW_G 1 +#define Z_ZX_SPECTRUM_KEY_ROW_H 6 +#define Z_ZX_SPECTRUM_KEY_ROW_I 5 +#define Z_ZX_SPECTRUM_KEY_ROW_J 6 +#define Z_ZX_SPECTRUM_KEY_ROW_K 6 +#define Z_ZX_SPECTRUM_KEY_ROW_L 6 +#define Z_ZX_SPECTRUM_KEY_ROW_M 7 +#define Z_ZX_SPECTRUM_KEY_ROW_N 7 +#define Z_ZX_SPECTRUM_KEY_ROW_O 5 +#define Z_ZX_SPECTRUM_KEY_ROW_P 5 +#define Z_ZX_SPECTRUM_KEY_ROW_Q 2 +#define Z_ZX_SPECTRUM_KEY_ROW_R 2 +#define Z_ZX_SPECTRUM_KEY_ROW_S 1 +#define Z_ZX_SPECTRUM_KEY_ROW_T 2 +#define Z_ZX_SPECTRUM_KEY_ROW_U 5 +#define Z_ZX_SPECTRUM_KEY_ROW_V 0 +#define Z_ZX_SPECTRUM_KEY_ROW_W 2 +#define Z_ZX_SPECTRUM_KEY_ROW_X 0 +#define Z_ZX_SPECTRUM_KEY_ROW_Y 5 +#define Z_ZX_SPECTRUM_KEY_ROW_Z 0 +#define Z_ZX_SPECTRUM_KEY_ROW_SYMBOL_SHIFT 7 + +#define Z_ZX_SPECTRUM_KEY_OFFSET_ENTER 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_SHIFT 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_SPACE 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_0 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_1 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_2 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_3 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_4 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_5 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_6 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_7 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_8 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_9 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_A 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_B 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_C 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_D 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_E 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_F 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_G 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_H 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_I 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_J 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_K 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_L 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_M 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_N 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_O 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_P 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_Q 0 +#define Z_ZX_SPECTRUM_KEY_OFFSET_R 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_S 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_T 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_U 3 +#define Z_ZX_SPECTRUM_KEY_OFFSET_V 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_W 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_X 2 +#define Z_ZX_SPECTRUM_KEY_OFFSET_Y 4 +#define Z_ZX_SPECTRUM_KEY_OFFSET_Z 1 +#define Z_ZX_SPECTRUM_KEY_OFFSET_SYMBOL_SHIFT 1 + +/* MARK: - 7FFDh - ZX Spectrum +128K - Bank Switch */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-\_/-|-|-|-\___/-' +unused| | | '---- user (C000h) + | | '-------- VRAM + | '---------- ROM + '------------ disable */ + +typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 5) ( + zuint8 unused :2, + zuint8 disable :1, + zuint8 rom :1, + zuint8 vram :1, + zuint8 user :3 + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumPlus128KBankSwitch; + +/* MARK: - 0x1FFD - ZX Spectrum +3 - Control */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-\___/-|-|-\_/-|-' + unused | | | '-- + | | '----- + | '-------- + '---------- */ + +typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 5) ( + zuint8 unused :3, + zuint8 enable_printer_strobe :1, + zuint8 enable_fdd_motor :1, + zuint8 bank_map :2, + zuint8 use_extended_banking :1 + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumPlus3Control; + +/* MARK: - 2FFDh - ZX Spectrum +3 - FDD Status */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-\___/-|-|-|-|-|-' + unused | | | | '-- + | | | '---- + | | '------ + | '-------- + '---------- */ + +/*typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 6) ( + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumPlus3FDDStatus;*/ + +/* MARK: - 3FFDh - ZX Spectrum +3 - FDD Data */ + +/*----------------. +| 7 6 5 4 3 2 1 0 | +'-\___/-|-|-|-|-|-' + unused | | | | '-- user (C000h) + | | | '---- VRAM + | | '------ ROM + | '-------- disable + '---------- */ + + +/*typedef Z_PACKED_UNION_BEGIN { + zuint8 value; + struct {Z_BIT_FIELD_MEMBERS(8, 6) ( + )} fields; +} Z_PACKED_UNION_END Z_ZXSpectrumPlus3FDDStatus;*/ + + +/* MARK: - Screen */ + +/*-------------------------------------------------------------------. +| References: | +| https://retrocomputing.stackexchange.com/questions/25107 | +| http://www.zxdesign.info/vidparam.shtml | +| http://zxprojects.com/inves | +| https://www.speccy.pl/forum/index.php?topic=1006.msg14258#msg14258 | +'===================================================================*/ + +/* +.- - <-INT-> - - - - - - - - - - - - - -. --- --- +: VBLANK + Invisible Top Border : | 16 / 15 | +.---------------------------------.- - -: --- --- | +| Top Border | : | 48 | | +|----.-----------------------.----| : --- | | +|L | |R | : | | | +|e | |i | H : | | | +|f B| |g B| B : | | | +|t o| Paper |h o| L : | 192 | 296 | 312 / 311 +| r| |t r| A : | | | +| d| | d| N : | | | +| e| | e| K : | | | +| r| | r| : | | | +|----'-----------------------'----| : --- | | +| Bottom Border | : | 56 | | +'---------------------------------'- - -' --- --- --- + +|----|-----------------------|----| + 48 256 48 +|---------------------------------| + 352 */ + +#define Z_ZX_SPECTRUM_SCREEN_FPS 50 +#define Z_ZX_SPECTRUM_SCREEN_WIDTH 352 +#define Z_ZX_SPECTRUM_SCREEN_HEIGHT 296 +#define Z_ZX_SPECTRUM_SCREEN_PIXELS 104192 /* 352 * 296 */ +#define Z_ZX_SPECTRUM_SCREEN_PAPER_WIDTH 256 +#define Z_ZX_SPECTRUM_SCREEN_PAPER_HEIGHT 192 +#define Z_ZX_SPECTRUM_SCREEN_PAPER_PIXELS 49152 /* 256 * 192 */ +#define Z_ZX_SPECTRUM_SCREEN_TOP_BORDER_HEIGHT 48 +#define Z_ZX_SPECTRUM_SCREEN_TOP_BORDER_PIXELS 16896 +#define Z_ZX_SPECTRUM_SCREEN_BOTTOM_BORDER_HEIGHT 56 +#define Z_ZX_SPECTRUM_SCREEN_BOTTOM_BORDER_PIXELS 19712 +#define Z_ZX_SPECTRUM_SCREEN_LATERAL_BORDER_WIDTH 48 + +/* MARK: - Timings */ + +#define Z_ZX_SPECTRUM_CPU_HZ 3500000 +#define Z_ZX_SPECTRUM_CYCLES_PER_FRAME 69888 +#define Z_ZX_SPECTRUM_CYCLES_PER_SCANLINE 224 +#define Z_ZX_SPECTRUM_CYCLES_PER_HBLANK 48 +#define Z_ZX_SPECTRUM_CYCLES_PER_FULL_BORDER_LINE 176 +#define Z_ZX_SPECTRUM_CYCLES_PER_LATERAL_BORDER_LINE 24 +#define Z_ZX_SPECTRUM_CYCLES_PER_PAPER_LINE 128 +#define Z_ZX_SPECTRUM_CYCLES_PER_INT 32 +#define Z_ZX_SPECTRUM_CYCLES_AT_VBLANK 0 +#define Z_ZX_SPECTRUM_CYCLES_AT_INT 24 +#define Z_ZX_SPECTRUM_CYCLES_AT_INT_END 56 +#define Z_ZX_SPECTRUM_CYCLES_AT_TOP_BORDER 3584 +#define Z_ZX_SPECTRUM_CYCLES_AT_PAPER_REGION 14336 +#define Z_ZX_SPECTRUM_CYCLES_AT_PAPER 14360 +#define Z_ZX_SPECTRUM_CYCLES_AT_PAPER_END 57272 +#define Z_ZX_SPECTRUM_CYCLES_AT_BOTTOM_BORDER 57344 + +#define Z_ZX_SPECTRUM_PLUS_128K_CPU_HZ 3546900 +#define Z_ZX_SPECTRUM_PLUS_128K_PSG_HZ 1773400 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_FRAME 70908 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_SCANLINE 228 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_HBLANK 52 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_FULL_BORDER_LINE 176 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_LATERAL_BORDER_LINE 24 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_PAPER_LINE 128 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_PER_INT 36 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_VBLANK 0 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_INT 24 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_INT_END 60 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_TOP_BORDER 3420 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_PAPER_REGION 14364 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_PAPER 14388 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_PAPER_END 58064 +#define Z_ZX_SPECTRUM_PLUS_128K_CYCLES_AT_BOTTOM_BORDER 58140 + +#define Z_ZX_SPECTRUM_PLUS3_CPU_HZ 3546900 +#define Z_ZX_SPECTRUM_PLUS3_PSG_HZ 1773400 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_FRAME 70908 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_SCANLINE 228 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_HBLANK 52 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_FULL_BORDER_LINE 176 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_LATERAL_BORDER_LINE 24 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_PAPER_LINE 128 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_PER_INT 32 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_VBLANK 0 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_INT 24 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_INT_END 56 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_TOP_BORDER 3420 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_PAPER_REGION 14364 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_PAPER 14388 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_PAPER_END 58064 +#define Z_ZX_SPECTRUM_PLUS3_CYCLES_AT_BOTTOM_BORDER 58140 + +#define Z_INVES_SPECTRUM_PLUS_CPU_HZ 3546900 +#define Z_INVES_SPECTRUM_PLUS_PSG_HZ 1773400 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_FRAME 70908 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_SCANLINE 228 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_HBLANK 52 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_FULL_BORDER_LINE 176 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_LATERAL_BORDER_LINE 24 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_PAPER_LINE 128 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_PER_INT 32 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_VBLANK 0 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_TOP_BORDER 3420 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_INT 14176 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_INT_END 14208 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_PAPER_REGION 14364 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_BOTTOM_BORDER 58140 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_PAPER 14388 +#define Z_INVES_SPECTRUM_PLUS_CYCLES_AT_PAPER_END 58064 + +#define Z_INVES_SPECTRUM_PLUS_MASTER_CLOCK_HZ 177345 +#define Z_INVES_SPECTRUM_PLUS_CPU_HZ 3546900 + +/* http://retrowiki.es/viewtopic.php?t=200032843&start=16#p200078815 */ +/* https://worldofspectrum.org/faq/reference/tmxreference.htm */ +/* https://sinclair.wiki.zxnet.co.uk/wiki/Timex_2000_series */ +#define Z_TIMEX_SINCLAIR_2068_CPU_HZ 3528000 /* OK? */ +#define Z_TIMEX_SINCLAIR_2068_PSG_HZ 1764750 /* OK? */ +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_FRAME 70512 /* OK? */ +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_SCANLINE 226 /* OK? */ +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_HBLANK 48 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_FULL_BORDER_LINE 176 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_LATERAL_BORDER_LINE 24 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_PAPER_LINE 128 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_PER_INT 32 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_VBLANK 0 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_INT 24 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_INT_END 56 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_TOP_BORDER 3584 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_PAPER_REGION 14336 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_PAPER 14360 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_PAPER_END 57272 +#define Z_TIMEX_SINCLAIR_2068_CYCLES_AT_BOTTOM_BORDER 57344 + + +#define Z_DIDAKTIK_M_CPU_HZ +#define Z_DIDAKTIK_M_CYCLES_PER_FRAME +#define Z_DIDAKTIK_M_CYCLES_PER_SCANLINE +#define Z_DIDAKTIK_M_CYCLES_PER_HBLANK +#define Z_DIDAKTIK_M_CYCLES_PER_VBLANK +#define Z_DIDAKTIK_M_CYCLES_PER_FULL_BORDER_LINE +#define Z_DIDAKTIK_M_CYCLES_PER_LATERAL_BORDER_LINE +#define Z_DIDAKTIK_M_CYCLES_PER_PAPER_LINE +#define Z_DIDAKTIK_M_CYCLES_PER_INT +#define Z_DIDAKTIK_M_CYCLES_AT_VBLANK +#define Z_DIDAKTIK_M_CYCLES_AT_INT +#define Z_DIDAKTIK_M_CYCLES_AT_TOP_BORDER +#define Z_DIDAKTIK_M_CYCLES_AT_PAPER_REGION +#define Z_DIDAKTIK_M_CYCLES_AT_BOTTOM_BORDER +#define Z_DIDAKTIK_M_CYCLES_AT_PAPER +#define Z_DIDAKTIK_M_CYCLES_AT_PAPER_END + +/* MARK: - Firmware ADC */ +/*-------------------------------------------------------. +| High _______ _______ | +| | Pulse | Pulse | Pulse | Pulse Square wave | +| | |_______| |_______ ... | +| Low | +|--------------------------------------------------------| +| 1) Pilot | +| ______ | +| | 2168 | 2168 x 8063 times (if block contains header) | +| | |______ x 3223 times (if block contains data) | +|--------------------------------------------------------| +| 2) Sync | 3) Pause | +| _____ | | +| | 667 | 735 | 1 second | +| | |_______ | ____________________________________ | +| | +'=======================================================*/ + +#define Z_ZX_SPECTRUM_ADC_PULSES_PER_HEADER_PILOT 8063 /* 5 seconds */ +#define Z_ZX_SPECTRUM_ADC_PULSES_PER_DATA_PILOT 3223 /* 2 seconds */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_PILOT_PULSE 2168 /* 807.2 Hz */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_SYNC_HIGH_PULSE 667 /* 2623.7 Hz */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_SYNC_LOW_PULSE 735 /* 2381 Hz */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_BIT_0_PULSE 855 /* 2046.8 Hz */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_BIT_1_PULSE 1710 /* 1023.4 Hz */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_TAIL 945 +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_PAUSE 3500000 +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_HEADER_PILOT 17482752 /* 2168 * 8064 */ +#define Z_ZX_SPECTRUM_ADC_CYCLES_PER_DATA_PILOT 6989632 /* 2168 * 3224 */ +#define Z_ZX_SPECTRUM_ADC_BLOCK_CONTENT_HEADER 0 +#define Z_ZX_SPECTRUM_ADC_BLOCK_CONTENT_DATA 255 + +typedef Z_PACKED_STRUCTURE_BEGIN { + zuint8 file_type; + zuint8 file_name[10]; + zuint16 data_size; + + union { struct {zuint16 autostart_line; + zuint16 size; + } program; + + struct {zuint8 unused1; + zuint8 variable_name; + zuint16 unused2; + } array; + + struct {zuint16 start_address; + zuint16 unused; + } code_file; + } parameters; +} Z_PACKED_STRUCTURE_END Z_ZXSpectrumHeaderBlock; + +#define Z_ZX_SPECTRUM_FILE_TYPE_PROGRAM 0 +#define Z_ZX_SPECTRUM_FILE_TYPE_NUMBER_ARRAY 1 +#define Z_ZX_SPECTRUM_FILE_TYPE_CHARACTER_ARRAY 2 +#define Z_ZX_SPECTRUM_FILE_TYPE_CODE_FILE 3 + +#endif /* Z_hardware_machine_computer_ZX_Spectrum_H */ diff --git a/projects/Zeta/API/Z/inspection/C++.h b/projects/Zeta/API/Z/inspection/C++.h new file mode 100644 index 0000000..d7c7107 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++.h @@ -0,0 +1,76 @@ +/* Zeta API - Z/inspection/C++.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_H +#define Z_inspection_CPP_H + +#include +#include + +#ifdef __cplusplus + +# ifndef Z_CPP +# if __cplusplus >= 202002L +# define Z_CPP Z_CPP20 +# elif __cplusplus >= 201703L +# define Z_CPP Z_CPP17 +# elif __cplusplus >= 201402L +# define Z_CPP Z_CPP14 +# elif __cplusplus >= 201103L +# define Z_CPP Z_CPP11 +# elif __cplusplus >= 199711L +# define Z_CPP Z_CPP98 +# else +# define Z_CPP Z_CPP1 +# endif +# endif + +# if Z_CPP == Z_CPP20 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP20 +# elif Z_CPP == Z_CPP17 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP17 +# elif Z_CPP == Z_CPP14 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP14 +# elif Z_CPP == Z_CPP11 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP11 +# elif Z_CPP == Z_CPP03 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP03 +# elif Z_CPP == Z_CPP98 +# include +# define Z_CPP_NAME Z_CPP_NAME_CPP98 +# elif Z_CPP == Z_CPP2 +# define Z_CPP_NAME Z_CPP_NAME_CPP2 +# elif Z_CPP == Z_CPP1 +# define Z_CPP_NAME Z_CPP_NAME_CPP1 +# else +# error "Invalid Z_CPP key." +# endif + +#endif + +/* MARK: - Getters */ + +#define Z_CPP_HAS( FEATURE ) Z_IS_TRUE(Z_CPP_HAS_##FEATURE ) +#define Z_CPP_HAS_ATTRIBUTE( ATTRIBUTE ) Z_IS_TRUE(Z_CPP_HAS_ATTRIBUTE_##ATTRIBUTE ) +#define Z_CPP_HAS_IDENTIFIER( IDENTIFIER ) Z_IS_TRUE(Z_CPP_HAS_IDENTIFIER_##IDENTIFIER ) +#define Z_CPP_HAS_LITERAL( LITERAL ) Z_IS_TRUE(Z_CPP_HAS_LITERAL_##LITERAL ) +#define Z_CPP_HAS_OPERATOR( OPERATOR ) Z_IS_TRUE(Z_CPP_HAS_OPERATOR_##OPERATOR ) +#define Z_CPP_HAS_OPERATOR_CASE( OPERATOR, CASE ) Z_IS_TRUE(Z_CPP_HAS_OPERATOR_CASE_##OPERATOR##_##CASE ) +#define Z_CPP_HAS_PREPROCESSOR_IDENTIFIER(PREPROCESSOR_IDENTIFIER) Z_IS_TRUE(Z_CPP_HAS_PREPROCESSOR_IDENTIFIER_##PREPROCESSOR_IDENTIFIER) +#define Z_CPP_HAS_PREPROCESSOR_OPERATOR( PREPROCESSOR_OPERATOR ) Z_IS_TRUE(Z_CPP_HAS_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR ) +#define Z_CPP_HAS_SPECIFIER( SPECIFIER ) Z_IS_TRUE(Z_CPP_HAS_SPECIFIER_##SPECIFIER ) +#define Z_CPP_HAS_SPECIFIER_CASE( SPECIFIER, CASE ) Z_IS_TRUE(Z_CPP_HAS_SPECIFIER_CASE_##SPECIFIER##_##CASE ) +#define Z_CPP_HAS_STORAGE_CLASS( STORAGE_CLASS ) Z_IS_TRUE(Z_CPP_HAS_STORAGE_CLASS_##STORAGE_CLASS ) +#define Z_CPP_HAS_TYPE( TYPE ) Z_IS_TRUE(Z_CPP_HAS_TYPE_##TYPE ) + +#endif /* Z_inspection_CPP_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++03.h b/projects/Zeta/API/Z/inspection/C++/modules/C++03.h new file mode 100644 index 0000000..6d983f7 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++03.h @@ -0,0 +1,16 @@ +/* Zeta API - Z/inspection/C++/modules/C++03.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP03_H +#define Z_inspection_CPP_modules_CPP03_H + +#include + +#define Z_LANGUAGE_HAS_CPP03_VALUE_INITIALIZATION 1 + +#endif /* Z_inspection_CPP_modules_CPP03_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++11.h b/projects/Zeta/API/Z/inspection/C++/modules/C++11.h new file mode 100644 index 0000000..eb5d88d --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++11.h @@ -0,0 +1,90 @@ +/* Zeta API - Z/inspection/C++/modules/C++11.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP11_H +#define Z_inspection_CPP_modules_CPP11_H + +#include /* Paper Test macro */ + /* ------- ------------------------------------------------------ */ +#define Z_LANGUAGE_HAS_CPP11_ANONYMOUS_TYPE_AS_TEMPLATE_ARGUMENT 1 /* N2657 */ +#define Z_LANGUAGE_HAS_CPP11_C99_PREPROCESSOR 1 /* N1653 */ +#define Z_LANGUAGE_HAS_CPP11_COPY_LIST_INITIALIZATION 1 /* N2672 __cpp_initializer_lists >= 200806L (!) */ +#define Z_LANGUAGE_HAS_CPP11_DEFAULT_MEMBER_INITIALIZER 1 /* N2756 __cpp_nsdmi >= 200809L (!) */ +#define Z_LANGUAGE_HAS_CPP11_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE 1 /* DR226 */ +#define Z_LANGUAGE_HAS_CPP11_DELEGATING_CONSTRUCTORS 1 /* N1986 __cpp_delegating_constructors >= 200604L (!) */ +#define Z_LANGUAGE_HAS_CPP11_DELETED_FUNCTION 1 /* N2346 */ +#define Z_LANGUAGE_HAS_CPP11_DIRECT_LIST_INITIALIZATION 1 /* N2672 __cpp_initializer_lists >= 200806L (!) */ +#define Z_LANGUAGE_HAS_CPP11_EXPLICIT_CONVERSION_OPERATOR 1 /* N2437 */ +#define Z_LANGUAGE_HAS_CPP11_EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION 1 /* N2346 */ +#define Z_LANGUAGE_HAS_CPP11_EXPRESSION_SFINAE 1 /* N2634 + DR339? */ +#define Z_LANGUAGE_HAS_CPP11_EXTENDED_FRIEND_DECLARATION 1 /* N1791 */ +#define Z_LANGUAGE_HAS_CPP11_EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS 1 /* N2555 */ +#define Z_LANGUAGE_HAS_CPP11_EXTERN_TEMPLATE 1 /* N1987 */ +#define Z_LANGUAGE_HAS_CPP11_FIXED_ENUMERATION 1 /* N2347 */ +#define Z_LANGUAGE_HAS_CPP11_INHERITING_CONSTRUCTORS 1 /* N2540 __cpp_inheriting_constructors >= 200802L (!) */ +#define Z_LANGUAGE_HAS_CPP11_INITIALIZATION_OF_CLASS_OBJECT_BY_RVALUE 1 /* N1610 */ +#define Z_LANGUAGE_HAS_CPP11_INITIALIZER_LIST 1 /* N2672 __cpp_initializer_lists >= 200806L (!) */ +#define Z_LANGUAGE_HAS_CPP11_INLINE_NAMESPACE 1 /* N2535 */ +#define Z_LANGUAGE_HAS_CPP11_LAMBDA 1 /* N2550 __cpp_lambdas >= 200907L (!) + N2658 __cpp_lambdas >= 200907L (!) + N2927 __cpp_lambdas >= 200907L (!) */ +#define Z_LANGUAGE_HAS_CPP11_LOCAL_TYPE_AS_TEMPLATE_ARGUMENT 1 /* N2657 */ +#define Z_LANGUAGE_HAS_CPP11_MOVE_SPECIAL_MEMBER_FUNCTIONS 1 /* N3053 */ +#define Z_LANGUAGE_HAS_CPP11_MULTI_DECLARATOR_AUTO 1 /* N1737 */ +#define Z_LANGUAGE_HAS_CPP11_OPAQUE_ENUMERATION_DECLARATION 1 /* N2764 */ + /* DR1206 */ +#define Z_LANGUAGE_HAS_CPP11_RANGE_BASED_FOR 1 /* N2930 __cpp_range_based_for >= 200907L (!) */ +#define Z_LANGUAGE_HAS_CPP11_REFERENCE_QUALIFIED_NON_STATIC_MEMBER_FUNCTION 1 /* N2439 __cpp_ref_qualifiers >= 200710L (!) */ +#define Z_LANGUAGE_HAS_CPP11_REMOVAL_OF_AUTO_AS_STORAGE_CLASS 1 /* N2546 */ +#define Z_LANGUAGE_HAS_CPP11_RIGHT_ANGLE_BRACKETS 1 /* N1757 */ +#define Z_LANGUAGE_HAS_CPP11_RVALUE_REFERENCE 1 /* N2118 __cpp_rvalue_references >= 200610L (!) + N2844 + CWG1138 */ +#define Z_LANGUAGE_HAS_CPP11_SCOPED_ENUMERATION 1 /* N2347 */ +#define Z_LANGUAGE_HAS_CPP11_STD_LAYOUT 1 /* N2342 */ +#define Z_LANGUAGE_HAS_CPP11_STANDARDIZED_ATTRIBUTE_SYNTAX 1 /* N2761 __cpp_attributes >= 200809L (!) */ +#define Z_LANGUAGE_HAS_CPP11_STATIC_ASSERTION 1 /* N1720 __cpp_static_assert >= 200410L (!) */ +#define Z_LANGUAGE_HAS_CPP11_THREAD_SAFE_STATIC_INITIALIZATION 1 /* N2660 __cpp_threadsafe_static_init >= 200806L (!) */ +#define Z_LANGUAGE_HAS_CPP11_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 /* */ +#define Z_LANGUAGE_HAS_CPP11_TRAILING_RETURN_TYPE 1 /* N2541 */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_ALIAS 1 /* N2258 __cpp_alias_templates >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_ALIAS_TEMPLATE 1 /* N2258 __cpp_alias_templates >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_UNIVERSAL_CHARACTER_NAME 1 /* N2170 */ +#define Z_LANGUAGE_HAS_CPP11_UNRESTRICTED_UNION 1 /* N2544 */ +#define Z_LANGUAGE_HAS_CPP11_VARIADIC_TEMPLATE 1 /* N2242 __cpp_variadic_templates >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_ATTRIBUTE_CARRIES_DEPENDENCY 1 /* N2782 __has_cpp_attribute(carries_dependency) >= 200809L (!) */ +#define Z_LANGUAGE_HAS_CPP11_ATTRIBUTE_NORETURN 1 /* N2761 __has_cpp_attribute(noreturn) >= 200809L (!) */ +#define Z_LANGUAGE_HAS_CPP11_IDENTIFIER_FUNC 1 /* N2340 */ +#define Z_LANGUAGE_HAS_CPP11_LITERAL_NULLPTR 1 /* N2431 */ +#define Z_LANGUAGE_HAS_CPP11_LITERAL_RAW_STRING 1 /* N2442 __cpp_raw_strings >= 200710L (!) */ +#define Z_LANGUAGE_HAS_CPP11_LITERAL_USER_DEFINED 1 /* N2765 __cpp_user_defined_literals >= 200809L (!) */ +#define Z_LANGUAGE_HAS_CPP11_LITERAL_UTF8_STRING 1 /* N2442 __cpp_unicode_literals >= 200710L (!) */ +#define Z_LANGUAGE_HAS_CPP11_OPERATOR_ALIGNOF 1 /* N2341 */ +#define Z_LANGUAGE_HAS_CPP11_OPERATOR_NOEXCEPT 1 /* N3050 */ +#define Z_LANGUAGE_HAS_CPP11_OPERATOR_CASE_SIZEOF_NON_STATIC_DATA_MEMBER 1 /* N2253 + DR850 */ +#define Z_LANGUAGE_HAS_CPP11_OPERATOR_CASE_SIZEOF_PARAMETER_PACK 1 /* N2242 __cpp_variadic_templates >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_ALIGNAS 1 /* N2341 */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_CONSTEXPR 1 /* N2235 __cpp_constexpr >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_DECLTYPE 1 /* N2343 __cpp_decltype >= 200707L (!) */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_FINAL 1 /* N2928 + N3206 + N3272 */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_NOEXCEPT 1 /* N3050 */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_OVERRIDE 1 /* N2928 + N3206 + N3272 */ +#define Z_LANGUAGE_HAS_CPP11_SPECIFIER_CASE_DECLTYPE_INCOMPLETE_RETURN_TYPE 1 /* N3276 */ +#define Z_LANGUAGE_HAS_CPP11_STORAGE_CLASS_THREAD_LOCAL 1 /* N2659 */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_AUTO 1 /* N1984 */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_CHAR16_T 1 /* N2249 __cpp_unicode_characters >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_CHAR32_T 1 /* N2249 __cpp_unicode_characters >= 200704L (!) */ +#define Z_LANGUAGE_HAS_CPP11_TYPE_LONG_LONG 1 /* N1811 */ + +#endif /* Z_inspection_CPP_modules_CPP11_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++14.h b/projects/Zeta/API/Z/inspection/C++/modules/C++14.h new file mode 100644 index 0000000..1702b5b --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++14.h @@ -0,0 +1,27 @@ +/* Zeta API - Z/inspection/C++/modules/C++14.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP14_H +#define Z_inspection_CPP_modules_CPP14_H + +#include /* Paper Test macro */ + /* ----- ---------------------------------------------- */ +#define Z_LANGUAGE_HAS_CPP14_APOSTROPHE_AS_DIGIT_SEPARATOR 1 /* N3781 __cpp_digit_separator(s) >= 201309L (?) */ +#define Z_LANGUAGE_HAS_CPP14_CONSTEXPR_FUNCTION 1 /* N3652 __cpp_constexpr >= 201304L (+) */ +#define Z_LANGUAGE_HAS_CPP14_CONTEXTUAL_CONVERSION 1 /* N3323 */ +#define Z_LANGUAGE_HAS_CPP14_DEFAULT_MEMBER_INITIALIZER_FOR_AGGREGATE 1 /* N3653 __cpp_aggregate_nsdmi >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_GENERIC_LAMBDA 1 /* N3649 __cpp_generic_lambdas >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_INITIALIZED_LAMBDA_CAPTURE 1 /* N3648 __cpp_init_captures >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_RETURN_TYPE_DEDUCTION_FOR_NORMAL_FUNCTION 1 /* N3638 __cpp_return_type_deduction >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_SIZED_DEALLOCATION 1 /* N3778 __cpp_sized_deallocation >= 201309L (!) */ +#define Z_LANGUAGE_HAS_CPP14_VARIABLE_TEMPLATE 1 /* N3651 __cpp_variable_templates >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_ATTRIBUTE_DEPRECATED 1 /* N3760 __has_cpp_attribute(deprecated) >= 201309L (!) */ +#define Z_LANGUAGE_HAS_CPP14_LITERAL_BINARY_INTEGRAL 1 /* N3472 __cpp_binary_literals >= 201304L (!) */ +#define Z_LANGUAGE_HAS_CPP14_SPECIFIER_CASE_DECLTYPE_AUTO 1 /* N3638 __cpp_decltype_auto >= 201304L (!) */ + +#endif /* Z_inspection_CPP_modules_CPP14_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++17.h b/projects/Zeta/API/Z/inspection/C++/modules/C++17.h new file mode 100644 index 0000000..1bacde5 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++17.h @@ -0,0 +1,59 @@ +/* Zeta API - Z/inspection/C++/modules/C++17.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP17_H +#define Z_inspection_CPP_modules_CPP17_H + +#include /* Paper Test macro */ + /* ------- ---------------------------------------------------- */ +#define Z_LANGUAGE_HAS_CPP17_AGGREGATE_INITIALIZATION_FOR_DERIVED_CLASS 1 /* P0017R1 __cpp_aggregate_bases >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTE_USING_PREFIX 1 /* P0028R4 */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTES_FOR_ENUMERATOR 1 /* N4266 __cpp_enumerator_attributes >= 201411L (!) */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTES_FOR_NAMESPACE 1 /* N4266 __cpp_namespace_attributes >= 201411L (!) */ +#define Z_LANGUAGE_HAS_CPP17_AUTO_DEDUCTION_FROM_LIST_INITIALIZATION 1 /* N3922 */ +#define Z_LANGUAGE_HAS_CPP17_CONSTEXPR_IF 1 /* P0292R2 __cpp_if_constexpr >= 201606L (!) */ +#define Z_LANGUAGE_HAS_CPP17_CONSTEXPR_LAMBDA 1 /* P0170R1 __cpp_constexpr >= 201603L (+) */ +#define Z_LANGUAGE_HAS_CPP17_DEDUCTION_GUIDES_FOR_CLASS_TEMPLATE 1 /* P0091R3 __cpp_deduction_guides >= 201606L (!) + P0512R0 __cpp_deduction_guides >= 201611L (+) + P0620R0 __cpp_deduction_guides >= 201703L (+) */ +#define Z_LANGUAGE_HAS_CPP17_DIFFERING_BEGIN_AND_END_TYPES_IN_RANGE_BASED_FOR 1 /* P0184R0 __cpp_range_based_for >= 201603L (+) */ +#define Z_LANGUAGE_HAS_CPP17_DIRECT_LIST_INITIALIZATION_FOR_FIXED_ENUMERATION 1 /* P0138R2 */ +#define Z_LANGUAGE_HAS_CPP17_EXPRESSION_EVALUATION_ORDER 1 /* P0145R3 + P0400R0 */ +#define Z_LANGUAGE_HAS_CPP17_FOLD_EXPRESSION 1 /* N4295 __cpp_fold_expressions >= 201411L (!) */ +#define Z_LANGUAGE_HAS_CPP17_GUARANTEED_COPY_ELISION 1 /* P0135R1 __cpp_guaranteed_copy_elision >= 201606L (!) */ +#define Z_LANGUAGE_HAS_CPP17_IF_WITH_INITIALIZER 1 /* P0305R1 */ +#define Z_LANGUAGE_HAS_CPP17_IGNORING_OF_UNKNOWN_ATTRIBUTES 1 /* P0283R2 */ +#define Z_LANGUAGE_HAS_CPP17_INHERITING_CONSTRUCTORS 1 /* P0136R1 __cpp_inheriting_constructors >= 201511L (+) */ +#define Z_LANGUAGE_HAS_CPP17_INLINE_VARIABLE 1 /* P0386R2 __cpp_inline_variables >= 201606L (!) */ +#define Z_LANGUAGE_HAS_CPP17_LAMBDA_CAPTURE_OF_STAR_THIS_BY_VALUE 1 /* P0018R3 __cpp_capture_star_this >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_NESTED_NAMESPACE_DEFINITION 1 /* N4230 __cpp_nested_namespace_definitions >= 201411L (?) */ +#define Z_LANGUAGE_HAS_CPP17_NOEXCEPT_AS_PART_OF_THE_FUNCTION_TYPE 1 /* P0012R1 __cpp_noexcept_function_type >= 201510L (!) */ +#define Z_LANGUAGE_HAS_CPP17_NON_TYPE_TEMPLATE_ARGUMENTS 1 /* N4268 __cpp_nontype_template_args >= 201411L (!) */ +#define Z_LANGUAGE_HAS_CPP17_NON_TYPE_TEMPLATE_PARAMETER_WITH_AUTO_TYPE 1 /* P0127R2 __cpp_nontype_template_parameter_auto >= 201606L (!) + __cpp_template_auto >= 201606L (?) */ +#define Z_LANGUAGE_HAS_CPP17_OVER_ALIGNED_DYNAMIC_MEMORY_ALLOCATION 1 /* P0035R4 __cpp_aligned_new >= 201606L (!) */ +#define Z_LANGUAGE_HAS_CPP17_REMOVAL_OF_BOOL_INCREMENT 1 /* P0002R1 */ +#define Z_LANGUAGE_HAS_CPP17_REMOVAL_OF_DYNAMIC_EXCEPTION_SPECIFICATION 1 /* P0003R5 */ +#define Z_LANGUAGE_HAS_CPP17_REMOVAL_OF_REGISTER_AS_STORAGE_CLASS 1 /* P0001R1 */ +#define Z_LANGUAGE_HAS_CPP17_REMOVAL_OF_TRIGRAPHS 1 /* N4086 */ +#define Z_LANGUAGE_HAS_CPP17_SAFE_UNARY_FOLD_EXPRESSION 1 /* P0036R0 __cpp_fold_expressions >= 201603L (+) */ +#define Z_LANGUAGE_HAS_CPP17_STATIC_ASSERTION_WITH_NO_MESSAGE 1 /* N3928 __cpp_static_assert >= 201411L (+) */ +#define Z_LANGUAGE_HAS_CPP17_STRUCTURED_BINDING 1 /* P0217R3 __cpp_structured_bindings >= 201606L (!) */ +#define Z_LANGUAGE_HAS_CPP17_SWITCH_WITH_INITIALIZER 1 /* P0305R1 */ +#define Z_LANGUAGE_HAS_CPP17_TEMPLATE_TEMPLATE_ARGUMENT_MATCHING 1 /* P0522R0 __cpp_template_template_args >= 201611L (!) */ +#define Z_LANGUAGE_HAS_CPP17_TYPENAME_IN_TEMPLATE_TEMPLATE_PARAMETER 1 /* N4051 */ +#define Z_LANGUAGE_HAS_CPP17_VARIADIC_USING 1 /* P0195R2 __cpp_variadic_using >= 201611L (!) */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTE_FALLTHROUGH 1 /* P0188R1 __has_cpp_attribute(fallthrough) >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTE_MAYBE_UNUSED 1 /* P0212R1 __has_cpp_attribute(maybe_unused) >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_ATTRIBUTE_NODISCARD 1 /* P0189R1 __has_cpp_attribute(nodiscard) >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_LITERAL_HEXADECIMAL_FLOATING_POINT 1 /* P0245R1 __cpp_hex_float >= 201603L (!) */ +#define Z_LANGUAGE_HAS_CPP17_LITERAL_UTF8_CHARACTER 1 /* N4267 __cpp_unicode_characters >= 201411L (?) */ +#define Z_LANGUAGE_HAS_CPP17_PREPROCESSOR_OPERATOR_HAS_INCLUDE 1 /* P0061R1 defined(__has_include) */ + +#endif /* Z_inspection_CPP_modules_CPP17_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++20.h b/projects/Zeta/API/Z/inspection/C++/modules/C++20.h new file mode 100644 index 0000000..6288980 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++20.h @@ -0,0 +1,53 @@ +/* Zeta API - Z/inspection/C++/modules/C++20.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP20_H +#define Z_inspection_CPP_modules_CPP20_H + +#include /* Paper Test macro */ + /* ------- ----------------------------------------------------- */ +#define Z_LANGUAGE_HAS_CPP20_CONCEPT 1 /* P0734R0 */ +#define Z_LANGUAGE_HAS_CPP20_CONST_LVALUE_MEMBER_FUNCTION_POINTER_FOR_RVALUE 1 /* P0704R1 */ +//#define Z_LANGUAGE_HAS_CPP20_const mismatch with defaulted copy constructor 1 /* P0641R2 */ +#define Z_LANGUAGE_HAS_CPP20_CONSTEXPR_VIRTUAL_FUNCTION 1 /* P1064R0 */ +#define Z_LANGUAGE_HAS_CPP20_CONVERSION_TO_UNSIZED_ARRAY 1 /* P0388R4 */ +#define Z_LANGUAGE_HAS_CPP20_STRUCTURED_BINDING 1 /* P1091R3 + P1381R1 */ +#define Z_LANGUAGE_HAS_CPP20_DEDUCTION_GUIDES_FOR_AGGREGATE 1 /* P1816R0 __cpp_deduction_guides >= 201907L (+) */ +#define Z_LANGUAGE_HAS_CPP20_DEDUCTION_GUIDES_FOR_CLASS_ALIAS_TEMPLATE 1 /* P1814R0 __cpp_deduction_guides >= 201907L (+) */ +#define Z_LANGUAGE_HAS_CPP20_DEFAULT_CONSTRUCTIBLE_AND_ASSIGNABLE_STATELESS_LAMBDA 1 /* P0624R2 */ +#define Z_LANGUAGE_HAS_CPP20_DEFAULT_MEMBER_INITIALIZER_FOR_BIT_FIELD 1 /* P0683R1 */ +#define Z_LANGUAGE_HAS_CPP20_DESIGNATED_INITIALIZATION 1 /* P0329R4 */ +#define Z_LANGUAGE_HAS_CPP20_DESTROYING_DELETE 1 /* P0722R3 __cpp_impl_destroying_delete >= 201806L (!) */ +#define Z_LANGUAGE_HAS_CPP20_EXPLICIT_LAMBDA_CAPTURE_OF_THIS_BY_VALUE 1 /* P0409R2 */ +#define Z_LANGUAGE_HAS_CPP20_LAMBDA_IN_UNEVALUATED_CONTEXT 1 /* P0315R4 */ +#define Z_LANGUAGE_HAS_CPP20_NESTED_INLINE_NAMESPACE_DEFINITION 1 /* P1094R2 */ +#define Z_LANGUAGE_HAS_CPP20_NO_ACCESS_CHECKING_ON_SPECIALIZATIONS 1 /* P0692R1 */ +#define Z_LANGUAGE_HAS_CPP20_OPTIONAL_TYPENAME 1 /* P0634R3 */ +#define Z_LANGUAGE_HAS_CPP20_PARAMETER_PACK_EXPANSION_IN_LAMBDA_CAPTURE 1 /* P0780R2 */ +#define Z_LANGUAGE_HAS_CPP20_PARENTHESIZED_LIST_INITIALIZATION_FOR_AGGREGATE 1 /* P0960R3 __cpp_aggregate_paren_init >= 201902L (!) */ +#define Z_LANGUAGE_HAS_CPP20_PREPROCESSOR_IDENTIFIER_VA_OPT 1 /* P0306R4 + P1042R1 */ +#define Z_LANGUAGE_HAS_CPP20_RANGE_BASED_FOR_WITH_INITIALIZER 1 /* P0614R1 */ +#define Z_LANGUAGE_HAS_CPP20_SAFE_OPERATOR_LESS_THAN_WITH_FUNCTION_ON_LHS 1 /* P0846R0 */ +#define Z_LANGUAGE_HAS_CPP20_STRUCTURE_AS_TEMPLATE_PARAMETER 1 /* P0732R2 __cpp_nontype_template_parameter_class >= 201806L (!) */ +#define Z_LANGUAGE_HAS_CPP20_TEMPLATE_PARAMETER_LIST_FOR_GENERIC_LAMBDA 1 /* P0428R2 */ +#define Z_LANGUAGE_HAS_CPP20_USING_ENUM 1 /* P1099R5 __cpp_using_enum >= 201907L (!) */ +#define Z_LANGUAGE_HAS_CPP20_ATTRIBUTE_LIKELY 1 /* P0479R5 __has_cpp_attribute(likely) >= 201803L (!) */ +#define Z_LANGUAGE_HAS_CPP20_ATTRIBUTE_NO_UNIQUE_ADDRESS 1 /* P0840R2 __has_cpp_attribute(no_unique_address) >= 201803L (!) */ +#define Z_LANGUAGE_HAS_CPP20_ATTRIBUTE_UNLIKELY 1 /* P0479R5 __has_cpp_attribute(unlikely) >= 201803L (!) */ +#define Z_LANGUAGE_HAS_CPP20_OPERATOR_3_WAY_COMPARISON 1 /* P0515R3 __cpp_impl_three_way_comparison >= 201711L (!) + P1185R2 __cpp_impl_three_way_comparison >= 201907L (+) + P1186R3 __cpp_impl_three_way_comparison >= 201907L (+) + P1630R1 __cpp_impl_three_way_comparison >= 201907L (+) */ +#define Z_LANGUAGE_HAS_CPP20_SPECIFIER_CONDITIONAL_EXPLICIT 1 /* P0892R2 __cpp_conditional_explicit >= 201806L (!) */ +#define Z_LANGUAGE_HAS_CPP20_SPECIFIER_CONSTEVAL 1 /* P1073R3 */ +#define Z_LANGUAGE_HAS_CPP20_SPECIFIER_CONSTINIT 1 /* P1143R2 __cpp_constinit >= 201907L (!) */ +#define Z_LANGUAGE_HAS_CPP20_TYPE_CHAR8_T 1 /* P0482R6 __cpp_char8_t >= 201811L (!) */ + +#endif /* Z_inspection_CPP_modules_CPP20_H */ diff --git a/projects/Zeta/API/Z/inspection/C++/modules/C++98.h b/projects/Zeta/API/Z/inspection/C++/modules/C++98.h new file mode 100644 index 0000000..0283ae2 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C++/modules/C++98.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/inspection/C++/modules/C++98.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_CPP_modules_CPP98_H +#define Z_inspection_CPP_modules_CPP98_H + + /* Test macro */ + /* ------------------------------- */ +#define Z_LANGUAGE_HAS_CPP98_EXCEPTIONS 1 /* __cpp_exceptions >= 199711L (!) */ +#define Z_LANGUAGE_HAS_CPP98_RTTI 1 /* __cpp_rtti >= 199711L (!) */ +#define Z_LANGUAGE_HAS_CPP98_SFINAE 1 +#define Z_LANGUAGE_HAS_CPP98_TYPE_BOOL 1 +#define Z_LANGUAGE_HAS_CPP98_TYPE_WCHAR_T 1 + +#endif /* Z_inspection_CPP_modules_CPP98_H */ diff --git a/projects/Zeta/API/Z/inspection/C.h b/projects/Zeta/API/Z/inspection/C.h new file mode 100644 index 0000000..24672bf --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C.h @@ -0,0 +1,75 @@ +/* Zeta API - Z/inspection/C.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_H +#define Z_inspection_C_H + +#include +#include + +#ifndef Z_C +# if !defined(__STDC__) && !defined(__cplusplus) +# define Z_C Z_C78 +# elif !defined(__STDC_VERSION__) +# define Z_C Z_C89 +# elif __STDC_VERSION__ >= 201710L +# define Z_C Z_C17 +# elif __STDC_VERSION__ >= 201112L +# define Z_C Z_C11 +# elif __STDC_VERSION__ >= 199901L +# define Z_C Z_C99 +# elif __STDC_VERSION__ >= 199409L +# define Z_C Z_C95 +# else +# define Z_C Z_C90 +# endif +#endif + +#if Z_C == Z_C17 +# include +# define Z_C_NAME Z_C_NAME_C17 +#elif Z_C == Z_C11 +# include +# define Z_C_NAME Z_C_NAME_C11 +#elif Z_C == Z_C99 +# include +# define Z_C_NAME Z_C_NAME_C99 +#elif Z_C == Z_C95 +# include +# define Z_C_NAME Z_C_NAME_C95 +#elif Z_C == Z_C90 +# include +# define Z_C_NAME Z_C_NAME_C90 +#elif Z_C == Z_C89 +# include +# define Z_C_NAME Z_C_NAME_C89 +#elif Z_C == Z_C78 +# include +# define Z_C_NAME Z_C_NAME_C78 +#else +# error "Invalid Z_C key." +#endif + +/* MARK: - Getters */ + +#define Z_C_HAS( FEATURE ) Z_IS_TRUE(Z_C_HAS_##FEATURE ) +#define Z_C_HAS_ATTRIBUTE( ATTRIBUTE ) Z_IS_TRUE(Z_C_HAS_ATTRIBUTE_##ATTRIBUTE ) +#define Z_C_HAS_ESCAPE_SEQUENCE( ESCAPE_SEQUENCE ) Z_IS_TRUE(Z_C_HAS_ESCAPE_SEQUENCE_##ESCAPE_SEQUENCE ) +#define Z_C_HAS_IDENTIFIER( IDENTIFIER ) Z_IS_TRUE(Z_C_HAS_IDENTIFIER_##IDENTIFIER ) +#define Z_C_HAS_LITERAL( LITERAL ) Z_IS_TRUE(Z_C_HAS_LITERAL_##LITERAL ) +#define Z_C_HAS_OPERATOR( OPERATOR ) Z_IS_TRUE(Z_C_HAS_OPERATOR_##OPERATOR ) +#define Z_C_HAS_PREPROCESSOR_DIRECTIVE(PREPROCESSOR_DIRECTIVE) Z_IS_TRUE(Z_C_HAS_PREPROCESSOR_DIRECTIVE_##PREPROCESSOR_DIRECTIVE) +#define Z_C_HAS_PREPROCESSOR_OPERATOR( PREPROCESSOR_OPERATOR ) Z_IS_TRUE(Z_C_HAS_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR ) +#define Z_C_HAS_SPECIFIER( SPECIFIER ) Z_IS_TRUE(Z_C_HAS_SPECIFIER_##SPECIFIER ) +#define Z_C_HAS_STD_PRAGMA( STD_PRAGMA ) Z_IS_TRUE(Z_C_HAS_STD_PRAGMA_##STD_PRAGMA ) +#define Z_C_HAS_STORAGE_CLASS( STORAGE_CLASS ) Z_IS_TRUE(Z_C_HAS_STORAGE_CLASS_##STORAGE_CLASS ) +#define Z_C_HAS_TYPE( TYPE ) Z_IS_TRUE(Z_C_HAS_TYPE_##TYPE ) +#define Z_C_HAS_TYPE_MODIFIER( TYPE_MODIFIER ) Z_IS_TRUE(Z_C_HAS_TYPE_MODIFIER_##TYPE_MODIFIER ) +#define Z_C_HAS_TYPE_QUALIFIER( TYPE_QUALIFIER ) Z_IS_TRUE(Z_C_HAS_TYPE_QUALIFIER_##TYPE_QUALIFIER ) + +#endif /* Z_inspection_C_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C11.h b/projects/Zeta/API/Z/inspection/C/modules/C11.h new file mode 100644 index 0000000..1e7b7aa --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C11.h @@ -0,0 +1,61 @@ +/* Zeta API - Z/inspection/C/modules/C11.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C11_H +#define Z_inspection_C_modules_C11_H + +#include + +#define Z_LANGUAGE_HAS_C11_ANONYMOUS_STRUCTURE_AS_MEMBER 1 +#define Z_LANGUAGE_HAS_C11_ANONYMOUS_UNION_AS_MEMBER 1 +#define Z_LANGUAGE_HAS_C11_GENERIC_SELECTION 1 +#define Z_LANGUAGE_HAS_C11_STATIC_ASSERTION 1 +#define Z_LANGUAGE_HAS_C11_TYPEDEF_REDECLARATION 1 +#define Z_LANGUAGE_HAS_C11_LITERAL_CHAR16_T_CHARACTER 1 +#define Z_LANGUAGE_HAS_C11_LITERAL_CHAR16_T_STRING 1 +#define Z_LANGUAGE_HAS_C11_LITERAL_CHAR32_T_CHARACTER 1 +#define Z_LANGUAGE_HAS_C11_LITERAL_CHAR32_T_STRING 1 +#define Z_LANGUAGE_HAS_C11_LITERAL_UTF8_STRING 1 +#define Z_LANGUAGE_HAS_C11_OPERATOR_ALIGNOF 1 +#define Z_LANGUAGE_HAS_C11_SPECIFIER_ALIGNAS 1 +#define Z_LANGUAGE_HAS_C11_SPECIFIER_NORETURN 1 +#define Z_LANGUAGE_HAS_C11_STORAGE_CLASS_THREAD_LOCAL 1 + +#ifndef __STDC_NO_ATOMICS__ +# define Z_LANGUAGE_HAS_C11_TYPE_MODIFIER_ATOMIC 1 +# define Z_LANGUAGE_HAS_C11_TYPE_QUALIFIER_ATOMIC 1 +#endif + +#ifdef __STDC_NO_COMPLEX__ +# undef Z_LANGUAGE_HAS_C99_TYPE_DOUBLE_COMPLEX +# undef Z_LANGUAGE_HAS_C99_TYPE_DOUBLE_IMAGINARY +# undef Z_LANGUAGE_HAS_C99_TYPE_FLOAT_COMPLEX +# undef Z_LANGUAGE_HAS_C99_TYPE_FLOAT_IMAGINARY +# undef Z_LANGUAGE_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX +# undef Z_LANGUAGE_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY +# undef Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_COMPLEX +# undef Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_IMAGINARY + +#elif defined(__STDC_IEC_559_COMPLEX__) && \ + __STDC_IEC_559_COMPLEX__ == 1 && \ + !defined(Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_IMAGINARY) + +# define Z_LANGUAGE_HAS_C99_TYPE_DOUBLE_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_FLOAT_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_IMAGINARY 1 +#endif + +/* TODO: Multidimensional arrays may be variably modified in every dimension + if VLAs are supported (since C11). */ + +#ifdef __STDC_NO_VLA__ +# undef Z_LANGUAGE_HAS_C99_VLA +#endif + +#endif /* Z_inspection_C_modules_C11_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C23.h b/projects/Zeta/API/Z/inspection/C/modules/C23.h new file mode 100644 index 0000000..0f01059 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C23.h @@ -0,0 +1,34 @@ +/* Zeta API - Z/inspection/C/modules/C23.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C23_H +#define Z_inspection_C_modules_C23_H + +#include + +#define Z_LANGUAGE_HAS_C23_STANDARDIZED_ATTRIBUTE_SYNTAX 1 +#define Z_LANGUAGE_HAS_C23_ATTRIBUTE_DEPRECATED 1 +#define Z_LANGUAGE_HAS_C23_ATTRIBUTE_FALLTHROUGH 1 +#define Z_LANGUAGE_HAS_C23_ATTRIBUTE_MAYBE_UNUSED 1 +#define Z_LANGUAGE_HAS_C23_ATTRIBUTE_NODISCARD 1 +#define Z_LANGUAGE_HAS_C23_LITERAL_BINARY_INTEGRAL 1 +#define Z_LANGUAGE_HAS_C23_LITERAL_BOOL 1 +#define Z_LANGUAGE_HAS_C23_LITERAL_NULLPTR 1 +#define Z_LANGUAGE_HAS_C23_OPERATOR_ALIGNOF 1 +#define Z_LANGUAGE_HAS_C23_OPERATOR_OFFSETOF 1 +#define Z_LANGUAGE_HAS_C23_OPERATOR_TYPEOF 1 +#define Z_LANGUAGE_HAS_C23_PREPROCESSOR_DIRECTIVE_ELIFDEF 1 +#define Z_LANGUAGE_HAS_C23_PREPROCESSOR_DIRECTIVE_ELIFNDEF 1 +#define Z_LANGUAGE_HAS_C23_PREPROCESSOR_DIRECTIVE_EMBED 1 +#define Z_LANGUAGE_HAS_C23_PREPROCESSOR_DIRECTIVE_WARNING 1 +#define Z_LANGUAGE_HAS_C23_PREPROCESSOR_OPERATOR_HAS_INCLUDE 1 +#define Z_LANGUAGE_HAS_C23_SPECIFIER_ALIGNAS 1 +#define Z_LANGUAGE_HAS_C23_STORAGE_CLASS_THREAD_LOCAL 1 +#define Z_LANGUAGE_HAS_C23_TYPE_BOOL 1 + +#endif /* Z_inspection_C_modules_C23_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C78.h b/projects/Zeta/API/Z/inspection/C/modules/C78.h new file mode 100644 index 0000000..68bbac8 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C78.h @@ -0,0 +1,21 @@ +/* Zeta API - Z/inspection/C/modules/C78.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C78_H +#define Z_inspection_C_modules_C78_H + +#define Z_LANGUAGE_HAS_C_OLD_STYLE_FUNCTION 1 +#define Z_LANGUAGE_HAS_C_OPERATOR_SIZEOF 1 +#define Z_LANGUAGE_HAS_C_STORAGE_CLASS_AUTO 1 +#define Z_LANGUAGE_HAS_C_STORAGE_CLASS_EXTERN 1 +#define Z_LANGUAGE_HAS_C_STORAGE_CLASS_REGISTER 1 +#define Z_LANGUAGE_HAS_C_STORAGE_CLASS_STATIC 1 +#define Z_LANGUAGE_HAS_C_TYPE_DOUBLE 1 +#define Z_LANGUAGE_HAS_C_TYPE_FLOAT 1 + +#endif /* Z_inspection_C_modules_C78_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C89.h b/projects/Zeta/API/Z/inspection/C/modules/C89.h new file mode 100644 index 0000000..5572d05 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C89.h @@ -0,0 +1,56 @@ +/* Zeta API - Z/inspection/C/modules/C89.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C89_H +#define Z_inspection_C_modules_C89_H + +#include + +#define Z_LANGUAGE_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +#define Z_LANGUAGE_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION 1 +#define Z_LANGUAGE_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT 1 +#define Z_LANGUAGE_HAS_C89_CONSTRUCT_RETURN 1 +#define Z_LANGUAGE_HAS_C89_CONSTRUCT_ASSIGNMENT 1 +#define Z_LANGUAGE_HAS_C89_CONSTRUCT_NAMESPACE 1 +#define Z_LANGUAGE_HAS_C89_ENUMERATION 1 +#define Z_LANGUAGE_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING 1 +#define Z_LANGUAGE_HAS_C89_FUNCTION_PROTOTYPE 1 +#define Z_LANGUAGE_HAS_C89_INTEGRAL_SWITCH 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_INDENTATION 1 +#define Z_LANGUAGE_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD 1 +#define Z_LANGUAGE_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE 1 +#define Z_LANGUAGE_HAS_C89_STRING_LITERAL_CONCATENATION 1 +#define Z_LANGUAGE_HAS_C89_TRIGRAPHS 1 +#define Z_LANGUAGE_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION 1 +#define Z_LANGUAGE_HAS_C89_ESCAPE_SEQUENCE_ALERT 1 +#define Z_LANGUAGE_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL 1 +#define Z_LANGUAGE_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB 1 +#define Z_LANGUAGE_HAS_C89_LITERAL_FLOAT 1 +#define Z_LANGUAGE_HAS_C89_LITERAL_UNSIGNED 1 +#define Z_LANGUAGE_HAS_C89_LITERAL_WCHAR_T_CHARACTER 1 +#define Z_LANGUAGE_HAS_C89_LITERAL_WCHAR_T_STRING 1 +#define Z_LANGUAGE_HAS_C89_OPERATOR_UNARY_PLUS 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_OPERATOR_PASTING 1 +#define Z_LANGUAGE_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING 1 +#define Z_LANGUAGE_HAS_C89_TYPE_LONG_DOUBLE 1 +#define Z_LANGUAGE_HAS_C89_TYPE_UNSIGNED_CHAR 1 +#define Z_LANGUAGE_HAS_C89_TYPE_UNSIGNED_LONG 1 +#define Z_LANGUAGE_HAS_C89_TYPE_UNSIGNED_SHORT 1 +#define Z_LANGUAGE_HAS_C89_TYPE_VOID 1 +#define Z_LANGUAGE_HAS_C89_TYPE_VOID_POINTER 1 +#define Z_LANGUAGE_HAS_C89_TYPE_MODIFIER_SIGNED 1 +#define Z_LANGUAGE_HAS_C89_TYPE_QUALIFIER_CONST 1 +#define Z_LANGUAGE_HAS_C89_TYPE_QUALIFIER_VOLATILE 1 + +#endif /* Z_inspection_C_modules_C89_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C95.h b/projects/Zeta/API/Z/inspection/C/modules/C95.h new file mode 100644 index 0000000..3200638 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C95.h @@ -0,0 +1,16 @@ +/* Zeta API - Z/inspection/C/modules/C95.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C95_H +#define Z_inspection_C_modules_C95_H + +#include + +#define Z_LANGUAGE_HAS_C95_DIGRAPHS 1 + +#endif /* Z_inspection_C_modules_C95_H */ diff --git a/projects/Zeta/API/Z/inspection/C/modules/C99.h b/projects/Zeta/API/Z/inspection/C/modules/C99.h new file mode 100644 index 0000000..b167909 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/C/modules/C99.h @@ -0,0 +1,61 @@ +/* Zeta API - Z/inspection/C/modules/C99.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_C_modules_C99_H +#define Z_inspection_C_modules_C99_H + +#include + +#define Z_LANGUAGE_HAS_C99_COMPOUND_LITERAL 1 +#define Z_LANGUAGE_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER 1 +#define Z_LANGUAGE_HAS_C99_CPP_STYLE_COMMENT 1 +#define Z_LANGUAGE_HAS_C99_DESIGNATED_INITIALIZATION 1 +#define Z_LANGUAGE_HAS_C99_EMPTY_MACRO_ARGUMENT 1 +#define Z_LANGUAGE_HAS_C99_EXTENDED_IDENTIFIER 1 +#define Z_LANGUAGE_HAS_C99_FLEXIBLE_ARRAY_MEMBER 1 +#define Z_LANGUAGE_HAS_C99_FOR_WITH_DECLARATION 1 +#define Z_LANGUAGE_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS 1 +#define Z_LANGUAGE_HAS_C99_MIXED_DECLARATIONS_AND_CODE 1 +#define Z_LANGUAGE_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +#define Z_LANGUAGE_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX 1 +#define Z_LANGUAGE_HAS_C99_RELIABLE_INTEGER_DIVISION 1 +#define Z_LANGUAGE_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN 1 +#define Z_LANGUAGE_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION 1 +#define Z_LANGUAGE_HAS_C99_REMOVAL_OF_IMPLICIT_INT 1 +#define Z_LANGUAGE_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION 1 +#define Z_LANGUAGE_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 +#define Z_LANGUAGE_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION 1 +#define Z_LANGUAGE_HAS_C99_UNIVERSAL_CHARACTER_NAME 1 +#define Z_LANGUAGE_HAS_C99_VARIADIC_MACRO 1 +#define Z_LANGUAGE_HAS_C99_VLA 1 +#define Z_LANGUAGE_HAS_C99_IDENTIFIER_FUNC 1 +#define Z_LANGUAGE_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT 1 +#define Z_LANGUAGE_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA 1 +#define Z_LANGUAGE_HAS_C99_SPECIFIER_INLINE 1 +#define Z_LANGUAGE_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE 1 +#define Z_LANGUAGE_HAS_C99_STD_PRAGMA_FENV_ACCESS 1 +#define Z_LANGUAGE_HAS_C99_STD_PRAGMA_FP_CONTRACT 1 +#define Z_LANGUAGE_HAS_C99_TYPE_BOOL 1 +#define Z_LANGUAGE_HAS_C99_TYPE_LONG_LONG 1 +#define Z_LANGUAGE_HAS_C99_TYPE_QUALIFIER_RESTRICT 1 + +#if defined(__STDC_IEC_559_COMPLEX__) && __STDC_IEC_559_COMPLEX__ == 1 +# define Z_LANGUAGE_HAS_C99_TYPE_DOUBLE_COMPLEX 1 +# define Z_LANGUAGE_HAS_C99_TYPE_FLOAT_COMPLEX 1 +# define Z_LANGUAGE_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX 1 +# define Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_COMPLEX 1 + +# ifdef _Imaginary_I +# define Z_LANGUAGE_HAS_C99_TYPE_DOUBLE_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_FLOAT_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY 1 +# define Z_LANGUAGE_HAS_C99_TYPE_MODIFIER_IMAGINARY 1 +# endif +#endif + +#endif /* Z_inspection_C_modules_C99_H */ diff --git a/projects/Zeta/API/Z/inspection/ISA.h b/projects/Zeta/API/Z/inspection/ISA.h new file mode 100644 index 0000000..f627c8b --- /dev/null +++ b/projects/Zeta/API/Z/inspection/ISA.h @@ -0,0 +1,206 @@ +/* Zeta API - Z/inspection/ISA.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_ISA_H +#define Z_inspection_ISA_H + +#include +#include + +#ifndef Z_ISA +# include + +# ifdef Z_COMPILER_ISA +# define Z_ISA Z_COMPILER_ISA +# else +# include +# endif +#endif + +#ifndef Z_ISA +# define Z_ISA Z_ISA_UNKNOWN +# define Z_ISA_IS_UNKNOWN 1 +# define Z_ISA_NAME "unknown ISA" +#elif Z_ISA == Z_ISA_6502 +# define Z_ISA_IS_6502 1 +# define Z_ISA_NAME Z_ISA_NAME_6502 +#elif Z_ISA == Z_ISA_AARCH32 +# define Z_ISA_IS_AARCH32 1 +# define Z_ISA_NAME Z_ISA_NAME_AARCH32 +#elif Z_ISA == Z_ISA_AARCH64 +# define Z_ISA_IS_AARCH64 1 +# define Z_ISA_NAME Z_ISA_NAME_AARCH64 +#elif Z_ISA == Z_ISA_ALPHA +# define Z_ISA_IS_ALPHA 1 +# define Z_ISA_NAME Z_ISA_NAME_ALPHA +#elif Z_ISA == Z_ISA_ARC +# define Z_ISA_IS_ARC 1 +# define Z_ISA_NAME Z_ISA_NAME_ARC +#elif Z_ISA == Z_ISA_BLACKFIN +# define Z_ISA_IS_BLACKFIN 1 +# define Z_ISA_NAME Z_ISA_NAME_BLACKFIN +#elif Z_ISA == Z_ISA_CONVEX +# define Z_ISA_IS_CONVEX 1 +# define Z_ISA_NAME Z_ISA_NAME_CONVEX +#elif Z_ISA == Z_ISA_EPIPHANY +# define Z_ISA_IS_EPIPHANY 1 +# define Z_ISA_NAME Z_ISA_NAME_EPIPHANY +#elif Z_ISA == Z_ISA_ESA_370 +# define Z_ISA_IS_ESA_370 1 +# define Z_ISA_NAME Z_ISA_NAME_ESA_370 +#elif Z_ISA == Z_ISA_ESA_390 +# define Z_ISA_IS_ESA_390 1 +# define Z_ISA_NAME Z_ISA_NAME_ESA_390 +#elif Z_ISA == Z_ISA_HEXAGON +# define Z_ISA_IS_HEXAGON 1 +# define Z_ISA_NAME Z_ISA_NAME_HEXAGON +#elif Z_ISA == Z_ISA_IA_64 +# define Z_ISA_IS_IA_64 1 +# define Z_ISA_NAME Z_ISA_NAME_IA_64 +#elif Z_ISA == Z_ISA_LA32R +# define Z_ISA_IS_LA32R 1 +# define Z_ISA_NAME Z_ISA_NAME_LA32R +#elif Z_ISA == Z_ISA_LA32S +# define Z_ISA_IS_LA32S 1 +# define Z_ISA_NAME Z_ISA_NAME_LA32S +#elif Z_ISA == Z_ISA_LA64 +# define Z_ISA_IS_LA64 1 +# define Z_ISA_NAME Z_ISA_NAME_LA64 +#elif Z_ISA == Z_ISA_LANAI +# define Z_ISA_IS_LANAI 1 +# define Z_ISA_NAME Z_ISA_NAME_LANAI +#elif Z_ISA == Z_ISA_LATTICE_MICO_32 +# define Z_ISA_IS_LATTICE_MICO_32 1 +# define Z_ISA_NAME Z_ISA_NAME_LATTICE_MICO_32 +#elif Z_ISA == Z_ISA_M68K +# define Z_ISA_IS_M68K 1 +# define Z_ISA_NAME Z_ISA_NAME_M68K +#elif Z_ISA == Z_ISA_MIPS +# define Z_ISA_IS_MIPS 1 +# define Z_ISA_NAME Z_ISA_NAME_MIPS +#elif Z_ISA == Z_ISA_MIPS64 +# define Z_ISA_IS_MIPS64 1 +# define Z_ISA_NAME Z_ISA_NAME_MIPS64 +#elif Z_ISA == Z_ISA_MSP430 +# define Z_ISA_IS_MSP430 1 +# define Z_ISA_NAME Z_ISA_NAME_MSP430 +#elif Z_ISA == Z_ISA_PA_RISC +# define Z_ISA_IS_PA_RISC 1 +# define Z_ISA_NAME Z_ISA_NAME_PA_RISC +#elif Z_ISA == Z_ISA_PA_RISC_2 +# define Z_ISA_IS_PA_RISC_2 1 +# define Z_ISA_NAME Z_ISA_NAME_PA_RISC_2 +#elif Z_ISA == Z_ISA_POWERPC_32BIT +# define Z_ISA_IS_POWERPC_32BIT 1 +# define Z_ISA_NAME Z_ISA_NAME_POWERPC_32BIT +#elif Z_ISA == Z_ISA_POWERPC_64BIT +# define Z_ISA_IS_POWERPC_64BIT 1 +# define Z_ISA_NAME Z_ISA_NAME_POWERPC_64BIT +#elif Z_ISA == Z_ISA_RV32E +# define Z_ISA_IS_RV32E 1 +# define Z_ISA_NAME Z_ISA_NAME_RV32E +#elif Z_ISA == Z_ISA_RV32I +# define Z_ISA_IS_RV32I 1 +# define Z_ISA_NAME Z_ISA_NAME_RV32I +#elif Z_ISA == Z_ISA_RV64E +# define Z_ISA_IS_RV64E 1 +# define Z_ISA_NAME Z_ISA_NAME_RV64E +#elif Z_ISA == Z_ISA_RV64I +# define Z_ISA_IS_RV64I 1 +# define Z_ISA_NAME Z_ISA_NAME_RV64I +#elif Z_ISA == Z_ISA_RV128I +# define Z_ISA_IS_RV128I 1 +# define Z_ISA_NAME Z_ISA_NAME_RV128I +#elif Z_ISA == Z_ISA_SPARC +# define Z_ISA_IS_SPARC 1 +# define Z_ISA_NAME Z_ISA_NAME_SPARC +#elif Z_ISA == Z_ISA_SPARC_V9 +# define Z_ISA_IS_SPARC_V9 1 +# define Z_ISA_NAME Z_ISA_NAME_SPARC_V9 +#elif Z_ISA == Z_ISA_SUPERH +# define Z_ISA_IS_SUPERH 1 +# define Z_ISA_NAME Z_ISA_NAME_SUPERH +#elif Z_ISA == Z_ISA_SUPERH_5 +# define Z_ISA_IS_SUPERH_5 1 +# define Z_ISA_NAME Z_ISA_NAME_SUPERH_5 +#elif Z_ISA == Z_ISA_VAX +# define Z_ISA_IS_VAX 1 +# define Z_ISA_NAME Z_ISA_NAME_VAX +#elif Z_ISA == Z_ISA_WASM32 +# define Z_ISA_IS_WASM32 1 +# define Z_ISA_NAME Z_ISA_NAME_WASM32 +#elif Z_ISA == Z_ISA_WASM64 +# define Z_ISA_IS_WASM64 1 +# define Z_ISA_NAME Z_ISA_NAME_WASM64 +#elif Z_ISA == Z_ISA_X86_16 +# define Z_ISA_IS_X86_16 1 +# define Z_ISA_NAME Z_ISA_NAME_X86_16 +#elif Z_ISA == Z_ISA_X86_32 +# define Z_ISA_IS_X86_32 1 +# define Z_ISA_NAME Z_ISA_NAME_X86_32 +#elif Z_ISA == Z_ISA_X86_64 +# define Z_ISA_IS_X86_64 1 +# define Z_ISA_NAME Z_ISA_NAME_X86_64 +#elif Z_ISA == Z_ISA_XCORE +# define Z_ISA_IS_XCORE 1 +# define Z_ISA_NAME Z_ISA_NAME_XCORE +#elif Z_ISA == Z_ISA_Z_ARCHITECTURE +# define Z_ISA_IS_Z_ARCHITECTURE 1 +# define Z_ISA_NAME Z_ISA_NAME_Z_ARCHITECTURE +#elif Z_ISA == Z_ISA_Z80 +# define Z_ISA_IS_Z80 1 +# define Z_ISA_NAME Z_ISA_NAME_Z80 +#else +# error "Invalid Z_ISA key." +#endif + +#ifndef Z_ISA_INTEGRAL_ENDIANNESS +# ifdef Z_COMPILER_ISA_INTEGRAL_ENDIANNESS +# define Z_ISA_INTEGRAL_ENDIANNESS Z_COMPILER_ISA_INTEGRAL_ENDIANNESS + +# elif Z_ISA == Z_ISA_6502 || \ + Z_ISA == Z_ISA_BLACKFIN || \ + Z_ISA == Z_ISA_EPIPHANY || \ + Z_ISA == Z_ISA_HEXAGON || \ + Z_ISA == Z_ISA_LA32R || \ + Z_ISA == Z_ISA_LA32S || \ + Z_ISA == Z_ISA_LA64 || \ + Z_ISA == Z_ISA_MSP430 || \ + Z_ISA == Z_ISA_VAX || \ + Z_ISA == Z_ISA_WASM32 || \ + Z_ISA == Z_ISA_WASM64 || \ + Z_ISA == Z_ISA_X86_16 || \ + Z_ISA == Z_ISA_X86_32 || \ + Z_ISA == Z_ISA_X86_64 || \ + Z_ISA == Z_ISA_XCORE || \ + Z_ISA == Z_ISA_Z80 + +# define Z_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE + +# elif Z_ISA == Z_ISA_CONVEX || \ + Z_ISA == Z_ISA_ESA_370 || \ + Z_ISA == Z_ISA_ESA_390 || \ + Z_ISA == Z_ISA_LANAI || \ + Z_ISA == Z_ISA_LATTICE_MICO_32 || \ + Z_ISA == Z_ISA_M68K || \ + Z_ISA == Z_ISA_SPARC || \ + Z_ISA == Z_ISA_Z_ARCHITECTURE + +# define Z_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_BIG + +# elif Z_ISA == Z_ISA_UNKNOWN +# error "It is necessary to define `Z_ISA_INTEGRAL_ENDIANNESS` for unknown ISAs." +# else +# error "It is necessary to define `Z_ISA_INTEGRAL_ENDIANNESS` for bi-endian ISAs not handled by the compiler driver." +# endif +#endif + +#define Z_ISA_IS( ISA ) Z_IS_TRUE(Z_ISA_IS_##ISA ) +#define Z_ISA_HAS_INTEGRAL(bits) Z_IS_TRUE(Z_ISA_HAS_INTEGRAL_##bits##BIT) + +#endif /* Z_inspection_ISA_H */ diff --git a/projects/Zeta/API/Z/inspection/ISA/detection.h b/projects/Zeta/API/Z/inspection/ISA/detection.h new file mode 100644 index 0000000..65ccce9 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/ISA/detection.h @@ -0,0 +1,281 @@ +/* Zeta API - Z/inspection/ISA/detection.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_ISA_detection_H +#define Z_inspection_ISA_detection_H + +#if defined(__amd64 ) || \ + defined(__amd64__ ) || \ + defined(__x86_64 ) || \ + defined(__x86_64__) || \ + defined(_M_AMD64 ) || \ + defined(_M_X64 ) + +# define Z_ISA Z_ISA_X86_64 + +#elif defined(__386 ) || \ + defined(__386__ ) || \ + defined(__I86__ ) || \ + defined(__IA32__ ) || \ + defined(__INTEL__ ) || \ + defined(__THW_INTEL__ ) || \ + defined(__X86__ ) || \ + defined(__WINDOWS_386__) || \ + defined(__i386 ) || \ + defined(__i386__ ) || \ + defined(__i486 ) || \ + defined(__i486__ ) || \ + defined(__i586 ) || \ + defined(__i586__ ) || \ + defined(__i686 ) || \ + defined(__i686__ ) || \ + defined(_X86_ ) || \ + defined(M_I386 ) || \ + defined(i386 ) || \ + (defined(_M_IX86) && !defined(__WATCOMC__)) + +# define Z_ISA Z_ISA_X86_32 + +#elif defined(_M_I86 ) || \ + defined(_M_IX86) + +# define Z_ISA Z_ISA_X86_16 + +#elif defined(__ARM_ARCH_ISA_A64) || \ + defined(__aarch64__ ) || \ + defined(__arm64 ) || \ + defined(__arm64__ ) || \ + defined(_M_ARM64 ) + +# define Z_ISA Z_ISA_AARCH64 + +#elif defined(__ARM_ARCH ) || \ + defined(__TARGET_ARCH_ARM ) || \ + defined(__TARGET_ARCH_THUMB) || \ + defined(__arm__ ) || \ + defined(__arm ) || \ + defined(__thumb__ ) || \ + defined(_ARM ) || \ + defined(_ARM_ ) || \ + defined(_M_ARM ) || \ + defined(_M_ARM_NT ) || \ + defined(_M_ARMT ) || \ + defined(_M_THUMB ) || \ + defined(arm ) + +# define Z_ISA Z_ISA_AARCH32 + +#elif defined(__APPLE2ENH__ ) || \ + defined(__APPLE2__ ) || \ + defined(__ATARI__ ) || \ + defined(__ATARI2600__ ) || \ + defined(__ATARI5200__ ) || \ + defined(__ATMOS__ ) || \ + defined(__CBM__ ) || \ + defined(__CREATIVISION__) || \ + defined(__GAMATE__ ) || \ + defined(__LYNX__ ) || \ + defined(__NES__ ) || \ + defined(__OSIC1P__ ) || \ + defined(__PCE__ ) || \ + defined(__SUPERVISION__ ) || \ + defined(__TELESTRAT__ ) || \ + (defined(__GEOS__) && defined(__C65__)) + +# define Z_ISA Z_ISA_6502 + +#elif defined(__alpha ) || \ + defined(__alpha__) || \ + defined(_M_ALPHA ) + +# define Z_ISA Z_ISA_ALPHA + +#elif defined(__arc__) +# define Z_COMPILER_ISA Z_ISA_ARC + +#elif defined(__ADSPBLACKFIN__ ) || \ + defined(__ADSPLPBLACKFIN__) || \ + defined(__BFIN ) || \ + defined(__BFIN__ ) || \ + defined(__bfin ) || \ + defined(__bfin__ ) || \ + defined(BFIN ) || \ + defined(bfin ) + +# define Z_ISA Z_ISA_BLACKFIN + +#elif defined(__convex__) +# define Z_ISA Z_ISA_CONVEX + +#elif defined(__epiphany__) +# define Z_ISA Z_ISA_EPIPHANY + +#elif defined(__s390__) +# define Z_ISA Z_ISA_ESA_390 + +#elif defined(__370__ ) || \ + defined(__THW_370__) + +# define Z_ISA Z_ISA_ESA_370 + +#elif defined(__HEXAGON_ARCH__) || \ + defined(__QDSP6_ARCH__ ) || \ + defined(__hexagon ) || \ + defined(__hexagon__ ) || \ + defined(__qdsp6 ) || \ + defined(__qdsp6__ ) || \ + defined(hexagon ) || \ + defined(qdsp6 ) + +# define Z_ISA Z_ISA_HEXAGON + +#elif defined(__IA64__ ) || \ + defined(__ia64__ ) || \ + defined(__ia64 ) || \ + defined(__itanium__) || \ + defined(_IA64 ) || \ + defined(_M_IA64 ) || \ + defined(ia64 ) + +# define Z_ISA Z_ISA_IA_64 + +#elif defined(__loongarch64) +# define Z_ISA Z_ISA_LA64 + +#elif defined(__loongarch__) +# define Z_ISA Z_ISA_LA32S + +#elif defined(__lanai__) +# define Z_ISA Z_ISA_LANAI + +#elif defined(__lm32__) +# define Z_ISA Z_ISA_LATTICE_MICO_32 + +#elif defined(__MC68K__) || \ + defined(__m68k__ ) || \ + defined(M68000 ) + +# define Z_ISA Z_ISA_M68K + +#elif defined(__mips64 ) || \ + defined(__mips64__) || \ + (defined(__mips) && (__mips == 64 || __mips == 4 || __mips == 3)) || \ + (defined(_MIPS_ISA) && \ + ((defined(_MIPS_ISA_MIPS64) && _MIPS_ISA == _MIPS_ISA_MIPS64) || \ + (defined(_MIPS_ISA_MIPS4 ) && _MIPS_ISA == _MIPS_ISA_MIPS4 ) || \ + (defined(_MIPS_ISA_MIPS3 ) && _MIPS_ISA == _MIPS_ISA_MIPS3 ))) + +# define Z_ISA Z_ISA_MIPS64 + +#elif defined(__MIPS__ ) || \ + defined(__mips ) || \ + defined(__mips__ ) || \ + defined(_M_MRX000) || \ + defined(_mips ) || \ + defined(mips ) + +# define Z_ISA Z_ISA_MIPS + +#elif defined(__MSP430__) || \ + defined(MSP430 ) + +# define Z_ISA Z_ISA_MSP430 + +#elif defined(__HPPA20__ ) || \ + defined(_PA_RISC2_0) + +# define Z_ISA Z_ISA_PA_RISC_2 + +#elif defined(__HPPA__ ) || \ + defined(__HPPA11__ ) || \ + defined(__hppa ) || \ + defined(__hppa__ ) || \ + defined(_PA_RISC1_0) || \ + defined(_PA_RISC1_1) + +# define Z_ISA Z_ISA_PA_RISC + +#elif defined(__PPC64__ ) || \ + defined(__powerpc64__) || \ + defined(__ppc64__ ) || \ + defined(_ARCH_PPC64 ) + +# define Z_ISA Z_ISA_POWERPC_64BIT + +#elif defined(__POWERPC__ ) || \ + defined(__PPC ) || \ + defined(__PPC__ ) || \ + defined(__PPCBROADWAY__) || \ + defined(__PPCGECKO__ ) || \ + defined(__powerpc ) || \ + defined(__powerpc__ ) || \ + defined(__ppc ) || \ + defined(__ppc__ ) || \ + defined(_ARCH_PPC ) || \ + defined(_M_PPC ) + +# define Z_ISA Z_ISA_POWERPC_32BIT + +#elif defined(__riscv_32e) +# define Z_ISA Z_ISA_RV32E + +#elif defined(__riscv_xlen) && __riscv_xlen == 32 +# define Z_ISA Z_ISA_RV32I + +#elif defined(__riscv_xlen) && __riscv_xlen == 64 +# define Z_ISA Z_ISA_RV64I + +#elif defined(__arch64__ ) || \ + defined(__sparc_v9__) || \ + defined(__sparc64__ ) || \ + defined(__sparcv9 ) || \ + defined(__sparcv9__ ) + +# define Z_ISA Z_ISA_SPARC_V9 + +#elif defined(__sparc ) || \ + defined(__sparc__ ) || \ + defined(__sparc_v8__) || \ + defined(__sparcv8 ) || \ + defined(__sparcv8__ ) || \ + defined(sparc ) + +# define Z_ISA Z_ISA_SPARC + +#elif defined(__SH5__) && __SH5__ == 64 +# define Z_ISA Z_ISA_SUPERH_5 + +#elif defined(__sh__) +# define Z_ISA Z_ISA_SUPERH + +#elif defined(__vax__) +# define Z_ISA Z_ISA_VAX + +#elif defined(__wasm64 ) || \ + defined(__wasm64__) + +# define Z_ISA Z_ISA_WASM64 + +#elif defined(__wasm ) || \ + defined(__wasm__ ) || \ + defined(__wasm32 ) || \ + defined(__wasm32__) + +# define Z_ISA Z_ISA_WASM32 + +#elif defined(__XS1B__) +# define Z_ISA Z_ISA_XCORE + +#elif defined(__SYSC_ZARCH__) || \ + defined(__s390x__ ) || \ + defined(__zarch__ ) + +# define Z_ISA Z_ISA_Z_ARCHITECTURE +#endif + +#endif /* Z_inspection_ISA_detection_H */ diff --git a/projects/Zeta/API/Z/inspection/OS.h b/projects/Zeta/API/Z/inspection/OS.h new file mode 100644 index 0000000..ce2a6d9 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/OS.h @@ -0,0 +1,340 @@ +/* Zeta API - Z/inspection/OS.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_OS_H +#define Z_inspection_OS_H + +#include +#include + +#ifndef Z_OS +# include + +# ifdef Z_COMPILER_OS +# define Z_OS Z_COMPILER_OS +# else +# include +# endif +#endif + +#ifndef Z_OS +# define Z_OS Z_OS_UNKNOWN +# define Z_OS_IS_UNKNOWN 1 +# define Z_OS_NAME "unknown OS" +#elif Z_OS == Z_OS_AEGIS +# define Z_OS_IS_AEGIS 1 +# define Z_OS_NAME Z_OS_NAME_AEGIS +#elif Z_OS == Z_OS_AIX +# define Z_OS_IS_AIX 1 +# define Z_OS_NAME Z_OS_NAME_AIX +#elif Z_OS == Z_OS_AMIGA_OS +# define Z_OS_IS_AMIGA_OS 1 +# define Z_OS_NAME Z_OS_NAME_AMIGA_OS +#elif Z_OS == Z_OS_ANANAS_OS +# define Z_OS_IS_ANANAS_OS 1 +# define Z_OS_NAME Z_OS_NAME_ANANAS_OS +#elif Z_OS == Z_OS_ANDROID +# define Z_OS_IS_ANDROID 1 +# define Z_OS_NAME Z_OS_NAME_ANDROID +#elif Z_OS == Z_OS_AROS +# define Z_OS_IS_AROS 1 +# define Z_OS_NAME Z_OS_NAME_AROS +#elif Z_OS == Z_OS_BE_OS +# define Z_OS_IS_BE_OS 1 +# define Z_OS_NAME Z_OS_NAME_BE_OS +#elif Z_OS == Z_OS_BITRIG +# define Z_OS_IS_BITRIG 1 +# define Z_OS_NAME Z_OS_NAME_BITRIG +#elif Z_OS == Z_OS_BSD_386 +# define Z_OS_IS_BSD_386 1 +# define Z_OS_IS_BSD_I 1 +# define Z_OS_IS_BSD_OS 1 +# define Z_OS_NAME Z_OS_NAME_BSD_OS +#elif Z_OS == Z_OS_CELL_OS +# define Z_OS_IS_CELL_OS 1 +# define Z_OS_NAME Z_OS_NAME_CELL_OS +#elif Z_OS == Z_OS_CNK +# define Z_OS_IS_CNK 1 +# define Z_OS_NAME Z_OS_NAME_CNK +#elif Z_OS == Z_OS_CONVEX_UNIX +# define Z_OS_IS_CONVEX_UNIX 1 +# define Z_OS_IS_CONVEX_OS 1 +# define Z_OS_NAME Z_OS_NAME_CONVEX_OS +#elif Z_OS == Z_OS_CYGWIN +# define Z_OS_IS_CYGWIN 1 +# define Z_OS_NAME Z_OS_NAME_CYGWIN +#elif Z_OS == Z_OS_DC_OSX +# define Z_OS_IS_DC_OSX 1 +# define Z_OS_NAME Z_OS_NAME_DC_OSX +#elif Z_OS == Z_OS_DG_UX +# define Z_OS_IS_DG_UX 1 +# define Z_OS_NAME Z_OS_NAME_DG_UX +#elif Z_OS == Z_OS_DOMAIN_OS +# define Z_OS_IS_DOMAIN_OS 1 +# define Z_OS_NAME Z_OS_NAME_DOMAIN_OS +#elif Z_OS == Z_OS_DRAGONFLY_BSD +# define Z_OS_IS_DRAGONFLY_BSD 1 +# define Z_OS_NAME Z_OS_NAME_DRAGONFLY_BSD +#elif Z_OS == Z_OS_DYNIX_PTX +# define Z_OS_IS_DYNIX_PTX 1 +# define Z_OS_NAME Z_OS_NAME_DYNIX_PTX +#elif Z_OS == Z_OS_ECOS +# define Z_OS_IS_ECOS 1 +# define Z_OS_NAME Z_OS_NAME_ECOS +#elif Z_OS == Z_OS_FREE_BSD +# define Z_OS_IS_FREE_BSD 1 +# define Z_OS_NAME Z_OS_NAME_FREE_BSD +#elif Z_OS == Z_OS_FUCHSIA +# define Z_OS_IS_FUCHSIA 1 +# define Z_OS_NAME Z_OS_NAME_FUCHSIA +#elif Z_OS == Z_OS_GNU_HURD +# define Z_OS_IS_GNU_HURD 1 +# define Z_OS_NAME Z_OS_NAME_GNU_HURD +#elif Z_OS == Z_OS_HAIKU +# define Z_OS_IS_HAIKU 1 +# define Z_OS_NAME Z_OS_NAME_HAIKU +#elif Z_OS == Z_OS_HI_UX_MPP +# define Z_OS_IS_HI_UX_MPP 1 +# define Z_OS_NAME Z_OS_NAME_HI_UX_MPP +#elif Z_OS == Z_OS_HP_UX +# define Z_OS_IS_HP_UX 1 +# define Z_OS_NAME Z_OS_NAME_HP_UX +#elif Z_OS == Z_OS_INTEGRITY +# define Z_OS_IS_INTEGRITY 1 +# define Z_OS_NAME Z_OS_NAME_INTEGRITY +#elif Z_OS == Z_OS_IPHONE_OS +# define Z_OS_IS_IPHONE_OS 1 +# define Z_OS_IS_IOS 1 +# define Z_OS_NAME Z_OS_NAME_IOS +#elif Z_OS == Z_OS_IRIX +# define Z_OS_IS_IRIX 1 +# define Z_OS_NAME Z_OS_NAME_IRIX +#elif Z_OS == Z_OS_LEMON_OS +# define Z_OS_IS_LEMON_OS 1 +# define Z_OS_NAME Z_OS_NAME_LEMON_OS +#elif Z_OS == Z_OS_LINUX +# define Z_OS_IS_LINUX 1 +# define Z_OS_NAME Z_OS_NAME_LINUX +#elif Z_OS == Z_OS_LUNIX +# define Z_OS_IS_LUNIX 1 +# define Z_OS_NAME Z_OS_NAME_LUNIX +#elif Z_OS == Z_OS_LYNX_OS +# define Z_OS_IS_LYNX_OS 1 +# define Z_OS_NAME Z_OS_NAME_LYNX_OS +#elif Z_OS == Z_OS_MAC_OS +# define Z_OS_IS_MAC_OS 1 +# define Z_OS_NAME Z_OS_NAME_MAC_OS +#elif Z_OS == Z_OS_MAC_OS_X +# define Z_OS_IS_MAC_OS_X 1 +# define Z_OS_IS_OS_X 1 +# define Z_OS_IS_MACOS 1 +# define Z_OS_NAME Z_OS_NAME_MACOS +#elif Z_OS == Z_OS_MINIX +# define Z_OS_IS_MINIX 1 +# define Z_OS_NAME Z_OS_NAME_MINIX +#elif Z_OS == Z_OS_MORPH_OS +# define Z_OS_IS_MORPH_OS 1 +# define Z_OS_NAME Z_OS_NAME_MORPH_OS +#elif Z_OS == Z_OS_MPE_XL +# define Z_OS_IS_MPE_XL 1 +# define Z_OS_NAME Z_OS_NAME_MPE_XL +#elif Z_OS == Z_OS_MS_DOS +# define Z_OS_IS_MS_DOS 1 +# define Z_OS_NAME Z_OS_NAME_MS_DOS +#elif Z_OS == Z_OS_NET_BSD +# define Z_OS_IS_NET_BSD 1 +# define Z_OS_NAME Z_OS_NAME_NET_BSD +#elif Z_OS == Z_OS_NETWARE +# define Z_OS_IS_NETWARE 1 +# define Z_OS_NAME Z_OS_NAME_NETWARE +#elif Z_OS == Z_OS_NEXTSTEP +# define Z_OS_IS_NEXTSTEP 1 +# define Z_OS_NAME Z_OS_NAME_NEXTSTEP +#elif Z_OS == Z_OS_NON_STOP_OS +# define Z_OS_IS_NON_STOP_OS 1 +# define Z_OS_NAME Z_OS_NAME_NON_STOP_OS +#elif Z_OS == Z_OS_NUCLEUS_RTOS +# define Z_OS_IS_NUCLEUS_RTOS 1 +# define Z_OS_NAME Z_OS_NAME_NUCLEUS_RTOS +#elif Z_OS == Z_OS_OPEN_BSD +# define Z_OS_IS_OPEN_BSD 1 +# define Z_OS_NAME Z_OS_NAME_OPEN_BSD +#elif Z_OS == Z_OS_OPEN_VMS +# define Z_OS_IS_OPEN_VMS 1 +# define Z_OS_NAME Z_OS_NAME_OPEN_VMS +#elif Z_OS == Z_OS_ORBIS_OS +# define Z_OS_IS_ORBIS_OS 1 +# define Z_OS_NAME Z_OS_NAME_ORBIS_OS +#elif Z_OS == Z_OS_OS_2 +# define Z_OS_IS_OS_2 1 +# define Z_OS_NAME Z_OS_NAME_OS_2 +#elif Z_OS == Z_OS_OS_9 +# define Z_OS_IS_OS_9 1 +# define Z_OS_NAME Z_OS_NAME_OS_9 +#elif Z_OS == Z_OS_OS_400 +# define Z_OS_IS_OS_400 1 +# define Z_OS_IS_I5_OS 1 +# define Z_OS_IS_IBM_I 1 +# define Z_OS_NAME Z_OS_NAME_IBM_I +#elif Z_OS == Z_OS_OSF_1 +# define Z_OS_IS_OSF_1 1 +# define Z_OS_IS_DIGITAL_UNIX 1 +# define Z_OS_IS_TRU64_UNIX 1 +# define Z_OS_NAME Z_OS_NAME_TRU64_UNIX +#elif Z_OS == Z_OS_PALM_OS +# define Z_OS_IS_PALM_OS 1 +# define Z_OS_NAME Z_OS_NAME_PALM_OS +#elif Z_OS == Z_OS_PLAN_9 +# define Z_OS_IS_PLAN_9 1 +# define Z_OS_NAME Z_OS_NAME_PLAN_9 +#elif Z_OS == Z_OS_PSP_SYSTEM_SOFTWARE +# define Z_OS_IS_PSP_SYSTEM_SOFTWARE 1 +# define Z_OS_NAME Z_OS_NAME_PSP_SYSTEM_SOFTWARE +#elif Z_OS == Z_OS_QNX +# define Z_OS_IS_QNX 1 +# define Z_OS_NAME Z_OS_NAME_QNX +#elif Z_OS == Z_OS_RTEMS +# define Z_OS_IS_RTEMS 1 +# define Z_OS_NAME Z_OS_NAME_RTEMS +#elif Z_OS == Z_OS_SCO_UNIX_SYSTEM_V +# define Z_OS_IS_SCO_UNIX_SYSTEM_V 1 +# define Z_OS_IS_OPEN_DESKTOP 1 +# define Z_OS_IS_SCO_UNIX 1 +# define Z_OS_IS_OPEN_SERVER 1 +# define Z_OS_NAME Z_OS_NAME_OPEN_SERVER +#elif Z_OS == Z_OS_SERENITY_OS +# define Z_OS_IS_SERENITY_OS 1 +# define Z_OS_NAME Z_OS_NAME_SERENITY_OS +#elif Z_OS == Z_OS_SINIX +# define Z_OS_IS_SINIX 1 +# define Z_OS_IS_RELIANT_UNIX 1 +# define Z_OS_NAME Z_OS_NAME_RELIANT_UNIX +#elif Z_OS == Z_OS_SOLARIS +# define Z_OS_IS_SOLARIS 1 +# define Z_OS_NAME Z_OS_NAME_SOLARIS +#elif Z_OS == Z_OS_SUN_OS +# define Z_OS_IS_SUN_OS 1 +# define Z_OS_NAME Z_OS_NAME_SUN_OS +#elif Z_OS == Z_OS_SYLLABLE +# define Z_OS_IS_SYLLABLE 1 +# define Z_OS_NAME Z_OS_NAME_SYLLABLE +#elif Z_OS == Z_OS_SYMBIAN +# define Z_OS_IS_SYMBIAN 1 +# define Z_OS_NAME Z_OS_NAME_SYMBIAN +#elif Z_OS == Z_OS_TVOS +# define Z_OS_IS_TVOS 1 +# define Z_OS_NAME Z_OS_NAME_TVOS +#elif Z_OS == Z_OS_ULTRIX +# define Z_OS_IS_ULTRIX 1 +# define Z_OS_NAME Z_OS_NAME_ULTRIX +#elif Z_OS == Z_OS_UNICOS +# define Z_OS_IS_UNICOS 1 +# define Z_OS_NAME Z_OS_NAME_UNICOS +#elif Z_OS == Z_OS_UNICOS_MP +# define Z_OS_IS_UNICOS_MP 1 +# define Z_OS_NAME Z_OS_NAME_UNICOS_MP +#elif Z_OS == Z_OS_UNIXWARE +# define Z_OS_IS_UNIXWARE 1 +# define Z_OS_IS_OPEN_UNIX 1 +# define Z_OS_NAME Z_OS_NAME_UNIXWARE +#elif Z_OS == Z_OS_UTS +# define Z_OS_IS_UTS 1 +# define Z_OS_NAME Z_OS_NAME_UTS +#elif Z_OS == Z_OS_VOS +# define Z_OS_IS_VOS 1 +# define Z_OS_NAME Z_OS_NAME_VOS +#elif Z_OS == Z_OS_VX_WORKS +# define Z_OS_IS_VX_WORKS 1 +# define Z_OS_NAME Z_OS_NAME_VX_WORKS +#elif Z_OS == Z_OS_WATCH_OS +# define Z_OS_IS_WATCH_OS 1 +# define Z_OS_IS_WATCHOS 1 +# define Z_OS_NAME Z_OS_NAME_WATCHOS +#elif Z_OS == Z_OS_WINDOWS +# define Z_OS_IS_WINDOWS 1 +# define Z_OS_NAME Z_OS_NAME_WINDOWS +#elif Z_OS == Z_OS_WINDOWS_CE +# define Z_OS_IS_WINDOWS_CE 1 +# define Z_OS_NAME Z_OS_NAME_WINDOWS_CE +#elif Z_OS == Z_OS_XENIX +# define Z_OS_IS_XENIX 1 +# define Z_OS_NAME Z_OS_NAME_XENIX +#elif Z_OS == Z_OS_Z_OS +# define Z_OS_IS_Z_OS 1 +# define Z_OS_NAME Z_OS_NAME_Z_OS +#elif Z_OS == Z_OS_ZETA +# define Z_OS_IS_ZETA 1 +# define Z_OS_NAME Z_OS_NAME_ZETA +#elif +# error "Invalid Z_OS key." +#endif + +#if Z_OS == Z_OS_AIX || \ + Z_OS == Z_OS_ANANAS_OS || \ + Z_OS == Z_OS_ANDROID || \ + Z_OS == Z_OS_BE_OS || \ + Z_OS == Z_OS_BITRIG || \ + Z_OS == Z_OS_BSD_386 || \ + Z_OS == Z_OS_CONVEX_UNIX || \ + Z_OS == Z_OS_CYGWIN || \ + Z_OS == Z_OS_DC_OSX || \ + Z_OS == Z_OS_DG_UX || \ + Z_OS == Z_OS_DOMAIN_OS || \ + Z_OS == Z_OS_DRAGONFLY_BSD || \ + Z_OS == Z_OS_DYNIX_PTX || \ + Z_OS == Z_OS_ECOS || \ + Z_OS == Z_OS_FREE_BSD || \ + Z_OS == Z_OS_GNU_HURD || \ + Z_OS == Z_OS_HAIKU || \ + Z_OS == Z_OS_HI_UX_MPP || \ + Z_OS == Z_OS_HP_UX || \ + Z_OS == Z_OS_INTEGRITY || \ + Z_OS == Z_OS_IPHONE_OS || \ + Z_OS == Z_OS_IRIX || \ + Z_OS == Z_OS_LEMON_OS || \ + Z_OS == Z_OS_LINUX || \ + Z_OS == Z_OS_LYNX_OS || \ + Z_OS == Z_OS_MAC_OS_X || \ + Z_OS == Z_OS_MINIX || \ + Z_OS == Z_OS_MPE_XL || \ + Z_OS == Z_OS_NET_BSD || \ + Z_OS == Z_OS_NEXTSTEP || \ + Z_OS == Z_OS_NON_STOP_OS || \ + Z_OS == Z_OS_NUCLEUS_RTOS || \ + Z_OS == Z_OS_OPEN_BSD || \ + Z_OS == Z_OS_ORBIS_OS || \ + Z_OS == Z_OS_OSF_1 || \ + Z_OS == Z_OS_QNX || \ + Z_OS == Z_OS_RTEMS || \ + Z_OS == Z_OS_SCO_UNIX_SYSTEM_V || \ + Z_OS == Z_OS_SERENITY_OS || \ + Z_OS == Z_OS_SINIX || \ + Z_OS == Z_OS_SOLARIS || \ + Z_OS == Z_OS_SUN_OS || \ + Z_OS == Z_OS_SYLLABLE || \ + Z_OS == Z_OS_TVOS || \ + Z_OS == Z_OS_ULTRIX || \ + Z_OS == Z_OS_UNICOS || \ + Z_OS == Z_OS_UNICOS_MP || \ + Z_OS == Z_OS_UNIXWARE || \ + Z_OS == Z_OS_UTS || \ + Z_OS == Z_OS_VX_WORKS || \ + Z_OS == Z_OS_WATCH_OS || \ + Z_OS == Z_OS_XENIX || \ + Z_OS == Z_OS_Z_OS || \ + Z_OS == Z_OS_ZETA + +# define Z_OS_HAS_POSIX 1 +#endif + +/* MARK: - Getters */ + +#define Z_OS_IS( OS ) Z_IS_TRUE(Z_OS_IS_##OS ) +#define Z_OS_HAS(WHAT) Z_IS_TRUE(Z_OS_HAS_##WHAT) + +#endif /* Z_inspection_OS_H */ diff --git a/projects/Zeta/API/Z/inspection/OS/detection.h b/projects/Zeta/API/Z/inspection/OS/detection.h new file mode 100644 index 0000000..68ad095 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/OS/detection.h @@ -0,0 +1,364 @@ +/* Zeta API - Z/inspection/OS/detection.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_OS_detection_H +#define Z_inspection_OS_detection_H + +#if defined(__ANDROID__) + +# define Z_OS Z_OS_ANDROID + +#elif defined(__TOS_LINUX__) || \ + defined(__gnu_linux__) || \ + defined(__linux ) || \ + defined(__linux__ ) || \ + defined(linux) + +# define Z_OS Z_OS_LINUX + +#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define Z_OS Z_OS_MAC_OS_X + +#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) +# define Z_OS Z_OS_IPHONE_OS + +#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) +# define Z_OS Z_OS_TVOS + +#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) +# define Z_OS Z_OS_WATCH_OS + +#elif defined(__APPLE_CC__ ) || \ + defined(__APPLE_CPP__) || \ + (defined(__APPLE__) && defined(__MACH__)) + +# include + + /* Review this */ +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE + +# if defined(TARGET_OS_TV) && TARGET_OS_TV +# define Z_OS Z_OS_TVOS + +# elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH +# define Z_OS Z_OS_WATCH_OS + +# else +# define Z_OS Z_OS_IPHONE_OS +# endif + +# else +# define Z_OS Z_OS_MAC_OS_X +# endif + +#elif defined(__DOS__ ) || \ + defined(__MSDOS__) || \ + defined(_MSDOS ) || \ + defined(MSDOS ) + +# define Z_OS Z_OS_MS_DOS + +#elif defined(__NT__ ) || \ + defined(__TOS_WIN__ ) || \ + defined(__WIN32 ) || \ + defined(__WIN32__ ) || \ + defined(__WIN64 ) || \ + defined(__WIN64__ ) || \ + defined(__WINDOWS__ ) || \ + defined(__WINDOWS_386__) || \ + defined(__WINNT ) || \ + defined(__WINNT__ ) || \ + defined(_WIN16 ) || \ + defined(_WIN32 ) || \ + defined(_WIN64 ) || \ + defined(WIN32 ) || \ + defined(WIN64 ) || \ + defined(WINNT ) + +# define Z_OS Z_OS_WINDOWS + +#elif defined(_WIN32_WCE ) || \ + defined(WIN32_PLATFORM_HPC2000) || \ + defined(WIN32_PLATFORM_HPCPRO ) || \ + defined(WIN32_PLATFORM_PSPC ) || \ + defined(WIN32_PLATFORM_WFSP ) + +# define Z_OS Z_OS_WINDOWS_CE + +#elif defined(aegis) +# define Z_OS Z_OS_AEGIS + +#elif defined(_AIX ) || \ + defined(__TOS_AIX__) + +# define Z_OS Z_OS_AIX + +#elif defined(__amigaos__) || \ + defined(AMIGA ) + +# define Z_OS Z_OS_AMIGA_OS + +#elif defined(__Ananas__) +# define Z_OS Z_OS_ANANAS_OS + +#elif defined(__AROS__) +# define Z_OS Z_OS_AROS + +#elif defined(__BEOS__) +# ifdef __ZETA__ +# define Z_OS Z_OS_ZETA +# else +# define Z_OS Z_OS_BE_OS +# endif + +#elif defined(__Bitrig__) +# define Z_OS Z_OS_BITRIG + +#elif defined(__bsdi__) +# define Z_OS Z_OS_BSD_386 + +#elif defined(__CELLOS_LV2__) +# define Z_OS Z_OS_CELL_OS + +#elif defined(__bg__ ) || \ + defined(__bgp__ ) || \ + defined(__bgq__ ) || \ + defined(__blrts ) || \ + defined(__blrts__ ) || \ + defined(__THW_BLUEGENE__) || \ + defined(__TOS_BGQ__ ) || \ + defined(__TOS_BGP__ ) || \ + defined(__TOS_BLRTS__ ) + +# define Z_OS Z_OS_CNK + +#elif defined(__convex__) +# define Z_OS Z_OS_CONVEX_UNIX + +#elif defined(__CYGWIN__ ) || \ + defined(__CYGWIN32__) || \ + defined(__CYGWIN64__) + +# define Z_OS Z_OS_CYGWIN + +#elif defined(pyr) +# define Z_OS Z_OS_DC_OSX + +#elif defined(__dgux__) || \ + defined(__DGUX__) || \ + defined(DGUX ) + +# define Z_OS Z_OS_DG_UX + +#elif defined(apollo) +# define Z_OS Z_OS_DOMAIN_OS + +#elif defined(__DragonFly__) +# define Z_OS Z_OS_DRAGONFLY_BSD + +#elif defined(_SEQUENT_) || \ + defined(sequent ) + +# define Z_OS Z_OS_DYNIX_PTX + +#elif defined(__ECOS) +# define Z_OS Z_OS_ECOS + +#elif !defined(__ORBIS__) && \ + (defined(__FreeBSD__ ) || \ + defined(__FreeBSD_kernel__)) + +# define Z_OS Z_OS_FREE_BSD + +#elif defined(__Fuchsia__) +# define Z_OS Z_OS_FUCHSIA + +#elif defined(__gnu_hurd__) /*|| defined(__GNU__)*/ +# define Z_OS Z_OS_GNU_HURD + +#elif defined(__HAIKU__) +# define Z_OS Z_OS_HAIKU + +#elif defined(__hiuxmpp) +# define Z_OS Z_OS_HI_UX_MPP + +#elif defined(__hpux) || \ + defined(_hpux ) || \ + defined(hpux ) + +# define Z_OS Z_OS_HP_UX + +#elif defined(__INTEGRITY) +# define Z_OS Z_OS_INTEGRITY + +#elif defined(__sgi) || \ + defined(sgi ) + +# define Z_OS Z_OS_IRIX + +#elif defined(__lemon__) +# define Z_OS Z_OS_LEMON_OS + +#elif defined(__LUNIX__) +# define Z_OS Z_OS_LUNIX + +#elif defined(__Lynx__) +# define Z_OS Z_OS_LYNX_OS + +#elif defined(Macintosh) || \ + defined(macintosh) + +# define Z_OS Z_OS_MAC_OS + +#elif defined(__minix) +# define Z_OS Z_OS_MINIX + +#elif defined(__MORPHOS__) +# define Z_OS Z_OS_MORPH_OS + +#elif defined(__mpexl) || \ + defined(mpeix ) + +# define Z_OS Z_OS_MPE_XL + +#elif defined(__NetBSD__) +# define Z_OS Z_OS_NET_BSD + +#elif defined(__netware__ ) || \ + defined(__NETWARE_386__) + +# define Z_OS Z_OS_NETWARE + +#elif defined(__TANDEM) +# define Z_OS Z_OS_NON_STOP_OS + +#elif defined(__nucleus__) +# define Z_OS Z_OS_NUCLEUS_RTOS + +#elif defined(__OpenBSD__) +# define Z_OS Z_OS_OPEN_BSD + +#elif defined(__VMS) || \ + defined(VMS ) + +# define Z_OS Z_OS_OPEN_VMS + +#elif defined(__ORBIS__) +# define Z_OS Z_OS_ORBIS_OS + +#elif defined(__OS2__ ) || \ + defined(__TOS_OS2__) || \ + defined(_OS2 ) || \ + defined(OS2 ) + +# define Z_OS Z_OS_OS_2 + +#elif defined(__OS9000) || \ + defined(_OSK ) + +# define Z_OS Z_OS_OS_9 + +#elif defined(__OS400__ ) || \ + defined(__TOS_OS400__) + +# define Z_OS Z_OS_OS_400 + +#elif defined(__osf__) || \ + defined(__osf ) + +# define Z_OS Z_OS_OSF_1 + +#elif defined(__palmos__) +# define Z_OS Z_OS_PALM_OS + +#elif defined(EPLAN9) +# define Z_OS Z_OS_PLAN_9 + +#elif defined(__psp__) || \ + defined(_PSP ) || \ + defined(PSP ) + +# define Z_OS Z_OS_PSP_SYSTEM_SOFTWARE + +#elif defined(__QNX__ ) || \ + defined(__QNXNTO__) + +# define Z_OS Z_OS_QNX + +#elif defined(__rtems__) +# define Z_OS Z_OS_RTEMS + +#elif defined(_SCO_DS) || \ + defined(M_I386 ) || /* TODO: Investigate */ \ + defined(M_XENIX) /* TODO: Investigate */ + +# define Z_OS Z_OS_SCO_UNIX_SYSTEM_V + +#elif defined(__serenity__) +# define Z_OS Z_OS_SERENITY_OS + +#elif defined(sinux) +# define Z_OS Z_OS_SINIX + +#elif defined(__sun ) || \ + defined(__sun__) || \ + defined(__SunOS) || \ + defined(sun ) + +# if defined(__svr4__) || \ + defined(__SVR4 ) + +# define Z_OS Z_OS_SOLARIS +# else +# define Z_OS Z_OS_SUN_OS +# endif + +#elif defined(__SYLLABLE__) +# define Z_OS Z_OS_SYLLABLE + +#elif defined(__SYMBIAN32__) +# define Z_OS Z_OS_SYMBIAN + +#elif defined(__ultrix__) || \ + defined(__ultrix ) || \ + defined(ultrix ) /* "unix & vax"? */ + +# define Z_OS Z_OS_ULTRIX + +#elif defined(_UNICOS) +# define Z_OS Z_OS_UNICOS + +#elif defined(__crayx1) || \ + defined(_CRAY ) + +# define Z_OS Z_OS_UNICOS_MP + +#elif defined(_UNIXWARE7) || \ + defined(sco ) + +# define Z_OS Z_OS_UNIXWARE + +#elif defined(UTS) +# define Z_OS Z_OS_UTS + +#elif defined(__VOS__) +# define Z_OS Z_OS_VOS + +#elif defined(__vxworks ) || \ + defined(__VXWORKS__) + +# define Z_OS Z_OS_VX_WORKS + +#elif defined(__MVS__ ) || \ + defined(__HOS_MVS__) || \ + defined(__TOS_MVS__) + +# define Z_OS Z_OS_Z_OS +#endif + +#endif /* Z_inspection_OS_detection_H */ diff --git a/projects/Zeta/API/Z/inspection/Z.h b/projects/Zeta/API/Z/inspection/Z.h new file mode 100644 index 0000000..0b8c892 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/Z.h @@ -0,0 +1,17 @@ +/* Zeta API - Z/inspection/Z.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_Z_H +#define Z_inspection_Z_H + +#include + +#define Z_HAS(type_or_identifier ) Z_IS_TRUE(Z_HAS_##type_or_identifier) +#define Z_HAS_MEMBER(type, member) Z_IS_TRUE(Z_HAS_##type##_MEMBER_##member) + +#endif /* Z_inspection_Z_H */ diff --git a/projects/Zeta/API/Z/inspection/character_set.h b/projects/Zeta/API/Z/inspection/character_set.h new file mode 100644 index 0000000..0f6794c --- /dev/null +++ b/projects/Zeta/API/Z/inspection/character_set.h @@ -0,0 +1,83 @@ +/* Zeta API - Z/inspection/character_set.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_character_set_H +#define Z_inspection_character_set_H + +#if ('0' < '9') && \ + ('0' + 1 == '1') && ('1' + 1 == '2') && ('2' + 1 == '3') && \ + ('3' + 1 == '4') && ('4' + 1 == '5') && ('5' + 1 == '6') && \ + ('6' + 1 == '7') && ('7' + 1 == '8') && ('8' + 1 == '9') + +# define Z_CHARACTER_SET_DIGITS_ARE_CONSECUTIVE 1 +#else +# define Z_CHARACTER_SET_DIGITS_ARE_CONSECUTIVE 0 +#endif + +#if ('A' < 'Z') && \ + ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') && \ + ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') && \ + ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') && \ + ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') && \ + ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') && \ + ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') && \ + ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') && \ + ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') && \ + ('Y' + 1 == 'Z') + +# define Z_CHARACTER_SET_UPPERCASE_LETTERS_ARE_CONSECUTIVE 1 +#else +# define Z_CHARACTER_SET_UPPERCASE_LETTERS_ARE_CONSECUTIVE 0 +#endif + +#if ('a' < 'z') && \ + ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') && \ + ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') && \ + ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') && \ + ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') && \ + ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') && \ + ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') && \ + ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') && \ + ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') && \ + ('y' + 1 == 'z') + +# define Z_CHARACTER_SET_LOWERCASE_LETTERS_ARE_CONSECUTIVE 1 +#else +# define Z_CHARACTER_SET_LOWERCASE_LETTERS_ARE_CONSECUTIVE 0 +#endif + +#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) && \ + ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) && \ + (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) && \ + ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) && \ + ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) && \ + ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) && \ + ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) && \ + ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) && \ + ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) && \ + ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) && \ + ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) && \ + ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) && \ + ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) && \ + ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) && \ + ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) && \ + ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) && \ + ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) && \ + ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) && \ + ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) && \ + ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) && \ + ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) && \ + ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) && \ + ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) + +# define Z_CHARACTER_SET_IS_ASCII 1 +#else +# define Z_CHARACTER_SET_IS_ASCII 0 +#endif + +#endif /* Z_inspection_character_set_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler.h b/projects/Zeta/API/Z/inspection/compiler.h new file mode 100644 index 0000000..71016df --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler.h @@ -0,0 +1,297 @@ +/* Zeta API - Z/inspection/compiler.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_H +#define Z_inspection_compiler_H + +#include +#include +#include + +#define Z_COMPILER_IS(COMPILER) Z_IS_TRUE(Z_COMPILER_IS_##COMPILER) + +#define Z_COMPILER_DIALECT_HAS( LANGUAGE, FEATURE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_##FEATURE ) +#define Z_COMPILER_DIALECT_HAS_ATTRIBUTE( LANGUAGE, ATTRIBUTE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_ATTRIBUTE_##ATTRIBUTE ) +#define Z_COMPILER_DIALECT_HAS_ESCAPE_SEQUENCE( LANGUAGE, ESCAPE_SEQUENCE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_ESCAPE_SEQUENCE_##ESCAPE_SEQUENCE ) +#define Z_COMPILER_DIALECT_HAS_IDENTIFIER( LANGUAGE, IDENTIFIER ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_IDENTIFIER_##IDENTIFIER ) +#define Z_COMPILER_DIALECT_HAS_LITERAL( LANGUAGE, LITERAL ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_LITERAL_##LITERAL ) +#define Z_COMPILER_DIALECT_HAS_OPERATOR( LANGUAGE, OPERATOR ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_OPERATOR_##OPERATOR ) +#define Z_COMPILER_DIALECT_HAS_OPERATOR_CASE( LANGUAGE, OPERATOR, CASE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_OPERATOR_CASE_##OPERATOR##_##CASE ) +#define Z_COMPILER_DIALECT_HAS_PREPROCESSOR_DIRECTIVE( LANGUAGE, PREPROCESSOR_DIRECTIVE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_DIRECTIVE_##PREPROCESSOR_DIRECTIVE ) +#define Z_COMPILER_DIALECT_HAS_PREPROCESSOR_IDENTIFIER(LANGUAGE, PREPROCESSOR_IDENTIFIER) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_IDENTIFIER_##PREPROCESSOR_IDENTIFIER) +#define Z_COMPILER_DIALECT_HAS_PREPROCESSOR_OPERATOR( LANGUAGE, PREPROCESSOR_OPERATOR ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR ) +#define Z_COMPILER_DIALECT_HAS_SPECIFIER( LANGUAGE, SPECIFIER ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_SPECIFIER_##SPECIFIER ) +#define Z_COMPILER_DIALECT_HAS_SPECIFIER_CASE( LANGUAGE, SPECIFIER, CASE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_SPECIFIER_CASE_##SPECIFIER##_##CASE ) +#define Z_COMPILER_DIALECT_HAS_STD_PRAGMA( LANGUAGE, STD_PRAGMA ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_STD_PRAGMA_##STD_PRAGMA ) +#define Z_COMPILER_DIALECT_HAS_STORAGE_CLASS( LANGUAGE, STORAGE_CLASS ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_STORAGE_CLASS_##STORAGE_CLASS ) +#define Z_COMPILER_DIALECT_HAS_TYPE( LANGUAGE, TYPE ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_##TYPE ) +#define Z_COMPILER_DIALECT_HAS_TYPE_MODIFIER( LANGUAGE, TYPE_MODIFIER ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_MODIFIER_##TYPE_MODIFIER ) +#define Z_COMPILER_DIALECT_HAS_TYPE_QUALIFIER( LANGUAGE, TYPE_QUALIFIER ) Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_QUALIFIER_##TYPE_QUALIFIER ) + +#define Z_COMPILER_HAS( FEATURE ) Z_IS_TRUE(Z_COMPILER_HAS_##FEATURE ) +#define Z_COMPILER_HAS_ATTRIBUTE( ATTRIBUTE ) Z_IS_TRUE(Z_COMPILER_HAS_ATTRIBUTE_##ATTRIBUTE ) +#define Z_COMPILER_HAS_CONSTANT( CONSTANT ) Z_IS_TRUE(Z_COMPILER_HAS_CONSTANT_##CONSTANT ) +#define Z_COMPILER_HAS_FUNCTION( FUNCTION ) Z_IS_TRUE(Z_COMPILER_HAS_FUNCTION_##FUNCTION ) +#define Z_COMPILER_HAS_LITERAL( LITERAL ) Z_IS_TRUE(Z_COMPILER_HAS_LITERAL_##LITERAL ) +#define Z_COMPILER_HAS_MACRO( MACRO ) Z_IS_TRUE(Z_COMPILER_HAS_MACRO_##MACRO ) +#define Z_COMPILER_HAS_MAGIC_CONSTANT(MAGIC_CONSTANT) Z_IS_TRUE(Z_COMPILER_HAS_MAGIC_CONSTANT_##MAGIC_CONSTANT) +#define Z_COMPILER_HAS_TRAIT( TRAIT ) Z_IS_TRUE(Z_COMPILER_HAS_TRAIT_##TRAIT ) +#define Z_COMPILER_HAS_TYPE( TYPE ) Z_IS_TRUE(Z_COMPILER_HAS_TYPE_##TYPE ) +#define Z_COMPILER_ATTRIBUTE( ATTRIBUTE ) Z_COMPILER_ATTRIBUTE_##ATTRIBUTE +#define Z_COMPILER_CONSTANT( CONSTANT ) Z_COMPILER_CONSTANT_##CONSTANT +#define Z_COMPILER_FUNCTION( FUNCTION ) Z_COMPILER_FUNCTION_##FUNCTION +#define Z_COMPILER_LITERAL( LITERAL ) Z_COMPILER_LITERAL_##LITERAL +#define Z_COMPILER_MACRO( MACRO ) Z_COMPILER_MACRO_##MACRO +#define Z_COMPILER_MAGIC_CONSTANT( MAGIC_CONSTANT) Z_COMPILER_MAGIC_CONSTANT_##MAGIC_CONSTANT +#define Z_COMPILER_TRAIT( TRAIT ) Z_COMPILER_TRAIT_##TRAIT +#define Z_COMPILER_TYPE( TYPE ) Z_COMPILER_TYPE_##TYPE + +#ifdef Z_COMPILER_HEADER +# include Z_COMPILER_HEADER + +#else +# ifndef Z_COMPILER +# include +# endif + +/*# if Z_COMPILER == Z_COMPILER_ACC +# include +# elif Z_COMPILER == Z_COMPILER_ADAPTIVE_CPP +# include +# elif Z_COMPILER == Z_COMPILER_ALTIUM_C_TO_HARDWARE +# include +# elif Z_COMPILER == Z_COMPILER_ALTIUM_MICROBLAZE_C +# include +# elif Z_COMPILER == Z_COMPILER_AMSTERDAM_COMPILER_KIT +# include +# elif Z_COMPILER == Z_COMPILER_APPLE_CLANG +# include +# elif Z_COMPILER == Z_COMPILER_ARM_C_CPP_COMPILER +# include +# elif Z_COMPILER == Z_COMPILER_ARM_COMPILER +# include +# elif Z_COMPILER == Z_COMPILER_AZTEC_C +# include +# elif Z_COMPILER == Z_COMPILER_BCC +# include */ +# if Z_COMPILER == Z_COMPILER_CC65 +# include +# elif Z_COMPILER == Z_COMPILER_CLANG +# include +/*# elif Z_COMPILER == Z_COMPILER_CODE_WARRIOR +# include +# elif Z_COMPILER == Z_COMPILER_COMEAU_CPP +# include +# elif Z_COMPILER == Z_COMPILER_COMPAQ_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_COMPCERT +# include +# elif Z_COMPILER == Z_COMPILER_CONVEX_C +# include +# elif Z_COMPILER == Z_COMPILER_COVERITY_C_CPP_STATIC_ANALYZER +# include +# elif Z_COMPILER == Z_COMPILER_CRAY_C +# include +# elif Z_COMPILER == Z_COMPILER_DIAB_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_DICE_C +# include +# elif Z_COMPILER == Z_COMPILER_DIGITAL_MARS +# include +# elif Z_COMPILER == Z_COMPILER_DJGPP +# include +# elif Z_COMPILER == Z_COMPILER_EDG_CPP_FRONTEND +# include +# elif Z_COMPILER == Z_COMPILER_EKOPATH +# include +# elif Z_COMPILER == Z_COMPILER_FUJITSU_CPP +# include */ +# elif Z_COMPILER == Z_COMPILER_GCC +# include +/*# elif Z_COMPILER == Z_COMPILER_GREEN_HILL_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_HP_ACPP +# include +# elif Z_COMPILER == Z_COMPILER_HP_ANSI_C +# include +# elif Z_COMPILER == Z_COMPILER_HP_UPC +# include +# elif Z_COMPILER == Z_COMPILER_IAR_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_IBM_XL_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_IBM_Z_OS_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_IMAGECRAFT_C +# include +# elif Z_COMPILER == Z_COMPILER_INTEL_CPP +# include +# elif Z_COMPILER == Z_COMPILER_KAI_CPP +# include +# elif Z_COMPILER == Z_COMPILER_KEIL_C166 +# include +# elif Z_COMPILER == Z_COMPILER_KEIL_C51 +# include +# elif Z_COMPILER == Z_COMPILER_KEIL_CARM +# include +# elif Z_COMPILER == Z_COMPILER_LCC +# include +# elif Z_COMPILER == Z_COMPILER_MCC +# include +# elif Z_COMPILER == Z_COMPILER_METAWARE_HIGH_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_MICROTEC_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_MINGW +# include +# elif Z_COMPILER == Z_COMPILER_MIPS_PRO +# include +# elif Z_COMPILER == Z_COMPILER_MIRACLE_C +# include +# elif Z_COMPILER == Z_COMPILER_MPW_CPP +# include +# elif Z_COMPILER == Z_COMPILER_MSC +# include */ +# elif Z_COMPILER == Z_COMPILER_MSVC +# include +/*# elif Z_COMPILER == Z_COMPILER_NDP_C +# include +# elif Z_COMPILER == Z_COMPILER_NORCROFT_C +# include +# elif Z_COMPILER == Z_COMPILER_NVC +# include +# elif Z_COMPILER == Z_COMPILER_NWCC +# include +# elif Z_COMPILER == Z_COMPILER_OPEN64 +# include +# elif Z_COMPILER == Z_COMPILER_ORACLE_PRO_C_PRECOMPILER +# include +# elif Z_COMPILER == Z_COMPILER_ORACLE_SOLARIS_STUDIO +# include +# elif Z_COMPILER == Z_COMPILER_PACIFIC_C +# include +# elif Z_COMPILER == Z_COMPILER_PALM_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_PCC +# include +# elif Z_COMPILER == Z_COMPILER_PELLES_C +# include +# elif Z_COMPILER == Z_COMPILER_PGI_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_RENESAS_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_SAS_C +# include +# elif Z_COMPILER == Z_COMPILER_SCCZ80 +# include +# elif Z_COMPILER == Z_COMPILER_SDCC +# include +# elif Z_COMPILER == Z_COMPILER_SNC +# include +# elif Z_COMPILER == Z_COMPILER_SYMANTEC_CPP +# include +# elif Z_COMPILER == Z_COMPILER_SYSTEMS_C +# include +# elif Z_COMPILER == Z_COMPILER_TENDRA +# include +# elif Z_COMPILER == Z_COMPILER_THINK_C +# include +# elif Z_COMPILER == Z_COMPILER_TI_C_CPP_COMPILER +# include */ +# elif Z_COMPILER == Z_COMPILER_TINY_CC +# include +/*# elif Z_COMPILER == Z_COMPILER_TURBO_C +# include +# elif Z_COMPILER == Z_COMPILER_TURBO_CPP +# include +# elif Z_COMPILER == Z_COMPILER_ULTRA_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_USL +# include +# elif Z_COMPILER == Z_COMPILER_VBCC +# include +# elif Z_COMPILER == Z_COMPILER_VOS_C +# include +# elif Z_COMPILER == Z_COMPILER_VOS_STANDARD_C +# include +# elif Z_COMPILER == Z_COMPILER_WATCOM_C_CPP +# include +# elif Z_COMPILER == Z_COMPILER_ZORTECH_CPP +# include */ +# elif Z_COMPILER == Z_COMPILER_UNKNOWN +# include +# else +# error "Invalid Z_COMPILER key." +# endif +#endif + +#include + +#ifdef Z_COMPILER_BIT_FIELD_ORDER_ALL +# define Z_COMPILER_BIT_FIELD_ORDER(bits) Z_COMPILER_BIT_FIELD_ORDER_ALL +#else +# define Z_COMPILER_BIT_FIELD_ORDER(bits) Z_COMPILER_BIT_FIELD_ORDER_##bits##BIT +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT +# define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE +# define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY +# define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY +# define Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION +# define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE +# define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY +# define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY +#endif + +#ifndef Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY +# define Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY +#endif + +#ifndef Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT +# define Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT +#endif + +#ifndef Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY +# define Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY +#endif + +#ifndef Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY +# define Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY +#endif + +#ifndef Z_COMPILER_PACKED_UNION_BEFORE_UNION +# define Z_COMPILER_PACKED_UNION_BEFORE_UNION +#endif + +#ifndef Z_COMPILER_PACKED_UNION_BEFORE_BODY +# define Z_COMPILER_PACKED_UNION_BEFORE_BODY +#endif + +#ifndef Z_COMPILER_PACKED_UNION_AFTER_BODY +# define Z_COMPILER_PACKED_UNION_AFTER_BODY +#endif + +#endif /* Z_inspection_compiler_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/completion.h b/projects/Zeta/API/Z/inspection/compiler/completion.h new file mode 100644 index 0000000..7c34549 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/completion.h @@ -0,0 +1,1418 @@ +/* Zeta API - Z/inspection/compiler/completion.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Copyright (C) 2018 Sofía Ortega Sosa. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_completion_H +#define Z_inspection_compiler_completion_H + +/* MARK: - Attributes */ + +#ifdef Z_COMPILER_ATTRIBUTE_ALIAS +# define Z_COMPILER_HAS_ATTRIBUTE_ALIAS 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_ALWAYS_INLINE +# define Z_COMPILER_HAS_ATTRIBUTE_ALWAYS_INLINE 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_API_ALIAS +# define Z_COMPILER_HAS_ATTRIBUTE_API_ALIAS 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_API_EXPORT +# define Z_COMPILER_HAS_ATTRIBUTE_API_EXPORT 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_API_IMPORT +# define Z_COMPILER_HAS_ATTRIBUTE_API_IMPORT 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_API_EXPORT_ALIAS +# define Z_COMPILER_HAS_ATTRIBUTE_API_EXPORT_ALIAS 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_API_WEAK_EXPORT +# define Z_COMPILER_HAS_ATTRIBUTE_API_WEAK_EXPORT 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_EBCO +# define Z_COMPILER_HAS_ATTRIBUTE_EBCO 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_INLINE +# define Z_COMPILER_HAS_ATTRIBUTE_INLINE 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_MICROSOFT_STD_CALL +# define Z_COMPILER_HAS_ATTRIBUTE_MICROSOFT_STD_CALL 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_NO_RETURN +# define Z_COMPILER_HAS_ATTRIBUTE_NO_RETURN 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_NULL_TERMINATED +# define Z_COMPILER_HAS_ATTRIBUTE_NULL_TERMINATED 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_PRIVATE +# define Z_COMPILER_HAS_ATTRIBUTE_PRIVATE 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_PUBLIC +# define Z_COMPILER_HAS_ATTRIBUTE_PUBLIC 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_THREAD_LOCAL +# define Z_COMPILER_HAS_ATTRIBUTE_THREAD_LOCAL 1 +#endif + +#ifdef Z_COMPILER_ATTRIBUTE_WEAK +# define Z_COMPILER_HAS_ATTRIBUTE_WEAK 1 +#endif + +/* MARK: - Built-in constants */ + +#ifdef Z_COMPILER_CONSTANT_FLOAT16_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT16_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT16_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT16_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT32_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT32_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT32_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT32_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT64_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT64_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT64_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT64_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT128_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT128_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT128_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT128_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT80_X87_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT80_X87_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT80_X87_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT80_X87_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT96_X87_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT96_X87_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT96_X87_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT96_X87_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT128_X87_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT128_X87_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT128_X87_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT128_X87_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_CHAR_WIDTH +# define Z_COMPILER_HAS_CONSTANT_CHAR_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UCHAR_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_UCHAR_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SCHAR_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SCHAR_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SCHAR_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SCHAR_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SHORT_SIZE +# define Z_COMPILER_HAS_CONSTANT_SHORT_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SHORT_WIDTH +# define Z_COMPILER_HAS_CONSTANT_SHORT_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_USHORT_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_USHORT_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SSHORT_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SSHORT_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SSHORT_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SSHORT_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_INT_SIZE +# define Z_COMPILER_HAS_CONSTANT_INT_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_INT_WIDTH +# define Z_COMPILER_HAS_CONSTANT_INT_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UINT_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_UINT_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINT_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SINT_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINT_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SINT_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LONG_SIZE +# define Z_COMPILER_HAS_CONSTANT_LONG_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LONG_WIDTH +# define Z_COMPILER_HAS_CONSTANT_LONG_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_ULONG_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_ULONG_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SLONG_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SLONG_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SLONG_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SLONG_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LLONG_SIZE +# define Z_COMPILER_HAS_CONSTANT_LLONG_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LLONG_WIDTH +# define Z_COMPILER_HAS_CONSTANT_LLONG_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_ULLONG_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_ULLONG_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SLLONG_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SLLONG_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SLLONG_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SLLONG_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT_SIZE +# define Z_COMPILER_HAS_CONSTANT_FLOAT_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT_WIDTH +# define Z_COMPILER_HAS_CONSTANT_FLOAT_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT_INFINITY +# define Z_COMPILER_HAS_CONSTANT_FLOAT_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_FLOAT_NAN +# define Z_COMPILER_HAS_CONSTANT_FLOAT_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_DOUBLE_SIZE +# define Z_COMPILER_HAS_CONSTANT_DOUBLE_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_DOUBLE_WIDTH +# define Z_COMPILER_HAS_CONSTANT_DOUBLE_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_DOUBLE_INFINITY +# define Z_COMPILER_HAS_CONSTANT_DOUBLE_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_DOUBLE_NAN +# define Z_COMPILER_HAS_CONSTANT_DOUBLE_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LDOUBLE_SIZE +# define Z_COMPILER_HAS_CONSTANT_LDOUBLE_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LDOUBLE_WIDTH +# define Z_COMPILER_HAS_CONSTANT_LDOUBLE_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LDOUBLE_INFINITY +# define Z_COMPILER_HAS_CONSTANT_LDOUBLE_INFINITY 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_LDOUBLE_NAN +# define Z_COMPILER_HAS_CONSTANT_LDOUBLE_NAN 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_WCHAR_SIZE +# define Z_COMPILER_HAS_CONSTANT_WCHAR_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_WCHAR_WIDTH +# define Z_COMPILER_HAS_CONSTANT_WCHAR_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_WCHAR_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_WCHAR_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SIZE_SIZE +# define Z_COMPILER_HAS_CONSTANT_SIZE_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SIZE_WIDTH +# define Z_COMPILER_HAS_CONSTANT_SIZE_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_USIZE_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_USIZE_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SSIZE_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SSIZE_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SSIZE_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SSIZE_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UINTMAX_SIZE +# define Z_COMPILER_HAS_CONSTANT_UINTMAX_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UINTMAX_WIDTH +# define Z_COMPILER_HAS_CONSTANT_UINTMAX_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UINTMAX_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_UINTMAX_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTMAX_SIZE +# define Z_COMPILER_HAS_CONSTANT_SINTMAX_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTMAX_WIDTH +# define Z_COMPILER_HAS_CONSTANT_SINTMAX_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTMAX_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SINTMAX_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTMAX_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SINTMAX_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_INTPTR_SIZE +# define Z_COMPILER_HAS_CONSTANT_INTPTR_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_INTPTR_WIDTH +# define Z_COMPILER_HAS_CONSTANT_INTPTR_WIDTH 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_UINTPTR_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_UINTPTR_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTPTR_MINIMUM +# define Z_COMPILER_HAS_CONSTANT_SINTPTR_MINIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_SINTPTR_MAXIMUM +# define Z_COMPILER_HAS_CONSTANT_SINTPTR_MAXIMUM 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_POINTER_SIZE +# define Z_COMPILER_HAS_CONSTANT_POINTER_SIZE 1 +#endif + +#ifdef Z_COMPILER_CONSTANT_POINTER_WIDTH +# define Z_COMPILER_HAS_CONSTANT_POINTER_WIDTH 1 +#endif + +/* MARK: - Built-in magic constants */ + +#ifdef Z_COMPILER_MAGIC_CONSTANT_MANGLED_FUNCTION_NAME +# define Z_COMPILER_HAS_MAGIC_CONSTANT_MANGLED_FUNCTION_NAME 1 +#endif + +/* MARK: - Built-in macros: Struture */ + +#ifdef Z_COMPILER_MACRO_MEMBER_OFFSET +# define Z_COMPILER_HAS_MACRO_MEMBER_OFFSET 1 +#endif + +/* MARK: - Built-in macros: VAL */ + +#ifdef Z_COMPILER_MACRO_VAL_INITIALIZE +# define Z_COMPILER_HAS_MACRO_VAL_INITIALIZE 1 +#endif + +#ifdef Z_COMPILER_MACRO_VAL_FINALIZE +# define Z_COMPILER_HAS_MACRO_VAL_FINALIZE 1 +#endif + +#ifdef Z_COMPILER_MACRO_VAL_READ +# define Z_COMPILER_HAS_MACRO_VAL_READ 1 +#endif + +#ifdef Z_COMPILER_MACRO_VAL_COPY +# define Z_COMPILER_HAS_MACRO_VAL_COPY 1 +#endif + +/* MARK: - Built-in types */ + +#ifdef Z_COMPILER_TYPE_UINT8 +# define Z_COMPILER_HAS_TYPE_UINT8 1 +#endif + +#ifdef Z_COMPILER_TYPE_SINT8 +# define Z_COMPILER_HAS_TYPE_SINT8 1 +#endif + +#ifdef Z_COMPILER_TYPE_UINT16 +# define Z_COMPILER_HAS_TYPE_UINT16 1 +#endif + +#ifdef Z_COMPILER_TYPE_SINT16 +# define Z_COMPILER_HAS_TYPE_SINT16 1 +#endif + +#ifdef Z_COMPILER_TYPE_UINT32 +# define Z_COMPILER_HAS_TYPE_UINT32 1 +#endif + +#ifdef Z_COMPILER_TYPE_SINT32 +# define Z_COMPILER_HAS_TYPE_SINT32 1 +#endif + +#ifdef Z_COMPILER_TYPE_UINT64 +# define Z_COMPILER_HAS_TYPE_UINT64 1 +#endif + +#ifdef Z_COMPILER_TYPE_SINT64 +# define Z_COMPILER_HAS_TYPE_SINT64 1 +#endif + +#ifdef Z_COMPILER_TYPE_UINT128 +# define Z_COMPILER_HAS_TYPE_UINT128 1 +#endif + +#ifdef Z_COMPILER_TYPE_SINT128 +# define Z_COMPILER_HAS_TYPE_SINT128 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT16 +# define Z_COMPILER_HAS_TYPE_FLOAT16 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT32 +# define Z_COMPILER_HAS_TYPE_FLOAT32 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT64 +# define Z_COMPILER_HAS_TYPE_FLOAT64 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT128 +# define Z_COMPILER_HAS_TYPE_FLOAT128 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT80_X87 +# define Z_COMPILER_HAS_TYPE_FLOAT80_X87 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT96_X87 +# define Z_COMPILER_HAS_TYPE_FLOAT96_X87 1 +#endif + +#ifdef Z_COMPILER_TYPE_FLOAT128_X87 +# define Z_COMPILER_HAS_TYPE_FLOAT128_X87 1 +#endif + +#ifdef Z_COMPILER_TYPE_VAL +# define Z_COMPILER_HAS_TYPE_VAL 1 +#endif + +/* MARK: - Suffix macros for built-in types */ + +#ifdef Z_COMPILER_LITERAL_UINT8 +# define Z_COMPILER_HAS_LITERAL_UINT8 1 +#endif + +#ifdef Z_COMPILER_LITERAL_SINT8 +# define Z_COMPILER_HAS_LITERAL_SINT8 1 +#endif + +#ifdef Z_COMPILER_LITERAL_UINT16 +# define Z_COMPILER_HAS_LITERAL_UINT16 1 +#endif + +#ifdef Z_COMPILER_LITERAL_SINT16 +# define Z_COMPILER_HAS_LITERAL_SINT16 1 +#endif + +#ifdef Z_COMPILER_LITERAL_UINT32 +# define Z_COMPILER_HAS_LITERAL_UINT32 1 +#endif + +#ifdef Z_COMPILER_LITERAL_SINT32 +# define Z_COMPILER_HAS_LITERAL_SINT32 1 +#endif + +#ifdef Z_COMPILER_LITERAL_UINT64 +# define Z_COMPILER_HAS_LITERAL_UINT64 1 +#endif + +#ifdef Z_COMPILER_LITERAL_SINT64 +# define Z_COMPILER_HAS_LITERAL_SINT64 1 +#endif + +#ifdef Z_COMPILER_LITERAL_UINT128 +# define Z_COMPILER_HAS_LITERAL_UINT128 1 +#endif + +#ifdef Z_COMPILER_LITERAL_SINT128 +# define Z_COMPILER_HAS_LITERAL_SINT128 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT16 +# define Z_COMPILER_HAS_LITERAL_FLOAT16 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT32 +# define Z_COMPILER_HAS_LITERAL_FLOAT32 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT64 +# define Z_COMPILER_HAS_LITERAL_FLOAT64 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT128 +# define Z_COMPILER_HAS_LITERAL_FLOAT128 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT80_X87 +# define Z_COMPILER_HAS_LITERAL_FLOAT80_X87 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT96_X87 +# define Z_COMPILER_HAS_LITERAL_FLOAT96_X87 1 +#endif + +#ifdef Z_COMPILER_LITERAL_FLOAT128_X87 +# define Z_COMPILER_HAS_LITERAL_FLOAT128_X87 1 +#endif + +/* MARK: - Complete implementations */ + +#ifndef Z_COMPILER_HAS_VAL +# if Z_COMPILER_HAS_TYPE_VAL && \ + Z_COMPILER_HAS_MACRO_VAL_INITIALIZE && \ + Z_COMPILER_HAS_MACRO_VAL_FINALIZE && \ + Z_COMPILER_HAS_MACRO_VAL_READ + +# define Z_COMPILER_HAS_VAL 1 +# else +# define Z_COMPILER_HAS_VAL 0 +# endif +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* De aquí hasta el final está comprobado y OK */ + +/* MARK: - Built-ins: Functions */ + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_AND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_AND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_AND +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_AND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_OR +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_OR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_OR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_OR_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET 1 +#endif + +#ifdef Z_COMPILER_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET +# define Z_COMPILER_HAS_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET 1 +#endif + +/* MARK: - Built-ins: Traits */ + +#ifdef Z_COMPILER_TRAIT_SELECT_TYPE +# define Z_COMPILER_HAS_TRAIT_SELECT_TYPE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_DIMENSION_COUNT +# define Z_COMPILER_HAS_TRAIT_TYPE_DIMENSION_COUNT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_ELEMENT_COUNT +# define Z_COMPILER_HAS_TRAIT_TYPE_ELEMENT_COUNT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_HAS_UNIQUE_OBJECT_REPRESENTATIONS +# define Z_COMPILER_HAS_TRAIT_TYPE_HAS_UNIQUE_OBJECT_REPRESENTATIONS 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_HAS_TRIVIAL_DESTRUCTOR +# define Z_COMPILER_HAS_TRAIT_TYPE_HAS_TRIVIAL_DESTRUCTOR 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR +# define Z_COMPILER_HAS_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_ABSTRACT +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_ABSTRACT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_AGGREGATE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_AGGREGATE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_ARITHMETIC +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_ARITHMETIC 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_ARRAY +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_ARRAY 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_BASE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_BASE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_COMPLETE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_COMPLETE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_COMPOUND +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_COMPOUND 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_CONST +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_CONST 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_CONVERTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_CONVERTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_DATA_MEMBER_POINTER +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_DATA_MEMBER_POINTER 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_DESTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_DESTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_EMPTY +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_EMPTY 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_ENUMERATION +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_ENUMERATION 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_FINAL +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_FINAL 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_INTEGRAL +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_INTEGRAL 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_INTERFACE_CLASS +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_INTERFACE_CLASS 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_FLOATING_POINT +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_FLOATING_POINT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_FUNCTION +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_FUNCTION 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_FUNDAMENTAL +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_FUNDAMENTAL 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_LITERAL +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_LITERAL 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_LVALUE_REFERENCE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_LVALUE_REFERENCE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_MEMBER_FUNCTION_POINTER +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_MEMBER_FUNCTION_POINTER 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_MEMBER_POINTER +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_MEMBER_POINTER 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DESTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_DESTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_MOVE_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_NOTHROW_MOVE_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_OBJECT +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_OBJECT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_POD +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_POD 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_POINTER +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_POINTER 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_POLYMORPHIC +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_POLYMORPHIC 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_REFERENCE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_REFERENCE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_RVALUE_REFERENCE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_RVALUE_REFERENCE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_SAME +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_SAME 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_SCALAR +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_SCALAR 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_SEALED +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_SEALED 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_SIGNED +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_SIGNED 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_STD_LAYOUT +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_STD_LAYOUT 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_STRUCTURE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_STRUCTURE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIAL +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIAL 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_UNION +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_UNION 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_UNSIGNED +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_UNSIGNED 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_VOID +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_VOID 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_IS_VOLATILE +# define Z_COMPILER_HAS_TRAIT_TYPE_IS_VOLATILE 1 +#endif + +#ifdef Z_COMPILER_TRAIT_TYPE_UNDERLYING_TYPE +# define Z_COMPILER_HAS_TRAIT_TYPE_UNDERLYING_TYPE 1 +#endif + +#endif /* Z_inspection_compiler_completion_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/detection.h b/projects/Zeta/API/Z/inspection/compiler/detection.h new file mode 100644 index 0000000..5ad36b0 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/detection.h @@ -0,0 +1,274 @@ +/* Zeta API - Z/inspection/compiler/detection.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_detection_H +#define Z_inspection_compiler_detection_H + +#if defined(__clang__) +/*# if defined(__apple_build_version__) +# define Z_COMPILER Z_COMPILER_APPLE_CLANG +# else*/ +# define Z_COMPILER Z_COMPILER_CLANG +/*# endif*/ + +#elif defined(_ACC_) +# define Z_COMPILER Z_COMPILER_ACC + +#elif defined(__ACPP__) || defined(__ADAPTIVECPP__) +# define Z_COMPILER Z_COMPILER_ADAPTIVE_CPP + +#elif defined(__CMB__) +# define Z_COMPILER Z_COMPILER_ALTIUM_MICROBLAZE_C + +#elif defined(__CHC__) +# define Z_COMPILER Z_COMPILER_ALTIUM_C_TO_HARDWARE + +#elif defined(__ACK__) +# define Z_COMPILER Z_COMPILER_AMSTERDAM_COMPILER_KIT + +#elif defined(__ARMCC__) +# define Z_COMPILER Z_COMPILER_ARM_C_CPP_COMPILER + +#elif defined(__CC_ARM) +# define Z_COMPILER Z_COMPILER_ARM_COMPILER + +#elif defined(AZTEC_C) || defined(__AZTEC_C__) +# define Z_COMPILER Z_COMPILER_AZTEC_C + +#elif defined(__BCC__) +# define Z_COMPILER Z_COMPILER_BCC + +#elif defined(__CC65__) +# define Z_COMPILER Z_COMPILER_CC65 + +#elif defined(__MWERKS__) || defined(__CWCC__) +# define Z_COMPILER Z_COMPILER_CODE_WARRIOR + +#elif defined(__COMO__) +# define Z_COMPILER Z_COMPILER_COMEAU_CPP + +#elif !defined(__COMPAQ_UPC_VER) && \ + !defined(__HP_UPC_VER ) && \ + (defined(__DECC) || defined(__DECCXX) || defined(__VAXC) || defined(VAXC)) + +# define Z_COMPILER Z_COMPILER_COMPAQ_C_CPP + +#elif defined(__COMPCERT__) +# define Z_COMPILER Z_COMPILER_COMPCERT + +#elif defined(__convexc__) +# define Z_COMPILER Z_COMPILER_CONVEX_C + +#elif defined(__COVERITY__) +# define Z_COMPILER Z_COMPILER_COVERITY_C_CPP_STATIC_ANALYZER + +#elif defined(_CRAYC) +# define Z_COMPILER Z_COMPILER_CRAY_C + +#elif defined(__DCC__) +# define Z_COMPILER Z_COMPILER_DIAB_C_CPP + +#elif defined(_DICE) +# define Z_COMPILER Z_COMPILER_DICE_C + +#elif defined(__DMC__) +# define Z_COMPILER Z_COMPILER_DIGITAL_MARS + +#elif defined(__DJGPP__) || defined(__GO32__) +# define Z_COMPILER Z_COMPILER_DJGPP + +#elif defined(__EDG__) +# define Z_COMPILER Z_COMPILER_EDG_CPP_FRONTEND + +#elif defined(__PATHCC__) +# define Z_COMPILER Z_COMPILER_EKOPATH + +#elif defined(__FCC_VERSION) +# define Z_COMPILER Z_COMPILER_FUJITSU_CPP + +#elif defined(__ghs__) +# define Z_COMPILER Z_COMPILER_GREEN_HILL_C_CPP + +#elif defined(__HP_aCC) +# define Z_COMPILER Z_COMPILER_HP_ACPP + +#elif defined(__HP_cc) +# define Z_COMPILER Z_COMPILER_HP_ANSI_C + +#elif defined(__COMPAQ_UPC_VER) || defined(__HP_UPC_VER) +# define Z_COMPILER Z_COMPILER_HP_UPC + +#elif defined(__IAR_SYSTEMS_ICC__) +# define Z_COMPILER Z_COMPILER_IAR_C_CPP + +#elif defined(__xlc__) || defined(__xlC__) /* Not sure */ +# define Z_COMPILER Z_COMPILER_IBM_XL_C_CPP + +#elif defined(__IBMC__) || defined(__IBMCPP__) +# if defined(__COMPILER_VER__) +# define Z_COMPILER Z_COMPILER_IBM_Z_OS_C_CPP +# else +# define Z_COMPILER Z_COMPILER_IBM_XL_C_CPP +# endif + +#elif defined(__IMAGECRAFT__) +# define Z_COMPILER Z_COMPILER_IMAGECRAFT_C + +#elif defined(__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL) +# define Z_COMPILER Z_COMPILER_INTEL_CPP + +#elif defined(__KCC) +# define Z_COMPILER Z_COMPILER_KAI_CPP + +#elif defined(__C166__) +# define Z_COMPILER Z_COMPILER_KEIL_C166 + +#elif defined(__C51__) || defined(__CX51__) +# define Z_COMPILER Z_COMPILER_KEIL_C51 + +#elif defined(__CA__) || defined(__KEIL__) +# define Z_COMPILER Z_COMPILER_KEIL_CARM + +#elif defined(__LCC__) +# define Z_COMPILER Z_COMPILER_LCC + +#elif defined(__MCC__) +# define Z_COMPILER Z_COMPILER_MCC + +#elif defined(__HIGHC__) +# define Z_COMPILER Z_COMPILER_METAWARE_HIGH_C_CPP + +#elif defined(_MRI) +# define Z_COMPILER Z_COMPILER_MICROTEC_C_CPP + +#elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) +# define Z_COMPILER Z_COMPILER_MINGW + +#elif defined(__sgi) || defined(sgi) +# define Z_COMPILER Z_COMPILER_MIPS_PRO + +#elif defined(MIRACLE) +# define Z_COMPILER Z_COMPILER_MIRACLE_C + +#elif defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS) +# define Z_COMPILER Z_COMPILER_MPW_CPP + +#elif defined(__NDPC__) || defined(__NDPX__) +# define Z_COMPILER Z_COMPILER_NDP_C + +#elif defined(__CC_NORCROFT) +# define Z_COMPILER Z_COMPILER_NORCROFT_C + +#elif defined(__NVCOMPILER) +# define Z_COMPILER Z_COMPILER_NVC + +#elif defined(__NWCC__) +# define Z_COMPILER Z_COMPILER_NWCC + +#elif defined(__OPEN64__) || defined(__OPENCC__) +# define Z_COMPILER Z_COMPILER_OPEN64 + +#elif defined(ORA_PROC) +# define Z_COMPILER Z_COMPILER_ORACLE_PRO_C_PRECOMPILER + +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define Z_COMPILER Z_COMPILER_ORACLE_SOLARIS_STUDIO + +#elif defined(__PACIFIC__) +# define Z_COMPILER Z_COMPILER_PACIFIC_C + +#elif defined(_PACC_VER) +# define Z_COMPILER Z_COMPILER_PALM_C_CPP + +#elif defined(__PCC__) +# define Z_COMPILER Z_COMPILER_PCC + +#elif defined(__POCC__) +# define Z_COMPILER Z_COMPILER_PELLES_C + +#elif defined(__PGI) +# define Z_COMPILER Z_COMPILER_PGI_C_CPP + +#elif defined(__RENESAS__) || defined(__HITACHI__) +# define Z_COMPILER Z_COMPILER_RENESAS_C_CPP + +#elif defined(__SASC) || defined(__SASC__) || defined(SASC) +# define Z_COMPILER Z_COMPILER_SAS_C + +#elif defined(__SCCZ80) +# define Z_COMPILER Z_COMPILER_SCCZ80 + +#elif defined(__SDCC) /* Z88DK version? */ /* || defined(SDCC) */ +# define Z_COMPILER Z_COMPILER_SDCC + +#elif defined(__SNC__) +# define Z_COMPILER Z_COMPILER_SNC + +#elif defined(__SC__) +# define Z_COMPILER Z_COMPILER_SYMANTEC_CPP + +#elif defined(__SYSC__) +# define Z_COMPILER Z_COMPILER_SYSTEMS_C + +#elif defined(__TenDRA__) +# define Z_COMPILER Z_COMPILER_TENDRA + +/*#elif defined(THINKC3) || defined(THINKC4) +# define Z_COMPILER Z_COMPILER_THINK_C*/ + +#elif defined(__TI_COMPILER_VERSION__) || defined(_TMS320C6X) +# define Z_COMPILER Z_COMPILER_TI_C_CPP_COMPILER + +#elif defined(__TINYC__) +# define Z_COMPILER Z_COMPILER_TINY_CC + +#elif defined(__BORLANDC__ ) || \ + defined(__CODEGEARC__) || \ + (defined(__TURBOC__) && __TURBOC__ >= 0x295) + +# define Z_COMPILER Z_COMPILER_TURBO_CPP + +#elif defined(__TURBOC__) +# define Z_COMPILER Z_COMPILER_TURBO_C + +#elif defined(_UCC) +# define Z_COMPILER Z_COMPILER_ULTRA_C_CPP + +#elif defined(__USLC__) +# define Z_COMPILER Z_COMPILER_USL + +#elif defined(__VBCC__) +# define Z_COMPILER Z_COMPILER_VBCC + +#elif defined(__VOSC__) && !__VOSC__ +# define Z_COMPILER Z_COMPILER_VOS_C + +#elif defined(__VOSC__) && __VOSC__ == 1 +# define Z_COMPILER Z_COMPILER_VOS_STANDARD_C + +#elif defined(_MSC_VER) +# if _MSC_VER < 800 +# define Z_COMPILER Z_COMPILER_MSC +# else +# define Z_COMPILER Z_COMPILER_MSVC +# endif + +#elif defined(__WATCOMC__) +# define Z_COMPILER Z_COMPILER_WATCOM_C_CPP + +#elif defined(__ZTC__) +# define Z_COMPILER Z_COMPILER_ZORTECH_CPP + +#elif defined(__GNUC__) +# define Z_COMPILER Z_COMPILER_GCC + +#else +# define Z_COMPILER Z_COMPILER_UNKNOWN +#endif + +#endif /* Z_inspection_compiler_detection_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/Clang.h b/projects/Zeta/API/Z/inspection/compiler/modules/Clang.h new file mode 100644 index 0000000..e2a9587 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/Clang.h @@ -0,0 +1,2618 @@ +/* Zeta API - Z/inspection/compiler/modules/Clang.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. + +.------------------------------------------------------------------------------. +| Compiler: Clang | +| Last version: v10.0 | +| Language support: C89 - C17, C++98 - C++17 | +| Options: -pedantic -Wall -Wextra | +|------------------------------------------------------------------------------| +| | +| 2. VERSION NOTATION | +| ------------------- | +| | +| N -> Release Notes | +| S -> C++ Status | +| T -> Tested | +| Tw -> Tested and generate warnings | +| T! -> Tested and doesn't generate warnings | +| | +| 3. COMMONLY USED PREDEFINED MACROS | +| ---------------------------------- | +| | +| Macro | Value | Since | Meaning | +| ---------------------------+---------+-------+------------------------------ | +| __STDC_VERSION__ | 199409L | v2.6 | C95 | +| __STDC_VERSION__ | 199901L | v2.6 | C99 | +| __STDC_VERSION__ | 201112L | v3.1 | C11 | +| __STDC_VERSION__ | 201710L | v6.0 | C17 | +| __STRICT_ANSI__ | 1 | v2.6 | | +| __GXX_EXPERIMENTAL_CXX0X__ | 1 | v2.6 | C++11 (experimental) | +| __cplusplus | 1 | | GNU++11 | +| __cplusplus | 199711L | v2.6 | C++98/C++03 | +| __cplusplus | 201103L | v3.0 | C++11 | +| __cplusplus | 201305L | v3.3 | C++14 (experimental) | +| __cplusplus | 201402L | v3.5 | C++14 | +| __cplusplus | 201406L | v3.5 | C++17 (experimental) | +| __cplusplus | 201703L | v5.0 | C++17 | +| __cplusplus | 201707L | v5.0 | C++20 (experimental) | +| __cplusplus | 202002L | v10.0 | C++20 | +| | +| +| -std=gnu++11 causes __cplusplus be predefined as 1 instead of 201103L in versions +| prior to v3.2. +| +| C++11 feature test macros not used (for now): +| __has_feature(cxx_access_control_sfinae) +| __has_feature(cxx_implicit_moves) +'=============================================================================*/ + +#ifndef Z_inspection_compiler_modules_Clang_H +#define Z_inspection_compiler_modules_Clang_H + +/* MARK: - Identification */ + +#define Z_COMPILER_IS_CLANG 1 +#define Z_COMPILER_NAME Z_COMPILER_NAME_CLANG + +#if defined(__clang_version__) /* v2.8 */ +# define Z_COMPILER_VERSION Z_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) +# define Z_COMPILER_VERSION_STRING __clang_version__ + +#elif defined(__SIZE_WIDTH__) /* v2.7 */ +# define Z_COMPILER_VERSION Z_VERSION(2,7,0) +# define Z_COMPILER_VERSION_STRING "2.7" + +#else +# define Z_COMPILER_VERSION Z_VERSION(2,6,0) +# define Z_COMPILER_VERSION_STRING "2.6" +#endif + +/* MARK: - Private macros */ + +#ifdef __has_attribute /* v2.9 */ +# define Z_z_HAS_ATTRIBUTE __has_attribute +#else +# define Z_z_HAS_ATTRIBUTE(which) 0 +#endif + +#ifdef __has_cpp_attribute /* v3.6 */ +# define Z_z_HAS_CPP_ATTRIBUTE __has_cpp_attribute +#else +# define Z_z_HAS_CPP_ATTRIBUTE(which) 0 +#endif + +#ifdef __has_extension /* v3.0 */ +# define Z_z_HAS_EXTENSION __has_extension +#else +# define Z_z_HAS_EXTENSION __has_feature +#endif + +/*---------------------------------------------------------------------------. +| IMPORTANT: There is no well-defined way to know if the MSVC compatibility | +| mode is enabled. The following method is based on certain macros that are | +| known to be predefined or not when this mode is used. This could change in | +| future versions of Clang... | +'===========================================================================*/ +#if (Z_COMPILER_VERSION >= Z_VERSION(3,1,0) && !defined(__GNUC__ )) || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && defined(__PRETTY_FUNCTION__)) || \ + (Z_COMPILER_VERSION < Z_VERSION(3,0,0) && !defined(__STDC__ )) + +# define Z_z_HAS_MSVC_COMPATIBILITY 1 +#else +# define Z_z_HAS_MSVC_COMPATIBILITY 0 +#endif + +/*-------------------------------------------------------------------------. +| IMPORTANT: Since v3.5, there is no way to know if the GNU extensions are | +| enabled when using the MSVC compatibility mode. However, this may not be | +| a serious problem, as ideally both things should be mutually exclusive. | +'=========================================================================*/ +#if !defined(__STRICT_ANSI__) && \ + ((Z_COMPILER_VERSION < Z_VERSION(3,5,0)) || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,5,0) && !Z_z_HAS_MSVC_COMPATIBILITY)) + +# define Z_z_HAS_GNU_EXTENSIONS 1 +#else +# define Z_z_HAS_GNU_EXTENSIONS 0 +#endif + +#if Z_COMPILER_VERSION >= Z_VERSION(10,0,0) +# define Z_z_HAS_TRAIT(which) \ + (__has_builtin(__##which) || !__is_identifier(__##which) || __has_extension(which)) + +#elif Z_COMPILER_VERSION >= Z_VERSION(6,0,0) +# define Z_z_HAS_TRAIT(which) \ + (!__is_identifier(__##which) || __has_extension(which)) + +#else +# define Z_z_HAS_TRAIT Z_z_HAS_EXTENSION +#endif + +/* MARK: - ISA / Bit field order */ + +#if defined(__amd64 ) /* v2.6 */ || \ + defined(__amd64__ ) /* v2.6 */ || \ + defined(__x86_64 ) /* v2.6 */ || \ + defined(__x86_64__) /* v2.6 */ || \ + defined(_M_AMD64 ) /* v2.9 */ || \ + defined(_M_X64 ) /* v2.7 */ + +# define Z_COMPILER_ISA Z_ISA_X86_64 + +#elif defined(__INTEL__) /* v2.8 */ || \ + defined(__i386 ) /* v2.6 */ || \ + defined(__i386__ ) /* v2.6 */ || \ + defined(__i486 ) /* v3.0 */ || \ + defined(__i486__ ) /* v3.0 */ || \ + defined(__i586 ) /* v3.0 */ || \ + defined(__i586__ ) /* v3.0 */ || \ + defined(__i686 ) /* v3.0 */ || \ + defined(__i686__ ) /* v3.0 */ || \ + defined(_M_IX86 ) /* v2.7 */ || \ + defined(_X86_ ) /* v2.6 */ || \ + defined(i386 ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_X86_32 + +#elif defined(__ARM_ARCH_ISA_A64) /* v3.4 */ || \ + defined(__aarch64__ ) /* v3.3 */ || \ + defined(__arm64 ) /* v3.5 */ || \ + defined(__arm64__ ) /* v3.5 */ || \ + defined(_M_ARM64 ) /* v5.0 */ + +# define Z_COMPILER_ISA Z_ISA_AARCH64 + +#elif defined(__ARM_ARCH) /* v3.2 */ || \ + defined(__arm ) /* v2.6 */ || \ + defined(__arm__ ) /* v2.6 */ || \ + defined(__thumb__ ) /* v2.7 */ || \ + defined(_ARM_ ) /* v3.8 */ || \ + defined(_M_ARM ) /* v3.5 */ || \ + defined(_M_ARM_NT ) /* v3.5 */ || \ + defined(_M_ARMT ) /* v3.5 */ || \ + defined(_M_THUMB ) /* v3.5 */ + +# define Z_COMPILER_ISA Z_ISA_AARCH32 + +#elif defined(__arc__) /* v8.0 */ +# define Z_COMPILER_ISA Z_ISA_ARC + +#elif defined(__HEXAGON_ARCH__) /* v3.1 */ || \ + defined(__QDSP6_ARCH__ ) /* v3.1 */ || \ + defined(__hexagon ) /* v3.1 */ || \ + defined(__hexagon__ ) /* v3.1 */ || \ + defined(__qdsp6 ) /* v3.1 */ || \ + defined(__qdsp6__ ) /* v3.1 */ || \ + defined(hexagon ) /* v3.1 */ || \ + defined(qdsp6 ) /* v3.1 */ + +# define Z_COMPILER_ISA Z_ISA_HEXAGON + +#elif defined(__ADSPBLACKFIN__ ) /* v2.6 */ || \ + defined(__ADSPLPBLACKFIN__) /* v2.6 */ || \ + defined(__BFIN ) /* v2.6 */ || \ + defined(__BFIN__ ) /* v2.6 */ || \ + defined(__bfin ) /* v2.6 */ || \ + defined(__bfin__ ) /* v2.6 */ || \ + defined(BFIN ) /* v2.6 */ || \ + defined(bfin ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_BLACKFIN + +#elif defined(__loongarch64) /* v16.0 */ +# define Z_COMPILER_ISA Z_ISA_LA64 + +#elif defined(__loongarch__) /* v16.0 */ +# define Z_COMPILER_ISA Z_ISA_LA32S + +#elif defined(__lanai__) /* v3.9 */ +# define Z_COMPILER_ISA Z_ISA_LANAI + +#elif defined(__mips64 ) /* v3.2 */ || \ + defined(__mips64__) /* v3.2 */ || \ + (defined(__mips) && __mips == 64) /* v3.5 */ || \ + (defined(_MIPS_ISA) && defined(_MIPS_ISA_MIPS64) && _MIPS_ISA == _MIPS_ISA_MIPS64) /* v3.5 */ + +# define Z_COMPILER_ISA Z_ISA_MIPS64 + +#elif defined(__mips ) /* v2.7 */ || \ + defined(__mips__) /* v2.7 */ || \ + defined(_mips ) /* v2.7 */ || \ + defined(mips ) /* v2.7 */ + +# define Z_COMPILER_ISA Z_ISA_MIPS + +#elif defined(__MSP430__) /* v2.6 */ || \ + defined(MSP430 ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_MSP430 + +#elif defined(__PPC64__ ) /* v3.4 */ || \ + defined(__powerpc64__) /* v2.7 */ || \ + defined(__ppc64__ ) /* v2.6 */ || \ + defined(_ARCH_PPC64 ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_POWERPC_64BIT + +#elif defined(__POWERPC__) /* v2.6 */ || \ + defined(__PPC__ ) /* v2.8 */ || \ + defined(__powerpc__) /* v2.7 */ || \ + defined(__ppc__ ) /* v2.6 */ || \ + defined(_ARCH_PPC ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_POWERPC_32BIT + +#elif defined(__riscv_xlen) /* v7.0 */ +# if __riscv_xlen == 64 /* v7.0 */ +# define Z_COMPILER_ISA Z_ISA_RV64I + +# elif __riscv_xlen == 32 /* v7.0 */ +# define Z_COMPILER_ISA Z_ISA_RV32I +# endif + +#elif defined(__arch64__ ) /* v3.3 */ || \ + defined(__sparc_v9__) /* v3.3 */ || \ + defined(__sparc64__ ) /* v3.3 */ || \ + defined(__sparcv9 ) /* v3.3 */ || \ + defined(__sparcv9__ ) /* v3.3 */ + +# define Z_COMPILER_ISA Z_ISA_SPARC_V9 + +#elif defined(__sparc ) /* v2.6 */ || \ + defined(__sparc__ ) /* v2.6 */ || \ + defined(__sparcv8 ) /* v2.6 */ || \ + defined(__sparcv8__) /* v3.8 */ || \ + defined(sparc ) /* v2.6 */ + +# define Z_COMPILER_ISA Z_ISA_SPARC + +#elif defined(__wasm64 ) || \ + defined(__wasm64__) + +# define Z_COMPILER_ISA Z_ISA_WASM64 + +#elif defined(__wasm ) || \ + defined(__wasm__ ) || \ + defined(__wasm32 ) || \ + defined(__wasm32__) + +# define Z_COMPILER_ISA Z_ISA_WASM32 + +#elif defined(__XS1B__) /* v3.4 */ +# define Z_COMPILER_ISA Z_ISA_XCORE + +#elif defined(__s390__ ) /* v2.6 */ || \ + defined(__s390x__) /* v2.6 */ || \ + defined(__zarch__) /* v3.3 */ + +# define Z_COMPILER_ISA Z_ISA_Z_ARCHITECTURE +#endif + +#ifdef __BYTE_ORDER__ /* v3.2 */ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* v3.2 */ +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_REVERSED + +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ /* v3.2 */ +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_BIG +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_NORMAL +# endif + +#elif defined(__AARCH64EL__ ) /* v3.3 */ || \ + defined(__ARMEL__ ) /* v2.6 */ || \ + defined(__ENDIAN_LITTLE__) /* v4.0 */ || \ + defined(__LITTLE_ENDIAN__) /* v2.6 */ || \ + defined(__MIPSEL ) /* v2.7 */ || \ + defined(__MIPSEL__ ) /* v2.7 */ || \ + defined(__THUMBEL__ ) /* v2.7 */ || \ + defined(_LITTLE_ENDIAN ) /* v3.4 */ || \ + defined(_MIPSEL ) /* v2.7 */ || \ + defined(MIPSEL ) /* v2.7 */ + +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_REVERSED + +#elif defined(__AARCH_BIG_ENDIAN) /* v3.4 */ || \ + defined(__AARCH64EB__ ) /* v3.5 */ || \ + defined(__ARM_BIG_ENDIAN ) /* v3.3 */ || \ + defined(__ARMEB__ ) /* v3.5 */ || \ + defined(__BIG_ENDIAN__ ) /* v2.6 */ || \ + defined(__MIPSEB ) /* v2.7 */ || \ + defined(__MIPSEB__ ) /* v2.7 */ || \ + defined(_BIG_ENDIAN ) /* v2.6 */ || \ + defined(_MIPSEB ) /* v2.7 */ || \ + defined(MIPSEB ) /* v2.7 */ + +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_BIG +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_NORMAL + +#else +# error "Clang module: Can not detect the endianness of the integral types." +#endif + +/*#define Z_COMPILER_BIT_FIELD_ORDER_8BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_16BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_32BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_64BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_128BIT*/ + +/* MARK: - Platform / OS */ + +#if defined(__ANDROID__) /* v3.2 */ +# define Z_COMPILER_OS Z_OS_ANDROID + +#elif defined(__gnu_linux__) /* v2.6 */ || \ + defined(__linux ) /* v2.6 */ || \ + defined(__linux__ ) /* v2.6 */ || \ + defined(linux ) /* v2.6 */ + +# define Z_COMPILER_OS Z_OS_LINUX + +#elif defined(__APPLE_CC__) /* v2.6 */ || \ + (defined(__APPLE__ ) /* v2.6 */ && \ + defined(__MACH__ )) /* v2.6 */ + +# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) /* v2.6 */ +# define Z_COMPILER_OS Z_OS_MAC_OS_X + +# elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) /* v2.6 */ +# define Z_COMPILER_OS Z_OS_IOS + +# elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) /* v3.8 */ +# define Z_COMPILER_OS Z_OS_TVOS + +# elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) /* v3.8 */ +# define Z_COMPILER_OS Z_OS_WATCHOS +# endif + +#elif defined(__WIN32 ) /* v2.6 */ || \ + defined(__WIN32__) /* v2.6 */ || \ + defined(__WIN64 ) /* v2.7 */ || \ + defined(__WIN64__) /* v2.7 */ || \ + defined(__WINNT ) /* v2.6 */ || \ + defined(__WINNT__) /* v2.6 */ || \ + defined(_WIN32 ) /* v2.6 */ || \ + defined(_WIN64 ) /* v2.7 */ || \ + defined(WIN32 ) /* v2.6 */ || \ + defined(WIN64 ) /* v2.7 */ || \ + defined(WINNT ) /* v2.6 */ + +# define Z_COMPILER_OS Z_OS_WINDOWS + +#elif defined(_AIX) /* v9.0 */ +# define Z_COMPILER_OS Z_OS_AIX + +#elif defined(__Ananas__) /* v5.0 */ +# define Z_COMPILER_OS Z_OS_ANANAS_OS + +#elif defined(__Bitrig__) /* v3.2 */ +# define Z_COMPILER_OS Z_OS_BITRIG + +#elif defined(__CELLOS_LV2__) /* v2.7 (Revisar, puede que sólo para la PPU) */ +# define Z_COMPILER_PLATFORM Z_PLATFORM_PS3 +# define Z_COMPILER_OS Z_OS_CELL_OS + +#elif defined(__CYGWIN__ ) /* v2.7 */ || \ + defined(__CYGWIN32__) /* v2.7 */ || \ + defined(__CYGWIN64__) /* v3.8 */ + +# define Z_COMPILER_OS Z_OS_CYGWIN + +#elif defined(__DragonFly__) /* v2.6 */ +# define Z_COMPILER_OS Z_OS_DRAGONFLY_BSD + +#elif defined(__FreeBSD__ ) /* v2.6 */ || \ + defined(__FreeBSD_kernel__) /* v3.4 */ + +# define Z_COMPILER_OS Z_OS_FREE_BSD + +#elif defined(__Fuchsia__) /* v4.0 */ +# define Z_COMPILER_OS Z_OS_FUCHSIA + +#elif defined(__HAIKU__) /* v2.8 */ +# define Z_COMPILER_OS Z_OS_HAIKU + +#elif defined(__gnu_hurd__) /* v8.0 */ +# define Z_COMPILER_OS Z_OS_GNU_HURD + +#elif defined(__minix) /* v2.8 */ +# define Z_COMPILER_OS Z_OS_MINIX + +#elif defined(__NetBSD__) /* v2.6 */ +# define Z_COMPILER_OS Z_OS_NET_BSD + +#elif defined(__OpenBSD__) /* v2.6 */ +# define Z_COMPILER_OS Z_OS_OPEN_BSD + +#elif defined(__ORBIS__) /* v3.9 */ +# define Z_COMPILER_PLATFORM Z_PLATFORM_PS4 +# define Z_COMPILER_OS Z_OS_ORBIS_OS + +#elif defined(__psp__) /* v2.7 */ || \ + defined(_PSP ) /* v2.7 */ || \ + defined(PSP ) /* v2.7 */ + +# define Z_COMPILER_PLATFORM Z_PLATFORM_PSP +# define Z_COMPILER_OS Z_OS_PSP_SYSTEM_SOFTWARE + +#elif defined(__rtems__) /* v3.0 */ +# define Z_COMPILER_OS Z_OS_RTEMS + +#elif defined(__SVR4 ) /* v2.6 */ || \ + defined(__sun ) /* v2.6 */ || \ + defined(__sun__ ) /* v2.6 */ || \ + defined(__svr4__) /* v2.6 */ || \ + defined(sun ) /* v2.6 */ + +# define Z_COMPILER_OS Z_OS_SOLARIS + +/* TODO: z-OS */ + +#endif + +/* MARK: - Data model */ + +#if defined(__ILP32__) /* v3.5 */ || \ + defined(_ILP32 ) /* v3.5 */ || \ + defined(_WIN32 ) /* v2.6 */ + +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_ILP32 + +#elif defined(_WIN64) /* v2.7 */ +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LLP64 + +#elif defined(__LP32__) /* v2.7 */ +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LP32 + +#elif defined(__LP64__) /* v2.6 */ || \ + defined(_LP64 ) /* v2.6 */ + +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LP64 +#endif + +/* MARK: - Floating-point */ + +#ifdef __FLT_MANT_DIG__ /* v2.6 */ +# if __FLT_MANT_DIG__ == 11 +# define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT Z_FUNDAMENTAL_BFP16 + +# elif __FLT_MANT_DIG__ == 24 +# define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT Z_FUNDAMENTAL_BFP32 + +# elif __FLT_MANT_DIG__ == 53 +# define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT Z_FUNDAMENTAL_BFP64 + +# elif +# error "Clang module: Can not detect the format of the float type." +# endif +#endif + +#ifdef __DBL_MANT_DIG__ /* v2.6 */ +# if __DBL_MANT_DIG__ == 11 +# define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE Z_FUNDAMENTAL_BFP16 + +# elif __DBL_MANT_DIG__ == 24 +# define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE Z_FUNDAMENTAL_BFP32 + +# elif __DBL_MANT_DIG__ == 53 +# define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE Z_FUNDAMENTAL_BFP64 + +# else +# error "Clang module: Can not detect the format of the double type." +# endif +#endif + +#ifdef __LDBL_MANT_DIG__ /* v2.6 */ +# if __LDBL_MANT_DIG__ == 11 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_BFP16 + +# elif __LDBL_MANT_DIG__ == 24 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_BFP32 + +# elif __LDBL_MANT_DIG__ == 53 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_BFP64 + +# elif __LDBL_MANT_DIG__ == 64 +# ifdef __SIZEOF_LONG_DOUBLE__ /* v2.8 */ +# if __SIZEOF_LONG_DOUBLE__ == 12 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_X87_DE96 + +# elif __SIZEOF_LONG_DOUBLE__ == 16 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_X87_DE128 +# endif + +# elif Z_COMPILER_VERSION < Z_VERSION(2,8,0) +# include +# include + +# if (defined(Z_COMPILER_ISA) && Z_COMPILER_ISA == Z_ISA_X86_64 ) || \ + (defined(Z_COMPILER_OS ) && Z_COMPILER_OS == Z_OS_MAC_OS_X) + +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_X87_DE128 + +# elif defined(Z_COMPILER_ISA) && Z_COMPILER_ISA == Z_ISA_X86_32 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_X87_DE96 +# else +# error "Clang module: Can not detect the format of the long double type." +# endif +# endif + +# elif __LDBL_MANT_DIG__ == 106 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_IBM_ED + +# elif __LDBL_MANT_DIG__ == 113 +# define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_BFP128 + +# else +# error "Clang module: Can not detect the format of the long double type." +# endif +#endif + +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X*/ + +/* MARK: - Language: C78 */ + +#define Z_COMPILER_HAS_C_OLD_STYLE_FUNCTION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C_OPERATOR_SIZEOF 1 /* v2.6 */ +#define Z_COMPILER_HAS_C_STORAGE_CLASS_EXTERN 1 /* v2.6 */ +#define Z_COMPILER_HAS_C_STORAGE_CLASS_STATIC 1 /* v2.6 */ + +#if __has_feature(cxx_auto_type) /* v2.7 */ +# define Z_COMPILER_HAS_C_STORAGE_CLASS_AUTO 1 /* v2.6 */ +#endif + +#if !defined(__cplusplus) || __cplusplus < 201103L || \ + Z_COMPILER_VERSION < Z_VERSION(3,4,0) + +# define Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER 1 /* v2.6 */ +#endif + +#ifdef __DBL_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C_TYPE_DOUBLE 1 /* v2.6 */ +#endif + +#ifdef __FLT_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C_TYPE_FLOAT 1 /* v2.6 */ +#endif + +/* MARK: - Language: C89 */ + +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_CONSTRUCT_RETURN 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_CONSTRUCT_ASSIGNMENT 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_CONSTRUCT_NAMESPACE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_ENUMERATION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_FUNCTION_PROTOTYPE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_INTEGRAL_SWITCH 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_INDENTATION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_STRING_LITERAL_CONCATENATION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_ALERT 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_LITERAL_UNSIGNED 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_CHARACTER 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_STRING 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_OPERATOR_UNARY_PLUS 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_PASTING 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_CHAR 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_LONG 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_SHORT 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_VOID 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_VOID_POINTER 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_MODIFIER_SIGNED 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_CONST 1 /* v2.6 */ +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_VOLATILE 1 /* v2.6 */ + +#ifdef __FLT_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C89_LITERAL_FLOAT 1 /* v2.6 */ +#endif + +#ifdef __LDBL_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C89_TYPE_LONG_DOUBLE 1 /* v2.6 */ +#endif + +/*#define Z_COMPILER_HAS_C89_TRIGRAPHS*/ /* Always generate warnings/errors. */ + +/* MARK: - Language: C95 */ + +#if defined(__cplusplus) || \ + Z_z_HAS_GNU_EXTENSIONS || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L) + +# define Z_COMPILER_HAS_C95_DIGRAPHS 1 /* v2.6 */ +#endif + +/* MARK: - Language: C99 */ + +#define Z_COMPILER_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX 1 /* v2.6? */ +#define Z_COMPILER_HAS_C99_RELIABLE_INTEGER_DIVISION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_INT 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_IDENTIFIER_FUNC 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE 1 /* v2.6 */ +#define Z_COMPILER_HAS_C99_STD_PRAGMA_FP_CONTRACT 1 /* v2.6 */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define Z_COMPILER_HAS_C99_COMPOUND_LITERAL 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_DESIGNATED_INITIALIZATION 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_FLEXIBLE_ARRAY_MEMBER 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_TYPE_QUALIFIER_RESTRICT 1 /* v2.6 */ + +# ifndef __STDC_NO_VLA__ /* Not found in Clang's sources. */ +# define Z_COMPILER_HAS_C99_VLA 1 /* v2.6 */ +# endif +#endif + +#if defined(__cplusplus) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) + +# define Z_COMPILER_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_FOR_WITH_DECLARATION 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_MIXED_DECLARATIONS_AND_CODE 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +# define Z_COMPILER_HAS_C99_UNIVERSAL_CHARACTER_NAME 1 /* v2.6 */ +# define Z_COMPILER_HAS_C99_SPECIFIER_INLINE 1 /* v2.6 */ +#endif + +#if defined(__cplusplus) || \ + Z_z_HAS_GNU_EXTENSIONS || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) + +# define Z_COMPILER_HAS_C99_CPP_STYLE_COMMENT 1 /* v2.6 */ +#endif + +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (Z_COMPILER_VERSION >= Z_VERSION(2,9,0) && \ + defined(__cplusplus) && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))) + +# define Z_COMPILER_HAS_C99_EMPTY_MACRO_ARGUMENT 1 /* v2.6 (C99), v2.9 (C++11 S) */ +# define Z_COMPILER_HAS_C99_VARIADIC_MACRO 1 /* v2.6 (C99), v2.9 (C++11 S) */ +# define Z_COMPILER_HAS_C99_TYPE_LONG_LONG 1 /* v2.6 (C99), v2.9 (C++11 S) */ +#endif + +#if Z_COMPILER_VERSION >= Z_VERSION(3,3,0) && \ + (defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)) + +# define Z_COMPILER_HAS_C99_EXTENDED_IDENTIFIER 1 /* v3.3 (RN-T) */ +#endif + +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))) + +# define Z_COMPILER_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 /* v2.6 */ +#endif + +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cpp_hex_float ) && __cpp_hex_float >= 201603L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + defined(__cplusplus) && __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT 1 /* v2.6 (C99), v3.9 (C++17 T!) */ +#endif + +/*---------------------------------------------------------------------. +| BUG: _Bool has always been available in all versions of C but not in | +| C++, although it was available in C++ by mistake in v2.6 and v2.7. | MAL, mirar +'=====================================================================*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (!defined(__cplusplus) && Z_COMPILER_VERSION <= Z_VERSION(9,1,0)) + +# define Z_COMPILER_HAS_C99_TYPE_BOOL 1 /* v2.6 */ +#endif + +#ifndef __STDC_NO_COMPLEX__ /* Not found in Clang's sources. */ +# define Z_COMPILER_HAS_C99_TYPE_MODIFIER_COMPLEX 1 /* v2.6 */ + +# ifdef __DBL_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C99_TYPE_DOUBLE_COMPLEX 1 /* v2.6 */ +# endif + +# ifdef __FLT_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C99_TYPE_FLOAT_COMPLEX 1 /* v2.6 */ +# endif + +# ifdef __LDBL_MAX__ /* v2.6 */ +# define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX 1 /* v2.6 */ +# endif +#endif + +/*#define Z_COMPILER_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS*/ /* Always generate warnings. */ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FENV_ACCESS*/ /* FENV_ACCESS ON is not implemented. */ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_IMAGINARY*/ /* _Imaginary recognized, but unusable. */ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_IMAGINARY*/ /* _Imaginary recognized, but unusable. */ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY*/ /* _Imaginary recognized, but unusable. */ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_IMAGINARY*/ /* _Imaginary recognized, but unusable. */ + +/* MARK: - Language: C11 */ + +#if Z_COMPILER_VERSION >= Z_VERSION(3,1,0) +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define Z_COMPILER_HAS_C11_ANONYMOUS_STRUCTURE_AS_MEMBER 1 /* v3.1 (N-T!) */ +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,3,0) + /*----------------------------------------------------------------------------. + | NOTE: Since v3.3, __has_feature(c_thread_local) only returns 1 in C11 and | + | later, but _Thread_local compiles without warnings in any version of C/C++. | + '============================================================================*/ +/*# if __has_feature(c_thread_local)*/ /* v3.3 */ +# define Z_COMPILER_HAS_C11_STORAGE_CLASS_THREAD_LOCAL 1 /* v3.3 (T) */ +/*# endif*/ + + /*---------------------------------------------------------------------. + | BUG: Since v3.0, __has_extension(c_alignas) always returns 1, and | + | __has_feature(c_alignas) returns 1 in C11 and later. Despite this, | + | explicitly using _Alignas() when declaring an identifier generates | + | errors in C++, and the same happens in C between v3.0 and v3.2. | + | However, using _Alignas() within a type definition seems to be safe. | + '======================================================================*/ +# if __has_feature(c_alignas) /* v3.0 */ +# define Z_COMPILER_HAS_C11_SPECIFIER_ALIGNAS 1 /* v3.0 (N), v3.3 (T) */ +# endif + +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define Z_COMPILER_HAS_C11_SPECIFIER_NORETURN 1 /* v3.3 (T) */ +# endif + + /*--------------------------------------------------------------. + | BUG: Since v3.1, __has_extension(c_atomic) always returns 1, | + | but _Atomic was not supported as a type qualifier until v3.3. | + '==============================================================*/ +# if __has_feature(c_atomic) /* v3.1 */ +# define Z_COMPILER_HAS_C11_TYPE_QUALIFIER_ATOMIC 1 /* v3.3 (T) */ +# endif +# endif +#endif + +#if defined(__cplusplus) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) + +# define Z_COMPILER_HAS_C11_ANONYMOUS_UNION_AS_MEMBER 1 /* v2.6? (C++), v3.1 (C11 N-T!) */ +#endif + +#if __has_feature(c_generic_selections) /* v3.0 */ +# define Z_COMPILER_HAS_C11_GENERIC_SELECTION 1 /* v3.0 (N-T) */ +#endif + +#if __has_feature(c_static_assert) /* v3.0 */ +# define Z_COMPILER_HAS_C11_STATIC_ASSERTION 1 /* v3.0 (N-T) */ +#endif + +#if defined(__cplusplus) || \ + Z_z_HAS_MSVC_COMPATIBILITY || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) + +# define Z_COMPILER_HAS_C11_TYPEDEF_REDECLARATION 1 /* v2.6? (C++, MSVC), v3.1 (C11 T) */ +#endif + +#if (defined(__cpp_unicode_characters) && __cpp_unicode_characters >= 200704L) /* v3.4 */ || \ + (Z_COMPILER_VERSION < Z_VERSION(3,4,0) && defined(__cplusplus ) && __cplusplus >= 201103L) || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,3,0) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) + +# define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_CHARACTER 1 /* v2.9 (C++11 S), v3.0 (C++11 RN), v3.3 (C11 T) */ +# define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_STRING 1 /* v2.9 (C++11 S), v3.0 (C++11 RN), v3.3 (C11 T) */ +# define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_CHARACTER 1 /* v2.9 (C++11 S), v3.0 (C++11 RN), v3.3 (C11 T) */ +# define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_STRING 1 /* v2.9 (C++11 S), v3.0 (C++11 RN), v3.3 (C11 T) */ +#endif + +#if (Z_COMPILER_VERSION >= Z_VERSION(3,3,0) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + (defined(__cpp_unicode_literals) && __cpp_unicode_literals >= 200710L) /* v3.4 */ || \ + (defined(__cplusplus) && \ + (__has_feature(cxx_unicode_literals) /* v3.1 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && __cplusplus >= 201103L))) + +# define Z_COMPILER_HAS_C11_LITERAL_UTF8_STRING 1 /* v3.0 (C++11 N-S-T), v3.3 (C11 T) */ +#endif + +#if __has_feature(c_alignof) /* v3.6 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,2,0) && \ + Z_COMPILER_VERSION < Z_VERSION(3,6,0) && \ + defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) + +# define Z_COMPILER_HAS_C11_OPERATOR_ALIGNOF 1 /* v3.2 (N-T) */ +#endif + +#if __has_feature(c_atomic) /* v3.1 */ +# define Z_COMPILER_HAS_C11_TYPE_MODIFIER_ATOMIC 1 /* v3.1 (T) */ +#endif + +/* MARK: - Language: Apple C extensions */ + +#if Z_z_HAS_EXTENSION(blocks) /* v2.6 */ || \ + defined(__BLOCKS__) /* v2.6 */ + +# define Z_COMPILER_HAS_APPLE_C_BLOCK_OBJECT 1 /* v2.6 */ +#endif + +/* MARK: - Language: Clang C extensions */ + +#if Z_COMPILER_VERSION >= Z_VERSION(2,7,0) +# define Z_COMPILER_HAS_CLANG_C_PREPROCESSOR_OPERATOR_HAS_INCLUDE 1 /* v2.7 */ +#endif + +#ifdef __cplusplus + + /* MARK: - Language: C++98 */ + +# define Z_COMPILER_HAS_CPP98_SFINAE 1 /* v2.6 */ +# define Z_COMPILER_HAS_CPP98_TYPE_BOOL 1 /* v2.6 */ +# define Z_COMPILER_HAS_CPP98_TYPE_WCHAR_T 1 /* v2.6 */ + +# if defined(_M_IX86 ) || /* v2.7 */ \ + defined(_M_X64 ) || /* v2.7 */ \ + defined(_M_ARM64) /* v5.0 */ + + /*-----------------------------------------------------------------------. + | NOTE: According to Clang's documentation, support for C++ exceptions | + | compatible with the MSVC C++ ABI was not "mostly complete" until v3.9. | + '=======================================================================*/ +# if defined(_CPPUNWIND) /* v2.9 */ && Z_COMPILER_VERSION >= Z_VERSION(3,9,0) +# define Z_COMPILER_HAS_CPP98_EXCEPTIONS 1 /* v3.9 */ +# endif + +# ifdef _CPPRTTI /* v3.0 */ +# define Z_COMPILER_HAS_CPP98_RTTI 1 /* v3.0? */ +# endif + +# else +# if (defined(__cpp_exceptions) && __cpp_exceptions >= 199711L) /* v3.6 */ || \ + __has_feature(cxx_exceptions) /* v2.7 */ || \ + defined(__EXCEPTIONS) /* v2.6 */ /* IMPORTANT: READ 3.5 Release Notes, bevaiour changed. */ + +# define Z_COMPILER_HAS_CPP98_EXCEPTIONS 1 /* v2.6 */ +# endif + +# if defined(__cpp_rtti) && __cpp_rtti >= 199711L /* v3.6 */ || \ + __has_feature(cxx_rtti) /* v2.7 */ || \ + defined(__GXX_RTTI) /* v2.8 */ + +# define Z_COMPILER_HAS_CPP98_RTTI 1 /* v2.7 (S?) */ +# endif +# endif + + /* MARK: - Language: C++03 */ + +# define Z_COMPILER_HAS_CPP03_VALUE_INITIALIZATION 1 /* v2.6 */ + + /* MARK: - Language: C++11 */ + +# define Z_COMPILER_HAS_CPP11_IDENTIFIER_FUNC 1 /* v2.6?, v2.9 (S) */ + +# if Z_COMPILER_VERSION >= Z_VERSION(2,9,0) +# define Z_COMPILER_HAS_CPP11_EXPRESSION_SFINAE 1 /* v2.9 (S) */ + +# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) +# define Z_COMPILER_HAS_CPP11_C99_PREPROCESSOR 1 /* v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_EXTENDED_FRIEND_DECLARATION 1 /* v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_TYPE_LONG_LONG 1 /* v2.9 (S) */ + + /*-----------------------------------------------------------------------------. + | NOTE: In v3.0 (and possibly v2.9), extern templates compile without warnings | + | in any version of C++. Z only recognizes this feature in C++11 and later. | + '=============================================================================*/ +# define Z_COMPILER_HAS_CPP11_EXTERN_TEMPLATE 1 /* v2.9 (S) */ +# endif + +# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || \ + Z_z_HAS_MSVC_COMPATIBILITY + +# define Z_COMPILER_HAS_CPP11_INITIALIZATION_OF_CLASS_OBJECT_BY_RVALUE 1 /* v2.9 (S) */ +# endif + +# if __has_feature(cxx_auto_type) /* v2.7 */ +# define Z_COMPILER_HAS_CPP11_MULTI_DECLARATOR_AUTO 1 /* v2.7?, v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_TYPE_AUTO 1 /* v2.7?, v2.9 (S) */ + + /*-----------------------------------------------------------------. + | BUG: In v3.0 (and possibly earlier versions), using `auto` as a | + | storage class generates warnings in C++03 and earlier. This must | + | be tolerated to not break compatibility with existing software. | + '=================================================================*/ +# define Z_COMPILER_HAS_CPP11_REMOVAL_OF_AUTO_AS_STORAGE_CLASS 1 /* v2.7?, v2.9 (S) */ +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,0,0) +# if __cplusplus >= 201103L +# define Z_COMPILER_HAS_CPP11_MOVE_SPECIAL_MEMBER_FUNCTIONS 1 /* v3.0 (S-T) */ +# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_NON_STATIC_DATA_MEMBER 1 /* v3.0 (T), v3.1 (S) */ +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,1,0) +# if __cplusplus >= 201103L +# define Z_COMPILER_HAS_CPP11_UNIVERSAL_CHARACTER_NAME 1 /* v3.1 (S-T) */ + + /*------------------------------------------------------------. + | BUG: DR1206 14.5.1.4 Enumeration members of class templates | + | TODO: Read v3.9 release notes (related?) | + '============================================================*/ +# define Z_COMPILER_HAS_CPP11_OPAQUE_ENUMERATION_DECLARATION 1 /* v3.1 (N-S-T), v3.2 (N) */ +# endif + + /*-----------------------------------------------------------------------. + | BUG: Since v3.0, __has_feature(cxx_explicit_conversions) returns 1 in | + | C++11 and later, but this feature did not work properly until v3.1. | + '=======================================================================*/ +# if __has_feature(cxx_explicit_conversions) /* v3.0 */ +# define Z_COMPILER_HAS_CPP11_EXPLICIT_CONVERSION_OPERATOR 1 /* v3.0 (S), v3.1 (T) */ +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,2,0) && __cplusplus >= 201103L +# define Z_COMPILER_HAS_CPP11_STD_LAYOUT 1 /* v3.0 (S), v3.2? (T!?) *//* TODO: More tests. */ +# endif +# endif +# endif +# endif + +# if __has_feature(cxx_local_type_template_args) /* v3.1 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && __cplusplus >= 201103L) || \ + (Z_COMPILER_VERSION == Z_VERSION(2,9,0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) + +# define Z_COMPILER_HAS_CPP11_ANONYMOUS_TYPE_AS_TEMPLATE_ARGUMENT 1 /* v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_LOCAL_TYPE_AS_TEMPLATE_ARGUMENT 1 /* v2.9 (S) */ +# endif + +# if (defined(__cpp_initializer_lists) && __cpp_initializer_lists >= 200806L) /* v3.6 */ || \ + __has_feature(cxx_generalized_initializers) /* v3.1 */ + +# define Z_COMPILER_HAS_CPP11_COPY_LIST_INITIALIZATION 1 /* v3.1 (N-S-T) */ +# define Z_COMPILER_HAS_CPP11_DIRECT_LIST_INITIALIZATION 1 /* v3.1 (N-S-T) */ +# define Z_COMPILER_HAS_CPP11_INITIALIZER_LIST 1 /* v3.1 (N-S-T) [No library support until v3.3?] */ +# endif + +# if (defined(__cpp_nsdmi) && (__cpp_nsdmi >= 200809L)) /* v3.6 */ || \ + __has_feature(cxx_nonstatic_member_init) /* v3.0 */ + +# define Z_COMPILER_HAS_CPP11_DEFAULT_MEMBER_INITIALIZER 1 /* v3.0 (N-S-T) */ +# endif + +# if __has_feature(cxx_default_function_template_args) /* v2.9 */ +# define Z_COMPILER_HAS_CPP11_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE 1 /* v2.9 (S) */ +# endif + +# if (defined(__cpp_delegating_constructors) && __cpp_delegating_constructors >= 200604L) /* v3.6 */ || \ + __has_feature(cxx_delegating_constructors) /* v3.0 */ + +# define Z_COMPILER_HAS_CPP11_DELEGATING_CONSTRUCTORS 1 /* v3.0 (N-S-T) */ +# endif + +# if __has_feature(cxx_deleted_functions) /* v2.7 */ +# define Z_COMPILER_HAS_CPP11_DELETED_FUNCTION 1 /* v2.6 (S), v2.9 (S) */ +# endif + +# if __has_feature(cxx_defaulted_functions) /* v3.1 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP11_EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION 1 /* v3.0 (N-S-T) */ +# endif + +# if (defined(__cpp_variadic_templates) && __cpp_variadic_templates >= 200704L) /* v3.4 */ || \ + __has_feature(cxx_variadic_templates) /* v2.9 */ + +# define Z_COMPILER_HAS_CPP11_EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS 1 /* v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_VARIADIC_TEMPLATE 1 /* v2.9 (N-S) */ +# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_PARAMETER_PACK 1 /* v2.9 (S) */ +# endif + +# if __has_feature(cxx_strong_enums) /* v2.9 */ +# define Z_COMPILER_HAS_CPP11_FIXED_ENUMERATION 1 /* v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_SCOPED_ENUMERATION 1 /* v2.9 (S) */ +# endif + + /*-----------------------------------------------------------------------. + | NOTE: Inheriting constructors seem to work in v3.0 (but not in v3.1 or | + | v3.2). However, since the implementation of that version is perhaps | + | unstable, Z only detects this feature using the appropriate macros. | + '=======================================================================*/ +# if (defined(__cpp_inheriting_constructors) && __cpp_inheriting_constructors >= 200802L) /* v3.6 */ || \ + __has_feature(cxx_inheriting_constructors) /* v3.3 */ + +# define Z_COMPILER_HAS_CPP11_INHERITING_CONSTRUCTORS 1 /* v3.3 (N-S-T) */ +# endif + + /*------------------------------------------------------. + | NOTE: According to Clang's sources, inline namespaces | + | seem to be implemented since v2.8. | + '======================================================*/ +# if __has_feature(cxx_inline_namespaces) /* v2.8 */ +# define Z_COMPILER_HAS_CPP11_INLINE_NAMESPACE 1 /* v2.9 (S) */ +# endif + +# if (defined(__cpp_lambdas) && __cpp_lambdas >= 200907L) /* v3.4 */ || \ + __has_feature(cxx_lambdas) /* v3.1 */ + +# define Z_COMPILER_HAS_CPP11_LAMBDA 1 /* v3.1 (N-S-T) */ +# endif + +# if (defined(__cpp_range_based_for) && __cpp_range_based_for >= 200907L) /* v3.6 */ || \ + __has_feature(cxx_range_for) /* v3.0 */ + +# define Z_COMPILER_HAS_CPP11_RANGE_BASED_FOR 1 /* v3.0 (N-S-T) */ +# endif + +# if (defined(__cpp_ref_qualifiers) && __cpp_ref_qualifiers >= 200710L) /* v3.6 */ || \ + __has_feature(cxx_reference_qualified_functions) /* v2.9 */ + +# define Z_COMPILER_HAS_CPP11_REFERENCE_QUALIFIED_NON_STATIC_MEMBER_FUNCTION 1 /* v2.9 (N-S) */ +# endif + +# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) +# define Z_COMPILER_HAS_CPP11_RIGHT_ANGLE_BRACKETS 1 /* v2.6 (S), v2.9 (S) */ +# define Z_COMPILER_HAS_CPP11_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 /* v2.6? */ +# endif + +# if (defined(__cpp_rvalue_references) && __cpp_rvalue_references >= 200610L) /* v3.4 */ || \ + __has_feature(cxx_rvalue_references) /* v2.9 */ + +# define Z_COMPILER_HAS_CPP11_RVALUE_REFERENCE 1 /* v2.9 (N-S) */ +# endif + + /*----------------------------------------------------------------------------. + | NOTE: According to Clang's documentation, the standardized attribute syntax | + | was added in v3.3, but this feature seems to have been present since v2.7. | + | The [[carries_dependency]] attribute is recognized but has no effect, and | + | its use within a parameter-declaration did not fully conform to the C++11 | + | standard until v3.1. | + '============================================================================*/ +# if (defined(__cpp_attributes) && __cpp_attributes >= 200809L) /* v3.4 */ || \ + __has_feature(cxx_attributes) /* v2.7 */ + +# define Z_COMPILER_HAS_CPP11_STANDARDIZED_ATTRIBUTE_SYNTAX 1 /* v2.7?, v3.3 (N-S) */ +# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_NORETURN 1 /* v2.7?, v3.3 (N-S) */ + +# if Z_COMPILER_VERSION >= Z_VERSION(3,1,0) +# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_CARRIES_DEPENDENCY 1 /* v3.1 (T), v3.3 (N-S) */ +# endif +# endif + + /*-----------------------------------------------------------------------------. + | NOTE: Since v9.0, static assertions compile without warnings in any version | + | of C++ when the MSVC compatibility mode is enabled. However, Z only detects | + | this feature using the appropriate macros, as this behaviour could change in | + | future versions of Clang. | + '=============================================================================*/ +# if (defined(__cpp_static_assert) && __cpp_static_assert >= 200410L) /* v3.4 */ || \ + __has_feature(cxx_static_assert) /* v2.7 */ + +# define Z_COMPILER_HAS_CPP11_STATIC_ASSERTION 1 /* v2.6 (S), v2.9 (S) */ +# endif + + /*-----------------------------------------------------------------------------. + | IMPORTANT: + '=============================================================================*/ +# if defined(__cpp_threadsafe_static_init) && __cpp_threadsafe_static_init >= 200806L /* v5.0 */ +# define Z_COMPILER_HAS_CPP11_THREAD_SAFE_STATIC_INITIALIZATION 1 /* v2.6?, v2.9 (S*) */ +# endif + +# if __has_feature(cxx_trailing_return) /* v2.9 */ +# define Z_COMPILER_HAS_CPP11_TRAILING_RETURN_TYPE 1 /* v2.9 (S) */ +# endif + +# if (defined(__cpp_alias_templates) && __cpp_alias_templates >= 200704L) /* v3.6 */ || \ + __has_feature(cxx_alias_templates) /* v3.0 */ + +# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS 1 /* v3.0 (N-S-T) */ +# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS_TEMPLATE 1 /* v3.0 (N-S-T) */ +# endif + +# if __has_feature(cxx_unrestricted_unions) /* v3.1 */ +# define Z_COMPILER_HAS_CPP11_UNRESTRICTED_UNION 1 /* v3.0 (T?), v3.1 (N-S) *//* TODO: More tests. */ +# endif + +# if __has_feature(cxx_nullptr) /* v3.0 */ +# define Z_COMPILER_HAS_CPP11_LITERAL_NULLPTR 1 /* v3.0 (N-S-T) */ +# endif + +# if (defined(__cpp_raw_strings) && __cpp_raw_strings >= 200710L) /* v3.4 */ || \ + __has_feature(cxx_raw_string_literals) /* v3.1 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP11_LITERAL_RAW_STRING 1 /* v3.0 (N-S-T) */ +# endif + +# if (defined(__cpp_user_defined_literals) && __cpp_user_defined_literals >= 200809L) /* v3.4 */ || \ + __has_feature(cxx_user_literals) /* v3.1 */ + +# define Z_COMPILER_HAS_CPP11_LITERAL_USER_DEFINED 1 /* v3.1 (N-S-T) */ +# endif + +# if (defined(__cpp_unicode_literals) && __cpp_unicode_literals >= 200710L) /* v3.4 */ || \ + __has_feature(cxx_unicode_literals) /* v3.1 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,0,0) && __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP11_LITERAL_UTF8_STRING 1 /* v3.0 (N-S-T) */ +# endif + +# if __has_feature(cxx_alignof) /* v3.6 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,0,0) && \ + Z_COMPILER_VERSION < Z_VERSION(3,6,0) && \ + __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP11_OPERATOR_ALIGNOF 1 /* v3.0 (N-S-T), v3.3 (S) */ +# endif + +# if __has_feature(cxx_noexcept) /* v3.0 */ +# define Z_COMPILER_HAS_CPP11_OPERATOR_NOEXCEPT 1 /* v2.9 (S), v3.0 (N-S) */ +# define Z_COMPILER_HAS_CPP11_SPECIFIER_NOEXCEPT 1 /* v2.9 (S), v3.0 (N-S) */ +# endif + +# if __has_feature(cxx_alignas) /* v3.0 */ +# define Z_COMPILER_HAS_CPP11_SPECIFIER_ALIGNAS 1 /* v3.0 (N-S-T), v3.3 (N-S) */ +# endif + +# if (defined(__cpp_constexpr) && __cpp_constexpr >= 200704L) /* v3.4 */ || \ + __has_feature(cxx_constexpr) /* v3.1 */ + +# define Z_COMPILER_HAS_CPP11_SPECIFIER_CONSTEXPR 1 /* v3.1 (N-S-T) */ +# endif + +# if (defined(__cpp_decltype) && __cpp_decltype >= 200707L) /* v3.4 */ || \ + __has_feature(cxx_decltype) /* v2.7 */ + +# define Z_COMPILER_HAS_CPP11_SPECIFIER_DECLTYPE 1 /* v2.6 (S), v2.9 (S) */ +# endif + +# if __has_feature(cxx_override_control) /* v3.0 */ +# define Z_COMPILER_HAS_CPP11_SPECIFIER_FINAL 1 /* v3.0 (S-T) */ +# define Z_COMPILER_HAS_CPP11_SPECIFIER_OVERRIDE 1 /* v3.0 (N-S-T) */ +# endif + +# if __has_feature(cxx_decltype_incomplete_return_types) /* v3.1 */ +# define Z_COMPILER_HAS_CPP11_SPECIFIER_CASE_DECLTYPE_INCOMPLETE_RETURN_TYPE 1 /* v3.1 (S-T) */ +# endif + + /*-------------------------------------------------------. + | IMPORTANT: thread_local support requires a C++ runtime | + | library providing the __cxa_thread_atexit function. | + '=======================================================*/ +# if __has_feature(cxx_thread_local) /* v3.3 */ +# define Z_COMPILER_HAS_CPP11_STORAGE_CLASS_THREAD_LOCAL 1 /* v3.3 (N-S-T) */ +# endif + +# if (defined(__cpp_unicode_characters) && __cpp_unicode_characters >= 200704L) /* v3.4 */ || \ + (Z_COMPILER_VERSION < Z_VERSION(3,4,0) && __cplusplus >= 201103L) + + // TODO: Fails with -fms-compatibility on Apple Clang (Z_z_HAS_MSVC_COMPATIBILITY) +# if !Z_z_HAS_MSVC_COMPATIBILITY +# define Z_COMPILER_HAS_CPP11_TYPE_CHAR16_T 1 /* v2.9 (S), v3.0 (N) */ +# define Z_COMPILER_HAS_CPP11_TYPE_CHAR32_T 1 /* v2.9 (S), v3.0 (N) */ +# endif +# endif + + /* MARK: - Language: C++14 */ + +# if (defined(__cpp_digit_separators) && __cpp_digit_separators >= 201309L) /* v3.6 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,4,0) && \ + Z_COMPILER_VERSION < Z_VERSION(3,6,0) && \ + __cplusplus >= 201305L) + +# define Z_COMPILER_HAS_CPP14_APOSTROPHE_AS_DIGIT_SEPARATOR 1 /* v3.4 (N-S-T) */ +# endif + +# if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_relaxed_constexpr) /* v3.4 */ + +# define Z_COMPILER_HAS_CPP14_CONSTEXPR_FUNCTION 1 /* v3.4 (N-S-T) */ +# endif + +# if __has_feature(cxx_contextual_conversions) /* v3.4 */ +# define Z_COMPILER_HAS_CPP14_CONTEXTUAL_CONVERSION 1 /* v3.4 (S-T) */ +# endif + +# if (defined(__cpp_aggregate_nsdmi) && __cpp_aggregate_nsdmi >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_aggregate_nsdmi) /* v3.3 */ + +# define Z_COMPILER_HAS_CPP14_DEFAULT_MEMBER_INITIALIZER_FOR_AGGREGATE 1 /* v3.3 (N-S-T) */ +# endif + +# if (defined(__cpp_generic_lambdas) && __cpp_generic_lambdas >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_generic_lambdas) /* v3.5 */ + +# define Z_COMPILER_HAS_CPP14_GENERIC_LAMBDA 1 /* v3.4 (N-S-T) */ +# endif + +# if (defined(__cpp_init_captures) && __cpp_init_captures >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_init_captures) /* v3.4 */ + +# define Z_COMPILER_HAS_CPP14_INITIALIZED_LAMBDA_CAPTURE 1 /* v3.4 (N-S-T) */ +# endif + + /*-------------------------------------------------------------. + | NOTE: Based on testing, the return type deduction for normal | + | functions seems to work in v3.3, but the documentation for | + | that version specifies that the implementation is partial. | + '=============================================================*/ +# if (defined(__cpp_return_type_deduction) && __cpp_return_type_deduction >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_return_type_deduction) /* v3.4 *//* || \ + (Z_COMPILER_VERSION == Z_VERSION(3,3,0) && __cplusplus >= 201305L)*/ + +# define Z_COMPILER_HAS_CPP14_RETURN_TYPE_DEDUCTION_FOR_NORMAL_FUNCTION 1 /* v3.3 (T?), v3.4 (N-S-T) */ +# endif + + /*---------------------------------------------------------------------. + | IMPORTANT: In v3.7 and later, sized deallocation is only enabled if | + | the user passes the -fsized-deallocation flag. The user must supply | + | definitions of the sized deallocation functions, either by providing | + | them explicitly or by using a C++ standard library that does. | + '=====================================================================*/ +# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L /* v3.6 */ +# define Z_COMPILER_HAS_CPP14_SIZED_DEALLOCATION 1 /* v3.4 (N-S) *//* TODO: Test. */ +# endif + + /*----------------------------------------------------------------------. + | BUG: Variable templates may produce warnings between v3.4 and v3.4.2. | + | e.g.: | + '======================================================================*/ +# if Z_COMPILER_VERSION >= Z_VERSION(3,5,0) && \ + ((defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_variable_templates)) /* v3.4 */ + +# define Z_COMPILER_HAS_CPP14_VARIABLE_TEMPLATE 1 /* v3.4 (N-S-Tw), v3.5 (T!) */ +# endif + + /*----------------------------------------------------------------------------. + | BUG: Since v3.6, __has_cpp_attribute(deprecated) is >= 201309L in C++11 and | + | later, but starting from v3.7 [[deprecated]] generates warnings in C++11. | + | [[deprecated]] compiles without warnings in C++11 between v3.4 and v3.6.2. | + '============================================================================*/ +# if (Z_z_HAS_CPP_ATTRIBUTE(deprecated) >= 201309L /* v3.6 */ && __cplusplus >= 201402L) || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,4,0) && \ + Z_COMPILER_VERSION <= Z_VERSION(3,6,2) && \ + __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP14_ATTRIBUTE_DEPRECATED 1 /* v3.4 (N-S-T) */ +# endif + +# if (defined(__cpp_binary_literals) && __cpp_binary_literals >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_binary_literals) /* v3.3 */ + +# define Z_COMPILER_HAS_CPP14_LITERAL_BINARY_INTEGRAL 1 /* v2.9 (S), v3.3 (N-T!) */ +# endif + +# if (defined(__cpp_decltype_auto) && __cpp_decltype_auto >= 201304L) /* v3.4 */ || \ + __has_feature(cxx_decltype_auto) /* v3.5 */ || \ + (Z_COMPILER_VERSION == Z_VERSION(3,3,0) && __cplusplus >= 201305L) + +# define Z_COMPILER_HAS_CPP14_SPECIFIER_CASE_DECLTYPE_AUTO 1 /* v3.3 (N-S-T) */ +# endif + + /* MARK: - Language: C++17 */ + +# if __cplusplus >= 201103L +# if Z_COMPILER_VERSION >= Z_VERSION(3,8,0) +# define Z_COMPILER_HAS_CPP17_AUTO_DEDUCTION_FROM_LIST_INITIALIZATION 1 /* v3.8 (S-T) */ +# endif + +# if __cplusplus >= 201406L +# if Z_COMPILER_VERSION >= Z_VERSION(3,5,0) +# define Z_COMPILER_HAS_CPP17_TYPENAME_IN_TEMPLATE_TEMPLATE_PARAMETER 1 /* v3.5 (N-S-T) */ + +# if Z_COMPILER_VERSION >= Z_VERSION(3,6,0) +# define Z_COMPILER_HAS_CPP17_LITERAL_UTF8_CHARACTER 1 /* v3.6 (N-S-T) */ + +# if Z_COMPILER_VERSION >= Z_VERSION(3,9,0) +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_USING_PREFIX 1 /* v3.9 (S-T) */ +# define Z_COMPILER_HAS_CPP17_DIRECT_LIST_INITIALIZATION_FOR_FIXED_ENUMERATION 1 /* v3.9 (N-S-T) */ + + /*-----------------------------------------------------------------. + | NOTE: In v3.9 and v3.9.1, selection statements with initializer | + | do not seem to generate warnings in any version of C++. However, | + | Z only recognizes these features in C++17 and later. | + '=================================================================*/ +# define Z_COMPILER_HAS_CPP17_IF_WITH_INITIALIZER 1 /* v3.9 (S-T) */ +# define Z_COMPILER_HAS_CPP17_SWITCH_WITH_INITIALIZER 1 /* v3.9 (S-T) */ + +# if Z_COMPILER_VERSION >= Z_VERSION(4,0,0) +# define Z_COMPILER_HAS_CPP17_EXPRESSION_EVALUATION_ORDER 1 /* v4.0 (S) *//* TODO: Test. */ +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_DYNAMIC_EXCEPTION_SPECIFICATION 1 /* v4.0 (S-T) */ +# endif +# endif +# endif +# endif + +# if Z_z_HAS_CPP_ATTRIBUTE(fallthrough) >= 201603L /* v3.9 */ +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_FALLTHROUGH 1 /* v3.9 (N-S-T) */ +# endif + +# if Z_z_HAS_CPP_ATTRIBUTE(maybe_unused) >= 201603L /* v3.9 */ +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_MAYBE_UNUSED 1 /* v3.9 (N-S-T) */ +# endif + +# if Z_z_HAS_CPP_ATTRIBUTE(nodiscard) >= 201603L /* v3.9 */ +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_NODISCARD 1 /* v3.9 (N-S-T) */ +# endif +# endif +# endif + +# if (defined(__cpp_aggregate_bases) && __cpp_aggregate_bases >= 201603L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_AGGREGATE_INITIALIZATION_FOR_DERIVED_CLASS 1 /* v3.9 (N-S-T) */ +# endif + + /*---------------------------------------------------------------. + | NOTE: Attributes for enumerators and namespaces do not seem to | + | generate warnings in C++11 and C++14 between v3.6 and v5.0.2. | + | However, Z only recognizes these features in C++17 and later. | + '===============================================================*/ +# if (defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,6,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_ENUMERATOR 1 /* v3.6 (N-S-T) */ +# endif + +# if (defined(__cpp_namespace_attributes) && __cpp_namespace_attributes >= 201411L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,6,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_NAMESPACE 1 /* v3.6 (N-S-T) */ +# endif + +# if (defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_CONSTEXPR_IF 1 /* v3.9 (S-T) */ +# endif + +# if defined(__cpp_constexpr) && __cpp_constexpr >= 201603L /* v5.0 */ +# define Z_COMPILER_HAS_CPP17_CONSTEXPR_LAMBDA 1 /* v5.0 (S-T) */ +# endif + +# if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201703L /* TODO: Investigate macro value. */ +# define Z_COMPILER_HAS_CPP17_DEDUCTION_GUIDES_FOR_CLASS_TEMPLATE 1 /* TODO: Investigate acceptable version. */ +# endif + +# if (defined(__cpp_range_based_for) && __cpp_range_based_for >= 201603L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_DIFFERING_BEGIN_AND_END_TYPES_IN_RANGE_BASED_FOR 1 /* v3.9 (N-S-T) */ +# endif + +# if defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201411L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_FOLD_EXPRESSION 1 /* v3.6 (N-S) */ + +# if __cpp_fold_expressions >= 201603L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_SAFE_UNARY_FOLD_EXPRESSION 1 /* v3.9 (N-S) */ +# endif +# endif + +# if (defined(__cpp_guaranteed_copy_elision) && __cpp_guaranteed_copy_elision >= 201606L) /* v7.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(4,0,0) && \ + Z_COMPILER_VERSION < Z_VERSION(7,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_GUARANTEED_COPY_ELISION 1 /* v4.0 (S) *//* TODO: Test. */ +# endif + +# if (defined(__cpp_inheriting_constructors) && __cpp_inheriting_constructors >= 201511L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201103L) + +# define Z_COMPILER_HAS_CPP17_INHERITING_CONSTRUCTORS 1 /* v3.9 (S-T) */ +# endif + +# if (defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_INLINE_VARIABLE 1 /* v3.9 (S-T) */ +# endif + +# if (defined(__cpp_capture_star_this) && __cpp_capture_star_this >= 201603L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,9,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_LAMBDA_CAPTURE_OF_STAR_THIS_BY_VALUE 1 /* v3.9 (N-S-T) */ +# endif + +# if (defined(__cpp_nested_namespace_definitions) && __cpp_nested_namespace_definitions >= 201411L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,6,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_NESTED_NAMESPACE_DEFINITION 1 /* v3.6 (N-S-T) */ +# endif + +# if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_NOEXCEPT_AS_PART_OF_THE_FUNCTION_TYPE 1 /* v4.0 (S-T) */ +# endif + + /*------------------------------------------------------------------. + | NOTE: According to Clang's documentation, constant evaluation for | + | all non-type template arguments was added in v3.6, but tests show | + | that non-generic lambdas with no lambda-capture (i.e. convertible | + | to pointer to function with external linkage) were not accepted | + | as non-type template arguments until v4.0. | + '==================================================================*/ +# if defined(__cpp_nontype_template_args) && __cpp_nontype_template_args >= 201411L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_ARGUMENTS 1 /* v3.6 (N-S), v4.0 (T) */ +# endif + +# if (defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L) /* v7.0 */ || \ + (defined(__cpp_template_auto ) && __cpp_template_auto >= 201606L) /* v4.0 */ + +# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_PARAMETER_WITH_AUTO_TYPE 1 /* v4.0 (S-T) */ +# endif + +# if defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_OVER_ALIGNED_DYNAMIC_MEMORY_ALLOCATION 1 /* v4.0 (S) *//* TODO: Test. */ +# endif + +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_BOOL_INCREMENT 1 /* v3.8 (S-Tr) */ + +# ifndef Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_REGISTER_AS_STORAGE_CLASS 1 /* v3.8 (S-Tr) */ +# endif + +# ifndef Z_COMPILER_HAS_C89_TRIGRAPHS +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_TRIGRAPHS 1 /* v3.5 (N-S-Tr) */ +# endif + +# if (defined(__cpp_static_assert) && __cpp_static_assert >= 201411L) /* v4.0 */ || \ + (Z_COMPILER_VERSION >= Z_VERSION(3,5,0) && \ + Z_COMPILER_VERSION < Z_VERSION(4,0,0) && \ + __cplusplus >= 201406L) + +# define Z_COMPILER_HAS_CPP17_STATIC_ASSERTION_WITH_NO_MESSAGE 1 /* v3.5 (N-S-T) */ +# endif + +# if defined(__cpp_structured_bindings) && __cpp_structured_bindings >= 201606L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_STRUCTURED_BINDING 1 /* v4.0 (S) */ +# endif + +# if defined(__cpp_template_template_args) && __cpp_template_template_args >= 201611L /* v7.0 */ +# define Z_COMPILER_HAS_CPP17_TEMPLATE_TEMPLATE_ARGUMENT_MATCHING 1 +# endif + +# if defined(__cpp_variadic_using) && __cpp_variadic_using >= 201611L /* v4.0 */ +# define Z_COMPILER_HAS_CPP17_VARIADIC_USING 1 /* v4.0 (S-T) */ +# endif + +# ifdef Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT +# define Z_COMPILER_HAS_CPP17_LITERAL_HEXADECIMAL_FLOATING_POINT 1 /* v3.9 (T!) */ +# endif + +# ifdef Z_COMPILER_HAS_CLANG_C_PREPROCESSOR_OPERATOR_HAS_INCLUDE +# define Z_COMPILER_HAS_CPP17_PREPROCESSOR_OPERATOR_HAS_INCLUDE 1 /* v2.7 */ +# endif + +/*# define Z_COMPILER_HAS_CPP17_IGNORING_OF_UNKNOWN_ATTRIBUTES*/ /* Always generate warnings. */ + +#endif + +/* MARK: - Language: Implementation-defined */ + +#if (~0 >> 1) == ~0 +# define Z_COMPILER_HAS_ARITHMETIC_RIGHT_SHIFT 1 +#endif + +/* MARK: - Non-standard language: Attributes */ + +#if __has_attribute(alias) +# define Z_COMPILER_ATTRIBUTE_ALIAS(name) __attribute__((alias(name))) /* v2.6 */ +#endif + +#if __has_attribute(dllexport) +# define Z_COMPILER_ATTRIBUTE_API_EXPORT __declspec(dllexport) /* v2.6 */ +#endif + +#if __has_attribute(dllimport) +# define Z_COMPILER_ATTRIBUTE_API_IMPORT __declspec(dllimport) /* v2.6 */ +#endif + +#if __has_attribute(stdcall) +# define Z_COMPILER_ATTRIBUTE_MICROSOFT_STD_CALL __attribute__((stdcall)) /* TODO */ +#endif + +#if __has_attribute(always_inline) +# define Z_COMPILER_ATTRIBUTE_ALWAYS_INLINE __inline__ __attribute__((always_inline)) /* v2.6 */ +# define Z_COMPILER_ATTRIBUTE_INLINE __inline__ __attribute__((always_inline)) /* v2.6 */ +#else +# define Z_COMPILER_ATTRIBUTE_INLINE __inline__ /* v2.6 */ +#endif + +#if __has_attribute(noreturn) +# define Z_COMPILER_ATTRIBUTE_NO_RETURN __attribute__((noreturn)) /* v2.6 */ +#endif + +#if __has_attribute(sentinel) +# define Z_COMPILER_ATTRIBUTE_NULL_TERMINATED __attribute__((sentinel)) /* v2.6 */ +#endif + +#if __has_attribute(visibility) +# define Z_COMPILER_ATTRIBUTE_PRIVATE __attribute__((visibility("hidden"))) /* v2.6 */ +# define Z_COMPILER_ATTRIBUTE_PUBLIC __attribute__((visibility("default"))) /* v2.6 */ +#endif + +#if __has_extension(tls) +# define Z_COMPILER_ATTRIBUTE_THREAD_LOCAL __thread /* v2.6 */ +#endif + +#if __has_attribute(weak) +# define Z_COMPILER_ATTRIBUTE_WEAK __attribute__((weak)) /* v2.6 */ +#endif + +/*#define Z_COMPILER_ATTRIBUTE_EBCO*/ +/*#define Z_COMPILER_ATTRIBUTE_API_WEAK_EXPORT*/ + +/* MARK: - Non-standard language: Structure padding */ + +#if __has_attribute(packed) /* v2.6 */ +# define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE __attribute__((packed)) +# define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE __attribute__((packed)) +# define Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY __attribute__((packed)) +# define Z_COMPILER_PACKED_UNION_AFTER_BODY __attribute__((packed)) +#endif + +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_BODY*/ + +/* MARK: - Built-ins: Types and literal suffixes */ + +#ifdef __UINT8_TYPE__ +# define Z_COMPILER_TYPE_UINT8 __typeof(__extension__ (__UINT8_TYPE__)1) +#endif + +#ifdef __INT8_TYPE__ /* v2.6 */ +# define Z_COMPILER_TYPE_SINT8 __typeof(__extension__ (__INT8_TYPE__)1) + +# ifndef __UINT8_TYPE__ +# define Z_COMPILER_TYPE_UINT8 __typeof(__extension__ (unsigned __INT8_TYPE__)1) +# endif +#endif + +#ifdef __UINT16_TYPE__ +# define Z_COMPILER_TYPE_UINT16 __typeof(__extension__ (__UINT16_TYPE__)1) +#endif + +#ifdef __INT16_TYPE__ /* v2.6 */ +# define Z_COMPILER_TYPE_SINT16 __typeof(__extension__ (__INT16_TYPE__)1) + +# ifndef __UINT16_TYPE__ +# define Z_COMPILER_TYPE_UINT16 __typeof(__extension__ (unsigned __INT16_TYPE__)1) +# endif +#endif + +#ifdef __UINT32_TYPE__ +# define Z_COMPILER_TYPE_UINT32 __typeof(__extension__ (__UINT32_TYPE__)1) +#endif + +#ifdef __INT32_TYPE__ /* v2.6 */ +# define Z_COMPILER_TYPE_SINT32 __typeof(__extension__ (__INT32_TYPE__)1) + +# ifndef __UINT32_TYPE__ +# define Z_COMPILER_TYPE_UINT32 __typeof(__extension__ (unsigned __INT32_TYPE__)1) +# endif +#endif + +#ifdef __UINT64_TYPE__ +# define Z_COMPILER_TYPE_UINT64 __typeof(__extension__ (__UINT64_TYPE__)1) +#endif + +#ifdef __INT64_TYPE__ /* v2.6 */ +# define Z_COMPILER_TYPE_SINT64 __typeof(__extension__ (__INT64_TYPE__)1) + +# ifndef __UINT64_TYPE__ +# define Z_COMPILER_TYPE_UINT64 __typeof(__extension__ (unsigned __INT64_TYPE__)1) +# endif +#endif + +#ifdef __SIZEOF_INT128__ /* v3.3 */ +# define Z_COMPILER_TYPE_UINT128 __uint128_t /* v2.6 */ +# define Z_COMPILER_TYPE_SINT128 __int128_t /* v2.6 */ +#endif + +#define Z_COMPILER_TYPE_VAL __builtin_va_list /* v2.6 */ + +#ifdef __UINT16_C_SUFFIX__ /* v3.5 */ +# define Z_COMPILER_LITERAL_UINT16(number) (__extension__ Z_JOIN_2(number, __UINT16_C_SUFFIX__)) +#endif + +#ifdef __INT16_C_SUFFIX__ /* v3.5 */ +# define Z_COMPILER_LITERAL_SINT16(number) (__extension__ Z_JOIN_2(number, __INT16_C_SUFFIX__)) +#endif + +#ifdef __UINT32_C_SUFFIX__ /* v3.5 */ +# define Z_COMPILER_LITERAL_UINT32(number) (__extension__ Z_JOIN_2(number, __UINT32_C_SUFFIX__)) +#endif + +#ifdef __INT32_C_SUFFIX__ /* v3.5 */ +# define Z_COMPILER_LITERAL_SINT32(number) (__extension__ Z_JOIN_2(number, __INT32_C_SUFFIX__)) +#endif + +#ifdef __UINT64_C_SUFFIX__ /* v3.5 */ +# define Z_COMPILER_LITERAL_UINT64(number) (__extension__ Z_JOIN_2(number, __UINT64_C_SUFFIX__)) +#endif + +#ifdef __INT64_C_SUFFIX__ /* v2.7 */ +# define Z_COMPILER_LITERAL_SINT64(number) (__extension__ Z_JOIN_2(number, __INT64_C_SUFFIX__)) + +# ifndef __UINT64_C_SUFFIX__ +# define Z_COMPILER_LITERAL_SINT64(number) (__extension__ Z_JOIN_2(Z_SUFFIX_U(number), __INT64_C_SUFFIX__)) +# endif +#endif + +/*#define Z_COMPILER_TYPE_UINT24*/ +/*#define Z_COMPILER_TYPE_SINT24*/ +/*#define Z_COMPILER_TYPE_UINT40*/ +/*#define Z_COMPILER_TYPE_SINT40*/ +/*#define Z_COMPILER_TYPE_UINT48*/ +/*#define Z_COMPILER_TYPE_SINT48*/ +/*#define Z_COMPILER_TYPE_UINT56*/ +/*#define Z_COMPILER_TYPE_SINT56*/ +/*#define Z_COMPILER_TYPE_BFP16*/ +/*#define Z_COMPILER_TYPE_BFP32*/ +/*#define Z_COMPILER_TYPE_BFP64*/ +/*#define Z_COMPILER_TYPE_BFP128*/ +/*#define Z_COMPILER_TYPE_DFP32*/ +/*#define Z_COMPILER_TYPE_DFP64*/ +/*#define Z_COMPILER_TYPE_DFP128*/ +/*#define Z_COMPILER_TYPE_X87_DE80*/ +/*#define Z_COMPILER_TYPE_X87_DE96*/ +/*#define Z_COMPILER_TYPE_X87_DE128*/ +/*#define Z_COMPILER_TYPE_IBM_ED*/ +/*#define Z_COMPILER_TYPE_BFLOAT16*/ +/*#define Z_COMPILER_LITERAL_UINT8(number)*/ +/*#define Z_COMPILER_LITERAL_SINT8(number)*/ +/*#define Z_COMPILER_LITERAL_UINT24(number)*/ +/*#define Z_COMPILER_LITERAL_SINT24(number)*/ +/*#define Z_COMPILER_LITERAL_UINT40(number)*/ +/*#define Z_COMPILER_LITERAL_SINT40(number)*/ +/*#define Z_COMPILER_LITERAL_UINT48(number)*/ +/*#define Z_COMPILER_LITERAL_SINT48(number)*/ +/*#define Z_COMPILER_LITERAL_UINT56(number)*/ +/*#define Z_COMPILER_LITERAL_SINT56(number)*/ +/*#define Z_COMPILER_LITERAL_UINT128(number)*/ +/*#define Z_COMPILER_LITERAL_SINT128(number)*/ +/*#define Z_COMPILER_LITERAL_BFP16(number)*/ +/*#define Z_COMPILER_LITERAL_BFP32(number)*/ +/*#define Z_COMPILER_LITERAL_BFP64(number)*/ +/*#define Z_COMPILER_LITERAL_BFP128(number)*/ +/*#define Z_COMPILER_LITERAL_DFP32(number)*/ +/*#define Z_COMPILER_LITERAL_DFP64(number)*/ +/*#define Z_COMPILER_LITERAL_DFP128(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE80(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE96(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE128(number)*/ +/*#define Z_COMPILER_LITERAL_IBM_ED(number)*/ +/*#define Z_COMPILER_LITERAL_BFLOAT16(number)*/ + +/* TODO */ +/*#ifdef __FLOAT128__*/ /* v3.9 */ +/*# define Z_COMPILER_TYPE_FLOAT128 __float128*/ /* v3.9 */ +/*#endif*/ + +/*#ifdef __ARM_FP16_FORMAT_IEEE +#endif*/ + +/* MARK: - Built-ins: Constants */ + +#ifdef __CHAR_BIT__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_CHAR_WIDTH __CHAR_BIT__ +#endif + +#ifdef __SCHAR_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SCHAR_MAXIMUM __SCHAR_MAX__ +#endif + +#if defined(__SIZEOF_SHORT__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_SHORT_SIZE __SIZEOF_SHORT__ +#elif defined(_EM_SSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_SHORT_SIZE _EM_SSIZE +#endif + +#ifdef __SHRT_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SSHORT_MAXIMUM __SHRT_MAX__ +#endif + +#if defined(__SIZEOF_INT__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_INT_SIZE __SIZEOF_INT__ +#elif defined(_EM_WSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_INT_SIZE _EM_WSIZE +#endif + +#ifdef _MIPS_SZINT /* v3.1 */ +# define Z_COMPILER_CONSTANT_INT_WIDTH _MIPS_SZINT +#endif + +#ifdef __INT_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SINT_MAXIMUM __INT_MAX__ +#endif + +#if defined(__SIZEOF_LONG__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_LONG_SIZE __SIZEOF_LONG__ +#elif defined(_EM_LSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_LONG_SIZE _EM_LSIZE +#endif + +#ifdef _MIPS_SZLONG /* v3.1 */ +# define Z_COMPILER_CONSTANT_LONG_WIDTH _MIPS_SZLONG +#endif + +#ifdef __LONG_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SLONG_MAXIMUM __LONG_MAX__ +#endif + +#ifdef __SIZEOF_LONG_LONG__ /* v2.8 */ +# define Z_COMPILER_CONSTANT_LLONG_SIZE __SIZEOF_LONG_LONG__ +#endif + +#ifdef __LONG_LONG_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SLLONG_MAXIMUM __LONG_LONG_MAX__ +#endif + +#ifdef __SIZEOF_WCHAR_T__ /* v2.8 */ +# define Z_COMPILER_CONSTANT_WCHAR_SIZE __SIZEOF_WCHAR_T__ +#endif + +#ifdef __WCHAR_WIDTH__ /* v2.7 */ +# define Z_COMPILER_CONSTANT_WCHAR_WIDTH __WCHAR_WIDTH__ +#endif + +#ifdef __WCHAR_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_WCHAR_MAXIMUM __WCHAR_MAX__ +#endif + +#ifdef __SIZEOF_SIZE_T__ /* v2.8 */ +# define Z_COMPILER_CONSTANT_SIZE_SIZE __SIZEOF_SIZE_T__ +#endif + +#ifdef __SIZE_WIDTH__ /* v2.7 */ +# define Z_COMPILER_CONSTANT_SIZE_WIDTH __SIZE_WIDTH__ +#endif + +#ifdef __SIZE_MAX__ /* v3.3 */ +# define Z_COMPILER_CONSTANT_USIZE_MAXIMUM __SIZE_MAX__ +#endif + +#ifdef __UINTMAX_WIDTH__ /* v3.5 */ +# define Z_COMPILER_CONSTANT_UINTMAX_WIDTH __UINTMAX_WIDTH__ +#endif + +#ifdef __UINTMAX_MAX__ /* v3.5 */ +# define Z_COMPILER_CONSTANT_UINTMAX_MAXIMUM __UINTMAX_MAX__ +#endif + +#ifdef __INTMAX_WIDTH__ /* v2.7 */ +# define Z_COMPILER_CONSTANT_SINTMAX_WIDTH __INTMAX_WIDTH__ +#endif + +#ifdef __INTMAX_MAX__ /* v2.6 */ +# define Z_COMPILER_CONSTANT_SINTMAX_MAXIMUM __INTMAX_MAX__ +#endif + +#ifdef __UINTPTR_WIDTH__ /* v3.5 */ +# define Z_COMPILER_CONSTANT_UINTPTR_WIDTH __UINTPTR_WIDTH__ +#endif + +#ifdef __UINTPTR_MAX__ /* v3.5 */ +# define Z_COMPILER_CONSTANT_UINTPTR_MAXIMUM __UINTPTR_MAX__ +#endif + +#ifdef __INTPTR_WIDTH__ /* v2.7 */ +# define Z_COMPILER_CONSTANT_SINTPTR_WIDTH __INTPTR_WIDTH__ +#endif + +#ifdef __INTPTR_MAX__ /* v3.5 */ +# define Z_COMPILER_CONSTANT_SINTPTR_MAXIMUM __INTPTR_MAX__ +#endif + +#if defined(__SIZEOF_FLOAT__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_FLOAT_SIZE __SIZEOF_FLOAT__ +#elif defined(_EM_FSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_FLOAT_SIZE _EM_FSIZE +#endif + +#if __has_builtin(__builtin_huge_valf) +# define Z_COMPILER_CONSTANT_FLOAT_HUGE __builtin_huge_valf() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_inff) +# define Z_COMPILER_CONSTANT_FLOAT_INFINITY __builtin_inff() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nanf) +# define Z_COMPILER_CONSTANT_FLOAT_QNAN __builtin_nanf("") /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nansf) +# define Z_COMPILER_CONSTANT_FLOAT_SNAN __builtin_nansf("") /* v2.6 */ +#endif + +#if defined(__SIZEOF_DOUBLE__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_DOUBLE_SIZE __SIZEOF_DOUBLE__ +#elif defined(_EM_DSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_DOUBLE_SIZE _EM_DSIZE +#endif + +#if __has_builtin(__builtin_huge_val) +# define Z_COMPILER_CONSTANT_DOUBLE_HUGE __builtin_huge_val() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_inf) +# define Z_COMPILER_CONSTANT_DOUBLE_INFINITY __builtin_inf() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nan) +# define Z_COMPILER_CONSTANT_DOUBLE_QNAN __builtin_nan("") /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nans) +# define Z_COMPILER_CONSTANT_DOUBLE_SNAN __builtin_nans("") /* v2.6 */ +#endif + +#ifdef __SIZEOF_LONG_DOUBLE__ /* v2.8 */ +# define Z_COMPILER_CONSTANT_LDOUBLE_SIZE __SIZEOF_LONG_DOUBLE__ +#endif + +#if __has_builtin(__builtin_huge_vall) +# define Z_COMPILER_CONSTANT_LDOUBLE_HUGE __builtin_huge_vall() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_infl) +# define Z_COMPILER_CONSTANT_LDOUBLE_INFINITY __builtin_infl() /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nanl) +# define Z_COMPILER_CONSTANT_LDOUBLE_QNAN __builtin_nanl("") /* v2.6 */ +#endif + +#if __has_builtin(__builtin_nansl) +# define Z_COMPILER_CONSTANT_LDOUBLE_SNAN __builtin_nansl("") /* v2.6 */ +#endif + +#if defined(__SIZEOF_POINTER__) /* v2.8 */ +# define Z_COMPILER_CONSTANT_POINTER_SIZE __SIZEOF_POINTER__ +#elif defined(_EM_PSIZE) /* v2.8 */ +# define Z_COMPILER_CONSTANT_POINTER_SIZE _EM_PSIZE +#endif + +#if defined(__POINTER_WIDTH__) /* v2.6 */ +# define Z_COMPILER_CONSTANT_POINTER_WIDTH __POINTER_WIDTH__ +#elif defined(_MIPS_SZPTR) /* v3.1 */ +# define Z_COMPILER_CONSTANT_POINTER_WIDTH _MIPS_SZPTR +#endif + +/*#define Z_COMPILER_CONSTANT_UCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SHORT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_USHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_ULONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_LLONG_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_ULLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_HUGE*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_QNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_SNAN*/ + +/* MARK: - Built-ins: Macros */ + +#if Z_COMPILER_VERSION >= Z_VERSION(3,1,0) && \ + Z_COMPILER_VERSION <= Z_VERSION(5,0,2) + + /* Multi-level: offsetof(Type, member.field.field); Fails in 3.0 */ +# pragma clang diagnostic ignored "-Wextended-offsetof" +#endif + +#define Z_COMPILER_MACRO_MEMBER_OFFSET(type, member) (__extension__ __builtin_offsetof(type, member)) /* v2.6 */ + + +#define Z_COMPILER_MACRO_VAL_INITIALIZE __builtin_va_start /* v2.6 */ +#define Z_COMPILER_MACRO_VAL_FINALIZE __builtin_va_end /* v2.6 */ +#define Z_COMPILER_MACRO_VAL_READ __builtin_va_arg /* v2.6 */ + +#if __has_builtin(__builtin_va_copy) +# define Z_COMPILER_MACRO_VAL_COPY(self, output) __builtin_va_copy(output, self) /* v2.6 */ +#endif + +/* MARK: - Built-ins: Functions */ + +#if __has_builtin(__sync_add_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_1 +#endif + +#if __has_builtin(__sync_and_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_AND_THEN_GET __sync_and_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_AND_THEN_GET __sync_and_and_fetch_1 +#endif + +#if __has_builtin(__sync_fetch_and_add_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_1 +#endif + +#if __has_builtin(__sync_fetch_and_and_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_AND __sync_fetch_and_and_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_AND __sync_fetch_and_and_1 +#endif + +#if __has_builtin(__sync_fetch_and_nand_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_1 +#endif + +#if __has_builtin(__sync_fetch_and_or_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_OR __sync_fetch_and_or_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_OR __sync_fetch_and_or_1 +#endif + +#if __has_builtin(__sync_val_compare_and_swap_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_1 +#endif + +#if __has_builtin(__sync_fetch_and_sub_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_1 +#endif + +#if __has_builtin(__sync_fetch_and_xor_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_1 +#endif + +#if __has_builtin(__sync_nand_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_1 +#endif + +#if __has_builtin(__sync_or_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_OR_THEN_GET __sync_or_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_OR_THEN_GET __sync_or_and_fetch_1 +#endif + +#if __has_builtin(__sync_bool_compare_and_swap_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_1 +#endif + +#if __has_builtin(__sync_sub_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_1 +#endif + +#if __has_builtin(__sync_xor_and_fetch_1) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_1 +#endif + +#if __has_builtin(__sync_add_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_2 +#endif + +#if __has_builtin(__sync_and_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_AND_THEN_GET __sync_and_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_AND_THEN_GET __sync_and_and_fetch_2 +#endif + +#if __has_builtin(__sync_fetch_and_add_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_2 +#endif + +#if __has_builtin(__sync_fetch_and_and_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_AND __sync_fetch_and_and_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_AND __sync_fetch_and_and_2 +#endif + +#if __has_builtin(__sync_fetch_and_nand_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_2 +#endif + +#if __has_builtin(__sync_fetch_and_or_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_OR __sync_fetch_and_or_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_OR __sync_fetch_and_or_2 +#endif + +#if __has_builtin(__sync_val_compare_and_swap_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_2 +#endif + +#if __has_builtin(__sync_fetch_and_sub_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_2 +#endif + +#if __has_builtin(__sync_fetch_and_xor_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_2 +#endif + +#if __has_builtin(__sync_nand_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_2 +#endif + +#if __has_builtin(__sync_or_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_OR_THEN_GET __sync_or_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_OR_THEN_GET __sync_or_and_fetch_2 +#endif + +#if __has_builtin(__sync_bool_compare_and_swap_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_2 +#endif + +#if __has_builtin(__sync_sub_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_2 +#endif + +#if __has_builtin(__sync_xor_and_fetch_2) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_2 +#endif + +#if __has_builtin(__sync_add_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_4 +#endif + +#if __has_builtin(__sync_and_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_AND_THEN_GET __sync_and_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_AND_THEN_GET __sync_and_and_fetch_4 +#endif + +#if __has_builtin(__sync_fetch_and_add_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_4 +#endif + +#if __has_builtin(__sync_fetch_and_and_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_AND __sync_fetch_and_and_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_AND __sync_fetch_and_and_4 +#endif + +#if __has_builtin(__sync_fetch_and_nand_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_4 +#endif + +#if __has_builtin(__sync_fetch_and_or_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_OR __sync_fetch_and_or_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_OR __sync_fetch_and_or_4 +#endif + +#if __has_builtin(__sync_val_compare_and_swap_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_4 +#endif + +#if __has_builtin(__sync_fetch_and_sub_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_4 +#endif + +#if __has_builtin(__sync_fetch_and_xor_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_4 +#endif + +#if __has_builtin(__sync_nand_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_4 +#endif + +#if __has_builtin(__sync_or_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_OR_THEN_GET __sync_or_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_OR_THEN_GET __sync_or_and_fetch_4 +#endif + +#if __has_builtin(__sync_bool_compare_and_swap_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_4 +#endif + +#if __has_builtin(__sync_sub_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_4 +#endif + +#if __has_builtin(__sync_xor_and_fetch_4) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_4 +#endif + +#if __has_builtin(__sync_add_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_8 +#endif + +#if __has_builtin(__sync_and_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_AND_THEN_GET __sync_and_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_AND_THEN_GET __sync_and_and_fetch_8 +#endif + +#if __has_builtin(__sync_fetch_and_add_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_8 +#endif + +#if __has_builtin(__sync_fetch_and_and_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_AND __sync_fetch_and_and_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_AND __sync_fetch_and_and_8 +#endif + +#if __has_builtin(__sync_fetch_and_nand_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_8 +#endif + +#if __has_builtin(__sync_fetch_and_or_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_OR __sync_fetch_and_or_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_OR __sync_fetch_and_or_8 +#endif + +#if __has_builtin(__sync_val_compare_and_swap_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_8 +#endif + +#if __has_builtin(__sync_fetch_and_sub_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_8 +#endif + +#if __has_builtin(__sync_fetch_and_xor_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_8 +#endif + +#if __has_builtin(__sync_nand_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_8 +#endif + +#if __has_builtin(__sync_or_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_OR_THEN_GET __sync_or_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_OR_THEN_GET __sync_or_and_fetch_8 +#endif + +#if __has_builtin(__sync_bool_compare_and_swap_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_8 +#endif + +#if __has_builtin(__sync_sub_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_8 +#endif + +#if __has_builtin(__sync_xor_and_fetch_8) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_8 +#endif + +#if __has_builtin(__sync_add_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_16 +#endif + +#if __has_builtin(__sync_and_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_AND_THEN_GET __sync_and_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_AND_THEN_GET __sync_and_and_fetch_16 +#endif + +#if __has_builtin(__sync_fetch_and_add_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_16 +#endif + +#if __has_builtin(__sync_fetch_and_and_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_AND __sync_fetch_and_and_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_AND __sync_fetch_and_and_16 +#endif + +#if __has_builtin(__sync_fetch_and_nand_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_16 +#endif + +#if __has_builtin(__sync_fetch_and_or_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_OR __sync_fetch_and_or_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_OR __sync_fetch_and_or_16 +#endif + +#if __has_builtin(__sync_val_compare_and_swap_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_16 +#endif + +#if __has_builtin(__sync_fetch_and_sub_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_16 +#endif + +#if __has_builtin(__sync_fetch_and_xor_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_16 +#endif + +#if __has_builtin(__sync_nand_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_16 +#endif + +#if __has_builtin(__sync_or_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_OR_THEN_GET __sync_or_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_OR_THEN_GET __sync_or_and_fetch_16 +#endif + +#if __has_builtin(__sync_bool_compare_and_swap_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_16 +#endif + +#if __has_builtin(__sync_sub_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_16 +#endif + +#if __has_builtin(__sync_xor_and_fetch_16) /* v2.6 */ +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_16 +#endif + +/* MARK: - Built-in traits */ + +/*__is_destructible (not correctly implemented? not available?) */ /* v3.5 (partially implemented), v3.8 (fully implemented) */ +/*__is_sealed*/ /* v3.4 */ +/*__is_trivially_destructible*/ /* v5.0 */ +/*__is_nothrow_destructible (not correctly implemented? not available?) */ /* v3.5 (partially implemented), v3.8 (fully implemented) */ +/*__has_nothrow_move_assign*/ /* v3.3 */ +/*__has_trivial_move_assign*/ /* v3.3 */ +/*__has_trivial_move_constructor*/ /* v3.3 */ +/*__has_unique_object_representations*/ /* v6.0 */ +/*__reference_binds_to_temporary*/ /* 7.0 */ +/*__is_lvalue_expr (operator? specifier?) */ /* v3.0 */ +/*__is_rvalue_expr (operator? specifier?) */ /* v3.0 */ +/*__is_arithmetic*/ /* v3.0 */ +/*__is_floating_point*/ /* v3.0 */ +/*__is_integral*/ /* v3.0 */ +/*__is_complete_type*/ /* v3.0 */ +/*__is_void*/ /* v3.0 */ +/*__is_array*/ /* v3.0 */ +/*__is_function*/ /* v3.0 */ +/*__is_reference*/ /* v3.0 */ +/*__is_lvalue_reference*/ /* v3.0 */ +/*__is_rvalue_reference*/ /* v3.0 */ +/*__is_fundamental*/ /* v3.0 */ +/*__is_object*/ /* v3.0 */ +/*__is_scalar*/ /* v3.0 */ +/*__is_compound*/ /* v3.0 */ +/*__is_pointer*/ /* v3.0 */ +/*__is_member_object_pointer*/ /* v3.0 */ +/*__is_member_function_pointer*/ /* v3.0 */ +/*__is_member_pointer*/ /* v3.0 */ +/*__is_const*/ /* v3.0 */ +/*__is_volatile*/ /* v3.0 */ +/*__is_signed*/ /* v3.0 */ +/*__is_unsigned*/ /* v3.0 */ +/*__is_same*/ /* v3.0 */ +/*__is_convertible (?) Embarcadero */ /* v3.0 */ +/*__array_rank*/ /* v3.0 */ +/*__array_extent*/ /* v3.0 */ +/*__builtin_omp_required_simd_align*/ /* v3.7 */ + + + +#ifdef __cplusplus + +# if __has_builtin(__type_pack_element) /* v3.9 */ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Weverything" +# define Z_COMPILER_TRAIT_SELECT_TYPE(I, ...) __type_pack_element /* v3.9 */ +# pragma clang diagnostic pop +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,5,0) +# define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE __is_nothrow_assignable /* v3.5 */ +# define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE __is_nothrow_constructible /* v3.5 */ + +# if Z_COMPILER_VERSION >= Z_VERSION(3,9,0) +# define Z_COMPILER_TRAIT_TYPE_IS_ASSIGNABLE __is_assignable /* v3.9 */ + +# if Z_COMPILER_VERSION >= Z_VERSION(5,0,0) +# define Z_COMPILER_TRAIT_TYPE_IS_AGGREGATE __is_aggregate /* v5.0 */ +# endif +# endif +# endif + +#endif + +#if Z_z_HAS_TRAIT(has_virtual_destructor) +# define Z_COMPILER_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR __has_virtual_destructor /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_abstract) +# define Z_COMPILER_TRAIT_TYPE_IS_ABSTRACT __is_abstract /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_base_of) +# define Z_COMPILER_TRAIT_TYPE_IS_BASE __is_base_of /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_constructible) +# define Z_COMPILER_TRAIT_TYPE_IS_CONSTRUCTIBLE __is_constructible /* v3.5 */ +#endif + +#if Z_z_HAS_TRAIT(is_convertible_to) +# define Z_COMPILER_TRAIT_TYPE_IS_CONVERTIBLE __is_convertible_to /* v2.9 */ +#endif + +#if Z_z_HAS_TRAIT(is_empty) +# define Z_COMPILER_TRAIT_TYPE_IS_EMPTY __is_empty /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_enum) +# define Z_COMPILER_TRAIT_TYPE_IS_ENUMERATION __is_enum /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_final) +# define Z_COMPILER_TRAIT_TYPE_IS_FINAL __is_final /* v3.1 */ +#endif + +#if Z_z_HAS_TRAIT(is_interface_class) +# define Z_COMPILER_TRAIT_TYPE_IS_INTERFACE_CLASS __is_interface_class /* v3.2 (not detectable with __has_extension?) */ +#endif + +#if Z_z_HAS_TRAIT(is_literal) +# define Z_COMPILER_TRAIT_TYPE_IS_LITERAL __is_literal /* v2.7 */ + +#elif defined(__cplusplus) && Z_COMPILER_VERSION >= Z_VERSION(3,0,0) +# define Z_COMPILER_TRAIT_TYPE_IS_LITERAL __is_literal_type /* v3.0 */ +#endif + +#if Z_z_HAS_TRAIT(has_nothrow_assign) +# define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE __has_nothrow_assign /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(has_nothrow_copy) +# define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE __has_nothrow_copy /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(has_nothrow_constructor) +# define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE __has_nothrow_constructor /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_pod) +# define Z_COMPILER_TRAIT_TYPE_IS_POD __is_pod /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_polymorphic) +# define Z_COMPILER_TRAIT_TYPE_IS_POLYMORPHIC __is_polymorphic /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_std_layout) +# define Z_COMPILER_TRAIT_TYPE_IS_STD_LAYOUT __is_standard_layout /* v3.0 */ +#endif + +#if Z_z_HAS_TRAIT(is_class) +# define Z_COMPILER_TRAIT_TYPE_IS_STRUCTURE __is_class /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivial) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIAL __is_trivial /* v3.0 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_assignable) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE __is_trivially_assignable /* v3.1 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_constructible) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE __is_trivially_constructible /* v3.1 */ +#endif + +/*--------------------------------------------------. +| See: | +| https://github.com/abseil/abseil-cpp/issues/1201 | +| https://reviews.llvm.org/D127593 | +| https://github.com/llvm/llvm-project/issues/33063 | +'==================================================*/ + +#if Z_z_HAS_TRAIT(has_trivial_assign) && Z_COMPILER_VERSION < Z_VERSION(10,0,0) /* Check version */ +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE __has_trivial_assign /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_copyable) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE __is_trivially_copyable +#elif Z_z_HAS_TRAIT(has_trivial_copy) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE __has_trivial_copy /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_copyable) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE __is_trivially_copyable /* v3.0 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_constructible) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE __is_trivially_constructible +#elif Z_z_HAS_TRAIT(has_trivial_constructor) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE __has_trivial_constructor /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_trivially_destructible) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE __is_trivially_destructible +#elif Z_z_HAS_TRAIT(has_trivial_destructor) +# define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE __has_trivial_destructor /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(is_union) +# define Z_COMPILER_TRAIT_TYPE_IS_UNION __is_union /* v2.6 */ +#endif + +#if Z_z_HAS_TRAIT(underlying_type) +# define Z_COMPILER_TRAIT_TYPE_UNDERLYING_TYPE __underlying_type /* v3.0 */ +#endif + +/* MARK: - Private macros clean-up */ + +#undef Z_z_HAS_ATTRIBUTE +#undef Z_z_HAS_CPP_ATTRIBUTE +#undef Z_z_HAS_EXTENSION +#undef Z_z_HAS_GNU_EXTENSIONS +#undef Z_z_HAS_MSVC_COMPATIBILITY +#undef Z_z_HAS_TRAIT + +#define Z_COMPILER_HAS_MAGIC_CONSTANT_MANGLED_FUNCTION_NAME 1 + +#endif /* Z_inspection_compiler_modules_Clang_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/GCC.h b/projects/Zeta/API/Z/inspection/compiler/modules/GCC.h new file mode 100644 index 0000000..8a845a8 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/GCC.h @@ -0,0 +1,1194 @@ +/* Zeta API - Z/inspection/compiler/modules/GCC.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_GCC_H +#define Z_inspection_compiler_modules_GCC_H + +#include +#include + +/* MARK: - Identification */ + +#define Z_COMPILER_IS_GCC 1 +#define Z_COMPILER_NAME Z_COMPILER_NAME_GCC +#define Z_COMPILER_VERSION Z_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#define Z_COMPILER_VERSION_STRING __VERSION__ + +/* MARK: - ISA / Bit field order */ + +#if defined(__amd64 ) || \ + defined(__amd64__ ) || \ + defined(__x86_64 ) || \ + defined(__x86_64__) + +# define Z_COMPILER_ISA Z_ISA_X86_64 + +#elif defined(__i386 ) || \ + defined(__i386__) || \ + defined(i386 ) + +# define Z_COMPILER_ISA Z_ISA_X86_32 + +#elif defined(__ARM_ARCH_ISA_A64) || \ + defined(__aarch64__ ) + +# define Z_COMPILER_ISA Z_ISA_AARCH64 + +#elif defined(__ARM_ARCH) || \ + defined(__arm__) + +# define Z_COMPILER_ISA Z_ISA_AARCH32 + +#elif defined(__loongarch64) +# define Z_COMPILER_ISA Z_ISA_LA64 + +#elif defined(__loongarch__) +# define Z_COMPILER_ISA Z_ISA_LA32S + +#elif defined(__lm32__) +# define Z_COMPILER_ISA Z_ISA_LATTICE_MICO_32 + +#elif defined(__riscv_32e) +# define Z_COMPILER_ISA Z_ISA_RV32E + +#elif defined(__riscv_xlen) && __riscv_xlen == 32 +# define Z_COMPILER_ISA Z_ISA_RV32I + +#elif defined(__riscv_xlen) && __riscv_xlen == 64 +# define Z_COMPILER_ISA Z_ISA_RV64I + +#elif defined(__vax__) +# define Z_COMPILER_ISA Z_ISA_VAX +#endif + +#ifdef __BYTE_ORDER__ + +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_REVERSED + +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_BIG +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_NORMAL +# endif + +#elif defined(__AARCH64EL__) || \ + defined(__ARMEL__ ) || \ + defined(__THUMBEL__ ) + +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_REVERSED + +#elif defined(__AARCH64EB__ ) || \ + defined(__ARM_BIG_ENDIAN) || \ + defined(__ARMEB__ ) || \ + defined(__THUMBEB__ ) + +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_BIG +# define Z_COMPILER_BIT_FIELD_ORDER_ALL Z_ORDER_NORMAL + +#else +# error "GCC module: Can not detect the endianness of the integral types." +#endif + +/*#define Z_COMPILER_BIT_FIELD_ORDER_8BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_16BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_32BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_64BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_128BIT*/ + +/* MARK: - Platform */ + +/*#define Z_COMPILER_PLATFORM*/ + +/* MARK: - OS */ + +#if defined(__ANDROID__) +# define Z_COMPILER_OS Z_OS_ANDROID + +#elif defined(__gnu_linux__) || \ + defined(__linux ) || \ + defined(__linux__ ) + +# define Z_COMPILER_OS Z_OS_LINUX + +#elif defined(__WIN32 ) || \ + defined(__WIN32__) || \ + defined(__WIN64 ) || \ + defined(__WIN64__) || \ + defined(__WINNT ) || \ + defined(__WINNT__) || \ + defined(_WIN32 ) || \ + defined(_WIN64 ) + +# define Z_COMPILER_OS Z_OS_WINDOWS +#endif + +/* MARK: - Data model */ + +#if defined(__ILP32__) || \ + defined(_ILP32 ) || \ + defined(_WIN32 ) + +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_ILP32 + +#elif defined(_WIN64) +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LLP64 + +#elif defined(__LP64__) || \ + defined(_LP64 ) + +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LP64 +#endif + + +/* MARK: - Floating-point */ + +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE*/ +#define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_X87_DE128 +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X*/ + +/* MARK: - Language: C78 */ + +#define Z_COMPILER_HAS_C_OLD_STYLE_FUNCTION 1 +#define Z_COMPILER_HAS_C_OPERATOR_SIZEOF 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_AUTO 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_EXTERN 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_STATIC 1 +#define Z_COMPILER_HAS_C_TYPE_DOUBLE 1 +#define Z_COMPILER_HAS_C_TYPE_FLOAT 1 + +/* MARK: - Language: C89 */ + +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_RETURN 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_ASSIGNMENT 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_NAMESPACE 1 +#define Z_COMPILER_HAS_C89_ENUMERATION 1 +#define Z_COMPILER_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING 1 +#define Z_COMPILER_HAS_C89_FUNCTION_PROTOTYPE 1 +#define Z_COMPILER_HAS_C89_INTEGRAL_SWITCH 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_INDENTATION 1 +#define Z_COMPILER_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD 1 +#define Z_COMPILER_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE 1 +#define Z_COMPILER_HAS_C89_STRING_LITERAL_CONCATENATION 1 +#define Z_COMPILER_HAS_C89_TRIGRAPHS 1 +#define Z_COMPILER_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_ALERT 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB 1 +#define Z_COMPILER_HAS_C89_LITERAL_FLOAT 1 +#define Z_COMPILER_HAS_C89_LITERAL_UNSIGNED 1 +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_CHARACTER 1 +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_STRING 1 +#define Z_COMPILER_HAS_C89_OPERATOR_UNARY_PLUS 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_PASTING 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING 1 +#define Z_COMPILER_HAS_C89_TYPE_LONG_DOUBLE 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_CHAR 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_LONG 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_SHORT 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID_POINTER 1 +#define Z_COMPILER_HAS_C89_TYPE_MODIFIER_SIGNED 1 +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_CONST 1 +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_VOLATILE 1 + +/* MARK: - Language: C95 */ + +#if Z_COMPILER_VERSION >= Z_VERSION(2, 7, 0) +# define Z_COMPILER_HAS_C95_DIGRAPHS 1 +#endif + +/* MARK: - Language: C99 */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define Z_COMPILER_HAS_C99_COMPOUND_LITERAL 1 +# define Z_COMPILER_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER 1 +# define Z_COMPILER_HAS_C99_CPP_STYLE_COMMENT 1 +# define Z_COMPILER_HAS_C99_DESIGNATED_INITIALIZATION 1 +# define Z_COMPILER_HAS_C99_EMPTY_MACRO_ARGUMENT 1 +# define Z_COMPILER_HAS_C99_EXTENDED_IDENTIFIER 1 +# define Z_COMPILER_HAS_C99_FLEXIBLE_ARRAY_MEMBER 1 +# define Z_COMPILER_HAS_C99_FOR_WITH_DECLARATION 1 +# define Z_COMPILER_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS 1 +# define Z_COMPILER_HAS_C99_MIXED_DECLARATIONS_AND_CODE 1 +# define Z_COMPILER_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +# define Z_COMPILER_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX 1 +# define Z_COMPILER_HAS_C99_RELIABLE_INTEGER_DIVISION 1 +# define Z_COMPILER_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN 1 +# define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION 1 +# define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_INT 1 +# define Z_COMPILER_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION 1 +# define Z_COMPILER_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 +# define Z_COMPILER_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION 1 +# define Z_COMPILER_HAS_C99_UNIVERSAL_CHARACTER_NAME 1 +# define Z_COMPILER_HAS_C99_VARIADIC_MACRO 1 +# define Z_COMPILER_HAS_C99_VLA 1 +# define Z_COMPILER_HAS_C99_IDENTIFIER_FUNC 1 +# define Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT 1 +# define Z_COMPILER_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA 1 +# define Z_COMPILER_HAS_C99_SPECIFIER_INLINE 1 +# define Z_COMPILER_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE 1 +# define Z_COMPILER_HAS_C99_STD_PRAGMA_FENV_ACCESS 1 +# define Z_COMPILER_HAS_C99_STD_PRAGMA_FP_CONTRACT 1 +# define Z_COMPILER_HAS_C99_TYPE_BOOL 1 +# define Z_COMPILER_HAS_C99_TYPE_DOUBLE_COMPLEX 1 +# define Z_COMPILER_HAS_C99_TYPE_DOUBLE_IMAGINARY 1 +# define Z_COMPILER_HAS_C99_TYPE_FLOAT_COMPLEX 1 +# define Z_COMPILER_HAS_C99_TYPE_FLOAT_IMAGINARY 1 +# define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX 1 +# define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY 1 +# define Z_COMPILER_HAS_C99_TYPE_LONG_LONG 1 +# define Z_COMPILER_HAS_C99_TYPE_MODIFIER_COMPLEX 1 +# define Z_COMPILER_HAS_C99_TYPE_MODIFIER_IMAGINARY 1 +# define Z_COMPILER_HAS_C99_TYPE_QUALIFIER_RESTRICT 1 +#endif + +/* MARK: - Language: C11 */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define Z_COMPILER_HAS_C11_ANONYMOUS_STRUCTURE_AS_MEMBER 1 +# define Z_COMPILER_HAS_C11_ANONYMOUS_UNION_AS_MEMBER 1 +# define Z_COMPILER_HAS_C11_GENERIC_SELECTION 1 +# define Z_COMPILER_HAS_C11_STATIC_ASSERTION 1 +# define Z_COMPILER_HAS_C11_TYPEDEF_REDECLARATION 1 +# define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_CHARACTER 1 +# define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_STRING 1 +# define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_CHARACTER 1 +# define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_STRING 1 +# define Z_COMPILER_HAS_C11_LITERAL_UTF8_STRING 1 +# define Z_COMPILER_HAS_C11_OPERATOR_ALIGNOF 1 +# define Z_COMPILER_HAS_C11_SPECIFIER_ALIGNAS 1 +# define Z_COMPILER_HAS_C11_SPECIFIER_NORETURN 1 +# define Z_COMPILER_HAS_C11_STORAGE_CLASS_THREAD_LOCAL 1 +# define Z_COMPILER_HAS_C11_TYPE_MODIFIER_ATOMIC 1 +# define Z_COMPILER_HAS_C11_TYPE_QUALIFIER_ATOMIC 1 +#endif + +/* MARK: - Language: Apple C extensions */ + +/*#define Z_COMPILER_C_HAS_BLOCK_OBJECT*/ + +#ifdef __cplusplus + + /* MARK: - Language: C++98 */ + +# if __cplusplus >= 199711L +# define Z_COMPILER_HAS_CPP98_EXCEPTIONS 1 +# define Z_COMPILER_HAS_CPP98_RTTI 1 +# define Z_COMPILER_HAS_CPP98_SFINAE 1 +# define Z_COMPILER_HAS_CPP98_TYPE_BOOL 1 +# define Z_COMPILER_HAS_CPP98_TYPE_WCHAR_T 1 +# endif + + /* MARK: - Language: C++03 */ + +# if __cplusplus >= 199711L +# define Z_COMPILER_HAS_CPP03_VALUE_INITIALIZATION 1 +# endif + + /* MARK: - Language: C++11 */ + +# if __cplusplus >= 201103L +# define Z_COMPILER_HAS_CPP11_ANONYMOUS_TYPE_AS_TEMPLATE_ARGUMENT 1 +# define Z_COMPILER_HAS_CPP11_C99_PREPROCESSOR 1 +# define Z_COMPILER_HAS_CPP11_COPY_LIST_INITIALIZATION 1 +# define Z_COMPILER_HAS_CPP11_DEFAULT_MEMBER_INITIALIZER 1 +# define Z_COMPILER_HAS_CPP11_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP11_DELEGATING_CONSTRUCTORS 1 +# define Z_COMPILER_HAS_CPP11_DELETED_FUNCTION 1 +# define Z_COMPILER_HAS_CPP11_DIRECT_LIST_INITIALIZATION 1 +# define Z_COMPILER_HAS_CPP11_EXPLICIT_CONVERSION_OPERATOR 1 +# define Z_COMPILER_HAS_CPP11_EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION 1 +# define Z_COMPILER_HAS_CPP11_EXPRESSION_SFINAE 1 +# define Z_COMPILER_HAS_CPP11_EXTENDED_FRIEND_DECLARATION 1 +# define Z_COMPILER_HAS_CPP11_EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS 1 +# define Z_COMPILER_HAS_CPP11_EXTERN_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP11_FIXED_ENUMERATION 1 +# define Z_COMPILER_HAS_CPP11_INHERITING_CONSTRUCTORS 1 +# define Z_COMPILER_HAS_CPP11_INITIALIZATION_OF_CLASS_OBJECT_BY_RVALUE 1 +# define Z_COMPILER_HAS_CPP11_INITIALIZER_LIST 1 +# define Z_COMPILER_HAS_CPP11_INLINE_NAMESPACE 1 +# define Z_COMPILER_HAS_CPP11_LAMBDA 1 +# define Z_COMPILER_HAS_CPP11_LOCAL_TYPE_AS_TEMPLATE_ARGUMENT 1 +# define Z_COMPILER_HAS_CPP11_MOVE_SPECIAL_MEMBER_FUNCTIONS 1 +# define Z_COMPILER_HAS_CPP11_MULTI_DECLARATOR_AUTO 1 +# define Z_COMPILER_HAS_CPP11_OPAQUE_ENUMERATION_DECLARATION 1 +# define Z_COMPILER_HAS_CPP11_RANGE_BASED_FOR 1 +# define Z_COMPILER_HAS_CPP11_REFERENCE_QUALIFIED_NON_STATIC_MEMBER_FUNCTION 1 +# define Z_COMPILER_HAS_CPP11_REMOVAL_OF_AUTO_AS_STORAGE_CLASS 1 +# define Z_COMPILER_HAS_CPP11_RIGHT_ANGLE_BRACKETS 1 +# define Z_COMPILER_HAS_CPP11_RVALUE_REFERENCE 1 +# define Z_COMPILER_HAS_CPP11_SCOPED_ENUMERATION 1 +# define Z_COMPILER_HAS_CPP11_STD_LAYOUT 1 +# define Z_COMPILER_HAS_CPP11_STANDARDIZED_ATTRIBUTE_SYNTAX 1 +# define Z_COMPILER_HAS_CPP11_STATIC_ASSERTION 1 +# define Z_COMPILER_HAS_CPP11_THREAD_SAFE_STATIC_INITIALIZATION 1 +# define Z_COMPILER_HAS_CPP11_TRAILING_COMMA_ALLOWED_IN_ENUMERATION 1 +# define Z_COMPILER_HAS_CPP11_TRAILING_RETURN_TYPE 1 +# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS 1 +# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP11_UNIVERSAL_CHARACTER_NAME 1 +# define Z_COMPILER_HAS_CPP11_UNRESTRICTED_UNION 1 +# define Z_COMPILER_HAS_CPP11_VARIADIC_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_CARRIES_DEPENDENCY 1 +# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_NORETURN 1 +# define Z_COMPILER_HAS_CPP11_IDENTIFIER_FUNC 1 +# define Z_COMPILER_HAS_CPP11_LITERAL_NULLPTR 1 +# define Z_COMPILER_HAS_CPP11_LITERAL_RAW_STRING 1 +# define Z_COMPILER_HAS_CPP11_LITERAL_USER_DEFINED 1 +# define Z_COMPILER_HAS_CPP11_LITERAL_UTF8_STRING 1 +# define Z_COMPILER_HAS_CPP11_OPERATOR_ALIGNOF 1 +# define Z_COMPILER_HAS_CPP11_OPERATOR_NOEXCEPT 1 +# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_NON_STATIC_DATA_MEMBER 1 +# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_PARAMETER_PACK 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_ALIGNAS 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_CONSTEXPR 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_DECLTYPE 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_FINAL 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_NOEXCEPT 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_OVERRIDE 1 +# define Z_COMPILER_HAS_CPP11_SPECIFIER_CASE_DECLTYPE_INCOMPLETE_RETURN_TYPE 1 +# define Z_COMPILER_HAS_CPP11_STORAGE_CLASS_THREAD_LOCAL 1 +# define Z_COMPILER_HAS_CPP11_TYPE_AUTO 1 +# define Z_COMPILER_HAS_CPP11_TYPE_CHAR16_T 1 +# define Z_COMPILER_HAS_CPP11_TYPE_CHAR32_T 1 +# define Z_COMPILER_HAS_CPP11_TYPE_LONG_LONG 1 +# endif + + /* MARK: - Language: C++14 */ + +# if __cplusplus >= 201402L +# define Z_COMPILER_HAS_CPP14_APOSTROPHE_AS_DIGIT_SEPARATOR 1 +# define Z_COMPILER_HAS_CPP14_CONSTEXPR_FUNCTION 1 +# define Z_COMPILER_HAS_CPP14_CONTEXTUAL_CONVERSION 1 +# define Z_COMPILER_HAS_CPP14_DEFAULT_MEMBER_INITIALIZER_FOR_AGGREGATE 1 +# define Z_COMPILER_HAS_CPP14_GENERIC_LAMBDA 1 +# define Z_COMPILER_HAS_CPP14_INITIALIZED_LAMBDA_CAPTURE 1 +# define Z_COMPILER_HAS_CPP14_RETURN_TYPE_DEDUCTION_FOR_NORMAL_FUNCTION 1 +# define Z_COMPILER_HAS_CPP14_SIZED_DEALLOCATION 1 +# define Z_COMPILER_HAS_CPP14_VARIABLE_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP14_ATTRIBUTE_DEPRECATED 1 +# define Z_COMPILER_HAS_CPP14_LITERAL_BINARY_INTEGRAL 1 +# define Z_COMPILER_HAS_CPP14_SPECIFIER_CASE_DECLTYPE_AUTO 1 +# endif + + /* MARK: - Language: C++17 */ + +# if __cplusplus >= 201703L +# define Z_COMPILER_HAS_CPP17_AGGREGATE_INITIALIZATION_FOR_DERIVED_CLASS 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_USING_PREFIX 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_ENUMERATOR 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_NAMESPACE 1 +# define Z_COMPILER_HAS_CPP17_AUTO_DEDUCTION_FROM_LIST_INITIALIZATION 1 +# define Z_COMPILER_HAS_CPP17_CONSTEXPR_IF 1 +# define Z_COMPILER_HAS_CPP17_CONSTEXPR_LAMBDA 1 +# define Z_COMPILER_HAS_CPP17_DEDUCTION_GUIDES_FOR_CLASS_TEMPLATE 1 +# define Z_COMPILER_HAS_CPP17_DIFFERING_BEGIN_AND_END_TYPES_IN_RANGE_BASED_FOR 1 +# define Z_COMPILER_HAS_CPP17_DIRECT_LIST_INITIALIZATION_FOR_FIXED_ENUMERATION 1 +# define Z_COMPILER_HAS_CPP17_EXPRESSION_EVALUATION_ORDER 1 +# define Z_COMPILER_HAS_CPP17_FOLD_EXPRESSION 1 +# define Z_COMPILER_HAS_CPP17_GUARANTEED_COPY_ELISION 1 +# define Z_COMPILER_HAS_CPP17_IF_WITH_INITIALIZER 1 +# define Z_COMPILER_HAS_CPP17_IGNORING_OF_UNKNOWN_ATTRIBUTES 1 +# define Z_COMPILER_HAS_CPP17_INHERITING_CONSTRUCTORS 1 +# define Z_COMPILER_HAS_CPP17_INLINE_VARIABLE 1 +# define Z_COMPILER_HAS_CPP17_LAMBDA_CAPTURE_OF_STAR_THIS_BY_VALUE 1 +# define Z_COMPILER_HAS_CPP17_NESTED_NAMESPACE_DEFINITION 1 +# define Z_COMPILER_HAS_CPP17_NOEXCEPT_AS_PART_OF_THE_FUNCTION_TYPE 1 + //https://stackoverflow.com/questions/43213997/why-is-gcc-failing-when-using-lambda-for-non-type-template-parameter +# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_ARGUMENTS 1 +# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_PARAMETER_WITH_AUTO_TYPE 1 +# define Z_COMPILER_HAS_CPP17_OVER_ALIGNED_DYNAMIC_MEMORY_ALLOCATION 1 +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_BOOL_INCREMENT 1 +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_DYNAMIC_EXCEPTION_SPECIFICATION 1 +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_REGISTER_AS_STORAGE_CLASS 1 +# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_TRIGRAPHS 1 +# define Z_COMPILER_HAS_CPP17_SAFE_UNARY_FOLD_EXPRESSION 1 +# define Z_COMPILER_HAS_CPP17_STATIC_ASSERTION_WITH_NO_MESSAGE 1 +# define Z_COMPILER_HAS_CPP17_STRUCTURED_BINDING 1 +# define Z_COMPILER_HAS_CPP17_SWITCH_WITH_INITIALIZER 1 +# define Z_COMPILER_HAS_CPP17_TEMPLATE_TEMPLATE_ARGUMENT_MATCHING 1 +# define Z_COMPILER_HAS_CPP17_TYPENAME_IN_TEMPLATE_TEMPLATE_PARAMETER 1 +# define Z_COMPILER_HAS_CPP17_VARIADIC_USING 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_FALLTHROUGH 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_MAYBE_UNUSED 1 +# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_NODISCARD 1 +# define Z_COMPILER_HAS_CPP17_LITERAL_HEXADECIMAL_FLOATING_POINT 1 +# define Z_COMPILER_HAS_CPP17_LITERAL_UTF8_CHARACTER 1 +# define Z_COMPILER_HAS_CPP17_PREPROCESSOR_OPERATOR_HAS_INCLUDE 1 +# endif + + /* MARK: - Language: C++20 */ + + /* MARK: - Language: GNU C++ extensions */ + +#endif + +/* MARK: - Language: Implementation-defined */ + +#if (~0 >> 1) == ~0 +# define Z_COMPILER_HAS_ARITHMETIC_RIGHT_SHIFT 1 +#endif + +/* MARK: - Attributes +.---------------------------------------------------------------------------. +| There is no official documentation where to consult since what version is | +| available each attribute. The following list has been used as reference: | +| | +'==========================================================================*/ + +#if Z_COMPILER_VERSION >= Z_VERSION(3,1,0) +# define Z_COMPILER_ATTRIBUTE_ALWAYS_INLINE __inline__ __attribute__((always_inline)) +# define Z_COMPILER_ATTRIBUTE_INLINE __inline__ __attribute__((always_inline)) + +#elif Z_COMPILER_VERSION >= Z_VERSION(1,21,0) +# define Z_COMPILER_ATTRIBUTE_INLINE __inline__ +#endif + +#if Z_COMPILER_VERSION >= Z_VERSION(2,5,0) +# define Z_COMPILER_ATTRIBUTE_NO_RETURN __attribute__((noreturn)) + +# if Z_COMPILER_VERSION >= Z_VERSION(2,7,0) +# define Z_COMPILER_ATTRIBUTE_ALIAS(name) __attribute__((alias(name))) +# define Z_COMPILER_ATTRIBUTE_WEAK __attribute__((weak)) + +# if Z_COMPILER_VERSION >= Z_VERSION(2,8,0) + +# if defined(Z_COMPILER_OS) && Z_COMPILER_OS == Z_OS_WINDOWS +# define Z_COMPILER_ATTRIBUTE_API_EXPORT __attribute__((dllexport)) +# define Z_COMPILER_ATTRIBUTE_API_IMPORT __attribute__((dllimport)) +# endif + +# if Z_COMPILER_VERSION >= Z_VERSION(3,3,0) +# define Z_COMPILER_ATTRIBUTE_PRIVATE __attribute__((visibility("hidden"))) +# define Z_COMPILER_ATTRIBUTE_PUBLIC __attribute__((visibility("default"))) + + /*------------------------------------------------------------. + | See: | + '============================================================*/ +# if defined(Z_COMPILER_ISA) && \ + (Z_COMPILER_ISA == Z_ISA_X86_32 || \ + Z_COMPILER_ISA == Z_ISA_X86_64) + +# define Z_COMPILER_ATTRIBUTE_THREAD_LOCAL __thread +# endif + + /*------------------------------------------------------------------------. + | "sentinel" first appeared in the documentation of GCC v4.0.0: | + | | + '========================================================================*/ +# if Z_COMPILER_VERSION >= Z_VERSION(4,0,0) +# define Z_COMPILER_ATTRIBUTE_NULL_TERMINATED __attribute__((sentinel)) +# endif +# endif + +# endif +# endif +#endif + +/*#define Z_COMPILER_ATTRIBUTE_EBCO*/ +/*#define Z_COMPILER_ATTRIBUTE_API_WEAK_EXPORT*/ + +#if defined(Z_COMPILER_OS) && Z_COMPILER_OS == Z_OS_WINDOWS +# define Z_COMPILER_ATTRIBUTE_MICROSOFT_STD_CALL __attribute__((stdcall)) /* TODO: check version */ +#endif + +/* MARK: - Padding specifiers */ + +#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE __attribute__((packed)) +#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE __attribute__((packed)) +#define Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY __attribute__((packed)) +#define Z_COMPILER_PACKED_UNION_AFTER_BODY __attribute__((packed)) + +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_BODY*/ + +/* MARK: - Built-ins: types and literal suffixes */ + +#ifdef __UINT8_TYPE__ +# define Z_COMPILER_TYPE_UINT8 __typeof(__extension__ (__UINT8_TYPE__)1) +#endif + +#ifdef __INT8_TYPE__ +# define Z_COMPILER_TYPE_SINT8 __typeof(__extension__ (__INT8_TYPE__)1) + +# ifndef __UINT8_TYPE__ +# define Z_COMPILER_TYPE_UINT8 __typeof(__extension__ (unsigned __INT8_TYPE__)1) +# endif +#endif + +#ifdef __UINT16_TYPE__ +# define Z_COMPILER_TYPE_UINT16 __typeof(__extension__ (__UINT16_TYPE__)1) +#endif + +#ifdef __INT16_TYPE__ +# define Z_COMPILER_TYPE_SINT16 __typeof(__extension__ (__INT16_TYPE__)1) + +# ifndef __UINT16_TYPE__ +# define Z_COMPILER_TYPE_UINT16 __typeof(__extension__ (unsigned __INT16_TYPE__)1) +# endif +#endif + +#ifdef __UINT32_TYPE__ +# define Z_COMPILER_TYPE_UINT32 __typeof(__extension__ (__UINT32_TYPE__)1) +#endif + +#ifdef __INT32_TYPE__ +# define Z_COMPILER_TYPE_SINT32 __typeof(__extension__ (__INT32_TYPE__)1) + +# ifndef __UINT32_TYPE__ +# define Z_COMPILER_TYPE_UINT32 __typeof(__extension__ (unsigned __INT32_TYPE__)1) +# endif +#endif + +#ifdef __UINT64_TYPE__ +# define Z_COMPILER_TYPE_UINT64 __typeof(__extension__ (__UINT64_TYPE__)1) +#endif + +#ifdef __INT64_TYPE__ +# define Z_COMPILER_TYPE_SINT64 __typeof(__extension__ (__INT64_TYPE__)1) + +# ifndef __UINT64_TYPE__ +# define Z_COMPILER_TYPE_UINT64 __typeof(__extension__ (unsigned __INT64_TYPE__)1) +# endif +#endif + +#ifdef __SIZEOF_INT128__ +# define Z_COMPILER_TYPE_UINT128 __typeof(__extension__ (unsigned __int128)1) +# define Z_COMPILER_TYPE_SINT128 __typeof(__extension__ (__int128)1) +#endif + +#ifdef __UINT8_C +# define Z_COMPILER_LITERAL_UINT8(number) (__extension__ __UINT8_C(number)) +#endif + +#ifdef __INT8_C +# define Z_COMPILER_LITERAL_INT8(number) (__extension__ __INT8_C(number)) +#endif + +#ifdef __UINT32_C +# define Z_COMPILER_LITERAL_UINT16(number) (__extension__ __UINT16_C(number)) +#endif + +#ifdef __INT32_C +# define Z_COMPILER_LITERAL_INT16(number) (__extension__ __INT16_C(number)) +#endif + +#ifdef __UINT32_C +# define Z_COMPILER_LITERAL_UINT32(number) (__extension__ __UINT32_C(number)) +#endif + +#ifdef __INT32_C +# define Z_COMPILER_LITERAL_INT32(number) (__extension__ __INT32_C(number)) +#endif + +#ifdef __UINT64_C +# define Z_COMPILER_LITERAL_UINT64(number) (__extension__ __UINT64_C(number)) +#endif + +#ifdef __INT64_C +# define Z_COMPILER_LITERAL_INT64(number) (__extension__ __INT64_C(number)) +#endif + +#define Z_COMPILER_TYPE_VAL __builtin_va_list + +/*#define Z_COMPILER_TYPE_UINT24*/ +/*#define Z_COMPILER_TYPE_SINT24*/ +/*#define Z_COMPILER_TYPE_UINT40*/ +/*#define Z_COMPILER_TYPE_SINT40*/ +/*#define Z_COMPILER_TYPE_UINT48*/ +/*#define Z_COMPILER_TYPE_SINT48*/ +/*#define Z_COMPILER_TYPE_UINT56*/ +/*#define Z_COMPILER_TYPE_SINT56*/ +/*#define Z_COMPILER_TYPE_BFP16*/ +/*#define Z_COMPILER_TYPE_BFP32*/ +/*#define Z_COMPILER_TYPE_BFP64*/ +/*#define Z_COMPILER_TYPE_BFP128*/ +/*#define Z_COMPILER_TYPE_DFP32*/ +/*#define Z_COMPILER_TYPE_DFP64*/ +/*#define Z_COMPILER_TYPE_DFP128*/ +/*#define Z_COMPILER_TYPE_X87_DE80*/ +/*#define Z_COMPILER_TYPE_X87_DE96*/ +/*#define Z_COMPILER_TYPE_X87_DE128*/ +/*#define Z_COMPILER_TYPE_IBM_ED*/ +/*#define Z_COMPILER_TYPE_BFLOAT16*/ +/*#define Z_COMPILER_LITERAL_UINT8(number)*/ +/*#define Z_COMPILER_LITERAL_SINT8(number)*/ +/*#define Z_COMPILER_LITERAL_UINT24(number)*/ +/*#define Z_COMPILER_LITERAL_SINT24(number)*/ +/*#define Z_COMPILER_LITERAL_UINT40(number)*/ +/*#define Z_COMPILER_LITERAL_SINT40(number)*/ +/*#define Z_COMPILER_LITERAL_UINT48(number)*/ +/*#define Z_COMPILER_LITERAL_SINT48(number)*/ +/*#define Z_COMPILER_LITERAL_UINT56(number)*/ +/*#define Z_COMPILER_LITERAL_SINT56(number)*/ +/*#define Z_COMPILER_LITERAL_UINT128(number)*/ +/*#define Z_COMPILER_LITERAL_SINT128(number)*/ +/*#define Z_COMPILER_LITERAL_BFP16(number)*/ +/*#define Z_COMPILER_LITERAL_BFP32(number)*/ +/*#define Z_COMPILER_LITERAL_BFP64(number)*/ +/*#define Z_COMPILER_LITERAL_BFP128(number)*/ +/*#define Z_COMPILER_LITERAL_DFP32(number)*/ +/*#define Z_COMPILER_LITERAL_DFP64(number)*/ +/*#define Z_COMPILER_LITERAL_DFP128(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE80(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE96(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE128(number)*/ +/*#define Z_COMPILER_LITERAL_IBM_ED(number)*/ +/*#define Z_COMPILER_LITERAL_BFLOAT16(number)*/ + +/* MARK: - Built-ins: Constants */ + +#if defined(__CHAR_BIT__) +# define Z_COMPILER_CONSTANT_CHAR_WIDTH __CHAR_BIT__ + +#elif defined(__SCHAR_WIDTH__) +# define Z_COMPILER_CONSTANT_CHAR_WIDTH __SCHAR_WIDTH__ +#endif + +#ifdef __SCHAR_MAX__ +# define Z_COMPILER_CONSTANT_SCHAR_MAXIMUM __SCHAR_MAX__ +#endif + +#ifdef __SIZEOF_SHORT__ +# define Z_COMPILER_CONSTANT_SHORT_SIZE __SIZEOF_SHORT__ +#endif + +#ifdef __SHRT_WIDTH__ +# define Z_COMPILER_CONSTANT_SHORT_WIDTH __SHRT_WIDTH__ +#endif + +#ifdef __SHRT_MAX__ +# define Z_COMPILER_CONSTANT_SSHORT_MAXIMUM __SHRT_MAX__ +#endif + +#ifdef __SIZEOF_INT__ +# define Z_COMPILER_CONSTANT_INT_SIZE __SIZEOF_INT__ +#endif + +#if defined(__INT_WIDTH__) +# define Z_COMPILER_CONSTANT_INT_WIDTH __INT_WIDTH__ +#elif defined(_MIPS_SZINT) +# define Z_COMPILER_CONSTANT_INT_WIDTH _MIPS_SZINT +#endif + +#ifdef __INT_MAX__ +# define Z_COMPILER_CONSTANT_SINT_MAXIMUM __INT_MAX__ +#endif + +#ifdef __SIZEOF_LONG__ +# define Z_COMPILER_CONSTANT_LONG_SIZE __SIZEOF_LONG__ +#endif + +#if defined(__LONG_WIDTH__) +# define Z_COMPILER_CONSTANT_LONG_WIDTH __LONG_WIDTH__ +#elif defined(_MIPS_SZLONG) +# define Z_COMPILER_CONSTANT_LONG_WIDTH _MIPS_SZLONG +#endif + +#ifdef __LONG_MAX__ +# define Z_COMPILER_CONSTANT_SLONG_MAXIMUM __LONG_MAX__ +#endif + +#ifdef __SIZEOF_LONG_LONG__ +# define Z_COMPILER_CONSTANT_LLONG_SIZE __SIZEOF_LONG_LONG__ +#endif + +#ifdef __LONG_LONG_WIDTH__ +# define Z_COMPILER_CONSTANT_LLONG_WIDTH __LONG_LONG_WIDTH__ +#endif + +#ifdef __LONG_LONG_MAX__ +# define Z_COMPILER_CONSTANT_SLLONG_MAXIMUM __LONG_LONG_MAX__ +#endif + +#ifdef __SIZEOF_WCHAR_T__ +# define Z_COMPILER_CONSTANT_WCHAR_SIZE __SIZEOF_WCHAR_T__ +#endif + +#ifdef __WCHAR_WIDTH__ +# define Z_COMPILER_CONSTANT_WCHAR_WIDTH __WCHAR_WIDTH__ +#endif + +#ifdef __WCHAR_MAX__ +# define Z_COMPILER_CONSTANT_WCHAR_MAXIMUM __WCHAR_MAX__ +#endif + +#ifdef __WCHAR_MIN__ +# define Z_COMPILER_CONSTANT_WCHAR_MINIMUM __WCHAR_MIN__ +#endif + +#ifdef __SIZEOF_SIZE_T__ +# define Z_COMPILER_CONSTANT_SIZE_SIZE __SIZEOF_SIZE_T__ +#endif + +#ifdef __SIZE_WIDTH__ +# define Z_COMPILER_CONSTANT_SIZE_WIDTH __SIZE_WIDTH__ +#endif + +#ifdef __SIZE_MAX__ +# define Z_COMPILER_CONSTANT_USIZE_MAXIMUM __SIZE_MAX__ +#endif + +#ifdef __UINTMAX_MAX__ +# define Z_COMPILER_CONSTANT_UINTMAX_MAXIMUM __UINTMAX_MAX__ +#endif + +#ifdef __INTMAX_WIDTH__ +# define Z_COMPILER_CONSTANT_SINTMAX_WIDTH __INTMAX_WIDTH__ +#endif + +#ifdef __INTMAX_MAX__ +# define Z_COMPILER_CONSTANT_SINTMAX_MAXIMUM __INTMAX_MAX__ +#endif + +#ifdef __UINTPTR_MAX__ +# define Z_COMPILER_CONSTANT_UINTPTR_MAXIMUM __UINTPTR_MAX__ +#endif + +#ifdef __INTPTR_WIDTH__ +# define Z_COMPILER_CONSTANT_SINTPTR_WIDTH __INTPTR_WIDTH__ +#endif + +#ifdef __INTPTR_MAX__ +# define Z_COMPILER_CONSTANT_SINTPTR_MAXIMUM __INTPTR_MAX__ +#endif + +#ifdef __SIZEOF_FLOAT__ +# define Z_COMPILER_CONSTANT_FLOAT_SIZE __SIZEOF_FLOAT__ +#endif + +#define Z_COMPILER_CONSTANT_FLOAT_HUGE __builtin_huge_valf( ) +#define Z_COMPILER_CONSTANT_FLOAT_INFINITY __builtin_inff ( ) +#define Z_COMPILER_CONSTANT_FLOAT_QNAN __builtin_nanf ("") +#define Z_COMPILER_CONSTANT_FLOAT_SNAN __builtin_nansf ("") + +#ifdef __SIZEOF_DOUBLE__ +# define Z_COMPILER_CONSTANT_DOUBLE_SIZE __SIZEOF_DOUBLE__ +#endif + +#define Z_COMPILER_CONSTANT_DOUBLE_HUGE __builtin_huge_val( ) +#define Z_COMPILER_CONSTANT_DOUBLE_INFINITY __builtin_inf ( ) +#define Z_COMPILER_CONSTANT_DOUBLE_QNAN __builtin_nan ("") +#define Z_COMPILER_CONSTANT_DOUBLE_SNAN __builtin_nans ("") + +#ifdef __SIZEOF_LONG_DOUBLE__ +# define Z_COMPILER_CONSTANT_LDOUBLE_SIZE __SIZEOF_LONG_DOUBLE__ +#endif + +#define Z_COMPILER_CONSTANT_LDOUBLE_HUGE __builtin_huge_vall ( ) +#define Z_COMPILER_CONSTANT_LDOUBLE_INFINITY __builtin_infl ( ) +#define Z_COMPILER_CONSTANT_LDOUBLE_QNAN __builtin_nanl ("") +#define Z_COMPILER_CONSTANT_LDOUBLE_SNAN __builtin_nansl ("") +#define Z_COMPILER_CONSTANT_FLOAT16_HUGE __builtin_huge_valf16 ( ) +#define Z_COMPILER_CONSTANT_FLOAT16_INFINITY __builtin_inff16 ( ) +#define Z_COMPILER_CONSTANT_FLOAT16_QNAN __builtin_nanf16 ("") +#define Z_COMPILER_CONSTANT_FLOAT16_SNAN __builtin_nansf16 ("") +#define Z_COMPILER_CONSTANT_FLOAT32_HUGE __builtin_huge_valf32 ( ) +#define Z_COMPILER_CONSTANT_FLOAT32_INFINITY __builtin_inff32 ( ) +#define Z_COMPILER_CONSTANT_FLOAT32_QNAN __builtin_nanf32 ("") +#define Z_COMPILER_CONSTANT_FLOAT32_SNAN __builtin_nansf32 ("") +#define Z_COMPILER_CONSTANT_FLOAT64_HUGE __builtin_huge_valf64 ( ) +#define Z_COMPILER_CONSTANT_FLOAT64_INFINITY __builtin_inff64 ( ) +#define Z_COMPILER_CONSTANT_FLOAT64_QNAN __builtin_nanf64 ("") +#define Z_COMPILER_CONSTANT_FLOAT64_SNAN __builtin_nansf64 ("") +#define Z_COMPILER_CONSTANT_FLOAT128_HUGE __builtin_huge_valf128 ( ) +#define Z_COMPILER_CONSTANT_FLOAT128_INFINITY __builtin_inff128 ( ) +#define Z_COMPILER_CONSTANT_FLOAT128_QNAN __builtin_nanf128 ("") +#define Z_COMPILER_CONSTANT_FLOAT128_SNAN __builtin_nansf128 ("") +#define Z_COMPILER_CONSTANT_FLOAT32X_HUGE __builtin_huge_valf32x ( ) +#define Z_COMPILER_CONSTANT_FLOAT32X_INFINITY __builtin_inff32x ( ) +#define Z_COMPILER_CONSTANT_FLOAT32X_QNAN __builtin_nanf32x ("") +#define Z_COMPILER_CONSTANT_FLOAT32X_SNAN __builtin_nansf32x ("") +#define Z_COMPILER_CONSTANT_FLOAT64X_HUGE __builtin_huge_valf64x ( ) +#define Z_COMPILER_CONSTANT_FLOAT64X_INFINITY __builtin_inff64x ( ) +#define Z_COMPILER_CONSTANT_FLOAT64X_QNAN __builtin_nanf64x ("") +#define Z_COMPILER_CONSTANT_FLOAT64X_SNAN __builtin_nansf64x ("") +#define Z_COMPILER_CONSTANT_FLOAT128X_HUGE __builtin_huge_valf128x( ) +#define Z_COMPILER_CONSTANT_FLOAT128X_INFINITY __builtin_inff128x ( ) +#define Z_COMPILER_CONSTANT_FLOAT128X_QNAN __builtin_nanf128x ("") +#define Z_COMPILER_CONSTANT_FLOAT128X_SNAN __builtin_nansf128x ("") +#define Z_COMPILER_CONSTANT_DECIMAL32_INFINITY __builtin_infd32 ( ) +#define Z_COMPILER_CONSTANT_DECIMAL32_QNAN __builtin_nand32 ("") +#define Z_COMPILER_CONSTANT_DECIMAL64_INFINITY __builtin_infd64 ( ) +#define Z_COMPILER_CONSTANT_DECIMAL64_QNAN __builtin_nand64 ("") +#define Z_COMPILER_CONSTANT_DECIMAL128_INFINITY __builtin_infd128 ( ) +#define Z_COMPILER_CONSTANT_DECIMAL128_QNAN __builtin_nand128 ("") + +#ifdef __SIZEOF_POINTER__ +# define Z_COMPILER_CONSTANT_POINTER_SIZE __SIZEOF_POINTER__ +#endif + +#ifdef _MIPS_SZPTR +# define Z_COMPILER_CONSTANT_POINTER_WIDTH _MIPS_SZPTR +#endif + +/*#define Z_COMPILER_CONSTANT_UCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_USHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_ULONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_ULLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_HUGE*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_QNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_SNAN*/ + +/* MARK: - Built-ins: Macros */ + +#define Z_COMPILER_MACRO_MEMBER_OFFSET __builtin_offsetof + +/*----------------------------------------------------------------------------. +| IMPORTANT: GCC breaks the CDECL calling convention on x86-32, which makes | +| necessary to always use the GCC's built-in macros for dealing with variable | +| argument lists. See . | +| | +| This should not be a problem, after all the built-in macros work well, but | +| some versions of GCC create dependencies with the C standard library under | +| certain conditions if they are used. The way to fix this is to use the | +| -fno-builtin option to make GCC, paradoxically, generate true built-ins. | +'============================================================================*/ +#define Z_COMPILER_MACRO_VAL_INITIALIZE __builtin_va_start +#define Z_COMPILER_MACRO_VAL_FINALIZE __builtin_va_end +#define Z_COMPILER_MACRO_VAL_READ __builtin_va_arg + +#if !defined(__STRICT_ANSI__) || \ + __STDC_VERSION__ >= 199900L || \ + __cplusplus >= 201103L + +# define Z_COMPILER_MACRO_VAL_COPY(self, output) __builtin_va_copy(output, self) +#endif + +/* MARK: - Built-ins: Functions */ + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_AND_THEN_GET __sync_and_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_AND_THEN_GET __sync_and_and_fetch_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_AND __sync_fetch_and_and_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_AND __sync_fetch_and_and_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_OR __sync_fetch_and_or_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_OR __sync_fetch_and_or_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_OR_THEN_GET __sync_or_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_OR_THEN_GET __sync_or_and_fetch_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_1 +# define Z_COMPILER_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_1 +# define Z_COMPILER_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_1 +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_AND_THEN_GET __sync_and_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_AND_THEN_GET __sync_and_and_fetch_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_AND __sync_fetch_and_and_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_AND __sync_fetch_and_and_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_OR __sync_fetch_and_or_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_OR __sync_fetch_and_or_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_OR_THEN_GET __sync_or_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_OR_THEN_GET __sync_or_and_fetch_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_2 +# define Z_COMPILER_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_2 +# define Z_COMPILER_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_2 +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_AND_THEN_GET __sync_and_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_AND_THEN_GET __sync_and_and_fetch_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_AND __sync_fetch_and_and_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_AND __sync_fetch_and_and_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_OR __sync_fetch_and_or_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_OR __sync_fetch_and_or_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_OR_THEN_GET __sync_or_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_OR_THEN_GET __sync_or_and_fetch_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_4 +# define Z_COMPILER_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_4 +# define Z_COMPILER_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_4 +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_AND_THEN_GET __sync_and_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_AND_THEN_GET __sync_and_and_fetch_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_AND __sync_fetch_and_and_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_AND __sync_fetch_and_and_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_OR __sync_fetch_and_or_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_OR __sync_fetch_and_or_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_OR_THEN_GET __sync_or_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_OR_THEN_GET __sync_or_and_fetch_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_8 +# define Z_COMPILER_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_8 +# define Z_COMPILER_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_8 +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET __sync_add_and_fetch_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_AND_THEN_GET __sync_and_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_AND_THEN_GET __sync_and_and_fetch_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD __sync_fetch_and_add_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_AND __sync_fetch_and_and_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_AND __sync_fetch_and_and_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND __sync_fetch_and_nand_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_OR __sync_fetch_and_or_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_OR __sync_fetch_and_or_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL __sync_val_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT __sync_fetch_and_sub_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR __sync_fetch_and_xor_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET __sync_nand_and_fetch_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_OR_THEN_GET __sync_or_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_OR_THEN_GET __sync_or_and_fetch_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL __sync_bool_compare_and_swap_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET __sync_sub_and_fetch_16 +# define Z_COMPILER_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_16 +# define Z_COMPILER_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET __sync_xor_and_fetch_16 +#endif + +/* MARK: - Built-ins: Traits */ + +/*#define Z_COMPILER_TRAIT_SELECT_TYPE(I, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_DIMENSION_COUNT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_ELEMENT_COUNT(T, dimension_index)*/ +/*#define Z_COMPILER_TRAIT_TYPE_HAS_UNIQUE_OBJECT_REPRESENTATIONS(T)*/ +#define Z_COMPILER_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR __has_virtual_destructor +#define Z_COMPILER_TRAIT_TYPE_IS_ABSTRACT __is_abstract +/*#define Z_COMPILER_TRAIT_TYPE_IS_AGGREGATE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARITHMETIC(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARRAY(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ASSIGNABLE(T, from_type)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_BASE __is_base_of +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPLETE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPOUND(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONST(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONVERTIBLE(T, to_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DATA_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DESTRUCTIBLE(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_EMPTY __is_empty +#define Z_COMPILER_TRAIT_TYPE_IS_ENUMERATION __is_enum +/*#define Z_COMPILER_TRAIT_TYPE_IS_FINAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTEGRAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTERFACE_CLASS(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FLOATING_POINT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNCTION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNDAMENTAL(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_LITERAL __is_literal_type +/*#define Z_COMPILER_TRAIT_TYPE_IS_LVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_FUNCTION_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE(T, ...)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE __has_nothrow_assign +#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE __has_nothrow_copy +#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE __has_nothrow_constructor +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_MOVE_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_OBJECT(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_POD __is_pod +/*#define Z_COMPILER_TRAIT_TYPE_IS_POINTER(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_POLYMORPHIC __is_polymorphic +/*#define Z_COMPILER_TRAIT_TYPE_IS_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_RVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SAME(T, as_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SCALAR(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SEALED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SIGNED(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_STD_LAYOUT __is_standard_layout +#define Z_COMPILER_TRAIT_TYPE_IS_STRUCTURE __is_class +#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIAL __is_trivial +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE(T, ...)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE __has_trivial_assign +#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE __has_trivial_copy +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE(T)*/ +#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE __has_trivial_constructor +#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE __has_trivial_destructor +#define Z_COMPILER_TRAIT_TYPE_IS_UNION __is_union +/*#define Z_COMPILER_TRAIT_TYPE_IS_UNSIGNED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOID(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOLATILE(T)*/ +#define Z_COMPILER_TRAIT_TYPE_UNDERLYING_TYPE __underlying_type + +/* +__integer_pack (length) +*/ + +#define Z_COMPILER_HAS_MAGIC_CONSTANT_MANGLED_FUNCTION_NAME 1 + +#endif /* Z_inspection_compiler_modules_GCC_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/MSVC.h b/projects/Zeta/API/Z/inspection/compiler/modules/MSVC.h new file mode 100644 index 0000000..6bdd905 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/MSVC.h @@ -0,0 +1,921 @@ +/* Zeta API - Z/inspection/compiler/modules/Clang.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_MSVC_H + +/* MARK: - Identification */ + +#define Z_COMPILER_IS_MSVC 1 +#define Z_COMPILER_NAME Z_COMPILER_NAME_MSVC + +#if _MSC_VER == 800 +# define Z_COMPILER_VERSION Z_VERSION(1,0,0) + +#elif _MSC_VER == 900 +# define Z_COMPILER_VERSION Z_VERSION(2,0,0) + +#elif _MSC_VER == 1000 /* Developer Studio v4.0 */ +# define Z_COMPILER_VERSION Z_VERSION(4,0,0) + +#elif _MSC_VER == 1020 /* Developer Studio v4.2 */ +# define Z_COMPILER_VERSION Z_VERSION(4,2,0) + +#elif _MSC_VER == 1100 /* Visual Studio 97 v5.0 */ +# define Z_COMPILER_VERSION Z_VERSION(5,0,0) + +#elif _MSC_VER == 1200 /* Visual Studio 6.0 v6.0 */ +# define Z_COMPILER_VERSION Z_VERSION(6,0,0) + +#elif _MSC_VER == 1300 /* Visual Studio .NET 2002 v7.0 */ +# define Z_COMPILER_VERSION Z_VERSION(7,0,0) + +#elif _MSC_VER == 1310 /* Visual Studio .NET 2003 v7.1 */ +# define Z_COMPILER_VERSION Z_VERSION(7,1,0) + +#elif _MSC_VER == 1400 /* Visual Studio 2005 v8.0 */ +# define Z_COMPILER_VERSION Z_VERSION(8,0,0) + +#elif _MSC_VER == 1500 /* Visual Studio 2008 v9.0 */ +# define Z_COMPILER_VERSION Z_VERSION(9,0,0) + +#elif _MSC_VER == 1600 /* Visual Studio 2010 v10.0 */ +# define Z_COMPILER_VERSION Z_VERSION(10,0,0) + +#elif _MSC_VER == 1700 /* Visual Studio 2012 v11.0 */ +# define Z_COMPILER_VERSION Z_VERSION(11,0,0) + +#elif _MSC_VER == 1800 /* Visual Studio 2013 v12.0 */ +# define Z_COMPILER_VERSION Z_VERSION(12,0,0) + +#elif _MSC_VER == 1900 /* Visual Studio 2015 v14.0 */ +# define Z_COMPILER_VERSION Z_VERSION(14,0,0) + +#elif _MSC_VER == 1910 /* Visual Studio 2017 v15.0 */ +# define Z_COMPILER_VERSION Z_VERSION(14,1,0) + +#elif _MSC_VER == 1911 /* Visual Studio 2017 v15.3 */ +# define Z_COMPILER_VERSION Z_VERSION(14,11,0) + +#elif _MSC_VER == 1912 /* Visual Studio 2017 v15.5 */ +# define Z_COMPILER_VERSION Z_VERSION(14,12,0) + +#elif _MSC_VER == 1913 /* Visual Studio 2017 v15.6 */ +# define Z_COMPILER_VERSION Z_VERSION(14,13,0) + +#elif _MSC_VER == 1914 /* Visual Studio 2017 v15.7 */ +# define Z_COMPILER_VERSION Z_VERSION(14,14,0) + +#elif _MSC_VER == 1915 /* Visual Studio 2017 v15.8 */ +# define Z_COMPILER_VERSION Z_VERSION(14,15,0) + +#elif _MSC_VER == 1916 /* Visual Studio 2017 v15.9 */ +# define Z_COMPILER_VERSION Z_VERSION(14,16,0) + +#elif _MSC_VER == 1920 /* Visual Studio 2019 v16.0 */ +# define Z_COMPILER_VERSION Z_VERSION(14,2,0) + +#elif _MSC_VER == 1921 /* Visual Studio 2019 v16.1 */ +# define Z_COMPILER_VERSION Z_VERSION(14,21,0) + +#elif _MSC_VER == 1922 /* Visual Studio 2019 v16.2 */ +# define Z_COMPILER_VERSION Z_VERSION(14,22,0) + +#elif _MSC_VER >= 1923 /* Visual Studio 2019 v16.3 */ +# define Z_COMPILER_VERSION Z_VERSION(14,23,0) +#endif + +/* MARK: - ISA */ + +#if defined(_M_AMD64) || defined(_M_X64) +# define Z_COMPILER_ISA Z_ISA_X86_64 + +#elif defined(_M_IX86) +# define Z_COMPILER_ISA Z_ISA_X86_32 + +#elif defined(_M_ARM64) +# define Z_COMPILER_ISA Z_ISA_AARCH64 + +#elif defined(_M_ARM) +# define Z_COMPILER_ISA Z_ISA_AARCH32 + +#elif defined(_M_ALPHA) +# define Z_COMPILER_ISA Z_ISA_ALPHA + +#elif defined(_M_IA64) +# define Z_COMPILER_ISA Z_ISA_ITANIUM + +#elif defined(_M_MRX000) +# define Z_COMPILER_ISA Z_ISA_MIPS + +#elif defined(_M_MPPC) defined(_M_PPC) +# define Z_COMPILER_ISA Z_ISA_POWERPC_32BIT +#endif + +/*#define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS*/ + +/* MARK: - Platform */ + +#if defined(_M_MPPC) +# define Z_COMPILER_PLATFORM Z_PLATFORM_MACINTOSH +#endif + +/* MARK: - OS */ + +/*#define Z_COMPIER_OS*/ + +/* MARK: - Bit field order */ + +/*#define Z_COMPILER_BIT_FIELD_ORDER_ALL*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_8BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_16BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_32BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_64BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_128BIT*/ + +/* MARK: - Data model */ + +/*#define Z_COMPILER_DATA_MODEL*/ + +/* MARK: - Floating-point */ + +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X*/ + +/* MARK: - Language: C78 */ + +/*#define Z_COMPILER_HAS_C_OLD_STYLE_FUNCTION*/ +#define Z_COMPILER_HAS_C_OPERATOR_SIZEOF 1 +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_AUTO*/ +#define Z_COMPILER_HAS_C_STORAGE_CLASS_EXTERN 1 +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER*/ +#define Z_COMPILER_HAS_C_STORAGE_CLASS_STATIC 1 +/*#define Z_COMPILER_HAS_C_TYPE_DOUBLE*/ +/*#define Z_COMPILER_HAS_C_TYPE_FLOAT*/ + +/* MARK: - Language: C89 */ + +/*#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE*/ +/*#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_RETURN*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_ASSIGNMENT*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_NAMESPACE*/ +#define Z_COMPILER_HAS_C89_ENUMERATION 1 +/*#define Z_COMPILER_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING*/ +/*#define Z_COMPILER_HAS_C89_FUNCTION_PROTOTYPE*/ +#define Z_COMPILER_HAS_C89_INTEGRAL_SWITCH 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_INDENTATION 1 +/*#define Z_COMPILER_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD*/ +/*#define Z_COMPILER_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE*/ +/*#define Z_COMPILER_HAS_C89_STRING_LITERAL_CONCATENATION*/ +/*#define Z_COMPILER_HAS_C89_TRIGRAPHS*/ +/*#define Z_COMPILER_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_ALERT*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_FLOAT*/ +#define Z_COMPILER_HAS_C89_LITERAL_UNSIGNED 1 +/*#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_STRING*/ +/*#define Z_COMPILER_HAS_C89_OPERATOR_UNARY_PLUS*/ +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED 1 +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_PASTING*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING*/ +/*#define Z_COMPILER_HAS_C89_TYPE_LONG_DOUBLE*/ +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_CHAR 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_LONG 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_SHORT 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID_POINTER 1 +#define Z_COMPILER_HAS_C89_TYPE_MODIFIER_SIGNED 1 +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_CONST 1 +/*#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_VOLATILE*/ + +/* MARK: - Language: C95 */ + +/*#define Z_COMPILER_HAS_C95_DIGRAPHS*/ + +/* MARK: - Language: C99 */ + +/*#define Z_COMPILER_HAS_C99_COMPOUND_LITERAL*/ +/*#define Z_COMPILER_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER*/ +/*#define Z_COMPILER_HAS_C99_CPP_STYLE_COMMENT*/ +/*#define Z_COMPILER_HAS_C99_DESIGNATED_INITIALIZATION*/ +/*#define Z_COMPILER_HAS_C99_EMPTY_MACRO_ARGUMENT*/ +/*#define Z_COMPILER_HAS_C99_EXTENDED_IDENTIFIER*/ +/*#define Z_COMPILER_HAS_C99_FLEXIBLE_ARRAY_MEMBER*/ +/*#define Z_COMPILER_HAS_C99_FOR_WITH_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS*/ +/*#define Z_COMPILER_HAS_C99_MIXED_DECLARATIONS_AND_CODE*/ +/*#define Z_COMPILER_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX*/ +/*#define Z_COMPILER_HAS_C99_RELIABLE_INTEGER_DIVISION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_INT*/ +/*#define Z_COMPILER_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_UNIVERSAL_CHARACTER_NAME*/ +/*#define Z_COMPILER_HAS_C99_VARIADIC_MACRO*/ +/*#define Z_COMPILER_HAS_C99_VLA*/ +/*#define Z_COMPILER_HAS_C99_IDENTIFIER_FUNC*/ +/*#define Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA*/ +/*#define Z_COMPILER_HAS_C99_SPECIFIER_INLINE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FENV_ACCESS*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FP_CONTRACT*/ +/*#define Z_COMPILER_HAS_C99_TYPE_BOOL*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_LONG*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIER_RESTRICT*/ + +/* MARK: - Language: C11 */ + +/*#define Z_COMPILER_HAS_C11_ANONYMOUS_STRUCTURE_AS_MEMBER*/ +/*#define Z_COMPILER_HAS_C11_ANONYMOUS_UNION_AS_MEMBER*/ +/*#define Z_COMPILER_HAS_C11_GENERIC_SELECTION*/ +/*#define Z_COMPILER_HAS_C11_STATIC_ASSERTION*/ +/*#define Z_COMPILER_HAS_C11_TYPEDEF_REDECLARATION*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_STRING*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_STRING*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_UTF8_STRING*/ +/*#define Z_COMPILER_HAS_C11_OPERATOR_ALIGNOF*/ +/*#define Z_COMPILER_HAS_C11_SPECIFIER_ALIGNAS*/ +/*#define Z_COMPILER_HAS_C11_SPECIFIER_NORETURN*/ +/*#define Z_COMPILER_HAS_C11_STORAGE_CLASS_THREAD_LOCAL*/ +/*#define Z_COMPILER_HAS_C11_TYPE_MODIFIER_ATOMIC*/ +/*#define Z_COMPILER_HAS_C11_TYPE_QUALIFIER_ATOMIC*/ + +/* MARK: - Language: Apple C extensions */ + +/*#define Z_COMPILER_HAS_APPLE_C_BLOCK_OBJECT*/ + +/* MARK: - Language: Clang C extensions */ + +/*#define Z_COMPILER_HAS_CLANG_C_PREPROCESSOR_OPERATOR_HAS_INCLUDE*/ + +#ifdef __cplusplus + + /* MARK: - Language: C++98 */ + +# ifdef _CPPUNWIND +# define Z_COMPILER_HAS_CPP98_EXCEPTIONS 1 +# endif + +# ifdef _CPPRTTI +# define Z_COMPILER_HAS_CPP98_RTTI 1 +# endif + +/*# define Z_COMPILER_HAS_CPP98_SFINAE*/ + +# if defined(__BOOL_DEFINED) && __BOOL_DEFINED == 1 +# define Z_COMPILER_HAS_CPP98_TYPE_BOOL 1 +# endif + +# ifdef _NATIVE_WCHAR_T_DEFINED +# define Z_COMPILER_HAS_CPP98_TYPE_WCHAR_T 1 +# endif + + /* MARK: - Language: C++03 */ + +/*# define Z_COMPILER_HAS_CPP03_VALUE_INITIALIZATION*/ + + /* MARK: - Language: C++11 */ + +/*# define Z_COMPILER_HAS_CPP11_ANONYMOUS_TYPE_AS_TEMPLATE_ARGUMENT*/ +/*# define Z_COMPILER_HAS_CPP11_C99_PREPROCESSOR*/ +/*# define Z_COMPILER_HAS_CPP11_COPY_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_DEFAULT_MEMBER_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP11_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_DELEGATING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP11_DELETED_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_DIRECT_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_EXPLICIT_CONVERSION_OPERATOR*/ +/*# define Z_COMPILER_HAS_CPP11_EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_EXPRESSION_SFINAE*/ +/*# define Z_COMPILER_HAS_CPP11_EXTENDED_FRIEND_DECLARATION*/ +/*# define Z_COMPILER_HAS_CPP11_EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS*/ +/*# define Z_COMPILER_HAS_CPP11_EXTERN_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_FIXED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_INHERITING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP11_INITIALIZATION_OF_CLASS_OBJECT_BY_RVALUE*/ +/*# define Z_COMPILER_HAS_CPP11_INITIALIZER_LIST*/ +/*# define Z_COMPILER_HAS_CPP11_INLINE_NAMESPACE*/ +/*# define Z_COMPILER_HAS_CPP11_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP11_LOCAL_TYPE_AS_TEMPLATE_ARGUMENT*/ +/*# define Z_COMPILER_HAS_CPP11_MOVE_SPECIAL_MEMBER_FUNCTIONS*/ +/*# define Z_COMPILER_HAS_CPP11_MULTI_DECLARATOR_AUTO*/ +/*# define Z_COMPILER_HAS_CPP11_OPAQUE_ENUMERATION_DECLARATION*/ +/*# define Z_COMPILER_HAS_CPP11_RANGE_BASED_FOR*/ +/*# define Z_COMPILER_HAS_CPP11_REFERENCE_QUALIFIED_NON_STATIC_MEMBER_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_REMOVAL_OF_AUTO_AS_STORAGE_CLASS*/ +/*# define Z_COMPILER_HAS_CPP11_RIGHT_ANGLE_BRACKETS*/ +/*# define Z_COMPILER_HAS_CPP11_RVALUE_REFERENCE*/ +/*# define Z_COMPILER_HAS_CPP11_SCOPED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_STD_LAYOUT*/ +/*# define Z_COMPILER_HAS_CPP11_STANDARDIZED_ATTRIBUTE_SYNTAX*/ +/*# define Z_COMPILER_HAS_CPP11_STATIC_ASSERTION*/ +/*# define Z_COMPILER_HAS_CPP11_THREAD_SAFE_STATIC_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_TRAILING_COMMA_ALLOWED_IN_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_TRAILING_RETURN_TYPE*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_UNIVERSAL_CHARACTER_NAME*/ +/*# define Z_COMPILER_HAS_CPP11_UNRESTRICTED_UNION*/ +/*# define Z_COMPILER_HAS_CPP11_VARIADIC_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_CARRIES_DEPENDENCY*/ +/*# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_NORETURN*/ +/*# define Z_COMPILER_HAS_CPP11_IDENTIFIER_FUNC*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_NULLPTR*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_RAW_STRING*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_USER_DEFINED*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_UTF8_STRING*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_ALIGNOF*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_NOEXCEPT*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_NON_STATIC_DATA_MEMBER*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_PARAMETER_PACK*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_ALIGNAS*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_CONSTEXPR*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_DECLTYPE*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_FINAL*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_NOEXCEPT*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_OVERRIDE*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_CASE_DECLTYPE_INCOMPLETE_RETURN_TYPE*/ +/*# define Z_COMPILER_HAS_CPP11_STORAGE_CLASS_THREAD_LOCAL*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_AUTO*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_CHAR16_T*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_CHAR32_T*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_LONG_LONG*/ + + /* MARK: - Language: C++14 */ + +/*# define Z_COMPILER_HAS_CPP14_APOSTROPHE_AS_DIGIT_SEPARATOR*/ +/*# define Z_COMPILER_HAS_CPP14_CONSTEXPR_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP14_CONTEXTUAL_CONVERSION*/ +/*# define Z_COMPILER_HAS_CPP14_DEFAULT_MEMBER_INITIALIZER_FOR_AGGREGATE*/ +/*# define Z_COMPILER_HAS_CPP14_GENERIC_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP14_INITIALIZED_LAMBDA_CAPTURE*/ +/*# define Z_COMPILER_HAS_CPP14_RETURN_TYPE_DEDUCTION_FOR_NORMAL_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP14_SIZED_DEALLOCATION*/ +/*# define Z_COMPILER_HAS_CPP14_VARIABLE_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP14_ATTRIBUTE_DEPRECATED*/ +/*# define Z_COMPILER_HAS_CPP14_LITERAL_BINARY_INTEGRAL*/ +/*# define Z_COMPILER_HAS_CPP14_SPECIFIER_CASE_DECLTYPE_AUTO*/ + + /* MARK: - Language: C++17 */ + +/*# define Z_COMPILER_HAS_CPP17_AGGREGATE_INITIALIZATION_FOR_DERIVED_CLASS*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_USING_PREFIX*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_ENUMERATOR*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_NAMESPACE*/ +/*# define Z_COMPILER_HAS_CPP17_AUTO_DEDUCTION_FROM_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP17_CONSTEXPR_IF*/ +/*# define Z_COMPILER_HAS_CPP17_CONSTEXPR_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP17_DEDUCTION_GUIDES_FOR_CLASS_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP17_DIFFERING_BEGIN_AND_END_TYPES_IN_RANGE_BASED_FOR*/ +/*# define Z_COMPILER_HAS_CPP17_DIRECT_LIST_INITIALIZATION_FOR_FIXED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP17_EXPRESSION_EVALUATION_ORDER*/ +/*# define Z_COMPILER_HAS_CPP17_FOLD_EXPRESSION*/ +/*# define Z_COMPILER_HAS_CPP17_GUARANTEED_COPY_ELISION*/ +/*# define Z_COMPILER_HAS_CPP17_IF_WITH_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP17_IGNORING_OF_UNKNOWN_ATTRIBUTES*/ +/*# define Z_COMPILER_HAS_CPP17_INHERITING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP17_INLINE_VARIABLE*/ +/*# define Z_COMPILER_HAS_CPP17_LAMBDA_CAPTURE_OF_STAR_THIS_BY_VALUE*/ +/*# define Z_COMPILER_HAS_CPP17_NESTED_NAMESPACE_DEFINITION*/ +/*# define Z_COMPILER_HAS_CPP17_NOEXCEPT_AS_PART_OF_THE_FUNCTION_TYPE*/ +/*# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_ARGUMENTS*/ +/*# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_PARAMETER_WITH_AUTO_TYPE*/ +/*# define Z_COMPILER_HAS_CPP17_OVER_ALIGNED_DYNAMIC_MEMORY_ALLOCATION*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_BOOL_INCREMENT*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_DYNAMIC_EXCEPTION_SPECIFICATION*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_REGISTER_AS_STORAGE_CLASS*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_TRIGRAPHS*/ +/*# define Z_COMPILER_HAS_CPP17_SAFE_UNARY_FOLD_EXPRESSION*/ +/*# define Z_COMPILER_HAS_CPP17_STATIC_ASSERTION_WITH_NO_MESSAGE*/ +/*# define Z_COMPILER_HAS_CPP17_STRUCTURED_BINDING*/ +/*# define Z_COMPILER_HAS_CPP17_SWITCH_WITH_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP17_TEMPLATE_TEMPLATE_ARGUMENT_MATCHING*/ +/*# define Z_COMPILER_HAS_CPP17_TYPENAME_IN_TEMPLATE_TEMPLATE_PARAMETER*/ +/*# define Z_COMPILER_HAS_CPP17_VARIADIC_USING*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_FALLTHROUGH*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_MAYBE_UNUSED*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_NODISCARD*/ +/*# define Z_COMPILER_HAS_CPP17_LITERAL_HEXADECIMAL_FLOATING_POINT*/ +/*# define Z_COMPILER_HAS_CPP17_LITERAL_UTF8_CHARACTER*/ +/*# define Z_COMPILER_HAS_CPP17_PREPROCESSOR_OPERATOR_HAS_INCLUDE*/ + +#endif + +/* MARK: - Language: Implementation-defined */ + +/*#define Z_COMPILER_HAS_ARITHMETIC_RIGHT_SHIFT*/ + +/* MARK: - Non-standard language: Attributes */ + +/*#define Z_COMPILER_ATTRIBUTE_ALIAS*/ +#define Z_COMPILER_ATTRIBUTE_API_EXPORT __declspec(dllexport) +#define Z_COMPILER_ATTRIBUTE_API_IMPORT __declspec(dllimport) +/*#define Z_COMPILER_ATTRIBUTE_API_WEAK_EXPORT*/ +/*#define Z_COMPILER_ATTRIBUTE_EBCO*/ +#define Z_COMPILER_ATTRIBUTE_ALWAYS_INLINE __forceinline /* _forceinline in old versions */ +#define Z_COMPILER_ATTRIBUTE_INLINE __inline /* _inline in old versions */ +#define Z_COMPILER_ATTRIBUTE_MICROSOFT_STD_CALL __stdcall +/*#define Z_COMPILER_ATTRIBUTE_NO_RETURN*/ +/*#define Z_COMPILER_ATTRIBUTE_NULL_TERMINATED*/ +/*#define Z_COMPILER_ATTRIBUTE_PRIVATE*/ +/*#define Z_COMPILER_ATTRIBUTE_PUBLIC*/ +#define Z_COMPILER_ATTRIBUTE_THREAD_LOCAL __declspec(thread) +/*#define Z_COMPILER_ATTRIBUTE_WEAK*/ + +/* MARK: - Non-standard language: Structure padding */ + +#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT __pragma(pack(push, 1)) +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY*/ +#define Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY __pragma(pack(pop)) +#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION __pragma(pack(push, 1)) +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY*/ +#define Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY __pragma(pack(pop)) +#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT __pragma(pack(push, 1)) +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY*/ +#define Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY __pragma(pack(pop)) +#define Z_COMPILER_PACKED_UNION_BEFORE_UNION __pragma(pack(push, 1)) +/*#define Z_COMPILER_PACKED_UNION_BEFORE_BODY*/ +#define Z_COMPILER_PACKED_UNION_AFTER_BODY __pragma(pack(pop)) + +/* MARK: - Built-ins: Types and literal suffixes */ + +#define Z_COMPILER_TYPE_UINT8 unsigned __int8 +#define Z_COMPILER_TYPE_SINT8 __int8 +#define Z_COMPILER_TYPE_UINT16 unsigned __int16 +#define Z_COMPILER_TYPE_SINT16 __int16 +/*#define Z_COMPILER_TYPE_UINT24*/ +/*#define Z_COMPILER_TYPE_SINT24*/ +#define Z_COMPILER_TYPE_UINT32 unsigned __int32 +#define Z_COMPILER_TYPE_SINT32 __int32 +/*#define Z_COMPILER_TYPE_UINT40*/ +/*#define Z_COMPILER_TYPE_SINT40*/ +/*#define Z_COMPILER_TYPE_UINT48*/ +/*#define Z_COMPILER_TYPE_SINT48*/ +/*#define Z_COMPILER_TYPE_UINT56*/ +/*#define Z_COMPILER_TYPE_SINT56*/ +#define Z_COMPILER_TYPE_UINT64 unsigned __int64 +#define Z_COMPILER_TYPE_SINT64 __int64 +/*#define Z_COMPILER_TYPE_UINT128*/ +/*#define Z_COMPILER_TYPE_SINT128*/ +/*#define Z_COMPILER_TYPE_BFP16*/ +/*#define Z_COMPILER_TYPE_BFP32*/ +/*#define Z_COMPILER_TYPE_BFP64*/ +/*#define Z_COMPILER_TYPE_BFP128*/ +/*#define Z_COMPILER_TYPE_DFP32*/ +/*#define Z_COMPILER_TYPE_DFP64*/ +/*#define Z_COMPILER_TYPE_DFP128*/ +/*#define Z_COMPILER_TYPE_X87_DE80*/ +/*#define Z_COMPILER_TYPE_X87_DE96*/ +/*#define Z_COMPILER_TYPE_X87_DE128*/ +/*#define Z_COMPILER_TYPE_IBM_ED*/ +/*#define Z_COMPILER_TYPE_BFLOAT16*/ +/*#define Z_COMPILER_TYPE_VAL*/ +/*#define Z_COMPILER_LITERAL_UINT8(number)*/ +/*#define Z_COMPILER_LITERAL_SINT8(number)*/ +/*#define Z_COMPILER_LITERAL_UINT16(number)*/ +/*#define Z_COMPILER_LITERAL_SINT16(number)*/ +/*#define Z_COMPILER_LITERAL_UINT24(number)*/ +/*#define Z_COMPILER_LITERAL_SINT24(number)*/ +/*#define Z_COMPILER_LITERAL_UINT32(number)*/ +/*#define Z_COMPILER_LITERAL_SINT32(number)*/ +/*#define Z_COMPILER_LITERAL_UINT40(number)*/ +/*#define Z_COMPILER_LITERAL_SINT40(number)*/ +/*#define Z_COMPILER_LITERAL_UINT48(number)*/ +/*#define Z_COMPILER_LITERAL_SINT48(number)*/ +/*#define Z_COMPILER_LITERAL_UINT56(number)*/ +/*#define Z_COMPILER_LITERAL_SINT56(number)*/ +#define Z_COMPILER_LITERAL_UINT64 Z_SUFFIX_Ui64 +#define Z_COMPILER_LITERAL_SINT64 Z_SUFFIX_i64 +/*#define Z_COMPILER_LITERAL_UINT128(number)*/ +/*#define Z_COMPILER_LITERAL_SINT128(number)*/ +/*#define Z_COMPILER_LITERAL_BFP16(number)*/ +/*#define Z_COMPILER_LITERAL_BFP32(number)*/ +/*#define Z_COMPILER_LITERAL_BFP64(number)*/ +/*#define Z_COMPILER_LITERAL_BFP128(number)*/ +/*#define Z_COMPILER_LITERAL_DFP32(number)*/ +/*#define Z_COMPILER_LITERAL_DFP64(number)*/ +/*#define Z_COMPILER_LITERAL_DFP128(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE80(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE96(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE128(number)*/ +/*#define Z_COMPILER_LITERAL_IBM_ED(number)*/ +/*#define Z_COMPILER_LITERAL_BFLOAT16(number)*/ + +/* MARK: - Built-ins: Constants */ + +/*#define Z_COMPILER_CONSTANT_CHAR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SHORT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SHORT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_USHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_INT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_INT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_LONG_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LONG_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_ULONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_LLONG_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LLONG_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_ULLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SIZE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SIZE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_USIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_SNAN*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_HUGE*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_QNAN*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_HUGE*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_QNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_POINTER_SIZE*/ +/*#define Z_COMPILER_CONSTANT_POINTER_WIDTH*/ + +/* MARK: - Built-ins: Macros */ + +/*#define Z_COMPILER_MACRO_MEMBER_OFFSET(type, member)*/ +/*#define Z_COMPILER_MACRO_VAL_INITIALIZE(self, last_parameter)*/ +/*#define Z_COMPILER_MACRO_VAL_FINALIZE(self)*/ +/*#define Z_COMPILER_MACRO_VAL_READ(self, type)*/ +/*#define Z_COMPILER_MACRO_VAL_COPY(self, output)*/ + +/* MARK: - Built-ins: Functions */ + +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET(value, operand)*/ + +/* MARK: - Built-ins: Traits */ + +/*#define Z_COMPILER_TRAIT_SELECT_TYPE(I, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_DIMENSION_COUNT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_ELEMENT_COUNT(T, dimension_index)*/ +/*#define Z_COMPILER_TRAIT_TYPE_HAS_UNIQUE_OBJECT_REPRESENTATIONS(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ABSTRACT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_AGGREGATE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARITHMETIC(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARRAY(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_BASE(T, of_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPLETE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPOUND(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONST(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONVERTIBLE(T, to_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DATA_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_EMPTY(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ENUMERATION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FINAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTEGRAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTERFACE_CLASS(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FLOATING_POINT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNCTION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNDAMENTAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_LITERAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_LVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_FUNCTION_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_MOVE_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_OBJECT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POD(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POLYMORPHIC(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_RVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SAME(T, as_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SCALAR(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SEALED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SIGNED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_STD_LAYOUT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_STRUCTURE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_UNION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_UNSIGNED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOID(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOLATILE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_UNDERLYING_TYPE(T)*/ + +#endif /* Z_inspection_compiler_modules_MSVC_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/TinyCC.h b/projects/Zeta/API/Z/inspection/compiler/modules/TinyCC.h new file mode 100644 index 0000000..933eb33 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/TinyCC.h @@ -0,0 +1,197 @@ +/* Zeta API - Z/inspection/compiler/modules/TinyCC.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_TinyCC_H +#define Z_inspection_compiler_modules_TinyCC_H + +/* MARK: - Identification */ + +#define Z_COMPILER_IS_TINY_CC 1 +#define Z_COMPILER_NAME Z_COMPILER_NAME_TINY_CC + +#define Z_COMPILER_VERSION \ + Z_VERSION(__TINYC__ / 1000, (__TINYC__ % 1000) / 100, __TINYC__ % 100) + +/*#define Z_COMPILER_VERSION_STRING*/ + +/* MARK: - ISA */ + +#if defined(__x86_64__) +# define Z_COMPILER_ISA Z_ISA_X86_64 + +#elif defined(__i386 ) \ + defined(__i386__) \ + defined(i386 ) + +# define Z_COMPILER_ISA Z_ISA_X86_32 + +#elif defined(__aarch64__) +# define Z_COMPILER_ISA Z_ISA_AARCH64 + +#elif defined(__arm ) \ + defined(__arm__) \ + defined(arm ) + +# define Z_COMPILER_ISA Z_ISA_AARCH32 + +#elif defined(__C67__) +/*# define Z_COMPILER_ISA Z_ISA_C67*/ +#endif + +#ifdef __ARMEL__ +# define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE +#endif + +/* MARK: - OS */ + +#if defined(__linux ) || \ + defined(__linux__) + +# define Z_COMPILER_OS Z_OS_LINUX + +#elif defined(_WIN32) || \ + defined(_WIN64) + +# define Z_COMPILER_OS Z_OS_WINDOWS + +#elif defined(__FreeBSD__ ) || \ + defined(__FreeBSD_kernel__) + +# define Z_COMPILER_OS Z_OS_FREE_BSD + +#elif defined(__NetBSD__) +# define Z_COMPILER_OS Z_OS_NET_BSD + +#elif defined(__OpenBSD__) +# define Z_COMPILER_OS Z_OS_OPEN_BSD +#endif + +/* MARK: - Bit field order */ + +/*#define Z_COMPILER_BIT_FIELD_ORDER_ALL*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_8BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_16BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_32BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_64BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_128BIT*/ + +/* MARK: - Data model */ + +#if defined(__ILP32__) +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_ILP32 + +#elif defined(__LLP64__) +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LLP64 + +#elif defined(__LP64__) +# define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_LP64 +#endif + +/* MARK: - Language: C78 */ + +/*#define Z_COMPILER_HAS_C_OLD_STYLE_FUNCTION*/ +#define Z_COMPILER_HAS_C_OPERATOR_SIZEOF 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_AUTO 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_EXTERN 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER 1 +#define Z_COMPILER_HAS_C_STORAGE_CLASS_STATIC 1 +#define Z_COMPILER_HAS_C_TYPE_DOUBLE 1 +#define Z_COMPILER_HAS_C_TYPE_FLOAT 1 + +/* MARK: - Language: C89 */ + +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE 1 +#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_RETURN 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_ASSIGNMENT 1 +#define Z_COMPILER_HAS_C89_CONSTRUCT_NAMESPACE 1 +#define Z_COMPILER_HAS_C89_ENUMERATION 1 +#define Z_COMPILER_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING 1 +#define Z_COMPILER_HAS_C89_FUNCTION_PROTOTYPE 1 +#define Z_COMPILER_HAS_C89_INTEGRAL_SWITCH 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_INDENTATION 1 +#define Z_COMPILER_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD 1 +#define Z_COMPILER_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE 1 +#define Z_COMPILER_HAS_C89_STRING_LITERAL_CONCATENATION 1 +#define Z_COMPILER_HAS_C89_TRIGRAPHS 1 +#define Z_COMPILER_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_ALERT 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL 1 +#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB 1 +#define Z_COMPILER_HAS_C89_LITERAL_FLOAT 1 +#define Z_COMPILER_HAS_C89_LITERAL_UNSIGNED 1 +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_CHARACTER 1 +#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_STRING 1 +#define Z_COMPILER_HAS_C89_OPERATOR_UNARY_PLUS 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_PASTING 1 +#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING 1 +#define Z_COMPILER_HAS_C89_TYPE_LONG_DOUBLE 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_CHAR 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_LONG 1 +#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_SHORT 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID 1 +#define Z_COMPILER_HAS_C89_TYPE_VOID_POINTER 1 +#define Z_COMPILER_HAS_C89_TYPE_MODIFIER_SIGNED 1 +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_CONST 1 +#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_VOLATILE 1 + +/* MARK: - Language: C95 */ + +/*#define Z_COMPILER_HAS_C95_DIGRAPHS*/ + +/* MARK: - Language: C99 */ + +/*#define Z_COMPILER_HAS_C99_COMPOUND_LITERAL*/ +/*#define Z_COMPILER_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER*/ +/*#define Z_COMPILER_HAS_C99_CPP_STYLE_COMMENT*/ +/*#define Z_COMPILER_HAS_C99_DESIGNATED_INITIALIZATION*/ +/*#define Z_COMPILER_HAS_C99_EMPTY_MACRO_ARGUMENT*/ +/*#define Z_COMPILER_HAS_C99_EXTENDED_IDENTIFIER*/ +/*#define Z_COMPILER_HAS_C99_FLEXIBLE_ARRAY_MEMBER*/ +/*#define Z_COMPILER_HAS_C99_FOR_WITH_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS*/ +/*#define Z_COMPILER_HAS_C99_MIXED_DECLARATIONS_AND_CODE*/ +/*#define Z_COMPILER_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX*/ +/*#define Z_COMPILER_HAS_C99_RELIABLE_INTEGER_DIVISION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_INT*/ +/*#define Z_COMPILER_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_UNIVERSAL_CHARACTER_NAME*/ +/*#define Z_COMPILER_HAS_C99_VARIADIC_MACRO*/ +/*#define Z_COMPILER_HAS_C99_VLA*/ +/*#define Z_COMPILER_HAS_C99_IDENTIFIER_FUNC*/ +/*#define Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA*/ +/*#define Z_COMPILER_HAS_C99_SPECIFIER_INLINE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FENV_ACCESS*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FP_CONTRACT*/ +/*#define Z_COMPILER_HAS_C99_TYPE_BOOL*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_LONG*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIER_RESTRICT*/ + +#endif /* Z_inspection_compiler_modules_TinyCC_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/cc65.h b/projects/Zeta/API/Z/inspection/compiler/modules/cc65.h new file mode 100644 index 0000000..46d49d7 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/cc65.h @@ -0,0 +1,104 @@ +/* Zeta API - Z/inspection/compiler/modules/cc65.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_cc65_H +#define Z_inspection_compiler_modules_cc65_H + +/* MARK: - Identification */ + +#define Z_COMPILER_IS_CC65 1 +#define Z_COMPILER_NAME Z_COMPILER_NAME_CC65 + +#define Z_COMPILER_VERSION \ + Z_VERSION((__C65__ & 0xF00) >> 16, (__C65__ & 0xF0) >> 8, __C65__ & 0xF) + +/* MARK: - ISA */ + +#define Z_COMPILER_ISA Z_ISA_6502 +#define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS Z_ENDIANNESS_LITTLE + +/* MARK: - Platform */ + +#if defined(__APPLE2__) || (__APPLE2ENH__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_APPLE_II + +#elif defined(__ATARI2600__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_ATARI_2600 + +#elif defined(__ATARI5200__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_ATARI_5200 + +#elif defined(__ATMOS__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_ATMOS + +#elif defined(__BBC__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_BBC_MICRO + +#elif defined(__CBM610__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_CBM_IIB + +#elif defined(__CBM510__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_CBM_IIP + +#elif defined(__OSIC1P__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_CHALLENGER_1P + +#elif defined(__CX16__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_COMMANDER_X16 + +#elif defined(__C16__) || !defined(__PLUS4__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_COMMODORE_16 + +#elif defined(__C64__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_COMMODORE_64 + +#elif defined(__C128__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_COMMODORE_128 + +#elif defined(__CREATIVISION__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_CREATIVISION + +#elif defined(__GAMATE__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_GAMATE + +#elif defined(__LYNX__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_LYNX + +#elif defined(__NES__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_NES + +#elif defined(__PCE__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_PC_ENGINE + +#elif defined(__PLUS4__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_PLUS_4 + +#elif defined(__PET__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_PET + +#elif defined(__SUPERVISION__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_SUPERVISION + +/*#elif defined(__TELESTRAT__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_TELESTRAT*/ + +#elif defined(__VIC20__) +# define Z_COMPILER_PLATFORM Z_PLATFORM_VIC_20 +#endif + +/* MARK: - OS */ + +#if defined(__LUNIX__) +# define Z_COMPIER_OS Z_OS_LUNIX +#endif + +/* MARK: - Data model */ + +#define Z_COMPILER_DATA_MODEL Z_DATA_MODEL_IP16L32 + +#endif /* Z_inspection_compiler_modules_cc65_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/generic.h b/projects/Zeta/API/Z/inspection/compiler/modules/generic.h new file mode 100644 index 0000000..1d6abc5 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/generic.h @@ -0,0 +1,14 @@ +/* Zeta API - Z/inspection/compiler/modules/generic.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_generic_H +#define Z_inspection_compiler_modules_generic_H + + + +#endif /* Z_inspection_compiler_modules_generic_H */ diff --git a/projects/Zeta/API/Z/inspection/compiler/modules/template.h b/projects/Zeta/API/Z/inspection/compiler/modules/template.h new file mode 100644 index 0000000..eaa18fa --- /dev/null +++ b/projects/Zeta/API/Z/inspection/compiler/modules/template.h @@ -0,0 +1,810 @@ +/* Zeta API - Z/inspection/compiler/modules/template.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_compiler_modules_template_H +#define Z_inspection_compiler_modules_template_H + +/* MARK: - Identification */ + +/*#define Z_COMPILER_IS_*/ +/*#define Z_COMPILER_NAME*/ +/*#define Z_COMPILER_VERSION*/ +/*#define Z_COMPILER_VERSION_STRING*/ + +/* MARK: - ISA */ + +/*#define Z_COMPILER_ISA*/ +/*#define Z_COMPILER_ISA_INTEGRAL_ENDIANNESS*/ + +/* MARK: - Platform */ + +/*#define Z_COMPILER_PLATFORM*/ + +/* MARK: - OS */ + +/*#define Z_COMPIER_OS*/ + +/* MARK: - Bit field order */ + +/*#define Z_COMPILER_BIT_FIELD_ORDER_ALL*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_8BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_16BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_32BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_64BIT*/ +/*#define Z_COMPILER_BIT_FIELD_ORDER_128BIT*/ + +/* MARK: - Data model */ + +/*#define Z_COMPILER_DATA_MODEL*/ + +/* MARK: - Floating-point */ + +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X*/ +/*#define Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X*/ + +/* MARK: - Language: C78 */ + +/*#define Z_COMPILER_HAS_C_OLD_STYLE_FUNCTION*/ +/*#define Z_COMPILER_HAS_C_OPERATOR_SIZEOF*/ +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_AUTO*/ +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_EXTERN*/ +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_REGISTER*/ +/*#define Z_COMPILER_HAS_C_STORAGE_CLASS_STATIC*/ +/*#define Z_COMPILER_HAS_C_TYPE_DOUBLE*/ +/*#define Z_COMPILER_HAS_C_TYPE_FLOAT*/ + +/* MARK: - Language: C89 */ + +/*#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE*/ +/*#define Z_COMPILER_HAS_C89_CONSTANT_INITIALIZATION_FOR_UNION*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_AS_FUNCTION_ARGUMENT*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_RETURN*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_ASSIGNMENT*/ +/*#define Z_COMPILER_HAS_C89_CONSTRUCT_NAMESPACE*/ +/*#define Z_COMPILER_HAS_C89_ENUMERATION*/ +/*#define Z_COMPILER_HAS_C89_FUNCTION_POINTER_AUTODEREFERENCING*/ +/*#define Z_COMPILER_HAS_C89_FUNCTION_PROTOTYPE*/ +/*#define Z_COMPILER_HAS_C89_INTEGRAL_SWITCH*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_INDENTATION*/ +/*#define Z_COMPILER_HAS_C89_REMOVAL_OF_ENTRY_AS_KEYWORD*/ +/*#define Z_COMPILER_HAS_C89_REMOVAL_OF_LONG_FLOAT_AS_TYPE*/ +/*#define Z_COMPILER_HAS_C89_STRING_LITERAL_CONCATENATION*/ +/*#define Z_COMPILER_HAS_C89_TRIGRAPHS*/ +/*#define Z_COMPILER_HAS_C89_VALUE_PRESERVING_UNSIGNED_CONVERSION*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_ALERT*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_HEXADECIMAL*/ +/*#define Z_COMPILER_HAS_C89_ESCAPE_SEQUENCE_VERTICAL_TAB*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_FLOAT*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_UNSIGNED*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C89_LITERAL_WCHAR_T_STRING*/ +/*#define Z_COMPILER_HAS_C89_OPERATOR_UNARY_PLUS*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_NULL*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ELIF*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_ERROR*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_LINE*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_DIRECTIVE_PRAGMA*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_DEFINED*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_PASTING*/ +/*#define Z_COMPILER_HAS_C89_PREPROCESSOR_OPERATOR_STRINGIZING*/ +/*#define Z_COMPILER_HAS_C89_TYPE_LONG_DOUBLE*/ +/*#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_CHAR*/ +/*#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_LONG*/ +/*#define Z_COMPILER_HAS_C89_TYPE_UNSIGNED_SHORT*/ +/*#define Z_COMPILER_HAS_C89_TYPE_VOID*/ +/*#define Z_COMPILER_HAS_C89_TYPE_VOID_POINTER*/ +/*#define Z_COMPILER_HAS_C89_TYPE_MODIFIER_SIGNED*/ +/*#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_CONST*/ +/*#define Z_COMPILER_HAS_C89_TYPE_QUALIFIER_VOLATILE*/ + +/* MARK: - Language: C95 */ + +/*#define Z_COMPILER_HAS_C95_DIGRAPHS*/ + +/* MARK: - Language: C99 */ + +/*#define Z_COMPILER_HAS_C99_COMPOUND_LITERAL*/ +/*#define Z_COMPILER_HAS_C99_CONVERSION_OF_NON_LVALUE_ARRAY_TO_POINTER*/ +/*#define Z_COMPILER_HAS_C99_CPP_STYLE_COMMENT*/ +/*#define Z_COMPILER_HAS_C99_DESIGNATED_INITIALIZATION*/ +/*#define Z_COMPILER_HAS_C99_EMPTY_MACRO_ARGUMENT*/ +/*#define Z_COMPILER_HAS_C99_EXTENDED_IDENTIFIER*/ +/*#define Z_COMPILER_HAS_C99_FLEXIBLE_ARRAY_MEMBER*/ +/*#define Z_COMPILER_HAS_C99_FOR_WITH_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_IDEMPOTENT_TYPE_QUALIFIERS*/ +/*#define Z_COMPILER_HAS_C99_MIXED_DECLARATIONS_AND_CODE*/ +/*#define Z_COMPILER_HAS_C99_NON_CONSTANT_INITIALIZATION_FOR_LOCAL_AGGREGATE*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_ARITHMETIC_DONE_IN_INTMAX*/ +/*#define Z_COMPILER_HAS_C99_RELIABLE_INTEGER_DIVISION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_ILL_FORMED_RETURN*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_FUNCTION_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_REMOVAL_OF_IMPLICIT_INT*/ +/*#define Z_COMPILER_HAS_C99_STATIC_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_TRAILING_COMMA_ALLOWED_IN_ENUMERATION*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIERS_IN_ARRAY_PARAMETER_DECLARATION*/ +/*#define Z_COMPILER_HAS_C99_UNIVERSAL_CHARACTER_NAME*/ +/*#define Z_COMPILER_HAS_C99_VARIADIC_MACRO*/ +/*#define Z_COMPILER_HAS_C99_VLA*/ +/*#define Z_COMPILER_HAS_C99_IDENTIFIER_FUNC*/ +/*#define Z_COMPILER_HAS_C99_LITERAL_HEXADECIMAL_FLOATING_POINT*/ +/*#define Z_COMPILER_HAS_C99_PREPROCESSOR_OPERATOR_PRAGMA*/ +/*#define Z_COMPILER_HAS_C99_SPECIFIER_INLINE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_CX_LIMITED_RANGE*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FENV_ACCESS*/ +/*#define Z_COMPILER_HAS_C99_STD_PRAGMA_FP_CONTRACT*/ +/*#define Z_COMPILER_HAS_C99_TYPE_BOOL*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_FLOAT_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_DOUBLE_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_LONG_LONG*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_COMPLEX*/ +/*#define Z_COMPILER_HAS_C99_TYPE_MODIFIER_IMAGINARY*/ +/*#define Z_COMPILER_HAS_C99_TYPE_QUALIFIER_RESTRICT*/ + +/* MARK: - Language: C11 */ + +/*#define Z_COMPILER_HAS_C11_ANONYMOUS_STRUCTURE_AS_MEMBER*/ +/*#define Z_COMPILER_HAS_C11_ANONYMOUS_UNION_AS_MEMBER*/ +/*#define Z_COMPILER_HAS_C11_GENERIC_SELECTION*/ +/*#define Z_COMPILER_HAS_C11_STATIC_ASSERTION*/ +/*#define Z_COMPILER_HAS_C11_TYPEDEF_REDECLARATION*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR16_T_STRING*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_CHARACTER*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_CHAR32_T_STRING*/ +/*#define Z_COMPILER_HAS_C11_LITERAL_UTF8_STRING*/ +/*#define Z_COMPILER_HAS_C11_OPERATOR_ALIGNOF*/ +/*#define Z_COMPILER_HAS_C11_SPECIFIER_ALIGNAS*/ +/*#define Z_COMPILER_HAS_C11_SPECIFIER_NORETURN*/ +/*#define Z_COMPILER_HAS_C11_STORAGE_CLASS_THREAD_LOCAL*/ +/*#define Z_COMPILER_HAS_C11_TYPE_MODIFIER_ATOMIC*/ +/*#define Z_COMPILER_HAS_C11_TYPE_QUALIFIER_ATOMIC*/ + +/* MARK: - Language: Apple C extensions */ + +/*#define Z_COMPILER_HAS_APPLE_C_BLOCK_OBJECT*/ + +/* MARK: - Language: Clang C extensions */ + +/*#define Z_COMPILER_HAS_CLANG_C_PREPROCESSOR_OPERATOR_HAS_INCLUDE*/ + +/*#ifdef __cplusplus*/ + + /* MARK: - Language: C++98 */ + +/*# define Z_COMPILER_HAS_CPP98_EXCEPTIONS*/ +/*# define Z_COMPILER_HAS_CPP98_RTTI*/ +/*# define Z_COMPILER_HAS_CPP98_SFINAE*/ +/*# define Z_COMPILER_HAS_CPP98_TYPE_BOOL*/ +/*# define Z_COMPILER_HAS_CPP98_TYPE_WCHAR_T*/ + + /* MARK: - Language: C++03 */ + +/*# define Z_COMPILER_HAS_CPP03_VALUE_INITIALIZATION*/ + + /* MARK: - Language: C++11 */ + +/*# define Z_COMPILER_HAS_CPP11_ANONYMOUS_TYPE_AS_TEMPLATE_ARGUMENT*/ +/*# define Z_COMPILER_HAS_CPP11_C99_PREPROCESSOR*/ +/*# define Z_COMPILER_HAS_CPP11_COPY_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_DEFAULT_MEMBER_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP11_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_DELEGATING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP11_DELETED_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_DIRECT_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_EXPLICIT_CONVERSION_OPERATOR*/ +/*# define Z_COMPILER_HAS_CPP11_EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_EXPRESSION_SFINAE*/ +/*# define Z_COMPILER_HAS_CPP11_EXTENDED_FRIEND_DECLARATION*/ +/*# define Z_COMPILER_HAS_CPP11_EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS*/ +/*# define Z_COMPILER_HAS_CPP11_EXTERN_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_FIXED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_INHERITING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP11_INITIALIZATION_OF_CLASS_OBJECT_BY_RVALUE*/ +/*# define Z_COMPILER_HAS_CPP11_INITIALIZER_LIST*/ +/*# define Z_COMPILER_HAS_CPP11_INLINE_NAMESPACE*/ +/*# define Z_COMPILER_HAS_CPP11_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP11_LOCAL_TYPE_AS_TEMPLATE_ARGUMENT*/ +/*# define Z_COMPILER_HAS_CPP11_MOVE_SPECIAL_MEMBER_FUNCTIONS*/ +/*# define Z_COMPILER_HAS_CPP11_MULTI_DECLARATOR_AUTO*/ +/*# define Z_COMPILER_HAS_CPP11_OPAQUE_ENUMERATION_DECLARATION*/ +/*# define Z_COMPILER_HAS_CPP11_RANGE_BASED_FOR*/ +/*# define Z_COMPILER_HAS_CPP11_REFERENCE_QUALIFIED_NON_STATIC_MEMBER_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP11_REMOVAL_OF_AUTO_AS_STORAGE_CLASS*/ +/*# define Z_COMPILER_HAS_CPP11_RIGHT_ANGLE_BRACKETS*/ +/*# define Z_COMPILER_HAS_CPP11_RVALUE_REFERENCE*/ +/*# define Z_COMPILER_HAS_CPP11_SCOPED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_STD_LAYOUT*/ +/*# define Z_COMPILER_HAS_CPP11_STANDARDIZED_ATTRIBUTE_SYNTAX*/ +/*# define Z_COMPILER_HAS_CPP11_STATIC_ASSERTION*/ +/*# define Z_COMPILER_HAS_CPP11_THREAD_SAFE_STATIC_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP11_TRAILING_COMMA_ALLOWED_IN_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP11_TRAILING_RETURN_TYPE*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_ALIAS_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_UNIVERSAL_CHARACTER_NAME*/ +/*# define Z_COMPILER_HAS_CPP11_UNRESTRICTED_UNION*/ +/*# define Z_COMPILER_HAS_CPP11_VARIADIC_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_CARRIES_DEPENDENCY*/ +/*# define Z_COMPILER_HAS_CPP11_ATTRIBUTE_NORETURN*/ +/*# define Z_COMPILER_HAS_CPP11_IDENTIFIER_FUNC*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_NULLPTR*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_RAW_STRING*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_USER_DEFINED*/ +/*# define Z_COMPILER_HAS_CPP11_LITERAL_UTF8_STRING*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_ALIGNOF*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_NOEXCEPT*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_NON_STATIC_DATA_MEMBER*/ +/*# define Z_COMPILER_HAS_CPP11_OPERATOR_CASE_SIZEOF_PARAMETER_PACK*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_ALIGNAS*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_CONSTEXPR*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_DECLTYPE*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_FINAL*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_NOEXCEPT*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_OVERRIDE*/ +/*# define Z_COMPILER_HAS_CPP11_SPECIFIER_CASE_DECLTYPE_INCOMPLETE_RETURN_TYPE*/ +/*# define Z_COMPILER_HAS_CPP11_STORAGE_CLASS_THREAD_LOCAL*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_AUTO*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_CHAR16_T*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_CHAR32_T*/ +/*# define Z_COMPILER_HAS_CPP11_TYPE_LONG_LONG*/ + + /* MARK: - Language: C++14 */ + +/*# define Z_COMPILER_HAS_CPP14_APOSTROPHE_AS_DIGIT_SEPARATOR*/ +/*# define Z_COMPILER_HAS_CPP14_CONSTEXPR_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP14_CONTEXTUAL_CONVERSION*/ +/*# define Z_COMPILER_HAS_CPP14_DEFAULT_MEMBER_INITIALIZER_FOR_AGGREGATE*/ +/*# define Z_COMPILER_HAS_CPP14_GENERIC_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP14_INITIALIZED_LAMBDA_CAPTURE*/ +/*# define Z_COMPILER_HAS_CPP14_RETURN_TYPE_DEDUCTION_FOR_NORMAL_FUNCTION*/ +/*# define Z_COMPILER_HAS_CPP14_SIZED_DEALLOCATION*/ +/*# define Z_COMPILER_HAS_CPP14_VARIABLE_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP14_ATTRIBUTE_DEPRECATED*/ +/*# define Z_COMPILER_HAS_CPP14_LITERAL_BINARY_INTEGRAL*/ +/*# define Z_COMPILER_HAS_CPP14_SPECIFIER_CASE_DECLTYPE_AUTO*/ + + /* MARK: - Language: C++17 */ + +/*# define Z_COMPILER_HAS_CPP17_AGGREGATE_INITIALIZATION_FOR_DERIVED_CLASS*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_USING_PREFIX*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_ENUMERATOR*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTES_FOR_NAMESPACE*/ +/*# define Z_COMPILER_HAS_CPP17_AUTO_DEDUCTION_FROM_LIST_INITIALIZATION*/ +/*# define Z_COMPILER_HAS_CPP17_CONSTEXPR_IF*/ +/*# define Z_COMPILER_HAS_CPP17_CONSTEXPR_LAMBDA*/ +/*# define Z_COMPILER_HAS_CPP17_DEDUCTION_GUIDES_FOR_CLASS_TEMPLATE*/ +/*# define Z_COMPILER_HAS_CPP17_DIFFERING_BEGIN_AND_END_TYPES_IN_RANGE_BASED_FOR*/ +/*# define Z_COMPILER_HAS_CPP17_DIRECT_LIST_INITIALIZATION_FOR_FIXED_ENUMERATION*/ +/*# define Z_COMPILER_HAS_CPP17_EXPRESSION_EVALUATION_ORDER*/ +/*# define Z_COMPILER_HAS_CPP17_FOLD_EXPRESSION*/ +/*# define Z_COMPILER_HAS_CPP17_GUARANTEED_COPY_ELISION*/ +/*# define Z_COMPILER_HAS_CPP17_IF_WITH_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP17_IGNORING_OF_UNKNOWN_ATTRIBUTES*/ +/*# define Z_COMPILER_HAS_CPP17_INHERITING_CONSTRUCTORS*/ +/*# define Z_COMPILER_HAS_CPP17_INLINE_VARIABLE*/ +/*# define Z_COMPILER_HAS_CPP17_LAMBDA_CAPTURE_OF_STAR_THIS_BY_VALUE*/ +/*# define Z_COMPILER_HAS_CPP17_NESTED_NAMESPACE_DEFINITION*/ +/*# define Z_COMPILER_HAS_CPP17_NOEXCEPT_AS_PART_OF_THE_FUNCTION_TYPE*/ +/*# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_ARGUMENTS*/ +/*# define Z_COMPILER_HAS_CPP17_NON_TYPE_TEMPLATE_PARAMETER_WITH_AUTO_TYPE*/ +/*# define Z_COMPILER_HAS_CPP17_OVER_ALIGNED_DYNAMIC_MEMORY_ALLOCATION*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_BOOL_INCREMENT*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_DYNAMIC_EXCEPTION_SPECIFICATION*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_REGISTER_AS_STORAGE_CLASS*/ +/*# define Z_COMPILER_HAS_CPP17_REMOVAL_OF_TRIGRAPHS*/ +/*# define Z_COMPILER_HAS_CPP17_SAFE_UNARY_FOLD_EXPRESSION*/ +/*# define Z_COMPILER_HAS_CPP17_STATIC_ASSERTION_WITH_NO_MESSAGE*/ +/*# define Z_COMPILER_HAS_CPP17_STRUCTURED_BINDING*/ +/*# define Z_COMPILER_HAS_CPP17_SWITCH_WITH_INITIALIZER*/ +/*# define Z_COMPILER_HAS_CPP17_TEMPLATE_TEMPLATE_ARGUMENT_MATCHING*/ +/*# define Z_COMPILER_HAS_CPP17_TYPENAME_IN_TEMPLATE_TEMPLATE_PARAMETER*/ +/*# define Z_COMPILER_HAS_CPP17_VARIADIC_USING*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_FALLTHROUGH*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_MAYBE_UNUSED*/ +/*# define Z_COMPILER_HAS_CPP17_ATTRIBUTE_NODISCARD*/ +/*# define Z_COMPILER_HAS_CPP17_LITERAL_HEXADECIMAL_FLOATING_POINT*/ +/*# define Z_COMPILER_HAS_CPP17_LITERAL_UTF8_CHARACTER*/ +/*# define Z_COMPILER_HAS_CPP17_PREPROCESSOR_OPERATOR_HAS_INCLUDE*/ + +/*#endif*/ + +/* MARK: - Language: Implementation-defined */ + +/*#define Z_COMPILER_HAS_ARITHMETIC_RIGHT_SHIFT*/ + +/* MARK: - Non-standard language: Attributes */ + +/*#define Z_COMPILER_ATTRIBUTE_ALIAS*/ +/*#define Z_COMPILER_ATTRIBUTE_ALWAYS_INLINE*/ +/*#define Z_COMPILER_ATTRIBUTE_API_EXPORT*/ +/*#define Z_COMPILER_ATTRIBUTE_API_IMPORT*/ +/*#define Z_COMPILER_ATTRIBUTE_API_WEAK_EXPORT*/ +/*#define Z_COMPILER_ATTRIBUTE_EBCO*/ +/*#define Z_COMPILER_ATTRIBUTE_INLINE*/ +/*#define Z_COMPILER_ATTRIBUTE_MICROSOFT_STD_CALL*/ +/*#define Z_COMPILER_ATTRIBUTE_NO_RETURN*/ +/*#define Z_COMPILER_ATTRIBUTE_NULL_TERMINATED*/ +/*#define Z_COMPILER_ATTRIBUTE_PRIVATE*/ +/*#define Z_COMPILER_ATTRIBUTE_PUBLIC*/ +/*#define Z_COMPILER_ATTRIBUTE_THREAD_LOCAL*/ +/*#define Z_COMPILER_ATTRIBUTE_WEAK*/ + +/* MARK: - Non-standard language: Structure padding */ + +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_UNION*/ +/*#define Z_COMPILER_PACKED_UNION_BEFORE_BODY*/ +/*#define Z_COMPILER_PACKED_UNION_AFTER_BODY*/ + +/* MARK: - Built-ins: Types and literal suffixes */ + +/*#define Z_COMPILER_TYPE_UINT8*/ +/*#define Z_COMPILER_TYPE_SINT8*/ +/*#define Z_COMPILER_TYPE_UINT16*/ +/*#define Z_COMPILER_TYPE_SINT16*/ +/*#define Z_COMPILER_TYPE_UINT24*/ +/*#define Z_COMPILER_TYPE_SINT24*/ +/*#define Z_COMPILER_TYPE_UINT32*/ +/*#define Z_COMPILER_TYPE_SINT32*/ +/*#define Z_COMPILER_TYPE_UINT40*/ +/*#define Z_COMPILER_TYPE_SINT40*/ +/*#define Z_COMPILER_TYPE_UINT48*/ +/*#define Z_COMPILER_TYPE_SINT48*/ +/*#define Z_COMPILER_TYPE_UINT56*/ +/*#define Z_COMPILER_TYPE_SINT56*/ +/*#define Z_COMPILER_TYPE_UINT64*/ +/*#define Z_COMPILER_TYPE_SINT64*/ +/*#define Z_COMPILER_TYPE_UINT128*/ +/*#define Z_COMPILER_TYPE_SINT128*/ +/*#define Z_COMPILER_TYPE_BFP16*/ +/*#define Z_COMPILER_TYPE_BFP32*/ +/*#define Z_COMPILER_TYPE_BFP64*/ +/*#define Z_COMPILER_TYPE_BFP128*/ +/*#define Z_COMPILER_TYPE_DFP32*/ +/*#define Z_COMPILER_TYPE_DFP64*/ +/*#define Z_COMPILER_TYPE_DFP128*/ +/*#define Z_COMPILER_TYPE_X87_DE80*/ +/*#define Z_COMPILER_TYPE_X87_DE96*/ +/*#define Z_COMPILER_TYPE_X87_DE128*/ +/*#define Z_COMPILER_TYPE_IBM_ED*/ +/*#define Z_COMPILER_TYPE_BFLOAT16*/ +/*#define Z_COMPILER_TYPE_VAL*/ +/*#define Z_COMPILER_LITERAL_UINT8(number)*/ +/*#define Z_COMPILER_LITERAL_SINT8(number)*/ +/*#define Z_COMPILER_LITERAL_UINT16(number)*/ +/*#define Z_COMPILER_LITERAL_SINT16(number)*/ +/*#define Z_COMPILER_LITERAL_UINT24(number)*/ +/*#define Z_COMPILER_LITERAL_SINT24(number)*/ +/*#define Z_COMPILER_LITERAL_UINT32(number)*/ +/*#define Z_COMPILER_LITERAL_SINT32(number)*/ +/*#define Z_COMPILER_LITERAL_UINT40(number)*/ +/*#define Z_COMPILER_LITERAL_SINT40(number)*/ +/*#define Z_COMPILER_LITERAL_UINT48(number)*/ +/*#define Z_COMPILER_LITERAL_SINT48(number)*/ +/*#define Z_COMPILER_LITERAL_UINT56(number)*/ +/*#define Z_COMPILER_LITERAL_SINT56(number)*/ +/*#define Z_COMPILER_LITERAL_UINT64(number)*/ +/*#define Z_COMPILER_LITERAL_SINT64(number)*/ +/*#define Z_COMPILER_LITERAL_UINT128(number)*/ +/*#define Z_COMPILER_LITERAL_SINT128(number)*/ +/*#define Z_COMPILER_LITERAL_BFP16(number)*/ +/*#define Z_COMPILER_LITERAL_BFP32(number)*/ +/*#define Z_COMPILER_LITERAL_BFP64(number)*/ +/*#define Z_COMPILER_LITERAL_BFP128(number)*/ +/*#define Z_COMPILER_LITERAL_DFP32(number)*/ +/*#define Z_COMPILER_LITERAL_DFP64(number)*/ +/*#define Z_COMPILER_LITERAL_DFP128(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE80(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE96(number)*/ +/*#define Z_COMPILER_LITERAL_X87_DE128(number)*/ +/*#define Z_COMPILER_LITERAL_IBM_ED(number)*/ +/*#define Z_COMPILER_LITERAL_BFLOAT16(number)*/ + +/* MARK: - Built-ins: Constants */ + +/*#define Z_COMPILER_CONSTANT_CHAR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SHORT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SHORT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_USHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSHORT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_INT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_INT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINT_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_LONG_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LONG_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_ULONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_LLONG_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LLONG_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_ULLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SLLONG_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_WCHAR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_SIZE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SIZE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_USIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SSIZE_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINTMAX_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTMAX_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_UINTPTR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_SIZE*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MAXIMUM*/ +/*#define Z_COMPILER_CONSTANT_SINTPTR_MINIMUM*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_SIZE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DOUBLE_SNAN*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_SIZE*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_WIDTH*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_HUGE*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_QNAN*/ +/*#define Z_COMPILER_CONSTANT_LDOUBLE_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT32X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_FLOAT128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL64X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DECIMAL128X_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP32_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP32_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP32_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP64_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP64_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP64_SNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_DFP128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_DFP128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_DFP128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE80_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE96_SNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_HUGE*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_QNAN*/ +/*#define Z_COMPILER_CONSTANT_X87_DE128_SNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_HUGE*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_QNAN*/ +/*#define Z_COMPILER_CONSTANT_IBM_ED_SNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_HUGE*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_INFINITY*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_QNAN*/ +/*#define Z_COMPILER_CONSTANT_BFLOAT16_SNAN*/ +/*#define Z_COMPILER_CONSTANT_POINTER_SIZE*/ +/*#define Z_COMPILER_CONSTANT_POINTER_WIDTH*/ + +/* MARK: - Built-ins: Macros */ + +/*#define Z_COMPILER_MACRO_MEMBER_OFFSET(type, member)*/ +/*#define Z_COMPILER_MACRO_VAL_INITIALIZE(self, last_parameter)*/ +/*#define Z_COMPILER_MACRO_VAL_FINALIZE(self)*/ +/*#define Z_COMPILER_MACRO_VAL_READ(self, type)*/ +/*#define Z_COMPILER_MACRO_VAL_COPY(self, output)*/ + +/* MARK: - Built-ins: Functions */ + +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT8_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT8_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT16_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT16_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT32_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT32_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT64_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT64_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_UINT128_ATOMIC_XOR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_ADD_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_AND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_ADD(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_AND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_NAND(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_OR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_SUBTRACT(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_GET_THEN_XOR(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_NAND_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_OR_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SET_IF_EQUAL(value, old_value, new_value)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_SUBTRACT_THEN_GET(value, operand)*/ +/*#define Z_COMPILER_FUNCTION_SINT128_ATOMIC_XOR_THEN_GET(value, operand)*/ + +/* MARK: - Built-ins: Traits */ + +/*#define Z_COMPILER_TRAIT_SELECT_TYPE(I, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_DIMENSION_COUNT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_ELEMENT_COUNT(T, dimension_index)*/ +/*#define Z_COMPILER_TRAIT_TYPE_HAS_UNIQUE_OBJECT_REPRESENTATIONS(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_HAS_VIRTUAL_DESTRUCTOR(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ABSTRACT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_AGGREGATE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARITHMETIC(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ARRAY(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_BASE(T, of_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPLETE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_COMPOUND(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONST(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_CONVERTIBLE(T, to_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DATA_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_EMPTY(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_ENUMERATION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FINAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTEGRAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_INTERFACE_CLASS(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FLOATING_POINT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNCTION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_FUNDAMENTAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_LITERAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_LVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_FUNCTION_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_MEMBER_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_NOTHROW_MOVE_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_OBJECT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POD(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POINTER(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_POLYMORPHIC(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_RVALUE_REFERENCE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SAME(T, as_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SCALAR(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SEALED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_SIGNED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_STD_LAYOUT(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_STRUCTURE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIAL(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_ASSIGNABLE(T, from_type)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_CONSTRUCTIBLE(T, ...)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_COPYABLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_TRIVIALLY_DESTRUCTIBLE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_UNION(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_UNSIGNED(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOID(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_IS_VOLATILE(T)*/ +/*#define Z_COMPILER_TRAIT_TYPE_UNDERLYING_TYPE(T)*/ + +#endif /* Z_inspection_compiler_modules_template_H */ diff --git a/projects/Zeta/API/Z/inspection/data_model.h b/projects/Zeta/API/Z/inspection/data_model.h new file mode 100644 index 0000000..06afe48 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/data_model.h @@ -0,0 +1,415 @@ +/* Zeta API - Z/inspection/data_model.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_data_model_H +#define Z_inspection_data_model_H + +#include +#include +#include + +#ifndef Z_DATA_MODEL +# ifdef Z_COMPILER_DATA_MODEL +# define Z_DATA_MODEL Z_COMPILER_DATA_MODEL +# else +# include + +# ifndef Z_DATA_MODEL +# include + +# ifndef Z_DATA_MODEL +# error "Z_DATA_MODEL not defined." +# endif +# endif +# endif +#endif + +#if Z_DATA_MODEL == Z_DATA_MODEL_IP16L32 +# include + +# define Z_DATA_MODEL_IS_IP16L32 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_IP16L32 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##IP16L32##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_I16LP32 +# include + +# define Z_DATA_MODEL_IS_I16LP32 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_I16LP32 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##I16LP32##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_ILP32 +# include + +# define Z_DATA_MODEL_IS_ILP32 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_ILP32 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##ILP32##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_ILP64 +# include + +# define Z_DATA_MODEL_IS_ILP64 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_ILP64 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##ILP64##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_LLP64 +# include + +# define Z_DATA_MODEL_IS_LLP64 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_LLP64 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##LLP64##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_LP32 +# include + +# define Z_DATA_MODEL_IS_LP32 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_LP32 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##LP32##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_LP64 +# include + +# define Z_DATA_MODEL_IS_LP64 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_LP64 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##LP64##rht + +#elif Z_DATA_MODEL == Z_DATA_MODEL_SILP64 +# include + +# define Z_DATA_MODEL_IS_SILP64 1 +# define Z_DATA_MODEL_NAME Z_DATA_MODEL_NAME_SILP64 +# define Z_INSERT_DATA_MODEL(lht, rht) lht##SILP64##rht + +#else +# error "Invalid Z_DATA_MODEL key." +#endif + +/* MARK: - Getters */ + +#define Z_DATA_MODEL_IS( DATA_MODEL) Z_IS_TRUE(Z_DATA_MODEL_IS_##DATA_MODEL ) +#define Z_DATA_MODEL_HAS_LITERAL(TYPE ) Z_IS_TRUE(Z_DATA_MODEL_HAS_LITERAL_##TYPE) +#define Z_DATA_MODEL_HAS_TYPE( TYPE ) Z_IS_TRUE(Z_DATA_MODEL_HAS_TYPE_##TYPE ) +#define Z_DATA_MODEL_WIDTH( TYPE ) Z_INSERT_DATA_MODEL(Z_, _WIDTH_##TYPE) +#define Z_DATA_MODEL_FUNDAMENTAL(TYPE ) Z_DATA_MODEL_FUNDAMENTAL_##TYPE +#define Z_DATA_MODEL_LITERAL( TYPE ) Z_DATA_MODEL_LITERAL_##TYPE +#define Z_DATA_MODEL_TYPE( TYPE ) Z_DATA_MODEL_TYPE_##TYPE + +/* MARK: - Selection: int8 */ + +#if Z_DATA_MODEL_WIDTH(CHAR) == 8 +# define Z_DATA_MODEL_TYPE_UINT8 unsigned char +# define Z_DATA_MODEL_FUNDAMENTAL_UINT8 Z_FUNDAMENTAL_UCHAR +# define Z_DATA_MODEL_LITERAL_UINT8 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT8 signed char +# define Z_DATA_MODEL_FUNDAMENTAL_SINT8 Z_FUNDAMENTAL_SCHAR +# define Z_DATA_MODEL_LITERAL_SINT8 Z_SAME + +#else +# if Z_COMPILER_HAS_TYPE(UINT8) +# define Z_DATA_MODEL_TYPE_UINT8 Z_COMPILER_TYPE(UINT8) +# define Z_DATA_MODEL_FUNDAMENTAL_UINT8 Z_FUNDAMENTAL_UINT8 + +# if Z_COMPILER_HAS_LITERAL(UINT8) +# define Z_DATA_MODEL_LITERAL_UINT8 Z_COMPILER_LITERAL(UINT8) +# endif +# endif + +# if Z_COMPILER_HAS_TYPE(SINT8) +# define Z_DATA_MODEL_TYPE_SINT8 Z_COMPILER_TYPE(SINT8) +# define Z_DATA_MODEL_FUNDAMENTAL_SINT8 Z_FUNDAMENTAL_SINT8 + +# if Z_COMPILER_HAS_LITERAL(SINT8) +# define Z_DATA_MODEL_LITERAL_SINT8 Z_COMPILER_LITERAL(SINT8) +# endif +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_UINT8 +# define Z_DATA_MODEL_HAS_TYPE_UINT8 1 + +# ifdef Z_DATA_MODEL_LITERAL_UINT8 +# define Z_DATA_MODEL_HAS_LITERAL_UINT8 1 +# else +# define Z_DATA_MODEL_LITERAL_UINT8 Z_SUFFIX_U +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_SINT8 +# define Z_DATA_MODEL_HAS_TYPE_SINT8 1 + +# ifdef Z_DATA_MODEL_LITERAL_SINT8 +# define Z_DATA_MODEL_HAS_LITERAL_SINT8 1 +# else +# define Z_DATA_MODEL_LITERAL_SINT8 Z_SAME +# endif +#endif + +/* MARK: - Selection: int16 */ + +#if Z_DATA_MODEL_WIDTH(CHAR) == 16 +# define Z_DATA_MODEL_TYPE_UINT16 unsigned char +# define Z_DATA_MODEL_FUNDAMENTAL_UINT16 Z_FUNDAMENTAL_UCHAR +# define Z_DATA_MODEL_LITERAL_UINT16 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT16 signed char +# define Z_DATA_MODEL_FUNDAMENTAL_SINT16 Z_FUNDAMENTAL_SCHAR +# define Z_DATA_MODEL_LITERAL_SINT16 Z_SAME + +#elif Z_DATA_MODEL_WIDTH(INT) == 16 +# define Z_DATA_MODEL_TYPE_UINT16 unsigned int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT16 Z_FUNDAMENTAL_UINT +# define Z_DATA_MODEL_LITERAL_UINT16 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT16 int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT16 Z_FUNDAMENTAL_SINT +# define Z_DATA_MODEL_LITERAL_SINT16 Z_SAME + +#elif Z_DATA_MODEL_WIDTH(SHORT) == 16 +# define Z_DATA_MODEL_TYPE_UINT16 unsigned short int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT16 Z_FUNDAMENTAL_USHORT +# define Z_DATA_MODEL_LITERAL_UINT16 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT16 short int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT16 Z_FUNDAMENTAL_SSHORT +# define Z_DATA_MODEL_LITERAL_SINT16 Z_SAME + +#else +# if Z_COMPILER_HAS_TYPE(UINT16) +# define Z_DATA_MODEL_TYPE_UINT16 Z_COMPILER_TYPE(UINT16) +# define Z_DATA_MODEL_FUNDAMENTAL_UINT16 Z_FUNDAMENTAL_UINT16 + +# if Z_COMPILER_HAS_LITERAL(UINT16) +# define Z_DATA_MODEL_LITERAL_UINT16 Z_COMPILER_LITERAL(UINT16) +# endif +# endif + +# if Z_COMPILER_HAS_TYPE(SINT16) +# define Z_DATA_MODEL_TYPE_SINT16 Z_COMPILER_TYPE(SINT16) +# define Z_DATA_MODEL_FUNDAMENTAL_SINT16 Z_FUNDAMENTAL_SINT16 + +# if Z_COMPILER_HAS_LITERAL(SINT16) +# define Z_DATA_MODEL_LITERAL_SINT16 Z_COMPILER_LITERAL(SINT16) +# endif +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_UINT16 +# define Z_DATA_MODEL_HAS_TYPE_UINT16 1 + +# ifdef Z_DATA_MODEL_LITERAL_UINT16 +# define Z_DATA_MODEL_HAS_LITERAL_UINT16 1 +# else +# define Z_DATA_MODEL_LITERAL_UINT16 Z_SUFFIX_U +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_SINT16 +# define Z_DATA_MODEL_HAS_TYPE_SINT16 1 + +# ifdef Z_DATA_MODEL_LITERAL_SINT16 +# define Z_DATA_MODEL_HAS_LITERAL_SINT16 1 +# else +# define Z_DATA_MODEL_LITERAL_SINT16 Z_SAME +# endif +#endif + +/* MARK: - Selection: int32 */ + +#if Z_DATA_MODEL_WIDTH(INT) == 32 +# define Z_DATA_MODEL_TYPE_UINT32 unsigned int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT32 Z_FUNDAMENTAL_UINT +# define Z_DATA_MODEL_LITERAL_UINT32 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT32 int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT32 Z_FUNDAMENTAL_SINT +# define Z_DATA_MODEL_LITERAL_SINT32 Z_SAME + +#elif Z_DATA_MODEL_WIDTH(SHORT) == 32 +# define Z_DATA_MODEL_TYPE_UINT32 unsigned short int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT32 Z_FUNDAMENTAL_USHORT +# define Z_DATA_MODEL_LITERAL_UINT32 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT32 short int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT32 Z_FUNDAMENTAL_SSHORT +# define Z_DATA_MODEL_LITERAL_SINT32 Z_SAME + +#elif Z_DATA_MODEL_WIDTH(LONG) == 32 +# define Z_DATA_MODEL_TYPE_UINT32 unsigned long int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT32 Z_FUNDAMENTAL_ULONG +# define Z_DATA_MODEL_LITERAL_UINT32 Z_SUFFIX_UL + +# define Z_DATA_MODEL_TYPE_SINT32 long int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT32 Z_FUNDAMENTAL_SLONG +# define Z_DATA_MODEL_LITERAL_SINT32 Z_SUFFIX_L + +#else +# if Z_COMPILER_HAS_TYPE(UINT32) +# define Z_DATA_MODEL_TYPE_UINT32 Z_COMPILER_TYPE(UINT32) +# define Z_DATA_MODEL_FUNDAMENTAL_UINT32 Z_FUNDAMENTAL_UINT32 + +# if Z_COMPILER_HAS_LITERAL(UINT32) +# define Z_DATA_MODEL_LITERAL_UINT32 Z_COMPILER_LITERAL(UINT32) +# endif +# endif + +# if Z_COMPILER_HAS_TYPE(SINT32) +# define Z_DATA_MODEL_TYPE_SINT32 Z_COMPILER_TYPE(SINT32) +# define Z_DATA_MODEL_FUNDAMENTAL_SINT32 Z_FUNDAMENTAL_SINT32 + +# if Z_COMPILER_HAS_LITERAL(SINT32) +# define Z_DATA_MODEL_LITERAL_SINT32 Z_COMPILER_LITERAL(SINT32) +# endif +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_UINT32 +# define Z_DATA_MODEL_HAS_TYPE_UINT32 1 + +# ifdef Z_DATA_MODEL_LITERAL_UINT32 +# define Z_DATA_MODEL_HAS_LITERAL_UINT32 1 +# else +# define Z_DATA_MODEL_LITERAL_UINT32 Z_SUFFIX_U +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_SINT32 +# define Z_DATA_MODEL_HAS_TYPE_SINT32 1 + +# ifdef Z_DATA_MODEL_LITERAL_SINT32 +# define Z_DATA_MODEL_HAS_LITERAL_SINT32 1 +# else +# define Z_DATA_MODEL_LITERAL_SINT32 Z_SAME +# endif +#endif + +/* MARK: - Selection: int64 */ + +#if Z_DATA_MODEL_WIDTH(INT) == 64 +# define Z_DATA_MODEL_TYPE_UINT64 unsigned int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT64 Z_FUNDAMENTAL_UINT +# define Z_DATA_MODEL_LITERAL_UINT64 Z_SUFFIX_U + +# define Z_DATA_MODEL_TYPE_SINT64 int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT64 Z_FUNDAMENTAL_SINT +# define Z_DATA_MODEL_LITERAL_SINT64 Z_SAME + +#elif Z_DATA_MODEL_WIDTH(LONG) == 64 +# define Z_DATA_MODEL_TYPE_UINT64 unsigned long int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT64 Z_FUNDAMENTAL_ULONG +# define Z_DATA_MODEL_LITERAL_UINT64 Z_SUFFIX_UL + +# define Z_DATA_MODEL_TYPE_SINT64 long int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT64 Z_FUNDAMENTAL_SLONG +# define Z_DATA_MODEL_LITERAL_SINT64 Z_SUFFIX_L + +#elif Z_DATA_MODEL_WIDTH(LLONG) == 64 && \ + (Z_DIALECT_HAS_TYPE(C99, LONG_LONG) || Z_DIALECT_HAS_TYPE(CPP11, LONG_LONG)) + +# define Z_DATA_MODEL_TYPE_UINT64 unsigned long long int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT64 Z_FUNDAMENTAL_ULLONG +# define Z_DATA_MODEL_LITERAL_UINT64 Z_SUFFIX_ULL + +# define Z_DATA_MODEL_TYPE_SINT64 long long int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT64 Z_FUNDAMENTAL_SLLONG +# define Z_DATA_MODEL_LITERAL_SINT64 Z_SUFFIX_LL + +#else +# if Z_COMPILER_HAS_TYPE(UINT64) +# define Z_DATA_MODEL_TYPE_UINT64 Z_COMPILER_TYPE(UINT64) +# define Z_DATA_MODEL_FUNDAMENTAL_UINT64 Z_FUNDAMENTAL_UINT64 + +# if Z_COMPILER_HAS_LITERAL(UINT64) +# define Z_DATA_MODEL_LITERAL_UINT64 Z_COMPILER_LITERAL(UINT64) +# endif +# endif + +# if Z_COMPILER_HAS_TYPE(SINT64) +# define Z_DATA_MODEL_TYPE_SINT64 Z_COMPILER_TYPE(SINT64) +# define Z_DATA_MODEL_FUNDAMENTAL_SINT64 Z_FUNDAMENTAL_SINT64 + +# if Z_COMPILER_HAS_LITERAL(SINT64) +# define Z_DATA_MODEL_LITERAL_SINT64 Z_COMPILER_LITERAL(SINT64) +# endif +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_UINT64 +# define Z_DATA_MODEL_HAS_TYPE_UINT64 1 + +# ifdef Z_DATA_MODEL_LITERAL_UINT64 +# define Z_DATA_MODEL_HAS_LITERAL_UINT64 1 +# else +# define Z_DATA_MODEL_LITERAL_UINT64 Z_SUFFIX_U +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_SINT64 +# define Z_DATA_MODEL_HAS_TYPE_SINT64 1 + +# ifdef Z_DATA_MODEL_LITERAL_SINT64 +# define Z_DATA_MODEL_HAS_LITERAL_SINT64 1 +# else +# define Z_DATA_MODEL_LITERAL_SINT64 Z_SAME +# endif +#endif + +/* MARK: - Selection: int128 */ + +#if Z_DATA_MODEL_WIDTH(LLONG) == 128 && \ + (Z_DIALECT_HAS_TYPE(C99, LONG_LONG) || Z_DIALECT_HAS_TYPE(CPP11, LONG_LONG)) + +# define Z_DATA_MODEL_TYPE_UINT128 unsigned long long int +# define Z_DATA_MODEL_FUNDAMENTAL_UINT128 Z_FUNDAMENTAL_ULLONG +# define Z_DATA_MODEL_LITERAL_UINT128 Z_SUFFIX_ULL + +# define Z_DATA_MODEL_TYPE_SINT128 long long int +# define Z_DATA_MODEL_FUNDAMENTAL_SINT128 Z_FUNDAMENTAL_SLLONG +# define Z_DATA_MODEL_LITERAL_SINT128 Z_SUFFIX_LL + +#else +# if Z_COMPILER_HAS_TYPE(UINT128) +# define Z_DATA_MODEL_TYPE_UINT128 Z_COMPILER_TYPE(UINT128) +# define Z_DATA_MODEL_FUNDAMENTAL_UINT128 Z_FUNDAMENTAL_UINT128 + +# if Z_COMPILER_HAS_LITERAL(UINT128) +# define Z_DATA_MODEL_LITERAL_UINT128 Z_COMPILER_LITERAL(UINT128) +# endif +# endif + +# if Z_COMPILER_HAS_TYPE(SINT128) +# define Z_DATA_MODEL_TYPE_SINT128 Z_COMPILER_TYPE(SINT128) +# define Z_DATA_MODEL_FUNDAMENTAL_SINT128 Z_FUNDAMENTAL_SINT128 + +# if Z_COMPILER_HAS_LITERAL(SINT128) +# define Z_DATA_MODEL_LITERAL_SINT128 Z_COMPILER_LITERAL(SINT128) +# endif +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_UINT128 +# define Z_DATA_MODEL_HAS_TYPE_UINT128 1 + +# ifdef Z_DATA_MODEL_LITERAL_UINT128 +# define Z_DATA_MODEL_HAS_LITERAL_UINT128 1 +# else +# define Z_DATA_MODEL_LITERAL_UINT128 Z_SUFFIX_U +# endif +#endif + +#ifdef Z_DATA_MODEL_TYPE_SINT128 +# define Z_DATA_MODEL_HAS_TYPE_SINT128 1 + +# ifdef Z_DATA_MODEL_LITERAL_SINT128 +# define Z_DATA_MODEL_HAS_LITERAL_SINT128 1 +# else +# define Z_DATA_MODEL_LITERAL_SINT128 Z_SAME +# endif +#endif + +#endif /* Z_inspection_data_model_H */ diff --git a/projects/Zeta/API/Z/inspection/data_model/deduction.h b/projects/Zeta/API/Z/inspection/data_model/deduction.h new file mode 100644 index 0000000..99c6252 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/data_model/deduction.h @@ -0,0 +1,409 @@ +/* Zeta API - Z/inspection/data_model/deduction.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_data_model_deduction_H +#define Z_inspection_data_model_deduction_H + +#if Z_COMPILER_HAS_CONSTANT(SHORT_WIDTH) +# define Z_z_SHORT_WIDTH Z_COMPILER_CONSTANT(SHORT_WIDTH) + +#elif Z_COMPILER_HAS_CONSTANT(SHORT_SIZE) +# define Z_z_SHORT_WIDTH (Z_COMPILER_CONSTANT(SHORT_SIZE) * 8) + +#elif Z_COMPILER_HAS_CONSTANT(USHORT_MAXIMUM) +# if Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 65535 +# define Z_z_SHORT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 16777215 +# define Z_z_SHORT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 4294967295 +# define Z_z_SHORT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 1099511627775 +# define Z_z_SHORT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 281474976710655 +# define Z_z_SHORT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 72057594037927935 +# define Z_z_SHORT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 18446744073709551615 +# define Z_z_SHORT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(USHORT_MAXIMUM) == 340282366920938463463374607431768211455 +# define Z_z_SHORT_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SSHORT_MAXIMUM) +# if Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 32767 +# define Z_z_SHORT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 8388607 +# define Z_z_SHORT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 2147483647 +# define Z_z_SHORT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 549755813887 +# define Z_z_SHORT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 140737488355327 +# define Z_z_SHORT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 36028797018963967 +# define Z_z_SHORT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 9223372036854775807 +# define Z_z_SHORT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SSHORT_MAXIMUM) == 170141183460469231731687303715884105727 +# define Z_z_SHORT_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SSHORT_MINIMUM) +# if Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -32767 - 1 +# define Z_z_SHORT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -8388607 - 1 +# define Z_z_SHORT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -2147483647 - 1 +# define Z_z_SHORT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -549755813887 - 1 +# define Z_z_SHORT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -140737488355327 - 1 +# define Z_z_SHORT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -36028797018963967 - 1 +# define Z_z_SHORT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -9223372036854775807 - 1 +# define Z_z_SHORT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SSHORT_MINIMUM) == -170141183460469231731687303715884105727 - 1 +# define Z_z_SHORT_WIDTH 64 +# endif + +#endif + +#ifndef Z_z_SHORT_WIDTH +# define Z_z_SHORT_WIDTH 0 +#endif + +#if Z_COMPILER_HAS_CONSTANT(INT_WIDTH) +# define Z_z_INT_WIDTH Z_COMPILER_CONSTANT(INT_WIDTH) + +#elif Z_COMPILER_HAS_CONSTANT(INT_SIZE) +# define Z_z_INT_WIDTH (Z_COMPILER_CONSTANT(INT_SIZE) * 8) + +#elif Z_COMPILER_HAS_CONSTANT(UINT_MAXIMUM) +# if Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 65535U +# define Z_z_INT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 16777215U +# define Z_z_INT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 4294967295U +# define Z_z_INT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 1099511627775U +# define Z_z_INT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 281474976710655U +# define Z_z_INT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 72057594037927935U +# define Z_z_INT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 18446744073709551615U +# define Z_z_INT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(UINT_MAXIMUM) == 340282366920938463463374607431768211455U +# define Z_z_INT_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SINT_MAXIMUM) +# if Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 32767 +# define Z_z_INT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 8388607 +# define Z_z_INT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 2147483647 +# define Z_z_INT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 549755813887 +# define Z_z_INT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 140737488355327 +# define Z_z_INT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 36028797018963967 +# define Z_z_INT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 9223372036854775807 +# define Z_z_INT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SINT_MAXIMUM) == 170141183460469231731687303715884105727 +# define Z_z_INT_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SINT_MINIMUM) +# if Z_COMPILER_CONSTANT(SINT_MINIMUM) == -32767 - 1 +# define Z_z_INT_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -8388607 - 1 +# define Z_z_INT_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -2147483647 - 1 +# define Z_z_INT_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -549755813887 - 1 +# define Z_z_INT_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -140737488355327 - 1 +# define Z_z_INT_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -36028797018963967 - 1 +# define Z_z_INT_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -9223372036854775807 - 1 +# define Z_z_INT_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SINT_MINIMUM) == -170141183460469231731687303715884105727 - 1 +# define Z_z_INT_WIDTH 64 +# endif + +#endif + +#ifndef Z_z_INT_WIDTH +# define Z_z_INT_WIDTH 0 +#endif + +#if Z_COMPILER_HAS_CONSTANT(LONG_WIDTH) +# define Z_z_LONG_WIDTH Z_COMPILER_CONSTANT(LONG_WIDTH) + +#elif Z_COMPILER_HAS_CONSTANT(LONG_SIZE) +# define Z_z_LONG_WIDTH (Z_COMPILER_CONSTANT(LONG_SIZE) * 8) + +#elif Z_COMPILER_HAS_CONSTANT(ULONG_MAXIMUM) +# if Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 65535UL +# define Z_z_LONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 16777215UL +# define Z_z_LONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 4294967295UL +# define Z_z_LONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 1099511627775UL +# define Z_z_LONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 281474976710655UL +# define Z_z_LONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 72057594037927935UL +# define Z_z_LONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 18446744073709551615UL +# define Z_z_LONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(ULONG_MAXIMUM) == 340282366920938463463374607431768211455UL +# define Z_z_LONG_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SLONG_MAXIMUM) +# if Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 32767L +# define Z_z_LONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 8388607L +# define Z_z_LONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 2147483647L +# define Z_z_LONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 549755813887L +# define Z_z_LONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 140737488355327L +# define Z_z_LONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 36028797018963967L +# define Z_z_LONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 9223372036854775807L +# define Z_z_LONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SLONG_MAXIMUM) == 170141183460469231731687303715884105727L +# define Z_z_LONG_WIDTH 128 +# endif + +#elif Z_COMPILER_HAS_CONSTANT(SLONG_MINIMUM) +# if Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -32767L - 1L +# define Z_z_LONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -8388607L - 1L +# define Z_z_LONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -2147483647L - 1L +# define Z_z_LONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -549755813887L - 1L +# define Z_z_LONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -140737488355327L - 1L +# define Z_z_LONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -36028797018963967L - 1L +# define Z_z_LONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -9223372036854775807L - 1L +# define Z_z_LONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SLONG_MINIMUM) == -170141183460469231731687303715884105727L - 1L +# define Z_z_LONG_WIDTH 64 +# endif + +#endif + +#ifndef Z_z_LONG_WIDTH +# define Z_z_LONG_WIDTH 0 +#endif + +#if Z_COMPILER_HAS_CONSTANT(LLONG_WIDTH) +# define Z_z_LLONG_WIDTH Z_COMPILER_CONSTANT(LLONG_WIDTH) + +#elif Z_COMPILER_HAS_CONSTANT(LLONG_SIZE) +# define Z_z_LLONG_WIDTH (Z_COMPILER_CONSTANT(LLONG_SIZE) * 8) + +#elif (Z_COMPILER_HAS_CONSTANT(ULLONG_MAXIMUM) && Z_COMPILER_HAS_CONSTANT(ULONG_MAXIMUM) && \ + Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == Z_COMPILER_CONSTANT(ULONG_MAXIMUM)) || \ + (Z_COMPILER_HAS_CONSTANT(SLLONG_MAXIMUM) && Z_COMPILER_HAS_CONSTANT(SLONG_MAXIMUM) && \ + Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == Z_COMPILER_CONSTANT(SLONG_MAXIMUM)) || \ + (Z_COMPILER_HAS_CONSTANT(SLONG_MINIMUM) && Z_COMPILER_HAS_CONSTANT(SLONG_MINIMUM) && \ + Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == Z_COMPILER_CONSTANT(SLONG_MINIMUM)) + +# define Z_z_LLONG_WIDTH Z_z_LONG_WIDTH + +#elif Z_DIALECT_HAS_TYPE(C99, LONG_LONG) || Z_DIALECT_HAS_TYPE(CPP11, LONG_LONG) + +# if Z_COMPILER_HAS_CONSTANT(ULLONG_MAXIMUM) +# if Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 65535ULL +# define Z_z_LLONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 16777215ULL +# define Z_z_LLONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 4294967295ULL +# define Z_z_LLONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 1099511627775ULL +# define Z_z_LLONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 281474976710655ULL +# define Z_z_LLONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 72057594037927935ULL +# define Z_z_LLONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 18446744073709551615ULL +# define Z_z_LLONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(ULLONG_MAXIMUM) == 340282366920938463463374607431768211455ULL +# define Z_z_LLONG_WIDTH 128 +# endif + +# elif Z_COMPILER_HAS_CONSTANT(SLLONG_MAXIMUM) +# if Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 32767LL +# define Z_z_LLONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 8388607LL +# define Z_z_LLONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 2147483647LL +# define Z_z_LLONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 549755813887LL +# define Z_z_LLONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 140737488355327LL +# define Z_z_LLONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 36028797018963967LL +# define Z_z_LLONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 9223372036854775807LL +# define Z_z_LLONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SLLONG_MAXIMUM) == 170141183460469231731687303715884105727LL +# define Z_z_LLONG_WIDTH 128 +# endif + +# elif Z_COMPILER_HAS_CONSTANT(SLLONG_MINIMUM) +# if Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -32767LL - 1LL +# define Z_z_LLONG_WIDTH 16 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -8388607LL - 1LL +# define Z_z_LLONG_WIDTH 24 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -2147483647LL - 1LL +# define Z_z_LLONG_WIDTH 32 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -549755813887LL - 1LL +# define Z_z_LLONG_WIDTH 40 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -140737488355327LL - 1LL +# define Z_z_LLONG_WIDTH 48 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -36028797018963967LL - 1LL +# define Z_z_LLONG_WIDTH 56 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -9223372036854775807LL - 1LL +# define Z_z_LLONG_WIDTH 64 +# elif Z_COMPILER_CONSTANT(SLLONG_MINIMUM) == -170141183460469231731687303715884105727LL - 1LL +# define Z_z_LLONG_WIDTH 64 +# endif + +# endif + +#endif + +#ifndef Z_z_LLONG_WIDTH +# define Z_z_LLONG_WIDTH 0 +#endif + +#if Z_COMPILER_HAS_CONSTANT(POINTER_WIDTH) +# define Z_z_POINTER_WIDTH Z_COMPILER_CONSTANT(POINTER_WIDTH) +#elif Z_COMPILER_HAS_CONSTANT(POINTER_SIZE) +# define Z_z_POINTER_WIDTH (Z_COMPILER_CONSTANT(POINTER_SIZE) * 8) +#elif Z_COMPILER_HAS_CONSTANT(SIZE_WIDTH) +# define Z_z_POINTER_WIDTH Z_COMPILER_CONSTANT(SIZE_WIDTH) +#elif Z_COMPILER_HAS_CONSTANT(SIZE_SIZE) +# define Z_z_POINTER_WIDTH (Z_COMPILER_CONSTANT(SIZE_SIZE) * 8) +#elif Z_COMPILER_HAS_CONSTANT(UINTPTR_WIDTH) +# define Z_z_POINTER_WIDTH Z_COMPILER_CONSTANT(UINTPTR_WIDTH) +#elif Z_COMPILER_HAS_CONSTANT(UINTPTR_SIZE) +# define Z_z_POINTER_WIDTH (Z_COMPILER_CONSTANT(UINTPTR_SIZE) * 8) +#elif Z_COMPILER_HAS_CONSTANT(SINTPTR_WIDTH) +# define Z_z_POINTER_WIDTH Z_COMPILER_CONSTANT(SINTPTR_WIDTH) +#elif Z_COMPILER_HAS_CONSTANT(SINTPTR_SIZE) +# define Z_z_POINTER_WIDTH (Z_COMPILER_CONSTANT(SINTPTR_SIZE) * 8) +#else +# define Z_z_POINTER_WIDTH 0 +#endif + +#if Z_z_SHORT_WIDTH == 16 +# if Z_z_INT_WIDTH == 16 + +# if Z_z_LONG_WIDTH == 32 && \ + Z_z_LLONG_WIDTH == 32 && \ + Z_z_POINTER_WIDTH == 32 + +# define Z_DATA_MODEL Z_DATA_MODEL_I16LP32 + +# elif Z_z_LONG_WIDTH == 32 && \ + Z_z_LLONG_WIDTH == 32 && \ + Z_z_POINTER_WIDTH == 16 + +# define Z_DATA_MODEL Z_DATA_MODEL_IP16L32 + +# elif Z_z_LONG_WIDTH == 32 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 32 + +# define Z_DATA_MODEL Z_DATA_MODEL_LP32 +# endif + +# elif Z_z_INT_WIDTH == 32 + +# if Z_z_LONG_WIDTH == 32 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 32 + +# define Z_DATA_MODEL Z_DATA_MODEL_ILP32 + +# elif Z_z_LONG_WIDTH == 32 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 64 + +# define Z_DATA_MODEL Z_DATA_MODEL_LLP64 + +# elif Z_z_LONG_WIDTH == 64 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 64 + +# define Z_DATA_MODEL Z_DATA_MODEL_LP64 +# endif + +# elif Z_z_INT_WIDTH == 64 && \ + Z_z_LONG_WIDTH == 64 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 64 + +# define Z_DATA_MODEL Z_DATA_MODEL_ILP64 +# endif + +#elif Z_z_SHORT_WIDTH == 64 && \ + Z_z_INT_WIDTH == 64 && \ + Z_z_LONG_WIDTH == 64 && \ + Z_z_LLONG_WIDTH == 64 && \ + Z_z_POINTER_WIDTH == 64 + +# define Z_DATA_MODEL Z_DATA_MODEL_SILP64 +#endif + +#undef Z_z_SHORT_WIDTH +#undef Z_z_INT_WIDTH +#undef Z_z_LONG_WIDTH +#undef Z_z_LLONG_WIDTH +#undef Z_z_POINTER_WIDTH + +#ifndef Z_DATA_MODEL +# include +# include +# include + +# if Z_OS_IS(UNICOS) +# define Z_DATA_MODEL Z_DATA_MODEL_SILP64 + +# elif Z_OS_IS(WINDOWS) && (Z_ISA_IS(X86_64) || Z_ISA_IS(ITANIUM)) +# define Z_DATA_MODEL Z_DATA_MODEL_LLP64 + +# elif Z_OS_IS(MAC_OS_X) && (Z_ISA_IS(X86_64) || Z_ISA_IS(POWERPC_64BIT)) +# define Z_DATA_MODEL Z_DATA_MODEL_LP64 + +# elif (Z_OS_IS(LINUX ) && Z_ISA_IS(X86_32)) || \ + (Z_OS_IS(WINDOWS ) && Z_ISA_IS(X86_32)) || \ + (Z_OS_IS(MAC_OS_X) && ((Z_ISA_IS(X86_32) || Z_ISA_IS(POWERPC_32BIT)))) + +# define Z_DATA_MODEL Z_DATA_MODEL_ILP32 +# endif +#endif + +#endif /* Z_inspection_data_model_deduction_H */ diff --git a/projects/Zeta/API/Z/inspection/data_model/detection.h b/projects/Zeta/API/Z/inspection/data_model/detection.h new file mode 100644 index 0000000..26df80e --- /dev/null +++ b/projects/Zeta/API/Z/inspection/data_model/detection.h @@ -0,0 +1,48 @@ +/* Zeta API - Z/inspection/data_model/detection.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_data_model_detection_H +#define Z_inspection_data_model_detection_H + +#if defined(__ILP32__) || \ + defined(__ILP32 ) || \ + defined(_ILP32_ ) || \ + defined(_ILP32 ) + +# define Z_DATA_MODEL Z_DATA_MODEL_ILP32 + +#elif defined(__ILP64__) || \ + defined(__ILP64 ) || \ + defined(_ILP64_ ) || \ + defined(_ILP64 ) + +# define Z_DATA_MODEL Z_DATA_MODEL_ILP64 + +#elif defined(__LLP64__) || \ + defined(__LLP64 ) || \ + defined(_LLP64_ ) || \ + defined(_LLP64 ) + +# define Z_DATA_MODEL Z_DATA_MODEL_LLP64 + +#elif defined(__LP32__) || \ + defined(__LP32 ) || \ + defined(_LP32_ ) || \ + defined(_LP32 ) + +# define Z_DATA_MODEL Z_DATA_MODEL_LP32 + +#elif defined(__LP64__) || \ + defined(__LP64 ) || \ + defined(_LP64_ ) || \ + defined(_LP64 ) + +# define Z_DATA_MODEL Z_DATA_MODEL_LP64 +#endif + +#endif /* Z_inspection_data_model_detection_H */ diff --git a/projects/Zeta/API/Z/inspection/floating-point.h b/projects/Zeta/API/Z/inspection/floating-point.h new file mode 100644 index 0000000..f64a087 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/floating-point.h @@ -0,0 +1,334 @@ +/* Zeta API - Z/inspection/floating-point.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_floating_point_H +#define Z_inspection_floating_point_H + +#include +#include +#include +#include + +#if Z_DIALECT_HAS_TYPE(C, DOUBLE) +# ifndef Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE Z_COMPILER_FIXED_FUNDAMENTAL_DOUBLE +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE Z_FUNDAMENTAL_BFP64 +# endif +# endif + +# if Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE == Z_FUNDAMENTAL_BFP64 +# define Z_FLOATING_POINT_TYPE_BFP64 double +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP64 Z_FUNDAMENTAL_DOUBLE +# define Z_FLOATING_POINT_LITERAL_BFP64 Z_SAME + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE == Z_FUNDAMENTAL_DFP64 +# define Z_FLOATING_POINT_TYPE_DFP64 double +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP64 Z_FUNDAMENTAL_DOUBLE +# define Z_FLOATING_POINT_LITERAL_DFP64 Z_SAME + +# else +# error "Invalid Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DOUBLE key." +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, FLOAT) +# ifndef Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT Z_FUNDAMENTAL_BFP32 +# endif +# endif + +# if Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT == Z_FUNDAMENTAL_BFP32 +# ifndef Z_FLOATING_POINT_TYPE_BFP32 +# define Z_FLOATING_POINT_TYPE_BFP32 float +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP32 Z_FUNDAMENTAL_FLOAT +# define Z_FLOATING_POINT_LITERAL_BFP32 Z_SUFFIX_F +# endif + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT == Z_FUNDAMENTAL_DFP32 +# ifndef Z_FLOATING_POINT_TYPE_DFP32 +# define Z_FLOATING_POINT_TYPE_DFP32 float +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP32 Z_FUNDAMENTAL_FLOAT +# define Z_FLOATING_POINT_LITERAL_DFP32 Z_SUFFIX_F +# endif + +# else +# error "Invalid Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT key." +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C89, LONG_DOUBLE) +# ifndef Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE Z_COMPILER_FIXED_FUNDAMENTAL_LDOUBLE +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE Z_FUNDAMENTAL_BFP128 +# endif +# endif + +# if Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_BFP64 +# ifndef Z_FLOATING_POINT_TYPE_BFP64 +# define Z_FLOATING_POINT_TYPE_BFP64 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP64 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_BFP64 Z_SUFFIX_L +# endif + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_DFP64 +# ifndef Z_FLOATING_POINT_TYPE_DFP64 +# define Z_FLOATING_POINT_TYPE_DFP64 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP64 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_DFP64 Z_SUFFIX_L +# endif + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_BFP128 +# define Z_FLOATING_POINT_TYPE_BFP128 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP128 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_BFP128 Z_SUFFIX_L + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_DFP128 +# define Z_FLOATING_POINT_TYPE_DFP128 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP128 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_DFP128 Z_SUFFIX_L + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_X87_DE80 +# define Z_FLOATING_POINT_TYPE_X87_DE80 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE80 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_X87_DE80 Z_SUFFIX_L + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_X87_DE96 +# define Z_FLOATING_POINT_TYPE_X87_DE96 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE96 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_X87_DE96 Z_SUFFIX_L + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_X87_DE128 +# define Z_FLOATING_POINT_TYPE_X87_DE128 long double +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE128 Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_X87_DE128 Z_SUFFIX_L + +# elif Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE == Z_FUNDAMENTAL_IBM_ED +# define Z_FLOATING_POINT_TYPE_IBM_ED long double +# define Z_FLOATING_POINT_FUNDAMENTAL_IBM_ED Z_FUNDAMENTAL_LDOUBLE +# define Z_FLOATING_POINT_LITERAL_IBM_ED Z_SUFFIX_L + +# else +# error "Invalid Z_FLOATING_POINT_FIXED_FUNDAMENTAL_LDOUBLE key." +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_BFP16 +# if Z_DIALECT_HAS_TYPE(C, FLOAT16) +# define Z_FLOATING_POINT_TYPE_BFP16 _Float16 +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP16 Z_FUNDAMENTAL_FLOAT16 +# define Z_FLOATING_POINT_LITERAL_BFP16 Z_SUFFIX_F16 + +# elif Z_COMPILER_HAS_TYPE(BFP16) +# define Z_FLOATING_POINT_TYPE_BFP16 Z_COMPILER_TYPE(BFP16) +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP16 Z_FUNDAMENTAL_BFP16 + +# if Z_COMPILER_HAS_LITERAL(BFP16) +# define Z_FLOATING_POINT_LITERAL_BFP16 Z_COMPILER_LITERAL(BFP16) +# else +# define Z_FLOATING_POINT_LITERAL_BFP16 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_BFP32 +# if Z_DIALECT_HAS_TYPE(C, FLOAT32) +# define Z_FLOATING_POINT_TYPE_BFP32 _Float32 +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP32 Z_FUNDAMENTAL_FLOAT32 +# define Z_FLOATING_POINT_LITERAL_BFP32 Z_SUFFIX_F32 + +# elif Z_COMPILER_HAS_TYPE(BFP32) +# define Z_FLOATING_POINT_TYPE_BFP32 Z_COMPILER_TYPE(BFP32) +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP32 Z_FUNDAMENTAL_BFP32 + +# if Z_COMPILER_HAS_LITERAL(BFP32) +# define Z_FLOATING_POINT_LITERAL_BFP32 Z_COMPILER_LITERAL(BFP32) +# else +# define Z_FLOATING_POINT_LITERAL_BFP32 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_BFP64 +# if Z_DIALECT_HAS_TYPE(C, FLOAT64) +# define Z_FLOATING_POINT_TYPE_BFP64 _Float64 +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP64 Z_FUNDAMENTAL_FLOAT64 +# define Z_FLOATING_POINT_LITERAL_BFP64 Z_SUFFIX_F64 + +# elif Z_COMPILER_HAS_TYPE(BFP64) +# define Z_FLOATING_POINT_TYPE_BFP64 Z_COMPILER_TYPE(BFP64) +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP64 Z_FUNDAMENTAL_BFP64 + +# if Z_COMPILER_HAS_LITERAL(BFP64) +# define Z_FLOATING_POINT_LITERAL_BFP64 Z_COMPILER_LITERAL(BFP64) +# else +# define Z_FLOATING_POINT_LITERAL_BFP64 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_BFP128 +# if Z_DIALECT_HAS_TYPE(C, FLOAT128) +# define Z_FLOATING_POINT_TYPE_BFP128 _Float128 +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP128 Z_FUNDAMENTAL_FLOAT128 +# define Z_FLOATING_POINT_LITERAL_BFP128 Z_SUFFIX_F128 + +# elif Z_COMPILER_HAS_TYPE(BFP128) +# define Z_FLOATING_POINT_TYPE_BFP128 Z_COMPILER_TYPE(BFP128) +# define Z_FLOATING_POINT_FUNDAMENTAL_BFP128 Z_FUNDAMENTAL_BFP128 + +# if Z_COMPILER_HAS_LITERAL(BFP128) +# define Z_FLOATING_POINT_LITERAL_BFP128 Z_COMPILER_LITERAL(BFP128) +# else +# define Z_FLOATING_POINT_LITERAL_BFP128 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_DFP32 +# if Z_DIALECT_HAS_TYPE(C, DECIMAL32) +# define Z_FLOATING_POINT_TYPE_DFP32 _Decimal32 +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP32 Z_FUNDAMENTAL_DECIMAL32 +# define Z_FLOATING_POINT_LITERAL_DFP32 Z_SUFFIX_DF + +# elif Z_COMPILER_HAS_TYPE(DFP32) +# define Z_FLOATING_POINT_TYPE_DFP32 Z_COMPILER_TYPE(DFP32) +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP32 Z_FUNDAMENTAL_DFP32 + +# if Z_COMPILER_HAS_LITERAL(DFP32) +# define Z_FLOATING_POINT_LITERAL_DFP32 Z_COMPILER_LITERAL(DFP32) +# else +# define Z_FLOATING_POINT_LITERAL_DFP32 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_DFP64 +# if Z_DIALECT_HAS_TYPE(C, DECIMAL64) +# define Z_FLOATING_POINT_TYPE_DFP64 _Decimal64 +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP64 Z_FUNDAMENTAL_DECIMAL64 +# define Z_FLOATING_POINT_LITERAL_DFP64 Z_SUFFIX_DF + +# elif Z_COMPILER_HAS_TYPE(DFP64) +# define Z_FLOATING_POINT_TYPE_DFP64 Z_COMPILER_TYPE(DFP64) +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP64 Z_FUNDAMENTAL_DFP64 + +# if Z_COMPILER_HAS_LITERAL(DFP64) +# define Z_FLOATING_POINT_LITERAL_DFP64 Z_COMPILER_LITERAL(DFP64) +# else +# define Z_FLOATING_POINT_LITERAL_DFP64 Z_SAME +# endif +# endif +#endif + +#ifndef Z_FLOATING_POINT_TYPE_DFP128 +# if Z_DIALECT_HAS_TYPE(C, DECIMAL128) +# define Z_FLOATING_POINT_TYPE_DFP128 _Decimal128 +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP128 Z_FUNDAMENTAL_DECIMAL128 +# define Z_FLOATING_POINT_LITERAL_DFP128 Z_SUFFIX_DF + +# elif Z_COMPILER_HAS_TYPE(DFP128) +# define Z_FLOATING_POINT_TYPE_DFP128 Z_COMPILER_TYPE(DFP128) +# define Z_FLOATING_POINT_FUNDAMENTAL_DFP128 Z_FUNDAMENTAL_DFP128 + +# if Z_COMPILER_HAS_LITERAL(DFP128) +# define Z_FLOATING_POINT_LITERAL_DFP128 Z_COMPILER_LITERAL(DFP128) +# else +# define Z_FLOATING_POINT_LITERAL_DFP128 Z_SAME +# endif +# endif +#endif + +#if !defined(Z_FLOATING_POINT_TYPE_X87_DE80) && Z_COMPILER_HAS_TYPE(X87_DE80) +# define Z_FLOATING_POINT_TYPE_X87_DE80 Z_COMPILER_TYPE(X87_DE80) +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE80 Z_FUNDAMENTAL_X87_DE80 + +# if Z_COMPILER_HAS_LITERAL(X87_DE80) +# define Z_FLOATING_POINT_LITERAL_X87_DE80 Z_COMPILER_LITERAL(X87_DE80) +# else +# define Z_FLOATING_POINT_LITERAL_X87_DE80 Z_SAME +# endif +#endif + +#if !defined(Z_FLOATING_POINT_TYPE_X87_DE96) && Z_COMPILER_HAS_TYPE(X87_DE96) +# define Z_FLOATING_POINT_TYPE_X87_DE96 Z_COMPILER_TYPE(X87_DE96) +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE96 Z_FUNDAMENTAL_X87_DE96 + +# if Z_COMPILER_HAS_LITERAL(X87_DE96) +# define Z_FLOATING_POINT_LITERAL_X87_DE96 Z_COMPILER_LITERAL(X87_DE96) +# else +# define Z_FLOATING_POINT_LITERAL_X87_DE96 Z_SAME +# endif +#endif + +#if !defined(Z_FLOATING_POINT_TYPE_X87_DE128) && Z_COMPILER_HAS_TYPE(X87_DE128) +# define Z_FLOATING_POINT_TYPE_X87_DE128 Z_COMPILER_TYPE(X87_DE128) +# define Z_FLOATING_POINT_FUNDAMENTAL_X87_DE128 Z_FUNDAMENTAL_X87_DE128 + +# if Z_COMPILER_HAS_LITERAL(X87_DE128) +# define Z_FLOATING_POINT_LITERAL_X87_DE128 Z_COMPILER_LITERAL(X87_DE128) +# else +# define Z_FLOATING_POINT_LITERAL_X87_DE128 Z_SAME +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, FLOAT32X) && !defined(Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT32X) +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT32X Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT32X +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT32X Z_FUNDAMENTAL_BFP64 +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, FLOAT64X) && !defined(Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT64X) +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT64X Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT64X +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT64X Z_FUNDAMENTAL_BFP128 +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, FLOAT128X) && !defined(Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT128X) +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT128X Z_COMPILER_FIXED_FUNDAMENTAL_FLOAT128X +# else +# error "Z_FLOATING_POINT_FIXED_FUNDAMENTAL_FLOAT128X not defined." +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, DECIMAL64X) && !defined(Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL64X) +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL64X Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL64X +# else +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL64X Z_FUNDAMENTAL_DFP128 +# endif +#endif + +#if Z_DIALECT_HAS_TYPE(C, DECIMAL128X) && !defined(Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL128X) +# ifdef Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X +# define Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL128X Z_COMPILER_FIXED_FUNDAMENTAL_DECIMAL128X +# else +# error "Z_FLOATING_POINT_FIXED_FUNDAMENTAL_DECIMAL128X not defined." +# endif +#endif + +#include + +#define Z_FLOATING_POINT_HAS_TYPE( TYPE) Z_IS_TRUE(Z_FLOATING_POINT_HAS_TYPE_##TYPE) +#define Z_FLOATING_POINT_TYPE( TYPE) Z_FLOATING_POINT_TYPE_##TYPE +#define Z_FLOATING_POINT_LITERAL( TYPE) Z_FLOATING_POINT_LITERAL_##TYPE +#define Z_FLOATING_POINT_FUNDAMENTAL( TYPE) Z_FLOATING_POINT_FUNDAMENTAL_##TYPE +#define Z_FLOATING_POINT_FIXED_FUNDAMENTAL(TYPE) Z_FLOATING_POINT_FIXED_FUNDAMENTAL_##TYPE + +#endif /* Z_inspection_floating_point_H */ diff --git a/projects/Zeta/API/Z/inspection/floating-point/completion.h b/projects/Zeta/API/Z/inspection/floating-point/completion.h new file mode 100644 index 0000000..87e66b4 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/floating-point/completion.h @@ -0,0 +1,60 @@ +/* Zeta API - Z/inspection/floating-point/completion.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_floating_point_completion_H +#define Z_inspection_floating_point_completion_H + +#ifdef Z_FLOATING_POINT_TYPE_BFP16 +# define Z_FLOATING_POINT_HAS_TYPE_BFP16 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_BFP32 +# define Z_FLOATING_POINT_HAS_TYPE_BFP32 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_BFP64 +# define Z_FLOATING_POINT_HAS_TYPE_BFP64 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_BFP128 +# define Z_FLOATING_POINT_HAS_TYPE_BFP128 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_DFP32 +# define Z_FLOATING_POINT_HAS_TYPE_DFP32 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_DFP64 +# define Z_FLOATING_POINT_HAS_TYPE_DFP64 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_DFP128 +# define Z_FLOATING_POINT_HAS_TYPE_DFP128 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_X87_DE80 +# define Z_FLOATING_POINT_HAS_TYPE_X87_DE80 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_X87_DE96 +# define Z_FLOATING_POINT_HAS_TYPE_X87_DE96 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_X87_DE128 +# define Z_FLOATING_POINT_HAS_TYPE_X87_DE128 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_IBM_ED +# define Z_FLOATING_POINT_HAS_TYPE_IBM_ED 1 +#endif + +#ifdef Z_FLOATING_POINT_TYPE_BFLOAT16 +# define Z_FLOATING_POINT_HAS_TYPE_BFLOAT16 1 +#endif + +#endif /* Z_inspection_floating_point_completion_H */ diff --git a/projects/Zeta/API/Z/inspection/language.h b/projects/Zeta/API/Z/inspection/language.h new file mode 100644 index 0000000..456d878 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/language.h @@ -0,0 +1,192 @@ +/* Zeta API - Z/inspection/language.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_language_H +#define Z_inspection_language_H + +#include +#include +#include + +#if defined(__OBJC__) || defined(__OBJC2__) +# ifdef __cplusplus +# include +# define Z_LANGUAGE Z_LANGUAGE_OBJECTIVE_CPP +# else +# define Z_LANGUAGE Z_LANGUAGE_OBJECTIVE_C +# endif + +#elif defined(__cplusplus) +# include +# define Z_LANGUAGE Z_LANGUAGE_CPP + +#else +# define Z_LANGUAGE Z_LANGUAGE_C +#endif + +#define Z_LANGUAGE_INCLUDES(LANGUAGE) \ + ((Z_LANGUAGE & Z_LANGUAGE_##LANGUAGE) == Z_LANGUAGE_##LANGUAGE) + +#define Z_C_FLAG(FLAG) Z_IS_TRUE(FLAG) + +#if Z_LANGUAGE_INCLUDES(CPP) +# define Z_CPP_FLAG(FLAG) Z_IS_TRUE(FLAG) +#else +# define Z_CPP_FLAG(FLAG) 0 +#endif + +#if Z_LANGUAGE_INCLUDES(OBJECTIVE_C) +# define Z_OBJECTIVE_C_FLAG(FLAG) Z_IS_TRUE(FLAG) +#else +# define Z_OBJECTIVE_C_FLAG(FLAG) 0 +#endif + +#if defined(Z_USE_LANGUAGE_STD) || Z_COMPILER == Z_COMPILER_UNKNOWN +# define Z_DIALECT_HAS(LANGUAGE, FEATURE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_##FEATURE) + +# define Z_DIALECT_HAS_ATTRIBUTE(LANGUAGE, ATTRIBUTE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_ATTRIBUTE_##ATTRIBUTE) + +# define Z_DIALECT_HAS_ESCAPE_SEQUENCE(LANGUAGE, ESCAPE_SEQUENCE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_ESCAPE_SEQUENCE_##ESCAPE_SEQUENCE) + +# define Z_DIALECT_HAS_IDENTIFIER(LANGUAGE, IDENTIFIER) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_IDENTIFIER_##IDENTIFIER) + +# define Z_DIALECT_HAS_LITERAL(LANGUAGE, LITERAL) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_LITERAL_##LITERAL) + +# define Z_DIALECT_HAS_OPERATOR(LANGUAGE, OPERATOR) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_OPERATOR_##OPERATOR) + +# define Z_DIALECT_HAS_OPERATOR_CASE(LANGUAGE, OPERATOR_CASE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_OPERATOR_CASE_##OPERATOR_CASE) + +# define Z_DIALECT_HAS_PREPROCESSOR_DIRECTIVE(LANGUAGE, PREPROCESSOR_DIRECTIVE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_DIRECTIVE_##PREPROCESSOR_DIRECTIVE) + +# define Z_DIALECT_HAS_PREPROCESSOR_IDENTIFIER(LANGUAGE, PREPROCESSOR_IDENTIFIER) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_IDENTIFIER_##PREPROCESSOR_IDENTIFIER) + +# define Z_DIALECT_HAS_PREPROCESSOR_OPERATOR(LANGUAGE, PREPROCESSOR_OPERATOR) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR) + +# define Z_DIALECT_HAS_SPECIFIER(LANGUAGE, SPECIFIER) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_SPECIFIER_##SPECIFIER) + +# define Z_DIALECT_HAS_SPECIFIER_CASE(LANGUAGE, SPECIFIER_CASE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_SPECIFIER_CASE_##SPECIFIER_CASE) + +# define Z_DIALECT_HAS_STD_PRAGMA(LANGUAGE, STD_PRAGMA) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_STD_PRAGMA_##STD_PRAGMA) + +# define Z_DIALECT_HAS_STORAGE_CLASS(LANGUAGE, STORAGE_CLASS) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_STORAGE_CLASS_##STORAGE_CLASS) + +# define Z_DIALECT_HAS_TYPE(LANGUAGE, TYPE) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_##TYPE) + +# define Z_DIALECT_HAS_TYPE_MODIFIER(LANGUAGE, TYPE_MODIFIER) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_MODIFIER_##TYPE_MODIFIER) + +# define Z_DIALECT_HAS_TYPE_QUALIFIER(LANGUAGE, TYPE_QUALIFIER) \ + Z_IS_TRUE(Z_COMPILER_HAS_##LANGUAGE##_TYPE_QUALIFIER_##TYPE_QUALIFIER) + + +#elif defined(Z_USE_SUPPORTED_LANGUAGE_STD) + +# define Z_DIALECT_HAS(LANGUAGE, FEATURE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_##FEATURE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_##FEATURE)) + +# define Z_DIALECT_HAS_ATTRIBUTE(LANGUAGE, ATTRIBUTE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_ATTRIBUTE_##ATTRIBUTE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_ATTRIBUTE_##ATTRIBUTE)) + +# define Z_DIALECT_HAS_ESCAPE_SEQUENCE(LANGUAGE, ESCAPE_SEQUENCE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_ESCAPE_SEQUENCE_##ESCAPE_SEQUENCE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_ESCAPE_SEQUENCE_##ESCAPE_SEQUENCE)) + +# define Z_DIALECT_HAS_IDENTIFIER(LANGUAGE, IDENTIFIER) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_IDENTIFIER_##IDENTIFIER) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_IDENTIFIER_##IDENTIFIER)) + +# define Z_DIALECT_HAS_LITERAL(LANGUAGE, LITERAL) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_LITERAL_##LITERAL) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_LITERAL_##LITERAL)) + +# define Z_DIALECT_HAS_OPERATOR(LANGUAGE, OPERATOR) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_OPERATOR_##OPERATOR) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_OPERATOR_##OPERATOR)) + +# define Z_DIALECT_HAS_OPERATOR_CASE(LANGUAGE, OPERATOR, CASE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_OPERATOR_CASE_##OPERATOR##_##CASE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_OPERATOR_CASE_##OPERATOR##_##CASE)) + +# define Z_DIALECT_HAS_PREPROCESSOR_DIRECTIVE(LANGUAGE, PREPROCESSOR_DIRECTIVE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_PREPROCESSOR_DIRECTIVE_##PREPROCESSOR_DIRECTIVE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_PREPROCESSOR_DIRECTIVE_##PREPROCESSOR_DIRECTIVE)) + +# define Z_DIALECT_HAS_PREPROCESSOR_IDENTIFIER(LANGUAGE, PREPROCESSOR_IDENTIFIER) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_PREPROCESSOR_IDENTIFIER_##PREPROCESSOR_IDENTIFIER) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_PREPROCESSOR_IDENTIFIER_##PREPROCESSOR_IDENTIFIER)) + +# define Z_DIALECT_HAS_PREPROCESSOR_OPERATOR(LANGUAGE, PREPROCESSOR_OPERATOR) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_PREPROCESSOR_OPERATOR_##PREPROCESSOR_OPERATOR)) + +# define Z_DIALECT_HAS_SPECIFIER(LANGUAGE, SPECIFIER) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_SPECIFIER_##SPECIFIER) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_SPECIFIER_##SPECIFIER)) + +# define Z_DIALECT_HAS_SPECIFIER_CASE(LANGUAGE, SPECIFIER, CASE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_SPECIFIER_CASE_##SPECIFIER##_##CASE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_SPECIFIER_CASE_##SPECIFIER##_##CASE)) + +# define Z_DIALECT_HAS_STD_PRAGMA(LANGUAGE, STD_PRAGMA) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_STD_PRAGMA_##STD_PRAGMA) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_STD_PRAGMA_##STD_PRAGMA)) + +# define Z_DIALECT_HAS_STORAGE_CLASS(LANGUAGE, STORAGE_CLASS) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_STORAGE_CLASS_##STORAGE_CLASS) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_STORAGE_CLASS_##STORAGE_CLASS)) + +# define Z_DIALECT_HAS_TYPE(LANGUAGE, TYPE) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_TYPE_##TYPE) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_TYPE_##TYPE)) + +# define Z_DIALECT_HAS_TYPE_MODIFIER(LANGUAGE, TYPE_MODIFIER) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_TYPE_MODIFIER_##TYPE_MODIFIER) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_TYPE_MODIFIER_##TYPE_MODIFIER)) + +# define Z_DIALECT_HAS_TYPE_QUALIFIER(LANGUAGE, TYPE_QUALIFIER) ( \ + Z_##LANGUAGE##_FLAG(Z_##LANGUAGE##_HAS_TYPE_QUALIFIER_##TYPE_QUALIFIER) && \ + Z_##LANGUAGE##_FLAG(Z_COMPILER_##LANGUAGE##_HAS_TYPE_QUALIFIER_##TYPE_QUALIFIER)) + +#else +# define Z_DIALECT_HAS Z_COMPILER_DIALECT_HAS +# define Z_DIALECT_HAS_ATTRIBUTE Z_COMPILER_DIALECT_HAS_ATTRIBUTE +# define Z_DIALECT_HAS_ESCAPE_SEQUENCE Z_COMPILER_DIALECT_HAS_ESCAPE_SEQUENCE +# define Z_DIALECT_HAS_IDENTIFIER Z_COMPILER_DIALECT_HAS_IDENTIFIER +# define Z_DIALECT_HAS_LITERAL Z_COMPILER_DIALECT_HAS_LITERAL +# define Z_DIALECT_HAS_OPERATOR Z_COMPILER_DIALECT_HAS_OPERATOR +# define Z_DIALECT_HAS_OPERATOR_CASE Z_COMPILER_DIALECT_HAS_OPERATOR_CASE +# define Z_DIALECT_HAS_PREPROCESSOR_DIRECTIVE Z_COMPILER_DIALECT_HAS_PREPROCESSOR_DIRECTIVE +# define Z_DIALECT_HAS_PREPROCESSOR_IDENTIFIER Z_COMPILER_DIALECT_HAS_PREPROCESSOR_IDENTIFIER +# define Z_DIALECT_HAS_PREPROCESSOR_OPERATOR Z_COMPILER_DIALECT_HAS_PREPROCESSOR_OPERATOR +# define Z_DIALECT_HAS_SPECIFIER Z_COMPILER_DIALECT_HAS_SPECIFIER +# define Z_DIALECT_HAS_SPECIFIER_CASE Z_COMPILER_DIALECT_HAS_SPECIFIER_CASE +# define Z_DIALECT_HAS_STD_PRAGMA Z_COMPILER_DIALECT_HAS_STD_PRAGMA +# define Z_DIALECT_HAS_STORAGE_CLASS Z_COMPILER_DIALECT_HAS_STORAGE_CLASS +# define Z_DIALECT_HAS_TYPE Z_COMPILER_DIALECT_HAS_TYPE +# define Z_DIALECT_HAS_TYPE_MODIFIER Z_COMPILER_DIALECT_HAS_TYPE_MODIFIER +# define Z_DIALECT_HAS_TYPE_QUALIFIER Z_COMPILER_DIALECT_HAS_TYPE_QUALIFIER +#endif + +#endif /* Z_inspection_language_H */ diff --git a/projects/Zeta/API/Z/inspection/platform.h b/projects/Zeta/API/Z/inspection/platform.h new file mode 100644 index 0000000..b3f861c --- /dev/null +++ b/projects/Zeta/API/Z/inspection/platform.h @@ -0,0 +1,30 @@ +/* Zeta API - Z/inspection/platform.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_platform_H +#define Z_inspection_platform_H + +#include + +#ifndef Z_PLATFORM +# include + +# ifdef Z_COMPILER_PLATFORM +# define Z_PLATFORM Z_COMPILER_PLATFORM +# else +# include +# endif +#endif + +#ifndef Z_PLATFORM +# define Z_PLATFORM Z_PLATFORM_UNKNOWN +#endif + +#define Z_PLATFORM_IS(PLATFORM) (Z_PLATFORM == Z_PLATFORM_##PLATFORM) + +#endif /* Z_inspection_platform_H */ diff --git a/projects/Zeta/API/Z/inspection/platform/detection.h b/projects/Zeta/API/Z/inspection/platform/detection.h new file mode 100644 index 0000000..1b2d292 --- /dev/null +++ b/projects/Zeta/API/Z/inspection/platform/detection.h @@ -0,0 +1,98 @@ +/* Zeta API - Z/inspection/platform/detection.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_inspection_platform_detection_H +#define Z_inspection_platform_detection_H + +/* Computers */ + +#if defined(__APPLE2__) || (__APPLE2ENH__) +# define Z_PLATFORM Z_PLATFORM_APPLE_II + +#elif defined(__ATMOS__) +# define Z_PLATFORM Z_PLATFORM_ATMOS + +#elif defined(__BBC__) +# define Z_PLATFORM Z_PLATFORM_BBC_MICRO + +#elif defined(__CBM610__) +# define Z_PLATFORM Z_PLATFORM_CBM_IIB + +#elif defined(__CBM510__) +# define Z_PLATFORM Z_PLATFORM_CBM_IIP + +#elif defined(__OSIC1P__) +# define Z_PLATFORM Z_PLATFORM_CHALLENGER_1P + +#elif defined(__CX16__) +# define Z_PLATFORM Z_PLATFORM_COMMANDER_X16 + +#elif defined(__C16__) && !defined(__PLUS4__) +# define Z_PLATFORM Z_PLATFORM_COMMODORE_16 + +#elif defined(__C64__) +# define Z_PLATFORM Z_PLATFORM_COMMODORE_64 + +#elif defined(__C128__) +# define Z_PLATFORM Z_PLATFORM_COMMODORE_128 + +#elif defined(_M_MPPC) +# define Z_PLATFORM Z_PLATFORM_MACINTOSH + +#elif defined(__PLUS4__) +# define Z_PLATFORM Z_PLATFORM_PLUS_4 + +#elif defined(__PET__) +# define Z_PLATFORM Z_PLATFORM_PET + +/*#elif defined(__TELESTRAT__) +# define Z_PLATFORM Z_PLATFORM_TELESTRAT*/ + +#elif defined(__VIC20__) +# define Z_PLATFORM Z_PLATFORM_VIC_20 + +/* Consoles */ + +#elif defined(__ATARI2600__) +# define Z_PLATFORM Z_PLATFORM_ATARI_2600 + +#elif defined(__ATARI5200__) +# define Z_PLATFORM Z_PLATFORM_ATARI_5200 + +#elif defined(__CREATIVISION__) +# define Z_PLATFORM Z_PLATFORM_CREATIVISION + +#elif defined(__GAMATE__) +# define Z_PLATFORM Z_PLATFORM_GAMATE + +#elif defined(__LYNX__) +# define Z_PLATFORM Z_PLATFORM_LYNX + +#elif defined(__NES__) +# define Z_PLATFORM Z_PLATFORM_NES + +#elif defined(__PCE__) +# define Z_PLATFORM Z_PLATFORM_PC_ENGINE + +#elif defined(__CELLOS_LV2__) /* (Revisar, puede que sólo para la PPU) */ +# define Z_PLATFORM Z_PLATFORM_PS3 + +#elif defined(__ORBIS__) +# define Z_PLATFORM Z_PLATFORM_PS4 + +#elif defined(__psp__) || \ + defined(_PSP )/* || \ + defined(PSP )*/ + +# define Z_PLATFORM Z_PLATFORM_PSP + +#elif defined(__SUPERVISION__) +# define Z_PLATFORM Z_PLATFORM_SUPERVISION +#endif + +#endif /* Z_inspection_platform_detection_H */ diff --git a/projects/Zeta/API/Z/keys/C++.h b/projects/Zeta/API/Z/keys/C++.h new file mode 100644 index 0000000..d16b3fd --- /dev/null +++ b/projects/Zeta/API/Z/keys/C++.h @@ -0,0 +1,30 @@ +/* Zeta API - Z/keys/C++.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_CPP_H +#define Z_keys_CPP_H + +#define Z_CPP1 1 +#define Z_CPP2 2 +#define Z_CPP98 3 +#define Z_CPP03 4 +#define Z_CPP11 5 +#define Z_CPP14 6 +#define Z_CPP17 7 +#define Z_CPP20 8 + +#define Z_CPP_NAME_CPP1 "C++ v1.0" +#define Z_CPP_NAME_CPP2 "C++ v2.0" +#define Z_CPP_NAME_CPP98 "ISO/IEC 14882:1998" +#define Z_CPP_NAME_CPP03 "ISO/IEC 14882:2003" +#define Z_CPP_NAME_CPP11 "ISO/IEC 14882:2011" +#define Z_CPP_NAME_CPP14 "ISO/IEC 14882:2014" +#define Z_CPP_NAME_CPP17 "ISO/IEC 14882:2017" +#define Z_CPP_NAME_CPP20 "ISO/IEC 14882:2020" + +#endif /* Z_keys_CPP_H */ diff --git a/projects/Zeta/API/Z/keys/C.h b/projects/Zeta/API/Z/keys/C.h new file mode 100644 index 0000000..aa73159 --- /dev/null +++ b/projects/Zeta/API/Z/keys/C.h @@ -0,0 +1,28 @@ +/* Zeta API - Z/keys/C.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_C_H +#define Z_keys_C_H + +#define Z_C78 1 +#define Z_C89 2 +#define Z_C90 3 +#define Z_C95 4 +#define Z_C99 5 +#define Z_C11 6 +#define Z_C17 7 + +#define Z_C_NAME_C78 "K&R C" +#define Z_C_NAME_C89 "ANSI X3.159-1989" +#define Z_C_NAME_C90 "ISO/IEC 9899:1990" +#define Z_C_NAME_C95 "ISO/IEC 9899:1990/AMD1:1995" +#define Z_C_NAME_C99 "ISO/IEC 9899:1999" +#define Z_C_NAME_C11 "ISO/IEC 9899:2011" +#define Z_C_NAME_C17 "ISO/IEC 9899:2018" + +#endif /* Z_keys_C_H */ diff --git a/projects/Zeta/API/Z/keys/ISA.h b/projects/Zeta/API/Z/keys/ISA.h new file mode 100644 index 0000000..10a9b33 --- /dev/null +++ b/projects/Zeta/API/Z/keys/ISA.h @@ -0,0 +1,102 @@ +/* Zeta API - Z/keys/ISA.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_ISA_H +#define Z_keys_ISA_H + +#define Z_ISA_UNKNOWN 0 +#define Z_ISA_6502 1 /* MOS Technology */ +#define Z_ISA_AARCH32 2 /* Acorn Computers */ +#define Z_ISA_AARCH64 3 /* ARM */ +#define Z_ISA_ALPHA 4 /* DEC */ +#define Z_ISA_ARC 5 /* ARC International */ +#define Z_ISA_BLACKFIN 6 /* Analog Devices */ +#define Z_ISA_CONVEX 7 /* Convex Computer */ +#define Z_ISA_EPIPHANY 8 /* Adapteva */ +#define Z_ISA_ESA_370 9 /* IBM */ +#define Z_ISA_ESA_390 10 /* IBM */ +#define Z_ISA_HEXAGON 11 /* Qualcomm */ +#define Z_ISA_IA_64 12 /* Hewlett-Packard / Intel */ +#define Z_ISA_LA32R 13 /* Loongson Technology */ +#define Z_ISA_LA32S 14 /* Loongson Technology */ +#define Z_ISA_LA64 15 /* Loongson Technology */ +#define Z_ISA_LANAI 16 /* Myricom / Google (?) */ /* See: https://q3k.org/lanai.html */ +#define Z_ISA_LATTICE_MICO_32 17 /* Lattice Semiconductor */ +#define Z_ISA_M68K 18 /* Motorola */ +#define Z_ISA_MIPS 19 /* MIPS Computer Systems */ +#define Z_ISA_MIPS64 20 /* MIPS Computer Systems */ +#define Z_ISA_MSP430 21 /* Texas Instruments */ +#define Z_ISA_PA_RISC 22 /* Hewlett-Packard */ +#define Z_ISA_PA_RISC_2 23 /* Hewlett-Packard */ +#define Z_ISA_POWERPC_32BIT 24 /* AIM alliance */ +#define Z_ISA_POWERPC_64BIT 25 /* IBM */ +#define Z_ISA_RV32E 26 /* University of California, Berkeley */ +#define Z_ISA_RV32I 27 /* University of California, Berkeley */ +#define Z_ISA_RV64E 28 /* University of California, Berkeley */ +#define Z_ISA_RV64I 29 /* University of California, Berkeley */ +#define Z_ISA_RV128I 30 /* University of California, Berkeley */ +#define Z_ISA_SPARC 31 /* Sun Microsystems */ +#define Z_ISA_SPARC_V9 32 /* SPARC International */ +#define Z_ISA_SUPERH 33 /* Hitachi */ +#define Z_ISA_SUPERH_5 34 /* Hitachi */ +#define Z_ISA_VAX 35 /* DEC */ +#define Z_ISA_WASM32 36 /* W3C */ +#define Z_ISA_WASM64 37 /* W3C */ +#define Z_ISA_X86_16 38 /* Intel */ +#define Z_ISA_X86_32 39 /* Intel */ +#define Z_ISA_X86_64 40 /* AMD */ +#define Z_ISA_XCORE 41 /* XMOS */ +#define Z_ISA_Z_ARCHITECTURE 42 /* IBM */ +#define Z_ISA_Z80 43 /* Zilog */ + +#define Z_ISA_NAME_UNKNOWN "unknown ISA" +#define Z_ISA_NAME_6502 "6502" +#define Z_ISA_NAME_AARCH32 "AArch32" +#define Z_ISA_NAME_AARCH64 "AArch64" +#define Z_ISA_NAME_ALPHA "Alpha" +#define Z_ISA_NAME_ARC "ARC" +#define Z_ISA_NAME_BLACKFIN "Blackfin" +#define Z_ISA_NAME_CONVEX "Convex" +#define Z_ISA_NAME_EPIPHANY "Epiphany" +#define Z_ISA_NAME_ESA_370 "ESA/370" +#define Z_ISA_NAME_ESA_390 "ESA/390" +#define Z_ISA_NAME_HEXAGON "Hexagon" +#define Z_ISA_NAME_IA_64 "IA-64" +#define Z_ISA_NAME_LA32R "LA32R" +#define Z_ISA_NAME_LA32S "LA32S" +#define Z_ISA_NAME_LA64 "LA64" +#define Z_ISA_NAME_LANAI "Lanai" +#define Z_ISA_NAME_LATTICE_MICO_32 "LatticeMico32" +#define Z_ISA_NAME_M68K "M68K" +#define Z_ISA_NAME_MIPS "MIPS" +#define Z_ISA_NAME_MIPS64 "MIPS64" +#define Z_ISA_NAME_MSP430 "MSP430" +#define Z_ISA_NAME_PA_RISC "PA-RISC" +#define Z_ISA_NAME_PA_RISC_2 "PA-RISC 2.0" +#define Z_ISA_NAME_POWERPC_32BIT "PowerPC 32-bit" +#define Z_ISA_NAME_POWERPC_64BIT "PowerPC 64-bit" +#define Z_ISA_NAME_RV32E "RV32E" +#define Z_ISA_NAME_RV32I "RV32I" +#define Z_ISA_NAME_RV64E "RV64E" +#define Z_ISA_NAME_RV64I "RV64I" +#define Z_ISA_NAME_RV128I "RV128I" +#define Z_ISA_NAME_SPARC "SPARC" +#define Z_ISA_NAME_SPARC_V9 "SPARC V9" +#define Z_ISA_NAME_SUPERH "SuperH" +#define Z_ISA_NAME_SUPERH_5 "SuperH 5" +#define Z_ISA_NAME_VAX "VAX" +#define Z_ISA_NAME_WASM32 "Wasm32" +#define Z_ISA_NAME_WASM64 "Wasm64" +#define Z_ISA_NAME_X86_16 "x86-16" +#define Z_ISA_NAME_X86_32 "x86-32" +#define Z_ISA_NAME_X86_64 "x86-64" +#define Z_ISA_NAME_XCORE "xCORE" +#define Z_ISA_NAME_Z_ARCHITECTURE "z/Architecture" +#define Z_ISA_NAME_Z80 "Z80" + +#endif /* Z_keys_ISA_H */ diff --git a/projects/Zeta/API/Z/keys/OS.h b/projects/Zeta/API/Z/keys/OS.h new file mode 100644 index 0000000..3844f7b --- /dev/null +++ b/projects/Zeta/API/Z/keys/OS.h @@ -0,0 +1,202 @@ +/* Zeta API - Z/keys/OS.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_OS_H +#define Z_keys_OS_H + /* First released by Official website */ +#define Z_OS_UNKNOWN 0 /* -------------------------- ------------------------------------------------------------------------------------------ */ +#define Z_OS_AEGIS 1 /* Apollo Computer */ +#define Z_OS_AIX 2 /* IBM */ +#define Z_OS_AMIGA_OS 3 /* Commodore */ +#define Z_OS_ANANAS_OS 4 /* Springer, Rink */ +#define Z_OS_ANDROID 5 /* Google */ +#define Z_OS_AROS 6 /* AROS Development Team. The */ +#define Z_OS_BE_OS 7 /* Be */ +#define Z_OS_BITRIG 8 /* */ +#define Z_OS_BSD_386 9 /* Berkeley Software Design */ +#define Z_OS_CELL_OS 10 /* Sony (PS3) */ +#define Z_OS_CNK 11 /* IBM */ +#define Z_OS_CONVEX_UNIX 12 /* Convex Computer */ +#define Z_OS_CYGWIN 13 /* Cygnus Solutions */ +#define Z_OS_DC_OSX 14 /* Pyramid Technology */ +#define Z_OS_DG_UX 15 /* Data General */ +#define Z_OS_DOMAIN_OS 16 /* Apollo Computer */ +#define Z_OS_DRAGONFLY_BSD 17 /* Dillon, Matthew */ +#define Z_OS_DYNIX_PTX 18 /* Sequent Computer Systems */ +#define Z_OS_ECOS 19 /* Cygnus Solutions */ +#define Z_OS_FREE_BSD 20 /* FreeBSD Project, The */ +#define Z_OS_FUCHSIA 21 /* Google */ +#define Z_OS_GNU_HURD 22 /* GNU */ +#define Z_OS_HAIKU 23 /* Haiku */ +#define Z_OS_HI_UX_MPP 24 /* Hitachi */ +#define Z_OS_HP_UX 25 /* Hewlett-Packard */ +#define Z_OS_INTEGRITY 26 /* Green Hills Software */ +#define Z_OS_IPHONE_OS 27 /* Apple */ +#define Z_OS_IRIX 28 /* SGI */ +#define Z_OS_LEMON_OS 29 /* Roberts-White, J.J. */ +#define Z_OS_LINUX 30 /* Torvalds, Linus */ +#define Z_OS_LUNIX 31 /* Dallmann, Daniel */ +#define Z_OS_LYNX_OS 32 /* Lynx Software Technologies */ +#define Z_OS_MAC_OS 33 /* Apple Computer */ +#define Z_OS_MAC_OS_X 34 /* Apple Computer */ +#define Z_OS_MINIX 35 /* Tanenbaum, Andrew Stuart */ +#define Z_OS_MORPH_OS 36 /* MorphOS Development Team */ +#define Z_OS_MPE_XL 37 /* Hewlett-Packard */ +#define Z_OS_MS_DOS 38 /* Microsoft */ +#define Z_OS_NET_BSD 39 /* NetBSD Foundation, The */ +#define Z_OS_NETWARE 40 /* Novell */ +#define Z_OS_NEXTSTEP 41 /* NeXT */ +#define Z_OS_NON_STOP_OS 42 /* Hewlett-Packard */ +#define Z_OS_NUCLEUS_RTOS 43 /* Mentor Graphics */ +#define Z_OS_OPEN_BSD 44 /* de Raadt, Theo */ +#define Z_OS_OPEN_VMS 45 /* DEC */ +#define Z_OS_ORBIS_OS 46 /* Sony (PS4) */ +#define Z_OS_OS_2 47 /* IBM / Microsoft */ +#define Z_OS_OS_9 48 /* Microware Systems */ +#define Z_OS_OS_400 49 /* IBM */ +#define Z_OS_OSF_1 50 /* DEC */ +#define Z_OS_PALM_OS 51 /* Palm */ +#define Z_OS_PLAN_9 52 /* Bell Labs */ +#define Z_OS_PSP_SYSTEM_SOFTWARE 53 /* Sony (PSP) */ +#define Z_OS_QNX 54 /* Quantum Software Systems */ +#define Z_OS_RTEMS 55 /* OAR Corporation (?) */ +#define Z_OS_SCO_UNIX_SYSTEM_V 56 /* SCO */ +#define Z_OS_SERENITY_OS 57 /* Kling, Andreas */ +#define Z_OS_SINIX 58 /* Siemens Nixdorf */ +#define Z_OS_SOLARIS 59 /* Sun Microsystems */ +#define Z_OS_SUN_OS 60 /* Sun Microsystems */ +#define Z_OS_SYLLABLE 61 /* */ +#define Z_OS_SYMBIAN 62 /* Symbian */ +#define Z_OS_TVOS 63 /* Apple */ +#define Z_OS_ULTRIX 64 /* DEC */ +#define Z_OS_UNICOS 65 /* Cray */ +#define Z_OS_UNICOS_MP 66 /* SGI (?) */ +#define Z_OS_UNIXWARE 67 /* Univel */ +#define Z_OS_UTS 68 /* Amdahl */ +#define Z_OS_VOS 69 /* Stratus Technologies */ +#define Z_OS_VX_WORKS 70 /* Wind River Systems */ +#define Z_OS_WATCH_OS 71 /* Apple */ +#define Z_OS_WINDOWS 72 /* Microsoft */ +#define Z_OS_WINDOWS_CE 73 /* Microsoft */ +#define Z_OS_XENIX 74 /* Microsoft */ +#define Z_OS_Z_OS 75 /* IBM */ +#define Z_OS_ZETA 76 /* yellowTAB */ + +#define Z_OS_NAME_UNKNOWN "unknown OS" +#define Z_OS_NAME_AEGIS "AEGIS" +#define Z_OS_NAME_AIX "AIX" +#define Z_OS_NAME_AMIGA_OS "AmigaOS" +#define Z_OS_NAME_ANANAS_OS "Ananas/OS" +#define Z_OS_NAME_ANDROID "Android" +#define Z_OS_NAME_AROS "AROS" +#define Z_OS_NAME_BE_OS "BeOS" +#define Z_OS_NAME_BITRIG "Bitrig" +#define Z_OS_NAME_BSD_386 "BSD/386" +#define Z_OS_NAME_CELL_OS "CellOS" +#define Z_OS_NAME_CNK "CNK" +#define Z_OS_NAME_CONVEX_UNIX "Convex UNIX" +#define Z_OS_NAME_CYGWIN "Cygwin" +#define Z_OS_NAME_DC_OSX "DC/OSx" +#define Z_OS_NAME_DG_UX "DG/UX" +#define Z_OS_NAME_DOMAIN_OS "Domain/OS" +#define Z_OS_NAME_DRAGONFLY_BSD "DragonFly BSD" +#define Z_OS_NAME_DYNIX_PTX "DYNIX/ptx" +#define Z_OS_NAME_ECOS "eCos" +#define Z_OS_NAME_FREE_BSD "FreeBSD" +#define Z_OS_NAME_FUCHSIA "Fuchsia" +#define Z_OS_NAME_GNU_HURD "GNU Hurd" +#define Z_OS_NAME_HAIKU "Haiku" +#define Z_OS_NAME_HI_UX_MPP "HI-UX/MPP" +#define Z_OS_NAME_HP_UX "HP-UX" +#define Z_OS_NAME_INTEGRITY "INTEGRITY" +#define Z_OS_NAME_IPHONE_OS "iPhone OS" +#define Z_OS_NAME_IRIX "IRIX" +#define Z_OS_NAME_LEMON_OS "Lemon OS" +#define Z_OS_NAME_LINUX "Linux" +#define Z_OS_NAME_LUNIX "LUnix" +#define Z_OS_NAME_LYNX_OS "LynxOS" +#define Z_OS_NAME_MAC_OS "Mac OS" +#define Z_OS_NAME_MAC_OS_X "Mac OS X" +#define Z_OS_NAME_MINIX "MINIX" +#define Z_OS_NAME_MORPH_OS "MorphOS" +#define Z_OS_NAME_MPE_XL "MPE XL" +#define Z_OS_NAME_MS_DOS "MS-DOS" +#define Z_OS_NAME_NET_BSD "NetBSD" +#define Z_OS_NAME_NETWARE "NetWare" +#define Z_OS_NAME_NEXTSTEP "NeXTSTEP" +#define Z_OS_NAME_NON_STOP_OS "NonStop OS" +#define Z_OS_NAME_NUCLEUS_RTOS "Nucleus RTOS" +#define Z_OS_NAME_OPEN_BSD "OpenBSD" +#define Z_OS_NAME_OPEN_VMS "OpenVMS" +#define Z_OS_NAME_ORBIS_OS "Orbis OS" +#define Z_OS_NAME_OS_2 "OS/2" +#define Z_OS_NAME_OS_9 "OS-9" +#define Z_OS_NAME_OS_400 "OS/400" +#define Z_OS_NAME_OSF_1 "OSF/1" +#define Z_OS_NAME_PALM_OS "Palm OS" +#define Z_OS_NAME_PLAN_9 "Plan 9" +#define Z_OS_NAME_PSP_SYSTEM_SOFTWARE "PlayStation Portable System Software" +#define Z_OS_NAME_QNX "QNX" +#define Z_OS_NAME_RTEMS "RTEMS" +#define Z_OS_NAME_SCO_UNIX_SYSTEM_V "SCO UNIX System V" +#define Z_OS_NAME_SERENITY_OS "SerenityOS" +#define Z_OS_NAME_SINIX "SINIX" +#define Z_OS_NAME_SOLARIS "Solaris" +#define Z_OS_NAME_SUN_OS "SunOS" +#define Z_OS_NAME_SYLLABLE "Syllable" +#define Z_OS_NAME_SYMBIAN "Symbian" +#define Z_OS_NAME_TVOS "tvOS" +#define Z_OS_NAME_ULTRIX "ULTRIX" +#define Z_OS_NAME_UNICOS "UNICOS" +#define Z_OS_NAME_UNICOS_MP "UNICOS/mp" +#define Z_OS_NAME_UNIXWARE "UnixWare" +#define Z_OS_NAME_UTS "UTS" +#define Z_OS_NAME_VOS "VOS" +#define Z_OS_NAME_VX_WORKS "VxWorks" +#define Z_OS_NAME_WATCH_OS "Watch OS" +#define Z_OS_NAME_WINDOWS "Windows" +#define Z_OS_NAME_WINDOWS_CE "Windows CE" +#define Z_OS_NAME_XENIX "XENIX" +#define Z_OS_NAME_Z_OS "z/OS" +#define Z_OS_NAME_ZETA "ZETA" + +#define Z_OS_BSD_I Z_OS_BSD_386 +#define Z_OS_BSD_OS Z_OS_BSD_386 +#define Z_OS_CONVEX_OS Z_OS_CONVEX_UNIX +#define Z_OS_DIGITAL_UNIX Z_OS_OSF_1 +#define Z_OS_I5_OS Z_OS_OS_400 +#define Z_OS_IBM_I Z_OS_OS_400 +#define Z_OS_IOS Z_OS_IPHONE_OS +#define Z_OS_MACOS Z_OS_MAC_OS_X +#define Z_OS_OPEN_DESKTOP Z_OS_SCO_UNIX_SYSTEM_V +#define Z_OS_OPEN_SERVER Z_OS_SCO_UNIX_SYSTEM_V /* Not sure */ +#define Z_OS_OPEN_UNIX Z_OS_UNIXWARE +#define Z_OS_OS_X Z_OS_MAC_OS_X +#define Z_OS_RELIANT_UNIX Z_OS_SINIX +#define Z_OS_SCO_UNIX Z_OS_SCO_UNIX_SYSTEM_V +#define Z_OS_TRU64_UNIX Z_OS_OSF_1 +#define Z_OS_WATCHOS Z_OS_WATCH_OS + +#define Z_OS_NAME_BSD_I "BSDi" +#define Z_OS_NAME_BSD_OS "BSD/OS" +#define Z_OS_NAME_CONVEX_OS "ConvexOS" +#define Z_OS_NAME_DIGITAL_UNIX "Digital UNIX" +#define Z_OS_NAME_I5_OS "i5/OS" +#define Z_OS_NAME_IBM_I "IBM i" +#define Z_OS_NAME_IOS "iOS" +#define Z_OS_NAME_MACOS "macOS" +#define Z_OS_NAME_OPEN_DESKTOP "Open Desktop" +#define Z_OS_NAME_OPEN_SERVER "OpenServer" +#define Z_OS_NAME_OPEN_UNIX "Open UNIX" +#define Z_OS_NAME_OS_X "OS X" +#define Z_OS_NAME_RELIANT_UNIX "Reliant UNIX" +#define Z_OS_NAME_SCO_UNIX "SCO UNIX" +#define Z_OS_NAME_TRU64_UNIX "Tru64 UNIX" +#define Z_OS_NAME_WATCHOS "watchOS" + +#endif /* Z_keys_OS_H */ diff --git a/projects/Zeta/API/Z/keys/compiler.h b/projects/Zeta/API/Z/keys/compiler.h new file mode 100644 index 0000000..df99b00 --- /dev/null +++ b/projects/Zeta/API/Z/keys/compiler.h @@ -0,0 +1,193 @@ +/* Zeta API - Z/keys/compiler.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_compiler_H +#define Z_keys_compiler_H + /* First released by Official website */ +#define Z_COMPILER_UNKNOWN 0 /* ----------------------------------------- ------------------------------------------------------- */ +#define Z_COMPILER_ACC 1 /* */ +#define Z_COMPILER_ADAPTIVE_CPP 2 /* */ +#define Z_COMPILER_ALTIUM_C_TO_HARDWARE 3 /* */ +#define Z_COMPILER_ALTIUM_MICROBLAZE_C 4 /* */ +#define Z_COMPILER_AMSTERDAM_COMPILER_KIT 5 /* */ +#define Z_COMPILER_APPLE_CLANG 6 /* Apple */ +#define Z_COMPILER_ARM_C_CPP_COMPILER 7 /* */ +#define Z_COMPILER_ARM_COMPILER 8 /* */ +#define Z_COMPILER_AZTEC_C 9 /* */ +#define Z_COMPILER_BCC 10 /* Evans, Bruce */ +#define Z_COMPILER_CC65 11 /* von Bassewitz, Ullrich */ +#define Z_COMPILER_CLANG 12 /* LLVM Foundation, The */ +#define Z_COMPILER_CODE_WARRIOR 13 /* */ +#define Z_COMPILER_COMEAU_CPP 14 /* */ +#define Z_COMPILER_COMPAQ_C_CPP 15 /* */ +#define Z_COMPILER_COMPCERT 16 /* */ +#define Z_COMPILER_CONVEX_C 17 /* */ +#define Z_COMPILER_COVERITY_C_CPP_STATIC_ANALYZER 18 /* */ +#define Z_COMPILER_CRAY_C 19 /* */ +#define Z_COMPILER_DIAB_C_CPP 20 /* */ +#define Z_COMPILER_DICE_C 21 /* */ +#define Z_COMPILER_DIGITAL_MARS 22 /* */ +#define Z_COMPILER_DJGPP 23 /* */ +#define Z_COMPILER_EDG_CPP_FRONTEND 24 /* */ +#define Z_COMPILER_EKOPATH 25 /* */ +#define Z_COMPILER_FUJITSU_CPP 26 /* */ +#define Z_COMPILER_GCC 27 /* GNU */ +#define Z_COMPILER_GREEN_HILL_C_CPP 28 /* */ +#define Z_COMPILER_HP_ACPP 29 /* */ +#define Z_COMPILER_HP_ANSI_C 30 /* */ +#define Z_COMPILER_HP_UPC 31 /* Hewlett-Packard (?) */ +#define Z_COMPILER_IAR_C_CPP 32 /* */ +#define Z_COMPILER_IBM_XL_C_CPP 33 /* */ +#define Z_COMPILER_IBM_Z_OS_C_CPP 34 /* */ +#define Z_COMPILER_IMAGECRAFT_C 35 /* */ +#define Z_COMPILER_INTEL_CPP 36 /* Intel */ +#define Z_COMPILER_KAI_CPP 37 /* Kuck & Associates */ +#define Z_COMPILER_KEIL_C166 38 /* */ +#define Z_COMPILER_KEIL_C51 39 /* */ +#define Z_COMPILER_KEIL_CARM 40 /* */ +#define Z_COMPILER_LCC 41 /* Fraser, Christopher W. - Hanson, David R. */ +#define Z_COMPILER_MCC 42 /* Sainz de Baranda y Goñi, Manuel */ +#define Z_COMPILER_METAWARE_HIGH_C_CPP 43 /* */ +#define Z_COMPILER_MICROTEC_C_CPP 44 /* */ +#define Z_COMPILER_MINGW 45 /* Peters, Colin */ +#define Z_COMPILER_MIPS_PRO 46 /* */ +#define Z_COMPILER_MIRACLE_C 47 /* */ +#define Z_COMPILER_MPW_CPP 48 /* */ +#define Z_COMPILER_MSC 49 /* Microsoft */ +#define Z_COMPILER_MSVC 50 /* Microsoft */ +#define Z_COMPILER_NDP_C 51 /* Microway */ +#define Z_COMPILER_NORCROFT_C 52 /* */ +#define Z_COMPILER_NVC 53 /* NVIDIA */ +#define Z_COMPILER_NWCC 54 /* */ +#define Z_COMPILER_OPEN64 55 /* */ +#define Z_COMPILER_ORACLE_PRO_C_PRECOMPILER 56 /* */ +#define Z_COMPILER_ORACLE_SOLARIS_STUDIO 57 /* */ +#define Z_COMPILER_PACIFIC_C 58 /* */ +#define Z_COMPILER_PALM_C_CPP 59 /* */ +#define Z_COMPILER_PCC 60 /* Johnson, Stephen C. */ +#define Z_COMPILER_PELLES_C 61 /* Orinius, Pelle */ +#define Z_COMPILER_PGI_C_CPP 62 /* */ +#define Z_COMPILER_RENESAS_C_CPP 63 /* */ +#define Z_COMPILER_SAS_C 64 /* */ +#define Z_COMPILER_SCCZ80 65 /* Z88DK */ +#define Z_COMPILER_SDCC 66 /* */ +#define Z_COMPILER_SNC 67 /* SN Systems */ +#define Z_COMPILER_SYMANTEC_CPP 68 /* */ +#define Z_COMPILER_SYSTEMS_C 69 /* Dignus */ +#define Z_COMPILER_TENDRA 70 /* DERA */ +#define Z_COMPILER_THINK_C 71 /* */ +#define Z_COMPILER_TI_C_CPP_COMPILER 72 /* */ +#define Z_COMPILER_TINY_CC 73 /* Bellard, Fabrice */ +#define Z_COMPILER_TURBO_C 74 /* Borland */ +#define Z_COMPILER_TURBO_CPP 75 /* Borland */ +#define Z_COMPILER_ULTRA_C_CPP 76 /* Microware Systems */ +#define Z_COMPILER_USL 77 /* */ +#define Z_COMPILER_VBCC 78 /* Barthelmann, Volker */ +#define Z_COMPILER_VOS_C 79 /* Stratus Technologies */ +#define Z_COMPILER_VOS_STANDARD_C 80 /* Stratus Technologies */ +#define Z_COMPILER_WATCOM_C_CPP 81 /* Watcom International */ +#define Z_COMPILER_ZORTECH_CPP 82 /* */ + +#define Z_COMPILER_NAME_ACC "ACC" +#define Z_COMPILER_NAME_ADAPTIVE_CPP "AdaptiveCpp" +#define Z_COMPILER_NAME_ALTIUM_C_TO_HARDWARE "Altium C-to-Hardware" +#define Z_COMPILER_NAME_ALTIUM_MICROBLAZE_C "Altium MicroBlaze C" +#define Z_COMPILER_NAME_AMSTERDAM_COMPILER_KIT "Amsterdam Compiler Kit" +#define Z_COMPILER_NAME_APPLE_CLANG "Apple Clang" +#define Z_COMPILER_NAME_ARM_C_CPP_COMPILER "ARM C/C++ Compiler" /* Previously known as ARM RealView C/C++ Compiler */ +#define Z_COMPILER_NAME_ARM_COMPILER "ARM Compiler" +#define Z_COMPILER_NAME_AZTEC_C "Aztec C" +#define Z_COMPILER_NAME_BCC "BCC" +#define Z_COMPILER_NAME_CC65 "cc65" +#define Z_COMPILER_NAME_CLANG "Clang" +#define Z_COMPILER_NAME_CODE_WARRIOR "CodeWarrior" +#define Z_COMPILER_NAME_COMEAU_CPP "Comeau C++ " +#define Z_COMPILER_NAME_COMPAQ_C_CPP "Compaq C/C++" +#define Z_COMPILER_NAME_COMPCERT "CompCert" +#define Z_COMPILER_NAME_CONVEX_C "Convex C" +#define Z_COMPILER_NAME_COVERITY_C_CPP_STATIC_ANALYZER "Coverity C/C++ Static Analyzer" +#define Z_COMPILER_NAME_CRAY_C "Cray C" +#define Z_COMPILER_NAME_DIAB_C_CPP "Diab C/C++" +#define Z_COMPILER_NAME_DICE_C "DICE C" +#define Z_COMPILER_NAME_DIGITAL_MARS "Digital Mars" +#define Z_COMPILER_NAME_DJGPP "DJGPP" +#define Z_COMPILER_NAME_EDG_CPP_FRONTEND "EDG C++ Frontend" +#define Z_COMPILER_NAME_EKOPATH "EKOPath" +#define Z_COMPILER_NAME_FUJITSU_CPP "Fujitsu C++" +#define Z_COMPILER_NAME_GCC "GCC" +#define Z_COMPILER_NAME_GREEN_HILL_C_CPP "Green Hill C/C++" +#define Z_COMPILER_NAME_HP_ACPP "HP aC++" +#define Z_COMPILER_NAME_HP_ANSI_C "HP ANSI C" +#define Z_COMPILER_NAME_HP_UPC "HP UPC" +#define Z_COMPILER_NAME_IAR_C_CPP "IAR C/C++" +#define Z_COMPILER_NAME_IBM_XL_C_CPP "IBM XL C/C++" +#define Z_COMPILER_NAME_IBM_Z_OS_C_CPP "IBM z/OS C/C++" +#define Z_COMPILER_NAME_IMAGECRAFT_C "ImageCraft C" +#define Z_COMPILER_NAME_INTEL_CPP "Intel C++" +#define Z_COMPILER_NAME_KAI_CPP "KAI C++" +#define Z_COMPILER_NAME_KEIL_C166 "KEIL C166" +#define Z_COMPILER_NAME_KEIL_C51 "KEIL C51" +#define Z_COMPILER_NAME_KEIL_CARM "KEIL CARM" /* Discontinued – Replaced by ARM RealView C/C++ Compiler */ +#define Z_COMPILER_NAME_LCC "LCC" +#define Z_COMPILER_NAME_MCC "MCC" +#define Z_COMPILER_NAME_METAWARE_HIGH_C_CPP "MetaWare High C/C++" +#define Z_COMPILER_NAME_MICROTEC_C_CPP "Microtec C/C++" +#define Z_COMPILER_NAME_MINGW "MinGW" +#define Z_COMPILER_NAME_MIPS_PRO "MIPSpro" +#define Z_COMPILER_NAME_MIRACLE_C "Miracle C" +#define Z_COMPILER_NAME_MPW_CPP "MPW C++" +#define Z_COMPILER_NAME_MSC "Microsoft C/C++" +#define Z_COMPILER_NAME_MSVC "Microsoft Visual C++" +#define Z_COMPILER_NAME_NDP_C "NDP C" +#define Z_COMPILER_NAME_NORCROFT_C "Norcroft C" +#define Z_COMPILER_NAME_NVC "NVC" +#define Z_COMPILER_NAME_NWCC "NWCC" +#define Z_COMPILER_NAME_OPEN64 "Open64" +#define Z_COMPILER_NAME_ORACLE_PRO_C_PRECOMPILER "Oracle Pro*C Precompiler" +#define Z_COMPILER_NAME_ORACLE_SOLARIS_STUDIO "Oracle Solaris Studio" +#define Z_COMPILER_NAME_PACIFIC_C "Pacific C" +#define Z_COMPILER_NAME_PALM_C_CPP "Palm C/C++" +#define Z_COMPILER_NAME_PCC "PCC" /* Portable C Compiler */ +#define Z_COMPILER_NAME_PELLES_C "Pelles C" +#define Z_COMPILER_NAME_PGI_C_CPP "PGI C/C++" +#define Z_COMPILER_NAME_RENESAS_C_CPP "Renesas C/C++" +#define Z_COMPILER_NAME_SAS_C "SAS/C" +#define Z_COMPILER_NAME_SCCZ80 "SCCZ80" +#define Z_COMPILER_NAME_SDCC "SDCC" /* Small Device C Compiler */ +#define Z_COMPILER_NAME_SNC "SNC" +#define Z_COMPILER_NAME_SYMANTEC_CPP "Symantec C++" +#define Z_COMPILER_NAME_SYSTEMS_C "Systems/C" +#define Z_COMPILER_NAME_TENDRA "TenDRA" +#define Z_COMPILER_NAME_THINK_C "THINK C" +#define Z_COMPILER_NAME_TI_C_CPP_COMPILER "Texas Instruments C/C++ Compiler" +#define Z_COMPILER_NAME_TINY_CC "TinyCC" +#define Z_COMPILER_NAME_TURBO_C "Turbo C" +#define Z_COMPILER_NAME_TURBO_CPP "Turbo C++" +#define Z_COMPILER_NAME_ULTRA_C_CPP "Ultra C/C++" +#define Z_COMPILER_NAME_USL "USL" +#define Z_COMPILER_NAME_VBCC "vbcc" +#define Z_COMPILER_NAME_VOS_C "VOS C" +#define Z_COMPILER_NAME_VOS_STANDARD_C "VOS Standard C" +#define Z_COMPILER_NAME_WATCOM_C_CPP "Watcom C/C++" +#define Z_COMPILER_NAME_ZORTECH_CPP "Zortech C++" + +#define Z_COMPILER_FORTE_DEVELOPER Z_COMPILER_ORACLE_SOLARIS_STUDIO +#define Z_COMPILER_SUN_PRO_COMPILERS Z_COMPILER_ORACLE_SOLARIS_STUDIO +#define Z_COMPILER_SUN_STUDIO Z_COMPILER_ORACLE_SOLARIS_STUDIO +#define Z_COMPILER_SUN_WORK_SHOP Z_COMPILER_ORACLE_SOLARIS_STUDIO +#define Z_COMPILER_SYSTEMS_CPP Z_COMPILER_SYSTEMS_C /* Check this */ +#define Z_COMPILER_VISUAL_AGE_CPP Z_COMPILER_IBM_XL_C_CPP + +#define Z_COMPILER_NAME_FORTE_DEVELOPER "Forte Developer" +#define Z_COMPILER_NAME_SUN_PRO_COMPILERS "SunPro Compilers" +#define Z_COMPILER_NAME_SUN_STUDIO "Sun Studio" +#define Z_COMPILER_NAME_SUN_WORK_SHOP "Sun WorkShop" +#define Z_COMPILER_NAME_SYSTEMS_CPP "Systems/C++" +#define Z_COMPILER_NAME_VISUAL_AGE_CPP "VisualAge C++" /* Renamed to IBM XL C/C++ */ + +#endif /* Z_keys_compiler_H */ diff --git a/projects/Zeta/API/Z/keys/data_model.h b/projects/Zeta/API/Z/keys/data_model.h new file mode 100644 index 0000000..3c08b89 --- /dev/null +++ b/projects/Zeta/API/Z/keys/data_model.h @@ -0,0 +1,30 @@ +/* Zeta API - Z/keys/data_model.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_data_model_H +#define Z_keys_data_model_H + +#define Z_DATA_MODEL_IP16L32 1 +#define Z_DATA_MODEL_I16LP32 2 +#define Z_DATA_MODEL_LP32 3 +#define Z_DATA_MODEL_ILP32 4 +#define Z_DATA_MODEL_LLP64 5 +#define Z_DATA_MODEL_LP64 6 +#define Z_DATA_MODEL_ILP64 7 +#define Z_DATA_MODEL_SILP64 8 + +#define Z_DATA_MODEL_NAME_IP16L32 "IP16L32" +#define Z_DATA_MODEL_NAME_I16LP32 "I16LP32" +#define Z_DATA_MODEL_NAME_LP32 "LP32" +#define Z_DATA_MODEL_NAME_ILP32 "ILP32" +#define Z_DATA_MODEL_NAME_LP64 "LP64" +#define Z_DATA_MODEL_NAME_LLP64 "LLP64" +#define Z_DATA_MODEL_NAME_ILP64 "ILP64" +#define Z_DATA_MODEL_NAME_SILP64 "SILP64" + +#endif /* Z_keys_data_model_H */ diff --git a/projects/Zeta/API/Z/keys/endianness.h b/projects/Zeta/API/Z/keys/endianness.h new file mode 100644 index 0000000..5a92e87 --- /dev/null +++ b/projects/Zeta/API/Z/keys/endianness.h @@ -0,0 +1,16 @@ +/* Zeta API - Z/keys/endianness.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_endianness_H +#define Z_keys_endianness_H + +#define Z_ENDIANNESS_LITTLE 0 +#define Z_ENDIANNESS_BIG 1 +#define Z_ENDIANNESS_PDP 2 + +#endif /* Z_keys_endianness_H */ diff --git a/projects/Zeta/API/Z/keys/fundamental.h b/projects/Zeta/API/Z/keys/fundamental.h new file mode 100644 index 0000000..3424306 --- /dev/null +++ b/projects/Zeta/API/Z/keys/fundamental.h @@ -0,0 +1,84 @@ +/* Zeta API - Z/keys/fundamental.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_fundamental_H +#define Z_keys_fundamental_H + +/* MARK: - Standard C/C++ fundamental types */ + +#define Z_FUNDAMENTAL_VOID 0 +#define Z_FUNDAMENTAL_CHAR 1 /* char */ +#define Z_FUNDAMENTAL_UCHAR 2 /* unsigned char */ +#define Z_FUNDAMENTAL_SCHAR 3 /* signed char */ +#define Z_FUNDAMENTAL_USHORT 4 /* unsigned short int */ +#define Z_FUNDAMENTAL_SSHORT 5 /* signed short int */ +#define Z_FUNDAMENTAL_UINT 6 /* unsigned int */ +#define Z_FUNDAMENTAL_SINT 7 /* signed int */ +#define Z_FUNDAMENTAL_ULONG 8 /* unsigned long int */ +#define Z_FUNDAMENTAL_SLONG 9 /* signed long int */ +#define Z_FUNDAMENTAL_ULLONG 10 /* (C99/C++11) unsigned long long int */ +#define Z_FUNDAMENTAL_SLLONG 11 /* (C99/C++11) signed long long int */ +#define Z_FUNDAMENTAL_BOOL 12 /* (C99) _Bool / (C++98) bool */ +#define Z_FUNDAMENTAL_WCHAR 13 /* (C++98) wchar_t */ +#define Z_FUNDAMENTAL_CHAR8 14 /* (C++20) char8_t */ +#define Z_FUNDAMENTAL_CHAR16 15 /* (C++11) char16_t */ +#define Z_FUNDAMENTAL_CHAR32 16 /* (C++11) char32_t */ +#define Z_FUNDAMENTAL_FLOAT 17 /* float */ +#define Z_FUNDAMENTAL_DOUBLE 18 /* double */ +#define Z_FUNDAMENTAL_LDOUBLE 19 /* long double */ +#define Z_FUNDAMENTAL_FLOAT16 20 /* _Float16 */ +#define Z_FUNDAMENTAL_FLOAT32 21 /* _Float32 */ +#define Z_FUNDAMENTAL_FLOAT64 22 /* _Float64 */ +#define Z_FUNDAMENTAL_FLOAT128 23 /* _Float128 */ +#define Z_FUNDAMENTAL_FLOAT32X 24 /* _Float32x */ +#define Z_FUNDAMENTAL_FLOAT64X 25 /* _Float64x */ +#define Z_FUNDAMENTAL_FLOAT128X 26 /* _Float128x */ +#define Z_FUNDAMENTAL_DECIMAL32 27 /* _Decimal32 */ +#define Z_FUNDAMENTAL_DECIMAL64 28 /* _Decimal64 */ +#define Z_FUNDAMENTAL_DECIMAL128 29 /* _Decimal128 */ +#define Z_FUNDAMENTAL_DECIMAL64X 30 /* _Decimal64x */ +#define Z_FUNDAMENTAL_DECIMAL128X 31 /* _Decimal128x */ +#define Z_FUNDAMENTAL_NULLPTR 32 /* (C++11) decltype(nullptr) */ + +/* MARK: - Fixed width integral types */ + +#define Z_FUNDAMENTAL_UINT8 100 /* 8-bit natural */ +#define Z_FUNDAMENTAL_SINT8 101 /* 8-bit integer */ +#define Z_FUNDAMENTAL_UINT16 102 /* 16-bit natural */ +#define Z_FUNDAMENTAL_SINT16 103 /* 16-bit integer */ +#define Z_FUNDAMENTAL_UINT24 104 /* 24-bit natural */ +#define Z_FUNDAMENTAL_SINT24 105 /* 24-bit integer */ +#define Z_FUNDAMENTAL_UINT32 106 /* 32-bit natural */ +#define Z_FUNDAMENTAL_SINT32 107 /* 32-bit integer */ +#define Z_FUNDAMENTAL_UINT40 108 /* 40-bit natural */ +#define Z_FUNDAMENTAL_SINT40 109 /* 40-bit integer */ +#define Z_FUNDAMENTAL_UINT48 110 /* 48-bit natural */ +#define Z_FUNDAMENTAL_SINT48 111 /* 48-bit integer */ +#define Z_FUNDAMENTAL_UINT56 112 /* 56-bit natural */ +#define Z_FUNDAMENTAL_SINT56 113 /* 56-bit integer */ +#define Z_FUNDAMENTAL_UINT64 114 /* 64-bit natural */ +#define Z_FUNDAMENTAL_SINT64 115 /* 64-bit integer */ +#define Z_FUNDAMENTAL_UINT128 116 /* 128-bit natural */ +#define Z_FUNDAMENTAL_SINT128 117 /* 128-bit integer */ + +/* MARK: - Fixed format real types */ + +#define Z_FUNDAMENTAL_BFP16 150 /* IEEE 754 binary16 */ +#define Z_FUNDAMENTAL_BFP32 151 /* IEEE 754 binary32 */ +#define Z_FUNDAMENTAL_BFP64 152 /* IEEE 754 binary64 */ +#define Z_FUNDAMENTAL_BFP128 153 /* IEEE 754 binary128 */ +#define Z_FUNDAMENTAL_DFP32 154 /* IEEE 754 decimal32 */ +#define Z_FUNDAMENTAL_DFP64 155 /* IEEE 754 decimal64 */ +#define Z_FUNDAMENTAL_DFP128 156 /* IEEE 754 decimal128 */ +#define Z_FUNDAMENTAL_X87_DE80 157 /* x87 double extended */ +#define Z_FUNDAMENTAL_X87_DE96 158 /* x87 double extended (with 16-bit padding) */ +#define Z_FUNDAMENTAL_X87_DE128 159 /* x87 double extended (with 48-bit padding) */ +#define Z_FUNDAMENTAL_IBM_ED 160 /* IBM extended double */ +#define Z_FUNDAMENTAL_BFLOAT16 162 /* Brain Floating-Point */ + +#endif /* Z_keys_fundamental_H */ diff --git a/projects/Zeta/API/Z/keys/language.h b/projects/Zeta/API/Z/keys/language.h new file mode 100644 index 0000000..ce3f4b7 --- /dev/null +++ b/projects/Zeta/API/Z/keys/language.h @@ -0,0 +1,22 @@ +/* Zeta API - Z/keys/language.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_language_H +#define Z_keys_language_H + +#define Z_LANGUAGE_C 1 +#define Z_LANGUAGE_CPP 3 +#define Z_LANGUAGE_OBJECTIVE_C 5 +#define Z_LANGUAGE_OBJECTIVE_CPP 7 + +#define Z_LANGUAGE_STRING_C "C" +#define Z_LANGUAGE_STRING_CPP "C++" +#define Z_LANGUAGE_STRING_OBJECTIVE_C "Objective-C" +#define Z_LANGUAGE_STRING_OBJECTIVE_CPP "Objective-C++" + +#endif /* Z_keys_language_H */ diff --git a/projects/Zeta/API/Z/keys/number.h b/projects/Zeta/API/Z/keys/number.h new file mode 100644 index 0000000..1653623 --- /dev/null +++ b/projects/Zeta/API/Z/keys/number.h @@ -0,0 +1,71 @@ +/* Zeta API - Z/keys/number.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_number_H +#define Z_keys_number_H + +#define Z_NUMBER_SET_N 1 +#define Z_NUMBER_SET_Z 3 +#define Z_NUMBER_SET_Q 4 +#define Z_NUMBER_SET_R 5 +#define Z_NUMBER_SET_I 6 +#define Z_NUMBER_SET_C 7 + +#define Z_INTEGER_FORMAT_SIGNED_MAGNITUDE 0 +#define Z_INTEGER_FORMAT_1S_COMPLEMENT 1 +#define Z_INTEGER_FORMAT_2S_COMPLEMENT 2 + +#define Z_NUMBER_FORMAT_8BIT_NATURAL 1 +#define Z_NUMBER_FORMAT_16BIT_NATURAL 2 +#define Z_NUMBER_FORMAT_24BIT_NATURAL 3 +#define Z_NUMBER_FORMAT_32BIT_NATURAL 4 +#define Z_NUMBER_FORMAT_40BIT_NATURAL 5 +#define Z_NUMBER_FORMAT_48BIT_NATURAL 6 +#define Z_NUMBER_FORMAT_56BIT_NATURAL 7 +#define Z_NUMBER_FORMAT_64BIT_NATURAL 8 +#define Z_NUMBER_FORMAT_128BIT_NATURAL 9 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_8BIT_INTEGER 10 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_16BIT_INTEGER 11 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_24BIT_INTEGER 12 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_32BIT_INTEGER 13 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_40BIT_INTEGER 14 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_48BIT_INTEGER 15 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_56BIT_INTEGER 16 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_64BIT_INTEGER 17 +#define Z_NUMBER_FORMAT_SIGNED_MAGNITUDE_128BIT_INTEGER 18 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_8BIT_INTEGER 19 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_16BIT_INTEGER 20 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_24BIT_INTEGER 21 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_32BIT_INTEGER 22 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_40BIT_INTEGER 23 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_48BIT_INTEGER 24 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_56BIT_INTEGER 25 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_64BIT_INTEGER 26 +#define Z_NUMBER_FORMAT_1S_COMPLEMENT_128BIT_INTEGER 27 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_8BIT_INTEGER 28 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_16BIT_INTEGER 29 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_24BIT_INTEGER 30 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_32BIT_INTEGER 31 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_40BIT_INTEGER 32 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_48BIT_INTEGER 33 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_56BIT_INTEGER 34 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_64BIT_INTEGER 35 +#define Z_NUMBER_FORMAT_2S_COMPLEMENT_128BIT_INTEGER 36 +#define Z_NUMBER_FORMAT_IEEE_754_BINARY16 37 +#define Z_NUMBER_FORMAT_IEEE_754_BINARY32 38 +#define Z_NUMBER_FORMAT_IEEE_754_BINARY64 39 +#define Z_NUMBER_FORMAT_IEEE_754_BINARY128 40 +#define Z_NUMBER_FORMAT_IEEE_754_DECIMAL32 41 +#define Z_NUMBER_FORMAT_IEEE_754_DECIMAL64 42 +#define Z_NUMBER_FORMAT_IEEE_754_DECIMAL128 43 +#define Z_NUMBER_FORMAT_X87_DOUBLE_EXTENDED 44 +#define Z_NUMBER_FORMAT_IBM_EXTENDED_DOUBLE 45 +#define Z_NUMBER_FORMAT_ARM_FP16_ALTERNATIVE 46 +#define Z_NUMBER_FORMAT_BRAIN_FLOATING_POINT 47 + +#endif /* Z_keys_number_H */ diff --git a/projects/Zeta/API/Z/keys/order.h b/projects/Zeta/API/Z/keys/order.h new file mode 100644 index 0000000..9f22fa7 --- /dev/null +++ b/projects/Zeta/API/Z/keys/order.h @@ -0,0 +1,18 @@ +/* Zeta API - Z/keys/order.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_order_H +#define Z_keys_order_H + +#define Z_ORDER_DESCENDING -1 +#define Z_ORDER_EQUAL 0 +#define Z_ORDER_ASCENDING 1 +#define Z_ORDER_NORMAL 0 +#define Z_ORDER_REVERSED 1 + +#endif /* Z_keys_order_H */ diff --git a/projects/Zeta/API/Z/keys/platform.h b/projects/Zeta/API/Z/keys/platform.h new file mode 100644 index 0000000..2a595ef --- /dev/null +++ b/projects/Zeta/API/Z/keys/platform.h @@ -0,0 +1,100 @@ +/* Zeta API - Z/keys/platform.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_keys_platform_H +#define Z_keys_platform_H + +#define Z_PLATFORM_UNKNOWN 0 + +/* Computers */ + +#define Z_PLATFORM_ABC_80 1001 /* Luxor */ +#define Z_PLATFORM_ABC_800 1002 /* Luxor */ +#define Z_PLATFORM_ALPHATRONIC_PC 1003 /* Triumph-Adler */ +#define Z_PLATFORM_AMIGA 1004 /* Commodore */ +#define Z_PLATFORM_APPLE_II 1005 /* Apple Computer */ +#define Z_PLATFORM_AQUARIUS 1006 /* Mattel */ +#define Z_PLATFORM_ATMOS 1007 /* Oric */ +#define Z_PLATFORM_BBC_MICRO 1008 /* Acorn Computers */ +#define Z_PLATFORM_CBM_IIB 1009 /* Commodore */ +#define Z_PLATFORM_CBM_IIP 1010 /* Commodore */ +#define Z_PLATFORM_CHALLENGER_1P 1011 /* Ohio Scientific */ +#define Z_PLATFORM_COMMANDER_X16 1012 /* Murray, David */ +#define Z_PLATFORM_COMMODORE_16 1013 /* Commodore */ +#define Z_PLATFORM_COMMODORE_64 1014 /* Commodore */ +#define Z_PLATFORM_COMMODORE_128 1015 /* Commodore */ +#define Z_PLATFORM_CPC 1016 /* Amstrad */ +#define Z_PLATFORM_GALAKSIJA 1017 /* Antonić, Vojislav */ +#define Z_PLATFORM_JUPITER_ACE 1018 /* Jupiter Cantab */ +#define Z_PLATFORM_MACINTOSH 1019 /* Apple */ +#define Z_PLATFORM_M5 1020 /* SORD */ +#define Z_PLATFORM_MSX 1021 /* Microsoft and others */ +#define Z_PLATFORM_QL 1022 /* Sinclair Research */ +#define Z_PLATFORM_PET 1023 /* Commodore */ +#define Z_PLATFORM_PLUS_4 1024 /* Commodore */ +#define Z_PLATFORM_RX_78 1025 /* Bandai */ +#define Z_PLATFORM_SAM_COUPE 1026 /* Miles Gordon Technology */ +#define Z_PLATFORM_SORCERER 1026 /* Exidy */ +#define Z_PLATFORM_ST 1027 /* Atari */ +/*#define Z_PLATFORM_TELESTRAT 1028*/ /* Oric / Euréka */ +#define Z_PLATFORM_VIC_20 1029 /* Commodore */ +#define Z_PLATFORM_X_07 1030 /* Canon */ +#define Z_PLATFORM_X1 1031 /* Sharp */ +#define Z_PLATFORM_Z88 1032 /* Cambridge Computer */ +#define Z_PLATFORM_ZX80 1033 /* Sinclair Research */ +#define Z_PLATFORM_ZX81 1034 /* Sinclair Research */ +#define Z_PLATFORM_ZX_SPECTRUM 1035 /* Sinclair Research */ + +/* Consoles */ + +#define Z_PLATFORM_3DO 2001 /* The 3DO Company */ +#define Z_PLATFORM_ATARI_2600 2002 /* Atari */ +#define Z_PLATFORM_ATARI_5200 2003 /* Atari */ +#define Z_PLATFORM_ATARI_7800 2004 /* Atari */ +#define Z_PLATFORM_CD_I 2005 /* Philips */ +#define Z_PLATFORM_COLECO_VISION 2006 /* Coleco Industries */ +#define Z_PLATFORM_CREATIVISION 2007 /* VTech */ +#define Z_PLATFORM_DREAMCAST 2008 /* Sega */ +#define Z_PLATFORM_GAMATE 2009 /* Bit Corporation */ +#define Z_PLATFORM_GAME_BOY 2010 /* Nintendo */ +#define Z_PLATFORM_GAME_BOY_ADVANCE 2011 /* Nintendo */ +#define Z_PLATFORM_GAME_GEAR 2012 /* Sega */ +#define Z_PLATFORM_JAGUAR 2013 /* Atari */ +#define Z_PLATFORM_LYNX 2014 /* Atari */ +#define Z_PLATFORM_MASTER_SYSTEM 2015 /* Sega */ +#define Z_PLATFORM_MEGA_DRIVE 2016 /* Sega */ +#define Z_PLATFORM_NEO_GEO 2017 /* SNK */ +#define Z_PLATFORM_NEO_GEO_POCKET 2018 /* SNK */ +#define Z_PLATFORM_NES 2019 /* Nintendo */ +#define Z_PLATFORM_NINTENDO_3DS 2020 /* Nintendo */ +#define Z_PLATFORM_NINTENDO_64 2021 /* Nintendo */ +#define Z_PLATFORM_NINTENDO_DS 2022 /* Nintendo */ +#define Z_PLATFORM_NINTENDO_GAME_CUBE 2023 /* Nintendo */ +#define Z_PLATFORM_NINTENDO_SWITCH 2024 /* Nintendo */ +#define Z_PLATFORM_PC_ENGINE 2025 /* NEC */ +#define Z_PLATFORM_PLAYDIA 2026 /* Bandai */ +#define Z_PLATFORM_PSX 2027 /* Sony */ +#define Z_PLATFORM_PS2 2028 /* Sony */ +#define Z_PLATFORM_PS3 2029 /* Sony */ +#define Z_PLATFORM_PS4 2030 /* Sony */ +#define Z_PLATFORM_PSP 2031 /* Sony */ +#define Z_PLATFORM_PS_VITA 2032 /* Sony */ +#define Z_PLATFORM_SEGA_SATURN 2033 /* Sega */ +#define Z_PLATFORM_SNES 2034 /* Nintendo */ +#define Z_PLATFORM_SUPERVISION 2035 /* Watara */ +#define Z_PLATFORM_VECTREX 2036 /* General Consumer Electronics */ +#define Z_PLATFORM_VIRTUAL_BOY 2037 /* Nintendo */ +#define Z_PLATFORM_WII 2038 /* Nintendo */ +#define Z_PLATFORM_WII_U 2039 /* Nintendo */ +#define Z_PLATFORM_WONDER_SWAN 2040 /* Bandai */ +#define Z_PLATFORM_XBOX 2041 /* Microsoft */ +#define Z_PLATFORM_XBOX_360 2042 /* Microsoft */ +#define Z_PLATFORM_XBOX_ONE 2043 /* Microsoft */ + + +#endif /* Z_keys_platform_H */ diff --git a/projects/Zeta/API/Z/macros/T.h b/projects/Zeta/API/Z/macros/T.h new file mode 100644 index 0000000..b84a674 --- /dev/null +++ b/projects/Zeta/API/Z/macros/T.h @@ -0,0 +1,463 @@ +/* Zeta API - Z/macros/T.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_T_H +#define Z_macros_T_H + +/* MARK: - Type name tokens: Standard C/C++ fundamental types */ + +#define Z_z_APPEND_TYPE_1(lht) lht##CHAR +#define Z_z_APPEND_Type_1(lht) lht##Char +#define Z_z_APPEND_type_1(lht) lht##char +#define Z_z_INSERT_TYPE_1(lht, rht) lht##CHAR##rht +#define Z_z_INSERT_Type_1(lht, rht) lht##Char##rht +#define Z_z_INSERT_type_1(lht, rht) lht##char##rht + +#define Z_z_APPEND_TYPE_2(lht) lht##UCHAR +#define Z_z_APPEND_Type_2(lht) lht##UChar +#define Z_z_APPEND_type_2(lht) lht##uchar +#define Z_z_INSERT_TYPE_2(lht, rht) lht##UCHAR##rht +#define Z_z_INSERT_Type_2(lht, rht) lht##UChar##rht +#define Z_z_INSERT_type_2(lht, rht) lht##uchar##rht + +#define Z_z_APPEND_TYPE_3(lht) lht##SCHAR +#define Z_z_APPEND_Type_3(lht) lht##SChar +#define Z_z_APPEND_type_3(lht) lht##schar +#define Z_z_INSERT_TYPE_3(lht, rht) lht##SCHAR##rht +#define Z_z_INSERT_Type_3(lht, rht) lht##SChar##rht +#define Z_z_INSERT_type_3(lht, rht) lht##schar##rht + +#define Z_z_APPEND_TYPE_4(lht) lht##USHORT +#define Z_z_APPEND_Type_4(lht) lht##UShort +#define Z_z_APPEND_type_4(lht) lht##ushort +#define Z_z_INSERT_TYPE_4(lht, rht) lht##USHORT##rht +#define Z_z_INSERT_Type_4(lht, rht) lht##UShort##rht +#define Z_z_INSERT_type_4(lht, rht) lht##ushort##rht + +#define Z_z_APPEND_TYPE_5(lht) lht##SSHORT +#define Z_z_APPEND_Type_5(lht) lht##SShort +#define Z_z_APPEND_type_5(lht) lht##sshort +#define Z_z_INSERT_TYPE_5(lht, rht) lht##SSHORT##rht +#define Z_z_INSERT_Type_5(lht, rht) lht##SShort##rht +#define Z_z_INSERT_type_5(lht, rht) lht##sshort##rht + +#define Z_z_APPEND_TYPE_6(lht) lht##UINT +#define Z_z_APPEND_Type_6(lht) lht##UInt +#define Z_z_APPEND_type_6(lht) lht##uint +#define Z_z_INSERT_TYPE_6(lht, rht) lht##UINT##rht +#define Z_z_INSERT_Type_6(lht, rht) lht##UInt##rht +#define Z_z_INSERT_type_6(lht, rht) lht##uint##rht + +#define Z_z_APPEND_TYPE_7(lht) lht##SINT +#define Z_z_APPEND_Type_7(lht) lht##SInt +#define Z_z_APPEND_type_7(lht) lht##sint +#define Z_z_INSERT_TYPE_7(lht, rht) lht##SINT##rht +#define Z_z_INSERT_Type_7(lht, rht) lht##SInt##rht +#define Z_z_INSERT_type_7(lht, rht) lht##sint##rht + +#define Z_z_APPEND_TYPE_8(lht) lht##ULONG +#define Z_z_APPEND_Type_8(lht) lht##ULong +#define Z_z_APPEND_type_8(lht) lht##ulong +#define Z_z_INSERT_TYPE_8(lht, rht) lht##ULONG##rht +#define Z_z_INSERT_Type_8(lht, rht) lht##ULong##rht +#define Z_z_INSERT_type_8(lht, rht) lht##ulong##rht + +#define Z_z_APPEND_TYPE_9(lht) lht##SLONG +#define Z_z_APPEND_Type_9(lht) lht##SLong +#define Z_z_APPEND_type_9(lht) lht##slong +#define Z_z_INSERT_TYPE_9(lht, rht) lht##SLONG##rht +#define Z_z_INSERT_Type_9(lht, rht) lht##SLong##rht +#define Z_z_INSERT_type_9(lht, rht) lht##slong##rht + +#define Z_z_APPEND_TYPE_10(lht) lht##ULLONG +#define Z_z_APPEND_Type_10(lht) lht##ULLong +#define Z_z_APPEND_type_10(lht) lht##ullong +#define Z_z_INSERT_TYPE_10(lht, rht) lht##ULLONG##rht +#define Z_z_INSERT_Type_10(lht, rht) lht##ULLong##rht +#define Z_z_INSERT_type_10(lht, rht) lht##ullong##rht + +#define Z_z_APPEND_TYPE_11(lht) lht##SLLONG +#define Z_z_APPEND_Type_11(lht) lht##SLLong +#define Z_z_APPEND_type_11(lht) lht##sllong +#define Z_z_INSERT_TYPE_11(lht, rht) lht##SLLONG##rht +#define Z_z_INSERT_Type_11(lht, rht) lht##SLLong##rht +#define Z_z_INSERT_type_11(lht, rht) lht##sllong##rht + +#define Z_z_APPEND_TYPE_13(lht) lht##WCHAR +#define Z_z_APPEND_Type_13(lht) lht##WChar +#define Z_z_APPEND_type_13(lht) lht##wchar +#define Z_z_INSERT_TYPE_13(lht, rht) lht##WCHAR##rht +#define Z_z_INSERT_Type_13(lht, rht) lht##WChar##rht +#define Z_z_INSERT_type_13(lht, rht) lht##wchar##rht + +#define Z_z_APPEND_TYPE_14(lht) lht##CHAR8 +#define Z_z_APPEND_Type_14(lht) lht##Char8 +#define Z_z_APPEND_type_14(lht) lht##char8 +#define Z_z_INSERT_TYPE_14(lht, rht) lht##CHAR8##rht +#define Z_z_INSERT_Type_14(lht, rht) lht##Char8##rht +#define Z_z_INSERT_type_14(lht, rht) lht##char8##rht + +#define Z_z_APPEND_TYPE_15(lht) lht##CHAR16 +#define Z_z_APPEND_Type_15(lht) lht##Char16 +#define Z_z_APPEND_type_15(lht) lht##char16 +#define Z_z_INSERT_TYPE_15(lht, rht) lht##CHAR16##rht +#define Z_z_INSERT_Type_15(lht, rht) lht##Char16##rht +#define Z_z_INSERT_type_15(lht, rht) lht##char16##rht + +#define Z_z_APPEND_TYPE_16(lht) lht##CHAR32 +#define Z_z_APPEND_Type_16(lht) lht##Char32 +#define Z_z_APPEND_type_16(lht) lht##char32 +#define Z_z_INSERT_TYPE_16(lht, rht) lht##CHAR32##rht +#define Z_z_INSERT_Type_16(lht, rht) lht##Char32##rht +#define Z_z_INSERT_type_16(lht, rht) lht##char32##rht + +#define Z_z_APPEND_TYPE_17(lht) lht##FLOAT +#define Z_z_APPEND_Type_17(lht) lht##Float +#define Z_z_APPEND_type_17(lht) lht##float +#define Z_z_INSERT_TYPE_17(lht, rht) lht##FLOAT##rht +#define Z_z_INSERT_Type_17(lht, rht) lht##Float##rht +#define Z_z_INSERT_type_17(lht, rht) lht##float##rht + +#define Z_z_APPEND_TYPE_18(lht) lht##DOUBLE +#define Z_z_APPEND_Type_18(lht) lht##Double +#define Z_z_APPEND_type_18(lht) lht##double +#define Z_z_INSERT_TYPE_18(lht, rht) lht##DOUBLE##rht +#define Z_z_INSERT_Type_18(lht, rht) lht##Double##rht +#define Z_z_INSERT_type_18(lht, rht) lht##double##rht + +#define Z_z_APPEND_TYPE_19(lht) lht##LDOUBLE +#define Z_z_APPEND_Type_19(lht) lht##LDouble +#define Z_z_APPEND_type_19(lht) lht##ldouble +#define Z_z_INSERT_TYPE_19(lht, rht) lht##LDOUBLE##rht +#define Z_z_INSERT_Type_19(lht, rht) lht##LDouble##rht +#define Z_z_INSERT_type_19(lht, rht) lht##ldouble##rht + +#define Z_z_APPEND_TYPE_20(lht) lht##FLOAT16 +#define Z_z_APPEND_Type_20(lht) lht##Float16 +#define Z_z_APPEND_type_20(lht) lht##float16 +#define Z_z_INSERT_TYPE_20(lht, rht) lht##FLOAT16##rht +#define Z_z_INSERT_Type_20(lht, rht) lht##Float16##rht +#define Z_z_INSERT_type_20(lht, rht) lht##float16##rht + +#define Z_z_APPEND_TYPE_21(lht) lht##FLOAT32 +#define Z_z_APPEND_Type_21(lht) lht##Float32 +#define Z_z_APPEND_type_21(lht) lht##float32 +#define Z_z_INSERT_TYPE_21(lht, rht) lht##FLOAT32##rht +#define Z_z_INSERT_Type_21(lht, rht) lht##Float32##rht +#define Z_z_INSERT_type_21(lht, rht) lht##float32##rht + +#define Z_z_APPEND_TYPE_22(lht) lht##FLOAT64 +#define Z_z_APPEND_Type_22(lht) lht##Float64 +#define Z_z_APPEND_type_22(lht) lht##float64 +#define Z_z_INSERT_TYPE_22(lht, rht) lht##FLOAT64##rht +#define Z_z_INSERT_Type_22(lht, rht) lht##Float64##rht +#define Z_z_INSERT_type_22(lht, rht) lht##float64##rht + +#define Z_z_APPEND_TYPE_23(lht) lht##FLOAT128 +#define Z_z_APPEND_Type_23(lht) lht##Float128 +#define Z_z_APPEND_type_23(lht) lht##float128 +#define Z_z_INSERT_TYPE_23(lht, rht) lht##FLOAT128##rht +#define Z_z_INSERT_Type_23(lht, rht) lht##Float128##rht +#define Z_z_INSERT_type_23(lht, rht) lht##float128##rht + +#define Z_z_APPEND_TYPE_24(lht) lht##FLOAT32X +#define Z_z_APPEND_Type_24(lht) lht##Float32x +#define Z_z_APPEND_type_24(lht) lht##float32x +#define Z_z_INSERT_TYPE_24(lht, rht) lht##FLOAT32X##rht +#define Z_z_INSERT_Type_24(lht, rht) lht##Float32x##rht +#define Z_z_INSERT_type_24(lht, rht) lht##float32x##rht + +#define Z_z_APPEND_TYPE_25(lht) lht##FLOAT64X +#define Z_z_APPEND_Type_25(lht) lht##Float64x +#define Z_z_APPEND_type_25(lht) lht##float64x +#define Z_z_INSERT_TYPE_25(lht, rht) lht##FLOAT64X##rht +#define Z_z_INSERT_Type_25(lht, rht) lht##Float64x##rht +#define Z_z_INSERT_type_25(lht, rht) lht##float64x##rht + +#define Z_z_APPEND_TYPE_26(lht) lht##FLOAT128X +#define Z_z_APPEND_Type_26(lht) lht##Float128x +#define Z_z_APPEND_type_26(lht) lht##float128x +#define Z_z_INSERT_TYPE_26(lht, rht) lht##FLOAT128X##rht +#define Z_z_INSERT_Type_26(lht, rht) lht##Float128x##rht +#define Z_z_INSERT_type_26(lht, rht) lht##float128x##rht + +#define Z_z_APPEND_TYPE_27(lht) lht##DECIMAL32 +#define Z_z_APPEND_Type_27(lht) lht##Decimal32 +#define Z_z_APPEND_type_27(lht) lht##decimal32 +#define Z_z_INSERT_TYPE_27(lht, rht) lht##DECIMAL32##rht +#define Z_z_INSERT_Type_27(lht, rht) lht##Decimal32##rht +#define Z_z_INSERT_type_27(lht, rht) lht##decimal32##rht + +#define Z_z_APPEND_TYPE_28(lht) lht##DECIMAL64 +#define Z_z_APPEND_Type_28(lht) lht##Decimal64 +#define Z_z_APPEND_type_28(lht) lht##decimal64 +#define Z_z_INSERT_TYPE_28(lht, rht) lht##DECIMAL64##rht +#define Z_z_INSERT_Type_28(lht, rht) lht##Decimal64##rht +#define Z_z_INSERT_type_28(lht, rht) lht##decimal64##rht + +#define Z_z_APPEND_TYPE_29(lht) lht##DECIMAL128 +#define Z_z_APPEND_Type_29(lht) lht##Decimal128 +#define Z_z_APPEND_type_29(lht) lht##decimal128 +#define Z_z_INSERT_TYPE_29(lht, rht) lht##DECIMAL128##rht +#define Z_z_INSERT_Type_29(lht, rht) lht##Decimal128##rht +#define Z_z_INSERT_type_29(lht, rht) lht##decimal128##rht + +#define Z_z_APPEND_TYPE_30(lht) lht##DECIMAL64X +#define Z_z_APPEND_Type_30(lht) lht##Decimal64x +#define Z_z_APPEND_type_30(lht) lht##decimal64x +#define Z_z_INSERT_TYPE_30(lht, rht) lht##DECIMAL64X##rht +#define Z_z_INSERT_Type_30(lht, rht) lht##Decimal64x##rht +#define Z_z_INSERT_type_30(lht, rht) lht##decimal64x##rht + +#define Z_z_APPEND_TYPE_31(lht) lht##DECIMAL128X +#define Z_z_APPEND_Type_31(lht) lht##Decimal128x +#define Z_z_APPEND_type_31(lht) lht##decimal128x +#define Z_z_INSERT_TYPE_31(lht, rht) lht##DECIMAL128X##rht +#define Z_z_INSERT_Type_31(lht, rht) lht##Decimal128x##rht +#define Z_z_INSERT_type_31(lht, rht) lht##decimal128x##rht + +/* MARK: - Type name tokens: Fixed width integral types */ + +#define Z_z_APPEND_TYPE_100(lht) lht##UINT8 +#define Z_z_APPEND_Type_100(lht) lht##UInt8 +#define Z_z_APPEND_type_100(lht) lht##uint8 +#define Z_z_INSERT_TYPE_100(lht, rht) lht##UINT8##rht +#define Z_z_INSERT_Type_100(lht, rht) lht##UInt8##rht +#define Z_z_INSERT_type_100(lht, rht) lht##uint8##rht + +#define Z_z_APPEND_TYPE_101(lht) lht##SINT8 +#define Z_z_APPEND_Type_101(lht) lht##SInt8 +#define Z_z_APPEND_type_101(lht) lht##sint8 +#define Z_z_INSERT_TYPE_101(lht, rht) lht##SINT8##rht +#define Z_z_INSERT_Type_101(lht, rht) lht##SInt8##rht +#define Z_z_INSERT_type_101(lht, rht) lht##sint8##rht + +#define Z_z_APPEND_TYPE_102(lht) lht##UINT16 +#define Z_z_APPEND_Type_102(lht) lht##UInt16 +#define Z_z_APPEND_type_102(lht) lht##uint16 +#define Z_z_INSERT_TYPE_102(lht, rht) lht##UINT16##rht +#define Z_z_INSERT_Type_102(lht, rht) lht##UInt16##rht +#define Z_z_INSERT_type_102(lht, rht) lht##uint16##rht + +#define Z_z_APPEND_TYPE_103(lht) lht##SINT16 +#define Z_z_APPEND_Type_103(lht) lht##SInt16 +#define Z_z_APPEND_type_103(lht) lht##sint16 +#define Z_z_INSERT_TYPE_103(lht, rht) lht##SINT16##rht +#define Z_z_INSERT_Type_103(lht, rht) lht##SInt16##rht +#define Z_z_INSERT_type_103(lht, rht) lht##sint16##rht + +#define Z_z_APPEND_TYPE_104(lht) lht##UINT24 +#define Z_z_APPEND_Type_104(lht) lht##UInt24 +#define Z_z_APPEND_type_104(lht) lht##uint24 +#define Z_z_INSERT_TYPE_104(lht, rht) lht##UINT24##rht +#define Z_z_INSERT_Type_104(lht, rht) lht##UInt24##rht +#define Z_z_INSERT_type_104(lht, rht) lht##uint24##rht + +#define Z_z_APPEND_TYPE_105(lht) lht##SINT24 +#define Z_z_APPEND_Type_105(lht) lht##SInt24 +#define Z_z_APPEND_type_105(lht) lht##sint24 +#define Z_z_INSERT_TYPE_105(lht, rht) lht##SINT24##rht +#define Z_z_INSERT_Type_105(lht, rht) lht##SInt24##rht +#define Z_z_INSERT_type_105(lht, rht) lht##sint24##rht + +#define Z_z_APPEND_TYPE_106(lht) lht##UINT32 +#define Z_z_APPEND_Type_106(lht) lht##UInt32 +#define Z_z_APPEND_type_106(lht) lht##uint32 +#define Z_z_INSERT_TYPE_106(lht, rht) lht##UINT32##rht +#define Z_z_INSERT_Type_106(lht, rht) lht##UInt32##rht +#define Z_z_INSERT_type_106(lht, rht) lht##uint32##rht + +#define Z_z_APPEND_TYPE_107(lht) lht##SINT32 +#define Z_z_APPEND_Type_107(lht) lht##SInt32 +#define Z_z_APPEND_type_107(lht) lht##sint32 +#define Z_z_INSERT_TYPE_107(lht, rht) lht##SINT32##rht +#define Z_z_INSERT_Type_107(lht, rht) lht##SInt32##rht +#define Z_z_INSERT_type_107(lht, rht) lht##sint32##rht + +#define Z_z_APPEND_TYPE_108(lht) lht##UINT40 +#define Z_z_APPEND_Type_108(lht) lht##UInt40 +#define Z_z_APPEND_type_108(lht) lht##uint40 +#define Z_z_INSERT_TYPE_108(lht, rht) lht##UINT40##rht +#define Z_z_INSERT_Type_108(lht, rht) lht##UInt40##rht +#define Z_z_INSERT_type_108(lht, rht) lht##uint40##rht + +#define Z_z_APPEND_TYPE_109(lht) lht##SINT40 +#define Z_z_APPEND_Type_109(lht) lht##SInt40 +#define Z_z_APPEND_type_109(lht) lht##sint40 +#define Z_z_INSERT_TYPE_109(lht, rht) lht##SINT40##rht +#define Z_z_INSERT_Type_109(lht, rht) lht##SInt40##rht +#define Z_z_INSERT_type_109(lht, rht) lht##sint40##rht + +#define Z_z_APPEND_TYPE_110(lht) lht##UINT48 +#define Z_z_APPEND_Type_110(lht) lht##UInt48 +#define Z_z_APPEND_type_110(lht) lht##uint48 +#define Z_z_INSERT_TYPE_110(lht, rht) lht##UINT48##rht +#define Z_z_INSERT_Type_110(lht, rht) lht##UInt48##rht +#define Z_z_INSERT_type_110(lht, rht) lht##uint48##rht + +#define Z_z_APPEND_TYPE_111(lht) lht##SINT48 +#define Z_z_APPEND_Type_111(lht) lht##SInt48 +#define Z_z_APPEND_type_111(lht) lht##sint48 +#define Z_z_INSERT_TYPE_111(lht, rht) lht##SINT48##rht +#define Z_z_INSERT_Type_111(lht, rht) lht##SInt48##rht +#define Z_z_INSERT_type_111(lht, rht) lht##sint48##rht + +#define Z_z_APPEND_TYPE_112(lht) lht##UINT56 +#define Z_z_APPEND_Type_112(lht) lht##UInt56 +#define Z_z_APPEND_type_112(lht) lht##uint56 +#define Z_z_INSERT_TYPE_112(lht, rht) lht##UINT56##rht +#define Z_z_INSERT_Type_112(lht, rht) lht##UInt56##rht +#define Z_z_INSERT_type_112(lht, rht) lht##uint56##rht + +#define Z_z_APPEND_TYPE_113(lht) lht##SINT56 +#define Z_z_APPEND_Type_113(lht) lht##SInt56 +#define Z_z_APPEND_type_113(lht) lht##sint56 +#define Z_z_INSERT_TYPE_113(lht, rht) lht##SINT56##rht +#define Z_z_INSERT_Type_113(lht, rht) lht##SInt56##rht +#define Z_z_INSERT_type_113(lht, rht) lht##sint56##rht + +#define Z_z_APPEND_TYPE_114(lht) lht##UINT64 +#define Z_z_APPEND_Type_114(lht) lht##UInt64 +#define Z_z_APPEND_type_114(lht) lht##uint64 +#define Z_z_INSERT_TYPE_114(lht, rht) lht##UINT64##rht +#define Z_z_INSERT_Type_114(lht, rht) lht##UInt64##rht +#define Z_z_INSERT_type_114(lht, rht) lht##uint64##rht + +#define Z_z_APPEND_TYPE_115(lht) lht##SINT64 +#define Z_z_APPEND_Type_115(lht) lht##SInt64 +#define Z_z_APPEND_type_115(lht) lht##sint64 +#define Z_z_INSERT_TYPE_115(lht, rht) lht##SINT64##rht +#define Z_z_INSERT_Type_115(lht, rht) lht##SInt64##rht +#define Z_z_INSERT_type_115(lht, rht) lht##sint64##rht + +#define Z_z_APPEND_TYPE_116(lht) lht##UINT128 +#define Z_z_APPEND_Type_116(lht) lht##UInt128 +#define Z_z_APPEND_type_116(lht) lht##uint128 +#define Z_z_INSERT_TYPE_116(lht, rht) lht##UINT128##rht +#define Z_z_INSERT_Type_116(lht, rht) lht##UInt128##rht +#define Z_z_INSERT_type_116(lht, rht) lht##uint128##rht + +#define Z_z_APPEND_TYPE_117(lht) lht##SINT128 +#define Z_z_APPEND_Type_117(lht) lht##SInt128 +#define Z_z_APPEND_type_117(lht) lht##sint128 +#define Z_z_INSERT_TYPE_117(lht, rht) lht##SINT128##rht +#define Z_z_INSERT_Type_117(lht, rht) lht##SInt128##rht +#define Z_z_INSERT_type_117(lht, rht) lht##sint128##rht + +/* MARK: - Type name tokens: Fixed format real types */ + +#define Z_z_APPEND_TYPE_150(lht) lht##BFP16 +#define Z_z_APPEND_Type_150(lht) lht##BFP16 +#define Z_z_APPEND_type_150(lht) lht##bfp16 +#define Z_z_INSERT_TYPE_150(lht, rht) lht##BFP16##rht +#define Z_z_INSERT_Type_150(lht, rht) lht##BFP16##rht +#define Z_z_INSERT_type_150(lht, rht) lht##bfp16##rht + +#define Z_z_APPEND_TYPE_151(lht) lht##BFP32 +#define Z_z_APPEND_Type_151(lht) lht##BFP32 +#define Z_z_APPEND_type_151(lht) lht##bfp32 +#define Z_z_INSERT_TYPE_151(lht, rht) lht##BFP32##rht +#define Z_z_INSERT_Type_151(lht, rht) lht##BFP32##rht +#define Z_z_INSERT_type_151(lht, rht) lht##bfp32##rht + +#define Z_z_APPEND_TYPE_152(lht) lht##BFP64 +#define Z_z_APPEND_Type_152(lht) lht##BFP64 +#define Z_z_APPEND_type_152(lht) lht##bfp64 +#define Z_z_INSERT_TYPE_152(lht, rht) lht##BFP64##rht +#define Z_z_INSERT_Type_152(lht, rht) lht##BFP64##rht +#define Z_z_INSERT_type_152(lht, rht) lht##bfp64##rht + +#define Z_z_APPEND_TYPE_153(lht) lht##BFP128 +#define Z_z_APPEND_Type_153(lht) lht##BFP128 +#define Z_z_APPEND_type_153(lht) lht##bfp128 +#define Z_z_INSERT_TYPE_153(lht, rht) lht##BFP128##rht +#define Z_z_INSERT_Type_153(lht, rht) lht##BFP128##rht +#define Z_z_INSERT_type_153(lht, rht) lht##bfp128##rht + +#define Z_z_APPEND_TYPE_154(lht) lht##DFP32 +#define Z_z_APPEND_Type_154(lht) lht##DFP32 +#define Z_z_APPEND_type_154(lht) lht##dfp32 +#define Z_z_INSERT_TYPE_154(lht, rht) lht##DFP32##rht +#define Z_z_INSERT_Type_154(lht, rht) lht##DFP32##rht +#define Z_z_INSERT_type_154(lht, rht) lht##dfp32##rht + +#define Z_z_APPEND_TYPE_155(lht) lht##DFP64 +#define Z_z_APPEND_Type_155(lht) lht##DFP64 +#define Z_z_APPEND_type_155(lht) lht##dfp64 +#define Z_z_INSERT_TYPE_155(lht, rht) lht##DFP64##rht +#define Z_z_INSERT_Type_155(lht, rht) lht##DFP64##rht +#define Z_z_INSERT_type_155(lht, rht) lht##dfp64##rht + +#define Z_z_APPEND_TYPE_156(lht) lht##DFP128 +#define Z_z_APPEND_Type_156(lht) lht##DFP128 +#define Z_z_APPEND_type_156(lht) lht##dfp128 +#define Z_z_INSERT_TYPE_156(lht, rht) lht##DFP128##rht +#define Z_z_INSERT_Type_156(lht, rht) lht##DFP128##rht +#define Z_z_INSERT_type_156(lht, rht) lht##dfp128##rht + +#define Z_z_APPEND_TYPE_157(lht) lht##X87_DE80 +#define Z_z_APPEND_Type_157(lht) lht##x87_DE80 +#define Z_z_APPEND_type_157(lht) lht##x87_de80 +#define Z_z_INSERT_TYPE_157(lht, rht) lht##X87_DE80##rht +#define Z_z_INSERT_Type_157(lht, rht) lht##x87_DE80##rht +#define Z_z_INSERT_type_157(lht, rht) lht##x87_de80##rht + +#define Z_z_APPEND_TYPE_158(lht) lht##X87_DE96 +#define Z_z_APPEND_Type_158(lht) lht##x87_DE96 +#define Z_z_APPEND_type_158(lht) lht##x87_de96 +#define Z_z_INSERT_TYPE_158(lht, rht) lht##X87_DE96##rht +#define Z_z_INSERT_Type_158(lht, rht) lht##x87_DE96##rht +#define Z_z_INSERT_type_158(lht, rht) lht##x87_de96##rht + +#define Z_z_APPEND_TYPE_159(lht) lht##X87_DE128 +#define Z_z_APPEND_Type_159(lht) lht##x87_DE128 +#define Z_z_APPEND_type_159(lht) lht##x87_de128 +#define Z_z_INSERT_TYPE_159(lht, rht) lht##X87_DE128##rht +#define Z_z_INSERT_Type_159(lht, rht) lht##x87_DE128##rht +#define Z_z_INSERT_type_159(lht, rht) lht##x87_de128##rht + +#define Z_z_APPEND_TYPE_160(lht) lht##IBM_ED +#define Z_z_APPEND_Type_160(lht) lht##IBM_ED +#define Z_z_APPEND_type_160(lht) lht##ibm_ed +#define Z_z_INSERT_TYPE_160(lht, rht) lht##IBM_ED##rht +#define Z_z_INSERT_Type_160(lht, rht) lht##IBM_ED##rht +#define Z_z_INSERT_type_160(lht, rht) lht##ibm_ed##rht + +#define Z_z_APPEND_TYPE_162(lht) lht##BFLOAT16 +#define Z_z_APPEND_Type_162(lht) lht##bfloat16 +#define Z_z_APPEND_type_162(lht) lht##bfloat16 +#define Z_z_INSERT_TYPE_162(lht, rht) lht##BFLOAT16##rht +#define Z_z_INSERT_Type_162(lht, rht) lht##bfloat16##rht +#define Z_z_INSERT_type_162(lht, rht) lht##bfloat16##rht + +#define Z_PREPEND_TYPE(FUNDAMENTAL) Z_JOIN_2(Z_z_PREPEND_TYPE_, FUNDAMENTAL) +#define Z_PREPEND_Type(FUNDAMENTAL) Z_JOIN_2(Z_z_PREPEND_Type_, FUNDAMENTAL) +#define Z_PREPEND_type(FUNDAMENTAL) Z_JOIN_2(Z_z_PREPEND_type_, FUNDAMENTAL) +#define Z_APPEND_TYPE( FUNDAMENTAL) Z_JOIN_2(Z_z_APPEND_TYPE_, FUNDAMENTAL) +#define Z_APPEND_Type( FUNDAMENTAL) Z_JOIN_2(Z_z_APPEND_Type_, FUNDAMENTAL) +#define Z_APPEND_type( FUNDAMENTAL) Z_JOIN_2(Z_z_APPEND_type_, FUNDAMENTAL) +#define Z_INSERT_TYPE( FUNDAMENTAL) Z_JOIN_2(Z_z_INSERT_TYPE_, FUNDAMENTAL) +#define Z_INSERT_Type( FUNDAMENTAL) Z_JOIN_2(Z_z_INSERT_Type_, FUNDAMENTAL) +#define Z_INSERT_type( FUNDAMENTAL) Z_JOIN_2(Z_z_INSERT_type_, FUNDAMENTAL) + +/* MARK: - Number format name tokens: Fixed format real types */ + +#define Z_z_INSERT_NUMBER_FORMAT_37(lht, rht) lht##IEEE_754_BINARY16##rht +#define Z_z_INSERT_NUMBER_FORMAT_38(lht, rht) lht##IEEE_754_BINARY32##rht +#define Z_z_INSERT_NUMBER_FORMAT_39(lht, rht) lht##IEEE_754_BINARY64##rht +#define Z_z_INSERT_NUMBER_FORMAT_40(lht, rht) lht##IEEE_754_BINARY128##rht +#define Z_z_INSERT_NUMBER_FORMAT_41(lht, rht) lht##IEEE_754_DECIMAL32##rht +#define Z_z_INSERT_NUMBER_FORMAT_42(lht, rht) lht##IEEE_754_DECIMAL64##rht +#define Z_z_INSERT_NUMBER_FORMAT_43(lht, rht) lht##IEEE_754_DECIMAL128##rht +#define Z_z_INSERT_NUMBER_FORMAT_44(lht, rht) lht##X87_DOUBLE_EXTENDED##rht +#define Z_z_INSERT_NUMBER_FORMAT_45(lht, rht) lht##IBM_EXTENDED_DOUBLE##rht +#define Z_z_INSERT_NUMBER_FORMAT_47(lht, rht) lht##BRAIN_FLOATING_POINT##rht + +#define Z_INSERT_NUMBER_FORMAT(NUMBER_FORMAT) Z_JOIN_2(Z_z_INSERT_NUMBER_FORMAT_, NUMBER_FORMAT) + +#endif /* Z_macros_T_H */ diff --git a/projects/Zeta/API/Z/macros/array.h b/projects/Zeta/API/Z/macros/array.h new file mode 100644 index 0000000..f0ec3f3 --- /dev/null +++ b/projects/Zeta/API/Z/macros/array.h @@ -0,0 +1,15 @@ +/* Zeta API - Z/macros/array.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_array_H +#define Z_macros_array_H + +#define Z_ARRAY_SIZE(array) \ + (sizeof((array)) / sizeof((array)[0])) + +#endif /* Z_macros_array_H */ diff --git a/projects/Zeta/API/Z/macros/bit-field.h b/projects/Zeta/API/Z/macros/bit-field.h new file mode 100644 index 0000000..2eb3045 --- /dev/null +++ b/projects/Zeta/API/Z/macros/bit-field.h @@ -0,0 +1,83 @@ +/* Zeta API - Z/macros/bit-field.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_bit_field_H +#define Z_macros_bit_field_H + +#include +#include + +#define Z_MEMBERIZE_2( _1, _2) _1; _2; +#define Z_MEMBERIZE_3( _1, _2, _3) _1; _2; _3; +#define Z_MEMBERIZE_4( _1, _2, _3, _4) _1; _2; _3; _4; +#define Z_MEMBERIZE_5( _1, _2, _3, _4, _5) _1; _2; _3; _4; _5; +#define Z_MEMBERIZE_6( _1, _2, _3, _4, _5, _6) _1; _2; _3; _4; _5; _6; +#define Z_MEMBERIZE_7( _1, _2, _3, _4, _5, _6, _7) _1; _2; _3; _4; _5; _6; _7; +#define Z_MEMBERIZE_8( _1, _2, _3, _4, _5, _6, _7, _8) _1; _2; _3; _4; _5; _6; _7; _8; +#define Z_MEMBERIZE_9( _1, _2, _3, _4, _5, _6, _7, _8, _9) _1; _2; _3; _4; _5; _6; _7; _8; _9; +#define Z_MEMBERIZE_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; +#define Z_MEMBERIZE_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; +#define Z_MEMBERIZE_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; +#define Z_MEMBERIZE_13(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; +#define Z_MEMBERIZE_14(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; +#define Z_MEMBERIZE_15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; +#define Z_MEMBERIZE_16(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; +#define Z_MEMBERIZE_17(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; +#define Z_MEMBERIZE_18(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; +#define Z_MEMBERIZE_19(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; +#define Z_MEMBERIZE_20(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; +#define Z_MEMBERIZE_21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; +#define Z_MEMBERIZE_22(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; +#define Z_MEMBERIZE_23(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; +#define Z_MEMBERIZE_24(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; +#define Z_MEMBERIZE_25(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; +#define Z_MEMBERIZE_26(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; +#define Z_MEMBERIZE_27(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; +#define Z_MEMBERIZE_28(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; _28; +#define Z_MEMBERIZE_29(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; _28; _29; +#define Z_MEMBERIZE_30(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; _28; _29; _30; +#define Z_MEMBERIZE_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; _28; _29; _30; _31; +#define Z_MEMBERIZE_32(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32) _1; _2; _3; _4; _5; _6; _7; _8; _9; _10; _11; _12; _13; _14; _15; _16; _17; _18; _19; _20; _21; _22; _23; _24; _25; _26; _27; _28; _29; _30; _31; _32; + +#define Z_MEMBERIZE_REVERSED_2( _1, _2) _2; _1; +#define Z_MEMBERIZE_REVERSED_3( _1, _2, _3) _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_4( _1, _2, _3, _4) _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_5( _1, _2, _3, _4, _5) _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_6( _1, _2, _3, _4, _5, _6) _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_7( _1, _2, _3, _4, _5, _6, _7) _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_8( _1, _2, _3, _4, _5, _6, _7, _8) _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_9( _1, _2, _3, _4, _5, _6, _7, _8, _9) _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_13(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_14(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_16(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_17(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_18(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_19(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_20(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20) _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_22(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22) _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_23(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23) _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_24(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24) _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_25(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25) _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_26(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_27(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_28(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) _28; _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_29(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) _29; _28; _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_30(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) _30; _29; _28; _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) _31; _30; _29; _28; _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; +#define Z_MEMBERIZE_REVERSED_32(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32) _32; _31; _30; _29; _28; _27; _26; _25; _24; _23; _22; _21; _20; _19; _18; _17; _16; _15; _14; _13; _12; _11; _10; _9; _8; _7; _6; _5; _4; _3; _2; _1; + +#define Z_BIT_FIELD_MEMBERS(bits, member_count) \ + Z_APPEND_TERNARY(Z_COMPILER_BIT_FIELD_ORDER(bits)) \ + (Z_MEMBERIZE_, REVERSED_##member_count, member_count) + +#endif /* Z_macros_bit_field_H */ diff --git a/projects/Zeta/API/Z/macros/bitwise.h b/projects/Zeta/API/Z/macros/bitwise.h new file mode 100644 index 0000000..7265487 --- /dev/null +++ b/projects/Zeta/API/Z/macros/bitwise.h @@ -0,0 +1,234 @@ +/* Zeta API - Z/macros/bitwise.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_bitwise_H +#define Z_macros_bitwise_H + +#include +#include +#include + +/* MARK: - 8-bit operations */ + +#define Z_UINT8_REVERSE_4(value) \ + (Z_CAST(zuint8)(((value) << 4) | ((value) >> 4))) + +#define Z_UINT8_ROTATE_LEFT(value, rotation) \ + (Z_CAST(zuint8)(((value) << (rotation)) | ((value) >> (8 - (rotation))))) + +#define Z_UINT8_ROTATE_RIGHT(value, rotation) \ + (Z_CAST(zuint8)(((value) >> (rotation)) | ((value) << (8 - (rotation))))) + +#define Z_UINT8_LITTLE_ENDIAN Z_SAME +#define Z_UINT8_BIG_ENDIAN Z_SAME +#define Z_UINT8_PDP_ENDIAN Z_SAME + +/* MARK: - 16-bit operations */ + +#define Z_UINT16_REVERSE_8(value) \ + (Z_CAST(zuint16)(((value) << 8) | ((value) >> 8))) + +#define Z_UINT16_ROTATE_LEFT(value, rotation) \ + (Z_CAST(zuint16)(((value) << (rotation)) | ((value) >> (16 - (rotation))))) + +#define Z_UINT16_ROTATE_RIGHT(value, rotation) \ + (Z_CAST(zuint16)(((value) >> (rotation)) | ((value) << (16 - (rotation))))) + +#if Z_ISA_INTEGRAL_ENDIANNESS != Z_ENDIANNESS_BIG +# define Z_UINT16_LITTLE_ENDIAN Z_SAME +# define Z_UINT16_BIG_ENDIAN Z_UINT16_REVERSE_8 +# define Z_UINT16_PDP_ENDIAN Z_SAME +#else +# define Z_UINT16_LITTLE_ENDIAN Z_UINT16_REVERSE_8 +# define Z_UINT16_BIG_ENDIAN Z_SAME +# define Z_UINT16_PDP_ENDIAN Z_UINT16_REVERSE_8 +#endif + +/* MARK: - 32-bit operations */ + +#define Z_UINT32_FLIP_8(value) (Z_CAST(zuint32)( \ + ((value << 8) & Z_UINT32(0xFF00FF00)) | \ + ((value >> 8) & Z_UINT32(0x00FF00FF)))) + +#define Z_UINT32_REVERSE_8(value) \ + (Z_CAST(zuint32)( \ + (((value) << 24) ) | \ + (((value) >> 24) ) | \ + (((value) << 8) & (Z_CAST(zuint32)(255) << 16)) | \ + (((value) >> 8) & (Z_CAST(zuint32)(255) << 8)))) + +#define Z_UINT32_REVERSE_16(value) \ + (Z_CAST(zuint32)(((value) << 16) | ((value) >> 16))) + +#define Z_UINT32_ROTATE_LEFT(value, rotation) \ + (Z_CAST(zuint32)(((value) << (rotation)) | ((value) >> (32 - (rotation))))) + +#define Z_UINT32_ROTATE_RIGHT(value, rotation) \ + (Z_CAST(zuint32)(((value) >> (rotation)) | ((value) << (32 - (rotation))))) + +#if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_UINT32_LITTLE_ENDIAN Z_SAME +# define Z_UINT32_BIG_ENDIAN Z_UINT32_REVERSE_8 +# define Z_UINT32_PDP_ENDIAN Z_UINT32_REVERSE_16 +#elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define Z_UINT32_LITTLE_ENDIAN Z_UINT32_REVERSE_8 +# define Z_UINT32_BIG_ENDIAN Z_SAME +# define Z_UINT32_PDP_ENDIAN Z_UINT32_FLIP_8 +#else +# define Z_UINT32_LITTLE_ENDIAN Z_UINT32_REVERSE_16 +# define Z_UINT32_BIG_ENDIAN Z_UINT32_FLIP_8 +# define Z_UINT32_PDP_ENDIAN Z_SAME +#endif + +/* MARK: - 64-bit operations */ + +#ifdef Z_UINT64 + +# define Z_UINT64_FLIP_8(value) (Z_CAST(zuint64)( \ + ((value << 8) & Z_UINT64(0xFF00FF00FF00FF00)) | \ + ((value >> 8) & Z_UINT64(0x00FF00FF00FF00FF)))) + +# define Z_UINT64_REVERSE_8(value) (Z_CAST(zuint64)( \ + (((value) << 56) ) | \ + (((value) >> 56) ) | \ + (((value) << 40) & (Z_CAST(zuint64)(255) << 48)) | \ + (((value) >> 40) & (Z_CAST(zuint64)(255) << 8)) | \ + (((value) << 24) & (Z_CAST(zuint64)(255) << 40)) | \ + (((value) >> 24) & (Z_CAST(zuint64)(255) << 16)) | \ + (((value) << 8) & (Z_CAST(zuint64)(255) << 32)) | \ + (((value) >> 8) & (Z_CAST(zuint64)(255) << 24)))) + +# define Z_UINT64_REVERSE_16(value) (Z_CAST(zuint64)( \ + (((value) << 48) ) | \ + (((value) >> 48) ) | \ + (((value) << 16) & (Z_CAST(zuint64)(65535U) << 32)) | \ + (((value) >> 16) & (Z_CAST(zuint64)(65535U) << 16)))) + +# define Z_UINT64_REVERSE_32(value) \ + (Z_CAST(zuint64)(((value) << 32) | ((value) >> 32))) + +# define Z_UINT64_ROTATE_LEFT(value, rotation) \ + (Z_CAST(zuint64)(((value) << (rotation)) | ((value) >> (64 - (rotation))))) + +# define Z_UINT64_ROTATE_RIGHT(value, rotation) \ + (Z_CAST(zuint64)(((value) >> (rotation)) | ((value) << (64 - (rotation))))) + +# if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_UINT64_LITTLE_ENDIAN Z_SAME +# define Z_UINT64_BIG_ENDIAN Z_UINT64_REVERSE_8 +# define Z_UINT64_PDP_ENDIAN Z_UINT64_REVERSE_16 +# elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define Z_UINT64_LITTLE_ENDIAN Z_UINT64_REVERSE_8 +# define Z_UINT64_BIG_ENDIAN Z_SAME +# define Z_UINT64_PDP_ENDIAN Z_UINT64_FLIP_8 +# else +# define Z_UINT64_LITTLE_ENDIAN Z_UINT64_REVERSE_16 +# define Z_UINT64_BIG_ENDIAN Z_UINT64_FLIP_8 +# define Z_UINT64_PDP_ENDIAN Z_SAME +# endif + +#endif + +/* MARK: - 128-bit operations */ + +#ifdef Z_UINT128 + +# define Z_UINT128_FLIP_8(value) (Z_CAST(zuint128)( \ + ((value << 8) & ( \ + (Z_CAST(zuint128)(255) << 120) | \ + (Z_CAST(zuint128)(255) << 104) | \ + (Z_CAST(zuint128)(255) << 88) | \ + (Z_CAST(zuint128)(255) << 72) | \ + (Z_CAST(zuint128)(255) << 56) | \ + (Z_CAST(zuint128)(255) << 40) | \ + (Z_CAST(zuint128)(255) << 24) | \ + (Z_CAST(zuint128)(255) << 8))) | \ + ((value >> 8) & ( \ + (Z_CAST(zuint128)(255) << 112) | \ + (Z_CAST(zuint128)(255) << 96) | \ + (Z_CAST(zuint128)(255) << 80) | \ + (Z_CAST(zuint128)(255) << 64) | \ + (Z_CAST(zuint128)(255) << 48) | \ + (Z_CAST(zuint128)(255) << 32) | \ + (Z_CAST(zuint128)(255) << 16) | \ + (Z_CAST(zuint128)(255)))))) + +# define Z_UINT128_REVERSE_8(value) (Z_CAST(zuint128)( \ + (((value) << 120) ) | \ + (((value) >> 120) ) | \ + (((value) << 104) & (Z_CAST(zuint128)(255) << 112)) | \ + (((value) >> 104) & (Z_CAST(zuint128)(255) << 8)) | \ + (((value) << 88) & (Z_CAST(zuint128)(255) << 104)) | \ + (((value) >> 88) & (Z_CAST(zuint128)(255) << 16)) | \ + (((value) << 72) & (Z_CAST(zuint128)(255) << 96)) | \ + (((value) >> 72) & (Z_CAST(zuint128)(255) << 24)) | \ + (((value) << 56) & (Z_CAST(zuint128)(255) << 88)) | \ + (((value) >> 56) & (Z_CAST(zuint128)(255) << 32)) | \ + (((value) << 40) & (Z_CAST(zuint128)(255) << 80)) | \ + (((value) >> 40) & (Z_CAST(zuint128)(255) << 40)) | \ + (((value) << 24) & (Z_CAST(zuint128)(255) << 72)) | \ + (((value) >> 24) & (Z_CAST(zuint128)(255) << 48)) | \ + (((value) << 8) & (Z_CAST(zuint128)(255) << 64)) | \ + (((value) >> 8) & (Z_CAST(zuint128)(255) << 56)))) + +# define Z_UINT128_REVERSE_16(value) (Z_CAST(zuint128)( \ + (((value) << 112) ) | \ + (((value) >> 112) ) | \ + (((value) << 80) & (Z_CAST(zuint128)(65535U) << 96)) | \ + (((value) >> 80) & (Z_CAST(zuint128)(65535U) << 16)) | \ + (((value) << 48) & (Z_CAST(zuint128)(65535U) << 80)) | \ + (((value) >> 48) & (Z_CAST(zuint128)(65535U) << 32)) | \ + (((value) << 16) & (Z_CAST(zuint128)(65535U) << 64)) | \ + (((value) >> 16) & (Z_CAST(zuint128)(65535U) << 48)))) + +# define Z_UINT128_REVERSE_32(value) (Z_CAST(zuint128)( \ + (((value) << 96) ) | \ + (((value) >> 96) ) | \ + (((value) << 32) & (Z_CAST(zuint128)(4294967295) << 64)) | \ + (((value) >> 32) & (Z_CAST(zuint128)(4294967295) << 32)))) + +# define Z_UINT128_REVERSE_64(value) \ + (Z_CAST(zuint128)(((value) << 64) | ((value) >> 64))) + +# define Z_UINT128_ROTATE_LEFT(value, rotation) \ + (Z_CAST(zuint128)(((value) << (rotation)) | ((value) >> (128 - (rotation))))) + +# define Z_UINT128_ROTATE_RIGHT(value, rotation) \ + (Z_CAST(zuint128)(((value) >> (rotation)) | ((value) << (128 - (rotation))))) + + +# if Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_LITTLE +# define Z_UINT128_LITTLE_ENDIAN Z_SAME +# define Z_UINT128_BIG_ENDIAN Z_UINT128_REVERSE_8 +# define Z_UINT128_PDP_ENDIAN Z_UINT128_REVERSE_16 + +# elif Z_ISA_INTEGRAL_ENDIANNESS == Z_ENDIANNESS_BIG +# define Z_UINT128_LITTLE_ENDIAN Z_UINT128_REVERSE_8 +# define Z_UINT128_BIG_ENDIAN Z_SAME +# define Z_UINT128_PDP_ENDIAN Z_UINT128_FLIP_8 +# else +# define Z_UINT128_LITTLE_ENDIAN Z_UINT128_REVERSE_16 +# define Z_UINT128_BIG_ENDIAN Z_UINT128_FLIP_8 +# define Z_UINT128_PDP_ENDIAN Z_SAME +# endif + +#endif + +/* MARK: - Macro selectors */ + +#define Z_T_REVERSE(T) \ + Z_JOIN_2(Z_APPEND_NUMBER_, Z_CHAR_WIDTH)( \ + Z_INSERT_TYPE(Z_##T##_FIXED_FUNDAMENTAL)(Z_, _REVERSE_)) + +#define Z_T_BIG_ENDIAN(T) \ + Z_INSERT_TYPE(Z_##T##_FIXED_FUNDAMENTAL)(Z_, _BIG_ENDIAN) + +#define Z_T_LITTLE_ENDIAN(T) \ + Z_INSERT_TYPE(Z_##T##_FIXED_FUNDAMENTAL)(Z_, _LITTLE_ENDIAN) + +#endif /* Z_macros_bitwise_H */ diff --git a/projects/Zeta/API/Z/macros/calendar.h b/projects/Zeta/API/Z/macros/calendar.h new file mode 100644 index 0000000..a7b537c --- /dev/null +++ b/projects/Zeta/API/Z/macros/calendar.h @@ -0,0 +1,18 @@ +/* Zeta API - Z/macros/calendar.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_calendar_H +#define Z_macros_calendar_H + +#define Z_GREGORIAN_YEAR_IS_LEAP(year) \ + !((year) % ((year) % 100 ? 4 : 400)) + +#define Z_JULIAN_YEAR_IS_LEAP(year) \ + !((year) % 4) + +#endif /* Z_macros_calendar_H */ diff --git a/projects/Zeta/API/Z/macros/casting.h b/projects/Zeta/API/Z/macros/casting.h new file mode 100644 index 0000000..a312d43 --- /dev/null +++ b/projects/Zeta/API/Z/macros/casting.h @@ -0,0 +1,18 @@ +/* Zeta API - Z/macros/casting.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_casting_H +#define Z_macros_casting_H + +#ifdef __cplusplus +# define Z_CAST(type) type +#else +# define Z_CAST +#endif + +#endif /* Z_macros_casting_H */ diff --git a/projects/Zeta/API/Z/macros/character.h b/projects/Zeta/API/Z/macros/character.h new file mode 100644 index 0000000..80e3500 --- /dev/null +++ b/projects/Zeta/API/Z/macros/character.h @@ -0,0 +1,146 @@ +/* Zeta API - Z/macros/character.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_character_H +#define Z_macros_character_H + +#include + +#if '\0' - '\1' > '\0' +# define Z_CHAR_IS_ASCII(value) \ + ((value) <= 0x7F) +#else +# define Z_CHAR_IS_ASCII(value) \ + ((value) >= 0x00 && (value) <= 0x7F) +#endif + +#define Z_CHAR_IS_BASE_2_DIGIT(value) \ + ((value) == '0' || (value) == '1') + +#define Z_CHAR_IS_BLANK(value) \ + ((value) == ' ' || (value) == '\t') + +#if Z_CHARACTER_SET_DIGITS_ARE_CONSECUTIVE +# define Z_CHAR_IS_BASE_8_DIGIT( value) \ + ((value) >= '0' && (value) <= '7') + +# define Z_CHAR_IS_BASE_10_DIGIT(value) \ + ((value) >= '0' && (value) <= '9') + +#else +# define Z_CHAR_IS_BASE_8_DIGIT(value) ( \ + (value) == '0' || (value) == '1' || (value) == '2' || \ + (value) == '3' || (value) == '4' || (value) == '5' || \ + (value) == '6' || (value) == '7') + +# define Z_CHAR_IS_BASE_10_DIGIT(value) ( \ + (value) == '0' || (value) == '1' || (value) == '2' || \ + (value) == '3' || (value) == '4' || (value) == '5' || \ + (value) == '6' || (value) == '7' || (value) == '8' || \ + (value) == '9') +#endif + +#if Z_CHARACTER_SET_LOWERCASE_LETTERS_ARE_CONSECUTIVE +# define Z_CHAR_IS_BASE_16_LOWERCASE_LETTER(value) \ + ((value) >= 'a' && (value) <= 'f') + +# define Z_CHAR_IS_LOWERCASE_LETTER(value) \ + ((value) >= 'a' && (value) <= 'z') + +#else +# define Z_CHAR_IS_BASE_16_LOWERCASE_LETTER(value) ( \ + (value) == 'a' || (value) == 'b' || (value) == 'c' || \ + (value) == 'd' || (value) == 'e' || (value) == 'f') + +# define Z_CHAR_IS_LOWERCASE_LETTER(value) ( \ + (value) == 'a' || (value) == 'b' || (value) == 'c' || \ + (value) == 'd' || (value) == 'e' || (value) == 'f' || \ + (value) == 'g' || (value) == 'h' || (value) == 'i' || \ + (value) == 'j' || (value) == 'k' || (value) == 'l' || \ + (value) == 'm' || (value) == 'n' || (value) == 'o' || \ + (value) == 'p' || (value) == 'q' || (value) == 'r' || \ + (value) == 's' || (value) == 't' || (value) == 'u' || \ + (value) == 'v' || (value) == 'y' || (value) == 'x' || \ + (value) == 'z') +#endif + +#if Z_CHARACTER_SET_UPPERCASE_LETTERS_ARE_CONSECUTIVE +# define Z_CHAR_IS_BASE_16_UPPERCASE_LETTER(value) \ + ((value) >= 'A' && (value) <= 'F') + +# define Z_CHAR_IS_UPPERCASE_LETTER(value) \ + ((value) >= 'A' && (value) <= 'Z') + +#else +# define Z_CHAR_IS_BASE_16_UPPERCASE_LETTER(value) ( \ + (value) == 'A' || (value) == 'B' || (value) == 'C' || \ + (value) == 'D' || (value) == 'E' || (value) == 'F') + +# define Z_CHAR_IS_UPPERCASE_LETTER(value) ( \ + (value) == 'A' || (value) == 'B' || (value) == 'C' || \ + (value) == 'D' || (value) == 'E' || (value) == 'F' || \ + (value) == 'G' || (value) == 'H' || (value) == 'I' || \ + (value) == 'J' || (value) == 'K' || (value) == 'L' || \ + (value) == 'M' || (value) == 'N' || (value) == 'O' || \ + (value) == 'P' || (value) == 'Q' || (value) == 'R' || \ + (value) == 'S' || (value) == 'T' || (value) == 'U' || \ + (value) == 'V' || (value) == 'Y' || (value) == 'X' || \ + (value) == 'Z') +#endif + +#define Z_CHAR_IS_BASE_16_LOWERCASE_DIGIT(value) ( \ + Z_CHAR_IS_BASE_10_DIGIT (value) || \ + Z_CHAR_IS_BASE_16_LOWERCASE_LETTER(value)) + +#define Z_CHAR_IS_BASE_16_UPPERCASE_DIGIT(value) ( \ + Z_CHAR_IS_BASE_10_DIGIT (value) || \ + Z_CHAR_IS_BASE_16_UPPERCASE_LETTER(value)) + +#if Z_CHARACTER_SET_IS_ASCII +# define Z_CHAR_IS_CONTROL(value) \ + (((value) & 0xE0) == 0 || (value) == 0x7F) + +# define Z_CHAR_IS_GRAPHICAL(value) \ + ((value) >= '!' && (value) <= '~') + +# define Z_CHAR_IS_PRINTABLE(value) \ + ((value) >= ' ' && (value) <= '~') + +# define Z_CHAR_IS_BASE_16_DIGIT(value) ( \ + ((value) >= '0' && (value) <= '9') || \ + (((value) & 0xDF) >= 'A' && ((value) & 0xDF) <= 'F')) + +# define Z_CHAR_IS_LETTER(value) \ + (((value) & 0xDF) >= 'A' && ((value) & 0xDF) <= 'Z') + +#else +# define Z_CHAR_IS_BASE_16_DIGIT(value) ( \ + Z_CHAR_IS_BASE_10_DIGIT (value) || \ + Z_CHAR_IS_BASE_16_LOWERCASE_LETTER(value) || \ + Z_CHAR_IS_BASE_16_UPPERCASE_LETTER(value)) + +# define Z_CHAR_IS_LETTER(value) ( \ + Z_CHAR_IS_LOWERCASE_LETTER(value) || \ + Z_CHAR_IS_UPPERCASE_LETTER(value)) +#endif + +#if Z_CHARACTER_SET_UPPERCASE_LETTERS_ARE_CONSECUTIVE && \ + Z_CHARACTER_SET_LOWERCASE_LETTERS_ARE_CONSECUTIVE + +# define Z_CHAR_LOWERCASE(value) \ + ((value) >= 'A' && (value) <= 'Z' ? (value) - 'A' + 'a' : (value)) + +# define Z_CHAR_UPPERCASE(value) \ + ((value) >= 'a' && (value) <= 'z' ? (value) - 'a' + 'A' : (value)) +#endif + +#define Z_CHAR_IS_ALPHANUMERIC(value) ( \ + Z_CHAR_IS_BASE_10_DIGIT(value) || \ + Z_CHAR_IS_LETTER (value)) + +#endif /* Z_macros_character_H */ diff --git a/projects/Zeta/API/Z/macros/hash.h b/projects/Zeta/API/Z/macros/hash.h new file mode 100644 index 0000000..fa66df6 --- /dev/null +++ b/projects/Zeta/API/Z/macros/hash.h @@ -0,0 +1,44 @@ +/* Zeta API - Z/macros/hash.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_hash_H +#define Z_macros_hash_H + +#include + +/* MARK: - FNV-0 */ + +#define Z_FNV0_32_INITIALIZER 0 +#define Z_FNV0_32_UPDATE(hash, value) (((hash) * Z_UINT32(0x01000193)) ^ (value)) + +#ifdef Z_UINT64 +# define Z_FNV0_64_INITIALIZER 0 +# define Z_FNV0_64_UPDATE(hash, value) (((hash) * Z_UINT64(0x00000100000001B3)) ^ (value)) +#endif + +/* MARK: - FNV-1 */ + +#define Z_FNV1_32_INITIALIZER Z_UINT32(0x811C9DC5) +#define Z_FNV1_32_UPDATE Z_FNV0_32_UPDATE + +#ifdef Z_UINT64 +# define Z_FNV1_64_INITIALIZER Z_UINT64(0xCBF29CE484222325) +# define Z_FNV1_64_UPDATE Z_FNV0_64_UPDATE +#endif + +/* MARK: - FNV-1a */ + +#define Z_FNV1A_32_INITIALIZER Z_FNV1_32_INITIALIZER +#define Z_FNV1A_32_UPDATE(hash, value) (((hash) ^ (value)) * Z_UINT32(0x01000193)) + +#ifdef Z_UINT64 +# define Z_FNV1A_64_INITIALIZER Z_FNV1_64_INITIALIZER +# define Z_FNV1A_64_UPDATE(hash, value) (((hash) ^ (value)) * Z_UINT64(0x00000100000001B3)) +#endif + +#endif /* Z_macros_hash_H */ diff --git a/projects/Zeta/API/Z/macros/iteration.h b/projects/Zeta/API/Z/macros/iteration.h new file mode 100644 index 0000000..670abd3 --- /dev/null +++ b/projects/Zeta/API/Z/macros/iteration.h @@ -0,0 +1,284 @@ +/* Zeta API - Z/macros/iteration.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_iteration_H +#define Z_macros_iteration_H + +#define Z_APPEND_INDEX_FOR_0( l, _) +#define Z_APPEND_INDEX_FOR_1( l, _) l##0 +#define Z_APPEND_INDEX_FOR_2( l, _) l##0 _ l##1 +#define Z_APPEND_INDEX_FOR_3( l, _) l##0 _ l##1 _ l##2 +#define Z_APPEND_INDEX_FOR_4( l, _) l##0 _ l##1 _ l##2 _ l##3 +#define Z_APPEND_INDEX_FOR_5( l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 +#define Z_APPEND_INDEX_FOR_6( l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 +#define Z_APPEND_INDEX_FOR_7( l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 +#define Z_APPEND_INDEX_FOR_8( l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 +#define Z_APPEND_INDEX_FOR_9( l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 +#define Z_APPEND_INDEX_FOR_10(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 +#define Z_APPEND_INDEX_FOR_11(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 +#define Z_APPEND_INDEX_FOR_12(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 +#define Z_APPEND_INDEX_FOR_13(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 +#define Z_APPEND_INDEX_FOR_14(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 +#define Z_APPEND_INDEX_FOR_15(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 +#define Z_APPEND_INDEX_FOR_16(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 +#define Z_APPEND_INDEX_FOR_17(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 +#define Z_APPEND_INDEX_FOR_18(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 +#define Z_APPEND_INDEX_FOR_19(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 +#define Z_APPEND_INDEX_FOR_20(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 +#define Z_APPEND_INDEX_FOR_21(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 +#define Z_APPEND_INDEX_FOR_22(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 +#define Z_APPEND_INDEX_FOR_23(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 +#define Z_APPEND_INDEX_FOR_24(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 +#define Z_APPEND_INDEX_FOR_25(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 +#define Z_APPEND_INDEX_FOR_26(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 +#define Z_APPEND_INDEX_FOR_27(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 +#define Z_APPEND_INDEX_FOR_28(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 +#define Z_APPEND_INDEX_FOR_29(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 +#define Z_APPEND_INDEX_FOR_30(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 +#define Z_APPEND_INDEX_FOR_31(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 _ l##30 +#define Z_APPEND_INDEX_FOR_32(l, _) l##0 _ l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 _ l##30 _ l##31 + +#define Z_APPEND_TIME_FOR_0( l, _) +#define Z_APPEND_TIME_FOR_1( l, _) l##1 +#define Z_APPEND_TIME_FOR_2( l, _) l##1 _ l##2 +#define Z_APPEND_TIME_FOR_3( l, _) l##1 _ l##2 _ l##3 +#define Z_APPEND_TIME_FOR_4( l, _) l##1 _ l##2 _ l##3 _ l##4 +#define Z_APPEND_TIME_FOR_5( l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 +#define Z_APPEND_TIME_FOR_6( l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 +#define Z_APPEND_TIME_FOR_7( l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 +#define Z_APPEND_TIME_FOR_8( l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 +#define Z_APPEND_TIME_FOR_9( l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 +#define Z_APPEND_TIME_FOR_10(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 +#define Z_APPEND_TIME_FOR_11(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 +#define Z_APPEND_TIME_FOR_12(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 +#define Z_APPEND_TIME_FOR_13(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 +#define Z_APPEND_TIME_FOR_14(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 +#define Z_APPEND_TIME_FOR_15(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 +#define Z_APPEND_TIME_FOR_16(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 +#define Z_APPEND_TIME_FOR_17(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 +#define Z_APPEND_TIME_FOR_18(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 +#define Z_APPEND_TIME_FOR_19(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 +#define Z_APPEND_TIME_FOR_20(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 +#define Z_APPEND_TIME_FOR_21(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 +#define Z_APPEND_TIME_FOR_22(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 +#define Z_APPEND_TIME_FOR_23(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 +#define Z_APPEND_TIME_FOR_24(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 +#define Z_APPEND_TIME_FOR_25(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 +#define Z_APPEND_TIME_FOR_26(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 +#define Z_APPEND_TIME_FOR_27(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 +#define Z_APPEND_TIME_FOR_28(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 +#define Z_APPEND_TIME_FOR_29(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 +#define Z_APPEND_TIME_FOR_30(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 _ l##30 +#define Z_APPEND_TIME_FOR_31(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 _ l##30 _ l##31 +#define Z_APPEND_TIME_FOR_32(l, _) l##1 _ l##2 _ l##3 _ l##4 _ l##5 _ l##6 _ l##7 _ l##8 _ l##9 _ l##10 _ l##11 _ l##12 _ l##13 _ l##14 _ l##15 _ l##16 _ l##17 _ l##18 _ l##19 _ l##20 _ l##21 _ l##22 _ l##23 _ l##24 _ l##25 _ l##26 _ l##27 _ l##28 _ l##29 _ l##30 _ l##31 _ l##32 + +#define Z_INSERT_INDEX_FOR_0( l, r, _) +#define Z_INSERT_INDEX_FOR_1( l, r, _) l##0##r +#define Z_INSERT_INDEX_FOR_2( l, r, _) l##0##r _ l##1##r +#define Z_INSERT_INDEX_FOR_3( l, r, _) l##0##r _ l##1##r _ l##2##r +#define Z_INSERT_INDEX_FOR_4( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r +#define Z_INSERT_INDEX_FOR_5( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r +#define Z_INSERT_INDEX_FOR_6( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r +#define Z_INSERT_INDEX_FOR_7( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r +#define Z_INSERT_INDEX_FOR_8( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r +#define Z_INSERT_INDEX_FOR_9( l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r +#define Z_INSERT_INDEX_FOR_10(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r +#define Z_INSERT_INDEX_FOR_11(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r +#define Z_INSERT_INDEX_FOR_12(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r +#define Z_INSERT_INDEX_FOR_13(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r +#define Z_INSERT_INDEX_FOR_14(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r +#define Z_INSERT_INDEX_FOR_15(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r +#define Z_INSERT_INDEX_FOR_16(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r +#define Z_INSERT_INDEX_FOR_17(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r +#define Z_INSERT_INDEX_FOR_18(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r +#define Z_INSERT_INDEX_FOR_19(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r +#define Z_INSERT_INDEX_FOR_20(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r +#define Z_INSERT_INDEX_FOR_21(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r +#define Z_INSERT_INDEX_FOR_22(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r +#define Z_INSERT_INDEX_FOR_23(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r +#define Z_INSERT_INDEX_FOR_24(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r +#define Z_INSERT_INDEX_FOR_25(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r +#define Z_INSERT_INDEX_FOR_26(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r +#define Z_INSERT_INDEX_FOR_27(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r +#define Z_INSERT_INDEX_FOR_28(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r +#define Z_INSERT_INDEX_FOR_29(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r +#define Z_INSERT_INDEX_FOR_30(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r +#define Z_INSERT_INDEX_FOR_31(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r _ l##30##r +#define Z_INSERT_INDEX_FOR_32(l, r, _) l##0##r _ l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r _ l##30##r _ l##31##r + +#define Z_INSERT_TIME_FOR_0( l, r, _) +#define Z_INSERT_TIME_FOR_1( l, r, _) l##1##r +#define Z_INSERT_TIME_FOR_2( l, r, _) l##1##r _ l##2##r +#define Z_INSERT_TIME_FOR_3( l, r, _) l##1##r _ l##2##r _ l##3##r +#define Z_INSERT_TIME_FOR_4( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r +#define Z_INSERT_TIME_FOR_5( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r +#define Z_INSERT_TIME_FOR_6( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r +#define Z_INSERT_TIME_FOR_7( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r +#define Z_INSERT_TIME_FOR_8( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r +#define Z_INSERT_TIME_FOR_9( l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r +#define Z_INSERT_TIME_FOR_10(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r +#define Z_INSERT_TIME_FOR_11(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r +#define Z_INSERT_TIME_FOR_12(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r +#define Z_INSERT_TIME_FOR_13(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r +#define Z_INSERT_TIME_FOR_14(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r +#define Z_INSERT_TIME_FOR_15(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r +#define Z_INSERT_TIME_FOR_16(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r +#define Z_INSERT_TIME_FOR_17(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r +#define Z_INSERT_TIME_FOR_18(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r +#define Z_INSERT_TIME_FOR_19(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r +#define Z_INSERT_TIME_FOR_20(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r +#define Z_INSERT_TIME_FOR_21(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r +#define Z_INSERT_TIME_FOR_22(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r +#define Z_INSERT_TIME_FOR_23(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r +#define Z_INSERT_TIME_FOR_24(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r +#define Z_INSERT_TIME_FOR_25(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r +#define Z_INSERT_TIME_FOR_26(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r +#define Z_INSERT_TIME_FOR_27(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r +#define Z_INSERT_TIME_FOR_28(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r +#define Z_INSERT_TIME_FOR_29(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r +#define Z_INSERT_TIME_FOR_30(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r _ l##30##r +#define Z_INSERT_TIME_FOR_31(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r _ l##30##r _ l##31##r +#define Z_INSERT_TIME_FOR_32(l, r, _) l##1##r _ l##2##r _ l##3##r _ l##4##r _ l##5##r _ l##6##r _ l##7##r _ l##8##r _ l##9##r _ l##10##r _ l##11##r _ l##12##r _ l##13##r _ l##14##r _ l##15##r _ l##16##r _ l##17##r _ l##18##r _ l##19##r _ l##20##r _ l##21##r _ l##22##r _ l##23##r _ l##24##r _ l##25##r _ l##26##r _ l##27##r _ l##28##r _ l##29##r _ l##30##r _ l##31##r _ l##32##r + +#define Z_CALL_WITH_INDEX_FOR_0( c, _) +#define Z_CALL_WITH_INDEX_FOR_1( c, _) c(0) +#define Z_CALL_WITH_INDEX_FOR_2( c, _) c(0) _ c(1) +#define Z_CALL_WITH_INDEX_FOR_3( c, _) c(0) _ c(1) _ c(2) +#define Z_CALL_WITH_INDEX_FOR_4( c, _) c(0) _ c(1) _ c(2) _ c(3) +#define Z_CALL_WITH_INDEX_FOR_5( c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) +#define Z_CALL_WITH_INDEX_FOR_6( c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) +#define Z_CALL_WITH_INDEX_FOR_7( c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) +#define Z_CALL_WITH_INDEX_FOR_8( c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) +#define Z_CALL_WITH_INDEX_FOR_9( c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) +#define Z_CALL_WITH_INDEX_FOR_10(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) +#define Z_CALL_WITH_INDEX_FOR_11(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) +#define Z_CALL_WITH_INDEX_FOR_12(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) +#define Z_CALL_WITH_INDEX_FOR_13(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) +#define Z_CALL_WITH_INDEX_FOR_14(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) +#define Z_CALL_WITH_INDEX_FOR_15(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) +#define Z_CALL_WITH_INDEX_FOR_16(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) +#define Z_CALL_WITH_INDEX_FOR_17(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) +#define Z_CALL_WITH_INDEX_FOR_18(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) +#define Z_CALL_WITH_INDEX_FOR_19(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) +#define Z_CALL_WITH_INDEX_FOR_20(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) +#define Z_CALL_WITH_INDEX_FOR_21(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) +#define Z_CALL_WITH_INDEX_FOR_22(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) +#define Z_CALL_WITH_INDEX_FOR_23(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) +#define Z_CALL_WITH_INDEX_FOR_24(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) +#define Z_CALL_WITH_INDEX_FOR_25(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) +#define Z_CALL_WITH_INDEX_FOR_26(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) +#define Z_CALL_WITH_INDEX_FOR_27(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) +#define Z_CALL_WITH_INDEX_FOR_28(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) +#define Z_CALL_WITH_INDEX_FOR_29(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) +#define Z_CALL_WITH_INDEX_FOR_30(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) +#define Z_CALL_WITH_INDEX_FOR_31(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) _ c(30) +#define Z_CALL_WITH_INDEX_FOR_32(c, _) c(0) _ c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) _ c(30) _ c(31) + +#define Z_CALL_WITH_TIME_FOR_0( c, _) +#define Z_CALL_WITH_TIME_FOR_1( c, _) c(1) +#define Z_CALL_WITH_TIME_FOR_2( c, _) c(1) _ c(2) +#define Z_CALL_WITH_TIME_FOR_3( c, _) c(1) _ c(2) _ c(3) +#define Z_CALL_WITH_TIME_FOR_4( c, _) c(1) _ c(2) _ c(3) _ c(4) +#define Z_CALL_WITH_TIME_FOR_5( c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) +#define Z_CALL_WITH_TIME_FOR_6( c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) +#define Z_CALL_WITH_TIME_FOR_7( c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) +#define Z_CALL_WITH_TIME_FOR_8( c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) +#define Z_CALL_WITH_TIME_FOR_9( c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) +#define Z_CALL_WITH_TIME_FOR_10(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) +#define Z_CALL_WITH_TIME_FOR_11(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) +#define Z_CALL_WITH_TIME_FOR_12(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) +#define Z_CALL_WITH_TIME_FOR_13(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) +#define Z_CALL_WITH_TIME_FOR_14(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) +#define Z_CALL_WITH_TIME_FOR_15(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) +#define Z_CALL_WITH_TIME_FOR_16(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) +#define Z_CALL_WITH_TIME_FOR_17(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) +#define Z_CALL_WITH_TIME_FOR_18(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) +#define Z_CALL_WITH_TIME_FOR_19(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) +#define Z_CALL_WITH_TIME_FOR_20(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) +#define Z_CALL_WITH_TIME_FOR_21(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) +#define Z_CALL_WITH_TIME_FOR_22(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) +#define Z_CALL_WITH_TIME_FOR_23(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) +#define Z_CALL_WITH_TIME_FOR_24(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) +#define Z_CALL_WITH_TIME_FOR_25(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) +#define Z_CALL_WITH_TIME_FOR_26(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) +#define Z_CALL_WITH_TIME_FOR_27(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) +#define Z_CALL_WITH_TIME_FOR_28(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) +#define Z_CALL_WITH_TIME_FOR_29(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) +#define Z_CALL_WITH_TIME_FOR_30(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) _ c(30) +#define Z_CALL_WITH_TIME_FOR_31(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) _ c(30) _ c(31) +#define Z_CALL_WITH_TIME_FOR_32(c, _) c(1) _ c(2) _ c(3) _ c(4) _ c(5) _ c(6) _ c(7) _ c(8) _ c(9) _ c(10) _ c(11) _ c(12) _ c(13) _ c(14) _ c(15) _ c(16) _ c(17) _ c(18) _ c(19) _ c(20) _ c(21) _ c(22) _ c(23) _ c(24) _ c(25) _ c(26) _ c(27) _ c(28) _ c(29) _ c(30) _ c(31) _ c(32) + +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_0( c, t, _) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_1( c, t, _) c(t, 0) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_2( c, t, _) c(t, 0) _ c(t, 1) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_3( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_4( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_5( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_6( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_7( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_8( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_9( c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_10(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_11(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_12(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_13(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_14(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_15(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_16(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_17(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_18(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_19(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_20(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_21(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_22(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_23(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_24(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_25(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_26(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_27(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_28(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_29(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_30(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_31(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) _ c(t, 30) +#define Z_CALL_WITH_TOKEN_AND_INDEX_FOR_32(c, t, _) c(t, 0) _ c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) _ c(t, 30) _ c(t, 31) + +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_0( c, t, _) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_1( c, t, _) c(t, 1) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_2( c, t, _) c(t, 1) _ c(t, 2) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_3( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_4( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_5( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_6( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_7( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_8( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_9( c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_10(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_11(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_12(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_13(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_14(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_15(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_16(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_17(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_18(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_19(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_20(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_21(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_22(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_23(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_24(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_25(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_26(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_27(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_28(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_29(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_30(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) _ c(t, 30) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_31(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) _ c(t, 30) _ c(t, 31) +#define Z_CALL_WITH_TOKEN_AND_TIME_FOR_32(c, t, _) c(t, 1) _ c(t, 2) _ c(t, 3) _ c(t, 4) _ c(t, 5) _ c(t, 6) _ c(t, 7) _ c(t, 8) _ c(t, 9) _ c(t, 10) _ c(t, 11) _ c(t, 12) _ c(t, 13) _ c(t, 14) _ c(t, 15) _ c(t, 16) _ c(t, 17) _ c(t, 18) _ c(t, 19) _ c(t, 20) _ c(t, 21) _ c(t, 22) _ c(t, 23) _ c(t, 24) _ c(t, 25) _ c(t, 26) _ c(t, 27) _ c(t, 28) _ c(t, 29) _ c(t, 30) _ c(t, 31) _ c(t, 32) + +#endif /* Z_macros_iteration_H */ diff --git a/projects/Zeta/API/Z/macros/language.h b/projects/Zeta/API/Z/macros/language.h new file mode 100644 index 0000000..73c59c9 --- /dev/null +++ b/projects/Zeta/API/Z/macros/language.h @@ -0,0 +1,167 @@ +/* Zeta API - Z/macros/language.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_language_H +#define Z_macros_language_H + +#include +#include + +/* MARK: - Attributes */ + +#if Z_COMPILER_HAS_ATTRIBUTE(API_EXPORT) +# define Z_API_EXPORT Z_COMPILER_ATTRIBUTE(API_EXPORT) +#else +# define Z_API_EXPORT Z_PUBLIC +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(API_IMPORT) +# define Z_API_IMPORT Z_COMPILER_ATTRIBUTE(API_IMPORT) +#else +# define Z_API_IMPORT +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(API_WEAK_EXPORT) +# define Z_API_WEAK_EXPORT Z_COMPILER_ATTRIBUTE(API_WEAK_EXPORT) +#else +# define Z_API_WEAK_EXPORT Z_API_EXPORT Z_WEAK +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(MICROSOFT_STD_CALL) +# define Z_MICROSOFT_STD_CALL Z_COMPILER_ATTRIBUTE(MICROSOFT_STD_CALL) +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(NULL_TERMINATED) +# define Z_NULL_TERMINATED Z_COMPILER_ATTRIBUTE(NULL_TERMINATED) +#else +# define Z_NULL_TERMINATED +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(PRIVATE) +# define Z_PRIVATE Z_COMPILER_ATTRIBUTE(PRIVATE) +#elif Z_DIALECT_HAS_STORAGE_CLASS(C, STATIC) +# define Z_PRIVATE static +#else +# define Z_PRIVATE +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(PUBLIC) +# define Z_PUBLIC Z_COMPILER_ATTRIBUTE(PUBLIC) +#else +# define Z_PUBLIC +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(WEAK) +# define Z_WEAK Z_COMPILER_ATTRIBUTE(WEAK) +#else +# define Z_WEAK +#endif + +/* MARK: - Specifiers */ + +#if Z_COMPILER_HAS_ATTRIBUTE(INLINE) +# define Z_INLINE Z_COMPILER_ATTRIBUTE(INLINE) +#elif defined(__cplusplus) || Z_DIALECT_HAS_SPECIFIER(C99, INLINE) +# define Z_INLINE inline +#else +# define Z_INLINE +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(ALWAYS_INLINE) +# define Z_ALWAYS_INLINE Z_COMPILER_ATTRIBUTE(ALWAYS_INLINE) +#else +# define Z_ALWAYS_INLINE Z_INLINE +#endif + +#if Z_COMPILER_HAS_ATTRIBUTE(NO_RETURN) +# define Z_NO_RETURN Z_COMPILER_ATTRIBUTE(NO_RETURN) +#elif Z_DIALECT_HAS_ATTRIBUTE(CPP11, NORETURN) +# define Z_NO_RETURN [[noreturn]] +#elif Z_DIALECT_HAS_SPECIFIER(C11, NORETURN) +# define Z_NO_RETURN _Noreturn +#else +# define Z_NO_RETURN +#endif + +/* MARK: - Storage classes */ + +#if Z_COMPILER_HAS_ATTRIBUTE(THREAD_LOCAL) +# define Z_THREAD_LOCAL Z_COMPILER_ATTRIBUTE(THREAD_LOCAL) +#elif Z_DIALECT_HAS_STORAGE_CLASS(CPP11, THREAD_LOCAL) +# define Z_THREAD_LOCAL thread_local +#elif Z_DIALECT_HAS_STORAGE_CLASS(C11, THREAD_LOCAL) +# define Z_THREAD_LOCAL _Thread_local +#endif + +/* MARK: - Informative macros */ + +#define Z_OUT +#define Z_INOUT +#define Z_UNUSED(variable) (void)variable; + +/* MARK: - Linkage */ + +#ifdef __cplusplus +# define Z_EXTERN_C extern "C" +# define Z_EXTERN_C_BEGIN extern "C" { +# define Z_EXTERN_C_END } +#else +# define Z_EXTERN_C +# define Z_EXTERN_C_BEGIN +# define Z_EXTERN_C_END +#endif + +/* MARK: - Packed constructs */ + +/* struct {} */ + +#define Z_PACKED_NAMED_STRUCTURE_BEGIN(type) \ + Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_STRUCT struct \ + Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_TYPE type \ + Z_COMPILER_PACKED_NAMED_STRUCTURE_BEFORE_BODY + +#define Z_PACKED_NAMED_STRUCTURE_END \ + Z_COMPILER_PACKED_NAMED_STRUCTURE_AFTER_BODY + +/* union {} */ + +#define Z_PACKED_NAMED_UNION_BEGIN(type) \ + Z_COMPILER_PACKED_NAMED_UNION_BEFORE_UNION union \ + Z_COMPILER_PACKED_NAMED_UNION_BEFORE_TYPE type \ + Z_COMPILER_PACKED_NAMED_UNION_BEFORE_BODY + +#define Z_PACKED_NAMED_UNION_END \ + Z_COMPILER_PACKED_NAMED_UNION_AFTER_BODY + +/* struct {} */ + +#define Z_PACKED_STRUCTURE_BEGIN \ + Z_COMPILER_PACKED_STRUCTURE_BEFORE_STRUCT struct \ + Z_COMPILER_PACKED_STRUCTURE_BEFORE_BODY + +#define Z_PACKED_STRUCTURE_END \ + Z_COMPILER_PACKED_STRUCTURE_AFTER_BODY + +/* union {} */ + +#define Z_PACKED_UNION_BEGIN \ + Z_COMPILER_PACKED_UNION_BEFORE_UNION union \ + Z_COMPILER_PACKED_UNION_BEFORE_BODY + +#define Z_PACKED_UNION_END \ + Z_COMPILER_PACKED_UNION_AFTER_BODY + +/* FAM */ + +#if Z_DIALECT_HAS(C99, FLEXIBLE_ARRAY_MEMBER) +# define Z_FAM(member) member +#else +# define Z_FAM(member) +#endif + +#endif /* Z_macros_language_H */ diff --git a/projects/Zeta/API/Z/macros/language.hpp b/projects/Zeta/API/Z/macros/language.hpp new file mode 100644 index 0000000..964c481 --- /dev/null +++ b/projects/Zeta/API/Z/macros/language.hpp @@ -0,0 +1,74 @@ +/* Zeta API - Z/macros/language.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_language_HPP +#define Z_macros_language_HPP + +#include + +// MARK: - Constants + +#if !Z_DIALECT_HAS_TYPE(CPP98, BOOL) +# ifndef true +# define true 1 +# endif + +# ifndef false +# define false 0 +# endif +#endif + +// MARK: - Specifiers + +#if Z_DIALECT_HAS_SPECIFIER(CPP11, CONSTEXPR) +# define Z_CONSTANT constexpr +# define Z_CT_CPP11 constexpr +#else +# define Z_CONSTANT const +# define Z_CT_CPP11 +#endif + +#if Z_DIALECT_HAS(CPP14, CONSTEXPR_FUNCTION) +# define Z_CT_CPP14 constexpr +#else +# define Z_CT_CPP14 +#endif + +#define Z_CT(CONFORM_TO) Z_CT_##CONFORM_TO Z_INLINE + +#if Z_DIALECT_HAS_SPECIFIER(CPP11, FINAL) +# define Z_FINAL final +#else +# define Z_FINAL +#endif + +#if Z_DIALECT_HAS_SPECIFIER(CPP11, NOEXCEPT) +# define Z_NOTHROW noexcept +#else +# define Z_NOTHROW throw() +#endif + +// MARK: - Defaulted functions + +#if !defined(Z_AVOID_VARIADIC_MACROS) && \ + (Z_DIALECT_HAS(C99, VARIADIC_MACRO) || Z_DIALECT_HAS(CPP11, C99_PREPROCESSOR)) + +# if Z_DIALECT_HAS(CPP11, EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION) +# define Z_DEFAULTED(...) = default; +# else +# define Z_DEFAULTED(...) __VA_ARGS__ +# endif +#else +# if Z_DIALECT_HAS(CPP11, EXPLICITLY_DEFAULTED_SPECIAL_MEMBER_FUNCTION) +# define Z_DEFAULTED(body) = default; +# else +# define Z_DEFAULTED(body) body +# endif +#endif + +#endif // Z_macros_language_HPP diff --git a/projects/Zeta/API/Z/macros/math.h b/projects/Zeta/API/Z/macros/math.h new file mode 100644 index 0000000..b90ca3f --- /dev/null +++ b/projects/Zeta/API/Z/macros/math.h @@ -0,0 +1,32 @@ +/* Zeta API - Z/macros/math.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_math_H +#define Z_macros_math_H + +#define Z_SUM( a, b) ((a) + (b)) +#define Z_SUBTRACT(a, b) ((a) - (b)) +#define Z_MULTIPLY(a, b) ((a) * (b)) +#define Z_DIVIDE( a, b) ((a) / (b)) +#define Z_MODULO( a, b) ((a) % (b)) +#define Z_MAXIMUM( a, b) ((a) > (b) ? (a) : (b)) +#define Z_MINIMUM( a, b) ((a) < (b) ? (a) : (b)) + +#define Z_ABSOLUTE(value) \ + ((value) < 0 ? -(value) : (value)) + +#define Z_IS_POWER_OF_2(value) \ + (!((value) & ((value) - 1)) && (value) > 1) + +#define Z_NEXT_MULTIPLE(value, base) \ + ((value) + (base) - ((value) % (base))) + +#define Z_PREVIOUS_MULTIPLE(value, base) \ + ((((value) - 1) / (base)) * (base)) + +#endif /* Z_macros_math_H */ diff --git a/projects/Zeta/API/Z/macros/pointer.h b/projects/Zeta/API/Z/macros/pointer.h new file mode 100644 index 0000000..16622b9 --- /dev/null +++ b/projects/Zeta/API/Z/macros/pointer.h @@ -0,0 +1,20 @@ +/* Zeta API - Z/macros/pointer.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_pointer_H +#define Z_macros_pointer_H + +#include + +#define Z_AT(type, base, offset) \ + ((type *)(((zchar *)(void *)(base)) + (offset))) + +#define Z_AT_CONST(type, base, offset) \ + ((type const *)(((zchar const *)(void const *)(base)) + (offset))) + +#endif /* Z_macros_pointer_H */ diff --git a/projects/Zeta/API/Z/macros/structure.h b/projects/Zeta/API/Z/macros/structure.h new file mode 100644 index 0000000..33fa529 --- /dev/null +++ b/projects/Zeta/API/Z/macros/structure.h @@ -0,0 +1,32 @@ +/* Zeta API - Z/macros/structure.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_structure_H +#define Z_macros_structure_H + +#include + +#if Z_COMPILER_HAS_MACRO(MEMBER_OFFSET) +# define Z_MEMBER_OFFSET Z_COMPILER_MACRO(MEMBER_OFFSET) + +#else +# include + +# ifdef __cplusplus +# include + +# define Z_MEMBER_OFFSET(type, member) \ + zusize(zuintptr(&(static_cast(Z_NULL))->member)) + +# else +# define Z_MEMBER_OFFSET(type, member) \ + ((zusize)(zuintptr)&((type *)(0))->member) +# endif +#endif + +#endif /* Z_macros_structure_H */ diff --git a/projects/Zeta/API/Z/macros/token.h b/projects/Zeta/API/Z/macros/token.h new file mode 100644 index 0000000..c7a37e5 --- /dev/null +++ b/projects/Zeta/API/Z/macros/token.h @@ -0,0 +1,367 @@ +/* Zeta API - Z/macros/token.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_token_H +#define Z_macros_token_H + +#define Z_COMMA , + +#define Z_z_EMPTY(dummy) +#define Z_EMPTY Z_z_EMPTY(~) + +#define Z_SAME(token) token + +#define Z_z_STRINGIFY(token) #token +#define Z_STRINGIFY( token) Z_z_STRINGIFY(token) + +#define Z_z_PREFIX_0( rht) 0##rht +#define Z_z_PREFIX_0x( rht) 0x##rht +#define Z_z_PREFIX_0b( rht) 0b##rht +#define Z_z_PREFIX_Z( rht) Z##rht +#define Z_z_PREFIX_Z_( rht) Z_##rht +#define Z_z_PREFIX_z( rht) z##rht +#define Z_z_PREFIX_z_( rht) z_##rht +#define Z_z_SUFFIX_D32( lht) lht##D32 +#define Z_z_SUFFIX_D64( lht) lht##D64 +#define Z_z_SUFFIX_D64x( lht) lht##D64x +#define Z_z_SUFFIX_D128( lht) lht##D128 +#define Z_z_SUFFIX_D128x(lht) lht##D128x +#define Z_z_SUFFIX_DD( lht) lht##DD +#define Z_z_SUFFIX_DF( lht) lht##DF +#define Z_z_SUFFIX_DL( lht) lht##DL +#define Z_z_SUFFIX_F( lht) lht##F +#define Z_z_SUFFIX_F16( lht) lht##F16 +#define Z_z_SUFFIX_F32( lht) lht##F32 +#define Z_z_SUFFIX_F32x( lht) lht##F32x +#define Z_z_SUFFIX_F64( lht) lht##F64 +#define Z_z_SUFFIX_F64x( lht) lht##F64x +#define Z_z_SUFFIX_F128( lht) lht##F128 +#define Z_z_SUFFIX_F128x(lht) lht##F128x +#define Z_z_SUFFIX_i32( lht) lht##i32 +#define Z_z_SUFFIX_i64( lht) lht##i64 +#define Z_z_SUFFIX_L( lht) lht##L +#define Z_z_SUFFIX_LL( lht) lht##LL +#define Z_z_SUFFIX_Q( lht) lht##Q +#define Z_z_SUFFIX_U( lht) lht##U +#define Z_z_SUFFIX_Ui32( lht) lht##Ui32 +#define Z_z_SUFFIX_Ui64( lht) lht##Ui64 +#define Z_z_SUFFIX_UL( lht) lht##UL +#define Z_z_SUFFIX_ULL( lht) lht##ULL +#define Z_z_SUFFIX_UZ( lht) lht##UZ +#define Z_z_SUFFIX_W( lht) lht##W +#define Z_z_SUFFIX_Z( lht) lht##Z + +#define Z_PREFIX_ Z_SAME +#define Z_PREFIX_0( rht) Z_z_PREFIX_0 (rht) +#define Z_PREFIX_0x( rht) Z_z_PREFIX_0x (rht) +#define Z_PREFIX_0b( rht) Z_z_PREFIX_0b (rht) +#define Z_PREFIX_Z( rht) Z_z_PREFIX_Z (rht) +#define Z_PREFIX_Z_( rht) Z_z_PREFIX_Z_ (rht) +#define Z_PREFIX_z( rht) Z_z_PREFIX_z (rht) +#define Z_PREFIX_z_( rht) Z_z_PREFIX_z_ (rht) +#define Z_SUFFIX_ Z_SAME +#define Z_SUFFIX_D32( lht) Z_z_SUFFIX_D32 (lht) +#define Z_SUFFIX_D64( lht) Z_z_SUFFIX_D64 (lht) +#define Z_SUFFIX_D64x( lht) Z_z_SUFFIX_D64x (lht) +#define Z_SUFFIX_D128( lht) Z_z_SUFFIX_D128 (lht) +#define Z_SUFFIX_D128x(lht) Z_z_SUFFIX_D128x(lht) +#define Z_SUFFIX_DD( lht) Z_z_SUFFIX_DD (lht) +#define Z_SUFFIX_DF( lht) Z_z_SUFFIX_DF (lht) +#define Z_SUFFIX_DL( lht) Z_z_SUFFIX_DL (lht) +#define Z_SUFFIX_F( lht) Z_z_SUFFIX_F (lht) +#define Z_SUFFIX_F16( lht) Z_z_SUFFIX_F16 (lht) +#define Z_SUFFIX_F32( lht) Z_z_SUFFIX_F32 (lht) +#define Z_SUFFIX_F32x( lht) Z_z_SUFFIX_F32x (lht) +#define Z_SUFFIX_F64( lht) Z_z_SUFFIX_F64 (lht) +#define Z_SUFFIX_F64x( lht) Z_z_SUFFIX_F64x (lht) +#define Z_SUFFIX_F128( lht) Z_z_SUFFIX_F128 (lht) +#define Z_SUFFIX_F128x(lht) Z_z_SUFFIX_F128x(lht) +#define Z_SUFFIX_i32( lht) Z_z_SUFFIX_i32 (lht) +#define Z_SUFFIX_i64( lht) Z_z_SUFFIX_i64 (lht) +#define Z_SUFFIX_L( lht) Z_z_SUFFIX_L (lht) +#define Z_SUFFIX_LL( lht) Z_z_SUFFIX_LL (lht) +#define Z_SUFFIX_Q( lht) Z_z_SUFFIX_Q (lht) +#define Z_SUFFIX_U( lht) Z_z_SUFFIX_U (lht) +#define Z_SUFFIX_Ui32( lht) Z_z_SUFFIX_Ui32 (lht) +#define Z_SUFFIX_Ui64( lht) Z_z_SUFFIX_Ui64 (lht) +#define Z_SUFFIX_UL( lht) Z_z_SUFFIX_UL (lht) +#define Z_SUFFIX_ULL( lht) Z_z_SUFFIX_ULL (lht) +#define Z_SUFFIX_UZ( lht) Z_z_SUFFIX_UZ (lht) +#define Z_SUFFIX_W( lht) Z_z_SUFFIX_W (lht) +#define Z_SUFFIX_Z( lht) Z_z_SUFFIX_Z (lht) + +#define Z_PASTE_2( _1, _2) _1##_2 +#define Z_PASTE_3( _1, _2, _3) _1##_2##_3 +#define Z_PASTE_4( _1, _2, _3, _4) _1##_2##_3##_4 +#define Z_PASTE_5( _1, _2, _3, _4, _5) _1##_2##_3##_4##_5 +#define Z_PASTE_6( _1, _2, _3, _4, _5, _6) _1##_2##_3##_4##_5##_6 +#define Z_PASTE_7( _1, _2, _3, _4, _5, _6, _7) _1##_2##_3##_4##_5##_6##_7 +#define Z_PASTE_8( _1, _2, _3, _4, _5, _6, _7, _8) _1##_2##_3##_4##_5##_6##_7##_8 +#define Z_PASTE_9( _1, _2, _3, _4, _5, _6, _7, _8, _9) _1##_2##_3##_4##_5##_6##_7##_8##_9 +#define Z_PASTE_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10 +#define Z_PASTE_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11 +#define Z_PASTE_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12 +#define Z_PASTE_13(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13 +#define Z_PASTE_14(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14 +#define Z_PASTE_15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15 +#define Z_PASTE_16(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16 +#define Z_PASTE_17(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17 +#define Z_PASTE_18(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18 +#define Z_PASTE_19(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19 +#define Z_PASTE_20(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20 +#define Z_PASTE_21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21 +#define Z_PASTE_22(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22 +#define Z_PASTE_23(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23 +#define Z_PASTE_24(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24 +#define Z_PASTE_25(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25 +#define Z_PASTE_26(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26 +#define Z_PASTE_27(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27 +#define Z_PASTE_28(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27##_28 +#define Z_PASTE_29(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27##_28##_29 +#define Z_PASTE_30(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27##_28##_29##_30 +#define Z_PASTE_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27##_28##_29##_30##_31 +#define Z_PASTE_32(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32) _1##_2##_3##_4##_5##_6##_7##_8##_9##_10##_11##_12##_13##_14##_15##_16##_17##_18##_19##_20##_21##_22##_23##_24##_25##_26##_27##_28##_29##_30##_31##_32 + +#define Z_JOIN_2( _1, _2) Z_PASTE_2 (_1, _2) +#define Z_JOIN_3( _1, _2, _3) Z_PASTE_3 (_1, _2, _3) +#define Z_JOIN_4( _1, _2, _3, _4) Z_PASTE_4 (_1, _2, _3, _4) +#define Z_JOIN_5( _1, _2, _3, _4, _5) Z_PASTE_5 (_1, _2, _3, _4, _5) +#define Z_JOIN_6( _1, _2, _3, _4, _5, _6) Z_PASTE_6 (_1, _2, _3, _4, _5, _6) +#define Z_JOIN_7( _1, _2, _3, _4, _5, _6, _7) Z_PASTE_7 (_1, _2, _3, _4, _5, _6, _7) +#define Z_JOIN_8( _1, _2, _3, _4, _5, _6, _7, _8) Z_PASTE_8 (_1, _2, _3, _4, _5, _6, _7, _8) +#define Z_JOIN_9( _1, _2, _3, _4, _5, _6, _7, _8, _9) Z_PASTE_9 (_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define Z_JOIN_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) Z_PASTE_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) +#define Z_JOIN_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) Z_PASTE_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) +#define Z_JOIN_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) Z_PASTE_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) +#define Z_JOIN_13(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) Z_PASTE_13(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) +#define Z_JOIN_14(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) Z_PASTE_14(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) +#define Z_JOIN_15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) Z_PASTE_15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) +#define Z_JOIN_16(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) Z_PASTE_16(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) +#define Z_JOIN_17(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) Z_PASTE_17(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) +#define Z_JOIN_18(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) Z_PASTE_18(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) +#define Z_JOIN_19(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) Z_PASTE_19(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) +#define Z_JOIN_20(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20) Z_PASTE_20(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20) +#define Z_JOIN_21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) Z_PASTE_21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) +#define Z_JOIN_22(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22) Z_PASTE_22(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22) +#define Z_JOIN_23(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23) Z_PASTE_23(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23) +#define Z_JOIN_24(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24) Z_PASTE_24(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24) +#define Z_JOIN_25(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25) Z_PASTE_25(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25) +#define Z_JOIN_26(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) Z_PASTE_26(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) +#define Z_JOIN_27(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) Z_PASTE_27(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) +#define Z_JOIN_28(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) Z_PASTE_28(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) +#define Z_JOIN_29(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) Z_PASTE_29(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) +#define Z_JOIN_30(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) Z_PASTE_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) +#define Z_JOIN_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) Z_PASTE_31(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) +#define Z_JOIN_32(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32) Z_PASTE_32(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32) + +#define Z_APPEND_NUMBER_0( lht) lht##0 +#define Z_APPEND_NUMBER_1( lht) lht##1 +#define Z_APPEND_NUMBER_2( lht) lht##2 +#define Z_APPEND_NUMBER_3( lht) lht##3 +#define Z_APPEND_NUMBER_4( lht) lht##4 +#define Z_APPEND_NUMBER_5( lht) lht##5 +#define Z_APPEND_NUMBER_6( lht) lht##6 +#define Z_APPEND_NUMBER_7( lht) lht##7 +#define Z_APPEND_NUMBER_8( lht) lht##8 +#define Z_APPEND_NUMBER_9( lht) lht##9 +#define Z_APPEND_NUMBER_10( lht) lht##10 +#define Z_APPEND_NUMBER_11( lht) lht##11 +#define Z_APPEND_NUMBER_12( lht) lht##12 +#define Z_APPEND_NUMBER_13( lht) lht##13 +#define Z_APPEND_NUMBER_14( lht) lht##14 +#define Z_APPEND_NUMBER_15( lht) lht##15 +#define Z_APPEND_NUMBER_16( lht) lht##16 +#define Z_APPEND_NUMBER_17( lht) lht##17 +#define Z_APPEND_NUMBER_18( lht) lht##18 +#define Z_APPEND_NUMBER_19( lht) lht##19 +#define Z_APPEND_NUMBER_20( lht) lht##20 +#define Z_APPEND_NUMBER_21( lht) lht##21 +#define Z_APPEND_NUMBER_22( lht) lht##22 +#define Z_APPEND_NUMBER_23( lht) lht##23 +#define Z_APPEND_NUMBER_24( lht) lht##24 +#define Z_APPEND_NUMBER_25( lht) lht##25 +#define Z_APPEND_NUMBER_26( lht) lht##26 +#define Z_APPEND_NUMBER_27( lht) lht##27 +#define Z_APPEND_NUMBER_28( lht) lht##28 +#define Z_APPEND_NUMBER_29( lht) lht##29 +#define Z_APPEND_NUMBER_30( lht) lht##30 +#define Z_APPEND_NUMBER_31( lht) lht##31 +#define Z_APPEND_NUMBER_32( lht) lht##32 +#define Z_APPEND_NUMBER_48( lht) lht##48 +#define Z_APPEND_NUMBER_64( lht) lht##64 +#define Z_APPEND_NUMBER_72( lht) lht##72 +#define Z_APPEND_NUMBER_80( lht) lht##80 +#define Z_APPEND_NUMBER_96( lht) lht##96 +#define Z_APPEND_NUMBER_128( lht) lht##128 +#define Z_APPEND_NUMBER_256( lht) lht##256 +#define Z_APPEND_NUMBER_512( lht) lht##512 +#define Z_APPEND_NUMBER_1024(lht) lht##1024 + +#define Z_PREPEND_NUMBER_0( rht) 0##rht +#define Z_PREPEND_NUMBER_1( rht) 1##rht +#define Z_PREPEND_NUMBER_2( rht) 2##rht +#define Z_PREPEND_NUMBER_3( rht) 3##rht +#define Z_PREPEND_NUMBER_4( rht) 4##rht +#define Z_PREPEND_NUMBER_5( rht) 5##rht +#define Z_PREPEND_NUMBER_6( rht) 6##rht +#define Z_PREPEND_NUMBER_7( rht) 7##rht +#define Z_PREPEND_NUMBER_8( rht) 8##rht +#define Z_PREPEND_NUMBER_9( rht) 9##rht +#define Z_PREPEND_NUMBER_10( rht) 10##rht +#define Z_PREPEND_NUMBER_11( rht) 11##rht +#define Z_PREPEND_NUMBER_12( rht) 12##rht +#define Z_PREPEND_NUMBER_13( rht) 13##rht +#define Z_PREPEND_NUMBER_14( rht) 14##rht +#define Z_PREPEND_NUMBER_15( rht) 15##rht +#define Z_PREPEND_NUMBER_16( rht) 16##rht +#define Z_PREPEND_NUMBER_17( rht) 17##rht +#define Z_PREPEND_NUMBER_18( rht) 18##rht +#define Z_PREPEND_NUMBER_19( rht) 19##rht +#define Z_PREPEND_NUMBER_20( rht) 20##rht +#define Z_PREPEND_NUMBER_21( rht) 21##rht +#define Z_PREPEND_NUMBER_22( rht) 22##rht +#define Z_PREPEND_NUMBER_23( rht) 23##rht +#define Z_PREPEND_NUMBER_24( rht) 24##rht +#define Z_PREPEND_NUMBER_25( rht) 25##rht +#define Z_PREPEND_NUMBER_26( rht) 26##rht +#define Z_PREPEND_NUMBER_27( rht) 27##rht +#define Z_PREPEND_NUMBER_28( rht) 28##rht +#define Z_PREPEND_NUMBER_29( rht) 29##rht +#define Z_PREPEND_NUMBER_30( rht) 30##rht +#define Z_PREPEND_NUMBER_31( rht) 31##rht +#define Z_PREPEND_NUMBER_32( rht) 32##rht +#define Z_PREPEND_NUMBER_48( rht) 48##rht +#define Z_PREPEND_NUMBER_64( rht) 64##rht +#define Z_PREPEND_NUMBER_72( rht) 72##rht +#define Z_PREPEND_NUMBER_80( rht) 80##rht +#define Z_PREPEND_NUMBER_96( rht) 96##rht +#define Z_PREPEND_NUMBER_128( rht) 128##rht +#define Z_PREPEND_NUMBER_256( rht) 256##rht +#define Z_PREPEND_NUMBER_512( rht) 512##rht +#define Z_PREPEND_NUMBER_1024(rht) 1024##rht + +#define Z_INSERT_NUMBER_0( lht, rht) lht##0##rht +#define Z_INSERT_NUMBER_1( lht, rht) lht##1##rht +#define Z_INSERT_NUMBER_2( lht, rht) lht##2##rht +#define Z_INSERT_NUMBER_3( lht, rht) lht##3##rht +#define Z_INSERT_NUMBER_4( lht, rht) lht##4##rht +#define Z_INSERT_NUMBER_5( lht, rht) lht##5##rht +#define Z_INSERT_NUMBER_6( lht, rht) lht##6##rht +#define Z_INSERT_NUMBER_7( lht, rht) lht##7##rht +#define Z_INSERT_NUMBER_8( lht, rht) lht##8##rht +#define Z_INSERT_NUMBER_9( lht, rht) lht##9##rht +#define Z_INSERT_NUMBER_10( lht, rht) lht##10##rht +#define Z_INSERT_NUMBER_11( lht, rht) lht##11##rht +#define Z_INSERT_NUMBER_12( lht, rht) lht##12##rht +#define Z_INSERT_NUMBER_13( lht, rht) lht##13##rht +#define Z_INSERT_NUMBER_14( lht, rht) lht##14##rht +#define Z_INSERT_NUMBER_15( lht, rht) lht##15##rht +#define Z_INSERT_NUMBER_16( lht, rht) lht##16##rht +#define Z_INSERT_NUMBER_17( lht, rht) lht##17##rht +#define Z_INSERT_NUMBER_18( lht, rht) lht##18##rht +#define Z_INSERT_NUMBER_19( lht, rht) lht##19##rht +#define Z_INSERT_NUMBER_20( lht, rht) lht##20##rht +#define Z_INSERT_NUMBER_21( lht, rht) lht##21##rht +#define Z_INSERT_NUMBER_22( lht, rht) lht##22##rht +#define Z_INSERT_NUMBER_23( lht, rht) lht##23##rht +#define Z_INSERT_NUMBER_24( lht, rht) lht##24##rht +#define Z_INSERT_NUMBER_25( lht, rht) lht##25##rht +#define Z_INSERT_NUMBER_26( lht, rht) lht##26##rht +#define Z_INSERT_NUMBER_27( lht, rht) lht##27##rht +#define Z_INSERT_NUMBER_28( lht, rht) lht##28##rht +#define Z_INSERT_NUMBER_29( lht, rht) lht##29##rht +#define Z_INSERT_NUMBER_30( lht, rht) lht##30##rht +#define Z_INSERT_NUMBER_31( lht, rht) lht##31##rht +#define Z_INSERT_NUMBER_32( lht, rht) lht##32##rht +#define Z_INSERT_NUMBER_48( lht, rht) lht##48##rht +#define Z_INSERT_NUMBER_64( lht, rht) lht##64##rht +#define Z_INSERT_NUMBER_72( lht, rht) lht##72##rht +#define Z_INSERT_NUMBER_80( lht, rht) lht##80##rht +#define Z_INSERT_NUMBER_96( lht, rht) lht##96##rht +#define Z_INSERT_NUMBER_128( lht, rht) lht##128##rht +#define Z_INSERT_NUMBER_256( lht, rht) lht##256##rht +#define Z_INSERT_NUMBER_512( lht, rht) lht##512##rht +#define Z_INSERT_NUMBER_1024(lht, rht) lht##1024##rht + +#define Z_z_IS_RESULT(padding1, result, padding2, padding3) result + +#define Z_z_IS_TEST(split, merge_begin, merge_end) \ + Z_SAME(Z_z_IS_RESULT(~ split 1, 0, ~ merge_begin , merge_end ~)) + +#define Z_z_IS_NOT_TEST(split, merge_begin, merge_end) \ + Z_SAME(Z_z_IS_RESULT(~ split 0, 1, ~ merge_begin , merge_end ~)) + +#define Z_z_IS_0_SPLIT_0 , +#define Z_z_IS_0_MERGE_BEGIN_0 Z_EMPTY ( +#define Z_z_IS_0_MERGE_END_0 Z_EMPTY ) +#define Z_z_IS_1_SPLIT_1 , +#define Z_z_IS_1_MERGE_BEGIN_1 Z_EMPTY ( +#define Z_z_IS_1_MERGE_END_1 Z_EMPTY ) + +#define Z_IS_0(token) Z_z_IS_TEST( \ + Z_JOIN_2(Z_z_IS_0_SPLIT_, token), \ + Z_JOIN_2(Z_z_IS_0_MERGE_BEGIN_, token), \ + Z_JOIN_2(Z_z_IS_0_MERGE_END_, token)) + +#define Z_IS_1(token) Z_z_IS_TEST( \ + Z_JOIN_2(Z_z_IS_1_SPLIT_, token), \ + Z_JOIN_2(Z_z_IS_1_MERGE_BEGIN_, token), \ + Z_JOIN_2(Z_z_IS_1_MERGE_END_, token)) + +#define Z_IS_NOT_0(token) Z_z_IS_NOT_TEST( \ + Z_JOIN_2(Z_z_IS_0_SPLIT_, token), \ + Z_JOIN_2(Z_z_IS_0_MERGE_BEGIN_, token), \ + Z_JOIN_2(Z_z_IS_0_MERGE_END_, token)) + +#define Z_IS_NOT_1(token) Z_z_IS_NOT_TEST( \ + Z_JOIN_2(Z_z_IS_1_SPLIT_, token), \ + Z_JOIN_2(Z_z_IS_1_MERGE_BEGIN_, token), \ + Z_JOIN_2(Z_z_IS_1_MERGE_END_, token)) + +#define Z_BOOLEANIZE Z_IS_NOT_0 +#define Z_NOT Z_IS_0 +#define Z_IS_TRUE Z_IS_1 +#define Z_IS_FALSE Z_IS_0 + +#define Z_z_IF_1(body) body +#define Z_z_IF_0(body) + +#define Z_IF(booleanizable) \ + Z_JOIN_2(Z_z_IF_, Z_BOOLEANIZE(booleanizable)) + +#define Z_z_UNLESS_1(body) +#define Z_z_UNLESS_0(body) body + +#define Z_UNLESS(booleanizable) \ + Z_JOIN_2(Z_z_UNLESS_, Z_BOOLEANIZE(booleanizable)) + +#define Z_z_TERNARY_1(a, b) a +#define Z_z_TERNARY_0(a, b) b + +#define Z_TERNARY(booleanizable) \ + Z_JOIN_2(Z_z_TERNARY_, Z_BOOLEANIZE(booleanizable)) + +#define Z_z_APPEND_TERNARY_1(lht, a, b) lht##a +#define Z_z_APPEND_TERNARY_0(lht, a, b) lht##b + +#define Z_APPEND_TERNARY(booleanizable) \ + Z_JOIN_2(Z_z_APPEND_TERNARY_, Z_BOOLEANIZE(booleanizable)) + +#define Z_z_PREPEND_TERNARY_1(rht, a, b) a##rht +#define Z_z_PREPEND_TERNARY_0(rht, a, b) b##rht + +#define Z_PREPEND_TERNARY(booleanizable) \ + Z_JOIN_2(Z_z_PREPEND_TERNARY_, Z_BOOLEANIZE(booleanizable)) + +#define Z_z_INSERT_TERNARY_1(lht, rht, a, b) lht##a##rht +#define Z_z_INSERT_TERNARY_0(lht, rht, a, b) lht##b##rht + +#define Z_INSERT_TERNARY(booleanizable) \ + Z_JOIN_2(Z_z_INSERT_TERNARY_, Z_BOOLEANIZE(booleanizable)) + +#endif /* Z_macros_token_H */ diff --git a/projects/Zeta/API/Z/macros/variadic.h b/projects/Zeta/API/Z/macros/variadic.h new file mode 100644 index 0000000..37584bf --- /dev/null +++ b/projects/Zeta/API/Z/macros/variadic.h @@ -0,0 +1,50 @@ +/* Zeta API - Z/macros/variadic.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006 Laurent Deniau . +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_variadic_H +#define Z_macros_variadic_H + +#include + +#if !defined(Z_AVOID_VARIADIC_MACROS) && \ + (Z_DIALECT_HAS(C99, VARIADIC_MACRO) || Z_DIALECT_HAS(CPP11, C99_PREPROCESSOR)) + +# include + +# define L_PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, \ + _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, \ + _33, _34, _35, _36, _37, _38, _39, _40, \ + _41, _42, _43, _44, _45, _46, _47, _48, \ + _49, _50, _51, _52, _53, _54, _55, _56, \ + _57, _58, _59, _60, _61, _62, _63, n, \ + ... \ + ) n + +# define L_PP_RSEQ_N() \ + 63, 62, 61, 60, 59, 58, 57, 56, \ + 55, 54, 53, 52, 51, 50, 49, 48, \ + 47, 46, 45, 44, 43, 42, 41, 40, \ + 39, 38, 37, 36, 35, 34, 33, 32, \ + 31, 30, 29, 28, 27, 26, 25, 24, \ + 23, 22, 21, 20, 19, 18, 17, 16, \ + 15, 14, 13, 12, 11, 10, 9, 8, \ + 7, 6, 5, 4, 3, 2, 1, 0 + +# define Z_z_ARGUMENT_COUNT(...) \ + Z_SAME(L_PP_ARG_N(__VA_ARGS__)) + +# define Z_ARGUMENT_COUNT(...) \ + Z_z_ARGUMENT_COUNT(__VA_ARGS__, L_PP_RSEQ_N()) + +#endif + +#endif /* Z_macros_variadic_H */ diff --git a/projects/Zeta/API/Z/macros/variadic_control.h b/projects/Zeta/API/Z/macros/variadic_control.h new file mode 100644 index 0000000..d257844 --- /dev/null +++ b/projects/Zeta/API/Z/macros/variadic_control.h @@ -0,0 +1,57 @@ +/* Zeta API - Z/macros/variadic_control.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2015 Petr Kobalicek . +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_variadic_control_H +#define Z_macros_variadic_control_H + +#include + +#if !defined(Z_AVOID_VARIADIC_MACROS) && \ + (Z_DIALECT_HAS(C99, VARIADIC_MACRO) || Z_DIALECT_HAS(CPP11, C99_PREPROCESSOR)) + +# include + +# define Z_SELECT_0( _0, ...) _0 +# define Z_SELECT_1( _0, _1, ...) _1 +# define Z_SELECT_2( _0, _1, _2, ...) _2 +# define Z_SELECT_3( _0, _1, _2, _3, ...) _3 +# define Z_SELECT_4( _0, _1, _2, _3, _4, ...) _4 +# define Z_SELECT_5( _0, _1, _2, _3, _4, _5, ...) _5 +# define Z_SELECT_6( _0, _1, _2, _3, _4, _5, _6, ...) _6 +# define Z_SELECT_7( _0, _1, _2, _3, _4, _5, _6, _7, ...) _7 +# define Z_SELECT_8( _0, _1, _2, _3, _4, _5, _6, _7, _8, ...) _8 +# define Z_SELECT_9( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) _9 +# define Z_SELECT_10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10 +# define Z_SELECT_11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) _11 +# define Z_SELECT_12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) _12 +# define Z_SELECT_13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) _13 +# define Z_SELECT_14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) _14 +# define Z_SELECT_15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) _15 +# define Z_SELECT_16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) _16 +# define Z_SELECT_17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) _17 +# define Z_SELECT_18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) _18 +# define Z_SELECT_19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) _19 +# define Z_SELECT_20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, ...) _20 +# define Z_SELECT_21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, ...) _21 +# define Z_SELECT_22(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, ...) _22 +# define Z_SELECT_23(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, ...) _23 +# define Z_SELECT_24(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, ...) _24 +# define Z_SELECT_25(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, ...) _25 +# define Z_SELECT_26(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, ...) _26 +# define Z_SELECT_27(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, ...) _27 +# define Z_SELECT_28(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, ...) _28 +# define Z_SELECT_29(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, ...) _29 +# define Z_SELECT_30(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, ...) _30 +# define Z_SELECT_31(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, ...) _31 + +# define Z_SELECT(index, ...) Z_JOIN_2(Z_SELECT_, index)(__VA_ARGS__, Z_DUMMY) + +#endif + +#endif /* Z_macros_variadic_control_H */ diff --git a/projects/Zeta/API/Z/macros/variadic_pasting.h b/projects/Zeta/API/Z/macros/variadic_pasting.h new file mode 100644 index 0000000..2f90419 --- /dev/null +++ b/projects/Zeta/API/Z/macros/variadic_pasting.h @@ -0,0 +1,26 @@ +/* Zeta API - Z/macros/variadic_pasting.h (C99) + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_variadic_pasting_H +#define Z_macros_variadic_pasting_H + +#include + +#if !defined(Z_AVOID_VARIADIC_MACROS) && \ + (Z_DIALECT_HAS(C99, VARIADIC_MACRO) || Z_DIALECT_HAS(CPP11, C99_PREPROCESSOR)) + +# define Z_JOIN_N(n) \ + Z_PASTE_2(Z_JOIN_, n) /* Needed for Z_JOIN(...) only */ + +# define Z_JOIN(...) \ + Z_SAME(Z_JOIN_N(Z_ARGUMENT_COUNT_(__VA_ARGS__, L_PP_RSEQ_N()))) \ + (__VA_ARGS__) + +#endif + +#endif /* Z_macros_variadic_pasting_H */ diff --git a/projects/Zeta/API/Z/macros/version.h b/projects/Zeta/API/Z/macros/version.h new file mode 100644 index 0000000..202d65d --- /dev/null +++ b/projects/Zeta/API/Z/macros/version.h @@ -0,0 +1,24 @@ +/* Zeta API - Z/macros/version.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_macros_version_H +#define Z_macros_version_H + +#define Z_VERSION(major, minor, micro) \ + ((major) * 4194304UL + (minor) * 4096UL + (micro)) + +#define Z_VERSION_MAJOR(version) \ + ((version) / 4194304UL) + +#define Z_VERSION_MINOR(version) \ + (((version) % 4194304UL) / 4096UL) + +#define Z_VERSION_MICRO(version) \ + ((version) & 0xFFFUL) + +#endif /* Z_macros_version_H */ diff --git a/projects/Zeta/API/Z/protocols/network/7/HTTP.h b/projects/Zeta/API/Z/protocols/network/7/HTTP.h new file mode 100644 index 0000000..25662d4 --- /dev/null +++ b/projects/Zeta/API/Z/protocols/network/7/HTTP.h @@ -0,0 +1,101 @@ +/* Zeta API - Z/Z/protocols/network/7/HTTP.h + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_protocols_network_7_HTTP_H +#define Z_protocols_network_7_HTTP_H + +/* MARK: - Ports */ + +#define Z_HTTP_DEFAULT_SERVER_PORT 80 + +/* MARK: - Status: Informational */ + +#define Z_HTTP_STATUS_CONTINUE 100 +#define Z_HTTP_STATUS_SWITCHING_PROTOCOLS 101 +#define Z_HTTP_STATUS_PROCESSING 102 /* WebDAV, RFC 2518 */ + +/* MARK: - Status: Success */ + +#define Z_HTTP_STATUS_OK 200 +#define Z_HTTP_STATUS_CREATED 201 +#define Z_HTTP_STATUS_ACCEPTED 202 +#define Z_HTTP_STATUS_NON_AUTHORITATIVE_INFO 203 +#define Z_HTTP_STATUS_NO_CONTENT 204 +#define Z_HTTP_STATUS_RESET_CONTENT 205 +#define Z_HTTP_STATUS_PARTIAL_CONTENT 206 +#define Z_HTTP_STATUS_MULTI_STATUS 207 /* WebDAV, RFC 4918 */ +#define Z_HTTP_STATUS_ALREADY_REPORTED 208 /* WebDAV, RFC 5842 */ +#define Z_HTTP_STATUS_IM_USED 226 /* RFC 3229 */ + +/* MARK: - Status: Redirection */ + +#define Z_HTTP_STATUS_MULTIPLE_CHOICES 300 +#define Z_HTTP_STATUS_MOVED_PERMANENTLY 301 +#define Z_HTTP_STATUS_FOUND 302 +#define Z_HTTP_STATUS_SEE_OTHER 303 /* v1.1 */ +#define Z_HTTP_STATUS_NOT_MODIFIED 304 +#define Z_HTTP_STATUS_USE_PROXY 305 /* v1.1 */ +#define Z_HTTP_STATUS_SWITCH_PROXY 306 +#define Z_HTTP_STATUS_TEMPORARY_REDIRECT 307 /* v1.1 */ +#define Z_HTTP_STATUS_PERMANENT_REDIRECT 308 /* Experimental Internet draft */ + +/* MARK: - Status: Client error */ + +#define Z_HTTP_STATUS_BAD_REQUEST 400 +#define Z_HTTP_STATUS_UNAUTHORIZED 401 +#define Z_HTTP_STATUS_PAYMENT_REQUIRED 402 /* Reserved for future use by the forces of the dark side */ +#define Z_HTTP_STATUS_FORBIDDEN 403 +#define Z_HTTP_STATUS_NOT_FOUND 404 +#define Z_HTTP_STATUS_METHOD_NOT_ALLOWED 405 +#define Z_HTTP_STATUS_NOT_ACCEPTABLE 406 +#define Z_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED 407 +#define Z_HTTP_STATUS_REQUEST_TIME_OUT 408 +#define Z_HTTP_STATUS_CONFLICT 409 +#define Z_HTTP_STATUS_GONE 410 +#define Z_HTTP_STATUS_LENGTH_REQUIRED 411 +#define Z_HTTP_STATUS_PRECONDITION_FAILED 412 +#define Z_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE 413 +#define Z_HTTP_STATUS_REQUEST_URI_TOO_LONG 414 +#define Z_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE 415 +#define Z_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE 416 +#define Z_HTTP_STATUS_EXPECTATION_FAILED 417 +#define Z_HTTP_STATUS_I_AM_A_TEAPOT 418 /* RFC 2324 */ +#define Z_HTTP_STATUS_ENHANCE_YOUR_CALM 420 /* Twitter */ +#define Z_HTTP_STATUS_UNPROCESSABLE_ENTITY 422 /* WebDAV, RFC 4918 */ +#define Z_HTTP_STATUS_LOCKED 423 /* WebDAV, RFC 4918 */ +#define Z_HTTP_STATUS_FAILED_DEPENDENCY 424 /* WebDAV, RFC 4918 */ +#define Z_HTTP_STATUS_METHOD_FAILURE 424 /* WebDAV */ +#define Z_HTTP_STATUS_UNORDERED_COLLECTION 425 /* WebDAV Internet draft */ +#define Z_HTTP_STATUS_UPGRADE_REQUIRED 426 /* RFC 2817 */ +#define Z_HTTP_STATUS_PRECONDITION_REQUIRED 428 /* RFC 6585 */ +#define Z_HTTP_STATUS_TOO_MANY_REQUESTS 429 /* RFC 6585 */ +#define Z_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE 431 /* RFC 6585 */ +#define Z_HTTP_STATUS_NO_RESPONSE 444 /* Nginx */ +#define Z_HTTP_STATUS_RETRY_WITH 449 /* Microsoft */ +#define Z_HTTP_STATUS_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450 /* Microsoft */ +#define Z_HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS 451 /* Internet draft */ +#define Z_HTTP_STATUS_CLIENT_CLOSED_REQUEST 499 /* Nginx */ + +/* MARK: - Status: Server error */ + +#define Z_HTTP_STATUS_INTERNAL_SERVER_ERROR 500 +#define Z_HTTP_STATUS_NOT_IMPLEMENTED 501 +#define Z_HTTP_STATUS_BAD_GATEWAY 502 +#define Z_HTTP_STATUS_SERVICE_UNAVAILABLE 503 +#define Z_HTTP_STATUS_GATEWAY_TIME_OUT 504 +#define Z_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED 505 +#define Z_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES 506 /* RFC 2295 */ +#define Z_HTTP_STATUS_INSUFICIENT_STORAGE 507 /* WebDAV, RFC 4918 */ +#define Z_HTTP_STATUS_LOOP_DETECTED 508 /* WebDAV, RFC 5842 */ +#define Z_HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED 509 /* Apache bw/limited extension */ +#define Z_HTTP_STATUS_NOT_EXTENDED 510 /* RFC 2774 */ +#define Z_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED 511 /* RFC 6585 */ +#define Z_HTTP_STATUS_NETWORK_READ_TIME_OUT_ERROR 598 /* Microsoft HTTP proxies */ +#define Z_HTTP_STATUS_NETWORK_CONNECT_TIME_OUT_ERROR 599 /* Microsoft HTTP proxies */ + +#endif /* Z_protocols_network_7_HTTP_H */ diff --git a/projects/Zeta/API/Z/traits/TypeCount.hpp b/projects/Zeta/API/Z/traits/TypeCount.hpp new file mode 100644 index 0000000..5064485 --- /dev/null +++ b/projects/Zeta/API/Z/traits/TypeCount.hpp @@ -0,0 +1,48 @@ +/* Zeta API - Z/traits/TypeCount.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_traits_TypeCount_HPP +#define Z_traits_TypeCount_HPP + +#include + +#if Z_DIALECT_HAS(CPP11, VARIADIC_TEMPLATE) && \ + Z_DIALECT_HAS_OPERATOR_CASE(CPP11, SIZEOF, PARAMETER_PACK) + + namespace Zeta {template struct TypeCount { + enum {value = sizeof...(t)}; + };} + +#else +# include +# include + + namespace Zeta { + template < + class t00 = NaT, class t01 = NaT, class t02 = NaT, class t03 = NaT, + class t04 = NaT, class t05 = NaT, class t06 = NaT, class t07 = NaT, + class t08 = NaT, class t09 = NaT, class t10 = NaT, class t11 = NaT, + class t12 = NaT, class t13 = NaT, class t14 = NaT, class t15 = NaT, + class t16 = NaT, class t17 = NaT, class t18 = NaT, class t19 = NaT, + class t20 = NaT, class t21 = NaT, class t22 = NaT, class t23 = NaT, + class t24 = NaT, class t25 = NaT, class t26 = NaT, class t27 = NaT, + class t28 = NaT, class t29 = NaT, class t30 = NaT, class t31 = NaT + > struct TypeCount {}; + +# define Z_z_SPECIALIZATION(arity) \ + template \ + struct TypeCount { \ + enum {value = arity}; \ + }; + + Z_CALL_WITH_INDEX_FOR_32(Z_z_SPECIALIZATION, Z_EMPTY) +# undef Z_z_SPECIALIZATION + } +#endif + +#endif // Z_traits_TypeCount_HPP diff --git a/projects/Zeta/API/Z/traits/TypeList.hpp b/projects/Zeta/API/Z/traits/TypeList.hpp new file mode 100644 index 0000000..7b6193d --- /dev/null +++ b/projects/Zeta/API/Z/traits/TypeList.hpp @@ -0,0 +1,377 @@ +/* Zeta API - Z/traits/TypeList.hpp + ______ ______________ ___ +|__ / | ___|___ ___|/ \ + / /__| __| | | / - \ + /______|_____| |__| /__/ \__\ +Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. +Released under the terms of the GNU Lesser General Public License v3. */ + +#ifndef Z_traits_TypeList_HPP +#define Z_traits_TypeList_HPP + +#include + +#if Z_DIALECT_HAS(CPP11, EXTENDED_VARIADIC_TEMPLATE_TEMPLATE_PARAMETERS) +# include +# include + +# define Z_HAS_TypeList 1 +# define Z_HAS_TypeListSize 1 +# define Z_HAS_TypeListApply 1 +# define Z_HAS_TypeListAppend 1 +# define Z_HAS_TypeListFirst 1 +# define Z_HAS_TypeListGet 1 +# define Z_HAS_TypeListJoin 1 +# define Z_HAS_TypeListLast 1 +# define Z_HAS_TypeListPrepend 1 +# define Z_HAS_TypeListRename 1 +# define Z_HAS_TypeListRemove 1 +# define Z_HAS_TypeListRemoveFirst 1 +# define Z_HAS_TypeListRemoveHead 1 +# define Z_HAS_TypeListRemoveLast 1 +# define Z_HAS_TypeListRemoveTail 1 +# define Z_HAS_TypeListReverse 1 +# define Z_HAS_TypeListRotateLeft 1 +# define Z_HAS_TypeListRotateRight 1 +# define Z_HAS_TypeListToFunction 1 + +# if Z_DIALECT_HAS(CPP11, TYPE_ALIAS_TEMPLATE) +# define Z_HAS_TypeList_MEMBER_apply 1 +# define Z_HAS_TypeList_MEMBER_append 1 +# define Z_HAS_TypeList_MEMBER_get 1 +# define Z_HAS_TypeList_MEMBER_prepend 1 +# define Z_HAS_TypeList_MEMBER_remove 1 +# define Z_HAS_TypeList_MEMBER_remove_head 1 +# define Z_HAS_TypeList_MEMBER_remove_tail 1 +# define Z_HAS_TypeList_MEMBER_rename 1 +# define Z_HAS_TypeList_MEMBER_rotate_left 1 +# define Z_HAS_TypeList_MEMBER_rotate_right 1 +# define Z_HAS_TypeList_MEMBER_to_function 1 +# define Z_HAS_type_list_apply 1 +# define Z_HAS_type_list_append 1 +# define Z_HAS_type_list_first 1 +# define Z_HAS_type_list_get 1 +# define Z_HAS_type_list_last 1 +# define Z_HAS_type_list_prepend 1 +# define Z_HAS_type_list_remove 1 +# define Z_HAS_type_list_remove_first 1 +# define Z_HAS_type_list_remove_head 1 +# define Z_HAS_type_list_remove_last 1 +# define Z_HAS_type_list_remove_tail 1 +# define Z_HAS_type_list_rename 1 +# define Z_HAS_type_list_reverse 1 +# define Z_HAS_type_list_rotate_left 1 +# define Z_HAS_type_list_rotate_right 1 +# define Z_HAS_type_list_to_function 1 +# endif + +# if Z_DIALECT_HAS(CPP14, VARIABLE_TEMPLATE) && Z_DIALECT_HAS_SPECIFIER(CPP11, CONSTEXPR) +# define Z_HAS_type_list_size 1 +# endif + + namespace Zeta { + + template struct TypeListSize; + + template