The entry manual
The source src/modules/system/manual built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
The manual: it shows the documentation of each module of the boot image.
A module carries its documentation in its file (the description tables):
- one line that says what the module is, and a text;
- for each export: its name, the name and the type of each parameter, the type of the result, and a text.
The build tool takes all of it from the comments of the source of the module, and the text keeps their Markdown. The manual reads it: a bold word is in the bold weight, a word in italics has a thin line under it, a name of code is in the font of the cells, a list item has its mark and its indentation, and an example is a block. A link is a colored name. A link that opens has a line under it: a link to a module, to an export or to a record of the boot image, and a link to a term of the glossary or to a heading of a guide, whose link page the boot image carries in the resource manual_pages. A declaration of the sources that no module describes has its link page there too: system.word_wait shows its line of Odin and its comment. An address of another host is shown after its link, and does not open. This process reads the file only: it does not load the module, and it does not start it.
The page of a module also says how the module can be used. The system has one kind of file for a module with an entry, a library and a service, so the answer comes from two facts: the module has an entry or not, and it has exports or not.
Keys
- a letter, a digit or a space: added to the filter of the list, which then shows the modules whose name, group or tag holds the filter;
- Escape: the filter is empty again;
- up, down: the module before, the module after, in the list;
- page up, page down: move the text;
- home: the start of the text;
- Tab, Shift+Tab: the focus on the next link, or the one before;
- Enter: open the link with the focus;
- Backspace: the last character of the filter goes; with no filter, back to the page before;
- Control+O: the table of all the modules, as
overview()shows it.
The action bar at the bottom names these keys: a press on an item does what its key does.
The list at the left has the modules of the boot image in groups by their category: the applications, the tools, the system services, the libraries, the demonstrations, then the tests, closed until a click on their heading opens them. Each group is in the order of the alphabet, and the column at the right counts the exports of each module. A click on a name of the list shows that module. A click on a link with a line under it shows the page that it names.
The manual is a service: another process asks for a page with show, and reads a description as a text with about and signature. The other exports give the facts of the modules as tables, which the console combines with where(), sort(), join() and columns().
Start: the console line start("manual"), or the bar of the desktop. A call of connect("manual") from the console also reaches it when it runs.
Grants, as the root service gives them:
- Serve: other processes call its exports through connections.
- Image: it reads the file of each module of the boot image, read-only.
- Replacements: it reads the replacement table, so that a page names the module that a loader gives in place of an import.
- Inspect: it reads the module records of each process that runs. It gives these facts only to a caller that acts for the principal (information.odin).
What it proves: the documentation of a module is in its file, and a reader needs neither its source nor a load of it. It does not prove that a text is true: the build copies the comments, and checks only their form.
The design of the description tables:.
manual module with an entry
- Hash
02d1dc5a096c703f532320f2c68c4c1bd8b0e8d2d254988c3328ec4a8e3b3364- Size
363155 bytes- Exports
17- Imports
1- Imported by
0- License
- MIT
The manual: it shows the documentation of each module of the boot image
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/system/manual |
| Boot image | yes: in the boot image, 363155 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
modules() -> Table(Module) | gives one row for each module of the boot image: its name, its hash, its sizes (code, constants, data, zero), whether it has an entry, its counts of exports, imports and records |
exports(name: Text) -> Table(Export) | gives one row for each export of a module, by name or by hash, with its signature and the rights that it asks of its handles |
imports(name: Text) -> Table(Import) | gives one row for each import of a module, by name or by hash: the hash and the name of the imported module, its import slots, and the module that the replacement table of the machine gives in its place |
importers(name: Text) -> Table(Import) | gives the imports, in each module of the boot image, of a module, by name or by hash: who imports it |
exporters(name: Text) -> Table(Export) | gives the exports with a name, in each module of the boot image: which modules export a function with this name |
described(words: Text) -> Table(Export) | gives the exports, in each module of the boot image, whose help or documentation holds a text: which modules export a function that does this |
handles(right: Text) -> Table(Export) | gives the exports, in each module of the boot image, that take a handle with a right: Read, Write, Control, and the other rights of the kernel |
import_slots(name: Text) -> Table(Import_Slot) | gives one row for each import slot of a module, by name or by hash: the import and the export that the loader writes in it |
segments(name: Text) -> Table(Segment) | gives one row for each segment of a module, by name or by hash: its kind, its place in memory and in the file |
running() -> Table(Running) | gives one row for each module that runs in a process, from the module records of the kernel: the process, the module, its hash, the hash that a replacement changed, and the writer of the record |
edges() -> Table(Edge) | gives one row for each import edge of each process that runs: the process, a module that runs in it with its hash, the module of the same process that imports it, and the module that a replacement put it in place of |
replacements() -> Table(Replacement) | gives one row for each record of the replacement table of the machine: where an import names the module from, a loader gives the module to |
problem(name: Text) -> Text | gives the first rule of the format that a module breaks, by name or by hash, as a sentence: the table, the record and the byte of the file |
overview() -> Integer | shows in the window the table of all the modules of the boot image: their sizes, their counts of exports and imports, who imports each one, and the processes that run it |
show(name: Text) -> Integer | shows the page of a module of the boot image, by name |
about(name: Text) -> Text | gives the line that says what a module is, by name |
signature(name: Text, export: Integer) -> Text | gives the description of one export of a module as a text: its name, the name and the type of each parameter, and the type of the result |
entry() | The entry of the manual: it opens its service and its window, then serves calls and keys until the principal closes the window |
modules
modules() -> ()
modules gives one row for each module of the boot image: its name, its hash, its sizes (code, constants, data, zero), whether it has an entry, its counts of exports, imports and records.
A module that breaks a rule of the format has a row too: problem, place, index and offset say where, and problem(name) gives the sentence. The rows are records Module.
Result: the count of rows.
exports
exports(name: ) -> ()
exports gives one row for each export of a module, by name or by hash, with its signature and the rights that it asks of its handles.
The module "" gives the exports of each module. The rows are records Export.
Result: the count of rows, or a negative number with an error record:
Absent(-1): no module has this name;Malformed(-2): the module breaks a rule of the format:problem(name)says where.
name:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:79
imports
imports(name: ) -> ()
imports gives one row for each import of a module, by name or by hash: the hash and the name of the imported module, its import slots, and the module that the replacement table of the machine gives in its place.
The module "" gives the imports of each module. The rows are records Import; a replacement is explained in the replacement of an import.
Result: the count of rows, or a negative number with an error record:
name:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:94
importers
importers(name: ) -> ()
importers gives the imports, in each module of the boot image, of a module, by name or by hash: who imports it.
An import that a replacement of the machine changes to this module is a row too. The rows are records Import.
Result: the count of rows, or a negative number with an error record:
Absent(-1): no module has this name.
name:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:108
exporters
exporters(name: ) -> ()
exporters gives the exports with a name, in each module of the boot image: which modules export a function with this name.
The rows are records Export.
Result: the count of rows.
described
described(words: ) -> ()
described gives the exports, in each module of the boot image, whose help or documentation holds a text: which modules export a function that does this.
The text is compared with the line of help of the export, which has no Markdown mark, and with its documentation text, which keeps the marks of its comment: a word between two marks is found, and two words with a mark between them are not. The rows are records Export.
Result: the count of rows.
handles
handles(right: ) -> ()
handles gives the exports, in each module of the boot image, that take a handle with a right: Read, Write, Control, and the other rights of the kernel.
The name of the right is one of Right, as the console writes it. The rows are records Export.
Result: the count of rows, or a negative number with an error record:
Absent(-1): no right has this name.
right:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:147
import_slots
import_slots(name: ) -> ()
import_slots gives one row for each import slot of a module, by name or by hash: the import and the export that the loader writes in it.
The rows are records Import_Slot.
Result: the count of rows, or a negative number with an error record:
name:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:165
segments
segments(name: ) -> ()
segments gives one row for each segment of a module, by name or by hash: its kind, its place in memory and in the file.
The rows are records Segment.
Result: the count of rows, or a negative number with an error record:
name:
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:179
running
running() -> ()
running gives one row for each module that runs in a process, from the module records of the kernel: the process, the module, its hash, the hash that a replacement changed, and the writer of the record.
The module records are what each loader asserted with the kernel operation Process_Module; the manual reads them with Inspect and the right Inspect on the machine. The rows are records Running. The field writer is starter for a record that the starter wrote, which the process cannot change, and process for a record that the process wrote for itself.
Result: the count of rows, or a negative number with an error record:
No_Grant(-3): the caller does not act for the principal: a process sees no other process;Refused(-3): the kernel refused the report to this process, with its status.
- none
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:196
edges
edges() -> ()
edges gives one row for each import edge of each process that runs: the process, a module that runs in it with its hash, the module of the same process that imports it, and the module that a replacement put it in place of.
A module that no module of its process imports, as the module of the process, has one row with imported_by empty. The rows come from the module records of the kernel and the imports of the files of the boot image: the module graph of the build, for what runs now. The rows are records Edge.
Result: the count of rows, or a negative number with an error record:
No_Grant(-3): the caller does not act for the principal;Refused(-3): the kernel refused the report to this process, with its status.
- none
()- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:216
replacements
replacements() -> ()
replacements gives one row for each record of the replacement table of the machine: where an import names the module from, a loader gives the module to.
The rows are records Replacement.
Result: the count of rows.
problem
problem(name: ) ->
problem gives the first rule of the format that a module breaks, by name or by hash, as a sentence: the table, the record and the byte of the file. The text is empty when the module keeps each rule.
Result: the count of bytes of the sentence, 0 for a module that keeps each rule, or a negative number with an error record:
Absent(-1): no module of the boot image has this name or this hash.
name:
- When it fails
- a negative result, and the error record
src/modules/system/manual/information.odin:241
overview
overview() ->
overview shows in the window the table of all the modules of the boot image: their sizes, their counts of exports and imports, who imports each one, and the processes that run it. The result is the count of modules.
show
show(name: ) ->
show shows the page of a module of the boot image, by name.
Result: the count of exports of the module, or a negative number with an error record:
Absent(-1): no module of the boot image has this name.
name:
- When it fails
- a negative result, and the error record
src/modules/system/manual/main.odin:847
about
about(name: ) ->
about gives the line that says what a module is, by name.
Result: the count of bytes of the line, or a negative number with an error record:
Absent(-1): no module of the boot image has this name.
A module with no documentation gives an empty text and 0: an answer, not a failure.
name:
- When it fails
- a negative result, and the error record
src/modules/system/manual/main.odin:880
signature
signature(name: , export: ) ->
signature gives the description of one export of a module as a text: its name, the name and the type of each parameter, and the type of the result. The exports have the numbers from 1.
Result: the count of bytes of the text, or a negative number with an error record:
Absent(-1): no module of the boot image has this name.Bad_Value(-2): the module has no export with this number; the record gives the count of its exports as the limit.
name:export:
- When it fails
- a negative result, and the error record
src/modules/system/manual/main.odin:897
entry
entry()
The entry of the manual: it opens its service and its window, then serves calls and keys until the principal closes the window.
When the loader starts it, the entry:
- 1. opens the service ring, so that callers can reach the exports;
- 2. opens a window of two pictures; with no window, it stops with
Failed; - 3. maps the boot image and the replacement table, read-only;
- 4. measures the information functions once (
information_start), and writes the line "manual: information: ... modules break a rule" on the log; - 5. shows the page of the module
manualand writes "manual: ok, N modules, M have their documentation".
Then one loop waits on the events of the window and on the service ring. A call to an export runs in this loop and can change the page; a key moves the page or the list. The window is drawn again only after a change. The process never stops by itself: the compositor or the console stops it.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/system/manual/main.odin:940
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | It reads the documentation of each module of the boot image, and the module records of each process. | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| The least budget of 2048 pages, in which it ran before it stated its window, less that window at the scale 1 (1001 pages): its module, its stack, its pages of text, its tables and its glyph memory. The tool counts the window at the largest scale. See: Module contract: The budget that a module asks for |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
Table wire form
A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).
Module record of a module
A record of the module manual: 224 bytes, aligned on 8 bytes, 0 bytes of padding.
nameText(32)032 byteshashText(64)3264 bytesfilei64968 bytescodei641048 bytesconstantsi641128 bytesdatai641208 byteszeroi641288 bytesentryi641368 bytes
and 7 more
Text wire form
A wire form of the module contract: one word of a call. The address of a slice record {address, count} of UTF-8 bytes.
Export record of a module
A record of the module manual: 240 bytes, aligned on 8 bytes, 0 bytes of padding.
moduleText(32)032 bytesnameText(32)3232 bytesnumberi64648 bytesparametersi64728 bytesresultText(8)808 bytesrightsText(40)8840 bytessignatureText(112)128112 bytes
Error_Record record of a module
A record of the module manual: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Import record of a module
A record of the module manual: 176 bytes, aligned on 8 bytes, 0 bytes of padding.
moduleText(32)032 bytesnumberi64328 byteshashText(64)4064 bytesnameText(32)10432 bytesimport_slotsi641368 bytesreplacementText(32)14432 bytes
Import_Slot record of a module
A record of the module manual: 120 bytes, aligned on 8 bytes, 0 bytes of padding.
moduleText(32)032 bytesnumberi64328 bytesimport_indexi64408 bytesexport_indexi64488 bytestargetText(32)5632 bytesnameText(32)8832 bytes
Segment record of a module
A record of the module manual: 96 bytes, aligned on 8 bytes, 0 bytes of padding.
moduleText(32)032 bytesnumberi64328 byteskindText(24)4024 bytesmemory_offseti64648 bytesmemory_sizei64728 bytesfile_offseti64808 bytesfile_sizei64888 bytes
Running record of a module
A record of the module manual: 224 bytes, aligned on 8 bytes, 0 bytes of padding.
processText(32)032 bytessloti64328 bytesmoduleText(32)4032 byteshashText(64)7264 bytesreplacesText(64)13664 bytesbasei642008 bytessizei642088 byteswriterText(8)2168 bytes
Edge record of a module
A record of the module manual: 200 bytes, aligned on 8 bytes, 0 bytes of padding.
processText(32)032 bytessloti64328 bytesmoduleText(32)4032 byteshashText(64)7264 bytesimported_byText(32)13632 bytesreplacesText(32)16832 bytes
Replacement record of a module
A record of the module manual: 192 bytes, aligned on 1 bytes, 0 bytes of padding.
fromText(32)032 bytesfrom_hashText(64)3264 bytestoText(32)9632 bytesto_hashText(64)12864 bytes
Integer wire form
A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.
word_wait procedure of the package system
word_wait :: proc "contextless" (word: ^u32, value: u32, deadline: u64 = WAIT_FOREVER) -> u64
word_wait stops the thread while the word holds value, until word_wake.
overview procedure of the package manual
overview :: proc "c" () -> i64
overview shows in the window the table of all the modules of the boot image: their sizes, their counts of exports and imports, who imports each one, and the processes that run it.
Module type of the package information
Module :: struct {...}
One row for each module of the catalog: modules().
Export type of the package information
Export :: struct {...}
One row for each export with a description: exports(), exporters(),.
Import type of the package information
Import :: struct {...}
One row for each import of a module: imports(), importers().
Import_Slot type of the package information
Import_Slot :: struct {...}
One row for each import slot of a module: import_slots().
Segment type of the package information
Segment :: struct {...}
One row for each segment of a module: segments().
Running type of the package information
Running :: struct {...}
One row for each module that runs in a process, from the module records.
Edge type of the package information
Edge :: struct {...}
One row for each import edge of each process that runs: edges().
Replacement type of the package information
Replacement :: struct {...}
One row for each record of the replacement table of the machine:.
information_start procedure of the package manual
information_start :: proc "contextless" (ctx: ^system.Context)
information_start keeps the machine handle and measures the functions:.
