From 108a0454d05c744c4a05e298cfc8cbf157952414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 12 Sep 2023 10:23:59 +0200 Subject: Rework file tree structure for info files. --- doc/ref/calp-prime.texi | 177 +-------- doc/ref/general.texi | 27 +- doc/ref/general/base64.texi | 22 ++ doc/ref/general/bst.texi | 37 ++ doc/ref/general/crypto.texi | 17 + doc/ref/general/datetime.texi | 670 +++++++++++++++++++++++++++++++++++ doc/ref/general/glob.texi | 37 ++ doc/ref/general/graphviz.texi | 10 + doc/ref/general/io.texi | 31 ++ doc/ref/general/srfi-41.texi | 100 ++++++ doc/ref/general/util-config.texi | 93 +++++ doc/ref/general/util-exceptions.texi | 40 +++ doc/ref/general/util-path.texi | 62 ++++ doc/ref/general/util.texi | 359 +++++++++++++++++++ doc/ref/general/uuid.texi | 17 + doc/ref/general/xdg-basedir.texi | 62 ++++ doc/ref/general/zic.texi | 135 +++++++ doc/ref/guile/base64.texi | 22 -- doc/ref/guile/crypto.texi | 17 - doc/ref/guile/datetime.texi | 670 ----------------------------------- doc/ref/guile/glob.texi | 37 -- doc/ref/guile/graphviz.texi | 10 - doc/ref/guile/srfi-41.texi | 100 ------ doc/ref/guile/translation.texi | 31 -- doc/ref/guile/util-config.texi | 93 ----- doc/ref/guile/util-exceptions.texi | 40 --- doc/ref/guile/util-path.texi | 62 ---- doc/ref/guile/util.texi | 447 ----------------------- doc/ref/guile/vcomponent.texi | 117 ------ doc/ref/guile/web.texi | 92 ----- doc/ref/guile/xdg-basedir.texi | 62 ---- doc/ref/guile/zic.texi | 135 ------- doc/ref/vcomponent.texi | 115 +++++- doc/ref/vulgar.texi | 238 +------------ doc/ref/vulgar/color.texi | 18 + doc/ref/vulgar/termios.texi | 217 ++++++++++++ doc/ref/web.texi | 2 +- doc/ref/web/web.texi | 92 +++++ 38 files changed, 2154 insertions(+), 2359 deletions(-) create mode 100644 doc/ref/general/base64.texi create mode 100644 doc/ref/general/bst.texi create mode 100644 doc/ref/general/crypto.texi create mode 100644 doc/ref/general/datetime.texi create mode 100644 doc/ref/general/glob.texi create mode 100644 doc/ref/general/graphviz.texi create mode 100644 doc/ref/general/io.texi create mode 100644 doc/ref/general/srfi-41.texi create mode 100644 doc/ref/general/util-config.texi create mode 100644 doc/ref/general/util-exceptions.texi create mode 100644 doc/ref/general/util-path.texi create mode 100644 doc/ref/general/util.texi create mode 100644 doc/ref/general/uuid.texi create mode 100644 doc/ref/general/xdg-basedir.texi create mode 100644 doc/ref/general/zic.texi delete mode 100644 doc/ref/guile/base64.texi delete mode 100644 doc/ref/guile/crypto.texi delete mode 100644 doc/ref/guile/datetime.texi delete mode 100644 doc/ref/guile/glob.texi delete mode 100644 doc/ref/guile/graphviz.texi delete mode 100644 doc/ref/guile/srfi-41.texi delete mode 100644 doc/ref/guile/translation.texi delete mode 100644 doc/ref/guile/util-config.texi delete mode 100644 doc/ref/guile/util-exceptions.texi delete mode 100644 doc/ref/guile/util-path.texi delete mode 100644 doc/ref/guile/util.texi delete mode 100644 doc/ref/guile/vcomponent.texi delete mode 100644 doc/ref/guile/web.texi delete mode 100644 doc/ref/guile/xdg-basedir.texi delete mode 100644 doc/ref/guile/zic.texi create mode 100644 doc/ref/vulgar/color.texi create mode 100644 doc/ref/vulgar/termios.texi create mode 100644 doc/ref/web/web.texi diff --git a/doc/ref/calp-prime.texi b/doc/ref/calp-prime.texi index 89decb1b..a13cbd0b 100644 --- a/doc/ref/calp-prime.texi +++ b/doc/ref/calp-prime.texi @@ -1,179 +1,8 @@ @node Calp as a Program @chapter Calp as a Program -@include guile/translation.texi +@include calp/translation.texi +@include calp/error.texi +@include calp/other.texi -@node Errors and Conditions -@section Errors and Conditions - -@subsection ``Special'' Errors - -@deftp{Error type} return -Thrown in some sub-mains to quickly return from the sub-function. -Should possibly be replaced by an explicit return-continuation. -@end deftp - -@deftp{Error type} warning fmt args -Thrown when @code{warnings-are-errors} is true. - -@ref{warning} for more information. -@end deftp - -@deftp{Error type} max-page page-number -@end deftp - -@subsection ``Regular'' Errors -All below mentioned error types behave as expected, e.g., they are -produced through @code{scm-error}. - -@deftp{Error Type} configuration-error -Thrown by (calp util config), in some scenarios. -@TODO{Better documentation} -@end deftp - -@deftp{Error Type} c-parse-error -Errors thrown by our make-shift C parser. -@end deftp - -@deftp{Error Type} decoding-error -thrown by base64 in some cases -@end deftp - -@deftp{Error Type} parse-error -Thrown by some things related to parsing, but not all. -@TODO{normalize parsing errors further} -@end deftp - -@deftp{Error Type} graph-error -The first element of data is guaranteed to be the graph which caused -the error. -@end deftp - -@deftp{Error Type} missing-helper -A helper program we wanted was missing, could be resolved by somehow -downloading it into one of the searched locations. - -@example -data : (program-name : string) - , (searched-locations : (list string)) -@end example -@end deftp - - - -@node Other -@section Other - -@defun get-parser type -@example -get-parser ∷ type-name → hash-table x string → any -type = 'BINARY | 'BOOLEAN | 'CAL-ADDRES | 'DATE | 'DATE-TIME - | 'DURATION | 'FLOAT | 'INTEGER | 'PERIOD | 'RECUR - | 'TEXT | 'TIME | 'URI | 'UTC-OFFSET -@end example - -@ref{ical-get-writer} -@end defun - -@subsection formats ical -@subsubsection output - -@defun component->ical-string component -@end defun - -@defun print-components-with-fake-parent events -@end defun - -@defun print-all-events -@end defun - -@defun print-events-in-interval start end -@end defun - -@subsubsection parse - -@defun parse-calendar port -@end defun - -@subsubsection types - -@defun escape-chars str -Escape @code{,}, @code{;} and @code{\} with a -backslash, and encode newlines as @code{\n}. -@end defun - -@defun get-writer type -@anchor{ical-get-writer} -@example -get-writer ∷ type-name → hash-table x value → string -type = 'BINARY | 'BOOLEAN | 'CAL-ADDRES | 'DATE | 'DATE-TIME - | 'DURATION | 'FLOAT | 'INTEGER | 'PERIOD | 'RECUR - | 'TEXT | 'TIME | 'URI | 'UTC-OFFSET -@end example -@end defun - -@subsection formats vdir -@subsubsection parse - -@defun parse-vdir path -@end defun - -@subsubsection save-delete - -@defun save-event event -@end defun - -@defun remove-event event -@end defun - -@subsection formats xcal -@subsubsection output - -@defun vcomponent->sxcal component -@end defun - -@defun ns-wrap -@lisp -(define (ns-wrap sxml) - `(icalendar (@@ (xmlns "urn:ietf:params:xml:ns:icalendar-2.0")) - ,sxml)) -@end lisp -Where @var{sxml} is expected to be the output of @var{vcomponent->sxcal}. -@end defun - -@subsubsection parse -@defun sxcal->vcomponent sxcal -Parses a vcomponent in sxcal format. Requires that the vcomponent is -the root of the document (fragment), so wrapping icalendar-tags or -similar @emph{must} be removed. - -@example -(vcalendar - (properties ...) - (components ...)) -@end example -@end defun - -@subsubsection types -@defun get-writer type -@ref{ical-get-writer} -@end defun - - -@c -------------------------------------------------- - -@c TODO -This chapter will probably in the future be replaced by a proper -system overview in the future. - -@c module (vcomponent control) - -@defmac with-replaced-properties (component (key value) ...) body ... -Through the extent of @var{body} each @var{key}'s value in -@var{component} is replaced by its repspective @var{value}. - -Note that @var{body} is guarded through a dynamic-wind, meaning that -even non-local exits will restore @var{component} to its initial -state. -@end defmac diff --git a/doc/ref/general.texi b/doc/ref/general.texi index 0b54205a..be68fca6 100644 --- a/doc/ref/general.texi +++ b/doc/ref/general.texi @@ -1,15 +1,18 @@ @node Generally Useful Utilities @chapter Generally Useful Utilities -@include guile/datetime.texi -@include guile/zic.texi -@include guile/srfi-41.texi -@include guile/util.texi -@include guile/util-path.texi -@include guile/util-config.texi -@include guile/util-exceptions.texi -@include guile/base64.texi -@include guile/xdg-basedir.texi -@include guile/glob.texi -@include guile/graphviz.texi -@include guile/crypto.texi +@include general/datetime.texi +@include general/zic.texi +@include general/srfi-41.texi +@include general/util.texi +@include general/uuid.texi +@include general/io.texi +@include general/bst.texi +@include general/util-path.texi +@include general/util-config.texi +@include general/util-exceptions.texi +@include general/base64.texi +@include general/xdg-basedir.texi +@include general/glob.texi +@include general/graphviz.texi +@include general/crypto.texi diff --git a/doc/ref/general/base64.texi b/doc/ref/general/base64.texi new file mode 100644 index 00000000..ab6bba81 --- /dev/null +++ b/doc/ref/general/base64.texi @@ -0,0 +1,22 @@ +@node Base64 +@section Base64 + +@defun base64->bytevector bv +@defunx bytevector->base64 bv +Base procedure for all Base64 operations. +Takes and returns bytevectors. + +Throws @code{decoding-error} on invalid input. +@end defun + +@defun base64-string->bytevector string +@defunx bytevector->base64-string bv +Base64 side is strings, while data is bytevectors. +@end defun + + +@defun base64encode string [transcoder=(native-transcoder)] +@defunx base64decode string [transcoder=(native-transcoder)] +Highest level Base64 procedures. Both encoded and decoded data is +strings. +@end defun diff --git a/doc/ref/general/bst.texi b/doc/ref/general/bst.texi new file mode 100644 index 00000000..d2bba0ff --- /dev/null +++ b/doc/ref/general/bst.texi @@ -0,0 +1,37 @@ +@node Binary Search Tree +@section Binary Search Tree + +A simple ``read only'' binary search tree. + +@defun make-tree pred? lst +Constructs a new tree. @var{pred?} should be a procedure taking the +first element of @var{lst}, along with each element, and should return +a boolean value indicating if the specific element should go in the +left or right subtree. (left subtree is ``truthy'' values). + +This operation is done recursively. +@end defun + +@defun tree-node tree +Return the value of a tree node. +@end defun + +@defun left-subtree tree +Return all ``truthy'' children of tree node. +@end defun + +@defun right-subtree tree +Return all ``falsy children of tree node. +@end defun + +@defun length-of-longest-branch tree +Get the depth of a tree. +@end defun + +@defun tree-map proc tree +Apply proc onto the value of every node in tree, keeping the structure +of the tree. + +@b{Note:} this can cause the tree to no longer be a binary search +tree, but simply a ``formless'' binary tree. +@end defun diff --git a/doc/ref/general/crypto.texi b/doc/ref/general/crypto.texi new file mode 100644 index 00000000..b9e362d3 --- /dev/null +++ b/doc/ref/general/crypto.texi @@ -0,0 +1,17 @@ +@node Cryptographic and Hash Procedures +@section Cryptographic and Hash Procedures + +This module links libcrypto, exposing some hash procedures. + +@defun sha256 message +Calculate the sha256-sum of @var{message}. The message can either be a +bytevector or a string (in which case it will de encoded as UTF-8). + +Returns the checksum as a bytevector. +@end defun + +@defun checksum->string message-digest [port] +Generates a hex digest string from a checksum (generated by +@code{sha256}). The checksum is written to @var{port} if given, or +returned as a string otherwise. +@end defun diff --git a/doc/ref/general/datetime.texi b/doc/ref/general/datetime.texi new file mode 100644 index 00000000..037ac8d5 --- /dev/null +++ b/doc/ref/general/datetime.texi @@ -0,0 +1,670 @@ +@node Datetime +@section Datetime + +My datetime library, with focus on date manipulation in ways sensible +for humans. So that a date-time plus one day always keep the time of +day. +For example, 26 mars 2022 10:00 plus 1 day would give 27 mars 2022 +10:00, even though 25 hours have passed due to summer time starting +(in Sweden). + +Note that while some of these procedures mentions timezones, almost +nothing is actually done with it. + +@subsection Constants + +@defvar jan +@defvarx january +@defvarx feb +@defvarx february +@defvarx mar +@defvarx mars +@defvarx apr +@defvarx april +@defvarx may +@defvarx jun +@defvarx june +@defvarx jul +@defvarx july +@defvarx aug +@defvarx august +@defvarx sep +@defvarx september +@defvarx oct +@defvarx october +@defvarx nov +@defvarx november +@defvarx dec +@defvarx december +Numeric constants for all months. +@code{@var{jan} = 1}, @code{@var{dec} = 12}. +@end defvar + +@defvar sun +@defvarx sunday +@defvarx mon +@defvarx monday +@defvarx tue +@defvarx tuesday +@defvarx wed +@defvarx wednesday +@defvarx thu +@defvarx thursday +@defvarx fri +@defvarx friday +@defvarx sat +@defvarx saturday +@anchor{sunday} +Numeric constants for all weekdays. +@code{@var{sunday} = 0}, @code{@var{saturday} = 6}. +@end defvar + +@subsection Parameters and Configuration + +@deftp {parameter} week-start +@anchor{week-start} +Which weekday should be considered the first. Used for calculating +week numbers, the start dates of week, and is available for UI-code +and the like which wants it. +@end deftp + +@deftp {config} week-start +Configuration item, updates @xref{week-start}. +@end deftp + + +@subsection Datatypes + +@deftp {Immutable Record} year month day +Object representing a date, without any timezone information. +Given the date 2040-03-23 (in ISO-8601 format), @var{year} = 2020, +@var{month} = 3 and @var{day} = 23. + +Values higher than those usually used are possible, but not recommended. + +@defun date? x +Is @var{x} a date object? +@end defun + +@defun date [#:year=0] [#:month=0] [#:day=0] +Create a new date object. +@end defun + +@defun year +@defunx month +@defunx day +Fetch corresponding field from the date object. +@end defun +@end deftp + +@deftp {Immutable Record}