This note describes a message format called Wota that was developed for use in Misty's local messaging system. It is very similar to Nota, but works at word granularity rather than byte granularity. The arrangements Wota produces are less compact than Nota, but are faster to arrange and consume. In network transfers, compactness is highly prized. In local inter-process communication, copying arrangements from one memory space to another, compactness is less beneficial. On 64 bit systems, a Wota word is 64 bits with no straddling.
| Bits | Hex | Type |
|---|---|---|
| Number | ||
0001 |
1 |
Array |
0010 |
2 |
Record |
0011 |
3 |
Blob |
0100 |
4 |
Text |
0110 |
6 |
Symbol |
Wota stands for Word Object Transfer Arrangement. It is mostly used to hold outgoing messages before transfer.
A value is expressed in Wota as one or more 64 bits words. The first word is the preamble.
If the least significant eight bits of the preamble are not 10000000binary 80hexadecimal, then the value is simply a DEC64 number.
If the least significant eight bits of the preamble are 10000000binary 80hexadecimal,
then the next four bits contain a type.
The interpretation of the most significant 52 bits (the remaining field) depends on the type.
A blob is a string of bits packed 64 per word. The remaining field contains the number of bits. The number of data words that follow:
floor((number_of_bits + 63) / 64)
The first bit of the blob goes into the most significant bit of the next word. The final word is padded with 0 as necessary.
Example: A blob containing 25 bits: 111100001110001100100001
0000000000000000000000000000000000000000000000011001001110000000 # 0000000000019380 1111000011100011001000001000000000000000000000000000000000000000 # F0E3208000000000
A text is a string of UTF-32 codepoints packed 2 per word. The remaining field contains the number of bytes. The number of data words that follow:
floor((number_of_characters + 1) / 2)
The final word is padded with 0 if necessary.
Example: "cat"
0000000000000000000000000000000000000000000000000011010010000000 # 0000000000003480 0000000000000000000000000110001100000000000000000000000001100001 # 0000006300000061 0000000000000000000000000111010000000000000000000000000000000000 # 0000007400000000
Example: ""empty text
0000000000000000000000000000000000000000000000000000010010000000 # 0000000000000480
An array is an ordered sequence of values. The remaining field contains the number of elements. Following the preamble are the elements of the array. Each element begins with a preamble. As with JSON, nesting is encouraged. Cyclic structures are not allowed.
Example: ["duck", "dragon"].
0000000000000000000000000000000000000000000000000010000110000000 # 0000000000002180 0000000000000000000000000000000000000000000000000100010010000000 # 0000000000004480 0000000000000000000000000110010000000000000000000000000001110100 # 0000006400000074 0000000000000000000000000110001100000000000000000000000001101011 # 000000630000006B 0000000000000000000000000000000000000000000000000110010010000000 # 0000000000006480 0000000000000000000000000110010000000000000000000000000001110010 # 0000006400000072 0000000000000000000000000110000100000000000000000000000001100111 # 0000006100000067 0000000000000000000000000110111100000000000000000000000001101110 # 0000006F0000006E
A record is a set of key:value pairs. The keys must be text. The values can be any Wota values. The remaining field contains the number of pairs.
Example: {"ox": ["O", "X"]}.
0000000000000000000000000000000000000000000000000001001010000000 # 0000000000001280 0000000000000000000000000000000000000000000000000010010010000000 # 0000000000002480 0000000000000000000000001101111000000000000000000000000001111000 # 0000006F00000078 0000000000000000000000000000000000000000000000000002000110000000 # 0000000000002180 0000000000000000000000000000000000000000000000000001010010000000 # 0000000000001480 0000000000000000000000001001111000000000000000000000000000000000 # 0000004F00000000 0000000000000000000000000000000000000000000000000001010010000000 # 0000000000001480 0000000000000000000000001011000000000000000000000000000000000000 # 0000005800000000
| Bits | Hex | Symbol |
|---|---|---|
0000 |
0 |
null |
0010 |
2 |
false |
0011 |
3 |
true |
0100 |
4 |
private |
0101 |
5 |
system |
Currently there are only five symbols. All other symbols are reserved. The remaining field contains the symbol.
Example: [null, false, true, private, system]
0000000000000000000000000000000000000000000000000101000110000000 # 0000000000005180 0000000000000000000000000000000000000000000000000000011010000000 # 0000000000000680 0000000000000000000000000000000000000000000000000010011010000000 # 0000000000002680 0000000000000000000000000000000000000000000000000011011010000000 # 0000000000003680 0000000000000000000000000000000000000000000000000100011010000000 # 0000000000004680 0000000000000000000000000000000000000000000000000101011010000000 # 0000000000005680
Numbers are represented as DEC64. In DEC64, the least significant byte is the exponent, which is not allowed to contain 10000000binary 80hexadecimal.
A number does not contain a preamble type field.
Example: 7
0000000000000000000000000000000000000000000000000000011100000000 # 0000000000000700
Example: 4.25
0000000000000000000000000000000000000000000000011010100111111110 # 000000000001A9FE