From 34bfedcd1e5e67b630fb7648cf7709d4a400abc5 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 6 Oct 2022 16:06:52 -0400 Subject: Minor fixes --- libtnsl/box/_vect.tnsl | 20 -------------------- libtnsl/box/error.tnsl | 38 ++++++++++++++++++++++++++++++++++++++ libtnsl/box/string.tnsl | 6 +++--- libtnsl/box/vector.tnsl | 2 +- 4 files changed, 42 insertions(+), 24 deletions(-) delete mode 100644 libtnsl/box/_vect.tnsl create mode 100644 libtnsl/box/error.tnsl (limited to 'libtnsl/box') diff --git a/libtnsl/box/_vect.tnsl b/libtnsl/box/_vect.tnsl deleted file mode 100644 index 52e6444..0000000 --- a/libtnsl/box/_vect.tnsl +++ /dev/null @@ -1,20 +0,0 @@ -/## - Copyright 2021-2022 Kyle Gunger - - Dual licensed under the CDDL 1.0 and BSD 3-Clause licenses. - - This file may only be used in accordance with one of the two - licenses. You should have received a copy of each license with - the source code. In the event that you did not recieve a copy - of the licenses, they may be found at the following URLs: - - CDDL 1.0: - https://opensource.org/licenses/CDDL-1.0 - - BSD 3-Clause: - https://opensource.org/licenses/BSD-3-Clause - - THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO - WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE - EXPRESS OR IMPLIED -#/ diff --git a/libtnsl/box/error.tnsl b/libtnsl/box/error.tnsl new file mode 100644 index 0000000..d536012 --- /dev/null +++ b/libtnsl/box/error.tnsl @@ -0,0 +1,38 @@ +/## + Copyright 2021-2022 Kyle Gunger + + Dual licensed under the CDDL 1.0 and BSD 3-Clause licenses. + + This file may only be used in accordance with one of the two + licenses. You should have received a copy of each license with + the source code. In the event that you did not recieve a copy + of the licenses, they may be found at the following URLs: + + CDDL 1.0: + https://opensource.org/licenses/CDDL-1.0 + + BSD 3-Clause: + https://opensource.org/licenses/BSD-3-Clause + + THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO + WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE + EXPRESS OR IMPLIED +#/ + +;enum ERROR_CODE [uint] { + OUT_OF_RANGE +} + +;struct Error { + String msg, + uint code, + ~void data +} + +/; method Error + /; Error (String msg, uint code) + ;self.msg = msg + ;self.code = code + ;self.data = null + ;/ +;/ \ No newline at end of file diff --git a/libtnsl/box/string.tnsl b/libtnsl/box/string.tnsl index 70b2c2a..d661676 100644 --- a/libtnsl/box/string.tnsl +++ b/libtnsl/box/string.tnsl @@ -19,14 +19,14 @@ EXPRESS OR IMPLIED #/ -;raw enum TEXT_ENCODING { +;enum TEXT_ENCODING [uint] { UTF_8, UN7_1, ASCII } -;struct String extends Vector (uint8) { - uint +;struct String extends Vector(uint8) { + uint encoding } /; method String diff --git a/libtnsl/box/vector.tnsl b/libtnsl/box/vector.tnsl index 065239e..724393f 100644 --- a/libtnsl/box/vector.tnsl +++ b/libtnsl/box/vector.tnsl @@ -68,7 +68,7 @@ ;/ # Probably not what errors will look like long term, but # serves as a proof of concept for now - ;throw Error{"Bad Index"} + ;throw Error("Bad index", ERROR_CODE.OUT_OF_RANGE) ;/ /; operator len [uint] -- cgit v1.2.3