\n", title)
fmt.wprintln(w, ``)
- for e in entities {
- print_entity(w, e)
+ if len(entities) == 0 {
+ io.write_string(w, "
This section is empty.
\n")
+ } else {
+ for e in entities {
+ print_entity(w, e)
+ }
}
fmt.wprintln(w, "")
}
From c85ac955f798fefd149a5eeaecabf0713210b152 Mon Sep 17 00:00:00 2001
From: gingerBill
Date: Mon, 17 Jan 2022 19:00:47 +0000
Subject: [PATCH 05/37] Simplify docs to hide the copyright
---
core/compress/common.odin | 3 +++
core/encoding/hxa/doc.odin | 12 ++++++------
core/fmt/doc.odin | 2 +-
core/image/common.odin | 2 ++
core/image/png/png.odin | 5 +++++
core/math/big/api.odin | 6 ++----
core/math/big/common.odin | 6 ++----
core/math/big/doc.odin | 28 ++++++++++++++++++++++++++++
core/math/big/helpers.odin | 6 ++----
core/math/big/internal.odin | 28 ++--------------------------
core/math/big/logical.odin | 2 ++
core/math/big/prime.odin | 2 ++
core/math/big/private.odin | 2 ++
core/math/big/public.odin | 2 ++
core/math/big/radix.odin | 2 ++
core/math/big/tune.odin | 2 ++
16 files changed, 65 insertions(+), 45 deletions(-)
create mode 100644 core/math/big/doc.odin
diff --git a/core/compress/common.odin b/core/compress/common.odin
index 41f292b6f..5f5ef2413 100644
--- a/core/compress/common.odin
+++ b/core/compress/common.odin
@@ -5,6 +5,9 @@
List of contributors:
Jeroen van Rijn: Initial implementation, optimization.
*/
+
+
+// package compress is a collection of utilities to aid with other compression packages
package compress
import "core:io"
diff --git a/core/encoding/hxa/doc.odin b/core/encoding/hxa/doc.odin
index 16b94a243..230d6ea66 100644
--- a/core/encoding/hxa/doc.odin
+++ b/core/encoding/hxa/doc.odin
@@ -27,7 +27,7 @@
// Construction history, or BSP trees would make the format too large to serve its purpose.
// The facilities of the formats to store meta data should make the format flexible enough
// for most uses. Adding HxA support should be something anyone can do in a days work.
-
+//
// Structure:
// ----------
// HxA is designed to be extremely simple to parse, and is therefore based around conventions. It has
@@ -45,17 +45,17 @@
// of a number of named layers. All layers in the stack have the same number of elements. Each layer
// describes one property of the primitive. Each layer can have multiple channels and each layer can
// store data of a different type.
-
+//
// HaX stores 3 kinds of nodes
// - Pixel data.
// - Polygon geometry data.
// - Meta data only.
-
+//
// Pixel Nodes stores pixels in a layer stack. A layer may store things like Albedo, Roughness,
// Reflectance, Light maps, Masks, Normal maps, and Displacement. Layers use the channels of the
// layers to store things like color. The length of the layer stack is determined by the type and
// dimensions stored in the
-
+//
// Geometry data is stored in 3 separate layer stacks for: vertex data, corner data and face data. The
// vertex data stores things like verities, blend shapes, weight maps, and vertex colors. The first
// layer in a vertex stack has to be a 3 channel layer named "position" describing the base position
@@ -63,7 +63,7 @@
// for things like UV, normals, and adjacency. The first layer in a corner stack has to be a 1 channel
// integer layer named "index" describing the vertices used to form polygons. The last value in each
// polygon has a negative - 1 index to indicate the end of the polygon.
-
+//
// Example:
// A quad and a tri with the vertex index:
// [0, 1, 2, 3] [1, 4, 2]
@@ -72,7 +72,7 @@
// The face stack stores values per face. the length of the face stack has to match the number of
// negative values in the index layer in the corner stack. The face stack can be used to store things
// like material index.
-
+//
// Storage
// -------
// All data is stored in little endian byte order with no padding. The layout mirrors the structs
diff --git a/core/fmt/doc.odin b/core/fmt/doc.odin
index 5984da950..668fc9bc6 100644
--- a/core/fmt/doc.odin
+++ b/core/fmt/doc.odin
@@ -64,6 +64,7 @@ If not present, the width is whatever is necessary to represent the value.
Precision is specified after the (optional) width followed by a period followed by a decimal number.
If no period is present, a default precision is used.
A period with no following number specifies a precision of 0.
+
Examples:
%f default width, default precision
%8f width 8, default precision
@@ -84,7 +85,6 @@ Other flags:
add leading 0z for dozenal (%#z)
add leading 0x or 0X for hexadecimal (%#x or %#X)
remove leading 0x for %p (%#p)
-
' ' (space) leave a space for elided sign in numbers (% d)
0 pad with leading zeros rather than spaces
diff --git a/core/image/common.odin b/core/image/common.odin
index 3ec8e15be..d72b770d5 100644
--- a/core/image/common.odin
+++ b/core/image/common.odin
@@ -6,6 +6,8 @@
Jeroen van Rijn: Initial implementation, optimization.
Ginger Bill: Cosmetic changes.
*/
+
+// package image implements a general 2D image library to be used with other image related packages
package image
import "core:bytes"
diff --git a/core/image/png/png.odin b/core/image/png/png.odin
index da76a4588..bff0afde3 100644
--- a/core/image/png/png.odin
+++ b/core/image/png/png.odin
@@ -6,6 +6,11 @@
Jeroen van Rijn: Initial implementation.
Ginger Bill: Cosmetic changes.
*/
+
+
+// package png implements a PNG image reader
+//
+// The PNG specification is at https://www.w3.org/TR/PNG/.
package png
import "core:compress"
diff --git a/core/math/big/api.odin b/core/math/big/api.odin
index c9be04da0..bf19e83b6 100644
--- a/core/math/big/api.odin
+++ b/core/math/big/api.odin
@@ -2,12 +2,10 @@
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
- An arbitrary precision mathematics implementation in Odin.
- For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
- The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
-
This file collects public proc maps and their aliases.
*/
+
+
package math_big
/*
diff --git a/core/math/big/common.odin b/core/math/big/common.odin
index 31ad54b14..2b34a9163 100644
--- a/core/math/big/common.odin
+++ b/core/math/big/common.odin
@@ -1,11 +1,9 @@
/*
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
-
- An arbitrary precision mathematics implementation in Odin.
- For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
- The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
*/
+
+
package math_big
import "core:intrinsics"
diff --git a/core/math/big/doc.odin b/core/math/big/doc.odin
new file mode 100644
index 000000000..f5e0900f5
--- /dev/null
+++ b/core/math/big/doc.odin
@@ -0,0 +1,28 @@
+/*
+A BigInt implementation in Odin.
+For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
+The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
+
+========================== Low-level routines ==========================
+
+IMPORTANT: `internal_*` procedures make certain assumptions about their input.
+
+The public functions that call them are expected to satisfy their sanity check requirements.
+This allows `internal_*` call `internal_*` without paying this overhead multiple times.
+
+Where errors can occur, they are of course still checked and returned as appropriate.
+
+When importing `math:core/big` to implement an involved algorithm of your own, you are welcome
+to use these procedures instead of their public counterparts.
+
+Most inputs and outputs are expected to be passed an initialized `Int`, for example.
+Exceptions include `quotient` and `remainder`, which are allowed to be `nil` when the calling code doesn't need them.
+
+Check the comments above each `internal_*` implementation to see what constraints it expects to have met.
+
+We pass the custom allocator to procedures by default using the pattern `context.allocator = allocator`.
+This way we don't have to add `, allocator` at the end of each call.
+
+TODO: Handle +/- Infinity and NaN.
+*/
+package math_big
diff --git a/core/math/big/helpers.odin b/core/math/big/helpers.odin
index 6d13d32bb..6c4b5dd01 100644
--- a/core/math/big/helpers.odin
+++ b/core/math/big/helpers.odin
@@ -1,11 +1,9 @@
/*
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
-
- An arbitrary precision mathematics implementation in Odin.
- For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
- The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
*/
+
+
package math_big
import "core:intrinsics"
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index 437f6e5fc..5085898e5 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -2,33 +2,9 @@
/*
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
-
- A BigInt implementation in Odin.
- For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
- The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
-
- ========================== Low-level routines ==========================
-
- IMPORTANT: `internal_*` procedures make certain assumptions about their input.
-
- The public functions that call them are expected to satisfy their sanity check requirements.
- This allows `internal_*` call `internal_*` without paying this overhead multiple times.
-
- Where errors can occur, they are of course still checked and returned as appropriate.
-
- When importing `math:core/big` to implement an involved algorithm of your own, you are welcome
- to use these procedures instead of their public counterparts.
-
- Most inputs and outputs are expected to be passed an initialized `Int`, for example.
- Exceptions include `quotient` and `remainder`, which are allowed to be `nil` when the calling code doesn't need them.
-
- Check the comments above each `internal_*` implementation to see what constraints it expects to have met.
-
- We pass the custom allocator to procedures by default using the pattern `context.allocator = allocator`.
- This way we don't have to add `, allocator` at the end of each call.
-
- TODO: Handle +/- Infinity and NaN.
*/
+
+
package math_big
import "core:mem"
diff --git a/core/math/big/logical.odin b/core/math/big/logical.odin
index e7e55cc47..b5de4cabf 100644
--- a/core/math/big/logical.odin
+++ b/core/math/big/logical.odin
@@ -8,6 +8,8 @@
This file contains logical operations like `and`, `or` and `xor`.
*/
+
+
package math_big
/*
diff --git a/core/math/big/prime.odin b/core/math/big/prime.odin
index eb0cd644c..3cce69675 100644
--- a/core/math/big/prime.odin
+++ b/core/math/big/prime.odin
@@ -8,6 +8,8 @@
This file contains prime finding operations.
*/
+
+
package math_big
import rnd "core:math/rand"
diff --git a/core/math/big/private.odin b/core/math/big/private.odin
index 9989a208a..419f2103f 100644
--- a/core/math/big/private.odin
+++ b/core/math/big/private.odin
@@ -15,6 +15,8 @@
These aren't exported for the same reasons.
*/
+
+
package math_big
import "core:intrinsics"
diff --git a/core/math/big/public.odin b/core/math/big/public.odin
index 2673a262f..3227d7bc4 100644
--- a/core/math/big/public.odin
+++ b/core/math/big/public.odin
@@ -8,6 +8,8 @@
This file contains basic arithmetic operations like `add`, `sub`, `mul`, `div`, ...
*/
+
+
package math_big
import "core:intrinsics"
diff --git a/core/math/big/radix.odin b/core/math/big/radix.odin
index 760c49d77..2b758dc35 100644
--- a/core/math/big/radix.odin
+++ b/core/math/big/radix.odin
@@ -12,6 +12,8 @@
- Use Barrett reduction for non-powers-of-two.
- Also look at extracting and splatting several digits at once.
*/
+
+
package math_big
import "core:intrinsics"
diff --git a/core/math/big/tune.odin b/core/math/big/tune.odin
index d67ff61b4..64a73b656 100644
--- a/core/math/big/tune.odin
+++ b/core/math/big/tune.odin
@@ -7,6 +7,8 @@
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
*/
+
+
package math_big
import "core:time"
From 8eda7567141316627973d0018bfb7e80ebdf90aa Mon Sep 17 00:00:00 2001
From: gingerBill
Date: Mon, 17 Jan 2022 19:01:16 +0000
Subject: [PATCH 06/37] Add printing for constants, variables, types, and
procedure groups
---
tools/odin-html-docs/odin_html_docs_main.odin | 97 +++++++++++++++----
tools/odin-html-docs/style.css | 6 +-
2 files changed, 83 insertions(+), 20 deletions(-)
diff --git a/tools/odin-html-docs/odin_html_docs_main.odin b/tools/odin-html-docs/odin_html_docs_main.odin
index 3cbc0d860..d1e4f4432 100644
--- a/tools/odin-html-docs/odin_html_docs_main.odin
+++ b/tools/odin-html-docs/odin_html_docs_main.odin
@@ -114,27 +114,30 @@ main :: proc() {
entities = array(header.entities)
types = array(header.types)
- fullpaths: [dynamic]string
- defer delete(fullpaths)
+ {
+ fullpaths: [dynamic]string
+ defer delete(fullpaths)
- for pkg in pkgs[1:] {
- append(&fullpaths, str(pkg.fullpath))
- }
- path_prefix := common_prefix(fullpaths[:])
-
- pkgs_to_use = make(map[string]^doc.Pkg)
- for fullpath, i in fullpaths {
- path := strings.trim_prefix(fullpath, path_prefix)
- if strings.has_prefix(path, "core/") {
- pkgs_to_use[strings.trim_prefix(path, "core/")] = &pkgs[i+1]
+ for pkg in pkgs[1:] {
+ append(&fullpaths, str(pkg.fullpath))
+ }
+ path_prefix := common_prefix(fullpaths[:])
+
+ pkgs_to_use = make(map[string]^doc.Pkg)
+ for fullpath, i in fullpaths {
+ path := strings.trim_prefix(fullpath, path_prefix)
+ if strings.has_prefix(path, "core/") {
+ pkgs_to_use[strings.trim_prefix(path, "core/")] = &pkgs[i+1]
+ }
+ }
+ sort.map_entries_by_key(&pkgs_to_use)
+ for path, pkg in pkgs_to_use {
+ pkg_to_path[pkg] = path
}
- }
- sort.map_entries_by_key(&pkgs_to_use)
- for path, pkg in pkgs_to_use {
- pkg_to_path[pkg] = path
}
b := strings.make_builder()
+ defer strings.destroy_builder(&b)
w := strings.to_writer(&b)
{
strings.reset_builder(&b)
@@ -369,7 +372,7 @@ write_type :: proc(using writer: ^Type_Writer, type: doc.Type, flags: Write_Type
if tn_pkg != pkg {
fmt.wprintf(w, `%s.`, str(pkgs[pkg].name))
}
- fmt.wprintf(w, `{1:s}`, pkg_to_path[&pkgs[tn_pkg]], name)
+ fmt.wprintf(w, `{1:s}`, pkg_to_path[&pkgs[tn_pkg]], name)
case .Generic:
name := str(type.name)
io.write_byte(w, '$')
@@ -694,12 +697,49 @@ write_pkg :: proc(w: io.Writer, path: string, pkg: ^doc.Pkg) {
case .Invalid, .Import_Name, .Library_Name:
// ignore
case .Constant:
+ fmt.wprint(w, "
")
diff --git a/tools/odin-html-docs/style.css b/tools/odin-html-docs/style.css
index 61cab3e8c..cf43a7199 100644
--- a/tools/odin-html-docs/style.css
+++ b/tools/odin-html-docs/style.css
@@ -21,7 +21,7 @@
pre {
white-space: pre-wrap;
- word-break: break-all;
+ word-break: keep-all;
word-wrap: break-word;
tab-size: 8;
font-family: Consolas,Liberation Mono,Menlo,monospace!important;
@@ -44,10 +44,15 @@ pre a {
}
.documentation-source {
+ display: inline;
+ float: right;
+}
+
+.documentation-source a {
text-decoration: none;
color: #666666;
}
-.documentation-source:hover {
+.documentation-source a:hover {
text-decoration: underline;
}
@@ -56,4 +61,27 @@ a > .a-hidden {
}
a:hover > .a-hidden {
opacity: 100;
+}
+
+ul.documentation-breadcrumb {
+ list-style: none;
+}
+
+ul.documentation-breadcrumb li {
+ display: inline;
+}
+
+ul.documentation-breadcrumb li+li:before {
+ padding: 0.2rem;
+ color: black;
+ content: "/\00a0";
+}
+
+.code-inline {
+ font-family: Consolas,Liberation Mono,Menlo,monospace!important;
+ background-color: #f8f8f8;
+ color: #202224;
+ border: 1px solid #c6c8ca;
+ border-radius: 0.25rem;
+ padding: 0.125rem;
}
\ No newline at end of file
From fb01dfe04845a489760956cea4f0019e1464b2e3 Mon Sep 17 00:00:00 2001
From: gingerBill
Date: Mon, 17 Jan 2022 22:17:07 +0000
Subject: [PATCH 12/37] Improve docs_writer.cpp
---
core/math/big/doc.odin | 22 ----------------------
core/math/big/internal.odin | 24 +++++++++++++++++++++++-
core/math/big/tune.odin | 3 +--
src/docs_writer.cpp | 2 +-
src/types.cpp | 14 +++++---------
5 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/core/math/big/doc.odin b/core/math/big/doc.odin
index f5e0900f5..0f9b88d01 100644
--- a/core/math/big/doc.odin
+++ b/core/math/big/doc.odin
@@ -2,27 +2,5 @@
A BigInt implementation in Odin.
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
-
-========================== Low-level routines ==========================
-
-IMPORTANT: `internal_*` procedures make certain assumptions about their input.
-
-The public functions that call them are expected to satisfy their sanity check requirements.
-This allows `internal_*` call `internal_*` without paying this overhead multiple times.
-
-Where errors can occur, they are of course still checked and returned as appropriate.
-
-When importing `math:core/big` to implement an involved algorithm of your own, you are welcome
-to use these procedures instead of their public counterparts.
-
-Most inputs and outputs are expected to be passed an initialized `Int`, for example.
-Exceptions include `quotient` and `remainder`, which are allowed to be `nil` when the calling code doesn't need them.
-
-Check the comments above each `internal_*` implementation to see what constraints it expects to have met.
-
-We pass the custom allocator to procedures by default using the pattern `context.allocator = allocator`.
-This way we don't have to add `, allocator` at the end of each call.
-
-TODO: Handle +/- Infinity and NaN.
*/
package math_big
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index 5085898e5..dbcd16509 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -1,10 +1,32 @@
-//+ignore
/*
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
+
+ ========================== Low-level routines ==========================
+
+ IMPORTANT: `internal_*` procedures make certain assumptions about their input.
+
+ The public functions that call them are expected to satisfy their sanity check requirements.
+ This allows `internal_*` call `internal_*` without paying this overhead multiple times.
+
+ Where errors can occur, they are of course still checked and returned as appropriate.
+
+ When importing `math:core/big` to implement an involved algorithm of your own, you are welcome
+ to use these procedures instead of their public counterparts.
+
+ Most inputs and outputs are expected to be passed an initialized `Int`, for example.
+ Exceptions include `quotient` and `remainder`, which are allowed to be `nil` when the calling code doesn't need them.
+
+ Check the comments above each `internal_*` implementation to see what constraints it expects to have met.
+
+ We pass the custom allocator to procedures by default using the pattern `context.allocator = allocator`.
+ This way we don't have to add `, allocator` at the end of each call.
+
+ TODO: Handle +/- Infinity and NaN.
*/
+//+ignore
package math_big
import "core:mem"
diff --git a/core/math/big/tune.odin b/core/math/big/tune.odin
index 64a73b656..78a20c12b 100644
--- a/core/math/big/tune.odin
+++ b/core/math/big/tune.odin
@@ -1,4 +1,3 @@
-//+ignore
/*
Copyright 2021 Jeroen van Rijn .
Made available under Odin's BSD-3 license.
@@ -8,7 +7,7 @@
The code started out as an idiomatic source port of libTomMath, which is in the public domain, with thanks.
*/
-
+//+ignore
package math_big
import "core:time"
diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp
index 94b43be99..762a2afe1 100644
--- a/src/docs_writer.cpp
+++ b/src/docs_writer.cpp
@@ -513,7 +513,7 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
break;
case Type_Generic:
doc_type.kind = OdinDocType_Generic;
- doc_type.name = odin_doc_write_string(w, type->Generic.name);
+ doc_type.name = odin_doc_write_string(w, type->Generic.entity->token.string);
if (type->Generic.specialized) {
doc_type.types = odin_doc_type_as_slice(w, type->Generic.specialized);
}
diff --git a/src/types.cpp b/src/types.cpp
index f621d4346..6162a5aa8 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -3933,7 +3933,7 @@ gbString write_type_to_string(gbString str, Type *type) {
str = gb_string_appendc(str, " = ");
str = write_exact_value_to_string(str, var->Constant.value);
} else {
- str = gb_string_appendc(str, "=");
+ str = gb_string_appendc(str, " := ");
str = write_exact_value_to_string(str, var->Constant.value);
}
continue;
@@ -3961,14 +3961,10 @@ gbString write_type_to_string(gbString str, Type *type) {
str = gb_string_appendc(str, "typeid/");
str = write_type_to_string(str, var->type);
} else {
- if (var->kind == Entity_TypeName) {
- str = gb_string_appendc(str, "$");
- str = gb_string_append_length(str, name.text, name.len);
- str = gb_string_appendc(str, "=");
- str = write_type_to_string(str, var->type);
- } else {
- str = gb_string_appendc(str, "typeid");
- }
+ str = gb_string_appendc(str, "$");
+ str = gb_string_append_length(str, name.text, name.len);
+ str = gb_string_appendc(str, "=");
+ str = write_type_to_string(str, var->type);
}
}
}
From 6b830f42b6a8baec77ee0c8d12333ca2ad4a296f Mon Sep 17 00:00:00 2001
From: gingerBill
Date: Mon, 17 Jan 2022 23:48:46 +0000
Subject: [PATCH 13/37] Improve stylization with collapsible directories; Fix
name padding
---
tools/odin-html-docs/odin_html_docs_main.odin | 75 ++++++++++++++++---
tools/odin-html-docs/style.css | 63 ++++++++++++++--
2 files changed, 121 insertions(+), 17 deletions(-)
diff --git a/tools/odin-html-docs/odin_html_docs_main.odin b/tools/odin-html-docs/odin_html_docs_main.odin
index 988c54d9d..317d95a5a 100644
--- a/tools/odin-html-docs/odin_html_docs_main.odin
+++ b/tools/odin-html-docs/odin_html_docs_main.odin
@@ -107,6 +107,51 @@ write_html_header :: proc(w: io.Writer, title: string) {
}
write_html_footer :: proc(w: io.Writer) {
+ io.write_string(w, `
+
+`)
fmt.wprintf(w, "