From ed008e0c7d9e104eb64bfb67dde960d123da3a45 Mon Sep 17 00:00:00 2001 From: servostar Date: Sat, 25 May 2024 09:59:38 +0200 Subject: [PATCH] added standard type definitions --- lib/def/def.h | 25 +++++++++++++++++++++++++ lib/def/mod.gem | 34 ++++++++++++++++++++++++++++++++++ lib/std.gem | 12 ++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 lib/def/def.h create mode 100644 lib/def/mod.gem create mode 100644 lib/std.gem diff --git a/lib/def/def.h b/lib/def/def.h new file mode 100644 index 0000000..b1980a9 --- /dev/null +++ b/lib/def/def.h @@ -0,0 +1,25 @@ +// Author: Sven Vogel +// Edited: 25.05.2024 +// License: GPL-2.0 + +#ifndef GEMSTONE_STD_LIB_DEF_H_ +#define GEMSTONE_STD_LIB_DEF_H_ + +#include + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef int8_t i8; +typedef int16_t i16; +typedef int32_t i32; +typedef int64_t i64; + +typedef float f32; +typedef double f64; + +typedef u8* str; + +#endif // GEMSTONE_STD_LIB_DEF_H_ diff --git a/lib/def/mod.gem b/lib/def/mod.gem new file mode 100644 index 0000000..22bfd7f --- /dev/null +++ b/lib/def/mod.gem @@ -0,0 +1,34 @@ +# Author: Sven Vogel +# Edited: 25.05.2024 +# License: GPL-2.0 + +# ,----------------------------------------. +# | Standard Type definitions | +# `----------------------------------------` + +# Unsigned integrals + +type unsgined half half int: u8 +type unsgined half int: u16 +type unsgined int: u32 +type unsgined double int: u64 +type unsgined double double int: u128 + +# Signed integrals + +type signed u8: i8 +type signed u16: i16 +type signed u32: i32 +type signed u64: i64 +type signed u128: i128 + +# IEEE-754 floating point + +type signed half float: f16 +type signed float: f32 +type signed double float: f64 +type signed double double float: f128 + +# String constant + +type ref u8: str diff --git a/lib/std.gem b/lib/std.gem new file mode 100644 index 0000000..402bc1b --- /dev/null +++ b/lib/std.gem @@ -0,0 +1,12 @@ +# Author: Sven Vogel +# Edited: 25.05.2024 +# License: GPL-2.0 + +# ,----------------------------------------. +# | Gemstone Standard Library | +# `----------------------------------------` + +# standard type definitions +import "def/mod.gem" + +