2021-11-05 17:04:26 +03:00
|
|
|
{
|
|
|
|
"types": {
|
|
|
|
"Str": {"go_type": "string", "zero": "\"\"", "compare": "a == b"},
|
|
|
|
"U": {"go_type": "uint64", "zero": "0", "compare": "a == b"},
|
|
|
|
"S": {"go_type": "int64", "zero": "0", "compare": "a == b"},
|
|
|
|
"F": {"go_type": "float64", "map_from": false, "zero": "0", "compare": "a == b"},
|
|
|
|
"Bool": {"go_type": "bool", "zero": "false", "compare": "a == b"},
|
2021-11-17 18:13:10 +03:00
|
|
|
"BitBuf": {"go_type": "*bitio.Buffer", "zero": "nil", "map_from": false, "map_to": false}
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
"readers": [
|
|
|
|
{
|
|
|
|
"name": "Raw",
|
|
|
|
"type": "BitBuf",
|
2021-11-17 18:13:10 +03:00
|
|
|
"variants": [ {"name": "Len", "args": "nBits", "params": "nBits int64", "call": "d.tryBitBuf(nBits)", "doc": "nBits raw bits"} ]
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Bool",
|
|
|
|
"type": "Bool",
|
2021-11-17 18:13:10 +03:00
|
|
|
"variants": [ {"name": "", "args": "", "params": "", "call": "d.tryBool()", "doc": "1 bit boolean"} ]
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "U",
|
|
|
|
"type": "U",
|
|
|
|
"variants": [
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "", "args": "nBits", "params": "nBits int", "call": "d.tryUE(nBits, d.Endian)", "doc": "nBits bits unsigned integer in current endian"},
|
2021-11-05 17:04:26 +03:00
|
|
|
{
|
|
|
|
"name": "E",
|
|
|
|
"args": "nBits, endian",
|
2021-11-17 18:13:10 +03:00
|
|
|
"params": "nBits int, endian Endian",
|
|
|
|
"call": "d.tryUE(nBits, endian)",
|
|
|
|
"doc": "nBits unsigned integer in specified endian"
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
2021-11-17 18:13:10 +03:00
|
|
|
{ "name": "$n", "range": [1, 64], "args": "", "params": "", "call": "d.tryUE($n, d.Endian)", "doc": "$n bit unsigned integer in current endian" },
|
|
|
|
{ "name": "$nLE", "range": [8, 64], "args": "", "params": "", "call": "d.tryUE($n, LittleEndian)", "doc": "$n bit unsigned integer in little-endian" },
|
|
|
|
{ "name": "$nBE", "range": [8, 64], "args": "", "params": "", "call": "d.tryUE($n, BigEndian)", "doc": "$n bit unsigned integer in big-endian" }
|
2021-11-05 17:04:26 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "S",
|
|
|
|
"type": "S",
|
|
|
|
"variants": [
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "", "args": "nBits", "params": "nBits int", "call": "d.trySE(nBits, d.Endian)", "doc": "nBits bits signed integer in current endian"},
|
2021-11-05 17:04:26 +03:00
|
|
|
{
|
|
|
|
"name": "E",
|
|
|
|
"args": "nBits, endian",
|
2021-11-17 18:13:10 +03:00
|
|
|
"params": "nBits int, endian Endian",
|
|
|
|
"call": "d.trySE(nBits, endian)",
|
|
|
|
"doc": "nBits signed integer in specified endian"
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
2021-11-17 18:13:10 +03:00
|
|
|
{ "name": "$n", "range": [1, 64], "args": "", "params": "", "call": "d.trySE($n, d.Endian)", "doc": "$n bit signed integer in current endian" },
|
|
|
|
{ "name": "$nLE", "range": [8, 64], "args": "", "params": "", "call": "d.trySE($n, LittleEndian)", "doc": "$n bit signed integer in little-endian" },
|
|
|
|
{ "name": "$nBE", "range": [8, 64], "args": "", "params": "", "call": "d.trySE($n, BigEndian)", "doc": "$n bit signed integer in big-endian" }
|
2021-11-05 17:04:26 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "F",
|
|
|
|
"type": "F",
|
|
|
|
"variants": [
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "", "args": "nBits", "params": "nBits int", "call": "d.tryFE(nBits, d.Endian)", "doc": "nBit IEEE 754 float in current endian"},
|
|
|
|
{"name": "E", "args": "nBits, endian", "params": "nBits int, endian Endian", "call": "d.tryFE(nBits, endian)", "doc": "nBit IEEE 754 float in specified endian"},
|
|
|
|
{"name": "16", "args": "", "params": "", "call": "d.tryFE(16, d.Endian)", "doc": "16 bit IEEE 754 float in current endian"},
|
|
|
|
{"name": "32", "args": "", "params": "", "call": "d.tryFE(32, d.Endian)", "doc": "32 bit IEEE 754 float in current endian"},
|
|
|
|
{"name": "64", "args": "", "params": "", "call": "d.tryFE(64, d.Endian)", "doc": "64 bit IEEE 754 float in current endian"},
|
|
|
|
{"name": "16LE", "args": "", "params": "", "call": "d.tryFE(16, LittleEndian)", "doc": "16 bit IEEE 754 float in little-endian"},
|
|
|
|
{"name": "32LE", "args": "", "params": "", "call": "d.tryFE(32, LittleEndian)", "doc": "32 bit IEEE 754 float in little-endian"},
|
|
|
|
{"name": "64LE", "args": "", "params": "", "call": "d.tryFE(64, LittleEndian)", "doc": "64 bit IEEE 754 float in little-endian"},
|
|
|
|
{"name": "16BE", "args": "", "params": "", "call": "d.tryFE(16, BigEndian)", "doc": "16 bit IEEE 754 float in big-endian"},
|
|
|
|
{"name": "32BE", "args": "", "params": "", "call": "d.tryFE(32, BigEndian)", "doc": "32 bit IEEE 754 float in big-endian"},
|
|
|
|
{"name": "64BE", "args": "", "params": "", "call": "d.tryFE(64, BigEndian)", "doc": "64 bit IEEE 754 float in big-endian"}
|
2021-11-05 17:04:26 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "FP",
|
|
|
|
"type": "F",
|
|
|
|
"variants": [
|
|
|
|
{
|
|
|
|
"name": "",
|
|
|
|
"args": "nBits, fBits",
|
2021-11-19 17:24:53 +03:00
|
|
|
"params": "nBits int, fBits int",
|
2021-11-17 18:13:10 +03:00
|
|
|
"call": "d.tryFPE(nBits, fBits, d.Endian)",
|
|
|
|
"doc": "nBits fixed-point number in current endian"
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-11-17 18:13:10 +03:00
|
|
|
"name": "E",
|
|
|
|
"args": "nBits, fBits, endian",
|
2021-11-19 17:24:53 +03:00
|
|
|
"params": "nBits int, fBits int, endian Endian",
|
2021-11-17 18:13:10 +03:00
|
|
|
"call": "d.tryFPE(nBits, fBits, endian)",
|
|
|
|
"doc": "nBits fixed-point number in specified endian"
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "16", "args": "", "params": "", "call": "d.tryFPE(16, 8, d.Endian)", "doc": "16 bit fixed-point number in current endian"},
|
|
|
|
{"name": "32", "args": "", "params": "", "call": "d.tryFPE(32, 16, d.Endian)", "doc": "32 bit fixed-point number in current endian"},
|
|
|
|
{"name": "64", "args": "", "params": "", "call": "d.tryFPE(64, 32, d.Endian)", "doc": "64 bit fixed-point number in current endian"},
|
|
|
|
{"name": "16LE", "args": "", "params": "", "call": "d.tryFPE(16, 8, LittleEndian)", "doc": "16 bit fixed-point number in little-endian"},
|
|
|
|
{"name": "32LE", "args": "", "params": "", "call": "d.tryFPE(32, 16, LittleEndian)", "doc": "32 bit fixed-point number in little-endian"},
|
|
|
|
{"name": "64LE", "args": "", "params": "", "call": "d.tryFPE(64, 32, LittleEndian)", "doc": "64 bit fixed-point number in little-endian"},
|
|
|
|
{"name": "16BE", "args": "", "params": "", "call": "d.tryFPE(16, 8, BigEndian)", "doc": "16 bit fixed-point number in big-endian"},
|
|
|
|
{"name": "32BE", "args": "", "params": "", "call": "d.tryFPE(32, 16, BigEndian)", "doc": "32 bit fixed-point number in big-endian"},
|
|
|
|
{"name": "64BE", "args": "", "params": "", "call": "d.tryFPE(64, 32, BigEndian)", "doc": "64 bit fixed-point number in big-endian"}
|
2021-11-05 17:04:26 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Unary",
|
|
|
|
"type": "U",
|
2021-11-17 18:13:10 +03:00
|
|
|
"variants": [ {"name": "", "args": "ov", "params": "ov uint64", "call": "d.tryUnary(ov)", "doc": "unary integer using ov as \"one\" value"} ]
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "Str",
|
|
|
|
"name": "UTF",
|
|
|
|
"variants": [
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "8", "args": "nBytes", "params": "nBytes int", "call": "d.tryText(nBytes, UTF8BOM)", "doc": "nBytes bytes UTF8 string"},
|
2021-11-05 17:04:26 +03:00
|
|
|
{
|
|
|
|
"name": "16",
|
|
|
|
"args": "nBytes",
|
2021-11-17 18:13:10 +03:00
|
|
|
"params": "nBytes int",
|
|
|
|
"call": "d.tryText(nBytes, UTF16BOM)",
|
|
|
|
"doc": "nBytes bytes UTF16 string, default big-endian and accepts BOM"
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "16LE", "args": "nBytes", "params": "nBytes int", "call": "d.tryText(nBytes, UTF16LE)", "doc": "nBytes bytes UTF16 little-endian string"},
|
|
|
|
{"name": "16BE", "args": "nBytes", "params": "nBytes int", "call": "d.tryText(nBytes, UTF16BE)", "doc": "nBytes bytes UTF16 big-endian string"}
|
2021-11-05 17:04:26 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "UTF8ShortString",
|
|
|
|
"type": "Str",
|
|
|
|
"variants": [
|
2021-11-17 18:13:10 +03:00
|
|
|
{"name": "", "args": "", "params": "", "call": "d.tryTextLenPrefixed(8, -1, UTF8BOM)", "doc": "one byte length fixed UTF8 string"},
|
2021-11-05 17:04:26 +03:00
|
|
|
{
|
2021-11-17 18:13:10 +03:00
|
|
|
"name": "FixedLen",
|
|
|
|
"args": "fixedBytes",
|
|
|
|
"params": "fixedBytes int",
|
|
|
|
"call": "d.tryTextLenPrefixed(8, fixedBytes, UTF8BOM)",
|
|
|
|
"doc": "fixedBytes bytes long one byte length prefixed UTF8 string"
|
2021-11-05 17:04:26 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-11-17 18:13:10 +03:00
|
|
|
"name": "UTF8Null",
|
2021-11-05 17:04:26 +03:00
|
|
|
"type": "Str",
|
2021-11-17 18:13:10 +03:00
|
|
|
"variants": [ {"name": "", "args": "", "params": "", "call": "d.tryTextNull(1, UTF8BOM)", "doc": "null terminated UTF8 string"} ]
|
2021-11-05 17:04:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-11-17 18:13:10 +03:00
|
|
|
"name": "UTF8NullFixedLen",
|
2021-11-05 17:04:26 +03:00
|
|
|
"type": "Str",
|
|
|
|
"variants": [
|
|
|
|
{
|
|
|
|
"name": "",
|
|
|
|
"args": "fixedBytes",
|
2021-11-17 18:13:10 +03:00
|
|
|
"params": "fixedBytes int",
|
|
|
|
"call": "d.tryTextNullLen(fixedBytes, UTF8BOM)",
|
|
|
|
"doc": "fixedBytes bytes long null terminated UTF8 string"
|
2021-11-05 17:04:26 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|