diff --git a/Media/Hello Aurora.png b/Media/Hello Aurora.png new file mode 100644 index 00000000..1b0ab9c8 Binary files /dev/null and b/Media/Hello Aurora.png differ diff --git a/Source/RNG/WELL.cpp b/Source/RNG/WELL.cpp index 58d226e7..130ab1a6 100644 --- a/Source/RNG/WELL.cpp +++ b/Source/RNG/WELL.cpp @@ -82,9 +82,8 @@ AuUInt32 WELL_NextLong_Unlocked(WELLRand *rand) */ AuUInt32 WELL_NextLong(WELLRand *rand) { - rand->lock.Lock(); + AU_LOCK_GUARD(rand->lock); AuUInt32 ret = WELL_NextLong_Unlocked(rand); - rand->lock.Unlock(); return ret; } @@ -95,8 +94,8 @@ void WELL_NextBytes(WELLRand *rand, void *in, AuUInt32 length) i = 0; base = reinterpret_cast(in); - - rand->lock.Lock(); + + AU_LOCK_GUARD(rand->lock); for (; i < length; i += 4) { @@ -110,6 +109,4 @@ void WELL_NextBytes(WELLRand *rand, void *in, AuUInt32 length) AuUInt32 padRng = WELL_NextLong_Unlocked(rand); AuMemcpy(base + i, &padRng, length - i); } - - rand->lock.Unlock(); } \ No newline at end of file diff --git a/Source/RNG/mtwister.cpp b/Source/RNG/mtwister.cpp index 6785ca6d..50e1504f 100644 --- a/Source/RNG/mtwister.cpp +++ b/Source/RNG/mtwister.cpp @@ -50,7 +50,7 @@ AuUInt32 MT_NextLong(MTRand *rand) AuUInt32 y; static const AuUInt32 mag[2] = {0x0, 0x9908b0df}; /* mag[x] = x * 0x9908b0df for x = 0,1 */ - rand->lock.Lock(); + AU_LOCK_GUARD(rand->lock); if (rand->index >= STATE_VECTOR_LENGTH || rand->index < 0) { @@ -85,6 +85,5 @@ AuUInt32 MT_NextLong(MTRand *rand) y ^= (y << 15) & TEMPERING_MASK_C; y ^= (y >> 18); - rand->lock.Unlock(); return y; } \ No newline at end of file diff --git a/readme.md b/readme.md index 5df28b79..054f3596 100644 --- a/readme.md +++ b/readme.md @@ -2,11 +2,13 @@ ## AuroraRuntime -The Aurora Runtime is an platform abstraction layer for cross-platform C++ development targeting
-embedded and PC systems. Simply fetch a binary package for your toolchain or integrate the build
-scripts into your applications build pipeline to get started.
+![picture](https://gitea.reece.sx/AuroraSupport/AuroraRuntime/raw/branch/master/Media/Hello%20Aurora.png) -View this raw file for improved formatting +The Aurora Runtime is an platform abstraction layer for cross-platform C++ development targeting +embedded and PC systems. Simply fetch a binary package for your toolchain or integrate the build +scripts into your applications build pipeline to get started. + +View this file without markdown for improved formatting ## Features @@ -48,29 +50,33 @@ Aurora Overloadable Type Declerations: https://git.reece.sx/AuroraSupport/Aurora ~~Aurora Runtime does not attempt to implement your favourite production logger. We instead
implement a subscription based log message dispatcher with some default backends including
a file logger, Windows debug logging, Windows conhost stdin/out using UTF-8, UNIX stdin/out
-respecting the applications codepage, a wxWidgets toolkit GUI, and hopefully more to come. ~~
+respecting the applications codepage, a wxWidgets toolkit GUI, and hopefully more to come~~
-Additionally, consoles that provide an input stream can be used in conjunction with the parse
-subsystem to provide basic command-based deserialization, tokenization, and dispatch of UTF-8
+Additionally, consoles that provide an input stream can be used in conjunction with the parse +subsystem to provide basic command-based deserialization, tokenization, and dispatch of UTF-8 translated strings regardless of the system locale ## Exceptions -Through the use of compiler internal overloads, ELF hooking, and Win32 `AddVectoredExceptionHandler`, Aurora
-Runtime hooks exceptions at the time of throw, including *some* out of ecosystem exceptions, providing detailed
-telemetry of the object type, object string, and backtrace. In addition, the `AuDebug` namespace provides TLS based
-last-error and last-backtrace methods.
+Through the use of compiler internal overloads, ELF hooking, and Win32 +`AddVectoredExceptionHandler`, Aurora Runtime hooks exceptions at the time of throw, including +*some* out of ecosystem exceptions, providing detailed telemetry of the object type, object +string, and backtrace. In addition, the `AuDebug` namespace provides TLS based last-error and +last-backtrace methods.
EXCEPTIONS ARE NOT CONTROL FLOW...
- Aurora Runtime WILL attempt to mitigate exceptions in internal logic - Aurora Runtime WILL NOT abuse exceptions to communicate failure - Aurora Runtime WILL try to decouple internal exceptions from the API - Aurora Runtime WILL NOT use anything that automatically crashes on exception catch (no-nothrow) -- Aurora Runtime WILL provide extended exception information to telemetry backends and through the `AuDebug` namespace -- Aurora Runtime WILL NOT make any guarantees of being globally-nothrow; however, it should be a safe assumption in non-critical environments +- Aurora Runtime WILL provide extended exception information to telemetry backends and through + the `AuDebug` namespace +- Aurora Runtime WILL NOT make any guarantees of being globally-nothrow; however, it should be a + safe assumption in non-critical environments -`SysPanic` can be used to format a `std::terminate`-like exit condition, complete with telemetry data and safe cleanup. +`SysPanic` can be used to format a `std::terminate`-like exit condition, complete with telemetry +data and safe cleanup. ## Loop @@ -167,31 +173,31 @@ User-overloadable type declerations and generic access utilities are defined und ## Binding -Aurora Runtime provides C++ APIs; however, it should be noted that two libraries are used to extend interfaces and enums
-to help with porting and internal utility access. One, AuroraEnums, wraps basic enumerations and provides value vectors;
-value strings; look up; iteration; and more. The other, AuroraInterfaces, provides *TWO* class types for each virtual interface.
-Each interface can be backed by a; C++ class method overriding a superclass's `virtual ...(...) = 0;` method, or a `AuFunctional`
--based structure.
+Aurora Runtime provides C++ APIs; however, it should be noted that two libraries are used to extend interfaces and enums +to help with porting and internal utility access. One, AuroraEnums, wraps basic enumerations and provides value vectors; +value strings; look up; iteration; and more. The other, AuroraInterfaces, provides *TWO* class types for each virtual interface. +Each interface can be backed by a; C++ class method overriding a superclass's `virtual ...(...) = 0;` method, or a `AuFunctional` +-based structure. -It should be noted that most language bindings and generator libraries (^swig, v8pp, nbind, luabind) work with shared pointers.
-Other user code may wish to stuff pointers into a machineword-sized space, whether its a C library, a FFI, or a size constraint.
-One handle or abstraction layer will be required to integrate the C++ API into the destination platform, and assuming we have a
-C++ language frontend parsing our API, we can use `AuSPtr` for all caller-to-method constant reference scanerios.
-Furthermore, `AuSPtrs` can be created, without a deletor, using `AuUnsafeRaiiToShared(unique/raw pointer)`. To solve the raw
-pointer issue, `AuSPtrs` are created in the public headers with the help of exported/default visibility interface create and
-destroy functions. These APIs provide raw pointers to public C++ interfaces, and as such, can be binded using virtually any
-shim generator. Method and API mapping will likely involve manual work from the library developer to reimplement AU concepts
-under their language runtime instead of using the C++ platform, or at least require manual effort to shim or map each runtime
-prototype into something more sane across the language barrier.
+It should be noted that most language bindings and generator libraries (^swig, v8pp, nbind, luabind) work with shared pointers. +Other user code may wish to stuff pointers into a machineword-sized space, whether its a C library, a FFI, or a size constraint. +One handle or abstraction layer will be required to integrate the C++ API into the destination platform, and assuming we have a +C++ language frontend parsing our API, we can use `AuSPtr` for all caller-to-method constant reference scanerios. +Furthermore, `AuSPtrs` can be created, without a deletor, using `AuUnsafeRaiiToShared(unique/raw pointer)`. To solve the raw +pointer issue, `AuSPtrs` are created in the public headers with the help of exported/default visibility interface create and +destroy functions. These APIs provide raw pointers to public C++ interfaces, and as such, can be binded using virtually any +shim generator. Method and API mapping will likely involve manual work from the library developer to reimplement AU concepts +under their language runtime instead of using the C++ platform, or at least require manual effort to shim or map each runtime +prototype into something more sane across the language barrier. -Memory is generally viewed through a `std::span` like concept called MemoryViews. `MemoryViewRead` and `MemoryViewWrite`
-provide windows into a defined address range. `MemoryViewStreamRead` and `MemoryViewStreamWrite` expand upon this concept by
-accepting an additional offset (`AuUInt &: reference`) that is used by internal APIs to indicate how many bytes were written or
-read from a given input region. Such requirement came about from so many APIs, networking, compression, encoding, doing the exact
+Memory is generally viewed through a `std::span` like concept called MemoryViews. `MemoryViewRead` and `MemoryViewWrite` +provide windows into a defined address range. `MemoryViewStreamRead` and `MemoryViewStreamWrite` expand upon this concept by +accepting an additional offset (`AuUInt &: reference`) that is used by internal APIs to indicate how many bytes were written or +read from a given input region. Such requirement came about from so many APIs, networking, compression, encoding, doing the exact same thing in different not-so-portable ways. Unifying memory access to 4 class types should aid with SWIG prototyping. -Unrelated note, structure interfacing with questionable C++ ABI reimplementations is somewhat sketchy in FFI projects (^ CppSharp)
-can lead to some memory leaks.
+Unrelated note, structure interfacing with questionable C++ ABI reimplementations is somewhat sketchy in FFI projects (^ CppSharp) +can lead to some memory leaks. ## IO