diff options
| -rw-r--r-- | dev/comm/xpcom_sms.idl (renamed from dev/sci/xpcom_sms.idl) | 5 | ||||
| -rw-r--r-- | dev/crt/ReadMe.md | 2 | ||||
| -rw-r--r-- | dev/crt/__ndk_new_delete.hxx | 28 | ||||
| -rw-r--r-- | dev/crt/alloca.hxx (renamed from dev/crt/__ndk_alloca.hxx) | 2 | ||||
| -rw-r--r-- | dev/crt/base_alloc.hxx | 49 | ||||
| -rw-r--r-- | dev/crt/base_exception.hxx (renamed from dev/crt/__ndk_exception.hxx) | 2 | ||||
| -rw-r--r-- | dev/crt/crt.json | 4 | ||||
| -rw-r--r-- | dev/crt/defines.hxx (renamed from dev/crt/__ndk_defines.hxx) | 3 | ||||
| -rw-r--r-- | dev/crt/math.hxx | 34 | ||||
| -rw-r--r-- | dev/crt/src/__ndk_runtime.cxx | 12 | ||||
| -rw-r--r-- | dev/crt/src/crt_lib.cxx | 13 | ||||
| -rw-r--r-- | dev/ddk/ddk.h (renamed from dev/ddk/KernelStd.h) | 0 | ||||
| -rw-r--r-- | dev/ddk/dev.h (renamed from dev/ddk/KernelDev.h) | 2 | ||||
| -rw-r--r-- | dev/ddk/io.h (renamed from dev/ddk/KernelPrint.h) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_alloc.c (renamed from dev/ddk/src/KernelAlloc.c) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_dev.c (renamed from dev/ddk/src/KernelDev.c) | 4 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_io.c (renamed from dev/ddk/src/KernelPrint.c) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_kernel_call.c (renamed from dev/ddk/src/KernelCall.c) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_kernel_call_dispatch.S (renamed from dev/ddk/src/KernelCallDispatch.S) | 0 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_rt_cxx.cxx (renamed from dev/ddk/src/KernelCxxRt.cxx) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_str.c (renamed from dev/ddk/src/KernelString.c) | 2 | ||||
| -rw-r--r-- | dev/ddk/src/ddk_ver.c (renamed from dev/ddk/src/KernelVersion.c) | 2 | ||||
| -rw-r--r-- | dev/ddk/str.h (renamed from dev/ddk/KernelString.h) | 2 | ||||
| -rw-r--r-- | dev/sci/makefile | 2 | ||||
| -rw-r--r-- | dev/sci/sci.json | 2 | ||||
| -rw-r--r-- | dev/sci/source_deploy.xml | 3 | ||||
| -rw-r--r-- | dev/zba/amd64-efi.make | 4 | ||||
| -rw-r--r-- | meta/sdk_install.iss | 13 | ||||
| -rw-r--r-- | meta/zka_licensing.rtf (renamed from meta/LICENSE.rtf) | 0 |
29 files changed, 109 insertions, 91 deletions
diff --git a/dev/sci/xpcom_sms.idl b/dev/comm/xpcom_sms.idl index ae37d285..27736153 100644 --- a/dev/sci/xpcom_sms.idl +++ b/dev/comm/xpcom_sms.idl @@ -2,13 +2,10 @@ Copyright ZKA Technologies.
-File: rt.internal.inl
-Purpose: Base code of XPCOM.
+Purpose: SMS XPCOM interface
------------------------------------------- */
-/// @internal
-
#ifndef __NDK__
#define object class
#define protocol class
diff --git a/dev/crt/ReadMe.md b/dev/crt/ReadMe.md index c90f5b5f..4f8ad4f5 100644 --- a/dev/crt/ReadMe.md +++ b/dev/crt/ReadMe.md @@ -1,4 +1,4 @@ -# ZKA C++ RunTime.
+# ZKA C++ RunTime Kit.
This is the public interface of ZKA' C++ RunTime.
diff --git a/dev/crt/__ndk_new_delete.hxx b/dev/crt/__ndk_new_delete.hxx deleted file mode 100644 index fad61aa9..00000000 --- a/dev/crt/__ndk_new_delete.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include <crt/__ndk_defines.hxx> - -namespace stdx -{ - /// @brief allocate a new class. - /// @tparam KindClass the class type to allocate. - template <typename KindClass, typename... Args> - inline void* allocate(Args&&... args) - { - return new KindClass(forward(args)...); - } - - /// @brief free a class. - /// @tparam KindClass the class type to allocate. - template <typename KindClass> - inline void release(KindClass ptr) - { - delete ptr; - } -} // namespace stdx diff --git a/dev/crt/__ndk_alloca.hxx b/dev/crt/alloca.hxx index 3c796bf2..fedcb25d 100644 --- a/dev/crt/__ndk_alloca.hxx +++ b/dev/crt/alloca.hxx @@ -2,7 +2,7 @@ Copyright ZKA Technologies. - File: __ndk_alloca.hxx + File: alloca.hxx Purpose: Stack allocation functions. ------------------------------------------- */ diff --git a/dev/crt/base_alloc.hxx b/dev/crt/base_alloc.hxx new file mode 100644 index 00000000..de157866 --- /dev/null +++ b/dev/crt/base_alloc.hxx @@ -0,0 +1,49 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <crt/defines.hxx> + +namespace std::base_alloc +{ + /// @brief allocate a new class. + /// @tparam KindClass the class type to allocate. + template <typename KindClass, typename... Args> + inline KindClass* allocate(Args&&... args) + { + return new KindClass(forward(args)...); + } + + /// @brief allocate a new class. + /// @note aborts on error. + /// @tparam KindClass the class type to allocate. + template <typename KindClass, typename... Args> + inline KindClass* allocate_nothrow(Args&&... args) noexcept + { + return allocate(forward(args)...); + } + + /// @brief free a class. + /// @tparam KindClass the class type to allocate. + template <typename KindClass> + inline void release(KindClass ptr) + { + if (!ptr) + return; + + delete ptr; + } + + /// @brief destroy and free a class. + /// @note aborts on error. + /// @tparam KindClass the class type to allocate. + template <typename KindClass> + inline void release_nothrow(KindClass ptr) noexcept + { + release(ptr); + } +} // namespace std::base_alloc diff --git a/dev/crt/__ndk_exception.hxx b/dev/crt/base_exception.hxx index 67735a9d..9d3fd208 100644 --- a/dev/crt/__ndk_exception.hxx +++ b/dev/crt/base_exception.hxx @@ -6,7 +6,7 @@ #pragma once -#include <crt/__ndk_defines.hxx> +#include <crt/defines.hxx> /// @brief CRT exit, with exit code (!!! exits all threads. !!!) /// @param code diff --git a/dev/crt/crt.json b/dev/crt/crt.json index dbca05fa..07368550 100644 --- a/dev/crt/crt.json +++ b/dev/crt/crt.json @@ -3,13 +3,13 @@ "compiler_std": "c++20", "headers_path": ["../", "./"], "sources_path": ["src/*.cxx"], - "output_name": "ndkcrt.dll", + "output_name": "zka-crt-cxx.dll", "compiler_flags": [ "-ffreestanding", "-shared", "-fno-rtti", "-fno-exceptions", - " -Wl,--subsystem=17" + "-Wl,--subsystem=17" ], "cpp_macros": [ "__CRT_AMD64__", diff --git a/dev/crt/__ndk_defines.hxx b/dev/crt/defines.hxx index bea3f67c..11a76ded 100644 --- a/dev/crt/__ndk_defines.hxx +++ b/dev/crt/defines.hxx @@ -7,6 +7,9 @@ #ifndef __NDK_DEFINES_HXX__ #define __NDK_DEFINES_HXX__ +#include <stdint.h> +#include <stddef.h> + #ifndef __GNUC__ typedef __SIZE_TYPE__ size_t; diff --git a/dev/crt/math.hxx b/dev/crt/math.hxx index 5f55b430..56bb1236 100644 --- a/dev/crt/math.hxx +++ b/dev/crt/math.hxx @@ -6,24 +6,22 @@ #pragma once -#include <NewKit/Defines.hxx> +#include <crt/defines.hxx> /// @file Math.hxx /// @brief Math functions. -namespace CRT -{ - using namespace Kernel; - #ifdef __ZKA_USE_DOUBLE__ - typedef double Real; +typedef double real_type; #else - typedef float Real; +typedef float real_type; #endif +namespace std::math +{ /// @brief Power function, with Repeat argument. - template <SizeT Exponent> - inline Real Pow(Real in) + template <size_t Exponent> + inline real_type pow(real_type in) { if (Exponent == 0) return 1; // Any number to the power of 0 is 1. @@ -31,11 +29,11 @@ namespace CRT if (Exponent == 1) return in; // Any number to the power of 1 is itself. - UInt64 cnt = Exponent; + size_t cnt = Exponent; - Real result = 1; + real_type result = 1; - for (auto i = 0; i < (cnt); ++i) + for (auto i = 0; i < cnt; ++i) result *= in; return result; @@ -43,22 +41,22 @@ namespace CRT /// @brief Square of function, with Base template argument. /// @param of Base argument to find sqquare of - template <SizeT Base> - inline Real SqrOf(Real in) + template <size_t Base> + inline real_type sqr(real_type in) { if (in == 0) return 0; - return Pow<1 / Base>(in); + return pow<1 / Base>(in); } /// @brief Linear interpolation equation solver. /// @param from where? /// @param to to? /// @param Updated diff value according to difference. - inline Real CGLerp(Real to, Real from, Real stat) + inline real_type lerp(real_type to, real_type from, real_type stat) { - Real diff = (to - from); + real_type diff = (to - from); return from + (diff * stat); } -} // namespace CRT +} // namespace std::math diff --git a/dev/crt/src/__ndk_runtime.cxx b/dev/crt/src/__ndk_runtime.cxx deleted file mode 100644 index b81963a8..00000000 --- a/dev/crt/src/__ndk_runtime.cxx +++ /dev/null @@ -1,12 +0,0 @@ -/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
-------------------------------------------- */
-
-#include <crt/__ndk_alloca.hxx>
-#include <crt/__ndk_defines.hxx>
-#include <crt/__ndk_exception.hxx>
-#include <crt/__ndk_new_delete.hxx>
-
-/// @note No sources needed for now.
diff --git a/dev/crt/src/crt_lib.cxx b/dev/crt/src/crt_lib.cxx new file mode 100644 index 00000000..530e40db --- /dev/null +++ b/dev/crt/src/crt_lib.cxx @@ -0,0 +1,13 @@ +/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#include <crt/alloca.hxx>
+#include <crt/defines.hxx>
+#include <crt/base_exception.hxx>
+#include <crt/math.hxx>
+#include <crt/base_alloc.hxx>
+
+/// @note Just here for building.
diff --git a/dev/ddk/KernelStd.h b/dev/ddk/ddk.h index 89fe786d..89fe786d 100644 --- a/dev/ddk/KernelStd.h +++ b/dev/ddk/ddk.h diff --git a/dev/ddk/KernelDev.h b/dev/ddk/dev.h index b7dce834..2a3aeb18 100644 --- a/dev/ddk/KernelDev.h +++ b/dev/ddk/dev.h @@ -8,7 +8,7 @@ #pragma once -#include <ddk/KernelStd.h> +#include <ddk/ddk.h> struct _KERNEL_DEVICE; diff --git a/dev/ddk/KernelPrint.h b/dev/ddk/io.h index 6ab6118e..ece8d059 100644 --- a/dev/ddk/KernelPrint.h +++ b/dev/ddk/io.h @@ -8,7 +8,7 @@ #pragma once -#include <ddk/KernelString.h> +#include <ddk/str.h> /// @brief print character into UART. DK_EXTERN void KernelPrintChar(const char ch); diff --git a/dev/ddk/src/KernelAlloc.c b/dev/ddk/src/ddk_alloc.c index af99f23b..3c379bf7 100644 --- a/dev/ddk/src/KernelAlloc.c +++ b/dev/ddk/src/ddk_alloc.c @@ -6,7 +6,7 @@ ------------------------------------------- */ -#include <ddk/KernelStd.h> +#include <ddk/ddk.h> /** \brief Allocates a new heap on the Kernel's side. diff --git a/dev/ddk/src/KernelDev.c b/dev/ddk/src/ddk_dev.c index 3cf7ed48..19dd3f55 100644 --- a/dev/ddk/src/KernelDev.c +++ b/dev/ddk/src/ddk_dev.c @@ -6,8 +6,8 @@ ------------------------------------------- */ -#include <ddk/KernelDev.h> -#include <ddk/KernelString.h> +#include <ddk/dev.h> +#include <ddk/str.h> /// @brief Open a new binary device from path. DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath) diff --git a/dev/ddk/src/KernelPrint.c b/dev/ddk/src/ddk_io.c index 7f8c8604..de39ea48 100644 --- a/dev/ddk/src/KernelPrint.c +++ b/dev/ddk/src/ddk_io.c @@ -6,7 +6,7 @@ ------------------------------------------- */ -#include <ddk/KernelPrint.h> +#include <ddk/io.h> DK_EXTERN void KernelPrintChar(const char ch) { diff --git a/dev/ddk/src/KernelCall.c b/dev/ddk/src/ddk_kernel_call.c index ccb401af..d768cb09 100644 --- a/dev/ddk/src/KernelCall.c +++ b/dev/ddk/src/ddk_kernel_call.c @@ -6,7 +6,7 @@ ------------------------------------------- */ -#include <ddk/KernelStd.h> +#include <ddk/ddk.h> #include <stdarg.h> /// @brief this is an internal call, do not use it. diff --git a/dev/ddk/src/KernelCallDispatch.S b/dev/ddk/src/ddk_kernel_call_dispatch.S index 3a9a57b5..3a9a57b5 100644 --- a/dev/ddk/src/KernelCallDispatch.S +++ b/dev/ddk/src/ddk_kernel_call_dispatch.S diff --git a/dev/ddk/src/KernelCxxRt.cxx b/dev/ddk/src/ddk_rt_cxx.cxx index 947e2de7..4d5f2563 100644 --- a/dev/ddk/src/KernelCxxRt.cxx +++ b/dev/ddk/src/ddk_rt_cxx.cxx @@ -6,7 +6,7 @@ ------------------------------------------- */ -#include <ddk/KernelStd.h> +#include <ddk/ddk.h> void* operator new(size_t sz) { diff --git a/dev/ddk/src/KernelString.c b/dev/ddk/src/ddk_str.c index 0030aa02..2969a9e2 100644 --- a/dev/ddk/src/KernelString.c +++ b/dev/ddk/src/ddk_str.c @@ -6,7 +6,7 @@ ------------------------------------------- */ -#include <ddk/KernelString.h> +#include <ddk/str.h> DK_EXTERN size_t KernelStringLength(const char* in) { diff --git a/dev/ddk/src/KernelVersion.c b/dev/ddk/src/ddk_ver.c index c40e8ff9..ff27634d 100644 --- a/dev/ddk/src/KernelVersion.c +++ b/dev/ddk/src/ddk_ver.c @@ -6,7 +6,7 @@ ------------------------------------------- */
-#include <KernelStd.h>
+#include <ddk/ddk.h>
#ifndef cDDKVersionHighest
#define cDDKVersionHighest 1
diff --git a/dev/ddk/KernelString.h b/dev/ddk/str.h index 01d7d919..0b9bde21 100644 --- a/dev/ddk/KernelString.h +++ b/dev/ddk/str.h @@ -8,7 +8,7 @@ #pragma once -#include <ddk/KernelStd.h> +#include <ddk/ddk.h> /// @brief DDK equivalent of POSIX's string.h /// @file KernelString.h diff --git a/dev/sci/makefile b/dev/sci/makefile index 05593216..c66d7a78 100644 --- a/dev/sci/makefile +++ b/dev/sci/makefile @@ -5,7 +5,7 @@ CC=g++
FLAGS=-I../ -shared -fPIC -D__ZKA_SYMS__
-OUTPUT=sci.dll
+OUTPUT=zka-sci-cxx.dll
.PHONY: build-sci
build-sci:
diff --git a/dev/sci/sci.json b/dev/sci/sci.json index 32a9238b..0b7c6bb7 100644 --- a/dev/sci/sci.json +++ b/dev/sci/sci.json @@ -3,7 +3,7 @@ "compiler_std": "c++20", "headers_path": ["../"], "sources_path": ["src/*.cxx"], - "output_name": "sci.dll", + "output_name": "zka-sci-cxx.dll", "compiler_flags": [ "-fPIC", "-ffreestanding", diff --git a/dev/sci/source_deploy.xml b/dev/sci/source_deploy.xml index a392015c..fda225db 100644 --- a/dev/sci/source_deploy.xml +++ b/dev/sci/source_deploy.xml @@ -1,9 +1,6 @@ <SourceDeploy>
<HiddenFiles>
- <SourceFile>src/*.cxx</SourceFile>
- <SourceFile>*.drawio</SourceFile>
<SourceFile>*.hxx</SourceFile>
- <SourceFile>*.inl</SourceFile>
<SourceFile>*.idl</SourceFile>
</HiddenFiles>
</SourceDeploy>
diff --git a/dev/zba/amd64-efi.make b/dev/zba/amd64-efi.make index 1dee6a1d..49008035 100644 --- a/dev/zba/amd64-efi.make +++ b/dev/zba/amd64-efi.make @@ -54,8 +54,8 @@ FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mno-red-zone -D__NEWOSKRNL__ -D__NEWOSL BOOT_LOADER=newosldr.exe KERNEL=newoskrnl.exe DDK=ddk.dll -SCI=sci.dll -CRT=ndkcrt.dll +SCI=zka-sci-cxx.dll +CRT=zka-crt-cxx.dll SYS_CHK=syschk.sys STARTUP=startup.sys diff --git a/meta/sdk_install.iss b/meta/sdk_install.iss index 789bf29e..a22447bb 100644 --- a/meta/sdk_install.iss +++ b/meta/sdk_install.iss @@ -1,7 +1,7 @@ ; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
-#define ZkaAppName "ZKA OS C++ Headers."
+#define ZkaAppName "ZKA OS C/C++ and XPCOM Headers."
#define ZkaAppVersion "1.00"
#define ZkaAppPublisher "ZKA Software B.V"
#define ZkaAppURL "https://www.zka-software.com/"
@@ -19,7 +19,7 @@ AppSupportURL={#ZkaAppURL} AppUpdatesURL={#ZkaAppURL}
DefaultDirName={autopf}\{#ZkaAppName}
DefaultGroupName=ZKA OS Headers
-LicenseFile=.\LICENSE.rtf
+LicenseFile=.\zka_licensing.rtf
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
OutputBaseFilename=zka-sdk
@@ -33,11 +33,12 @@ SetupIconFile=.\setup.ico Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
-Source: "..\dev\sci\*.hxx"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
-Source: "..\dev\crt\*.hxx"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "..\dev\sci\*.hxx"; DestDir: "{app}\sci"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "..\dev\crt\*.hxx"; DestDir: "{app}\crt"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "..\dev\comm\*.idl"; DestDir: "{app}\comm"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
-
+
[Files]
Source: ".\background.bmp"; Flags: dontcopy
@@ -56,4 +57,4 @@ begin BackgroundImage.Stretch := True;
ExtractTemporaryFile('background.bmp');
BackgroundImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\background.bmp'));
-end;
\ No newline at end of file +end;
diff --git a/meta/LICENSE.rtf b/meta/zka_licensing.rtf index 4ca3b7d2..4ca3b7d2 100644 --- a/meta/LICENSE.rtf +++ b/meta/zka_licensing.rtf |
