1
1
mirror of https://github.com/wader/fq.git synced 2024-12-25 22:34:14 +03:00
fq/pkg/decode/scalar_gen.go.json
2021-11-17 16:13:10 +01:00

155 lines
9.0 KiB
JSON

{
"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"},
"BitBuf": {"go_type": "*bitio.Buffer", "zero": "nil", "map_from": false, "map_to": false}
},
"readers": [
{
"name": "Raw",
"type": "BitBuf",
"variants": [ {"name": "Len", "args": "nBits", "params": "nBits int64", "call": "d.tryBitBuf(nBits)", "doc": "nBits raw bits"} ]
},
{
"name": "Bool",
"type": "Bool",
"variants": [ {"name": "", "args": "", "params": "", "call": "d.tryBool()", "doc": "1 bit boolean"} ]
},
{
"name": "U",
"type": "U",
"variants": [
{"name": "", "args": "nBits", "params": "nBits int", "call": "d.tryUE(nBits, d.Endian)", "doc": "nBits bits unsigned integer in current endian"},
{
"name": "E",
"args": "nBits, endian",
"params": "nBits int, endian Endian",
"call": "d.tryUE(nBits, endian)",
"doc": "nBits unsigned integer in specified endian"
},
{ "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" }
]
},
{
"name": "S",
"type": "S",
"variants": [
{"name": "", "args": "nBits", "params": "nBits int", "call": "d.trySE(nBits, d.Endian)", "doc": "nBits bits signed integer in current endian"},
{
"name": "E",
"args": "nBits, endian",
"params": "nBits int, endian Endian",
"call": "d.trySE(nBits, endian)",
"doc": "nBits signed integer in specified endian"
},
{ "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" }
]
},
{
"name": "F",
"type": "F",
"variants": [
{"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"}
]
},
{
"name": "FP",
"type": "F",
"variants": [
{
"name": "",
"args": "nBits, fBits",
"params": "nBits int, fBits int64",
"call": "d.tryFPE(nBits, fBits, d.Endian)",
"doc": "nBits fixed-point number in current endian"
},
{
"name": "E",
"args": "nBits, fBits, endian",
"params": "nBits int, fBits int64, endian Endian",
"call": "d.tryFPE(nBits, fBits, endian)",
"doc": "nBits fixed-point number in specified endian"
},
{"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"}
]
},
{
"name": "Unary",
"type": "U",
"variants": [ {"name": "", "args": "ov", "params": "ov uint64", "call": "d.tryUnary(ov)", "doc": "unary integer using ov as \"one\" value"} ]
},
{
"type": "Str",
"name": "UTF",
"variants": [
{"name": "8", "args": "nBytes", "params": "nBytes int", "call": "d.tryText(nBytes, UTF8BOM)", "doc": "nBytes bytes UTF8 string"},
{
"name": "16",
"args": "nBytes",
"params": "nBytes int",
"call": "d.tryText(nBytes, UTF16BOM)",
"doc": "nBytes bytes UTF16 string, default big-endian and accepts BOM"
},
{"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"}
]
},
{
"name": "UTF8ShortString",
"type": "Str",
"variants": [
{"name": "", "args": "", "params": "", "call": "d.tryTextLenPrefixed(8, -1, UTF8BOM)", "doc": "one byte length fixed UTF8 string"},
{
"name": "FixedLen",
"args": "fixedBytes",
"params": "fixedBytes int",
"call": "d.tryTextLenPrefixed(8, fixedBytes, UTF8BOM)",
"doc": "fixedBytes bytes long one byte length prefixed UTF8 string"
}
]
},
{
"name": "UTF8Null",
"type": "Str",
"variants": [ {"name": "", "args": "", "params": "", "call": "d.tryTextNull(1, UTF8BOM)", "doc": "null terminated UTF8 string"} ]
},
{
"name": "UTF8NullFixedLen",
"type": "Str",
"variants": [
{
"name": "",
"args": "fixedBytes",
"params": "fixedBytes int",
"call": "d.tryTextNullLen(fixedBytes, UTF8BOM)",
"doc": "fixedBytes bytes long null terminated UTF8 string"
}
]
}
]
}