diff options
| author | Amlal <amlal@zka.com> | 2024-07-21 09:47:44 +0200 |
|---|---|---|
| committer | Amlal <amlal@zka.com> | 2024-07-21 09:47:44 +0200 |
| commit | af93068ec107e8d8f5873399e86e4001cb1c6b40 (patch) | |
| tree | af9acd1b32140317eb066ec857e4eb44416804a3 | |
| parent | 13b84ff69d821029da3c2318a35a294d8045d7f9 (diff) | |
[RM] Examples/ added to gitignore, improved Ref class.
Signed-off-by: Amlal <amlal@zka.com>
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Examples/Example64k.s | 3 | ||||
| -rw-r--r-- | Examples/ExampleAMD64.asm | 6 | ||||
| -rw-r--r-- | Examples/ExampleAMD64_Return.asm | 6 | ||||
| -rw-r--r-- | Examples/ExampleCDialect.S | 14 | ||||
| -rw-r--r-- | Examples/ExampleCDialect.cc | 7 | ||||
| -rw-r--r-- | Examples/ExampleCPlusPlus.cxx | 12 | ||||
| -rw-r--r-- | Examples/ExampleCPlusPlus.s | 19 | ||||
| -rw-r--r-- | Examples/ExamplePowerPC.S | 8 | ||||
| -rw-r--r-- | Examples/ExamplePowerPC.S.pp | 11 | ||||
| -rw-r--r-- | Examples/ExamplePowerPC.dmp | 5 | ||||
| -rw-r--r-- | Headers/StdKit/Ref.hpp | 26 | ||||
| -rw-r--r-- | Sources/cplusplus.cxx | 9 | ||||
| -rw-r--r-- | codetools.10x | 48 | ||||
| -rw-r--r-- | codetools.cflags | 1 | ||||
| -rw-r--r-- | codetools.config | 2 | ||||
| -rw-r--r-- | codetools.creator | 1 | ||||
| -rw-r--r-- | codetools.cxxflags | 1 | ||||
| -rw-r--r-- | codetools.files | 61 | ||||
| -rw-r--r-- | codetools.includes | 2 |
20 files changed, 23 insertions, 221 deletions
@@ -10,6 +10,8 @@ local.properties *.creator.user +Examples/ + # NewOS/MP-UX executable *.exec *.bin diff --git a/Examples/Example64k.s b/Examples/Example64k.s deleted file mode 100644 index b56003a..0000000 --- a/Examples/Example64k.s +++ /dev/null @@ -1,3 +0,0 @@ -mv r0, r3 -lda r19, 0x10000 -jlr diff --git a/Examples/ExampleAMD64.asm b/Examples/ExampleAMD64.asm deleted file mode 100644 index 781934c..0000000 --- a/Examples/ExampleAMD64.asm +++ /dev/null @@ -1,6 +0,0 @@ -#bits 64 - -export .code64 __ImageStart - -mov rax, 17 -ret diff --git a/Examples/ExampleAMD64_Return.asm b/Examples/ExampleAMD64_Return.asm deleted file mode 100644 index 0ecbaf7..0000000 --- a/Examples/ExampleAMD64_Return.asm +++ /dev/null @@ -1,6 +0,0 @@ -#bits 64 - -export .code64 __RaiseInterrupt - -int 13 -ret diff --git a/Examples/ExampleCDialect.S b/Examples/ExampleCDialect.S deleted file mode 100644 index c657cbb..0000000 --- a/Examples/ExampleCDialect.S +++ /dev/null @@ -1,14 +0,0 @@ -; Path: Examples/ExampleCDialect.cxx -; Language: NDK assembly. (Generated from C++) -; Date: 2024-5-14 - -#bits 64 - -#org 0x1000000 - -export .code64 __MPCC_int___ImageStart -mov r8, 0 - -mov r9, 36 -mov rax, r8 -ret diff --git a/Examples/ExampleCDialect.cc b/Examples/ExampleCDialect.cc deleted file mode 100644 index b55dd5f..0000000 --- a/Examples/ExampleCDialect.cc +++ /dev/null @@ -1,7 +0,0 @@ -int __ImageStart(int argc, char const* argv[]) -{ - int *foo; - *foo = 36; - - return *foo; -} diff --git a/Examples/ExampleCPlusPlus.cxx b/Examples/ExampleCPlusPlus.cxx deleted file mode 100644 index 3335e1e..0000000 --- a/Examples/ExampleCPlusPlus.cxx +++ /dev/null @@ -1,12 +0,0 @@ -int main(int argc, char const* argv[]) -{ - { - bool bar = false; - bar = 1; - - bool bar2 = bar; - bar2 = false; - } - - return 0; -} diff --git a/Examples/ExampleCPlusPlus.s b/Examples/ExampleCPlusPlus.s deleted file mode 100644 index 7522eca..0000000 --- a/Examples/ExampleCPlusPlus.s +++ /dev/null @@ -1,19 +0,0 @@ -; Path: Examples/ExampleCPlusPlus.cxx -; Language: NDK assembly. (Generated from C++) -; Date: 2024-5-14 - -#bits 64 - -#org 0x1000000 - -export .code64 __MPCC_int_main -mov r8, 0 -mov r9, 0 - -mov r10, 1 -mov r10, r8 -mov r11, 0 - -mov r12, 0 -mov rax, 0 -ret diff --git a/Examples/ExamplePowerPC.S b/Examples/ExamplePowerPC.S deleted file mode 100644 index b9de796..0000000 --- a/Examples/ExamplePowerPC.S +++ /dev/null @@ -1,8 +0,0 @@ -; you you can never say! - -b 0x1000 -mflr r21 -mtlr r21 -li r3, 0 -cmpw r10, r11 -stw r7, r5+36 diff --git a/Examples/ExamplePowerPC.S.pp b/Examples/ExamplePowerPC.S.pp deleted file mode 100644 index 5eeb07f..0000000 --- a/Examples/ExamplePowerPC.S.pp +++ /dev/null @@ -1,11 +0,0 @@ -# Path: Examples/ExamplePowerPC.S.pp -# Language: POWER Assembly -# Build Date: 2024-6-4 - -bl 0x1000 - - -li r1, 0x500 -mr r2, r1 -sc -blr diff --git a/Examples/ExamplePowerPC.dmp b/Examples/ExamplePowerPC.dmp deleted file mode 100644 index 5986d03..0000000 --- a/Examples/ExamplePowerPC.dmp +++ /dev/null @@ -1,5 +0,0 @@ -0x0000000000000000: 00 10 00 48 b 0x1000 -0x0000000000000004: 00 05 20 38 li r1, 0x500 -0x0000000000000008: 78 13 21 7C or r1, r1, r2 -0x000000000000000c: 02 00 00 44 sc -0x0000000000000010: 20 00 80 4E blr
\ No newline at end of file diff --git a/Headers/StdKit/Ref.hpp b/Headers/StdKit/Ref.hpp index e655ccb..0f9c0e3 100644 --- a/Headers/StdKit/Ref.hpp +++ b/Headers/StdKit/Ref.hpp @@ -12,18 +12,25 @@ namespace CompilerKit { - // @author ZKA Technologies - // @brief Reference class, refers to a pointer of data in static memory. + // @author Amlal + // @brief Reference holder class, refers to a pointer of data in static memory. template <typename T> class Ref final { public: explicit Ref() = default; - ~Ref() = default; + + ~Ref() + { + if (m_Strong) + { + (*m_Class).~T(); + } + } public: explicit Ref(T cls, const bool& strong = false) - : m_Class(cls), m_Strong(strong) + : m_Class(&cls), m_Strong(strong) { } @@ -41,12 +48,12 @@ namespace CompilerKit T& Leak() { - return m_Class; + return *m_Class; } T operator*() { - return m_Class; + return *m_Class; } bool IsStrong() const @@ -56,11 +63,11 @@ namespace CompilerKit operator bool() { - return m_Class; + return *m_Class; } private: - T m_Class; + T* m_Class; bool m_Strong{false}; }; @@ -68,8 +75,7 @@ namespace CompilerKit class NonNullRef final { public: - NonNullRef() = delete; - NonNullRef(nullPtr) = delete; + explicit NonNullRef() = delete; explicit NonNullRef(T* ref) : m_Ref(ref, true) diff --git a/Sources/cplusplus.cxx b/Sources/cplusplus.cxx index e1044b9..5b5b8bc 100644 --- a/Sources/cplusplus.cxx +++ b/Sources/cplusplus.cxx @@ -9,10 +9,13 @@ /// bugs: 0 +#include "StdKit/Ref.hpp" #define __PK_USE_STRUCT_INSTEAD__ 1 #define kPrintF printf +#define kOk (0) + #define kSplashCxx() \ kPrintF(kWhite "%s\n", "Zeta C++ Compiler Driver, (c) 2024 Zeta Electronics, all rights reserved.") @@ -20,8 +23,8 @@ kPrintF(kWhite "%s\n", "Zeta C++ Compiler Driver, (c) 2024 Zeta Electronics, all #include <Headers/AsmKit/CPU/amd64.hpp> #include <Headers/ParserKit.hpp> -#include <cstdio> #include <filesystem> +#include <cstdio> #include <fstream> #include <iostream> #include <memory> @@ -30,10 +33,8 @@ kPrintF(kWhite "%s\n", "Zeta C++ Compiler Driver, (c) 2024 Zeta Electronics, all #include <vector> #include <UUID.hpp> -#define kOk 0 - /* ZKA Technologies C++ driver */ -/* This is part of ZECC C++ compiler. */ +/* This is part of NDK. */ /* (c) ZKA Technologies */ /// @author Amlal El Mahrouss (amlel) diff --git a/codetools.10x b/codetools.10x deleted file mode 100644 index 2961860..0000000 --- a/codetools.10x +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<N10X> - <Workspace> - <IncludeFilter>*.c,*.cc,*.cpp,*.c++,*.cp,*.cxx,*.h,*.hh,*.hpp,*.h++,*.hp,*.hxx,*.inl,*.cs,*.rs,*.java,*.jav,*.js,*.jsc,*.jsx,*.json,*.cls,*.py,*.rpy,*.php,*.php3,*.phl,*.phtml,*.rhtml,*.tpl,*.phps,*.lua,*.html,*.html5,*.htm,*.xml,*.xaml,*.css,*.ssi,*.haml,*.yaml,*.bat,*.wbf,*.wbt,*.txt,*.cmake,*.make,*.makefile,*.mak,*.mk,*.sh,*.bash,*.csv,*.asp,*.pl,*.mac,*.ws,*.vbs,*.perl,*.src,*.rss,*.inc,*.f,*.go,*.prl,*.plx,*.rb,*.lsp,*.lpx,*.ps1,*.command,*.cbl,*.cob,*.qs,*.wxs,*.ph,*.msc,*.glsl,*.hlsl,*.fx,*.vert,*.tesc,*.tese,*.geom,*.frag,*.comp,*.pssl,*.scons,*.cu,*.jai,</IncludeFilter> - <ExcludeFilter></ExcludeFilter> - <SyncFiles>true</SyncFiles> - <Recursive>true</Recursive> - <ShowEmptyFolders>true</ShowEmptyFolders> - <IncludeFilesWithoutExt>false</IncludeFilesWithoutExt> - <IsVirtual>false</IsVirtual> - <IsFolder>false</IsFolder> - <BuildCommand></BuildCommand> - <RebuildCommand></RebuildCommand> - <BuildFileCommand></BuildFileCommand> - <CleanCommand></CleanCommand> - <BuildWorkingDirectory></BuildWorkingDirectory> - <CancelBuild></CancelBuild> - <RunCommand></RunCommand> - <RunCommandWorkingDirectory></RunCommandWorkingDirectory> - <DebugCommand></DebugCommand> - <DebugArguments></DebugArguments> - <ExePathCommand></ExePathCommand> - <DebugSln></DebugSln> - <UseVisualStudioEnvBat>false</UseVisualStudioEnvBat> - <Configurations> - <Configuration>Debug</Configuration> - <Configuration>Release</Configuration> - </Configurations> - <Platforms> - <Platform>x64</Platform> - <Platform>Win32</Platform> - </Platforms> - <AdditionalIncludePaths> - <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt</AdditionalIncludePath> - <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um</AdditionalIncludePath> - </AdditionalIncludePaths> - <Defines></Defines> - <ConfigProperties></ConfigProperties> - <Children></Children> - </Workspace> -</N10X> diff --git a/codetools.cflags b/codetools.cflags deleted file mode 100644 index 68d5165..0000000 --- a/codetools.cflags +++ /dev/null @@ -1 +0,0 @@ --std=c17
\ No newline at end of file diff --git a/codetools.config b/codetools.config deleted file mode 100644 index e0284f4..0000000 --- a/codetools.config +++ /dev/null @@ -1,2 +0,0 @@ -// Add predefined macros for your project here. For example: -// #define THE_ANSWER 42 diff --git a/codetools.creator b/codetools.creator deleted file mode 100644 index e94cbbd..0000000 --- a/codetools.creator +++ /dev/null @@ -1 +0,0 @@ -[General] diff --git a/codetools.cxxflags b/codetools.cxxflags deleted file mode 100644 index e23b2ae..0000000 --- a/codetools.cxxflags +++ /dev/null @@ -1 +0,0 @@ --std=c++20 diff --git a/codetools.files b/codetools.files deleted file mode 100644 index d895485..0000000 --- a/codetools.files +++ /dev/null @@ -1,61 +0,0 @@ -.clang-format -Headers/AsmKit/AsmKit.hpp -Headers/AsmKit/CPU/32x0.hpp -Headers/AsmKit/CPU/64x0.hpp -Headers/AsmKit/CPU/amd64.hpp -Headers/AsmKit/CPU/arm64.hpp -Headers/AsmKit/CPU/ppc.hpp -Headers/Macros.hpp -Headers/Defines.hpp -Headers/ParserKit.hpp -Headers/Public/SDK/CRT/__mpcc_alloca.hxx -Headers/Public/SDK/CRT/__mpcc_defines.hxx -Headers/Public/SDK/CRT/__mpcc_exception.hxx -Headers/Public/SDK/CRT/__mpcc_hint.hxx -Headers/Public/SDK/CRT/__mpcc_malloc.hxx -Headers/Public/SDK/CRT/__mpcc_power.inc -Headers/StdKit/AE.hpp -Headers/StdKit/ELF.hpp -Headers/StdKit/ErrorID.hpp -Headers/StdKit/ErrorOr.hpp -Headers/StdKit/PEF.hpp -Headers/StdKit/Ref.hpp -Headers/StdKit/String.hpp -Headers/StdKit/XCOFF.hxx -Headers/UUID.hpp -Headers/Version.hxx -Doc/asm-specs.txt -Doc/havp.txt -Doc/notice.txt -Doc/vnrp.txt -Doxyfile -Examples/Example64k.s -Examples/ExampleAMD64.asm -Examples/ExampleAMD64_Return.asm -Examples/ExampleCDialect.S -Examples/ExampleCDialect.cxx -Examples/ExampleCPlusPlus.cxx -Examples/ExampleCPlusPlus.s -Examples/ExamplePowerPC.S -MailMap -ReadMe.md -Sources/32asm.cxx -Sources/64asm.cxx -Sources/64x0-cc.cxx -Sources/AssemblyFactory.cxx -Sources/Detail/ReadMe.md -Sources/Detail/asmutils.hxx -Sources/Detail/compilerutils.hxx -Sources/String.cxx -Sources/bpp.cxx -Sources/coff2ae.cxx -Sources/compile_flags.txt -Sources/cplusplus.cxx -Sources/elf2ae.cxx -Sources/i64asm.cxx -Sources/link.cxx -Sources/power-cc.cxx -Sources/ppcasm.cxx -posix.make -run_format.sh -win64.make diff --git a/codetools.includes b/codetools.includes deleted file mode 100644 index cb0237d..0000000 --- a/codetools.includes +++ /dev/null @@ -1,2 +0,0 @@ -./Headers -./ |
