(html (head (title "sph-lib (sph module)") (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2023-04-05") (section (h1 "(sph module)") (div (p "guile module system and rnrs library related procedures") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) ((section (@ (class "library-description")) (h1 "library description") (div (p "# syntax") (p "module-compose :: dest source ...") (p (((*ENTITY* "nbsp") (*ENTITY* "nbsp")) "define a new module dest with all exported bindings of the specified sources.")) (p (((*ENTITY* "nbsp") (*ENTITY* "nbsp")) "example: (module-compose (my-module) (rnrs base) (rnrs sorting))")) (p "import-unexported :: unquoted-module-name unquoted-binding-name") (p (((*ENTITY* "nbsp") (*ENTITY* "nbsp")) "imports and defines the binding locally at place")))) (section (@ (class "library-name")) (h1 "module name") (p "(sph module)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "environment*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "environment*") " " (span (@ (class "first-sig")) "name ... ->")) (div (@ (class "rest-sig")) (div "(symbol ...) ... -> environment/module")) (div (@ (class "description")) (("similar to \\\"environment\\\" from (rnrs eval)." (br) "this can be used to load modules that use syntax to create their module definition." (br) "the modules contents are first evaluated in the top-level environment - before the environment object is created." (br) "the syntax used for creating the module definition must be available in the current top-level environment." (br) "only the \\\".scm\\\" filename-extension is supported when resolving file paths from module names for loading")))) (div (@ (id "doc-b-" "import-unexported") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "import-unexported") " " (span (@ (class "first-sig")) "module-name binding-name")) "" "") (div (@ (id "doc-b-" "load-with-environment") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "load-with-environment") " " (span (@ (class "first-sig")) "path env ->")) (div (@ (class "rest-sig")) (div "string module ->")) (div (@ (class "description")) (("load filename and evaluate its contents with the given eval environment which may be a module, a r6rs library or a environment")))) (div (@ (id "doc-b-" "module-compose") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "module-compose") " " (span (@ (class "first-sig")) "dest-name r6rs-import-spec ...")) "" "") (div (@ (id "doc-b-" "module-current-bindings") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "module-current-bindings")) "" (div (@ (class "description")) (("return a guile-hashtable of all bindings in the current module")))) (div (@ (id "doc-b-" "module-dependencies") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-dependencies") " " (span (@ (class "first-sig")) "module ->")) (div (@ (class "rest-sig")) (div "module -> (module ...)")) "") (div (@ (id "doc-b-" "module-exports") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-exports") " " (span (@ (class "first-sig")) "module ->")) (div (@ (class "rest-sig")) (div "module -> (symbol ...)")) (div (@ (class "description")) (("list of exported binding names")))) (div (@ (id "doc-b-" "module-file->name") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-file->name") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "string -> (symbol ...)/false")) (div (@ (class "description")) (("read file at the given path and, check the first expression for an r6rs or r7rs library definition" (br) "and extract the module name")))) (div (@ (id "doc-b-" "module-file?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-file?") " " (span (@ (class "first-sig")) "path ->")) (div (@ (class "rest-sig")) (div "string -> boolean")) (div (@ (class "description")) (("true if file contains as the first expression an r6rs or r7rs library definition")))) (div (@ (id "doc-b-" "module-find") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-find") " " (span (@ (class "first-sig")) "path #:max-depth #:load-path #:guile-modules #:ignore-content #:file-content-match #:ignore-load-path #:enter? ->")) (div (@ (class "rest-sig")) (div "string module-find-one-arguments ... -> ((module-name . path) ...)")) (div (@ (class "description")) (("get all names for modules under or at path using module-find-one")))) (div (@ (id "doc-b-" "module-find-by-name") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-find-by-name") " " (span (@ (class "first-sig")) "name search-type load-paths ->")) (div (@ (class "rest-sig")) (div "(symbol ...) symbol:exact/prefix/prefix-not-exact (string ...) -> ((symbol ...):module-name ...)")) (div (@ (class "description")) (("find module names by module name part")))) (div (@ (id "doc-b-" "module-find-one") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-find-one") " " (span (@ (class "first-sig")) "path #:load-path #:ignore-content #:ignore-load-path #:guile-modules #:file-content-match ->")) (div (@ (class "rest-sig")) (div "string [#:load-path (string ...) #:guile-modules boolean #:ignore-content boolean] -> false/(symbol ...):module-name")) (div (@ (class "description")) (("setting the right load-path is important because the module name is derived from it." (br) "a file is considered a valid module if:" (br) " it exists and is a regular file" (br) " the file name extension is \\\".scm\\\"" (br) " the file contains as the first expression an r6rs library or r7rs define-library form" (br) " if \\\"guile-modules\\\" is true: the file contains a define-module form" (br) " it is in a load path and the module name matches the path under a load path (using %load-paths)")))) (div (@ (id "doc-b-" "module-fold") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-fold") " " (span (@ (class "first-sig")) "proc init module ->")) "" (div (@ (class "description")) (("procedure:{name any:value any:init} any (symbol ...) -> any" (br) "fold over the exported, bound variables for the given module-name")))) (div (@ (id "doc-b-" "module-match-guile-definition") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-match-guile-definition") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any -> false/list:module-name")) (div (@ (class "description")) (("matches a guile \\\"define-module\\\" form and returns the module name")))) (div (@ (id "doc-b-" "module-match-rnrs-definition") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-match-rnrs-definition") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any -> false/list:module-name")) (div (@ (class "description")) (("matches a r6rs or r7rs library definition and returns the module name")))) (div (@ (id "doc-b-" "module-name->load-path-and-path") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "module-name->load-path-and-path") " " (span (@ (class "first-sig")) "a filename-extension load-path c ->")) (div (@ (class "rest-sig")) (div "(symbol ...) string (string ...) procedure:{string:load-path string:full-path -> any} -> any")) (div (@ (class "description")) (("finds the load path under which a possibly partial (prefix) module name is saved." (br) "if no filename-extension is given it will usually only match directories")))) (div (@ (id "doc-b-" "module-re-export-module") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "module-re-export-module") " " (span (@ (class "first-sig")) "module-name ...")) "" (div (@ (class "description")) (("modules must have already been imported")))) (div (@ (id "doc-b-" "path->load-path") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "path->load-path") " " (span (@ (class "first-sig")) "path [load-path] ->")) (div (@ (class "rest-sig")) (div "string -> false/path")) (div (@ (class "description")) (("returns the first found load-path where path can be found." (br) "works for full and relative paths")))) (div (@ (id "doc-b-" "sph-module-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-module-description")) "" "") (div (@ (id "doc-b-" "symbol-list->path") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "symbol-list->path") " " (span (@ (class "first-sig")) "a [filename-extension] ->")) (div (@ (class "rest-sig")) (div "(symbol ...) string -> string")) (div (@ (class "description")) (("creates a filesystem path string from a module name. module existence is not checked." (br) "filename-extension can be false so that for example directory paths can be created"))))))))))) ()))