The entry heron
The source src/modules/demonstrations/heron built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
A demonstration, for fun: the heron of the mark plays its animations.
1 to 9, a to f: play one animation space: pause .: next frame
s: slow motion l: the lines of the cells z: the cell size
g: a move on the grid, or free
What it is for. It shows the graphics of the system with the mark of the system: the heron stands in its water, drawn large from the cells of src/library/modus/mark, and plays its 15 animations in an order of chance. Four animations move the whole heron: in the dash it leaves the window by the right and comes back by the left, in the forms of the crouch and of the run. The process draws again only the part of its window that changed, and its log says how long a picture takes and how many pixels it damages.
What a reader sees. Start it from the start menu, or with start("heron") in the console. The heron is still for about 40 % of the time; between two still times one animation plays. Each animation plays once before one plays again, and none follows itself: the rule of the home of the site (mark.next_animation). Under the heron a band names the animation that plays, its frame and its progress, then the keys:
1to9andatofplay one animation at once.- Space pauses. While the play is paused,
.shows the next frame, and an animation key shows the first frame of its animation. splays four times slower.lshows the lines between the cells, and a white outline around each cell that the frame changed in the still heron: an animation changes a few cells.zchanges the cell size: 12, 8 or 4 pixels.gchooses the way of a move. On the grid, the way of the system: the heron takes the forms ofsrc/library/modus/mark, the same drawings as on the home of the site, each in whole square cells, at places in whole cells (mark.move_pose,mark.form_cells). Free, to compare: the frame of the heron is stretched to the box of the form, so its cells become rectangles, and the box goes from a key to the next one pixel by pixel. The way on the grid draws cells; it is not a filter over the free picture.
The window is shown whole or not at all. Its surface has two pictures: the process draws one while the compositor reads the other, and it draws only when the compositor took the picture before.
The log. heron: ok, the first picture is presented after the first picture. Each key writes one line, after the process presented its state:
- an animation that a key or a call asked for, when it ends:
heron: dash played: 17 frames, the heron left the window and came back, on the grid, and once, the measure of its pictures (heron: a picture of dash took ... us to draw and damaged ... pixels); - Space:
heron: paused,heron: plays again; s:heron: slow,heron: full speed;z:heron: cells of 8 pixels;l,g,., and an animation key while the play is paused:heron: shows dash at frame 3 of 17, held, on the grid: the form run, ....
An animation of the own order writes heron: blink played in its own order: 1 frames when it ends. Only the first 32 of them have a line: the heron plays for as long as its window is open, and the log of the system is not its diary.
Its grant: Serve, its exports. It needs no other.
Its exports: play, animations and grid.
connect("heron")
heron.animations()
heron.play("dash")
heron.grid(0)
What it does not prove. The time of a picture is a measure of the host of the run: no test compares it to a bound.
heron module with an entry
- Hash
79c55a2e3fc01f1e074cef297fb6b0cc7f76669bdf92d191b7b5c7f342cdce94- Size
235211 bytes- Exports
3- Imports
1- Imported by
0- License
- MIT
A demonstration, for fun: the heron of the mark plays its animations
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/heron |
| Boot image | yes: in the boot image, 235211 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 |
|---|---|
play(name: Text) -> Integer | plays one animation of the heron at once, by its name: play("dash") |
animations() -> Table(Animation_Row) | gives one row for each animation of the heron, in the order of the keys of the window: its name, the count of its frames, its time in milliseconds, and 1 when the whole heron moves during it |
grid(on: Integer) -> Integer | chooses the way of a move of the heron: grid(1) is on the grid, grid(0) is free |
entry() | opens the window and plays the animations until the process is stopped |
play
play(name: ) ->
play plays one animation of the heron at once, by its name: play("dash").
The animation that plays is replaced. When the asked animation ends, the log gets one line, and the order of chance goes on. While the play is paused, the window shows the first frame of the animation, and holds it.
- name: a name of the first column of animations, 16 bytes at most. The match is exact.
The result is the count of the frames of the animation. It fails with -1 and an error record: Absent when no animation has this name; the record names the first argument.
Example, in the console after connect("heron"): heron.play("dash").
name:
- When it fails
- a negative result, and the error record
src/modules/demonstrations/heron/main.odin:256
animations
animations() -> ()
animations gives one row for each animation of the heron, in the order of the keys of the window: its name, the count of its frames, its time in milliseconds, and 1 when the whole heron moves during it.
The names, the frames, the times and the moves are the data of src/library/modus/mark: the same as on the home of the site.
- result: a table of
Animation_Rowrows that the call fills. A table shorter than the count gets the first rows only; the result still counts every animation.
The result is the count of the animations, 15. It never fails.
grid
grid(on: ) ->
grid chooses the way of a move of the heron: grid(1) is on the grid, grid(0) is free.
On the grid, the heron takes the drawn forms of the mark, in whole square cells, at places in whole cells: the way of the system, and the way of the window at its start. Free, the frame of the heron is stretched to the box of the form and is at any pixel: its cells are rectangles. The key g of the window does the same. The log gets one line that says what the window shows.
- on: 0 for the free way; another number for the way on the grid.
The result is 1 when the way is on the grid, else 0. It never fails.
entry
entry()
entry opens the window and plays the animations until the process is stopped.
The loop: it runs the calls of its exports, takes the keys of the window, moves the play forward by the time since the last picture, draws the stage when the heron changed, and builds the window: one picture for each tile of the stage, then the band. The interface package draws again only the tiles and the texts that changed. The loop then waits for a key, a call, the next picture of an animation, or the end of the still time (with no end while paused). With no random seed, it stops with Refused; with no window, with Failed.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/heron/main.odin:871
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 | A service: the console calls its exports through a connection. | |
| 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 (610 pages): its module, its stack, 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).
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.
Integer wire form
A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.
Error_Record record of a module
A record of the module heron: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
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).
Animation_Row record of a module
A record of the module heron: 40 bytes, aligned on 8 bytes, 0 bytes of padding.
nameText(16)016 bytesframesi64168 bytesdurationi64248 bytesmovesi64328 bytes
next_animation procedure of the package mark
next_animation :: proc "contextless" (memory: ^Order_Memory, chance: u32) -> int
next_animation chooses the animation to play: one of those that the.
move_pose procedure of the package mark
move_pose :: proc "contextless" (animation: Animation, at_milliseconds: int, travel: Move_Travel) -> Move_Pose
move_pose gives the form and the place of the heron at a time from the.
form_cells procedure of the package mark
form_cells :: proc "contextless" (form: Form, animation: Animation, frame: int) -> (drawn: Form_Cells, found: bool)
form_cells gives the cells of one frame of an animation in a form: the.
Animation_Row type of the package heron
Animation_Row :: struct {...}
One row of the table of animations().
