aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-11-05 13:42:19 +0000
committergingerBill <gingerBill@users.noreply.github.com>2025-11-05 13:42:19 +0000
commitc937d38db2b31b885256b9aac0d606032f6c5343 (patch)
treece90ab9ff0cd888fa6092ecb852d6934b0bdc877 /src
parentc5556aa2e0c3cffc9f379ba00ce0d6d92e7ad79c (diff)
Improve doc-writer format for `#all_or_none`bill/all_or_none
Diffstat (limited to 'src')
-rw-r--r--src/docs_format.cpp61
-rw-r--r--src/docs_writer.cpp6
2 files changed, 64 insertions, 3 deletions
diff --git a/src/docs_format.cpp b/src/docs_format.cpp
index e292519ab..2235789d5 100644
--- a/src/docs_format.cpp
+++ b/src/docs_format.cpp
@@ -125,21 +125,76 @@ enum {
struct OdinDocType {
OdinDocTypeKind kind;
+ // Type_Kind specific used by some types
+ // Underlying flag types:
+ // .Basic - Type_Flags_Basic
+ // .Struct - Type_Flags_Struct
+ // .Union - Type_Flags_Union
+ // .Proc - Type_Flags_Proc
+ // .Bit_Set - Type_Flags_Bit_Set
u32 flags;
+
+ // Used by:
+ // .Basic
+ // .Named
+ // .Generic
OdinDocString name;
+
+ // Used By: .Struct, .Union
OdinDocString custom_align;
- // Used by some types
+ // Used by:
+ // .Array - 1 count: 0=len
+ // .Enumerated_Array - 1 count: 0=len
+ // .SOA_Struct_Fixed - 1 count: 0=len
+ // .Bit_Set - 2 count: 0=lower, 1=upper
+ // .Simd_Vector - 1 count: 0=len
+ // .Matrix - 2 count: 0=row_count, 1=column_count
+ // .Struct - <=2 count: 0=min_field_align, 1=max_field_align
u32 elem_count_len;
i64 elem_counts[OdinDocType_ElemsCap];
- // Each of these is esed by some types, not all
+ // Used by: .Procedures
+ // blank implies the "odin" calling convention
OdinDocString calling_convention;
+
+ // Used by:
+ // .Named - 1 type: 0=base type
+ // .Generic - <1 type: 0=specialization
+ // .Pointer - 1 type: 0=element
+ // .Array - 1 type: 0=element
+ // .Enumerated_Array - 2 types: 0=index and 1=element
+ // .Slice - 1 type: 0=element
+ // .Dynamic_Array - 1 type: 0=element
+ // .Map - 2 types: 0=key, 1=value
+ // .SOA_Struct_Fixed - 1 type: underlying SOA struct element
+ // .SOA_Struct_Slice - 1 type: underlying SOA struct element
+ // .SOA_Struct_Dynamic - 1 type: underlying SOA struct element
+ // .Union - 0+ types: variants
+ // .Enum - <1 type: 0=base type
+ // .Proc - 2 types: 0=parameters, 1=results
+ // .Bit_Set - <=2 types: 0=element type, 1=underlying type (Underlying_Type flag will be set)
+ // .Simd_Vector - 1 type: 0=element
+ // .Relative_Pointer - 2 types: 0=pointer type, 1=base integer
+ // .Multi_Pointer - 1 type: 0=element
+ // .Matrix - 1 type: 0=element
+ // .Soa_Pointer - 1 type: 0=element
+ // .Bit_Field - 1 type: 0=backing type
OdinDocArray<OdinDocTypeIndex> types;
+
+ // Used by:
+ // .Named - 1 field for the definition
+ // .Struct - fields
+ // .Enum - fields
+ // .Parameters - parameters (procedures only)
OdinDocArray<OdinDocEntityIndex> entities;
+
+ // Used By: .Struct, .Union
OdinDocTypeIndex polmorphic_params;
+ // Used By: .Struct, .Union
OdinDocArray<OdinDocString> where_clauses;
- OdinDocArray<OdinDocString> tags; // struct field tags
+ // Used By: .Struct
+ OdinDocArray<OdinDocString> tags;
};
struct OdinDocAttribute {
diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp
index 9f6b3bc22..3edd7da9d 100644
--- a/src/docs_writer.cpp
+++ b/src/docs_writer.cpp
@@ -622,6 +622,12 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type, bool ca
if (type->Struct.is_raw_union) { doc_type.flags |= OdinDocTypeFlag_Struct_raw_union; }
if (type->Struct.is_all_or_none) { doc_type.flags |= OdinDocTypeFlag_Struct_all_or_none; }
+ if (type->Struct.custom_min_field_align > 0 || type->Struct.custom_max_field_align > 0) {
+ doc_type.elem_count_len = 2;
+ doc_type.elem_counts[0] = cast(u32)gb_max(type->Struct.custom_min_field_align, 0);
+ doc_type.elem_counts[1] = cast(u32)gb_max(type->Struct.custom_max_field_align, 0);
+ }
+
auto fields = array_make<OdinDocEntityIndex>(heap_allocator(), type->Struct.fields.count);
defer (array_free(&fields));