diff --git a/core/odin/doc-format/doc_format.odin b/core/odin/doc-format/doc_format.odin index 5e869ff73..59eafdc09 100644 --- a/core/odin/doc-format/doc_format.odin +++ b/core/odin/doc-format/doc_format.odin @@ -107,6 +107,8 @@ Entity_Flag :: enum u32le { Var_Thread_Local = 40, Var_Static = 41, + + Private = 50, } Entity_Flags :: distinct bit_set[Entity_Flag; u64le] diff --git a/core/sync/sync2/primitives.odin b/core/sync/sync2/primitives.odin index d9e013664..6d056d439 100644 --- a/core/sync/sync2/primitives.odin +++ b/core/sync/sync2/primitives.odin @@ -29,12 +29,12 @@ mutex_try_lock :: proc(m: ^Mutex) -> bool { return _mutex_try_lock(m) } -// Example: -// -// if mutex_guard(&m) { -// ... -// } -// +/* +Example: + if mutex_guard(&m) { + ... + } +*/ @(deferred_in=mutex_unlock) mutex_guard :: proc(m: ^Mutex) -> bool { mutex_lock(m) @@ -80,25 +80,24 @@ rw_mutex_shared_unlock :: proc(rw: ^RW_Mutex) { rw_mutex_try_shared_lock :: proc(rw: ^RW_Mutex) -> bool { return _rw_mutex_try_shared_lock(rw) } - -// Example: -// -// if rw_mutex_guard(&m) { -// ... -// } -// +/* +Example: + if rw_mutex_guard(&m) { + ... + } +*/ @(deferred_in=rw_mutex_unlock) rw_mutex_guard :: proc(m: ^RW_Mutex) -> bool { rw_mutex_lock(m) return true } -// Example: -// -// if rw_mutex_shared_guard(&m) { -// ... -// } -// +/* +Example: + if rw_mutex_shared_guard(&m) { + ... + } +*/ @(deferred_in=rw_mutex_shared_unlock) rw_mutex_shared_guard :: proc(m: ^RW_Mutex) -> bool { rw_mutex_shared_lock(m) @@ -127,13 +126,12 @@ recursive_mutex_try_lock :: proc(m: ^Recursive_Mutex) -> bool { return _recursive_mutex_try_lock(m) } - -// Example: -// -// if recursive_mutex_guard(&m) { -// ... -// } -// +/* +Example: + if recursive_mutex_guard(&m) { + ... + } +*/ @(deferred_in=recursive_mutex_unlock) recursive_mutex_guard :: proc(m: ^Recursive_Mutex) -> bool { recursive_mutex_lock(m) diff --git a/core/sync/sync2/primitives_atomic.odin b/core/sync/sync2/primitives_atomic.odin index a13b73a99..5fc6fba85 100644 --- a/core/sync/sync2/primitives_atomic.odin +++ b/core/sync/sync2/primitives_atomic.odin @@ -82,13 +82,12 @@ atomic_mutex_try_lock :: proc(m: ^Atomic_Mutex) -> bool { return ok } - -// Example: -// -// if atomic_mutex_guard(&m) { -// ... -// } -// +/* +Example: + if atomic_mutex_guard(&m) { + ... + } +*/ @(deferred_in=atomic_mutex_unlock) atomic_mutex_guard :: proc(m: ^Atomic_Mutex) -> bool { atomic_mutex_lock(m) @@ -193,25 +192,24 @@ atomic_rw_mutex_try_shared_lock :: proc(rw: ^Atomic_RW_Mutex) -> bool { return false } - -// Example: -// -// if atomic_rw_mutex_guard(&m) { -// ... -// } -// +/* +Example: + if atomic_rw_mutex_guard(&m) { + ... + } +*/ @(deferred_in=atomic_rw_mutex_unlock) atomic_rw_mutex_guard :: proc(m: ^Atomic_RW_Mutex) -> bool { atomic_rw_mutex_lock(m) return true } -// Example: -// -// if atomic_rw_mutex_shared_guard(&m) { -// ... -// } -// +/* +Example: + if atomic_rw_mutex_shared_guard(&m) { + ... + } +*/ @(deferred_in=atomic_rw_mutex_shared_unlock) atomic_rw_mutex_shared_guard :: proc(m: ^Atomic_RW_Mutex) -> bool { atomic_rw_mutex_shared_lock(m) @@ -270,13 +268,12 @@ atomic_recursive_mutex_try_lock :: proc(m: ^Atomic_Recursive_Mutex) -> bool { return true } - -// Example: -// -// if atomic_recursive_mutex_guard(&m) { -// ... -// } -// +/* +Example: + if atomic_recursive_mutex_guard(&m) { + ... + } +*/ @(deferred_in=atomic_recursive_mutex_unlock) atomic_recursive_mutex_guard :: proc(m: ^Atomic_Recursive_Mutex) -> bool { atomic_recursive_mutex_lock(m) diff --git a/core/sync/sync2/sema_internal.odin b/core/sync/sync2/sema_internal.odin index 64fc4ed96..f4027e908 100644 --- a/core/sync/sync2/sema_internal.odin +++ b/core/sync/sync2/sema_internal.odin @@ -1,3 +1,4 @@ +//+private package sync2 import "core:time" diff --git a/core/sync/sync2/sync_util.odin b/core/sync/sync2/sync_util.odin index 853c3c685..013bf511a 100644 --- a/core/sync/sync2/sync_util.odin +++ b/core/sync/sync2/sync_util.odin @@ -1,12 +1,11 @@ package sync2 - -// Example: -// -// if guard(&m) { -// ... -// } -// +/* +Example: + if guard(&m) { + ... + } +*/ guard :: proc{ mutex_guard, rw_mutex_guard, @@ -17,13 +16,12 @@ guard :: proc{ atomic_recursive_mutex_guard, atomic_rw_mutex_guard, } - -// Example: -// -// if shared_guard(&m) { -// ... -// } -// +/* +Example: + if shared_guard(&m) { + ... + } +*/ shared_guard :: proc{ rw_mutex_shared_guard, atomic_rw_mutex_shared_guard, diff --git a/src/docs_format.cpp b/src/docs_format.cpp index 38e7e20c2..f47fd0945 100644 --- a/src/docs_format.cpp +++ b/src/docs_format.cpp @@ -172,6 +172,8 @@ enum OdinDocEntityFlag : u64 { OdinDocEntityFlag_Var_Thread_Local = 1ull<<40, OdinDocEntityFlag_Var_Static = 1ull<<41, + + OdinDocEntityFlag_Private = 1ull<<50, }; struct OdinDocEntity { diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp index c2d07dc12..0a990cc37 100644 --- a/src/docs_writer.cpp +++ b/src/docs_writer.cpp @@ -815,7 +815,7 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) { String link_name = {}; OdinDocEntityKind kind = OdinDocEntity_Invalid; - u32 flags = 0; + u64 flags = 0; i32 field_group_index = -1; switch (e->kind) { @@ -866,6 +866,9 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) { if (e->flags & EntityFlag_NoAlias) { flags |= OdinDocEntityFlag_Param_NoAlias; } if (e->flags & EntityFlag_AnyInt) { flags |= OdinDocEntityFlag_Param_AnyInt; } } + if (e->scope && (e->scope->flags & (ScopeFlag_File|ScopeFlag_Pkg)) && !is_entity_exported(e)) { + flags |= OdinDocEntityFlag_Private; + } OdinDocString init_string = {}; if (init_expr) { diff --git a/tools/odin-html-docs/odin_html_docs_main.odin b/tools/odin-html-docs/odin_html_docs_main.odin index 89a82ad77..570950dfb 100644 --- a/tools/odin-html-docs/odin_html_docs_main.odin +++ b/tools/odin-html-docs/odin_html_docs_main.odin @@ -543,10 +543,13 @@ write_type :: proc(using writer: ^Type_Writer, type: doc.Type, flags: Write_Type e := entities[type_entites[0]] name := str(type.name) tn_pkg := files[e.pos.file].pkg + if tn_pkg != pkg { fmt.wprintf(w, `%s.`, str(pkgs[tn_pkg].name)) } - if n := strings.contains_rune(name, '('); n >= 0 { + if .Private in e.flags { + io.write_string(w, name) + } else if n := strings.contains_rune(name, '('); n >= 0 { fmt.wprintf(w, `{1:s}`, pkg_to_path[&pkgs[tn_pkg]], name[:n], BASE_CORE_URL) io.write_string(w, name[n:]) } else {