mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Improve Bluon documentation
This commit is contained in:
parent
2b1c9cff7c
commit
322da6cf0a
@ -45,7 +45,7 @@ for _, type in ipairs{
|
|||||||
{"number", 1};
|
{"number", 1};
|
||||||
{"string_constant", 1};
|
{"string_constant", 1};
|
||||||
{"string", uint_types};
|
{"string", uint_types};
|
||||||
-- (T0, T8, T16, T32, T64) x (L0, L8, L16, L32, L64)
|
-- (M0, M8, M16, M32, M64) x (L0, L8, L16, L32, L64)
|
||||||
{"table", (uint_types + 1) ^ 2};
|
{"table", (uint_types + 1) ^ 2};
|
||||||
{"reference", uint_types}
|
{"reference", uint_types}
|
||||||
} do
|
} do
|
||||||
|
32
doc/bluon.md
32
doc/bluon.md
@ -44,23 +44,41 @@ Checking whether the stream has been fully consumed by doing `assert(not stream:
|
|||||||
|
|
||||||
## Format
|
## Format
|
||||||
|
|
||||||
* `nil`: nothing (`""`)
|
Bluon uses a "tagged union" binary format:
|
||||||
|
Values are stored as a one-byte tag followed by the contents of the union.
|
||||||
|
For frequently used "constants", only a tag is used.
|
||||||
|
|
||||||
|
`nil` is an exception; since it can't appear in tables, it gets no tag.
|
||||||
|
If the value to be written by Bluon is `nil`, Bluon simply writes *nothing*.
|
||||||
|
|
||||||
|
The following is an enumeration of tag numbers, which are assigned *in this order*.
|
||||||
|
|
||||||
* `false`: 0
|
* `false`: 0
|
||||||
* `true`: 1
|
* `true`: 1
|
||||||
* Numbers:
|
* Numbers:
|
||||||
* Constants: 0, nan, +inf, -inf
|
* Constants: 0, nan, +inf, -inf
|
||||||
* Integers: Little endian `U8`, `U16`, `U32`, `U64`, `-U8`, `-U16`, `-U32`, `-U64`
|
* Integers: Little endian:
|
||||||
|
* Unsigned: `U8`, `U16`, `U32`, `U64`
|
||||||
|
* Negative: `-U8`, `-U16`, `-U32`, `-U64`
|
||||||
* Floats: Little endian `F32`, `F64`
|
* Floats: Little endian `F32`, `F64`
|
||||||
* Strings:
|
* Strings:
|
||||||
* Constant: `""`
|
* Constant: `""`
|
||||||
* Length as unsigned integer: `T8`, `T16`, `T32`, `T64`
|
* Length is written as unsigned integer according to the tag: `S8`, `S16`, `S32`, `S64`
|
||||||
|
* followed by the raw bytes
|
||||||
* Tables:
|
* Tables:
|
||||||
* List and map part count as unsigned integers
|
* Tags: `M0`, `M8`, `M16`, `M32`, `M64` times `L0`, `L8`, `L16`, `L32`, `L64`
|
||||||
* `L0`, `L8`, `L16`, `L32`, `L64` times `M0`, `M8`, `M16`, `M32`, `M64`
|
* `M` is more significant than `L`: The order of the cartesian product is `M0L0`, `M0L1`, ...
|
||||||
|
* List and map part count encoded as unsigned integers according to the tag,
|
||||||
|
list part count comes first
|
||||||
|
* followed by all values in the list part written as Bluon
|
||||||
|
* followed by all key-value pairs in the map part written as Bluon
|
||||||
|
(first the key is written as Bluon, then the value)
|
||||||
* Reference:
|
* Reference:
|
||||||
* Reference ID as unsigned integer: `R8`, `R16`, `R32`, `R64`
|
* Reference ID as unsigned integer: `R8`, `R16`, `R32`, `R64`
|
||||||
* Reserved types:
|
* References a previously encountered table or string by an index:
|
||||||
* Everything <= 55 => 200 free types
|
All tables and strings are numbered in the order they occur in the Bluon
|
||||||
|
* Reserved tags:
|
||||||
|
* All tags <= 55 are reserved. This gives 200 free tags.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user