From 4ae210e0c2593587dbcb07fe5ed3a7ce687b8d1d Mon Sep 17 00:00:00 2001 From: eudoxia Date: Fri, 1 Apr 2022 10:45:42 -0400 Subject: software/literary: updated docs --- software/literary/data.html | 71 +++++++++++++++++++------------------------ software/literary/log.html | 29 ++++++------------ software/literary/tangle.html | 33 ++++++++------------ software/literary/weave.html | 31 +++++++------------ 4 files changed, 64 insertions(+), 100 deletions(-) diff --git a/software/literary/data.html b/software/literary/data.html index 0019f3e..66ecb30 100755 --- a/software/literary/data.html +++ b/software/literary/data.html @@ -9,51 +9,42 @@ - - - - +data.lp — DistressNetwork° + + -
-
-
-
-
––––DistressNetwork°
- -
-
-
+
data.lp

This file contains the various data processing-related constants and functions referenced by the tangling and weaving processes.

*:

-
@= Imports =@
+
(Imports)
 
-@= Processing limits =@
+(Processing limits)
 
-@= Formatting keywords =@
+(Formatting keywords)
 
-@= Configuration keywords =@
+(Configuration keywords)
 
-@= Data structure types =@
+(Data structure types)
 
-@= Error set =@
+(Error set)
 
-@= Line splitting function =@
+(Line splitting function)
 
-@= Configuration searching function =@
+(Configuration searching function)
 
-@= Section searching function =@
+(Section searching function)
 
-@= Parsing functions =@
+(Parsing functions)
 
-@= Code generation functions =@
+(Code generation functions)
 
-@= Text generation function =@
+(Text generation function)
 

Constants

@@ -173,7 +164,7 @@ pub const LineRange = struct { var buffer = std.ArrayList([]const u8).init(alloc); defer buffer.deinit(); - @= Split file at each newline =@ + (Split file at each newline) return buffer.toOwnedSlice(); } @@ -212,7 +203,7 @@ while (iterator.next()) |line| { return error.NotFound; } -@= Auxiliary formatting function =@ +(Auxiliary formatting function)

If the declaration is found, its contained format string is split along instances of the section name escape sequence, and each substring has its instances of the newline escape sequence replaced with a literal newline.

@@ -256,7 +247,7 @@ while (iterator.next()) |line| { var sections = std.ArrayList(Section).init(alloc); defer sections.deinit(); - @= Main parsing routine =@ + (Main parsing routine) return sections.toOwnedSlice(); } @@ -265,7 +256,7 @@ fn parse_code(lines: [][]const u8, index: u32, alloc: Allocator) !CodeReturn { var content = std.ArrayList(Content).init(alloc); defer content.deinit(); - @= Code parsing subroutine =@ + (Code parsing subroutine) return CodeReturn{ .content = content.toOwnedSlice(), .index = i + 1 }; } @@ -289,9 +280,9 @@ fn parse_code(lines: [][]const u8, index: u32, alloc: Allocator) !CodeReturn { while (i < lines.len) { const line = lines[i]; if (std.mem.startsWith(u8, line, k_start)) { - @= Add new section =@ + (Add new section) } else if (std.mem.startsWith(u8, line, k_add)) { - @= Append to section =@ + (Append to section) } else if (std.mem.eql(u8, line, k_end)) { log(.err, "line {d}: unexpected section end", .{i + 1}); return error.UnexpectedEnd; @@ -343,11 +334,11 @@ while (i < lines.len) { log(.err, "line {d}: unexpected section start", .{i + 1}); return error.UnexpectedStart; } else if (std.mem.startsWith(u8, std.mem.trimLeft(u8, line, " \t"), k_ref)) { - @= Add reference =@ + (Add reference) } else if (std.mem.eql(u8, line, k_end)) { break; } else { - @= Add literal range =@ + (Add literal range) } } @@ -402,10 +393,10 @@ fn codegen_main(lines: [][]const u8, list: []Section, index: usize, depth: u8, a log(.debug, "generating section '{s}'", .{section.name}); for (section.content) |content| switch (content) { .literal => |range| { - @= Append literal range =@ + (Append literal range) }, .reference => |name| { - @= Resolve reference =@ + (Resolve reference) }, }; @@ -445,7 +436,7 @@ try buffer.appendSlice(code); var buffer = std.ArrayList([]const u8).init(alloc); defer buffer.deinit(); - @= Process configuration declarations =@ + (Process configuration declarations) var current_name: []const u8 = undefined; for (lines) |line| { @@ -455,13 +446,13 @@ try buffer.appendSlice(code); or std.mem.startsWith(u8, line, kc_ref)) { continue; } else if (std.mem.startsWith(u8, line, k_start)) { - @= Format starting command =@ + (Format starting command) } else if (std.mem.startsWith(u8, line, k_add)) { - @= Format appending command =@ + (Format appending command) } else if (std.mem.startsWith(u8, line, k_end)) { - @= Format ending command =@ + (Format ending command) } else if (std.mem.startsWith(u8, std.mem.trimLeft(u8, line, " \t"), k_ref)) { - @= Format reference command =@ + (Format reference command) } else { try buffer.append(line); } diff --git a/software/literary/log.html b/software/literary/log.html index c2bffff..9ebf2dc 100755 --- a/software/literary/log.html +++ b/software/literary/log.html @@ -9,33 +9,24 @@ - - - - +log.lp — DistressNetwork° + + -
-
-
-
-
––––DistressNetwork°
- -
-
-
+
log.lp

This file contains a simple logging function. It is a modified version of the example logging function implementation provided in std.log.

*:

-
@= Imports =@
+
(Imports)
 
-@= Level setting =@
+(Level setting)
 
-@= Logging function =@
+(Logging function)
 

We first import the standard library, and the Level type which is an enum representing the possible log levels.

@@ -62,11 +53,11 @@ const Level = std.log.Level; comptime format: []const u8, args: anytype, ) void { - @= Compare with level threshold =@ + (Compare with level threshold) - @= Define message string =@ + (Define message string) - @= Print to console =@ + (Print to console) }
diff --git a/software/literary/tangle.html b/software/literary/tangle.html index 9d853fe..1559d31 100755 --- a/software/literary/tangle.html +++ b/software/literary/tangle.html @@ -9,44 +9,35 @@ - - - - +tangle.lp — DistressNetwork° + + -
-
-
-
-
––––DistressNetwork°
- -
-
-
+
tangle.lp

The structure of this file is quite similar to that of weave.zig, only differing in terms of which functions are used to transform the input data.

*:

-
@= Imports =@
+
(Imports)
 
 pub fn main() !u8 {
-    @= IO initialization =@
+    (IO initialization)
 
-    @= Allocator initialization =@
+    (Allocator initialization)
 
-    @= Read file from stdin =@
+    (Read file from stdin)
 
-    @= Split into lines =@
+    (Split into lines)
 
-    @= Parse lines into sections =@
+    (Parse lines into sections)
 
-    @= Generate code =@
+    (Generate code)
 
-    @= Write to stdout =@
+    (Write to stdout)
 
     return 0;
 }
diff --git a/software/literary/weave.html b/software/literary/weave.html
index 73ae64f..9edd4f1 100755
--- a/software/literary/weave.html
+++ b/software/literary/weave.html
@@ -9,42 +9,33 @@
 
 
 
-
-
-
-
+weave.lp — DistressNetwork°
+
+
 
 
-
-
-
-
-
––––DistressNetwork°
- -
-
-
+
weave.lp

The structure of this file is quite similar to that of tangle.zig, only differing in terms of which functions are used to transform the input data.

*:

-
@= Imports =@
+
(Imports)
 
 pub fn main() !u8 {
-    @= IO initialization =@
+    (IO initialization)
 
-    @= Allocator initialization =@
+    (Allocator initialization)
 
-    @= Read file from stdin =@
+    (Read file from stdin)
 
-    @= Split into lines =@
+    (Split into lines)
 
-    @= Generate text =@
+    (Generate text)
 
-    @= Write to stdout =@
+    (Write to stdout)
 
     return 0;
 }
-- 
cgit v1.2.3