diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/CompilerKit/Detail/Config.h | 5 | ||||
| -rw-r--r-- | include/CompilerKit/Detail/PreConfig.h | 3 | ||||
| -rw-r--r-- | include/CompilerKit/MachO.h | 4 | ||||
| -rw-r--r-- | include/CompilerKit/UUID.h | 2 | ||||
| -rw-r--r-- | include/CompilerKit/Utilities/Compiler.h | 2 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/abi/abi.hpp (renamed from include/CoreRuntimeKit/C++/__abi) | 5 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/abi/new.hpp (renamed from include/CoreRuntimeKit/C++/new) | 2 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/core/base_alloc.hpp (renamed from include/CoreRuntimeKit/C++/base_alloc) | 2 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/core/base_exception.hpp (renamed from include/CoreRuntimeKit/C++/base_exception) | 2 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/core/base_math.hpp (renamed from include/CoreRuntimeKit/C++/base_math) | 0 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/core/base_process.hpp (renamed from include/CoreRuntimeKit/C++/base_process) | 8 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/defines.hpp (renamed from include/CoreRuntimeKit/C++/defines) | 0 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/filesystem/filesystem.hpp (renamed from include/CoreRuntimeKit/C++/filesystem) | 0 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/C++/utility.hpp (renamed from include/CoreRuntimeKit/C++/utility) | 0 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/Nectar/exports.hpp (renamed from include/CoreRuntimeKit/Nectar/ncl_exports.h) | 8 | ||||
| -rw-r--r-- | include/CoreRuntimeKit/README.md | 8 | ||||
| -rw-r--r-- | include/GenericsLibrary/std.nhh | 7 | ||||
| -rw-r--r-- | include/ThirdParty/Dialogs/Dialogs.h | 43 |
18 files changed, 59 insertions, 42 deletions
diff --git a/include/CompilerKit/Detail/Config.h b/include/CompilerKit/Detail/Config.h index 651904e..14d4fd0 100644 --- a/include/CompilerKit/Detail/Config.h +++ b/include/CompilerKit/Detail/Config.h @@ -16,6 +16,7 @@ #include <ocl/tproc.hpp> namespace CompilerKit { + inline static constexpr int kBaseYear = 1900; using STLString = std::string; using RopeString = ocl::tproc::crope; @@ -63,6 +64,10 @@ inline bool install_signal(Int32 signal, void (*handler)(int)) noexcept { return true; } + } // namespace CompilerKit +/// @brief This function is for internal uses only, do not call it without a wrapper! +CK_IMPORT_C bool NectarCheckFrontend(CompilerKit::STLString& input); + #endif // __COMPILERKIT_CONFIG_H__ diff --git a/include/CompilerKit/Detail/PreConfig.h b/include/CompilerKit/Detail/PreConfig.h index 882e00b..9294c01 100644 --- a/include/CompilerKit/Detail/PreConfig.h +++ b/include/CompilerKit/Detail/PreConfig.h @@ -87,8 +87,7 @@ #define kObjectFileExt ".obj" #define kBinaryFileExt ".bin" -#define kAsmFileExts \ - { ".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64" } +#define kAsmFileExts {".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64"} #define kAsmFileExtsMax (7U) diff --git a/include/CompilerKit/MachO.h b/include/CompilerKit/MachO.h index 05131ad..2942420 100644 --- a/include/CompilerKit/MachO.h +++ b/include/CompilerKit/MachO.h @@ -43,7 +43,9 @@ namespace MachO { constexpr uint32_t kSectionAlign = 4; /// @brief Helper to align a value to page boundary - inline uint64_t AlignToPage(uint64_t value) { return (value + kPageSize - 1) & ~(kPageSize - 1); } + inline uint64_t AlignToPage(uint64_t value) { + return (value + kPageSize - 1) & ~(kPageSize - 1); + } /// @brief Helper to copy segment/section name safely inline void CopySegmentName(char* dest, const char* src) { diff --git a/include/CompilerKit/UUID.h b/include/CompilerKit/UUID.h index a334052..02f95dc 100644 --- a/include/CompilerKit/UUID.h +++ b/include/CompilerKit/UUID.h @@ -165,7 +165,7 @@ namespace Detail { process_byte(static_cast<unsigned char>((bitCount >> 24) & 0xFF)); process_byte(static_cast<unsigned char>((bitCount >> 16) & 0xFF)); process_byte(static_cast<unsigned char>((bitCount >> 8) & 0xFF)); - process_byte(static_cast<unsigned char>((bitCount) &0xFF)); + process_byte(static_cast<unsigned char>((bitCount) & 0xFF)); memcpy(digest, m_digest, 5 * sizeof(uint32_t)); return digest; diff --git a/include/CompilerKit/Utilities/Compiler.h b/include/CompilerKit/Utilities/Compiler.h index dd2c5c1..094647b 100644 --- a/include/CompilerKit/Utilities/Compiler.h +++ b/include/CompilerKit/Utilities/Compiler.h @@ -90,7 +90,7 @@ inline void drvi_crash_handler(std::int32_t id) { switch (id) { default: { - kStdOut << "SIGNAL: (" << id << ")." << kBlank << kStdEndl; + kStdOut << "SIGNAL: (" << id << ")." << kBlank << kStdEndl; break; } } diff --git a/include/CoreRuntimeKit/C++/__abi b/include/CoreRuntimeKit/C++/abi/abi.hpp index 0252e0b..c0a2680 100644 --- a/include/CoreRuntimeKit/C++/__abi +++ b/include/CoreRuntimeKit/C++/abi/abi.hpp @@ -10,12 +10,11 @@ __init_decl() - static constexpr int32_t __unreachable_code = 34; +static constexpr int32_t __unreachable_code = 34; inline void __compilerkit_unreachable(void) { std::base_process::signal(__unreachable_code); - - while (1); + while (true); } __fini_decl() diff --git a/include/CoreRuntimeKit/C++/new b/include/CoreRuntimeKit/C++/abi/new.hpp index 71afa28..9e86e22 100644 --- a/include/CoreRuntimeKit/C++/new +++ b/include/CoreRuntimeKit/C++/abi/new.hpp @@ -8,6 +8,7 @@ #include <defines> namespace std { + struct nothrow_t final { explicit nothrow_t() = default; ~nothrow_t() = default; @@ -21,6 +22,7 @@ struct placement_t final { int32_t __align{}; size_t __size{}; }; + } // namespace std // AMLALE: Define the placement_t feature. diff --git a/include/CoreRuntimeKit/C++/base_alloc b/include/CoreRuntimeKit/C++/core/base_alloc.hpp index 9e10f92..4d715f7 100644 --- a/include/CoreRuntimeKit/C++/base_alloc +++ b/include/CoreRuntimeKit/C++/core/base_alloc.hpp @@ -8,6 +8,7 @@ #include <defines> namespace std::base_alloc { + /// @brief allocate a new class. /// @tparam KindClass the class type to allocate. template <class KindClass, typename... Args> @@ -39,4 +40,5 @@ template <class KindClass> inline void release_nothrow(KindClass ptr) noexcept { release(ptr); } + } // namespace std::base_alloc diff --git a/include/CoreRuntimeKit/C++/base_exception b/include/CoreRuntimeKit/C++/core/base_exception.hpp index db1de01..c103da5 100644 --- a/include/CoreRuntimeKit/C++/base_exception +++ b/include/CoreRuntimeKit/C++/core/base_exception.hpp @@ -5,7 +5,7 @@ #pragma once -#include <__abi> +#include <abi> #include <base_process> #include <defines> #include <iostream> diff --git a/include/CoreRuntimeKit/C++/base_math b/include/CoreRuntimeKit/C++/core/base_math.hpp index 6691c27..6691c27 100644 --- a/include/CoreRuntimeKit/C++/base_math +++ b/include/CoreRuntimeKit/C++/core/base_math.hpp diff --git a/include/CoreRuntimeKit/C++/base_process b/include/CoreRuntimeKit/C++/core/base_process.hpp index 45de8fd..84354a9 100644 --- a/include/CoreRuntimeKit/C++/base_process +++ b/include/CoreRuntimeKit/C++/core/base_process.hpp @@ -9,10 +9,10 @@ __init_decl() - /// @brief CRT exit, with exit code (!!! exits all threads. !!!) - /// @param code the exit code. - /// @return the return > 0 for non successful. - extern int exit_(int code); +/// @brief CRT exit, with exit code (!!! exits all threads. !!!) +/// @param code the exit code. +/// @return the return > 0 for non successful. +extern int exit_(int code); /// @brief CRT signal handler. /// @param code the signal code. diff --git a/include/CoreRuntimeKit/C++/defines b/include/CoreRuntimeKit/C++/defines.hpp index 3cd1ee1..3cd1ee1 100644 --- a/include/CoreRuntimeKit/C++/defines +++ b/include/CoreRuntimeKit/C++/defines.hpp diff --git a/include/CoreRuntimeKit/C++/filesystem b/include/CoreRuntimeKit/C++/filesystem/filesystem.hpp index 917dd0f..917dd0f 100644 --- a/include/CoreRuntimeKit/C++/filesystem +++ b/include/CoreRuntimeKit/C++/filesystem/filesystem.hpp diff --git a/include/CoreRuntimeKit/C++/utility b/include/CoreRuntimeKit/C++/utility.hpp index a427c44..a427c44 100644 --- a/include/CoreRuntimeKit/C++/utility +++ b/include/CoreRuntimeKit/C++/utility.hpp diff --git a/include/CoreRuntimeKit/Nectar/ncl_exports.h b/include/CoreRuntimeKit/Nectar/exports.hpp index 115484f..72638af 100644 --- a/include/CoreRuntimeKit/Nectar/ncl_exports.h +++ b/include/CoreRuntimeKit/Nectar/exports.hpp @@ -5,3 +5,11 @@ // Official repository: https://github.com/ne-foss-org/nectar #pragma once + +#include <CoreRuntimeKit/C++/abi/abi.hpp> +#include <CoreRuntimeKit/C++/abi/new.hpp> + +/// @brief The Nectar FFI. +namespace nectar_lang { + +} diff --git a/include/CoreRuntimeKit/README.md b/include/CoreRuntimeKit/README.md index 356eaf5..84d50bb 100644 --- a/include/CoreRuntimeKit/README.md +++ b/include/CoreRuntimeKit/README.md @@ -1,8 +1,12 @@ -# The NectarCoreLibrary +# The Nectar Core Support Libraries: ## Abstract: -The NCL is a kit used to interact with other programs using the FFI of Nectar. +The NCSL is a framework used to interact with other programs using the concept of FFI in Nectar. The implmentation is still in progress, feel free to open a PR to propose a new function. +## Example: + +**No examples are available right now, we're working on some.** + diff --git a/include/GenericsLibrary/std.nhh b/include/GenericsLibrary/std.nhh index 0727269..677586e 100644 --- a/include/GenericsLibrary/std.nhh +++ b/include/GenericsLibrary/std.nhh @@ -6,19 +6,17 @@ #pragma once -#define PALLOC_INVALID 0 - extern __nrt_alloc; extern __nrt_free; -//@ Parallel free +//@ Standard free let free_bytes(let ptr) { if (ptr := 0) return 0; return __nrt_free(ptr); } -//@ Parallel alloc (bytes) +//@ Standard alloc (bytes) let alloc_bytes(let type, let sz, let align := 0) { if (0 := align) return 0; @@ -27,4 +25,3 @@ let alloc_bytes(let type, let sz, let align := 0) return __nrt_alloc(type, sz, align); } - diff --git a/include/ThirdParty/Dialogs/Dialogs.h b/include/ThirdParty/Dialogs/Dialogs.h index f370719..8168dd2 100644 --- a/include/ThirdParty/Dialogs/Dialogs.h +++ b/include/ThirdParty/Dialogs/Dialogs.h @@ -176,7 +176,7 @@ namespace internal { #elif __EMSCRIPTEN__ void start(int exit_code); #else - void start_process(std::vector<std::string> const& command); + void start_process(std::vector<std::string> const& command); #endif ~executor(); @@ -219,7 +219,7 @@ namespace internal { : m_proc(reinterpret_cast<T*>((void*) ::GetProcAddress(lib.handle, sym.c_str()))) {} explicit operator bool() const { return m_proc != nullptr; } - operator T*() const { return m_proc; } + operator T*() const { return m_proc; } private: T* m_proc; @@ -491,10 +491,10 @@ inline settings::settings(bool resync) { #if _WIN32 flags(flag::is_vista) = internal::is_vista(); #elif !__APPLE__ - flags(flag::has_zenity) = check_program("zenity"); + flags(flag::has_zenity) = check_program("zenity"); flags(flag::has_matedialog) = check_program("matedialog"); - flags(flag::has_qarma) = check_program("qarma"); - flags(flag::has_kdialog) = check_program("kdialog"); + flags(flag::has_qarma) = check_program("qarma"); + flags(flag::has_kdialog) = check_program("kdialog"); // If multiple helpers are available, try to default to the best one if (flags(flag::has_zenity) && flags(flag::has_kdialog)) { @@ -541,7 +541,7 @@ inline bool settings::check_program(std::string const& program) { (void) program; return false; #else - int exit_code = -1; + int exit_code = -1; internal::executor async; async.start_process({"/bin/sh", "-c", "which " + program}); async.result(&exit_code); @@ -605,7 +605,7 @@ inline std::string path::home() { if (size_max != -1) len = size_t(size_max); #endif std::vector<char> buf(len); - struct passwd pwd, *result; + struct passwd pwd, *result; if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir; #endif return "/"; @@ -718,7 +718,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co } close(in[1]); - m_fd = out[0]; + m_fd = out[0]; auto flags = fcntl(m_fd, F_GETFL); fcntl(m_fd, F_SETFL, flags | O_NONBLOCK); @@ -754,7 +754,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // FIXME: do something (void) timeout; #else - char buf[BUFSIZ]; + char buf[BUFSIZ]; ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore if (received > 0) { m_stdout += std::string(buf, received); @@ -765,7 +765,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // (this happens when the calling application handles or ignores SIG_CHLD) and results in // waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for // a little while. - int status; + int status; pid_t child = waitpid(m_pid, &status, WNOHANG); if (child != m_pid && (child >= 0 || errno != ECHILD)) { // FIXME: this happens almost always at first iteration @@ -783,8 +783,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) inline void internal::executor::stop() { // Loop until the user closes the dialog - while (!ready()) - ; + while (!ready()); } // dll implementation @@ -880,11 +879,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const { #if __APPLE__ return {"osascript"}; #else - return {flags(flag::has_zenity) ? "zenity" + return {flags(flag::has_zenity) ? "zenity" : flags(flag::has_matedialog) ? "matedialog" - : flags(flag::has_qarma) ? "qarma" - : flags(flag::has_kdialog) ? "kdialog" - : "echo"}; + : flags(flag::has_qarma) ? "qarma" + : flags(flag::has_kdialog) ? "kdialog" + : "echo"}; #endif } @@ -1126,9 +1125,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title // Split the pattern list to check whether "*" is in there; if it // is, we have to disable filters because there is no mechanism in // OS X for the user to override the filter. - std::regex sep("\\s+"); - std::string filter_list; - bool has_filter = true; + std::regex sep("\\s+"); + std::string filter_list; + bool has_filter = true; std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1); std::sregex_token_iterator end; for (; iter != end; ++iter) { @@ -1237,7 +1236,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() { return m_vector_result; #else std::vector<std::string> ret; - auto result = m_async->result(); + auto result = m_async->result(); for (;;) { // Split result along newline characters auto i = result.find('\n'); @@ -1570,7 +1569,7 @@ inline message::message(std::string const& title, std::string const& text, if_cancel = button::ok; break; } - m_mappings[1] = if_cancel; + m_mappings[1] = if_cancel; m_mappings[256] = if_cancel; // XXX: I think this was never correct script += " with icon "; switch (_icon) { @@ -1657,7 +1656,7 @@ inline message::message(std::string const& title, std::string const& text, if (_choice == choice::yes_no_cancel) flag += "cancel"; command.push_back(flag); if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) { - m_mappings[0] = button::yes; + m_mappings[0] = button::yes; m_mappings[256] = button::no; } } |
