From 511bfe41079053c8cc3b2d91a5345a0ac9334a0edea60143ac7e9a95a6a68f54 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 15 Dec 2024 11:32:21 +0300 Subject: [PATCH] Add invalid item type for zeroed memory --- cyac/lib/dec.h | 6 ++++-- gyac/types/type.go | 3 ++- gyac/types/type_string.go | 35 ++++++++++++++++++----------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cyac/lib/dec.h b/cyac/lib/dec.h index c582ac7..190459a 100644 --- a/cyac/lib/dec.h +++ b/cyac/lib/dec.h @@ -10,6 +10,7 @@ // @deftp {Data type} {enum YACItemType} // High-level type of the atom. // @itemize +// @item YACItemInvalid -- invalid item value, uninitialised // @item YACItemEOC // @item YACItemNIL // @item YACItemFalse @@ -28,8 +29,9 @@ // @end itemize // @end deftp enum YACItemType { - YACItemEOC = 0, - YACItemNIL = 1, + YACItemInvalid = 0, + YACItemEOC = 1, + YACItemNIL, YACItemFalse, YACItemTrue, YACItemUUID, diff --git a/gyac/types/type.go b/gyac/types/type.go index ba0d90a..fcfea0e 100644 --- a/gyac/types/type.go +++ b/gyac/types/type.go @@ -4,7 +4,8 @@ type Type byte //go:generate stringer -type=Type const ( - EOC Type = iota + Invalid Type = iota + EOC NIL Bool UUID diff --git a/gyac/types/type_string.go b/gyac/types/type_string.go index c21de88..2cbecdf 100644 --- a/gyac/types/type_string.go +++ b/gyac/types/type_string.go @@ -8,26 +8,27 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} - _ = x[EOC-0] - _ = x[NIL-1] - _ = x[Bool-2] - _ = x[UUID-3] - _ = x[UInt-4] - _ = x[Int-5] - _ = x[BigInt-6] - _ = x[List-7] - _ = x[Map-8] - _ = x[Blob-9] - _ = x[Float-10] - _ = x[TAI64-11] - _ = x[Bin-12] - _ = x[Str-13] - _ = x[Raw-14] + _ = x[Invalid-0] + _ = x[EOC-1] + _ = x[NIL-2] + _ = x[Bool-3] + _ = x[UUID-4] + _ = x[UInt-5] + _ = x[Int-6] + _ = x[BigInt-7] + _ = x[List-8] + _ = x[Map-9] + _ = x[Blob-10] + _ = x[Float-11] + _ = x[TAI64-12] + _ = x[Bin-13] + _ = x[Str-14] + _ = x[Raw-15] } -const _Type_name = "EOCNILBoolUUIDUIntIntBigIntListMapBlobFloatTAI64BinStrRaw" +const _Type_name = "InvalidEOCNILBoolUUIDUIntIntBigIntListMapBlobFloatTAI64BinStrRaw" -var _Type_index = [...]uint8{0, 3, 6, 10, 14, 18, 21, 27, 31, 34, 38, 43, 48, 51, 54, 57} +var _Type_index = [...]uint8{0, 7, 10, 13, 17, 21, 25, 28, 34, 38, 41, 45, 50, 55, 58, 61, 64} func (i Type) String() string { if i >= Type(len(_Type_index)-1) { -- 2.50.0