From 9784f940cf71aef91ccbeb1a11651a83a3eff213 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 24 Jun 2024 14:33:40 +0200 Subject: IMP: UIAccessibilty class, work in progress Core CoreGraphics (GPU/FB SDK). REFACTOR: Moved Builtins to Modules/ Signed-off-by: Amlal El Mahrouss --- Comm/herror.hxx | 46 ++++++++++++++++++++++ Comm/newstd.hxx | 119 ++++++++++++++++++++++++++------------------------------ 2 files changed, 102 insertions(+), 63 deletions(-) create mode 100644 Comm/herror.hxx (limited to 'Comm') diff --git a/Comm/herror.hxx b/Comm/herror.hxx new file mode 100644 index 00000000..8cf15d17 --- /dev/null +++ b/Comm/herror.hxx @@ -0,0 +1,46 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include + +typedef SInt32 HError; + +inline constexpr HError kErrorSuccess = 0; +inline constexpr HError kErrorExecutable = 33; +inline constexpr HError kErrorExecutableLib = 34; // no such library!!! +inline constexpr HError kErrorFileNotFound = 35; +inline constexpr HError kErrorDirectoryNotFound = 36; +inline constexpr HError kErrorDiskReadOnly = 37; +inline constexpr HError kErrorDiskIsFull = 38; +inline constexpr HError kErrorProcessFault = 39; +inline constexpr HError kErrorSocketHangUp = 40; +inline constexpr HError kErrorThreadLocalStorage = 41; +inline constexpr HError kErrorMath = 42; +inline constexpr HError kErrorNoNetwork = 43; +inline constexpr HError kErrorHeapOutOfMemory = 44; +inline constexpr HError kErrorNoSuchDisk = 45; +inline constexpr HError kErrorFileExists = 46; +inline constexpr HError kErrorFormatFailed = 47; +inline constexpr HError kErrorNetworkTimeout = 48; +inline constexpr HError kErrorInternal = 49; +inline constexpr HError kErrorForkAlreadyExists = 50; +inline constexpr HError kErrorOutOfTeamSlot = 51; +inline constexpr HError kErrorHeapNotPresent = 52; +inline constexpr HError kErrorNoEntrypoint = 53; +inline constexpr HError kErrorDiskIsCorrupted = 54; +inline constexpr HError kErrorDisk = 55; +inline constexpr HError kErrorInvalidData = 56; +inline constexpr HError kErrorAsync = 57; +inline constexpr HError kErrorNonBlocking = 58; +inline constexpr HError kErrorUnimplemented = 0; + +#define DbgOk() (kLastError == kErrorSuccess) +#define DbgFailed() (kLastError != kErrorSuccess) +#define DbgLastError() kLastError + +inline HError kLastError = 0; diff --git a/Comm/newstd.hxx b/Comm/newstd.hxx index d7665c78..7362f8e9 100644 --- a/Comm/newstd.hxx +++ b/Comm/newstd.hxx @@ -14,33 +14,33 @@ Purpose: NewOS standard interface. #endif // __KERNEL__ #define ML_IMPORT_CXX extern "C++" -#define ML_IMPORT_C extern "C" +#define ML_IMPORT_C extern "C" #define cRestrictR "r" #define cRestrictRB "rb" #define cRestrictW "w" #define cRestrictRW "rw" -class NUser; /// @brief User application class. -class NWindow; /// @brief Window class. +class NUser; /// @brief User application class. +class NWindow; /// @brief Window class. class NWindowAlert; /// @brief Window alert object -class NURL; /// @brief URL object. +class NURL; /// @brief URL object. -typedef void(*NWindowCallback)(NWindow*); +typedef void (*NWindowCallback)(NWindow*); -typedef int OSType; +typedef int OSType; typedef bool Bool; typedef void UInt0; typedef __UINT64_TYPE__ UInt64; typedef __UINT32_TYPE__ UInt32; typedef __UINT16_TYPE__ UInt16; -typedef __UINT8_TYPE__ UInt8; +typedef __UINT8_TYPE__ UInt8; typedef __INT64_TYPE__ SInt64; typedef __INT32_TYPE__ SInt32; typedef __INT16_TYPE__ SInt16; -typedef __INT8_TYPE__ SInt8; +typedef __INT8_TYPE__ SInt8; /** @brief Standard library class. @@ -48,30 +48,30 @@ typedef __INT8_TYPE__ SInt8; class NUser final { public: - // THOSE REQUIRES PERMISSIONS FROM THE USER. /// + // THOSE REQUIRES PERMISSIONS FROM THE USER. /// - static UInt0 Poweroff(); - static UInt0 Reboot(); - static Bool IsWokeup(); + static UInt0 Poweroff(); + static UInt0 Reboot(); + static Bool IsWokeup(); - // THOSE DOESNT REQUIRE PERMISSIONS FROM THE USER. /// + // THOSE DOESNT REQUIRE PERMISSIONS FROM THE USER. /// - static UInt0 Terminate(); - static Bool Exit(OSType code); - static UInt0* New(long long sz); - static UInt0 Delete(void* ptr); + static UInt0 Terminate(); + static Bool Exit(OSType code); + static UInt0* New(long long sz); + static UInt0 Delete(void* ptr); - // ASK FOR ELEVATION /// + // ASK FOR ELEVATION /// - static Bool RaiseUAC(); + static Bool RaiseUAC(); - // THOSE MAY REQUIRE PERMISSIONS FROM THE USER. /// + // THOSE MAY REQUIRE PERMISSIONS FROM THE USER. /// - static OSType Open(const char* path); - static UInt0 Close(OSType fd); - static NURL* Execute(const NURL* command); - static UInt0* Read(const char* forkName, OSType fd); - static UInt0* Write(const char* forkName, OSType fd); + static OSType Open(const char* path); + static UInt0 Close(OSType fd); + static NURL* Execute(const NURL* command); + static UInt0* Read(const char* forkName, OSType fd); + static UInt0* Write(const char* forkName, OSType fd); }; /** @@ -80,61 +80,55 @@ public: class NWindowAlert { public: - explicit NWindowAlert() = default; - virtual ~NWindowAlert() = default; + explicit NWindowAlert() = default; + virtual ~NWindowAlert() = default; public: - /// @brief Opens an alert dialog. - virtual NWindowAlert* Alert(const char* message, const char* title) = 0; + /// @brief Opens an alert dialog. + virtual NWindowAlert* Alert(const char* message, const char* title) = 0; - /// @brief Makes a prompt dialog. - virtual NWindowAlert* Prompt(const char* message, const char* title) = 0; + /// @brief Makes a prompt dialog. + virtual NWindowAlert* Prompt(const char* message, const char* title) = 0; - /// @brief Makes a prompt notification dialog. - virtual NWindowAlert* PromptNotification(const char* message, const char* title) = 0; + /// @brief Makes a prompt notification dialog. + virtual NWindowAlert* PromptNotification(const char* message, const char* title) = 0; - /// @brief Makes a notification dialog. - virtual NWindowAlert* Notification(const char* message, const char* title) = 0; + /// @brief Makes a notification dialog. + virtual NWindowAlert* Notification(const char* message, const char* title) = 0; - /// Collect result of prompt/notification. - virtual NWindowAlert* Collect(const char* resultBuf, long resultBufSz) = 0; + /// Collect result of prompt/notification. + virtual NWindowAlert* Collect(const char* resultBuf, long resultBufSz) = 0; public: - Bool fAsyncOperationMode; - NWindowCallback fAsyncOnComplete; - + Bool fAsyncOperationMode; + NWindowCallback fAsyncOnComplete; }; /// @brief Window object. class NWindow { public: - explicit NWindow() = default; - virtual ~NWindow() = default; + explicit NWindow() = default; + virtual ~NWindow() = default; public: - virtual NWindow* New(const char* pageName) = 0; + virtual NWindow* New(const char* pageName) = 0; - virtual NWindow* Ref(NWindow* pagee) = 0; + virtual NWindow* Ref(NWindow* pagee) = 0; - virtual NWindow* Text(const char* text) = 0; + virtual NWindow* Text(const char* text) = 0; - virtual NWindow* Button(const char* text, NWindowCallback onClick = nullptr, - NWindowCallback onDblClick = nullptr) = 0; + virtual NWindow* Button(const char* text, NWindowCallback onClick = nullptr, NWindowCallback onDblClick = nullptr) = 0; - virtual NWindow* Checkbox(const char* text, NWindowCallback onSelect = nullptr, - NWindowCallback onUnselect = nullptr) = 0; + virtual NWindow* Checkbox(const char* text, NWindowCallback onSelect = nullptr, NWindowCallback onUnselect = nullptr) = 0; - virtual NWindow* Radio(const char* text, NWindowCallback onSelect = nullptr, - NWindowCallback onUnselect = nullptr) = 0; + virtual NWindow* Radio(const char* text, NWindowCallback onSelect = nullptr, NWindowCallback onUnselect = nullptr) = 0; - virtual NWindow* Link(const char* where, const char* textIfAny = "", NWindowCallback onClick = nullptr, - NWindowCallback onHover = nullptr) = 0; + virtual NWindow* Link(const char* where, const char* textIfAny = "", NWindowCallback onClick = nullptr, NWindowCallback onHover = nullptr) = 0; public: - Bool fWindowEnabled; - void* fWindowDataPtr; - + Bool fWindowEnabled; + void* fWindowDataPtr; }; /** @@ -143,15 +137,14 @@ This class contains an URL class NURL { public: - explicit NURL() = default; - virtual ~NURL() = default; + explicit NURL() = default; + virtual ~NURL() = default; public: - virtual NURL* Navigate(const char* url) = 0; - virtual NURL* Protocol(const char* protocol) = 0; + virtual NURL* Navigate(const char* url) = 0; + virtual NURL* Protocol(const char* protocol) = 0; public: - char* fBufferPtr; - long fBufferLen; - + char* fBufferPtr; + long fBufferLen; }; -- cgit v1.2.3