mod to_bin;
mod from_bin;

pub use to_bin::encode_timestamp;
pub use from_bin::decode_timestamp;

// There should not be any precision loss during conversion!!

/*
MetaChars

| Number     | Type Signature                                     | Explanation                                                       |
|------------|----------------------------------------------------|-------------------------------------------------------------------|
| 0          | () -> None                                         |                                                                   |
| 1          | () -> True                                         |                                                                   |
| 2          | () -> False                                        |                                                                   |
| 3 ~ 162    | () -> Int                                          | Number - 35, representing -32 ~ 127                               |
| 163        | (bytes: [byte; 1]) -> Int                          | to_uint(bytes) + 128, representing 128 ~ 383                      |
| 164        | (bytes: [byte; 2]) -> Int                          | to_uint(bytes) + 384, representing 384 ~ 65919                    |
| 165        | (bytes: [byte; 3]) -> Int                          | to_uint(bytes) + 65920, representing 65920 ~ 16843135             |
| 166        | (bytes: [byte; 4]) -> Int                          | to_uint(bytes) + 16843136, representing 16843136 ~ 4311810431     |
| 167        | (n: Int, bytes: [byte; (n + 37)]) -> Int           | to_uint(bytes) + 4311810432, representing 4311810432 ~ inf        |
| 168        | (n: Int) -> Int                                    | -n                                                                |
| 168        | (n: Float) -> Float                                | -n                                                                |
| 169        | (n: Int) -> Float                                  | n / 10_000                                                        |
| 170        | (n: Int) -> Float                                  | n / 100_000_000                                                   |
| 171        | (a: Int, b: Int) -> Float                          | a / b                                                             |
| 172 ~ 188  | (elements: [any; (Number - 172)]) -> List          | a list with (Number - 172) elements                               |
| 189        | (n: Int, elements: [any; (n + 49)]) -> List        | a list with (n + 49) elements                                     |
| 190 ~ 206  | (bytes: [byte; (Number - 190)]) -> String          | to_string(bytes), it uses utf-8 encoding                          |
| 207        | (n: Int, bytes: [byte; (n + 49)]) -> String        | to_string(bytes), it uses utf-8 encoding                          |
| 208        | (n: Int) -> String                                 | string_cache.get(n)                                               |
| 209        | (n: Int, s: String)                                | string_cache.insert(n, s)                                         |
| 210 ~ 226  | (pairs: [(any, any); (Number - 210)]) -> Table     | a table with (Number - 210) elements. a key comes before a value  |
| 227        | (n: Int, pairs: [(any, any); (n + 49)]) -> Table   | a table with (n + 49) elements. a key comes before a value        |
| 228        | (n: Int, bytes: [byte; n])                         | indicates a start of bsjfl metadata secion. n byte from here must be skipped when parsing SJFL values  |

Metadata Section
| 0          | (bytes: [byte; 8]) -> Int                          | a hash value of the raw text file (of itself)
*/

pub const META_NONE: u8 = 0;
pub const META_TRUE: u8 = 1;
pub const META_FALSE: u8 = 2;
pub const META_CONST_NUM_BEGIN: u8 = 3;
pub const META_CONST_NUM_END: u8 = 162;
pub const META_NUM_1_BYTE: u8 = 163;
pub const META_NUM_2_BYTE: u8 = 164;
pub const META_NUM_3_BYTE: u8 = 165;
pub const META_NUM_4_BYTE: u8 = 166;
pub const META_NUM_ARB_BYTE: u8 = 167;
pub const META_NUM_NEG: u8 = 168;
pub const META_NUM_DENOM_10000: u8 = 169;
pub const META_NUM_DENOM_100000000: u8 = 170;
pub const META_NUM_DENOM_ARB: u8 = 171;
pub const META_LIST_CONST_LEN_BEGIN: u8 = 172;
pub const META_LIST_CONST_LEN_END: u8 = 188;
pub const META_LIST_ARB_LEN: u8 = 189;
pub const META_STRING_CONST_LEN_BEGIN: u8 = 190;
pub const META_STRING_CONST_LEN_END: u8 = 206;
pub const META_STRING_ARB_LEN: u8 = 207;
pub const META_STRING_GET: u8 = 208;
pub const META_STRING_SET: u8 = 209;
pub const META_TABLE_CONST_LEN_BEGIN: u8 = 210;
pub const META_TABLE_CONST_LEN_END: u8 = 226;
pub const META_TABLE_ARB_LEN: u8 = 227;
pub const META_FILE_METADATA_START: u8 = 228;