diff --git a/dev/snippets.jq b/dev/snippets.jq index b5c26fc2..6ca6c9fa 100644 --- a/dev/snippets.jq +++ b/dev/snippets.jq @@ -1,11 +1,6 @@ def protobuf_to_value: .fields | map({(.name | tostring): (.enum // .value)}) | add; -# hack to parse just a box -# | mp4_box -def mp4_box: - [0, 0, 0, 16, "ftyp", "isom", 0, 0 , 2 , 0, .] | mp4.boxes; - # converted from https://github.com/FFmpeg/FFmpeg/blob/870bfe16a12bf09dca3a4ae27ef6f81a2de80c40/libavutil/display.c av_display_rotation_get def mp4_matrix_structure_rotation: ( .a as $s0 diff --git a/doc/dev.md b/doc/dev.md index 6714ada3..15743260 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -98,7 +98,7 @@ d.FieldUTF8("magic", 4) // create a new struct and add it as "headers", returns a *decode.D d.FieldStruct("headers", func(d *decode.D) { // read 8 bit unsigned integer, map it and add it as "type", returns a uint64 - d.FieldU8("type", scalar.UToSymStr{ + d.FieldU8("type", scalar.UintMapSymStr{ 1: "start", // ... }) @@ -115,7 +115,7 @@ will produce something like this: Children: []*decode.Value{ *decode.Value{ Name: "magic", - V: scalar.S{ + V: scalar.Str{ Actual: "abcd", // read and set by UTF8 reader }, Range: ranges.Range{Start: 0, Len: 32}, @@ -128,9 +128,9 @@ will produce something like this: Children: []*decode.Value{ *decode.Value{ Name: "type", - V: scalar.S{ + V: scalar.Uint{ Actual: uint64(1), // read and set by U8 reader - Sym: "start", // set by UToSymStr scalar.Mapper + Sym: "start", // set by UintMapSymStr scalar.Mapper }, Range: ranges.Range{Start: 32, Len: 8}, }, @@ -186,7 +186,7 @@ Decoder authors will probably not have to create them. Keeps track of - Actual value. Decoded value represented using a go type like `uint64`, `string` etc. For example a value reader by a utf8 or utf16 reader both will ends up as a `string`. -- Symbolic value. Optional symbolic representation of the actual value. For example a `scalar.UToSymStr` would map an actual `uint64` to a symbolic `string`. +- Symbolic value. Optional symbolic representation of the actual value. For example a `scalar.UintMapSymStr` would map an actual `uint64` to a symbolic `string`. - String description of the value. - Number representation diff --git a/doc/presentations/bts2022/avc_sps_hdr_params.go b/doc/presentations/bts2022/avc_sps_hdr_params.go index 0ab6de62..b3706785 100644 --- a/doc/presentations/bts2022/avc_sps_hdr_params.go +++ b/doc/presentations/bts2022/avc_sps_hdr_params.go @@ -1,12 +1,12 @@ func avcHdrParameters(d *decode.D) { - cpbCnt := d.FieldUFn("cpb_cnt", uEV, scalar.UAdd(1)) + cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UAdd(1)) d.FieldU4("bit_rate_scale") d.FieldU4("cpb_size_scale") d.FieldArray("sched_sels", func(d *decode.D) { for i := uint64(0); i < cpbCnt; i++ { d.FieldStruct("sched_sel", func(d *decode.D) { - d.FieldUFn("bit_rate_value", uEV, scalar.UAdd(1)) - d.FieldUFn("cpb_size_value", uEV, scalar.UAdd(1)) + d.FieldUintFn("bit_rate_value", uEV, scalar.UAdd(1)) + d.FieldUintFn("cpb_size_value", uEV, scalar.UAdd(1)) d.FieldBool("cbr_flag") }) } diff --git a/format/ape/apev2.go b/format/ape/apev2.go index 4fde1414..36521830 100644 --- a/format/ape/apev2.go +++ b/format/ape/apev2.go @@ -27,7 +27,7 @@ func apev2Decode(d *decode.D, _ any) any { headerFooterFn := func(d *decode.D, name string) uint64 { var tagCount uint64 d.FieldStruct(name, func(d *decode.D) { - d.FieldUTF8("preamble", 8, d.AssertStr("APETAGEX")) + d.FieldUTF8("preamble", 8, d.StrAssert("APETAGEX")) d.FieldU32("version") d.FieldU32("tag_size") tagCount = d.FieldU32("item_count") diff --git a/format/applebookmark/apple_bookmark.go b/format/applebookmark/apple_bookmark.go index 45978cb9..e4506cce 100644 --- a/format/applebookmark/apple_bookmark.go +++ b/format/applebookmark/apple_bookmark.go @@ -44,7 +44,7 @@ const ( dataTypeRelativeURL = 0x0902 ) -var dataTypeMap = scalar.UToScalar{ +var dataTypeMap = scalar.UintMap{ dataTypeString: {Sym: "string", Description: "UTF-8 String"}, dataTypeData: {Sym: "data", Description: "Raw bytes"}, dataTypeNumber8: {Sym: "byte", Description: "(signed 8-bit) 1-byte number"}, @@ -103,7 +103,7 @@ const ( elementTypeSandboxROExtension = 0xf081 ) -var elementTypeMap = scalar.UToScalar{ +var elementTypeMap = scalar.UintMap{ elementTypeTargetURL: {Sym: "target_url", Description: "A URL"}, elementTypeTargetPath: {Sym: "target_path", Description: "Array of individual path components"}, elementTypeTargetCNIDPath: {Sym: "target_cnid_path", Description: "Array of CNIDs"}, @@ -147,8 +147,8 @@ const dataObjectLen = 24 func decodeFlagDataObject(d *decode.D, flagFn func(d *decode.D)) { d.FieldStruct("record", func(d *decode.D) { - d.FieldU32("length", d.AssertU(dataObjectLen)) - d.FieldU32("raw_type", dataTypeMap, d.AssertU(dataTypeData)) + d.FieldU32("length", d.UintAssert(dataObjectLen)) + d.FieldU32("raw_type", dataTypeMap, d.UintAssert(dataTypeData)) d.FieldValueStr("type", "flag_data") d.FieldStruct("property_flags", flagFn) d.FieldStruct("enabled_property_flags", flagFn) @@ -284,7 +284,7 @@ func decodeTOCHeader(d *decode.D) *tocHeader { d.FieldStruct("toc_header", func(d *decode.D) { d.FieldU32("toc_size") - d.FieldU32("magic", d.AssertU(0xfffffffe)) + d.FieldU32("magic", d.UintAssert(0xfffffffe)) d.FieldU32("identifier") hdr.nextTOCOffset = d.FieldU32("next_toc_offset") hdr.numEntries = d.FieldU32("num_entries_in_toc") @@ -351,7 +351,7 @@ func makeDecodeRecord() func(d *decode.D) { case dataTypeNumber64F: d.FieldF64("data") case dataTypeDate: - d.FieldF64BE("data", scalar.DescriptionTimeFn(scalar.S.TryActualF, cocoaTimeEpochDate, time.RFC3339)) + d.FieldF64BE("data", scalar.FltActualDate(cocoaTimeEpochDate, time.RFC3339)) case dataTypeBooleanFalse: case dataTypeBooleanTrue: case dataTypeArray: @@ -405,10 +405,10 @@ func bookmarkDecode(d *decode.D, _ any) any { // decode bookmarkdata header, one at the top of each "file", // although these may be nested inside of binary plists d.FieldStruct("header", func(d *decode.D) { - d.FieldUTF8("magic", 4, d.AssertStr("book", "alis")) + d.FieldUTF8("magic", 4, d.StrAssert("book", "alis")) d.FieldU32("total_size") d.FieldU32("unknown") - d.FieldU32("header_size", d.AssertU(48)) + d.FieldU32("header_size", d.UintAssert(48)) d.FieldRawLen("reserved", reservedSize*8) }) diff --git a/format/ar/ar.go b/format/ar/ar.go index c861a5e5..b69724ab 100644 --- a/format/ar/ar.go +++ b/format/ar/ar.go @@ -22,21 +22,20 @@ func init() { } func decodeAr(d *decode.D, _ any) any { - d.FieldUTF8("signature", 8, d.AssertStr("!\n")) + d.FieldUTF8("signature", 8, d.StrAssert("!\n")) d.FieldArray("files", func(d *decode.D) { for !d.End() { d.FieldStruct("file", func(d *decode.D) { d.FieldUTF8("identifier", 16, scalar.ActualTrimSpace) - // TODO: try scalar.DescriptionSymUUnixTime - d.FieldUTF8("modification_timestamp", 12, scalar.ActualTrimSpace, scalar.TrySymUParseUint(10)) - d.FieldUTF8("owner_id", 6, scalar.ActualTrimSpace, scalar.TrySymUParseUint(10)) - d.FieldUTF8("group_id", 6, scalar.ActualTrimSpace, scalar.TrySymUParseUint(10)) - d.FieldUTF8("file_mode", 8, scalar.ActualTrimSpace, scalar.TrySymUParseUint(8)) // Octal - sizeS := d.FieldScalarUTF8("file_size", 10, scalar.ActualTrimSpace, scalar.TrySymUParseUint(10)) - if sizeS.Sym == nil { + d.FieldUTF8("modification_timestamp", 12, scalar.ActualTrimSpace, scalar.TryStrSymParseUint(10)) + d.FieldUTF8("owner_id", 6, scalar.ActualTrimSpace, scalar.TryStrSymParseUint(10)) + d.FieldUTF8("group_id", 6, scalar.ActualTrimSpace, scalar.TryStrSymParseUint(10)) + d.FieldUTF8("file_mode", 8, scalar.ActualTrimSpace, scalar.TryStrSymParseUint(8)) // Octal + sizeStr := d.FieldScalarUTF8("file_size", 10, scalar.ActualTrimSpace, scalar.TryStrSymParseUint(10)) + if sizeStr.Sym == nil { d.Fatalf("could not decode file_size") } - size := int64(sizeS.SymU()) * 8 + size := int64(sizeStr.SymUint()) * 8 d.FieldUTF8("ending_characters", 2) d.FieldFormatOrRawLen("data", size, probeFormat, nil) padding := d.AlignBits(16) diff --git a/format/asn1/asn1_ber.go b/format/asn1/asn1_ber.go index 2ff69a04..876d8208 100644 --- a/format/asn1/asn1_ber.go +++ b/format/asn1/asn1_ber.go @@ -49,7 +49,7 @@ const ( classPrivate = 0b11 ) -var tagClassMap = scalar.UToSymStr{ +var tagClassMap = scalar.UintMapSymStr{ classUniversal: "universal", classApplication: "application", classContext: "context", @@ -61,7 +61,7 @@ const ( formConstructed = 1 ) -var constructedPrimitiveMap = scalar.UToSymStr{ +var constructedPrimitiveMap = scalar.UintMapSymStr{ formConstructed: "constructed", formPrimitive: "primitive", } @@ -95,7 +95,7 @@ const ( universalTypeUniversalString = 0x1c // not encoded? ) -var universalTypeMap = scalar.UToSymStr{ +var universalTypeMap = scalar.UintMapSymStr{ universalTypeEndOfContent: "end_of_content", universalTypeBoolean: "boolean", universalTypeInteger: "integer", @@ -136,7 +136,7 @@ const ( decimalMinusZero = 0b00_00_11 ) -var lengthMap = scalar.UToSymStr{ +var lengthMap = scalar.UintMapSymStr{ 0: "indefinite", } @@ -179,12 +179,12 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par var tag uint64 switch class { case classUniversal: - tag = d.FieldUFn("tag", decodeTagNumber, universalTypeMap, scalar.ActualHex) + tag = d.FieldUintFn("tag", decodeTagNumber, universalTypeMap, scalar.UintHex) default: - tag = d.FieldUFn("tag", decodeTagNumber) + tag = d.FieldUintFn("tag", decodeTagNumber) } - length := d.FieldUFn("length", decodeLength, lengthMap) + length := d.FieldUintFn("length", decodeLength, lengthMap) var l int64 switch length { case lengthIndefinite: @@ -261,9 +261,9 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par case class == classUniversal && tag == universalTypeEndOfContent: // nop case class == classUniversal && tag == universalTypeBoolean: - d.FieldU8("value", scalar.URangeToScalar{ - {Range: [2]uint64{0, 0}, S: scalar.S{Sym: false}}, - {Range: [2]uint64{0x01, 0xff1}, S: scalar.S{Sym: true}}, + d.FieldU8("value", scalar.UintRangeToScalar{ + {Range: [2]uint64{0, 0}, S: scalar.Uint{Sym: false}}, + {Range: [2]uint64{0x01, 0xff1}, S: scalar.Uint{Sym: true}}, }) case class == classUniversal && tag == universalTypeInteger: if length > 8 { @@ -295,15 +295,15 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par } } case class == classUniversal && tag == universalTypeNull: - d.FieldValueNil("value") + d.FieldValueAny("value", nil) case class == classUniversal && tag == universalTypeObjectIdentifier: d.FieldArray("value", func(d *decode.D) { // first byte is = oid0*40 + oid1 - d.FieldUFn("oid", func(d *decode.D) uint64 { return d.U8() / 40 }) + d.FieldUintFn("oid", func(d *decode.D) uint64 { return d.U8() / 40 }) d.SeekRel(-8) - d.FieldUFn("oid", func(d *decode.D) uint64 { return d.U8() % 40 }) + d.FieldUintFn("oid", func(d *decode.D) uint64 { return d.U8() % 40 }) for !d.End() { - d.FieldUFn("oid", func(d *decode.D) uint64 { + d.FieldUintFn("oid", func(d *decode.D) uint64 { more := true var n uint64 for more { @@ -322,20 +322,20 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par case class == classUniversal && tag == universalTypeReal: switch { case length == 0: - d.FieldValueU("value", 0) + d.FieldValueUint("value", 0) default: switch d.FieldBool("binary_encoding") { case true: - s := d.FieldScalarBool("sign", scalar.BoolToSymS{ + s := d.FieldScalarBool("sign", scalar.BoolMapSymSint{ true: -1, false: 1, - }).SymS() - base := d.FieldScalarU2("base", scalar.UToSymU{ + }).SymSint() + base := d.FieldScalarU2("base", scalar.UintMapSymUint{ 0b00: 2, 0b01: 8, 0b10: 16, 0b11: 0, - }).SymU() + }).SymUint() scale := d.FieldU2("scale") format := d.FieldU2("format") @@ -354,15 +354,13 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par } n := d.FieldU("n", int(d.BitsLeft())) - m := float64(s) * float64(n) * math.Pow(float64(base), float64(exp)) * float64(int(1)<= len(e.Symbols) { return s, errors.New("enum value of out range") } @@ -20,7 +20,7 @@ func (e EnumMapper) MapScalar(s scalar.S) (scalar.S, error) { return s, nil } -func decodeEnumFn(schema schema.SimplifiedSchema, sms ...scalar.Mapper) (DecodeFn, error) { +func decodeEnumFn(schema schema.SimplifiedSchema, sms ...scalar.SintMapper) (DecodeFn, error) { if len(schema.Symbols) == 0 { return nil, errors.New("enum requires symbols") } @@ -29,6 +29,6 @@ func decodeEnumFn(schema schema.SimplifiedSchema, sms ...scalar.Mapper) (DecodeF // For example, consider the enum: // {"type": "enum", "name": "Foo", "symbols": ["A", "B", "C", "D"] } // This would be encoded by an int between zero and three, with zero indicating "A", and 3 indicating "D". - sms = append([]scalar.Mapper{EnumMapper{Symbols: schema.Symbols}}, sms...) + sms = append([]scalar.SintMapper{EnumMapper{Symbols: schema.Symbols}}, sms...) return decodeIntFn(sms...) } diff --git a/format/avro/decoders/fixed.go b/format/avro/decoders/fixed.go index f6603cfd..7f76f4a5 100644 --- a/format/avro/decoders/fixed.go +++ b/format/avro/decoders/fixed.go @@ -9,7 +9,7 @@ import ( "github.com/wader/fq/pkg/decode" ) -func decodeFixedFn(schema schema.SimplifiedSchema, sms ...scalar.Mapper) (DecodeFn, error) { +func decodeFixedFn(schema schema.SimplifiedSchema, sms ...scalar.BitBufMapper) (DecodeFn, error) { if schema.Size < 0 { return nil, errors.New("fixed size must be greater than or equal to zero") } diff --git a/format/avro/decoders/float.go b/format/avro/decoders/float.go index 4d744f33..c9b1c7af 100644 --- a/format/avro/decoders/float.go +++ b/format/avro/decoders/float.go @@ -5,7 +5,7 @@ import ( "github.com/wader/fq/pkg/scalar" ) -func decodeFloatFn(sms ...scalar.Mapper) (DecodeFn, error) { +func decodeFloatFn(sms ...scalar.FltMapper) (DecodeFn, error) { // A float is written as 4 bytes. The float is converted into a 32-bit integer using a method equivalent to Java's // floatToIntBits and then encoded in little-endian format. return func(name string, d *decode.D) any { diff --git a/format/avro/decoders/int.go b/format/avro/decoders/int.go index 22bd8b11..afd30060 100644 --- a/format/avro/decoders/int.go +++ b/format/avro/decoders/int.go @@ -5,9 +5,9 @@ import ( "github.com/wader/fq/pkg/scalar" ) -func decodeIntFn(sms ...scalar.Mapper) (DecodeFn, error) { +func decodeIntFn(sms ...scalar.SintMapper) (DecodeFn, error) { // Int and long values are written using variable-length zig-zag coding. return func(name string, d *decode.D) any { - return d.FieldSFn(name, VarZigZag, sms...) + return d.FieldSintFn(name, VarZigZag, sms...) }, nil } diff --git a/format/avro/decoders/logicaltypes.go b/format/avro/decoders/logicaltypes.go index 83fc1527..cd921afd 100644 --- a/format/avro/decoders/logicaltypes.go +++ b/format/avro/decoders/logicaltypes.go @@ -17,7 +17,7 @@ const ( NANOSECOND ) -func logicalMapperForSchema(schema schema.SimplifiedSchema) scalar.Mapper { +func logicalTimeMapperForSchema(schema schema.SimplifiedSchema) scalar.SintMapper { switch schema.LogicalType { case "timestamp": return TimestampMapper{Precision: SECOND} @@ -46,8 +46,8 @@ type TimestampMapper struct { Precision Precision } -func (t TimestampMapper) MapScalar(s scalar.S) (scalar.S, error) { - v := s.ActualS() +func (t TimestampMapper) MapSint(s scalar.Sint) (scalar.Sint, error) { + v := s.Actual var ts time.Time if t.Precision == SECOND { ts = time.Unix(v, 0) @@ -68,8 +68,8 @@ type TimeMapper struct { Precision Precision } -func (t TimeMapper) MapScalar(s scalar.S) (scalar.S, error) { - v := s.ActualS() +func (t TimeMapper) MapSint(s scalar.Sint) (scalar.Sint, error) { + v := s.Actual if t.Precision == SECOND { s.Sym = time.Unix(v, 0).UTC().Format("15:04:05") @@ -88,8 +88,8 @@ func (t TimeMapper) MapScalar(s scalar.S) (scalar.S, error) { type DateMapper struct { } -func (d DateMapper) MapScalar(s scalar.S) (scalar.S, error) { - v := s.ActualS() +func (d DateMapper) MapSint(s scalar.Sint) (scalar.Sint, error) { + v := s.Actual s.Sym = time.Unix(0, 0).AddDate(0, 0, int(v)).UTC().Format("2006-01-02") return s, nil } diff --git a/format/avro/decoders/long.go b/format/avro/decoders/long.go index 9b15e751..211227ed 100644 --- a/format/avro/decoders/long.go +++ b/format/avro/decoders/long.go @@ -29,9 +29,9 @@ func VarZigZag(d *decode.D) int64 { return 0 } -func decodeLongFn(sms ...scalar.Mapper) (DecodeFn, error) { +func decodeLongFn(sms ...scalar.SintMapper) (DecodeFn, error) { // Int and long values are written using variable-length zig-zag coding. return func(name string, d *decode.D) any { - return d.FieldSFn(name, VarZigZag, sms...) + return d.FieldSintFn(name, VarZigZag, sms...) }, nil } diff --git a/format/avro/decoders/null.go b/format/avro/decoders/null.go index b6c2531e..41cc7992 100644 --- a/format/avro/decoders/null.go +++ b/format/avro/decoders/null.go @@ -5,10 +5,10 @@ import ( "github.com/wader/fq/pkg/scalar" ) -func decodeNullFn(sms ...scalar.Mapper) (DecodeFn, error) { +func decodeNullFn(sms ...scalar.AnyMapper) (DecodeFn, error) { // null is written as zero bytes. return func(name string, d *decode.D) any { - d.FieldValueNil(name, sms...) + d.FieldValueAny(name, nil, sms...) return nil }, nil } diff --git a/format/avro/decoders/string.go b/format/avro/decoders/string.go index 643cbdee..9047755b 100644 --- a/format/avro/decoders/string.go +++ b/format/avro/decoders/string.go @@ -6,7 +6,7 @@ import ( "github.com/wader/fq/pkg/scalar" ) -func decodeStringFn(schema schema.SimplifiedSchema, sms ...scalar.Mapper) (DecodeFn, error) { +func decodeStringFn(schema schema.SimplifiedSchema, sms ...scalar.StrMapper) (DecodeFn, error) { // String is encoded as a long followed by that many bytes of UTF-8 encoded character data. // For example, the three-character string "foo" would be encoded as the long value 3 (encoded as hex 06) followed // by the UTF-8 encoding of 'f', 'o', and 'o' (the hex bytes 66 6f 6f): @@ -14,7 +14,7 @@ func decodeStringFn(schema schema.SimplifiedSchema, sms ...scalar.Mapper) (Decod return func(name string, d *decode.D) any { var val string d.FieldStruct(name, func(d *decode.D) { - length := d.FieldSFn("length", VarZigZag) + length := d.FieldSintFn("length", VarZigZag) val = d.FieldUTF8("data", int(length)) }) return val diff --git a/format/avro/decoders/union.go b/format/avro/decoders/union.go index 7fd32aa9..7afd9529 100644 --- a/format/avro/decoders/union.go +++ b/format/avro/decoders/union.go @@ -27,7 +27,7 @@ func decodeUnionFn(schema schema.SimplifiedSchema) (DecodeFn, error) { return func(name string, d *decode.D) any { var val any d.FieldStruct(name, func(d *decode.D) { - v := int(d.FieldSFn("type", VarZigZag)) + v := int(d.FieldSintFn("type", VarZigZag)) if v < 0 || v >= len(decoders) { d.Fatalf("invalid union value: %d", v) } diff --git a/format/bencode/bencode.go b/format/bencode/bencode.go index d6c132b1..62390341 100644 --- a/format/bencode/bencode.go +++ b/format/bencode/bencode.go @@ -26,7 +26,7 @@ func init() { interp.RegisterFS(bencodeFS) } -var typeToNames = scalar.StrToSymStr{ +var typeToNames = scalar.StrMapSymStr{ "d": "dictionary", "i": "integer", "l": "list", @@ -63,19 +63,19 @@ func decodeBencodeValue(d *decode.D) { switch typ { case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9": d.SeekRel(-8) - length := d.FieldSFn("length", decodeStrIntUntil(':')) - d.FieldUTF8("separator", 1, d.AssertStr(":")) + length := d.FieldSintFn("length", decodeStrIntUntil(':')) + d.FieldUTF8("separator", 1, d.StrAssert(":")) d.FieldUTF8("value", int(length)) case "i": - d.FieldSFn("value", decodeStrIntUntil('e')) - d.FieldUTF8("end", 1, d.AssertStr("e")) + d.FieldSintFn("value", decodeStrIntUntil('e')) + d.FieldUTF8("end", 1, d.StrAssert("e")) case "l": d.FieldArray("values", func(d *decode.D) { for d.PeekBits(8) != 'e' { d.FieldStruct("value", decodeBencodeValue) } }) - d.FieldUTF8("end", 1, d.AssertStr("e")) + d.FieldUTF8("end", 1, d.StrAssert("e")) case "d": d.FieldArray("pairs", func(d *decode.D) { for d.PeekBits(8) != 'e' { @@ -85,7 +85,7 @@ func decodeBencodeValue(d *decode.D) { }) } }) - d.FieldUTF8("end", 1, d.AssertStr("e")) + d.FieldUTF8("end", 1, d.StrAssert("e")) default: d.Fatalf("unknown type %v", typ) } diff --git a/format/bitcoin/bitcoin_block.go b/format/bitcoin/bitcoin_block.go index 1ab7640a..fb064205 100644 --- a/format/bitcoin/bitcoin_block.go +++ b/format/bitcoin/bitcoin_block.go @@ -28,7 +28,7 @@ func init() { }) } -var rawHexReverse = scalar.Fn(func(s scalar.S) (scalar.S, error) { +var rawHexReverse = scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { return scalar.RawSym(s, -1, func(b []byte) string { decode.ReverseBytes(b) return fmt.Sprintf("%x", b) @@ -45,11 +45,11 @@ func decodeBitcoinBlock(d *decode.D, in interface{}) interface{} { case 0xf9beb4d9, 0x0b110907, 0xfabfb5da: - d.FieldU32("magic", scalar.UToSymStr{ + d.FieldU32("magic", scalar.UintMapSymStr{ 0xf9beb4d9: "mainnet", 0x0b110907: "testnet3", 0xfabfb5da: "regtest", - }, scalar.ActualHex) + }, scalar.UintHex) size = int64(d.FieldU32LE("size")) * 8 default: d.Fatalf("unknown magic %x", magic) @@ -60,12 +60,12 @@ func decodeBitcoinBlock(d *decode.D, in interface{}) interface{} { d.FramedFn(size, func(d *decode.D) { d.FieldStruct("header", func(d *decode.D) { - d.FieldU32("version", scalar.ActualHex) + d.FieldU32("version", scalar.UintHex) d.FieldRawLen("previous_block_hash", 32*8, rawHexReverse) d.FieldRawLen("merkle_root", 32*8, rawHexReverse) - d.FieldU32("time", scalar.DescriptionUnixTimeFn(scalar.S.TryActualU, time.RFC3339)) - d.FieldU32("bits", scalar.ActualHex) - d.FieldU32("nonce", scalar.ActualHex) + d.FieldU32("time", scalar.UintActualUnixTime(time.RFC3339)) + d.FieldU32("bits", scalar.UintHex) + d.FieldU32("nonce", scalar.UintHex) }) // TODO: remove? support header only decode this way? @@ -73,7 +73,7 @@ func decodeBitcoinBlock(d *decode.D, in interface{}) interface{} { return } - txCount := d.FieldUFn("tx_count", decodeVarInt) + txCount := d.FieldUintFn("tx_count", decodeVarInt) d.FieldArray("transactions", func(d *decode.D) { for i := uint64(0); i < txCount; i++ { d.FieldFormat("transaction", bitcoinTranscationFormat, nil) diff --git a/format/bitcoin/bitcoin_script.go b/format/bitcoin/bitcoin_script.go index b96f8d77..67d74e1a 100644 --- a/format/bitcoin/bitcoin_script.go +++ b/format/bitcoin/bitcoin_script.go @@ -9,7 +9,7 @@ import ( type opcodeEntry struct { r [2]byte - s scalar.S + s scalar.Uint d func(d *decode.D, opcode byte) } @@ -24,8 +24,8 @@ func (ops opcodeEntries) lookup(u byte) (opcodeEntry, bool) { return opcodeEntry{}, false } -func (ops opcodeEntries) MapScalar(s scalar.S) (scalar.S, error) { - u := s.ActualU() +func (ops opcodeEntries) MapUint(s scalar.Uint) (scalar.Uint, error) { + u := s.Actual if fe, ok := ops.lookup(byte(u)); ok { s = fe.s s.Actual = u @@ -46,128 +46,128 @@ func init() { func decodeBitcoinScript(d *decode.D, in interface{}) interface{} { // based on https://en.bitcoin.it/wiki/Script opcodeEntries := opcodeEntries{ - {r: [2]byte{0x00, 0x00}, s: scalar.S{Sym: "false"}}, + {r: [2]byte{0x00, 0x00}, s: scalar.Uint{Sym: "false"}}, // TODO: name op code? - {r: [2]byte{0x01, 0x4b}, s: scalar.S{Sym: "pushself"}, d: func(d *decode.D, opcode byte) { + {r: [2]byte{0x01, 0x4b}, s: scalar.Uint{Sym: "pushself"}, d: func(d *decode.D, opcode byte) { d.FieldRawLen("arg", int64(opcode)*8) }}, - {r: [2]byte{0x04c, 0x4e}, s: scalar.S{Sym: "pushdata1"}, d: func(d *decode.D, opcode byte) { + {r: [2]byte{0x04c, 0x4e}, s: scalar.Uint{Sym: "pushdata1"}, d: func(d *decode.D, opcode byte) { argLen := d.FieldU8("arg_length") d.FieldRawLen("arg", int64(argLen)*8) }}, - {r: [2]byte{0x04c, 0x4e}, s: scalar.S{Sym: "pushdata2"}, d: func(d *decode.D, opcode byte) { + {r: [2]byte{0x04c, 0x4e}, s: scalar.Uint{Sym: "pushdata2"}, d: func(d *decode.D, opcode byte) { argLen := d.FieldU16("arg_length") d.FieldRawLen("arg", int64(argLen)*8) }}, - {r: [2]byte{0x04c, 0x4e}, s: scalar.S{Sym: "pushdata4"}, d: func(d *decode.D, opcode byte) { + {r: [2]byte{0x04c, 0x4e}, s: scalar.Uint{Sym: "pushdata4"}, d: func(d *decode.D, opcode byte) { argLen := d.FieldU32("arg_length") d.FieldRawLen("arg", int64(argLen)*8) }}, - {r: [2]byte{0x4f, 0x4f}, s: scalar.S{Sym: "1negate"}}, - {r: [2]byte{0x51, 0x51}, s: scalar.S{Sym: "true"}}, + {r: [2]byte{0x4f, 0x4f}, s: scalar.Uint{Sym: "1negate"}}, + {r: [2]byte{0x51, 0x51}, s: scalar.Uint{Sym: "true"}}, // TODO: name - {r: [2]byte{0x52, 0x60}, s: scalar.S{Sym: "push"}, d: func(d *decode.D, opcode byte) { - d.FieldValueU("arg", uint64(opcode-0x50)) + {r: [2]byte{0x52, 0x60}, s: scalar.Uint{Sym: "push"}, d: func(d *decode.D, opcode byte) { + d.FieldValueUint("arg", uint64(opcode-0x50)) }}, - {r: [2]byte{0x61, 0x61}, s: scalar.S{Sym: "nop"}}, - {r: [2]byte{0x62, 0x62}, s: scalar.S{Sym: "ver"}}, - {r: [2]byte{0x63, 0x63}, s: scalar.S{Sym: "if"}}, - {r: [2]byte{0x64, 0x64}, s: scalar.S{Sym: "notif"}}, - {r: [2]byte{0x65, 0x65}, s: scalar.S{Sym: "verif"}}, - {r: [2]byte{0x66, 0x66}, s: scalar.S{Sym: "vernotif"}}, - {r: [2]byte{0x67, 0x67}, s: scalar.S{Sym: "else"}}, - {r: [2]byte{0x68, 0x68}, s: scalar.S{Sym: "endif"}}, - {r: [2]byte{0x69, 0x69}, s: scalar.S{Sym: "verify"}}, - {r: [2]byte{0x6a, 0x6a}, s: scalar.S{Sym: "return"}}, - {r: [2]byte{0x6b, 0x6b}, s: scalar.S{Sym: "toaltstack"}}, - {r: [2]byte{0x6c, 0x6c}, s: scalar.S{Sym: "fromaltstack"}}, - {r: [2]byte{0x6d, 0x6d}, s: scalar.S{Sym: "2drop"}}, - {r: [2]byte{0x6e, 0x6e}, s: scalar.S{Sym: "2dup"}}, - {r: [2]byte{0x6f, 0x6f}, s: scalar.S{Sym: "3dup"}}, - {r: [2]byte{0x70, 0x70}, s: scalar.S{Sym: "2over"}}, - {r: [2]byte{0x71, 0x71}, s: scalar.S{Sym: "2rot"}}, - {r: [2]byte{0x72, 0x72}, s: scalar.S{Sym: "2swap"}}, - {r: [2]byte{0x73, 0x73}, s: scalar.S{Sym: "ifdup"}}, - {r: [2]byte{0x74, 0x74}, s: scalar.S{Sym: "depth"}}, - {r: [2]byte{0x75, 0x75}, s: scalar.S{Sym: "drop"}}, - {r: [2]byte{0x76, 0x76}, s: scalar.S{Sym: "dup"}}, - {r: [2]byte{0x77, 0x77}, s: scalar.S{Sym: "nip"}}, - {r: [2]byte{0x78, 0x78}, s: scalar.S{Sym: "over"}}, - {r: [2]byte{0x79, 0x79}, s: scalar.S{Sym: "pick"}}, - {r: [2]byte{0x7a, 0x7a}, s: scalar.S{Sym: "roll"}}, - {r: [2]byte{0x7b, 0x7b}, s: scalar.S{Sym: "rot"}}, - {r: [2]byte{0x7c, 0x7c}, s: scalar.S{Sym: "swap"}}, - {r: [2]byte{0x7d, 0x7d}, s: scalar.S{Sym: "tuck"}}, - {r: [2]byte{0x7e, 0x7e}, s: scalar.S{Sym: "cat"}}, - {r: [2]byte{0x7f, 0x7f}, s: scalar.S{Sym: "split"}}, - {r: [2]byte{0x80, 0x80}, s: scalar.S{Sym: "num2bin"}}, - {r: [2]byte{0x81, 0x81}, s: scalar.S{Sym: "bin2num"}}, - {r: [2]byte{0x82, 0x82}, s: scalar.S{Sym: "size"}}, - {r: [2]byte{0x83, 0x83}, s: scalar.S{Sym: "invert"}}, - {r: [2]byte{0x84, 0x84}, s: scalar.S{Sym: "and"}}, - {r: [2]byte{0x85, 0x85}, s: scalar.S{Sym: "or"}}, - {r: [2]byte{0x86, 0x86}, s: scalar.S{Sym: "xor"}}, - {r: [2]byte{0x87, 0x87}, s: scalar.S{Sym: "equal"}}, - {r: [2]byte{0x88, 0x88}, s: scalar.S{Sym: "equalverify"}}, - {r: [2]byte{0x89, 0x89}, s: scalar.S{Sym: "reserved1"}}, - {r: [2]byte{0x8a, 0x8a}, s: scalar.S{Sym: "reserved2"}}, - {r: [2]byte{0x8b, 0x8b}, s: scalar.S{Sym: "1add"}}, - {r: [2]byte{0x8c, 0x8c}, s: scalar.S{Sym: "1sub"}}, - {r: [2]byte{0x8d, 0x8d}, s: scalar.S{Sym: "2mul"}}, - {r: [2]byte{0x8e, 0x8e}, s: scalar.S{Sym: "2div"}}, - {r: [2]byte{0x8f, 0x8f}, s: scalar.S{Sym: "negate"}}, - {r: [2]byte{0x90, 0x90}, s: scalar.S{Sym: "abs"}}, - {r: [2]byte{0x91, 0x91}, s: scalar.S{Sym: "not"}}, - {r: [2]byte{0x92, 0x92}, s: scalar.S{Sym: "0notequal"}}, - {r: [2]byte{0x93, 0x93}, s: scalar.S{Sym: "add"}}, - {r: [2]byte{0x94, 0x94}, s: scalar.S{Sym: "sub"}}, - {r: [2]byte{0x95, 0x95}, s: scalar.S{Sym: "mul"}}, - {r: [2]byte{0x96, 0x96}, s: scalar.S{Sym: "div"}}, - {r: [2]byte{0x97, 0x97}, s: scalar.S{Sym: "mod"}}, - {r: [2]byte{0x98, 0x98}, s: scalar.S{Sym: "lshift"}}, - {r: [2]byte{0x99, 0x99}, s: scalar.S{Sym: "rshift"}}, - {r: [2]byte{0x9a, 0x9a}, s: scalar.S{Sym: "booland"}}, - {r: [2]byte{0x9b, 0x9b}, s: scalar.S{Sym: "boolor"}}, - {r: [2]byte{0x9c, 0x9c}, s: scalar.S{Sym: "numequal"}}, - {r: [2]byte{0x9d, 0x9d}, s: scalar.S{Sym: "numequalverify"}}, - {r: [2]byte{0x9e, 0x9e}, s: scalar.S{Sym: "numnotequal"}}, - {r: [2]byte{0x9f, 0x9f}, s: scalar.S{Sym: "lessthan"}}, - {r: [2]byte{0xa0, 0xa0}, s: scalar.S{Sym: "greaterthan"}}, - {r: [2]byte{0xa1, 0xa1}, s: scalar.S{Sym: "lessthanorequal"}}, - {r: [2]byte{0xa2, 0xa2}, s: scalar.S{Sym: "greaterthanorequal"}}, - {r: [2]byte{0xa3, 0xa3}, s: scalar.S{Sym: "min"}}, - {r: [2]byte{0xa4, 0xa4}, s: scalar.S{Sym: "max"}}, - {r: [2]byte{0xa5, 0xa5}, s: scalar.S{Sym: "within"}}, - {r: [2]byte{0xa6, 0xa6}, s: scalar.S{Sym: "ripemd160"}}, - {r: [2]byte{0xa7, 0xa7}, s: scalar.S{Sym: "sha1"}}, - {r: [2]byte{0xa8, 0xa8}, s: scalar.S{Sym: "sha256"}}, - {r: [2]byte{0xa9, 0xa9}, s: scalar.S{Sym: "hash160"}}, - {r: [2]byte{0xaa, 0xaa}, s: scalar.S{Sym: "hash256"}}, - {r: [2]byte{0xab, 0xab}, s: scalar.S{Sym: "codeseparator"}}, - {r: [2]byte{0xac, 0xac}, s: scalar.S{Sym: "checksig"}}, - {r: [2]byte{0xad, 0xad}, s: scalar.S{Sym: "checksigverify"}}, - {r: [2]byte{0xae, 0xae}, s: scalar.S{Sym: "checkmultisig"}}, - {r: [2]byte{0xaf, 0xaf}, s: scalar.S{Sym: "checkmultisigverify"}}, - {r: [2]byte{0xb0, 0xb0}, s: scalar.S{Sym: "nop1"}}, - {r: [2]byte{0xb1, 0xb1}, s: scalar.S{Sym: "nop2"}}, - {r: [2]byte{0xb1, 0xb1}, s: scalar.S{Sym: "checklocktimeverify"}}, - {r: [2]byte{0xb2, 0xb2}, s: scalar.S{Sym: "nop3"}}, - {r: [2]byte{0xb2, 0xb2}, s: scalar.S{Sym: "checksequenceverify"}}, - {r: [2]byte{0xb3, 0xb3}, s: scalar.S{Sym: "nop4"}}, - {r: [2]byte{0xb4, 0xb4}, s: scalar.S{Sym: "nop5"}}, - {r: [2]byte{0xb5, 0xb5}, s: scalar.S{Sym: "nop6"}}, - {r: [2]byte{0xb6, 0xb6}, s: scalar.S{Sym: "nop7"}}, - {r: [2]byte{0xb7, 0xb7}, s: scalar.S{Sym: "nop8"}}, - {r: [2]byte{0xb8, 0xb8}, s: scalar.S{Sym: "nop9"}}, - {r: [2]byte{0xb9, 0xb9}, s: scalar.S{Sym: "nop10"}}, - {r: [2]byte{0xba, 0xba}, s: scalar.S{Sym: "checkdatasig"}}, - {r: [2]byte{0xbb, 0xbb}, s: scalar.S{Sym: "checkdatasigverif"}}, - {r: [2]byte{0xfa, 0xfa}, s: scalar.S{Sym: "smallinteger"}}, - {r: [2]byte{0xfb, 0xfb}, s: scalar.S{Sym: "pubkeys"}}, - {r: [2]byte{0xfc, 0xfc}, s: scalar.S{Sym: "unknown252"}}, - {r: [2]byte{0xfd, 0xfd}, s: scalar.S{Sym: "pubkeyhash"}}, - {r: [2]byte{0xfe, 0xfe}, s: scalar.S{Sym: "pubkey"}}, - {r: [2]byte{0xff, 0xff}, s: scalar.S{Sym: "invalidopcode"}}, + {r: [2]byte{0x61, 0x61}, s: scalar.Uint{Sym: "nop"}}, + {r: [2]byte{0x62, 0x62}, s: scalar.Uint{Sym: "ver"}}, + {r: [2]byte{0x63, 0x63}, s: scalar.Uint{Sym: "if"}}, + {r: [2]byte{0x64, 0x64}, s: scalar.Uint{Sym: "notif"}}, + {r: [2]byte{0x65, 0x65}, s: scalar.Uint{Sym: "verif"}}, + {r: [2]byte{0x66, 0x66}, s: scalar.Uint{Sym: "vernotif"}}, + {r: [2]byte{0x67, 0x67}, s: scalar.Uint{Sym: "else"}}, + {r: [2]byte{0x68, 0x68}, s: scalar.Uint{Sym: "endif"}}, + {r: [2]byte{0x69, 0x69}, s: scalar.Uint{Sym: "verify"}}, + {r: [2]byte{0x6a, 0x6a}, s: scalar.Uint{Sym: "return"}}, + {r: [2]byte{0x6b, 0x6b}, s: scalar.Uint{Sym: "toaltstack"}}, + {r: [2]byte{0x6c, 0x6c}, s: scalar.Uint{Sym: "fromaltstack"}}, + {r: [2]byte{0x6d, 0x6d}, s: scalar.Uint{Sym: "2drop"}}, + {r: [2]byte{0x6e, 0x6e}, s: scalar.Uint{Sym: "2dup"}}, + {r: [2]byte{0x6f, 0x6f}, s: scalar.Uint{Sym: "3dup"}}, + {r: [2]byte{0x70, 0x70}, s: scalar.Uint{Sym: "2over"}}, + {r: [2]byte{0x71, 0x71}, s: scalar.Uint{Sym: "2rot"}}, + {r: [2]byte{0x72, 0x72}, s: scalar.Uint{Sym: "2swap"}}, + {r: [2]byte{0x73, 0x73}, s: scalar.Uint{Sym: "ifdup"}}, + {r: [2]byte{0x74, 0x74}, s: scalar.Uint{Sym: "depth"}}, + {r: [2]byte{0x75, 0x75}, s: scalar.Uint{Sym: "drop"}}, + {r: [2]byte{0x76, 0x76}, s: scalar.Uint{Sym: "dup"}}, + {r: [2]byte{0x77, 0x77}, s: scalar.Uint{Sym: "nip"}}, + {r: [2]byte{0x78, 0x78}, s: scalar.Uint{Sym: "over"}}, + {r: [2]byte{0x79, 0x79}, s: scalar.Uint{Sym: "pick"}}, + {r: [2]byte{0x7a, 0x7a}, s: scalar.Uint{Sym: "roll"}}, + {r: [2]byte{0x7b, 0x7b}, s: scalar.Uint{Sym: "rot"}}, + {r: [2]byte{0x7c, 0x7c}, s: scalar.Uint{Sym: "swap"}}, + {r: [2]byte{0x7d, 0x7d}, s: scalar.Uint{Sym: "tuck"}}, + {r: [2]byte{0x7e, 0x7e}, s: scalar.Uint{Sym: "cat"}}, + {r: [2]byte{0x7f, 0x7f}, s: scalar.Uint{Sym: "split"}}, + {r: [2]byte{0x80, 0x80}, s: scalar.Uint{Sym: "num2bin"}}, + {r: [2]byte{0x81, 0x81}, s: scalar.Uint{Sym: "bin2num"}}, + {r: [2]byte{0x82, 0x82}, s: scalar.Uint{Sym: "size"}}, + {r: [2]byte{0x83, 0x83}, s: scalar.Uint{Sym: "invert"}}, + {r: [2]byte{0x84, 0x84}, s: scalar.Uint{Sym: "and"}}, + {r: [2]byte{0x85, 0x85}, s: scalar.Uint{Sym: "or"}}, + {r: [2]byte{0x86, 0x86}, s: scalar.Uint{Sym: "xor"}}, + {r: [2]byte{0x87, 0x87}, s: scalar.Uint{Sym: "equal"}}, + {r: [2]byte{0x88, 0x88}, s: scalar.Uint{Sym: "equalverify"}}, + {r: [2]byte{0x89, 0x89}, s: scalar.Uint{Sym: "reserved1"}}, + {r: [2]byte{0x8a, 0x8a}, s: scalar.Uint{Sym: "reserved2"}}, + {r: [2]byte{0x8b, 0x8b}, s: scalar.Uint{Sym: "1add"}}, + {r: [2]byte{0x8c, 0x8c}, s: scalar.Uint{Sym: "1sub"}}, + {r: [2]byte{0x8d, 0x8d}, s: scalar.Uint{Sym: "2mul"}}, + {r: [2]byte{0x8e, 0x8e}, s: scalar.Uint{Sym: "2div"}}, + {r: [2]byte{0x8f, 0x8f}, s: scalar.Uint{Sym: "negate"}}, + {r: [2]byte{0x90, 0x90}, s: scalar.Uint{Sym: "abs"}}, + {r: [2]byte{0x91, 0x91}, s: scalar.Uint{Sym: "not"}}, + {r: [2]byte{0x92, 0x92}, s: scalar.Uint{Sym: "0notequal"}}, + {r: [2]byte{0x93, 0x93}, s: scalar.Uint{Sym: "add"}}, + {r: [2]byte{0x94, 0x94}, s: scalar.Uint{Sym: "sub"}}, + {r: [2]byte{0x95, 0x95}, s: scalar.Uint{Sym: "mul"}}, + {r: [2]byte{0x96, 0x96}, s: scalar.Uint{Sym: "div"}}, + {r: [2]byte{0x97, 0x97}, s: scalar.Uint{Sym: "mod"}}, + {r: [2]byte{0x98, 0x98}, s: scalar.Uint{Sym: "lshift"}}, + {r: [2]byte{0x99, 0x99}, s: scalar.Uint{Sym: "rshift"}}, + {r: [2]byte{0x9a, 0x9a}, s: scalar.Uint{Sym: "booland"}}, + {r: [2]byte{0x9b, 0x9b}, s: scalar.Uint{Sym: "boolor"}}, + {r: [2]byte{0x9c, 0x9c}, s: scalar.Uint{Sym: "numequal"}}, + {r: [2]byte{0x9d, 0x9d}, s: scalar.Uint{Sym: "numequalverify"}}, + {r: [2]byte{0x9e, 0x9e}, s: scalar.Uint{Sym: "numnotequal"}}, + {r: [2]byte{0x9f, 0x9f}, s: scalar.Uint{Sym: "lessthan"}}, + {r: [2]byte{0xa0, 0xa0}, s: scalar.Uint{Sym: "greaterthan"}}, + {r: [2]byte{0xa1, 0xa1}, s: scalar.Uint{Sym: "lessthanorequal"}}, + {r: [2]byte{0xa2, 0xa2}, s: scalar.Uint{Sym: "greaterthanorequal"}}, + {r: [2]byte{0xa3, 0xa3}, s: scalar.Uint{Sym: "min"}}, + {r: [2]byte{0xa4, 0xa4}, s: scalar.Uint{Sym: "max"}}, + {r: [2]byte{0xa5, 0xa5}, s: scalar.Uint{Sym: "within"}}, + {r: [2]byte{0xa6, 0xa6}, s: scalar.Uint{Sym: "ripemd160"}}, + {r: [2]byte{0xa7, 0xa7}, s: scalar.Uint{Sym: "sha1"}}, + {r: [2]byte{0xa8, 0xa8}, s: scalar.Uint{Sym: "sha256"}}, + {r: [2]byte{0xa9, 0xa9}, s: scalar.Uint{Sym: "hash160"}}, + {r: [2]byte{0xaa, 0xaa}, s: scalar.Uint{Sym: "hash256"}}, + {r: [2]byte{0xab, 0xab}, s: scalar.Uint{Sym: "codeseparator"}}, + {r: [2]byte{0xac, 0xac}, s: scalar.Uint{Sym: "checksig"}}, + {r: [2]byte{0xad, 0xad}, s: scalar.Uint{Sym: "checksigverify"}}, + {r: [2]byte{0xae, 0xae}, s: scalar.Uint{Sym: "checkmultisig"}}, + {r: [2]byte{0xaf, 0xaf}, s: scalar.Uint{Sym: "checkmultisigverify"}}, + {r: [2]byte{0xb0, 0xb0}, s: scalar.Uint{Sym: "nop1"}}, + {r: [2]byte{0xb1, 0xb1}, s: scalar.Uint{Sym: "nop2"}}, + {r: [2]byte{0xb1, 0xb1}, s: scalar.Uint{Sym: "checklocktimeverify"}}, + {r: [2]byte{0xb2, 0xb2}, s: scalar.Uint{Sym: "nop3"}}, + {r: [2]byte{0xb2, 0xb2}, s: scalar.Uint{Sym: "checksequenceverify"}}, + {r: [2]byte{0xb3, 0xb3}, s: scalar.Uint{Sym: "nop4"}}, + {r: [2]byte{0xb4, 0xb4}, s: scalar.Uint{Sym: "nop5"}}, + {r: [2]byte{0xb5, 0xb5}, s: scalar.Uint{Sym: "nop6"}}, + {r: [2]byte{0xb6, 0xb6}, s: scalar.Uint{Sym: "nop7"}}, + {r: [2]byte{0xb7, 0xb7}, s: scalar.Uint{Sym: "nop8"}}, + {r: [2]byte{0xb8, 0xb8}, s: scalar.Uint{Sym: "nop9"}}, + {r: [2]byte{0xb9, 0xb9}, s: scalar.Uint{Sym: "nop10"}}, + {r: [2]byte{0xba, 0xba}, s: scalar.Uint{Sym: "checkdatasig"}}, + {r: [2]byte{0xbb, 0xbb}, s: scalar.Uint{Sym: "checkdatasigverif"}}, + {r: [2]byte{0xfa, 0xfa}, s: scalar.Uint{Sym: "smallinteger"}}, + {r: [2]byte{0xfb, 0xfb}, s: scalar.Uint{Sym: "pubkeys"}}, + {r: [2]byte{0xfc, 0xfc}, s: scalar.Uint{Sym: "unknown252"}}, + {r: [2]byte{0xfd, 0xfd}, s: scalar.Uint{Sym: "pubkeyhash"}}, + {r: [2]byte{0xfe, 0xfe}, s: scalar.Uint{Sym: "pubkey"}}, + {r: [2]byte{0xff, 0xff}, s: scalar.Uint{Sym: "invalidopcode"}}, } for !d.End() { diff --git a/format/bitcoin/bitcoin_transaction.go b/format/bitcoin/bitcoin_transaction.go index 6ee827d6..2bb88500 100644 --- a/format/bitcoin/bitcoin_transaction.go +++ b/format/bitcoin/bitcoin_transaction.go @@ -54,27 +54,27 @@ func decodeBitcoinTranscation(d *decode.D, in interface{}) interface{} { d.FieldU8("marker") d.FieldU8("flag") } - inputCount := d.FieldUFn("input_count", decodeVarInt) + inputCount := d.FieldUintFn("input_count", decodeVarInt) d.FieldArray("inputs", func(d *decode.D) { for i := uint64(0); i < inputCount; i++ { d.FieldStruct("input", func(d *decode.D) { - d.FieldRawLen("txid", 32*8, scalar.BytesToScalar{ - {Bytes: txIDCoinbaseBytes[:], Scalar: scalar.S{Description: "coinbase"}}, + d.FieldRawLen("txid", 32*8, scalar.RawBytesMap{ + {Bytes: txIDCoinbaseBytes[:], Scalar: scalar.BitBuf{Description: "coinbase"}}, }, rawHexReverse) d.FieldU32("vout") - scriptSigSize := d.FieldUFn("scriptsig_size", decodeVarInt) + scriptSigSize := d.FieldUintFn("scriptsig_size", decodeVarInt) d.FieldFormatOrRawLen("scriptsig", int64(scriptSigSize)*8, bitcoinScriptFormat, nil) // TODO: better way to know if there should be a valid script - d.FieldU32("sequence", scalar.ActualHex) + d.FieldU32("sequence", scalar.UintHex) }) } }) - outputCount := d.FieldUFn("output_count", decodeVarInt) + outputCount := d.FieldUintFn("output_count", decodeVarInt) d.FieldArray("outputs", func(d *decode.D) { for i := uint64(0); i < outputCount; i++ { d.FieldStruct("output", func(d *decode.D) { d.FieldU64("value") - scriptSigSize := d.FieldUFn("scriptpub_size", decodeVarInt) + scriptSigSize := d.FieldUintFn("scriptpub_size", decodeVarInt) // TODO: better way to know if there should be a valid script d.FieldFormatOrRawLen("scriptpub", int64(scriptSigSize)*8, bitcoinScriptFormat, nil) }) @@ -85,10 +85,10 @@ func decodeBitcoinTranscation(d *decode.D, in interface{}) interface{} { d.FieldArray("witnesses", func(d *decode.D) { for i := uint64(0); i < inputCount; i++ { d.FieldStruct("witness", func(d *decode.D) { - witnessSize := d.FieldUFn("witness_size", decodeVarInt) + witnessSize := d.FieldUintFn("witness_size", decodeVarInt) d.FieldArray("items", func(d *decode.D) { for j := uint64(0); j < witnessSize; j++ { - itemSize := d.FieldUFn("item_size", decodeVarInt) + itemSize := d.FieldUintFn("item_size", decodeVarInt) d.FieldRawLen("item", int64(itemSize)*8) } }) diff --git a/format/bits/bits.go b/format/bits/bits.go index 336b5de6..03509c1f 100644 --- a/format/bits/bits.go +++ b/format/bits/bits.go @@ -15,7 +15,7 @@ var bitsFS embed.FS func decodeBits(unit int) func(d *decode.D, _ any) any { return func(d *decode.D, _ any) any { - var s scalar.S + var s scalar.Any b, _ := interp.NewBinaryFromBitReader(d.BitBufRange(0, d.Len()), unit, 0) s.Actual = b d.Value.V = &s diff --git a/format/bplist/bplist.go b/format/bplist/bplist.go index ff87cc8c..b78bf012 100644 --- a/format/bplist/bplist.go +++ b/format/bplist/bplist.go @@ -47,7 +47,7 @@ const ( boolTrue = 0x09 ) -var elementTypeMap = scalar.UToScalar{ +var elementTypeMap = scalar.UintMap{ elementTypeNullOrBoolOrFill: {Sym: "singleton", Description: "Singleton value (null/bool)"}, elementTypeInt: {Sym: "int", Description: "Integer"}, elementTypeReal: {Sym: "real", Description: "Floating Point Number"}, @@ -64,13 +64,13 @@ var elementTypeMap = scalar.UToScalar{ var cocoaTimeEpochDate = time.Date(2001, time.January, 1, 0, 0, 0, 0, time.UTC) // decodes the number of bits required to store the following object -func decodeSize(d *decode.D, sms ...scalar.Mapper) uint64 { +func decodeSize(d *decode.D, sms ...scalar.UintMapper) uint64 { n := d.FieldU4("size_bits") if n != 0x0f { return n } - d.FieldU4("large_size_marker", d.AssertU(0b0001)) + d.FieldU4("large_size_marker", d.UintAssert(0b0001)) // get the exponent value n = d.FieldU4("exponent") @@ -79,11 +79,11 @@ func decodeSize(d *decode.D, sms ...scalar.Mapper) uint64 { n = 1 << n // decode that many bytes as big endian - n = d.FieldUFn( + n = d.FieldUintFn( "size_bigint", func(d *decode.D) uint64 { v := d.UBigInt(int(n * 8)) - d.AssertBigIntRange(big.NewInt(1), big.NewInt(math.MaxInt64)) + d.BigIntAssertRange(big.NewInt(1), big.NewInt(math.MaxInt64)) return v.Uint64() }, sms...) @@ -98,13 +98,13 @@ func decodeItem(d *decode.D, p *plist) bool { m := d.FieldU4("type", elementTypeMap) switch m { case elementTypeNullOrBoolOrFill: - d.FieldU4("value", scalar.UToScalar{ - null: scalar.S{Sym: nil}, - boolTrue: scalar.S{Sym: true}, - boolFalse: scalar.S{Sym: false}, + d.FieldU4("value", scalar.UintMap{ + null: scalar.Uint{Sym: nil}, + boolTrue: scalar.Uint{Sym: true}, + boolFalse: scalar.Uint{Sym: false}, }) case elementTypeInt, elementTypeUID: - n := d.FieldUFn("size", func(d *decode.D) uint64 { + n := d.FieldUintFn("size", func(d *decode.D) uint64 { return 1 << d.U4() }) switch n { @@ -123,29 +123,29 @@ func decodeItem(d *decode.D, p *plist) bool { } case elementTypeReal: n := 1 << decodeSize(d) - d.FieldValueU("size", uint64(n)) + d.FieldValueUint("size", uint64(n)) d.FieldF("value", n*8) case elementTypeDate: - n := 1 << decodeSize(d, d.AssertU(4, 8)) - d.FieldValueU("size", uint64(n)) - d.FieldF("value", n*8, scalar.DescriptionTimeFn(scalar.S.TryActualF, cocoaTimeEpochDate, time.RFC3339)) + n := 1 << decodeSize(d, d.UintAssert(4, 8)) + d.FieldValueUint("size", uint64(n)) + d.FieldF("value", n*8, scalar.FltActualDate(cocoaTimeEpochDate, time.RFC3339)) case elementTypeData: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldRawLen("value", int64(n*8)) case elementTypeASCIIString: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldUTF8("value", int(n)) return true case elementTypeUnicodeString: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldUTF16BE("value", int(n)) return true case elementTypeArray: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldStructNArray("entries", "entry", int64(n), func(d *decode.D) { idx := d.FieldU("object_index", int(p.t.objRefSize)*8) @@ -153,7 +153,7 @@ func decodeItem(d *decode.D, p *plist) bool { }) case elementTypeSet: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldStructNArray("entries", "entry", int64(n), func(d *decode.D) { idx := d.FieldU("object_index", int(p.t.objRefSize)*8) @@ -161,7 +161,7 @@ func decodeItem(d *decode.D, p *plist) bool { }) case elementTypeDict: n := decodeSize(d) - d.FieldValueU("size", n) + d.FieldValueUint("size", n) d.FieldStructNArray("entries", "entry", int64(n), func(d *decode.D) { var ki, vi uint64 @@ -248,8 +248,8 @@ type plist struct { func bplistDecode(d *decode.D, _ any) any { d.FieldStruct("header", func(d *decode.D) { - d.FieldUTF8("magic", 6, d.AssertStr("bplist")) - d.FieldUTF8("version", 2, d.AssertStr("00")) + d.FieldUTF8("magic", 6, d.StrAssert("bplist")) + d.FieldUTF8("version", 2, d.StrAssert("00")) }) p := new(plist) @@ -259,8 +259,8 @@ func bplistDecode(d *decode.D, _ any) any { d.FieldStruct("trailer", func(d *decode.D) { d.FieldU40("unused") d.FieldS8("sort_version") - p.t.offTblOffSize = d.FieldU8("offset_table_offset_size", d.AssertURange(1, 8)) - p.t.objRefSize = d.FieldU8("object_reference_size", d.AssertURange(1, 8)) + p.t.offTblOffSize = d.FieldU8("offset_table_offset_size", d.UintAssertRange(1, 8)) + p.t.objRefSize = d.FieldU8("object_reference_size", d.UintAssertRange(1, 8)) p.t.nObjects = d.FieldU64("object_count") p.t.topObjectOffset = d.FieldU64("top_object_offset") p.t.offsetTableStart = d.FieldU64("offset_table_start") diff --git a/format/bson/bson.go b/format/bson/bson.go index 2e201348..913cdfb2 100644 --- a/format/bson/bson.go +++ b/format/bson/bson.go @@ -43,7 +43,7 @@ const ( elementTypeInt64 = 0x12 ) -var elementTypeMap = scalar.UToScalar{ +var elementTypeMap = scalar.UintMap{ elementTypeDouble: {Sym: "double", Description: "64-bit binary floating point"}, elementTypeString: {Sym: "string", Description: "UTF-8 string"}, elementTypeDocument: {Sym: "document", Description: "Embedded document"}, @@ -91,7 +91,7 @@ func decodeBSONDocument(d *decode.D) { case elementTypeDatatime: d.FieldS32("value") case elementTypeNull: - d.FieldValueNil("value") + d.FieldValueAny("value", nil) case elementTypeRegexp: d.FieldUTF8Null("value") d.FieldUTF8Null("options") @@ -107,7 +107,7 @@ func decodeBSONDocument(d *decode.D) { }) } }) - d.FieldU8("terminator", d.ValidateU(0)) + d.FieldU8("terminator", d.UintValidate(0)) }) } diff --git a/format/bzip2/bzip2.go b/format/bzip2/bzip2.go index 39082e88..4569b56f 100644 --- a/format/bzip2/bzip2.go +++ b/format/bzip2/bzip2.go @@ -58,7 +58,7 @@ func bzip2Decode(d *decode.D, _ any) any { var blockCRCValue *decode.Value var streamCRCN uint32 - d.FieldUTF8("magic", 2, d.AssertStr("BZ")) + d.FieldUTF8("magic", 2, d.StrAssert("BZ")) d.FieldU8("version") d.FieldU8("hundred_k_blocksize") @@ -67,8 +67,8 @@ func bzip2Decode(d *decode.D, _ any) any { // moreStreams = false // return // } - d.FieldU48("magic", d.AssertU(blockMagic), scalar.ActualHex) - d.FieldU32("crc", scalar.ActualHex) + d.FieldU48("magic", d.UintAssert(blockMagic), scalar.UintHex) + d.FieldU32("crc", scalar.UintHex) blockCRCValue = d.FieldGet("crc") d.FieldU1("randomised") d.FieldU24("origptr") @@ -91,7 +91,7 @@ func bzip2Decode(d *decode.D, _ any) any { }) treesI := uint64(0) d.FieldArrayLoop("trees", func() bool { return treesI < numTrees }, func(d *decode.D) { - d.FieldUFn("tree", func(d *decode.D) uint64 { + d.FieldUintFn("tree", func(d *decode.D) uint64 { l := d.U5() if !d.Bool() { return l @@ -118,7 +118,7 @@ func bzip2Decode(d *decode.D, _ any) any { blockCRC32W := crc32.NewIEEE() d.Copy(blockCRC32W, bitFlipReader{bitio.NewIOReader(uncompressedBR)}) blockCRC32N := bits.Reverse32(binary.BigEndian.Uint32(blockCRC32W.Sum(nil))) - _ = blockCRCValue.TryScalarFn(d.ValidateU(uint64(blockCRC32N))) + _ = blockCRCValue.TryUintScalarFn(d.UintValidate(uint64(blockCRC32N))) streamCRCN = blockCRC32N ^ ((streamCRCN << 1) | (streamCRCN >> 31)) // HACK: bzip2.NewReader will read from start of whole buffer and then we figure out compressedSize ourself @@ -137,9 +137,9 @@ func bzip2Decode(d *decode.D, _ any) any { d.FieldRawLen("compressed", compressedSize) d.FieldStruct("footer", func(d *decode.D) { - d.FieldU48("magic", d.AssertU(footerMagic), scalar.ActualHex) + d.FieldU48("magic", d.UintAssert(footerMagic), scalar.UintHex) // TODO: crc of block crcs - d.FieldU32("crc", scalar.ActualHex, d.ValidateU(uint64(streamCRCN))) + d.FieldU32("crc", scalar.UintHex, d.UintValidate(uint64(streamCRCN))) d.FieldRawLen("padding", int64(d.ByteAlignBits())) }) } diff --git a/format/cbor/cbor.go b/format/cbor/cbor.go index 5f93cd8c..390a18f8 100644 --- a/format/cbor/cbor.go +++ b/format/cbor/cbor.go @@ -35,14 +35,14 @@ func init() { } type majorTypeEntry struct { - s scalar.S + s scalar.Uint d func(d *decode.D, shortCount uint64, count uint64) any } type majorTypeEntries map[uint64]majorTypeEntry -func (mts majorTypeEntries) MapScalar(s scalar.S) (scalar.S, error) { - u := s.ActualU() +func (mts majorTypeEntries) MapUint(s scalar.Uint) (scalar.Uint, error) { + u := s.Actual if fe, ok := mts[u]; ok { s = fe.s s.Actual = u @@ -67,7 +67,7 @@ const ( shortCountSpecialFloat64Bit = 27 ) -var shortCountMap = scalar.UToSymStr{ +var shortCountMap = scalar.UintMapSymStr{ shortCountVariable8Bit: "8bit", shortCountVariable16Bit: "16bit", shortCountVariable32Bit: "32bit", @@ -75,7 +75,7 @@ var shortCountMap = scalar.UToSymStr{ shortCountIndefinite: "indefinite", } -var tagMap = scalar.UToSymStr{ +var tagMap = scalar.UintMapSymStr{ 0: "date_time", 1: "epoch_date_time", 2: "unsigned_bignum", @@ -110,17 +110,17 @@ const ( func decodeCBORValue(d *decode.D) any { majorTypeMap := majorTypeEntries{ - majorTypePositiveInt: {s: scalar.S{Sym: "positive_int"}, d: func(d *decode.D, shortCount uint64, count uint64) any { - d.FieldValueU("value", count) + majorTypePositiveInt: {s: scalar.Uint{Sym: "positive_int"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + d.FieldValueUint("value", count) return nil }}, - majorTypeNegativeInt: {s: scalar.S{Sym: "negative_int"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeNegativeInt: {s: scalar.Uint{Sym: "negative_int"}, d: func(d *decode.D, shortCount uint64, count uint64) any { n := new(big.Int) n.SetUint64(count).Neg(n).Sub(n, mathex.BigIntOne) d.FieldValueBigInt("value", n) return nil }}, - majorTypeBytes: {s: scalar.S{Sym: "bytes"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeBytes: {s: scalar.Uint{Sym: "bytes"}, d: func(d *decode.D, shortCount uint64, count uint64) any { if shortCount == shortCountIndefinite { bb := &bytes.Buffer{} d.FieldArray("items", func(d *decode.D) { @@ -145,7 +145,7 @@ func decodeCBORValue(d *decode.D) any { return buf }}, - majorTypeUTF8: {s: scalar.S{Sym: "utf8"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeUTF8: {s: scalar.Uint{Sym: "utf8"}, d: func(d *decode.D, shortCount uint64, count uint64) any { if shortCount == shortCountIndefinite { sb := &strings.Builder{} d.FieldArray("items", func(d *decode.D) { @@ -168,7 +168,7 @@ func decodeCBORValue(d *decode.D) any { return d.FieldUTF8("value", int(count)) }}, - majorTypeArray: {s: scalar.S{Sym: "array"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeArray: {s: scalar.Uint{Sym: "array"}, d: func(d *decode.D, shortCount uint64, count uint64) any { d.FieldArray("elements", func(d *decode.D) { for i := uint64(0); true; i++ { if shortCount == shortCountIndefinite && d.PeekBits(8) == breakMarker { @@ -184,7 +184,7 @@ func decodeCBORValue(d *decode.D) any { } return nil }}, - majorTypeMap: {s: scalar.S{Sym: "map"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeMap: {s: scalar.Uint{Sym: "map"}, d: func(d *decode.D, shortCount uint64, count uint64) any { d.FieldArray("pairs", func(d *decode.D) { for i := uint64(0); true; i++ { if shortCount == shortCountIndefinite && d.PeekBits(8) == breakMarker { @@ -203,12 +203,12 @@ func decodeCBORValue(d *decode.D) any { } return nil }}, - majorTypeSematic: {s: scalar.S{Sym: "semantic"}, d: func(d *decode.D, shortCount uint64, count uint64) any { - d.FieldValueU("tag", count, tagMap) + majorTypeSematic: {s: scalar.Uint{Sym: "semantic"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + d.FieldValueUint("tag", count, tagMap) d.FieldStruct("value", func(d *decode.D) { decodeCBORValue(d) }) return nil }}, - majorTypeSpecialFloat: {s: scalar.S{Sym: "special_float"}, d: func(d *decode.D, shortCount uint64, count uint64) any { + majorTypeSpecialFloat: {s: scalar.Uint{Sym: "special_float"}, d: func(d *decode.D, shortCount uint64, count uint64) any { switch shortCount { // TODO: 0-19 case shortCountSpecialFalse: @@ -216,7 +216,7 @@ func decodeCBORValue(d *decode.D) any { case shortCountSpecialTrue: d.FieldValueBool("value", true) case shortCountSpecialNull: - d.FieldValueNil("value") + d.FieldValueAny("value", nil) case shortCountSpecialUndefined: // TODO: undefined case 24: diff --git a/format/csv/csv.go b/format/csv/csv.go index aba0dca3..b3bf8761 100644 --- a/format/csv/csv.go +++ b/format/csv/csv.go @@ -64,7 +64,7 @@ func decodeCSV(d *decode.D, in any) any { rvs = append(rvs, vs) } - d.Value.V = &scalar.S{Actual: rvs} + d.Value.V = &scalar.Any{Actual: rvs} d.Value.Range.Len = d.Len() return nil diff --git a/format/dns/dns.go b/format/dns/dns.go index c958eaa7..77fc36ce 100644 --- a/format/dns/dns.go +++ b/format/dns/dns.go @@ -26,18 +26,18 @@ const ( classIN = 1 ) -var classNames = scalar.URangeToScalar{ - {Range: [2]uint64{0x0000, 0x0000}, S: scalar.S{Sym: "reserved", Description: "Reserved"}}, - {Range: [2]uint64{classIN, classIN}, S: scalar.S{Sym: "in", Description: "Internet"}}, - {Range: [2]uint64{0x0002, 0x0002}, S: scalar.S{Sym: "unassigned", Description: "Unassigned"}}, - {Range: [2]uint64{0x0003, 0x0003}, S: scalar.S{Sym: "chaos", Description: "Chaos"}}, - {Range: [2]uint64{0x0004, 0x0004}, S: scalar.S{Sym: "hesiod", Description: "Hesiod"}}, - {Range: [2]uint64{0x0005, 0x00fd}, S: scalar.S{Sym: "unassigned", Description: "Unassigned"}}, - {Range: [2]uint64{0x00fe, 0x00fe}, S: scalar.S{Sym: "qclass_none", Description: "QCLASS NONE"}}, - {Range: [2]uint64{0x00ff, 0x00ff}, S: scalar.S{Sym: "qclass_any", Description: "QCLASS ANY"}}, - {Range: [2]uint64{0x0100, 0xfeff}, S: scalar.S{Sym: "unassigned", Description: "Unassigned"}}, - {Range: [2]uint64{0xff00, 0xfffe}, S: scalar.S{Sym: "private", Description: "Reserved for Private Use"}}, - {Range: [2]uint64{0xffff, 0xffff}, S: scalar.S{Sym: "reserved", Description: "Reserved"}}, +var classNames = scalar.UintRangeToScalar{ + {Range: [2]uint64{0x0000, 0x0000}, S: scalar.Uint{Sym: "reserved", Description: "Reserved"}}, + {Range: [2]uint64{classIN, classIN}, S: scalar.Uint{Sym: "in", Description: "Internet"}}, + {Range: [2]uint64{0x0002, 0x0002}, S: scalar.Uint{Sym: "unassigned", Description: "Unassigned"}}, + {Range: [2]uint64{0x0003, 0x0003}, S: scalar.Uint{Sym: "chaos", Description: "Chaos"}}, + {Range: [2]uint64{0x0004, 0x0004}, S: scalar.Uint{Sym: "hesiod", Description: "Hesiod"}}, + {Range: [2]uint64{0x0005, 0x00fd}, S: scalar.Uint{Sym: "unassigned", Description: "Unassigned"}}, + {Range: [2]uint64{0x00fe, 0x00fe}, S: scalar.Uint{Sym: "qclass_none", Description: "QCLASS NONE"}}, + {Range: [2]uint64{0x00ff, 0x00ff}, S: scalar.Uint{Sym: "qclass_any", Description: "QCLASS ANY"}}, + {Range: [2]uint64{0x0100, 0xfeff}, S: scalar.Uint{Sym: "unassigned", Description: "Unassigned"}}, + {Range: [2]uint64{0xff00, 0xfffe}, S: scalar.Uint{Sym: "private", Description: "Reserved for Private Use"}}, + {Range: [2]uint64{0xffff, 0xffff}, S: scalar.Uint{Sym: "reserved", Description: "Reserved"}}, } const ( @@ -50,7 +50,7 @@ const ( typeAAAA = 28 ) -var typeNames = scalar.UToSymStr{ +var typeNames = scalar.UintMapSymStr{ typeA: "a", typeAAAA: "aaaa", 18: "afsdb", @@ -100,7 +100,7 @@ var typeNames = scalar.UToSymStr{ 65: "https", } -var rcodeNames = scalar.UToScalar{ +var rcodeNames = scalar.UintMap{ 0: {Sym: "no_error", Description: "No error"}, 1: {Sym: "form_err", Description: "Format error"}, 2: {Sym: "serv_fail", Description: "Server failure"}, @@ -230,11 +230,11 @@ func dnsDecode(d *decode.D, hasLengthHeader bool) any { d.FieldU16("length") } d.FieldU16("id") - d.FieldU1("qr", scalar.UToSymStr{ + d.FieldU1("qr", scalar.UintMapSymStr{ 0: "query", 1: "response", }) - d.FieldU4("opcode", scalar.UToSymStr{ + d.FieldU4("opcode", scalar.UintMapSymStr{ 0: "query", 1: "iquery", 2: "status", diff --git a/format/elf/elf.go b/format/elf/elf.go index 7d054066..16a473fa 100644 --- a/format/elf/elf.go +++ b/format/elf/elf.go @@ -31,12 +31,12 @@ const ( BIG_ENDIAN = 2 ) -var endianNames = scalar.UToSymStr{ +var endianNames = scalar.UintMapSymStr{ LITTLE_ENDIAN: "little_endian", BIG_ENDIAN: "big_endian", } -var classBits = scalar.UToSymU{ +var classBits = scalar.UintMapSymUint{ 1: 32, 2: 64, } @@ -46,7 +46,7 @@ const ( CLASS_64 = 2 ) -var osABINames = scalar.UToSymStr{ +var osABINames = scalar.UintMapSymStr{ 0: "sysv", 1: "hpux", 2: "netbsd", @@ -72,14 +72,14 @@ const ( ET_CORE = 4 ) -var typeNames = scalar.URangeToScalar{ - {Range: [2]uint64{ET_NONE, ET_NONE}, S: scalar.S{Sym: "none"}}, - {Range: [2]uint64{ET_REL, ET_REL}, S: scalar.S{Sym: "rel"}}, - {Range: [2]uint64{ET_EXEC, ET_EXEC}, S: scalar.S{Sym: "exec"}}, - {Range: [2]uint64{ET_DYN, ET_DYN}, S: scalar.S{Sym: "dyn"}}, - {Range: [2]uint64{ET_CORE, ET_CORE}, S: scalar.S{Sym: "core"}}, - {Range: [2]uint64{0xfe00, 0xfeff}, S: scalar.S{Sym: "os"}}, - {Range: [2]uint64{0xff00, 0xffff}, S: scalar.S{Sym: "proc"}}, +var typeNames = scalar.UintRangeToScalar{ + {Range: [2]uint64{ET_NONE, ET_NONE}, S: scalar.Uint{Sym: "none"}}, + {Range: [2]uint64{ET_REL, ET_REL}, S: scalar.Uint{Sym: "rel"}}, + {Range: [2]uint64{ET_EXEC, ET_EXEC}, S: scalar.Uint{Sym: "exec"}}, + {Range: [2]uint64{ET_DYN, ET_DYN}, S: scalar.Uint{Sym: "dyn"}}, + {Range: [2]uint64{ET_CORE, ET_CORE}, S: scalar.Uint{Sym: "core"}}, + {Range: [2]uint64{0xfe00, 0xfeff}, S: scalar.Uint{Sym: "os"}}, + {Range: [2]uint64{0xff00, 0xffff}, S: scalar.Uint{Sym: "proc"}}, } const ( @@ -87,7 +87,7 @@ const ( EM_ARM64 = 0xb7 ) -var machineNames = scalar.UToScalar{ +var machineNames = scalar.UintMap{ 0x00: {Description: "No specific instruction set"}, 0x01: {Sym: "we_32100", Description: "AT&T WE 32100"}, 0x02: {Sym: "sparc", Description: "SPARC"}, @@ -151,20 +151,20 @@ const ( PT_TLS = 7 ) -var phTypeNames = scalar.URangeToScalar{ - {Range: [2]uint64{PT_NULL, PT_NULL}, S: scalar.S{Sym: "null", Description: "Unused element"}}, - {Range: [2]uint64{PT_LOAD, PT_LOAD}, S: scalar.S{Sym: "load", Description: "Loadable segment"}}, - {Range: [2]uint64{PT_DYNAMIC, PT_DYNAMIC}, S: scalar.S{Sym: "dynamic", Description: "Dynamic linking information"}}, - {Range: [2]uint64{PT_INTERP, PT_INTERP}, S: scalar.S{Sym: "interp", Description: "Interpreter to invoke"}}, - {Range: [2]uint64{PT_NOTE, PT_NOTE}, S: scalar.S{Sym: "note", Description: "Auxiliary information"}}, - {Range: [2]uint64{PT_SHLIB, PT_SHLIB}, S: scalar.S{Sym: "shlib", Description: "Reserved but has unspecified"}}, - {Range: [2]uint64{PT_PHDR, PT_PHDR}, S: scalar.S{Sym: "phdr", Description: "Program header location and size"}}, - {Range: [2]uint64{PT_TLS, PT_TLS}, S: scalar.S{Sym: "tls", Description: "Thread-Local Storage template"}}, - {Range: [2]uint64{0x6474e550, 0x6474e550}, S: scalar.S{Sym: "gnu_eh_frame", Description: "GNU frame unwind information"}}, - {Range: [2]uint64{0x6474e551, 0x6474e551}, S: scalar.S{Sym: "gnu_stack", Description: "GNU stack permission"}}, - {Range: [2]uint64{0x6474e552, 0x6474e552}, S: scalar.S{Sym: "gnu_relro", Description: "GNU read-only after relocation"}}, - {Range: [2]uint64{0x60000000, 0x6fffffff}, S: scalar.S{Sym: "os", Description: "Operating system-specific"}}, - {Range: [2]uint64{0x70000000, 0x7fffffff}, S: scalar.S{Sym: "proc", Description: "Processor-specific"}}, +var phTypeNames = scalar.UintRangeToScalar{ + {Range: [2]uint64{PT_NULL, PT_NULL}, S: scalar.Uint{Sym: "null", Description: "Unused element"}}, + {Range: [2]uint64{PT_LOAD, PT_LOAD}, S: scalar.Uint{Sym: "load", Description: "Loadable segment"}}, + {Range: [2]uint64{PT_DYNAMIC, PT_DYNAMIC}, S: scalar.Uint{Sym: "dynamic", Description: "Dynamic linking information"}}, + {Range: [2]uint64{PT_INTERP, PT_INTERP}, S: scalar.Uint{Sym: "interp", Description: "Interpreter to invoke"}}, + {Range: [2]uint64{PT_NOTE, PT_NOTE}, S: scalar.Uint{Sym: "note", Description: "Auxiliary information"}}, + {Range: [2]uint64{PT_SHLIB, PT_SHLIB}, S: scalar.Uint{Sym: "shlib", Description: "Reserved but has unspecified"}}, + {Range: [2]uint64{PT_PHDR, PT_PHDR}, S: scalar.Uint{Sym: "phdr", Description: "Program header location and size"}}, + {Range: [2]uint64{PT_TLS, PT_TLS}, S: scalar.Uint{Sym: "tls", Description: "Thread-Local Storage template"}}, + {Range: [2]uint64{0x6474e550, 0x6474e550}, S: scalar.Uint{Sym: "gnu_eh_frame", Description: "GNU frame unwind information"}}, + {Range: [2]uint64{0x6474e551, 0x6474e551}, S: scalar.Uint{Sym: "gnu_stack", Description: "GNU stack permission"}}, + {Range: [2]uint64{0x6474e552, 0x6474e552}, S: scalar.Uint{Sym: "gnu_relro", Description: "GNU read-only after relocation"}}, + {Range: [2]uint64{0x60000000, 0x6fffffff}, S: scalar.Uint{Sym: "os", Description: "Operating system-specific"}}, + {Range: [2]uint64{0x70000000, 0x7fffffff}, S: scalar.Uint{Sym: "proc", Description: "Processor-specific"}}, } const ( @@ -236,7 +236,7 @@ const ( NT_LOONGARCH_LBT = 0xa04 ) -var coreNoteNames = scalar.UToScalar{ +var coreNoteNames = scalar.UintMap{ NT_PRSTATUS: {Sym: "prstatus"}, NT_PRFPREG: {Sym: "prfpreg"}, NT_PRPSINFO: {Sym: "prpsinfo"}, @@ -325,7 +325,7 @@ const ( SHT_GNU_HASH = 0x6ffffff6 ) -var sectionHeaderTypeMap = scalar.UToScalar{ +var sectionHeaderTypeMap = scalar.UintMap{ SHT_NULL: {Sym: "null", Description: "Header inactive"}, SHT_PROGBITS: {Sym: "progbits", Description: "Information defined by the program"}, SHT_SYMTAB: {Sym: "symtab", Description: "Symbol table"}, @@ -402,7 +402,7 @@ const ( type dtEntry struct { r [2]uint64 dUn int - s scalar.S + s scalar.Uint } type dynamicTableEntries []dtEntry @@ -416,8 +416,8 @@ func (d dynamicTableEntries) lookup(u uint64) (dtEntry, bool) { return dtEntry{}, false } -func (d dynamicTableEntries) MapScalar(s scalar.S) (scalar.S, error) { - u := s.ActualU() +func (d dynamicTableEntries) MapUint(s scalar.Uint) (scalar.Uint, error) { + u := s.Actual if de, ok := d.lookup(u); ok { s = de.s s.Actual = u @@ -426,44 +426,44 @@ func (d dynamicTableEntries) MapScalar(s scalar.S) (scalar.S, error) { } var dynamicTableMap = dynamicTableEntries{ - {r: [2]uint64{DT_NULL, DT_NULL}, dUn: dUnIgnored, s: scalar.S{Sym: "null", Description: "Marks end of dynamic section"}}, - {r: [2]uint64{DT_NEEDED, DT_NEEDED}, dUn: dUnVal, s: scalar.S{Sym: "needed", Description: "String table offset to name of a needed library"}}, - {r: [2]uint64{DT_PLTRELSZ, DT_PLTRELSZ}, dUn: dUnVal, s: scalar.S{Sym: "pltrelsz", Description: "Size in bytes of PLT relocation entries"}}, - {r: [2]uint64{DT_PLTGOT, DT_PLTGOT}, dUn: dUnPtr, s: scalar.S{Sym: "pltgot", Description: "Address of PLT and/or GOT"}}, - {r: [2]uint64{DT_HASH, DT_HASH}, dUn: dUnPtr, s: scalar.S{Sym: "hash", Description: "Address of symbol hash table"}}, - {r: [2]uint64{DT_STRTAB, DT_STRTAB}, dUn: dUnPtr, s: scalar.S{Sym: "strtab", Description: "Address of string table"}}, - {r: [2]uint64{DT_SYMTAB, DT_SYMTAB}, dUn: dUnPtr, s: scalar.S{Sym: "symtab", Description: "Address of symbol table"}}, - {r: [2]uint64{DT_RELA, DT_RELA}, dUn: dUnPtr, s: scalar.S{Sym: "rela", Description: "Address of Rela relocation table"}}, - {r: [2]uint64{DT_RELASZ, DT_RELASZ}, dUn: dUnVal, s: scalar.S{Sym: "relasz", Description: "Size in bytes of the Rela relocation table"}}, - {r: [2]uint64{DT_RELAENT, DT_RELAENT}, dUn: dUnVal, s: scalar.S{Sym: "relaent", Description: "Size in bytes of a Rela relocation table entry"}}, - {r: [2]uint64{DT_STRSZ, DT_STRSZ}, dUn: dUnVal, s: scalar.S{Sym: "strsz", Description: "Size in bytes of string table"}}, - {r: [2]uint64{DT_SYMENT, DT_SYMENT}, dUn: dUnVal, s: scalar.S{Sym: "syment", Description: "Size in bytes of a symbol table entry"}}, - {r: [2]uint64{DT_INIT, DT_INIT}, dUn: dUnPtr, s: scalar.S{Sym: "init", Description: "Address of the initialization function"}}, - {r: [2]uint64{DT_FINI, DT_FINI}, dUn: dUnPtr, s: scalar.S{Sym: "fini", Description: "Address of the termination function"}}, - {r: [2]uint64{DT_SONAME, DT_SONAME}, dUn: dUnVal, s: scalar.S{Sym: "soname", Description: "String table offset to name of shared object"}}, - {r: [2]uint64{DT_RPATH, DT_RPATH}, dUn: dUnVal, s: scalar.S{Sym: "rpath", Description: "String table offset to library search path (deprecated)"}}, - {r: [2]uint64{DT_SYMBOLIC, DT_SYMBOLIC}, dUn: dUnIgnored, s: scalar.S{Sym: "symbolic", Description: "Alert linker to search this shared object before the executable for symbols DT_REL Address of Rel relocation table"}}, - {r: [2]uint64{DT_REL, DT_REL}, dUn: dUnPtr, s: scalar.S{Sym: "rel", Description: ""}}, - {r: [2]uint64{DT_RELSZ, DT_RELSZ}, dUn: dUnVal, s: scalar.S{Sym: "relsz", Description: "Size in bytes of Rel relocation table"}}, - {r: [2]uint64{DT_RELENT, DT_RELENT}, dUn: dUnVal, s: scalar.S{Sym: "relent", Description: "Size in bytes of a Rel table entry"}}, - {r: [2]uint64{DT_PLTREL, DT_PLTREL}, dUn: dUnVal, s: scalar.S{Sym: "pltrel", Description: "Type of relocation entry to which the PLT refers (Rela or Rel)"}}, - {r: [2]uint64{DT_DEBUG, DT_DEBUG}, dUn: dUnPtr, s: scalar.S{Sym: "debug", Description: "Undefined use for debugging"}}, - {r: [2]uint64{DT_TEXTREL, DT_TEXTREL}, dUn: dUnIgnored, s: scalar.S{Sym: "textrel", Description: "Absence of this entry indicates that no relocation entries should apply to a nonwritable segment"}}, - {r: [2]uint64{DT_JMPREL, DT_JMPREL}, dUn: dUnPtr, s: scalar.S{Sym: "jmprel", Description: "Address of relocation entries associated solely with the PLT"}}, - {r: [2]uint64{DT_BIND_NOW, DT_BIND_NOW}, dUn: dUnIgnored, s: scalar.S{Sym: "bind_now", Description: "Instruct dynamic linker to process all relocations before transferring control to the executable"}}, - {r: [2]uint64{DT_INIT_ARRAY, DT_INIT_ARRAY}, dUn: dUnPtr, s: scalar.S{Sym: "init_array", Description: "Address of the array of pointers to initialization functions"}}, - {r: [2]uint64{DT_FINI_ARRAY, DT_FINI_ARRAY}, dUn: dUnPtr, s: scalar.S{Sym: "fini_array", Description: "Address of the array of pointers to termination functions"}}, - {r: [2]uint64{DT_INIT_ARRAYSZ, DT_INIT_ARRAYSZ}, dUn: dUnVal, s: scalar.S{Sym: "init_arraysz", Description: "Size in bytes of the array of initialization functions"}}, - {r: [2]uint64{DT_FINI_ARRAYSZ, DT_FINI_ARRAYSZ}, dUn: dUnVal, s: scalar.S{Sym: "fini_arraysz", Description: "Size in bytes of the array of termination functions "}}, - {r: [2]uint64{DT_RUNPATH, DT_RUNPATH}, dUn: dUnVal, s: scalar.S{Sym: "runpath", Description: "String table offset to library search path"}}, - {r: [2]uint64{DT_FLAGS, DT_FLAGS}, dUn: dUnVal, s: scalar.S{Sym: "flags", Description: "Flag values specific to the object being loaded"}}, // TODO: flag ma}}, - {r: [2]uint64{DT_ENCODING, DT_ENCODING}, dUn: dUnUnspecified, s: scalar.S{Sym: "encoding", Description: ""}}, // or DT_PREINIT_ARRAY }}, - {r: [2]uint64{DT_PREINIT_ARRAYSZ, DT_PREINIT_ARRAYSZ}, dUn: dUnVal, s: scalar.S{Sym: "preinit_arraysz", Description: "Address of the array of pointers to pre-initialization functions"}}, - {r: [2]uint64{DT_LOOS, DT_HIOS}, dUn: dUnUnspecified, s: scalar.S{Sym: "lo", Description: "Operating system-specific semantics"}}, - {r: [2]uint64{DT_LOPROC, DT_HIPROC}, dUn: dUnUnspecified, s: scalar.S{Sym: "proc", Description: "Processor-specific semantics"}}, + {r: [2]uint64{DT_NULL, DT_NULL}, dUn: dUnIgnored, s: scalar.Uint{Sym: "null", Description: "Marks end of dynamic section"}}, + {r: [2]uint64{DT_NEEDED, DT_NEEDED}, dUn: dUnVal, s: scalar.Uint{Sym: "needed", Description: "String table offset to name of a needed library"}}, + {r: [2]uint64{DT_PLTRELSZ, DT_PLTRELSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "pltrelsz", Description: "Size in bytes of PLT relocation entries"}}, + {r: [2]uint64{DT_PLTGOT, DT_PLTGOT}, dUn: dUnPtr, s: scalar.Uint{Sym: "pltgot", Description: "Address of PLT and/or GOT"}}, + {r: [2]uint64{DT_HASH, DT_HASH}, dUn: dUnPtr, s: scalar.Uint{Sym: "hash", Description: "Address of symbol hash table"}}, + {r: [2]uint64{DT_STRTAB, DT_STRTAB}, dUn: dUnPtr, s: scalar.Uint{Sym: "strtab", Description: "Address of string table"}}, + {r: [2]uint64{DT_SYMTAB, DT_SYMTAB}, dUn: dUnPtr, s: scalar.Uint{Sym: "symtab", Description: "Address of symbol table"}}, + {r: [2]uint64{DT_RELA, DT_RELA}, dUn: dUnPtr, s: scalar.Uint{Sym: "rela", Description: "Address of Rela relocation table"}}, + {r: [2]uint64{DT_RELASZ, DT_RELASZ}, dUn: dUnVal, s: scalar.Uint{Sym: "relasz", Description: "Size in bytes of the Rela relocation table"}}, + {r: [2]uint64{DT_RELAENT, DT_RELAENT}, dUn: dUnVal, s: scalar.Uint{Sym: "relaent", Description: "Size in bytes of a Rela relocation table entry"}}, + {r: [2]uint64{DT_STRSZ, DT_STRSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "strsz", Description: "Size in bytes of string table"}}, + {r: [2]uint64{DT_SYMENT, DT_SYMENT}, dUn: dUnVal, s: scalar.Uint{Sym: "syment", Description: "Size in bytes of a symbol table entry"}}, + {r: [2]uint64{DT_INIT, DT_INIT}, dUn: dUnPtr, s: scalar.Uint{Sym: "init", Description: "Address of the initialization function"}}, + {r: [2]uint64{DT_FINI, DT_FINI}, dUn: dUnPtr, s: scalar.Uint{Sym: "fini", Description: "Address of the termination function"}}, + {r: [2]uint64{DT_SONAME, DT_SONAME}, dUn: dUnVal, s: scalar.Uint{Sym: "soname", Description: "String table offset to name of shared object"}}, + {r: [2]uint64{DT_RPATH, DT_RPATH}, dUn: dUnVal, s: scalar.Uint{Sym: "rpath", Description: "String table offset to library search path (deprecated)"}}, + {r: [2]uint64{DT_SYMBOLIC, DT_SYMBOLIC}, dUn: dUnIgnored, s: scalar.Uint{Sym: "symbolic", Description: "Alert linker to search this shared object before the executable for symbols DT_REL Address of Rel relocation table"}}, + {r: [2]uint64{DT_REL, DT_REL}, dUn: dUnPtr, s: scalar.Uint{Sym: "rel", Description: ""}}, + {r: [2]uint64{DT_RELSZ, DT_RELSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "relsz", Description: "Size in bytes of Rel relocation table"}}, + {r: [2]uint64{DT_RELENT, DT_RELENT}, dUn: dUnVal, s: scalar.Uint{Sym: "relent", Description: "Size in bytes of a Rel table entry"}}, + {r: [2]uint64{DT_PLTREL, DT_PLTREL}, dUn: dUnVal, s: scalar.Uint{Sym: "pltrel", Description: "Type of relocation entry to which the PLT refers (Rela or Rel)"}}, + {r: [2]uint64{DT_DEBUG, DT_DEBUG}, dUn: dUnPtr, s: scalar.Uint{Sym: "debug", Description: "Undefined use for debugging"}}, + {r: [2]uint64{DT_TEXTREL, DT_TEXTREL}, dUn: dUnIgnored, s: scalar.Uint{Sym: "textrel", Description: "Absence of this entry indicates that no relocation entries should apply to a nonwritable segment"}}, + {r: [2]uint64{DT_JMPREL, DT_JMPREL}, dUn: dUnPtr, s: scalar.Uint{Sym: "jmprel", Description: "Address of relocation entries associated solely with the PLT"}}, + {r: [2]uint64{DT_BIND_NOW, DT_BIND_NOW}, dUn: dUnIgnored, s: scalar.Uint{Sym: "bind_now", Description: "Instruct dynamic linker to process all relocations before transferring control to the executable"}}, + {r: [2]uint64{DT_INIT_ARRAY, DT_INIT_ARRAY}, dUn: dUnPtr, s: scalar.Uint{Sym: "init_array", Description: "Address of the array of pointers to initialization functions"}}, + {r: [2]uint64{DT_FINI_ARRAY, DT_FINI_ARRAY}, dUn: dUnPtr, s: scalar.Uint{Sym: "fini_array", Description: "Address of the array of pointers to termination functions"}}, + {r: [2]uint64{DT_INIT_ARRAYSZ, DT_INIT_ARRAYSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "init_arraysz", Description: "Size in bytes of the array of initialization functions"}}, + {r: [2]uint64{DT_FINI_ARRAYSZ, DT_FINI_ARRAYSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "fini_arraysz", Description: "Size in bytes of the array of termination functions "}}, + {r: [2]uint64{DT_RUNPATH, DT_RUNPATH}, dUn: dUnVal, s: scalar.Uint{Sym: "runpath", Description: "String table offset to library search path"}}, + {r: [2]uint64{DT_FLAGS, DT_FLAGS}, dUn: dUnVal, s: scalar.Uint{Sym: "flags", Description: "Flag values specific to the object being loaded"}}, // TODO: flag ma}}, + {r: [2]uint64{DT_ENCODING, DT_ENCODING}, dUn: dUnUnspecified, s: scalar.Uint{Sym: "encoding", Description: ""}}, // or DT_PREINIT_ARRAY }}, + {r: [2]uint64{DT_PREINIT_ARRAYSZ, DT_PREINIT_ARRAYSZ}, dUn: dUnVal, s: scalar.Uint{Sym: "preinit_arraysz", Description: "Address of the array of pointers to pre-initialization functions"}}, + {r: [2]uint64{DT_LOOS, DT_HIOS}, dUn: dUnUnspecified, s: scalar.Uint{Sym: "lo", Description: "Operating system-specific semantics"}}, + {r: [2]uint64{DT_LOPROC, DT_HIPROC}, dUn: dUnUnspecified, s: scalar.Uint{Sym: "proc", Description: "Processor-specific semantics"}}, } -var symbolTableBindingMap = scalar.UToSymStr{ +var symbolTableBindingMap = scalar.UintMapSymStr{ 0: "local", 1: "global", 2: "weak", @@ -474,7 +474,7 @@ var symbolTableBindingMap = scalar.UToSymStr{ 15: "proc", } -var symbolTableTypeMap = scalar.UToSymStr{ +var symbolTableTypeMap = scalar.UintMapSymStr{ 0: "notype", 1: "object", 2: "func", @@ -489,7 +489,7 @@ var symbolTableTypeMap = scalar.UToSymStr{ 15: "proc", } -var symbolTableVisibilityMap = scalar.UToSymStr{ +var symbolTableVisibilityMap = scalar.UintMapSymStr{ 0: "default", 1: "internal", 2: "hidden", @@ -509,8 +509,8 @@ func strIndexNull(idx int, s string) string { type strTable string -func (m strTable) MapScalar(s scalar.S) (scalar.S, error) { - s.Sym = strIndexNull(int(s.ActualU()), string(m)) +func (m strTable) MapUint(s scalar.Uint) (scalar.Uint, error) { + s.Sym = strIndexNull(int(s.Actual), string(m)) return s, nil } @@ -819,8 +819,8 @@ func elfDecodeHeader(d *decode.D, ec *elfContext) { d.Fatalf("unknown endian %d", endian) } - typ := d.FieldU16("type", typeNames, scalar.ActualHex) - machine := d.FieldU16("machine", machineNames, scalar.ActualHex) + typ := d.FieldU16("type", typeNames, scalar.UintHex) + machine := d.FieldU16("machine", machineNames, scalar.UintHex) d.FieldU32("version") d.FieldU("entry", archBits) phOff := d.FieldU("phoff", archBits) @@ -871,9 +871,9 @@ func elfDecodeProgramHeader(d *decode.D, ec elfContext) { switch ec.archBits { case 32: typ = d.FieldU32("type", phTypeNames) - offset = d.FieldU("offset", ec.archBits, scalar.ActualHex) - d.FieldU("vaddr", ec.archBits, scalar.ActualHex) - d.FieldU("paddr", ec.archBits, scalar.ActualHex) + offset = d.FieldU("offset", ec.archBits, scalar.UintHex) + d.FieldU("vaddr", ec.archBits, scalar.UintHex) + d.FieldU("paddr", ec.archBits, scalar.UintHex) size = d.FieldU32("filesz") d.FieldU32("memsz") pFlags(d) @@ -881,9 +881,9 @@ func elfDecodeProgramHeader(d *decode.D, ec elfContext) { case 64: typ = d.FieldU32("type", phTypeNames) pFlags(d) - offset = d.FieldU("offset", ec.archBits, scalar.ActualHex) - d.FieldU("vaddr", ec.archBits, scalar.ActualHex) - d.FieldU("paddr", ec.archBits, scalar.ActualHex) + offset = d.FieldU("offset", ec.archBits, scalar.UintHex) + d.FieldU("vaddr", ec.archBits, scalar.UintHex) + d.FieldU("paddr", ec.archBits, scalar.UintHex) size = d.FieldU64("filesz") d.FieldU64("memsz") d.FieldU64("align") @@ -900,9 +900,9 @@ func elfDecodeProgramHeader(d *decode.D, ec elfContext) { nameSz := d.FieldU32("n_namesz") descSz := d.FieldU32("n_descsz") if ec.typ == ET_CORE { - d.FieldU32("n_type", coreNoteNames, scalar.ActualHex) + d.FieldU32("n_type", coreNoteNames, scalar.UintHex) } else { - d.FieldU32("n_type", scalar.ActualHex) + d.FieldU32("n_type", scalar.UintHex) } d.FieldUTF8NullFixedLen("name", int(nameSz)) nameAlign := d.AlignBits(4 * 8) @@ -935,14 +935,14 @@ func elfDecodeProgramHeaders(d *decode.D, ec elfContext) { func elfDecodeDynamicTag(d *decode.D, ec elfContext, dc dynamicContext) { dtTag := d.FieldU("tag", ec.archBits, dynamicTableMap) name := "unspecified" - dfMapper := scalar.ActualHex + dfMapper := scalar.UintHex if de, ok := dynamicTableMap.lookup(dtTag); ok { switch de.dUn { case dUnIgnored: name = "ignored" case dUnVal: name = "val" - dfMapper = scalar.ActualDec + dfMapper = scalar.UintDec case dUnPtr: name = "ptr" } @@ -954,7 +954,7 @@ func elfDecodeDynamicTag(d *decode.D, ec elfContext, dc dynamicContext) { case DT_HASH: v := d.FieldU(name, ec.archBits, dfMapper) if i, ok := ec.sectionIndexByAddr(int64(v) * 8); ok { - d.FieldValueU("section_index", uint64(i)) + d.FieldValueUint("section_index", uint64(i)) } case DT_SYMTAB, DT_STRTAB, @@ -964,7 +964,7 @@ func elfDecodeDynamicTag(d *decode.D, ec elfContext, dc dynamicContext) { DT_FINI: v := d.FieldU(name, ec.archBits, dfMapper) if i, ok := ec.sectionIndexByAddr(int64(v) * 8); ok { - d.FieldValueU("section_index", uint64(i)) + d.FieldValueUint("section_index", uint64(i)) } default: d.FieldU(name, ec.archBits, dfMapper) @@ -1033,21 +1033,21 @@ func elfDecodeSectionHeader(d *decode.D, ec elfContext, sh sectionHeader) { switch ec.archBits { case 32: d.FieldU32("name", strTable(ec.strTabMap[STRTAB_SHSTRTAB])) - typ = d.FieldU32("type", sectionHeaderTypeMap, scalar.ActualHex) + typ = d.FieldU32("type", sectionHeaderTypeMap, scalar.UintHex) shFlags(d, ec.archBits) - d.FieldU("addr", ec.archBits, scalar.ActualHex) + d.FieldU("addr", ec.archBits, scalar.UintHex) offset = int64(d.FieldU("offset", ec.archBits)) * 8 - size = int64(d.FieldU32("size", scalar.ActualHex) * 8) + size = int64(d.FieldU32("size", scalar.UintHex) * 8) d.FieldU32("link") d.FieldU32("info") d.FieldU32("addralign") entSize = int64(d.FieldU32("entsize") * 8) case 64: d.FieldU32("name", strTable(ec.strTabMap[STRTAB_SHSTRTAB])) - typ = d.FieldU32("type", sectionHeaderTypeMap, scalar.ActualHex) + typ = d.FieldU32("type", sectionHeaderTypeMap, scalar.UintHex) shFlags(d, ec.archBits) - d.FieldU("addr", ec.archBits, scalar.ActualHex) - offset = int64(d.FieldU("offset", ec.archBits, scalar.ActualHex) * 8) + d.FieldU("addr", ec.archBits, scalar.UintHex) + offset = int64(d.FieldU("offset", ec.archBits, scalar.UintHex) * 8) size = int64(d.FieldU64("size") * 8) d.FieldU32("link") d.FieldU32("info") diff --git a/format/flac/flac.go b/format/flac/flac.go index fa0dfc17..6e817468 100644 --- a/format/flac/flac.go +++ b/format/flac/flac.go @@ -33,7 +33,7 @@ func init() { } func flacDecode(d *decode.D, _ any) any { - d.FieldUTF8("magic", 4, d.AssertStr("fLaC")) + d.FieldUTF8("magic", 4, d.StrAssert("fLaC")) var streamInfo format.FlacStreamInfo var flacFrameIn format.FlacFrameIn @@ -78,8 +78,8 @@ func flacDecode(d *decode.D, _ any) any { }) md5CalcValue := d.FieldRootBitBuf("md5_calculated", bitio.NewBitReader(md5Samples.Sum(nil), -1)) - _ = md5CalcValue.TryScalarFn(d.ValidateBitBuf(streamInfo.MD5), scalar.RawHex) - d.FieldValueU("decoded_samples", framesNDecodedSamples) + _ = md5CalcValue.TryBitBufScalarFn(d.ValidateBitBuf(streamInfo.MD5), scalar.RawHex) + d.FieldValueUint("decoded_samples", framesNDecodedSamples) return nil } diff --git a/format/flac/flac_frame.go b/format/flac/flac_frame.go index afe10dc9..3efbeca0 100644 --- a/format/flac/flac_frame.go +++ b/format/flac/flac_frame.go @@ -36,7 +36,7 @@ const ( BlockingStrategyVariable = 1 ) -var BlockingStrategyNames = scalar.UToSymStr{ +var BlockingStrategyNames = scalar.UintMapSymStr{ BlockingStrategyFixed: "fixed", BlockingStrategyVariable: "variable", } @@ -71,9 +71,9 @@ const ( ResidualCodingMethodRice2 = 0b01 ) -var ResidualCodingMethodMap = scalar.UToScalar{ - ResidualCodingMethodRice: scalar.S{Sym: uint64(4), Description: "rice"}, - ResidualCodingMethodRice2: scalar.S{Sym: uint64(5), Description: "rice2"}, +var ResidualCodingMethodMap = scalar.UintMap{ + ResidualCodingMethodRice: scalar.Uint{Sym: uint64(4), Description: "rice"}, + ResidualCodingMethodRice2: scalar.Uint{Sym: uint64(5), Description: "rice2"}, } // TODO: generic enough? @@ -115,12 +115,12 @@ func frameDecode(d *decode.D, in any) any { d.FieldStruct("header", func(d *decode.D) { // <14> 11111111111110 - d.FieldU14("sync", d.AssertU(0b11111111111110), scalar.ActualBin) + d.FieldU14("sync", d.UintAssert(0b11111111111110), scalar.UintBin) // <1> Reserved // 0 : mandatory value // 1 : reserved for future use - d.FieldU1("reserved0", d.AssertU(0)) + d.FieldU1("reserved0", d.UintAssert(0)) // <1> Blocking strategy: // 0 : fixed-blocksize stream; frame header encodes the frame number @@ -134,7 +134,7 @@ func frameDecode(d *decode.D, in any) any { // 0110 : get 8 bit (blocksize-1) from end of header // 0111 : get 16 bit (blocksize-1) from end of header // 1000-1111 : 256 * (2^(n-8)) samples, i.e. 256/512/1024/2048/4096/8192/16384/32768 - var blockSizeMap = scalar.UToScalar{ + var blockSizeMap = scalar.UintMap{ 0b0000: {Description: "reserved"}, 0b0001: {Sym: uint64(192)}, 0b0010: {Sym: uint64(576)}, @@ -152,9 +152,9 @@ func frameDecode(d *decode.D, in any) any { 0b1110: {Sym: uint64(16384)}, 0b1111: {Sym: uint64(32768)}, } - blockSizeS := d.FieldScalarU4("block_size", blockSizeMap, scalar.ActualBin) + blockSizeS := d.FieldScalarU4("block_size", blockSizeMap, scalar.UintBin) if blockSizeS.Sym != nil { - blockSize = int(blockSizeS.SymU()) + blockSize = int(blockSizeS.SymUint()) } // <4> Sample rate: @@ -174,7 +174,7 @@ func frameDecode(d *decode.D, in any) any { // 1101 : get 16 bit sample rate (in Hz) from end of header // 1110 : get 16 bit sample rate (in tens of Hz) from end of header // 1111 : invalid, to prevent sync-fooling string of 1s - var sampleRateMap = scalar.UToScalar{ + var sampleRateMap = scalar.UintMap{ 0b0000: {Description: "from streaminfo"}, 0b0001: {Sym: uint64(88200)}, 0b0010: {Sym: uint64(176400)}, @@ -192,7 +192,7 @@ func frameDecode(d *decode.D, in any) any { 0b1110: {Description: "end of header (16 bit*10)"}, 0b1111: {Description: "invalid"}, } - sampleRateS := d.FieldScalarU4("sample_rate", sampleRateMap, scalar.ActualBin) + sampleRateS := d.FieldScalarU4("sample_rate", sampleRateMap, scalar.UintBin) // <4> Channel assignment // 0000-0111 : (number of independent channels)-1. Where defined, the channel order follows SMPTE/ITU-R recommendations. The assignments are as follows: @@ -209,7 +209,7 @@ func frameDecode(d *decode.D, in any) any { // 1010 : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel // 1011-1111 : reserved // TODO: extract to tables and cleanup - var channelAssignmentMap = scalar.UToScalar{ + var channelAssignmentMap = scalar.UintMap{ 0: {Sym: uint64(1), Description: "mono"}, 1: {Sym: uint64(2), Description: "lr"}, 2: {Sym: uint64(3), Description: "lrc"}, @@ -226,13 +226,13 @@ func frameDecode(d *decode.D, in any) any { 0b1101: {Sym: nil, Description: "reserved"}, 0b1111: {Sym: nil, Description: "reserved"}, } - channelAssignmentS := d.FieldScalarU4("channel_assignment", channelAssignmentMap) - if channelAssignmentS.Sym == nil { + channelAssignmentUint := d.FieldScalarU4("channel_assignment", channelAssignmentMap) + if channelAssignmentUint.Sym == nil { d.Fatalf("unknown number of channels") } - channelAssignment = channelAssignmentS.ActualU() - channels = int(channelAssignmentS.SymU()) - switch channelAssignmentS.ActualU() { + channelAssignment = channelAssignmentUint.Actual + channels = int(channelAssignmentUint.SymUint()) + switch channelAssignmentUint.Actual { case ChannelLeftSide: sideChannelIndex = 1 case ChannelSideRight: @@ -241,7 +241,7 @@ func frameDecode(d *decode.D, in any) any { sideChannelIndex = 1 } if sideChannelIndex != -1 { - d.FieldValueU("side_channel_index", uint64(sideChannelIndex)) + d.FieldValueUint("side_channel_index", uint64(sideChannelIndex)) } // <3> Sample size in bits: @@ -253,7 +253,7 @@ func frameDecode(d *decode.D, in any) any { // 101 : 20 bits per sample // 110 : 24 bits per sample // 111 : reserved - var sampleSizeMap = scalar.UToScalar{ + var sampleSizeMap = scalar.UintMap{ 0b000: {Description: "from streaminfo"}, 0b001: {Sym: uint64(8)}, 0b010: {Sym: uint64(12)}, @@ -263,20 +263,20 @@ func frameDecode(d *decode.D, in any) any { 0b110: {Sym: uint64(24)}, 0b111: {Sym: uint64(32)}, } - sampleSizeS := d.FieldScalarU3("sample_size", sampleSizeMap, scalar.ActualBin) - switch sampleSizeS.ActualU() { + sampleSizeS := d.FieldScalarU3("sample_size", sampleSizeMap, scalar.UintBin) + switch sampleSizeS.Actual { case SampleSizeStreaminfo: sampleSize = ffi.BitsPerSample default: if sampleSizeS.Sym != nil { - sampleSize = int(sampleSizeS.SymU()) + sampleSize = int(sampleSizeS.SymUint()) } } // <1> Reserved: // 0 : mandatory value // 1 : reserved for future use - d.FieldU1("reserved1", d.AssertU(0)) + d.FieldU1("reserved1", d.UintAssert(0)) d.FieldStruct("end_of_header", func(d *decode.D) { // if(variable blocksize) @@ -287,20 +287,20 @@ func frameDecode(d *decode.D, in any) any { // 1 : variable-blocksize stream; frame header encodes the sample number switch blockingStrategy { case BlockingStrategyVariable: - d.FieldUFn("sample_number", utf8Uint) + d.FieldUintFn("sample_number", utf8Uint) case BlockingStrategyFixed: - d.FieldUFn("frame_number", utf8Uint) + d.FieldUintFn("frame_number", utf8Uint) } // if(blocksize bits == 011x) // 8/16 bit (blocksize-1) // 0110 : get 8 bit (blocksize-1) from end of header // 0111 : get 16 bit (blocksize-1) from end of header - switch blockSizeS.ActualU() { + switch blockSizeS.Actual { case BlockSizeEndOfHeader8: - blockSize = int(d.FieldU8("block_size", scalar.ActualUAdd(1))) + blockSize = int(d.FieldU8("block_size", scalar.UintActualAdd(1))) case BlockSizeEndOfHeader16: - blockSize = int(d.FieldU16("block_size", scalar.ActualUAdd(1))) + blockSize = int(d.FieldU16("block_size", scalar.UintActualAdd(1))) } // if(sample rate bits == 11xx) @@ -308,19 +308,19 @@ func frameDecode(d *decode.D, in any) any { // 1100 : get 8 bit sample rate (in kHz) from end of header // 1101 : get 16 bit sample rate (in Hz) from end of header // 1110 : get 16 bit sample rate (in tens of Hz) from end of header - switch sampleRateS.ActualU() { + switch sampleRateS.Actual { case SampeleRateEndOfHeader8: - d.FieldUFn("sample_rate", func(d *decode.D) uint64 { return d.U8() * 1000 }) + d.FieldUintFn("sample_rate", func(d *decode.D) uint64 { return d.U8() * 1000 }) case SampeleRateEndOfHeader16: d.FieldU16("sample_rate") case SampeleRateEndOfHeader160: - d.FieldUFn("sample_rate", func(d *decode.D) uint64 { return d.U16() * 10 }) + d.FieldUintFn("sample_rate", func(d *decode.D) uint64 { return d.U16() * 10 }) } }) headerCRC := &checksum.CRC{Bits: 8, Table: checksum.ATM8Table} d.CopyBits(headerCRC, d.BitBufRange(frameStart, d.Pos()-frameStart)) - d.FieldU8("crc", d.ValidateUBytes(headerCRC.Sum(nil)), scalar.ActualHex) + d.FieldU8("crc", d.UintValidateBytes(headerCRC.Sum(nil)), scalar.UintHex) }) var channelSamples [][]int64 @@ -328,7 +328,7 @@ func frameDecode(d *decode.D, in any) any { for channelIndex := 0; channelIndex < channels; channelIndex++ { d.FieldStruct("subframe", func(d *decode.D) { // <1> Zero bit padding, to prevent sync-fooling string of 1s - d.FieldU1("zero_bit", d.AssertU(0)) + d.FieldU1("zero_bit", d.UintAssert(0)) // <6> Subframe type: // 000000 : SUBFRAME_CONSTANT @@ -339,25 +339,25 @@ func frameDecode(d *decode.D, in any) any { // 01xxxx : reserved // 1xxxxx : SUBFRAME_LPC, xxxxx=order-1 lpcOrder := -1 - var subframeTypeRangeMap = scalar.URangeToScalar{ - {Range: [2]uint64{0b000000, 0b000000}, S: scalar.S{Sym: SubframeConstant}}, - {Range: [2]uint64{0b000001, 0b000001}, S: scalar.S{Sym: SubframeVerbatim}}, - {Range: [2]uint64{0b000010, 0b000011}, S: scalar.S{Sym: SubframeReserved}}, - {Range: [2]uint64{0b000100, 0b000111}, S: scalar.S{Sym: SubframeReserved}}, - {Range: [2]uint64{0b001000, 0b001100}, S: scalar.S{Sym: SubframeFixed}}, - {Range: [2]uint64{0b001101, 0b001111}, S: scalar.S{Sym: SubframeReserved}}, - {Range: [2]uint64{0b010000, 0b011111}, S: scalar.S{Sym: SubframeReserved}}, - {Range: [2]uint64{0b100000, 0b111111}, S: scalar.S{Sym: SubframeLPC}}, + var subframeTypeRangeMap = scalar.UintRangeToScalar{ + {Range: [2]uint64{0b000000, 0b000000}, S: scalar.Uint{Sym: SubframeConstant}}, + {Range: [2]uint64{0b000001, 0b000001}, S: scalar.Uint{Sym: SubframeVerbatim}}, + {Range: [2]uint64{0b000010, 0b000011}, S: scalar.Uint{Sym: SubframeReserved}}, + {Range: [2]uint64{0b000100, 0b000111}, S: scalar.Uint{Sym: SubframeReserved}}, + {Range: [2]uint64{0b001000, 0b001100}, S: scalar.Uint{Sym: SubframeFixed}}, + {Range: [2]uint64{0b001101, 0b001111}, S: scalar.Uint{Sym: SubframeReserved}}, + {Range: [2]uint64{0b010000, 0b011111}, S: scalar.Uint{Sym: SubframeReserved}}, + {Range: [2]uint64{0b100000, 0b111111}, S: scalar.Uint{Sym: SubframeLPC}}, } - subframeTypeS := d.FieldScalarU6("subframe_type", subframeTypeRangeMap, scalar.ActualBin) - switch subframeTypeS.SymStr() { + subframeTypeUint := d.FieldScalarU6("subframe_type", subframeTypeRangeMap, scalar.UintBin) + switch subframeTypeUint.SymStr() { case SubframeFixed: - lpcOrder = int(subframeTypeS.ActualU() & 0b111) + lpcOrder = int(subframeTypeUint.Actual & 0b111) case SubframeLPC: - lpcOrder = int((subframeTypeS.ActualU() & 0b11111) + 1) + lpcOrder = int((subframeTypeUint.Actual & 0b11111) + 1) } if lpcOrder != -1 { - d.FieldValueU("lpc_order", uint64(lpcOrder)) + d.FieldValueUint("lpc_order", uint64(lpcOrder)) } // 'Wasted bits-per-sample' flag: @@ -366,7 +366,7 @@ func frameDecode(d *decode.D, in any) any { wastedBitsFlag := d.FieldU1("wasted_bits_flag") var wastedBitsK int if wastedBitsFlag != 0 { - wastedBitsK = int(d.FieldUnary("wasted_bits_k", 0, scalar.ActualUAdd(1))) + wastedBitsK = int(d.FieldUnary("wasted_bits_k", 0, scalar.UintActualAdd(1))) } subframeSampleSize := sampleSize - wastedBitsK @@ -378,7 +378,7 @@ func frameDecode(d *decode.D, in any) any { if channelIndex == sideChannelIndex { subframeSampleSize++ } - d.FieldValueU("subframe_sample_size", uint64(subframeSampleSize)) + d.FieldValueUint("subframe_sample_size", uint64(subframeSampleSize)) decodeWarmupSamples := func(samples []int64, n int, sampleSize int) { if len(samples) < n { @@ -402,9 +402,9 @@ func frameDecode(d *decode.D, in any) any { // 10-11 : reserved var riceEscape int var riceBits int - residualCodingMethod := d.FieldU2("residual_coding_method", scalar.UToScalar{ - 0b00: scalar.S{Sym: uint64(4), Description: "rice"}, - 0b01: scalar.S{Sym: uint64(5), Description: "rice2"}, + residualCodingMethod := d.FieldU2("residual_coding_method", scalar.UintMap{ + 0b00: scalar.Uint{Sym: uint64(4), Description: "rice"}, + 0b01: scalar.Uint{Sym: uint64(5), Description: "rice2"}, }) switch residualCodingMethod { case ResidualCodingMethodRice: @@ -419,7 +419,7 @@ func frameDecode(d *decode.D, in any) any { partitionOrder := int(d.FieldU4("partition_order")) // There will be 2^order partitions. ricePartitions := 1 << partitionOrder - d.FieldValueU("rice_partitions", uint64(ricePartitions)) + d.FieldValueUint("rice_partitions", uint64(ricePartitions)) d.FieldArray("partitions", func(d *decode.D) { for i := 0; i < ricePartitions; i++ { @@ -445,7 +445,7 @@ func frameDecode(d *decode.D, in any) any { count = (blockSize / ricePartitions) - lpcOrder } - d.FieldValueU("count", uint64(count)) + d.FieldValueUint("count", uint64(count)) riceParameter := int(d.FieldU("rice_parameter", riceBits)) @@ -504,7 +504,7 @@ func frameDecode(d *decode.D, in any) any { } samples := make([]int64, blockSize) - switch subframeTypeS.SymStr() { + switch subframeTypeUint.SymStr() { case SubframeConstant: // Unencoded constant value of the subblock, n = frame's bits-per-sample. v := d.FieldS("value", subframeSampleSize) @@ -540,7 +540,7 @@ func frameDecode(d *decode.D, in any) any { // Unencoded warm-up samples (n = frame's bits-per-sample * lpc order). decodeWarmupSamples(samples, lpcOrder, subframeSampleSize) // <4> (Quantized linear predictor coefficients' precision in bits)-1 (1111 = invalid). - precision := int(d.FieldU4("precision", scalar.ActualUAdd(1))) + precision := int(d.FieldU4("precision", scalar.UintActualAdd(1))) // <5> Quantized linear predictor coefficient shift needed in bits (NOTE: this number is signed two's-complement). shift := d.FieldS5("shift") if shift < 0 { @@ -570,7 +570,7 @@ func frameDecode(d *decode.D, in any) any { }) // Zero-padding to byte alignment. - d.FieldU("byte_align", d.ByteAlignBits(), d.AssertU(0)) + d.FieldU("byte_align", d.ByteAlignBits(), d.UintAssert(0)) // <16> CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0) of everything before the crc, back to and including the frame header sync code footerCRC := &checksum.CRC{Bits: 16, Table: checksum.ANSI16Table} d.CopyBits(footerCRC, d.BitBufRange(frameStart, d.Pos()-frameStart)) diff --git a/format/flac/flac_metadatablock.go b/format/flac/flac_metadatablock.go index 9265df3a..cccc13e1 100644 --- a/format/flac/flac_metadatablock.go +++ b/format/flac/flac_metadatablock.go @@ -39,7 +39,7 @@ const ( MetadataBlockPicture = 6 ) -var metadataBlockNames = scalar.UToSymStr{ +var metadataBlockNames = scalar.UintMapSymStr{ MetadataBlockStreaminfo: "streaminfo", MetadataBlockPadding: "padding", MetadataBlockApplication: "application", @@ -74,7 +74,7 @@ func metadatablockDecode(d *decode.D, _ any) any { d.FieldArray("seekpoints", func(d *decode.D) { for i := uint64(0); i < seektableCount; i++ { d.FieldStruct("seekpoint", func(d *decode.D) { - d.FieldU64("sample_number", scalar.UToScalar{ + d.FieldU64("sample_number", scalar.UintMap{ 0xffff_ffff_ffff_ffff: {Description: "Placeholder"}, }) d.FieldU64("offset") diff --git a/format/flac/flac_picture.go b/format/flac/flac_picture.go index d2475fdc..94833464 100644 --- a/format/flac/flac_picture.go +++ b/format/flac/flac_picture.go @@ -9,7 +9,7 @@ import ( var images decode.Group -var pictureTypeNames = scalar.UToSymStr{ +var pictureTypeNames = scalar.UintMapSymStr{ 0: "Other", 1: "32x32_pixels", 2: "other_file_icon", diff --git a/format/flac/flac_streaminfo.go b/format/flac/flac_streaminfo.go index 1e353efc..f49024d1 100644 --- a/format/flac/flac_streaminfo.go +++ b/format/flac/flac_streaminfo.go @@ -22,9 +22,9 @@ func streaminfoDecode(d *decode.D, _ any) any { d.FieldU24("maximum_frame_size") sampleRate := d.FieldU("sample_rate", 20) // <3> (number of channels)-1. FLAC supports from 1 to 8 channels - d.FieldU3("channels", scalar.ActualUAdd(1)) + d.FieldU3("channels", scalar.UintActualAdd(1)) // <5> (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample. - bitsPerSample := d.FieldU5("bits_per_sample", scalar.ActualUAdd(1)) + bitsPerSample := d.FieldU5("bits_per_sample", scalar.UintActualAdd(1)) totalSamplesInStream := d.FieldU("total_samples_in_stream", 36) md5BR := d.FieldRawLen("md5", 16*8, scalar.RawHex) md5b := d.ReadAllBits(md5BR) diff --git a/format/flv/flv.go b/format/flv/flv.go index fbb77ab8..10bf9fd7 100644 --- a/format/flv/flv.go +++ b/format/flv/flv.go @@ -27,7 +27,7 @@ const ( scriptDataObject = 18 ) -var tagTypeNames = scalar.UToSymStr{ +var tagTypeNames = scalar.UintMapSymStr{ audioData: "audioData", videoData: "videoData", scriptDataObject: "scriptDataObject", @@ -49,7 +49,7 @@ const ( typeLongString = 12 ) -var typeNames = scalar.UToSymStr{ +var typeNames = scalar.UintMapSymStr{ typeNumber: "Number", typeBoolean: "Boolean", typeString: "String", @@ -146,11 +146,11 @@ func flvDecode(d *decode.D, _ any) any { }) } - d.FieldUTF8("signature", 3, d.AssertStr("FLV")) + d.FieldUTF8("signature", 3, d.StrAssert("FLV")) d.FieldU8("version") - d.FieldU5("type_flags_reserved", d.AssertU(0)) + d.FieldU5("type_flags_reserved", d.UintAssert(0)) d.FieldU1("type_flags_audio") - d.FieldU1("type_flags_reserved", d.AssertU(0)) + d.FieldU1("type_flags_reserved", d.UintAssert(0)) d.FieldU1("type_flags_video") dataOffset := d.FieldU32("data_offset") diff --git a/format/gif/gif.go b/format/gif/gif.go index a3890cf4..e7744c05 100644 --- a/format/gif/gif.go +++ b/format/gif/gif.go @@ -32,7 +32,7 @@ const ( extensionApplication = 0xff ) -var extensionNames = scalar.UToSymStr{ +var extensionNames = scalar.UintMapSymStr{ extensionPlainText: "PlainText", extensionGraphicalControl: "GraphicalControl", extensionComment: "Comment", @@ -54,14 +54,14 @@ func fieldColorMap(d *decode.D, name string, bitDepth int) { func gifDecode(d *decode.D, _ any) any { d.Endian = decode.LittleEndian - d.FieldUTF8("header", 6, d.AssertStr("GIF87a", "GIF89a")) + d.FieldUTF8("header", 6, d.StrAssert("GIF87a", "GIF89a")) d.FieldU16("width") d.FieldU16("height") gcpFollows := d.FieldBool("gcp_follows") - d.FieldUFn("color_resolution", func(d *decode.D) uint64 { return d.U3() + 1 }) + d.FieldUintFn("color_resolution", func(d *decode.D) uint64 { return d.U3() + 1 }) d.FieldU1("zero") - bitDepth := d.FieldUFn("bit_depth", func(d *decode.D) uint64 { return d.U3() + 1 }) + bitDepth := d.FieldUintFn("bit_depth", func(d *decode.D) uint64 { return d.U3() + 1 }) d.FieldU8("black_color") d.FieldU8("pixel_aspect_ratio") @@ -78,7 +78,7 @@ func gifDecode(d *decode.D, _ any) any { case '!': /* "!" */ d.FieldStruct("extension_block", func(d *decode.D) { d.FieldU8("introducer") - functionCode := d.FieldU8("function_code", extensionNames, scalar.ActualHex) + functionCode := d.FieldU8("function_code", extensionNames, scalar.UintHex) dataBytes := &bytes.Buffer{} @@ -121,7 +121,7 @@ func gifDecode(d *decode.D, _ any) any { localFollows := d.FieldBool("local_color_map_follows") d.FieldBool("image_interlaced") d.FieldU3("zero") - d.FieldUFn("bit_depth", func(d *decode.D) uint64 { return d.U3() + 1 }) + d.FieldUintFn("bit_depth", func(d *decode.D) uint64 { return d.U3() + 1 }) d.FieldU8("code_size") if localFollows { diff --git a/format/gzip/gzip.go b/format/gzip/gzip.go index 39e69b78..0d7cca20 100644 --- a/format/gzip/gzip.go +++ b/format/gzip/gzip.go @@ -32,11 +32,11 @@ func init() { const delfateMethod = 8 -var compressionMethodNames = scalar.UToSymStr{ +var compressionMethodNames = scalar.UintMapSymStr{ delfateMethod: "deflate", } -var osNames = scalar.UToSymStr{ +var osNames = scalar.UintMapSymStr{ 0: "fat", 1: "amiga", 2: "vms", @@ -53,7 +53,7 @@ var osNames = scalar.UToSymStr{ 13: "acorn_riscos", } -var deflateExtraFlagsNames = scalar.UToSymStr{ +var deflateExtraFlagsNames = scalar.UintMapSymStr{ 2: "slow", 4: "fast", } @@ -75,7 +75,7 @@ func gzDecode(d *decode.D, _ any) any { hasComment = d.FieldBool("comment") d.FieldU3("reserved") }) - d.FieldU32("mtime", scalar.DescriptionUnixTimeFn(scalar.S.TryActualU, time.RFC3339)) + d.FieldU32("mtime", scalar.UintActualUnixTime(time.RFC3339)) switch compressionMethod { case delfateMethod: d.FieldU8("extra_flags", deflateExtraFlagsNames) @@ -117,7 +117,7 @@ func gzDecode(d *decode.D, _ any) any { crc32W := crc32.NewIEEE() // TODO: cleanup clone d.CopyBits(crc32W, d.CloneReadSeeker(uncompressedBR)) - d.FieldU32("crc32", d.ValidateUBytes(crc32W.Sum(nil)), scalar.ActualHex) + d.FieldU32("crc32", d.UintValidateBytes(crc32W.Sum(nil)), scalar.UintHex) d.FieldU32("isize") } } diff --git a/format/icc/icc_profile.go b/format/icc/icc_profile.go index 476da365..ae94d240 100644 --- a/format/icc/icc_profile.go +++ b/format/icc/icc_profile.go @@ -111,8 +111,8 @@ func iccProfileDecode(d *decode.D, _ any) any { d.FieldStruct("header", func(d *decode.D) { d.FieldU32("size") d.FieldUTF8NullFixedLen("cmm_type_signature", 4) - d.FieldUFn("version_major", decodeBCDU8) - d.FieldUFn("version_minor", decodeBCDU8) + d.FieldUintFn("version_major", decodeBCDU8) + d.FieldUintFn("version_minor", decodeBCDU8) d.FieldU16("version_reserved") d.FieldUTF8NullFixedLen("device_class_signature", 4) d.FieldUTF8NullFixedLen("color_space", 4) diff --git a/format/id3/id3v1.go b/format/id3/id3v1.go index 179014e0..4e84d8e9 100644 --- a/format/id3/id3v1.go +++ b/format/id3/id3v1.go @@ -20,7 +20,7 @@ func init() { // Decode ID3v1 tag func id3v1Decode(d *decode.D, _ any) any { d.AssertAtLeastBitsLeft(128 * 8) - d.FieldUTF8("magic", 3, d.AssertStr("TAG")) + d.FieldUTF8("magic", 3, d.StrAssert("TAG")) if d.PeekBits(8) == uint64('+') { d.Errorf("looks like id3v11") } @@ -30,7 +30,7 @@ func id3v1Decode(d *decode.D, _ any) any { d.FieldUTF8NullFixedLen("year", 4) d.FieldUTF8NullFixedLen("comment", 30) // from https://en.wikipedia.org/wiki/List_of_ID3v1_Genres - d.FieldU8("genre", scalar.UToScalar{ + d.FieldU8("genre", scalar.UintMap{ 0: {Sym: "blues", Description: "Blues"}, 1: {Sym: "classic_rock", Description: "Classic Rock"}, 2: {Sym: "country", Description: "Country"}, diff --git a/format/id3/id3v11.go b/format/id3/id3v11.go index ac0751a4..6bb4bbb3 100644 --- a/format/id3/id3v11.go +++ b/format/id3/id3v11.go @@ -17,11 +17,11 @@ func init() { func id3v11Decode(d *decode.D, _ any) any { d.AssertAtLeastBitsLeft(128 * 8) - d.FieldUTF8("magic", 4, d.AssertStr("TAG+")) + d.FieldUTF8("magic", 4, d.StrAssert("TAG+")) d.FieldUTF8("title", 60) d.FieldUTF8("artist", 60) d.FieldUTF8("album", 60) - d.FieldU8("speed", scalar.UToSymStr{ + d.FieldU8("speed", scalar.UintMapSymStr{ 0: "unset", 1: "slow", 2: "medium", diff --git a/format/id3/id3v2.go b/format/id3/id3v2.go index 9d32d99f..2332c4a8 100644 --- a/format/id3/id3v2.go +++ b/format/id3/id3v2.go @@ -32,7 +32,7 @@ func init() { }) } -var idDescriptions = scalar.StrToDescription{ +var idDescriptions = scalar.StrMapDescription{ "BUF": "Recommended buffer size", "CNT": "Play counter", "COM": "Comments", @@ -236,7 +236,7 @@ const ( // Terminated with $00 00. // // $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00. -var encodingNames = scalar.UToSymStr{ +var encodingNames = scalar.UintMapSymStr{ encodingISO8859_1: "iso_8859-1", encodingUTF16: "utf16", encodingUTF16BE: "utf16be", @@ -370,7 +370,7 @@ func decodeFrame(d *decode.D, version int) uint64 { // Size 4 * %0xxxxxxx (synchsafe integer) // Flags $xx xx id = d.FieldUTF8("id", 4, idDescriptions) - dataSize = d.FieldUFn("size", decodeSyncSafeU32) + dataSize = d.FieldUintFn("size", decodeSyncSafeU32) var headerLen uint64 = 10 dataLenFlag := false @@ -395,7 +395,7 @@ func decodeFrame(d *decode.D, version int) uint64 { }) if dataLenFlag { - d.FieldUFn("data_length_indicator", decodeSyncSafeU32) + d.FieldUintFn("data_length_indicator", decodeSyncSafeU32) dataSize -= 4 headerLen += 4 } @@ -608,7 +608,7 @@ func decodeFrames(d *decode.D, version int, size uint64) { func id3v2Decode(d *decode.D, _ any) any { d.AssertAtLeastBitsLeft(4 * 8) - d.FieldUTF8("magic", 3, d.AssertStr("ID3")) + d.FieldUTF8("magic", 3, d.StrAssert("ID3")) version := int(d.FieldU8("version")) versionValid := version == 2 || version == 3 || version == 4 if !versionValid { @@ -623,7 +623,7 @@ func id3v2Decode(d *decode.D, _ any) any { d.FieldBool("experimental_indicator") d.FieldU5("unused") }) - size := d.FieldUFn("size", decodeSyncSafeU32) + size := d.FieldUintFn("size", decodeSyncSafeU32) var extHeaderSize uint64 if extendedHeader { @@ -633,7 +633,7 @@ func id3v2Decode(d *decode.D, _ any) any { extHeaderSize = d.FieldU32("size") d.FieldRawLen("data", int64(extHeaderSize)*8) case 4: - extHeaderSize = d.FieldUFn("size", decodeSyncSafeU32) + extHeaderSize = d.FieldUintFn("size", decodeSyncSafeU32) // in v4 synchsafe integer includes itself d.FieldRawLen("data", (int64(extHeaderSize)-4)*8) } diff --git a/format/inet.go b/format/inet.go index 3033b0c6..29e7e565 100644 --- a/format/inet.go +++ b/format/inet.go @@ -140,7 +140,7 @@ const ( LinkTypeETW = 290 ) -var LinkTypeMap = scalar.UToScalar{ +var LinkTypeMap = scalar.UintMap{ LinkTypeNULL: {Sym: "null", Description: `BSD loopback encapsulation`}, LinkTypeETHERNET: {Sym: "ethernet", Description: `IEEE 802.3 Ethernet`}, LinkTypeAX25: {Sym: "ax25", Description: `AX.25 packet, with nothing preceding it`}, @@ -281,7 +281,7 @@ const ( // from https://en.wikipedia.org/wiki/EtherType // TODO: cleanup -var EtherTypeMap = scalar.UToScalar{ +var EtherTypeMap = scalar.UintMap{ EtherTypeIPv4: {Sym: "ipv4", Description: `Internet Protocol version 4`}, 0x0806: {Sym: "arp", Description: `Address Resolution Protocol`}, 0x0842: {Sym: "wake", Description: `Wake-on-LAN[9]`}, @@ -350,7 +350,7 @@ const ( IPv4ProtocolICMPv6 = 58 ) -var IPv4ProtocolMap = scalar.UToScalar{ +var IPv4ProtocolMap = scalar.UintMap{ 0: {Sym: "ip", Description: "Internet protocol, pseudo protocol number"}, IPv4ProtocolICMP: {Sym: "icmp", Description: "Internet control message protocol"}, IPv4ProtocolIGMP: {Sym: "igmp", Description: "Internet group management protocol"}, @@ -498,7 +498,7 @@ const ( UDPPortMDNS = 5353 ) -var UDPPortMap = scalar.UToScalar{ +var UDPPortMap = scalar.UintMap{ 1: {Sym: "tcpmux", Description: "TCP Port Service Multiplexer"}, 2: {Sym: "compressnet", Description: "Management Utility"}, 3: {Sym: "compressnet", Description: "Compression Process"}, @@ -1186,7 +1186,7 @@ const ( TCPPortRTMP = 1935 ) -var TCPPortMap = scalar.UToScalar{ +var TCPPortMap = scalar.UintMap{ 1: {Sym: "tcpmux", Description: "TCP Port Service Multiplexer"}, 2: {Sym: "compressnet", Description: "Management Utility"}, 3: {Sym: "compressnet", Description: "Compression Process"}, diff --git a/format/inet/bsd_loopback_frame.go b/format/inet/bsd_loopback_frame.go index 46f60b20..3012bdf3 100644 --- a/format/inet/bsd_loopback_frame.go +++ b/format/inet/bsd_loopback_frame.go @@ -33,7 +33,7 @@ var bsdLoopbackFrameNetworkLayerEtherType = map[uint64]int{ bsdLoopbackNetworkLayerIPv6: format.EtherTypeIPv6, } -var bsdLookbackNetworkLayerMap = scalar.UToScalar{ +var bsdLookbackNetworkLayerMap = scalar.UintMap{ bsdLoopbackNetworkLayerIPv4: {Sym: "ipv4", Description: `Internet protocol v4`}, bsdLoopbackNetworkLayerIPv6: {Sym: "ipv6", Description: `Internet protocol v6`}, } @@ -50,7 +50,7 @@ func decodeLoopbackFrame(d *decode.D, in any) any { } // if no LinkFrameIn assume big endian for now - networkLayer := d.FieldU32("network_layer", bsdLookbackNetworkLayerMap, scalar.ActualHex) + networkLayer := d.FieldU32("network_layer", bsdLookbackNetworkLayerMap, scalar.UintHex) d.FieldFormatOrRawLen( "payload", diff --git a/format/inet/ether8023_frame.go b/format/inet/ether8023_frame.go index 76188a4d..90b139a6 100644 --- a/format/inet/ether8023_frame.go +++ b/format/inet/ether8023_frame.go @@ -27,9 +27,9 @@ func init() { } // TODO: move to shared? -var mapUToEtherSym = scalar.Fn(func(s scalar.S) (scalar.S, error) { +var mapUToEtherSym = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { var b [8]byte - binary.BigEndian.PutUint64(b[:], s.ActualU()) + binary.BigEndian.PutUint64(b[:], s.Actual) s.Sym = fmt.Sprintf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", b[2], b[3], b[4], b[5], b[6], b[7]) return s, nil }) @@ -41,9 +41,9 @@ func decodeEthernetFrame(d *decode.D, in any) any { } } - d.FieldU("destination", 48, mapUToEtherSym, scalar.ActualHex) - d.FieldU("source", 48, mapUToEtherSym, scalar.ActualHex) - etherType := d.FieldU16("ether_type", format.EtherTypeMap, scalar.ActualHex) + d.FieldU("destination", 48, mapUToEtherSym, scalar.UintHex) + d.FieldU("source", 48, mapUToEtherSym, scalar.UintHex) + etherType := d.FieldU16("ether_type", format.EtherTypeMap, scalar.UintHex) d.FieldFormatOrRawLen( "payload", diff --git a/format/inet/icmp.go b/format/inet/icmp.go index 70d9d1a5..88a028e1 100644 --- a/format/inet/icmp.go +++ b/format/inet/icmp.go @@ -17,7 +17,7 @@ func init() { } // based on https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol -var icmpTypeMap = scalar.UToScalar{ +var icmpTypeMap = scalar.UintMap{ 0: {Sym: "echo_reply", Description: "Echo reply"}, 3: {Sym: "unreachable", Description: "Destination network unreachable"}, 4: {Sym: "source_quench", Description: "Source quench (congestion control)"}, @@ -50,7 +50,7 @@ var icmpTypeMap = scalar.UToScalar{ 43: {Sym: "extended_echo_reply", Description: "No Error"}, } -var icmpCodeMapMap = map[uint64]scalar.UToDescription{ +var icmpCodeMapMap = map[uint64]scalar.UintMapDescription{ 3: { 1: "Destination host unreachable", 2: "Destination protocol unreachable", diff --git a/format/inet/icmpv6.go b/format/inet/icmpv6.go index 37ec7081..f123a4a4 100644 --- a/format/inet/icmpv6.go +++ b/format/inet/icmpv6.go @@ -17,7 +17,7 @@ func init() { } // based on https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 -var icmpv6TypeMap = scalar.UToScalar{ +var icmpv6TypeMap = scalar.UintMap{ 1: {Sym: "unreachable", Description: "Destination unreachable"}, 2: {Sym: "too_big", Description: "Packet too big"}, 3: {Sym: "time_exceeded", Description: "Time exceeded"}, @@ -56,7 +56,7 @@ var icmpv6TypeMap = scalar.UToScalar{ 255: {Description: "Reserved for expansion of ICMPv6 informational messages"}, } -var icmpv6CodeMapMap = map[uint64]scalar.UToDescription{ +var icmpv6CodeMapMap = map[uint64]scalar.UintMapDescription{ 1: { 1: "Communication with destination administratively prohibited", 2: "Beyond scope of source address", diff --git a/format/inet/ipv4_packet.go b/format/inet/ipv4_packet.go index c1a57a2a..fbf9a5c5 100644 --- a/format/inet/ipv4_packet.go +++ b/format/inet/ipv4_packet.go @@ -31,7 +31,7 @@ const ( ipv4OptionNop = 1 ) -var ipv4OptionsMap = scalar.UToScalar{ +var ipv4OptionsMap = scalar.UintMap{ ipv4OptionEnd: {Sym: "end", Description: "End of options list"}, ipv4OptionNop: {Sym: "nop", Description: "No operation"}, 2: {Description: "Security"}, @@ -42,9 +42,9 @@ var ipv4OptionsMap = scalar.UToScalar{ 4: {Description: "Internet Timestamp"}, } -var mapUToIPv4Sym = scalar.Fn(func(s scalar.S) (scalar.S, error) { +var mapUToIPv4Sym = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { var b [4]byte - binary.BigEndian.PutUint32(b[:], uint32(s.ActualU())) + binary.BigEndian.PutUint32(b[:], uint32(s.Actual)) s.Sym = net.IP(b[:]).String() return s, nil }) @@ -67,10 +67,10 @@ func decodeIPv4(d *decode.D, in any) any { d.FieldU8("ttl") protocol := d.FieldU8("protocol", format.IPv4ProtocolMap) checksumStart := d.Pos() - d.FieldU16("header_checksum", scalar.ActualHex) + d.FieldU16("header_checksum", scalar.UintHex) checksumEnd := d.Pos() - d.FieldU32("source_ip", mapUToIPv4Sym, scalar.ActualHex) - d.FieldU32("destination_ip", mapUToIPv4Sym, scalar.ActualHex) + d.FieldU32("source_ip", mapUToIPv4Sym, scalar.UintHex) + d.FieldU32("destination_ip", mapUToIPv4Sym, scalar.UintHex) optionsLen := (int64(ihl) - 5) * 8 * 4 if optionsLen > 0 { d.FramedFn(optionsLen, func(d *decode.D) { @@ -96,7 +96,7 @@ func decodeIPv4(d *decode.D, in any) any { ipv4Checksum := &checksum.IPv4{} d.Copy(ipv4Checksum, bitio.NewIOReader(d.BitBufRange(0, checksumStart))) d.Copy(ipv4Checksum, bitio.NewIOReader(d.BitBufRange(checksumEnd, headerEnd-checksumEnd))) - _ = d.FieldMustGet("header_checksum").TryScalarFn(d.ValidateUBytes(ipv4Checksum.Sum(nil)), scalar.ActualHex) + _ = d.FieldMustGet("header_checksum").TryUintScalarFn(d.UintValidateBytes(ipv4Checksum.Sum(nil)), scalar.UintHex) dataLen := int64(totalLength-(ihl*4)) * 8 diff --git a/format/inet/ipv6_packet.go b/format/inet/ipv6_packet.go index eb9e23f9..49a0da40 100644 --- a/format/inet/ipv6_packet.go +++ b/format/inet/ipv6_packet.go @@ -41,7 +41,7 @@ const ( // 253 Use for experimentation and testing [RFC3692][RFC4727] // 254 Use for experimentation and testing [RFC3692][RFC4727] -var nextHeaderNames = scalar.UToSymStr{ +var nextHeaderNames = scalar.UintMapSymStr{ nextHeaderHopByHop: "hop_by_hop", nextHeaderRouting: "routing", nextHeaderFragment: "fragment", @@ -53,11 +53,11 @@ var nextHeaderNames = scalar.UToSymStr{ nextHeaderShim6: "shim6", } -var nextHeaderMap = scalar.Fn(func(s scalar.S) (scalar.S, error) { - if isIpv6Option(s.ActualU()) { - return nextHeaderNames.MapScalar(s) +var nextHeaderMap = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + if isIpv6Option(s.Actual) { + return nextHeaderNames.MapUint(s) } - return format.IPv4ProtocolMap.MapScalar(s) + return format.IPv4ProtocolMap.MapUint(s) }) func isIpv6Option(n uint64) bool { @@ -78,7 +78,7 @@ func isIpv6Option(n uint64) bool { } // from https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2 -var hopByHopTypeNames = scalar.UToSymStr{ +var hopByHopTypeNames = scalar.UintMapSymStr{ 0x00: "pad1", 0x01: "padn", 0xc2: "jumbo_payload", @@ -99,9 +99,9 @@ var hopByHopTypeNames = scalar.UToSymStr{ 0x31: "ioam", } -var mapUToIPv6Sym = scalar.Fn(func(s scalar.S) (scalar.S, error) { +var mapUToIPv6Sym = scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { b := &bytes.Buffer{} - if _, err := bitioex.CopyBits(b, s.ActualBitBuf()); err != nil { + if _, err := bitioex.CopyBits(b, s.Actual); err != nil { return s, err } s.Sym = net.IP(b.Bytes()).String() diff --git a/format/inet/sll2_packet.go b/format/inet/sll2_packet.go index c6539ae6..839cbb82 100644 --- a/format/inet/sll2_packet.go +++ b/format/inet/sll2_packet.go @@ -31,12 +31,12 @@ func decodeSLL2(d *decode.D, in any) any { } } - protcolType := d.FieldU16("protocol_type", format.EtherTypeMap, scalar.ActualHex) + protcolType := d.FieldU16("protocol_type", format.EtherTypeMap, scalar.UintHex) d.FieldU16("reserved") d.FieldU32("interface_index") arpHdrType := d.FieldU16("arphdr_type", arpHdrTypeMAp) d.FieldU8("packet_type", sllPacketTypeMap) - addressLength := d.FieldU8("link_address_length", d.ValidateURange(0, 8)) + addressLength := d.FieldU8("link_address_length", d.UintValidateRange(0, 8)) // "If there are more than 8 bytes, only the first 8 bytes are present" if addressLength > 8 { addressLength = 8 @@ -51,7 +51,7 @@ func decodeSLL2(d *decode.D, in any) any { // TODO: handle other arphdr types switch arpHdrType { case arpHdrTypeLoopback, arpHdrTypeEther: - _ = d.FieldMustGet("link_address").TryScalarFn(mapUToEtherSym, scalar.ActualHex) + _ = d.FieldMustGet("link_address").TryUintScalarFn(mapUToEtherSym, scalar.UintHex) d.FieldFormatOrRawLen( "payload", d.BitsLeft(), diff --git a/format/inet/sll_packet.go b/format/inet/sll_packet.go index 0db2e1c4..5269a567 100644 --- a/format/inet/sll_packet.go +++ b/format/inet/sll_packet.go @@ -24,7 +24,7 @@ func init() { }) } -var sllPacketTypeMap = scalar.UToScalar{ +var sllPacketTypeMap = scalar.UintMap{ 0: {Sym: "to_us", Description: "Sent to us"}, 1: {Sym: "broadcast", Description: "Broadcast by somebody else"}, 2: {Sym: "multicast", Description: "Multicast by somebody else"}, @@ -38,7 +38,7 @@ const ( ) // based on https://github.com/torvalds/linux/blob/master/include/uapi/linux/if_arp.h -var arpHdrTypeMAp = scalar.UToScalar{ +var arpHdrTypeMAp = scalar.UintMap{ 0: {Sym: "netrom", Description: `from KA9Q: NET/ROM pseudo`}, arpHdrTypeEther: {Sym: "ether", Description: `Ethernet 10Mbps`}, 2: {Sym: "eether", Description: `Experimental Ethernet`}, @@ -127,8 +127,8 @@ func decodeSLL(d *decode.D, in any) any { // TODO: handle other arphdr types switch arpHdrType { case arpHdrTypeLoopback, arpHdrTypeEther: - _ = d.FieldMustGet("link_address").TryScalarFn(mapUToEtherSym, scalar.ActualHex) - protcolType := d.FieldU16("protocol_type", format.EtherTypeMap, scalar.ActualHex) + _ = d.FieldMustGet("link_address").TryUintScalarFn(mapUToEtherSym, scalar.UintHex) + protcolType := d.FieldU16("protocol_type", format.EtherTypeMap, scalar.UintHex) d.FieldFormatOrRawLen( "payload", d.BitsLeft(), diff --git a/format/inet/tcp_segment.go b/format/inet/tcp_segment.go index e5ba0064..b50f7c83 100644 --- a/format/inet/tcp_segment.go +++ b/format/inet/tcp_segment.go @@ -23,7 +23,7 @@ const ( tcpOptionNop = 1 ) -var tcpOptionsMap = scalar.UToScalar{ +var tcpOptionsMap = scalar.UintMap{ tcpOptionEnd: {Sym: "end", Description: "End of options list"}, tcpOptionNop: {Sym: "nop", Description: "No operation"}, 2: {Sym: "maxseg", Description: "Maximum segment size"}, @@ -55,7 +55,7 @@ func decodeTCP(d *decode.D, in any) any { d.FieldBool("fin") d.FieldU16("window_size") // checksumStart := d.Pos() - d.FieldU16("checksum", scalar.ActualHex) + d.FieldU16("checksum", scalar.UintHex) // checksumEnd := d.Pos() d.FieldU16("urgent_pointer") optionsLen := (int64(dataOffset) - 5) * 8 * 4 @@ -81,7 +81,7 @@ func decodeTCP(d *decode.D, in any) any { // tcpChecksum := &checksum.IPv4{} // d.MustCopy(tcpChecksum, d.BitBufRange(0, checksumStart)) // d.MustCopy(tcpChecksum, d.BitBufRange(checksumEnd, d.Len()-checksumEnd)) - // _ = d.FieldMustGet("checksum").TryScalarFn(d.ValidateUBytes(tcpChecksum.Sum(nil)), scalar.Hex) + // _ = d.FieldMustGet("checksum").TryScalarFn(d.UintValidateBytes(tcpChecksum.Sum(nil)), scalar.Hex) d.FieldRawLen("payload", d.BitsLeft()) diff --git a/format/inet/udp_datagram.go b/format/inet/udp_datagram.go index b82215aa..c29a16d3 100644 --- a/format/inet/udp_datagram.go +++ b/format/inet/udp_datagram.go @@ -29,7 +29,7 @@ func decodeUDP(d *decode.D, in any) any { sourcePort := d.FieldU16("source_port", format.UDPPortMap) destPort := d.FieldU16("destination_port", format.UDPPortMap) length := d.FieldU16("length") - d.FieldU16("checksum", scalar.ActualHex) + d.FieldU16("checksum", scalar.UintHex) payloadLen := int64(length-8) * 8 d.FieldFormatOrRawLen( diff --git a/format/jpeg/jpeg.go b/format/jpeg/jpeg.go index f4f65072..9696fca7 100644 --- a/format/jpeg/jpeg.go +++ b/format/jpeg/jpeg.go @@ -97,7 +97,7 @@ const ( TEM = 0x01 ) -var markers = scalar.UToScalar{ +var markers = scalar.UintMap{ SOF0: {Sym: "sof0", Description: "Baseline DCT"}, SOF1: {Sym: "sof1", Description: "Extended sequential DCT"}, SOF2: {Sym: "sof2", Description: "Progressive DCT"}, diff --git a/format/jpeg/ps_irids.go b/format/jpeg/ps_irids.go index 4e021678..10770a89 100644 --- a/format/jpeg/ps_irids.go +++ b/format/jpeg/ps_irids.go @@ -3,7 +3,7 @@ package jpeg import "github.com/wader/fq/pkg/scalar" // based on https://www.adobe.com/devnet-apps/photoshop/fileformatashtml -var psImageResourceBlockNames = scalar.UToDescription{ +var psImageResourceBlockNames = scalar.UintMapDescription{ 0x03E8: `Contains five 2-byte values: number of channels, rows, columns, depth, and mode`, 0x03E9: `Macintosh print manager print info record`, 0x03EA: `Macintosh page format information. No longer read by Photoshop. (Obsolete)`, diff --git a/format/json/json.go b/format/json/json.go index f1b4f120..b1512aaf 100644 --- a/format/json/json.go +++ b/format/json/json.go @@ -66,7 +66,7 @@ func decodeJSONEx(d *decode.D, lines bool) any { d.Fatalf("trialing data after top-level value") } - var s scalar.S + var s scalar.Any if lines { if len(vs) == 0 { d.Fatalf("not lines found") diff --git a/format/json/testdata/json_color.fqtest b/format/json/testdata/json_color.fqtest new file mode 100644 index 00000000..68dc70d6 --- /dev/null +++ b/format/json/testdata/json_color.fqtest @@ -0,0 +1,21 @@ +# TODO: tests descorator with different types, move this test +$ fq -C d json.gz + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: json.gz (gzip) +0x000|1f 8b |.. | identification: raw bits (valid) +0x000| 08 | . | compression_method: "deflate" (8) + | | | flags{}: +0x000| 00 | . | text: false +0x000| 00 | . | header_crc: false +0x000| 00 | . | extra: false +0x000| 00 | . | name: false +0x000| 00 | . | comment: false +0x000| 00 | . | reserved: 0 +0x000| 65 0a 08 61 | e..a | mtime: 1627916901 (2021-08-02T15:08:21Z) +0x000| 00 | . | extra_flags: 0 +0x000| 03 | . | os: "unix" (3) + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| + 0x0|7b 22 61 22 3a 20 31 32 33 7d 0a| |{"a": 123}.| | uncompressed: {} (json) +0x000| ab 56 4a 54 b2 52| .VJT.R| compressed: raw bits +0x010|30 34 32 ae e5 02 00 |042.... | +0x010| 20 ac d2 9c |  ... | crc32: 0x9cd2ac20 (valid) +0x010| 0b 00 00 00| | ....|| isize: 11 diff --git a/format/macho/macho.go b/format/macho/macho.go index 124a0a5f..09a7c3c4 100644 --- a/format/macho/macho.go +++ b/format/macho/macho.go @@ -40,8 +40,8 @@ func strIndexNull(idx int, s string) string { type strTable string -func (m strTable) MapScalar(s scalar.S) (scalar.S, error) { - s.Sym = strIndexNull(int(s.ActualU()), string(m)) +func (m strTable) MapUint(s scalar.Uint) (scalar.Uint, error) { + s.Sym = strIndexNull(int(s.Actual), string(m)) return s, nil } @@ -53,14 +53,14 @@ const ( MH_CIGAM_64 = 0xcffa_edfe ) -var magicSymMapper = scalar.UToScalar{ - MH_MAGIC: scalar.S{Sym: "32le", Description: "32-bit little endian"}, - MH_CIGAM: scalar.S{Sym: "32be", Description: "32-bit big endian"}, - MH_MAGIC_64: scalar.S{Sym: "64le", Description: "64-bit little endian"}, - MH_CIGAM_64: scalar.S{Sym: "64be", Description: "64-bit big endian"}, +var magicSymMapper = scalar.UintMap{ + MH_MAGIC: scalar.Uint{Sym: "32le", Description: "32-bit little endian"}, + MH_CIGAM: scalar.Uint{Sym: "32be", Description: "32-bit big endian"}, + MH_MAGIC_64: scalar.Uint{Sym: "64le", Description: "64-bit little endian"}, + MH_CIGAM_64: scalar.Uint{Sym: "64be", Description: "64-bit big endian"}, } -var cpuTypes = scalar.UToSymStr{ +var cpuTypes = scalar.UintMapSymStr{ 0xff_ff_ff_ff: "any", 1: "vax", 2: "romp", @@ -89,7 +89,7 @@ func intelSubTypeHelper(f, m uint64) uint64 { return f + (m << 4) } -var cpuSubTypes = map[uint64]scalar.UToSymStr{ +var cpuSubTypes = map[uint64]scalar.UintMapSymStr{ 0xff_ff_ff_ff: { 0xff_ff_ff_ff: "multiple", }, @@ -214,7 +214,7 @@ var cpuSubTypes = map[uint64]scalar.UToSymStr{ }, } -var fileTypes = scalar.UToSymStr{ +var fileTypes = scalar.UintMapSymStr{ 0x1: "object", 0x2: "execute", 0x3: "fvmlib", @@ -284,7 +284,7 @@ const ( LC_BUILD_VERSION = 0x32 ) -var loadCommands = scalar.UToSymStr{ +var loadCommands = scalar.UintMapSymStr{ LC_REQ_DYLD: "req_dyld", LC_SEGMENT: "segment", LC_SYMTAB: "symtab", @@ -339,7 +339,7 @@ var loadCommands = scalar.UToSymStr{ LC_BUILD_VERSION: "build_version", } -var sectionTypes = scalar.UToSymStr{ +var sectionTypes = scalar.UintMapSymStr{ 0x0: "regular", 0x1: "zerofill", 0x2: "cstring_literals", @@ -390,11 +390,11 @@ func machoDecode(d *decode.D, _ any) any { d.SeekRel(-4 * 8) d.FieldStruct("header", func(d *decode.D) { - d.FieldValueS("arch_bits", int64(archBits)) - d.FieldU32("magic", magicSymMapper, scalar.ActualHex) - d.FieldValueU("bits", uint64(archBits)) - cpuType = d.FieldU32("cputype", cpuTypes, scalar.ActualHex) - d.FieldU32("cpusubtype", cpuSubTypes[cpuType], scalar.ActualHex) + d.FieldValueSint("arch_bits", int64(archBits)) + d.FieldU32("magic", magicSymMapper, scalar.UintHex) + d.FieldValueUint("bits", uint64(archBits)) + cpuType = d.FieldU32("cputype", cpuTypes, scalar.UintHex) + d.FieldU32("cpusubtype", cpuSubTypes[cpuType], scalar.UintHex) d.FieldU32("filetype", fileTypes) ncmds = d.FieldU32("ncdms") d.FieldU32("sizeofncdms") @@ -409,7 +409,7 @@ func machoDecode(d *decode.D, _ any) any { d.FieldStruct("load_command", func(d *decode.D) { d.SeekAbs(loadCommandsNext) - cmd := d.FieldU32("cmd", loadCommands, scalar.ActualHex) + cmd := d.FieldU32("cmd", loadCommands, scalar.UintHex) cmdSize := d.FieldU32("cmdsize") if cmdSize == 0 { d.Fatalf("cmdSize is zero") @@ -431,17 +431,17 @@ func machoDecode(d *decode.D, _ any) any { var nsects uint64 d.FieldStruct("segment_command", func(d *decode.D) { - d.FieldValueS("arch_bits", int64(archBits)) + d.FieldValueSint("arch_bits", int64(archBits)) d.FieldUTF8NullFixedLen("segname", 16) // OPCODE_DECODER segname==__TEXT if archBits == 32 { - vmaddr = int64(d.FieldU32("vmaddr", scalar.ActualHex)) + vmaddr = int64(d.FieldU32("vmaddr", scalar.UintHex)) d.FieldU32("vmsize") - fileoff = int64(d.FieldU32("fileoff", scalar.ActualHex)) + fileoff = int64(d.FieldU32("fileoff", scalar.UintHex)) d.FieldU32("tfilesize") } else { - vmaddr = int64(d.FieldU64("vmaddr", scalar.ActualHex)) + vmaddr = int64(d.FieldU64("vmaddr", scalar.UintHex)) d.FieldU64("vmsize") - fileoff = int64(d.FieldU64("fileoff", scalar.ActualHex)) + fileoff = int64(d.FieldU64("fileoff", scalar.UintHex)) d.FieldU64("tfilesize") } d.FieldS32("initprot") @@ -457,13 +457,13 @@ func machoDecode(d *decode.D, _ any) any { d.FieldUTF8NullFixedLen("segname", 16) var size uint64 if archBits == 32 { - d.FieldU32("address", scalar.ActualHex) + d.FieldU32("address", scalar.UintHex) size = d.FieldU32("size") } else { - d.FieldU64("address", scalar.ActualHex) + d.FieldU64("address", scalar.UintHex) size = d.FieldU64("size") } - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldU32("align") d.FieldU32("reloff") d.FieldU32("nreloc") @@ -506,11 +506,11 @@ func machoDecode(d *decode.D, _ any) any { const flagUTF16 = 0x07d0 d.FieldU("isa_vmaddr", archBits) - flag := d.FieldU("flags", archBits, scalar.ActualHex, scalar.UToSymStr{ + flag := d.FieldU("flags", archBits, scalar.UintHex, scalar.UintMapSymStr{ flagUTF8: "utf8", flagUTF16: "utf16", }) - dataPtr := int64(d.FieldU("data_ptr", archBits, scalar.ActualHex)) + dataPtr := int64(d.FieldU("data_ptr", archBits, scalar.UintHex)) length := int64(d.FieldU("length", archBits)) offset := ((dataPtr - vmaddr) + fileoff) * 8 @@ -533,7 +533,7 @@ func machoDecode(d *decode.D, _ any) any { } }) case LC_TWOLEVEL_HINTS: - d.FieldU32("offset", scalar.ActualHex) + d.FieldU32("offset", scalar.UintHex) d.FieldU32("nhints") case LC_LOAD_DYLIB, LC_ID_DYLIB, @@ -542,7 +542,7 @@ func machoDecode(d *decode.D, _ any) any { LC_LAZY_LOAD_DYLIB, LC_REEXPORT_DYLIB: d.FieldStruct("dylib_command", func(d *decode.D) { - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldU32("timestamp", timestampMapper) d.FieldU32("current_version") d.FieldU32("compatibility_version") @@ -551,10 +551,10 @@ func machoDecode(d *decode.D, _ any) any { case LC_LOAD_DYLINKER, LC_ID_DYLINKER, LC_DYLD_ENVIRONMENT: - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldUTF8NullFixedLen("name", int(cmdSize)-int(offset)) case LC_RPATH: - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldUTF8NullFixedLen("name", int(cmdSize)-int(offset)) case LC_PREBOUND_DYLIB: // https://github.com/aidansteele/osx-abi-macho-file-format-reference#prebound_dylib_command @@ -588,7 +588,7 @@ func machoDecode(d *decode.D, _ any) any { case LC_ROUTINES, LC_ROUTINES_64: if archBits == 32 { - d.FieldU32("init_address", scalar.ActualHex) + d.FieldU32("init_address", scalar.UintHex) d.FieldU32("init_module") d.FieldU32("reserved1") d.FieldU32("reserved2") @@ -597,7 +597,7 @@ func machoDecode(d *decode.D, _ any) any { d.FieldU32("reserved5") d.FieldU32("reserved6") } else { - d.FieldU64("init_address", scalar.ActualHex) + d.FieldU64("init_address", scalar.UintHex) d.FieldU64("init_module") d.FieldU64("reserved1") d.FieldU64("reserved2") @@ -610,7 +610,7 @@ func machoDecode(d *decode.D, _ any) any { LC_SUB_LIBRARY, LC_SUB_CLIENT, LC_SUB_FRAMEWORK: - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldUTF8NullFixedLen("name", int(cmdSize)-int(offset)) case LC_SYMTAB: symOff := d.FieldU32("symoff") @@ -626,7 +626,7 @@ func machoDecode(d *decode.D, _ any) any { d.SeekAbs(int64(symOff) * 8) d.FieldArray("symbols", func(d *decode.D) { for i := 0; i < int(nSyms); i++ { - symbolTypeMap := scalar.UToSymStr{ + symbolTypeMap := scalar.UintMapSymStr{ 0x0: "undef", 0x1: "abs", 0x5: "indr", @@ -644,7 +644,7 @@ func machoDecode(d *decode.D, _ any) any { }) d.FieldU8("sect") d.FieldU16("desc") - d.FieldU("value", archBits, scalar.ActualHex) + d.FieldU("value", archBits, scalar.UintHex) }) } }) @@ -700,20 +700,20 @@ func machoDecode(d *decode.D, _ any) any { case LC_DYLD_INFO, LC_DYLD_INFO_ONLY: d.FieldStruct("dyld_info", func(d *decode.D) { - d.FieldU32("rebase_off", scalar.ActualHex) + d.FieldU32("rebase_off", scalar.UintHex) d.FieldU32("rebase_size") - d.FieldU32("bind_off", scalar.ActualHex) + d.FieldU32("bind_off", scalar.UintHex) d.FieldU32("bind_size") - d.FieldU32("weak_bind_off", scalar.ActualHex) + d.FieldU32("weak_bind_off", scalar.UintHex) d.FieldU32("weak_bind_size") - d.FieldU32("lazy_bind_off", scalar.ActualHex) + d.FieldU32("lazy_bind_off", scalar.UintHex) d.FieldU32("lazy_bind_size") - d.FieldU32("export_off", scalar.ActualHex) + d.FieldU32("export_off", scalar.UintHex) d.FieldU32("export_size") }) case LC_MAIN: d.FieldStruct("entrypoint", func(d *decode.D) { - d.FieldU64("entryoff", scalar.ActualHex) + d.FieldU64("entryoff", scalar.UintHex) d.FieldU64("stacksize") }) case LC_SOURCE_VERSION: @@ -728,7 +728,7 @@ func machoDecode(d *decode.D, _ any) any { case LC_ENCRYPTION_INFO, LC_ENCRYPTION_INFO_64: d.FieldStruct("encryption_info", func(d *decode.D) { - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) size := d.FieldU32("size") d.FieldU32("id") d.RangeFn(int64(offset)*8, int64(size)*8, func(d *decode.D) { @@ -742,9 +742,9 @@ func machoDecode(d *decode.D, _ any) any { case LC_IDFVMLIB, LC_LOADFVMLIB: d.FieldStruct("fvmlib", func(d *decode.D) { - offset := d.FieldU32("offset", scalar.ActualHex) + offset := d.FieldU32("offset", scalar.UintHex) d.FieldU32("minor_version") - d.FieldU32("header_addr", scalar.ActualHex) + d.FieldU32("header_addr", scalar.UintHex) d.FieldUTF8NullFixedLen("name", int(cmdSize)-int(offset)) }) default: @@ -817,8 +817,8 @@ func parseSectionFlags(d *decode.D) { d.FieldBool("attr_loc_reloc") } -var timestampMapper = scalar.Fn(func(s scalar.S) (scalar.S, error) { - s.Sym = time.UnixMilli(int64(s.ActualU())).UTC().String() +var timestampMapper = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + s.Sym = time.UnixMilli(int64(s.Actual)).UTC().String() return s, nil }) diff --git a/format/macho/macho_fat.go b/format/macho/macho_fat.go index 7c27b78a..d3376db1 100644 --- a/format/macho/macho_fat.go +++ b/format/macho/macho_fat.go @@ -34,16 +34,16 @@ func machoFatDecode(d *decode.D, _ any) any { var ofiles []ofile d.FieldStruct("fat_header", func(d *decode.D) { - d.FieldU32("magic", magicSymMapper, scalar.ActualHex, d.AssertU(FAT_MAGIC)) + d.FieldU32("magic", magicSymMapper, scalar.UintHex, d.UintAssert(FAT_MAGIC)) narchs := d.FieldU32("narchs") d.FieldArray("archs", func(d *decode.D) { for i := 0; i < int(narchs); i++ { d.FieldStruct("arch", func(d *decode.D) { // beware cputype and cpusubtype changes from ofile header to fat header - cpuType := d.FieldU32("cputype", cpuTypes, scalar.ActualHex) - d.FieldU32("cpusubtype", cpuSubTypes[cpuType], scalar.ActualHex) - offset := d.FieldU32("offset", scalar.ActualHex) + cpuType := d.FieldU32("cputype", cpuTypes, scalar.UintHex) + d.FieldU32("cpusubtype", cpuSubTypes[cpuType], scalar.UintHex) + offset := d.FieldU32("offset", scalar.UintHex) size := d.FieldU32("size") d.FieldU32("align") diff --git a/format/markdown/markdown.go b/format/markdown/markdown.go index 3582a081..ebdc4b36 100644 --- a/format/markdown/markdown.go +++ b/format/markdown/markdown.go @@ -34,7 +34,7 @@ func decodeMarkdown(d *decode.D, _ any) any { panic(err) } - var s scalar.S + var s scalar.Any s.Actual = node(markdown.Parse(b, nil)) d.Value.V = &s d.Value.Range.Len = d.Len() diff --git a/format/matroska/ebml/ebml.go b/format/matroska/ebml/ebml.go index 82f6d51a..9b8517e3 100644 --- a/format/matroska/ebml/ebml.go +++ b/format/matroska/ebml/ebml.go @@ -33,9 +33,9 @@ type Attribute struct { Type Type Tag Tag Definition string - IntegerEnums scalar.SToScalar - UintegerEnums scalar.UToScalar - StringEnums scalar.StrToScalar + IntegerEnums scalar.SintMap + UintegerEnums scalar.UintMap + StringEnums scalar.StrMap } type Tag map[uint64]Attribute diff --git a/format/matroska/ebml/gen/main.go b/format/matroska/ebml/gen/main.go index e4f68fd9..dbf4471b 100644 --- a/format/matroska/ebml/gen/main.go +++ b/format/matroska/ebml/gen/main.go @@ -165,11 +165,11 @@ func main() { if len(c.Enums) > 0 { switch c.Type { case "integer": - fmt.Printf("\t\tIntegerEnums: scalar.SToScalar{\n") + fmt.Printf("\t\tIntegerEnums: scalar.SintMap{\n") case "uinteger": - fmt.Printf("\t\tUintegerEnums: scalar.UToScalar{\n") + fmt.Printf("\t\tUintegerEnums: scalar.UintMap{\n") case "string": - fmt.Printf("\t\tStringEnums: scalar.StrToScalar{\n") + fmt.Printf("\t\tStringEnums: scalar.StrMap{\n") } // matroska.xml has dup keys (e.g. PARTS) diff --git a/format/matroska/ebml_matroska/ebml_matroska_gen.go b/format/matroska/ebml_matroska/ebml_matroska_gen.go index 9757ec98..65b4e790 100644 --- a/format/matroska/ebml_matroska/ebml_matroska_gen.go +++ b/format/matroska/ebml_matroska/ebml_matroska_gen.go @@ -424,7 +424,7 @@ var ChapterTranslate = ebml.Tag{ Name: "chapter_translate_codec", Definition: "This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element).", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "matroska_script", Description: "Chapter commands using the Matroska Script codec.", @@ -639,7 +639,7 @@ var TrackEntry = ebml.Tag{ Name: "track_type", Definition: "The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 1: { Sym: "video", Description: "An image.", @@ -914,7 +914,7 @@ var TrackTranslate = ebml.Tag{ Name: "track_translate_codec", Definition: "This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element).", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "matroska_script", Description: "Chapter commands using the Matroska Script codec.", @@ -937,7 +937,7 @@ var Video = ebml.Tag{ Name: "flag_interlaced", Definition: "Specify whether the video frames in this track are interlaced or not.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "undetermined", Description: "Unknown status.", @@ -956,7 +956,7 @@ var Video = ebml.Tag{ Name: "field_order", Definition: "Specify the field ordering of video frames in this track.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "progressive", Description: "Interlaced frames.", @@ -985,7 +985,7 @@ var Video = ebml.Tag{ Name: "stereo_mode", Definition: "Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos).", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "mono", }, @@ -1037,7 +1037,7 @@ var Video = ebml.Tag{ Name: "alpha_mode", Definition: "Indicate whether the BlockAdditional Element with BlockAddID of \"1\" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "none", Description: "The BlockAdditional Element with BlockAddID of \"1\" does not exist or **SHOULD NOT** be considered as containing such data.", @@ -1052,7 +1052,7 @@ var Video = ebml.Tag{ Name: "old_stereo_mode", Definition: "Bogus StereoMode value used in old versions of libmatroska.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "mono", }, @@ -1111,7 +1111,7 @@ var Video = ebml.Tag{ Name: "display_unit", Definition: "How DisplayWidth & DisplayHeight are interpreted.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "pixels", }, @@ -1133,7 +1133,7 @@ var Video = ebml.Tag{ Name: "aspect_ratio_type", Definition: "Specify the possible modifications to the aspect ratio.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "free_resizing", }, @@ -1177,7 +1177,7 @@ var Colour = ebml.Tag{ Name: "matrix_coefficients", Definition: "The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "identity", }, @@ -1254,7 +1254,7 @@ var Colour = ebml.Tag{ Name: "chroma_siting_horz", Definition: "How chroma is subsampled horizontally.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "unspecified", }, @@ -1270,7 +1270,7 @@ var Colour = ebml.Tag{ Name: "chroma_siting_vert", Definition: "How chroma is subsampled vertically.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "unspecified", }, @@ -1286,7 +1286,7 @@ var Colour = ebml.Tag{ Name: "range", Definition: "Clipping of the color ranges.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "unspecified", }, @@ -1305,7 +1305,7 @@ var Colour = ebml.Tag{ Name: "transfer_characteristics", Definition: "The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "reserved", }, @@ -1369,7 +1369,7 @@ var Colour = ebml.Tag{ Name: "primaries", Definition: "The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "reserved", }, @@ -1489,7 +1489,7 @@ var Projection = ebml.Tag{ Name: "projection_type", Definition: "Describes the projection used for this video track.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "rectangular", }, @@ -1556,7 +1556,7 @@ var Audio = ebml.Tag{ Name: "emphasis", Definition: "Audio emphasis applied on audio samples. The player **MUST** apply the inverse emphasis to get the proper audio samples.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "no_emphasis", }, @@ -1642,7 +1642,7 @@ var TrackPlane = ebml.Tag{ Name: "track_plane_type", Definition: "The kind of plane this track corresponds to.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "left_eye", }, @@ -1682,7 +1682,7 @@ var ContentEncoding = ebml.Tag{ Name: "content_encoding_scope", Definition: "A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 1: { Sym: "block", Description: "All frame contents, excluding lacing data.", @@ -1701,7 +1701,7 @@ var ContentEncoding = ebml.Tag{ Name: "content_encoding_type", Definition: "A value describing what kind of transformation is applied.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "compression", }, @@ -1727,7 +1727,7 @@ var ContentCompression = ebml.Tag{ Name: "content_comp_algo", Definition: "The compression algorithm used.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "zlib", Description: "zlib compression [@!RFC1950].", @@ -1758,7 +1758,7 @@ var ContentEncryption = ebml.Tag{ Name: "content_enc_algo", Definition: "The encryption algorithm used.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "not_encrypted", Description: "The data are not encrypted.", @@ -1809,7 +1809,7 @@ var ContentEncryption = ebml.Tag{ Name: "content_sig_algo", Definition: "The algorithm used for the signature.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "not_signed", }, @@ -1822,7 +1822,7 @@ var ContentEncryption = ebml.Tag{ Name: "content_sig_hash_algo", Definition: "The hash algorithm used for the signature.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "not_signed", }, @@ -1841,7 +1841,7 @@ var ContentEncAESSettings = ebml.Tag{ Name: "aessettings_cipher_mode", Definition: "The AES cipher mode used in the encryption.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 1: { Sym: "aes_ctr", Description: "Counter [@?SP.800-38A].", @@ -2081,7 +2081,7 @@ var ChapterAtom = ebml.Tag{ Name: "chapter_skip_type", Definition: "Indicate what type of content the ChapterAtom contains and might be skipped. It can be used to automatically skip content based on the type. If a `ChapterAtom` is inside a `ChapterAtom` that has a `ChapterSkipType` set, it **MUST NOT** have a `ChapterSkipType` or have a `ChapterSkipType` with the same value as it's parent `ChapterAtom`. If the `ChapterAtom` doesn't contain a `ChapterTimeEnd`, the value of the `ChapterSkipType` is only valid until the next `ChapterAtom` with a `ChapterSkipType` value or the end of the file.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "no_skipping", Description: "Content which should not be skipped.", @@ -2193,7 +2193,7 @@ var ChapProcessCommand = ebml.Tag{ Name: "chap_process_time", Definition: "Defines when the process command **SHOULD** be handled", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 0: { Sym: "during_the_whole_chapter", }, @@ -2238,7 +2238,7 @@ var Targets = ebml.Tag{ Name: "target_type_value", Definition: "A number to indicate the logical level of the target.", Type: ebml.Uinteger, - UintegerEnums: scalar.UToScalar{ + UintegerEnums: scalar.UintMap{ 70: { Sym: "collection", Description: "The highest hierarchical level that tags can describe.", @@ -2273,7 +2273,7 @@ var Targets = ebml.Tag{ Name: "target_type", Definition: "An informational string that can be used to display the logical level of the target like \"ALBUM\", \"TRACK\", \"MOVIE\", \"CHAPTER\", etc ; see Section 6.4 of [@?MatroskaTags].", Type: ebml.String, - StringEnums: scalar.StrToScalar{ + StringEnums: scalar.StrMap{ "COLLECTION": { Sym: "targettypevalue_70", }, diff --git a/format/matroska/matroska.go b/format/matroska/matroska.go index 73f50e3f..f98d62d3 100644 --- a/format/matroska/matroska.go +++ b/format/matroska/matroska.go @@ -106,7 +106,7 @@ const ( lacingTypeEBML = 0b11 ) -var lacingTypeNames = scalar.UToSymStr{ +var lacingTypeNames = scalar.UintMapSymStr{ lacingTypeNone: "none", lacingTypeXiph: "xiph", lacingTypeFixed: "fixed", @@ -127,7 +127,7 @@ func decodeLacingFn(d *decode.D, lacingType int, fn func(d *decode.D)) { numLaces := int(d.FieldU8("num_laces")) d.FieldArray("lace_sizes", func(d *decode.D) { for i := 0; i < numLaces; i++ { - s := int64(d.FieldUFn("lace_size", decodeXiphLaceSize)) + s := int64(d.FieldUintFn("lace_size", decodeXiphLaceSize)) laceSizes = append(laceSizes, s) } laceSizes = append(laceSizes, -1) @@ -135,10 +135,10 @@ func decodeLacingFn(d *decode.D, lacingType int, fn func(d *decode.D)) { case lacingTypeEBML: numLaces := int(d.FieldU8("num_laces")) d.FieldArray("lace_sizes", func(d *decode.D) { - s := int64(d.FieldUFn("lace_size", decodeVint)) // first is unsigned, not ranged shifted + s := int64(d.FieldUintFn("lace_size", decodeVint)) // first is unsigned, not ranged shifted laceSizes = append(laceSizes, s) for i := 0; i < numLaces-1; i++ { - d := int64(d.FieldUFn("lace_size_delta", decodeRawVint)) + d := int64(d.FieldUintFn("lace_size_delta", decodeRawVint)) // range shifting switch { case d&0b1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1000_0000 == 0b0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1000_0000: @@ -258,8 +258,8 @@ func decodeMaster(d *decode.D, bitsLimit int64, tag ebml.Tag, dc *decodeContext) Type: ebml.Unknown, } - tagID := d.FieldUFn("id", decodeRawVint, scalar.Fn(func(s scalar.S) (scalar.S, error) { - n := s.ActualU() + tagID := d.FieldUintFn("id", decodeRawVint, scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + n := s.Actual var ok bool a, ok = tag[n] if !ok { @@ -268,10 +268,10 @@ func decodeMaster(d *decode.D, bitsLimit int64, tag ebml.Tag, dc *decodeContext) a = ebml.Attribute{ Type: ebml.Unknown, } - return scalar.S{Actual: n, ActualDisplay: scalar.NumberHex, Description: "Unknown"}, nil + return scalar.Uint{Actual: n, DisplayFormat: scalar.NumberHex, Description: "Unknown"}, nil } } - return scalar.S{Actual: n, ActualDisplay: scalar.NumberHex, Sym: a.Name, Description: a.Definition}, nil + return scalar.Uint{Actual: n, DisplayFormat: scalar.NumberHex, Sym: a.Name, Description: a.Definition}, nil })) d.FieldValueStr("type", ebml.TypeNames[a.Type]) @@ -286,7 +286,7 @@ func decodeMaster(d *decode.D, bitsLimit int64, tag ebml.Tag, dc *decodeContext) // element that is not a valid sub-element of that Master-element // TODO: should also handle garbage between const maxStringTagSize = 100 * 1024 * 1024 - tagSize := d.FieldUFn("size", decodeVint) + tagSize := d.FieldUintFn("size", decodeVint) // assert sane tag size // TODO: strings are limited for now because they are read into memory @@ -309,29 +309,32 @@ func decodeMaster(d *decode.D, bitsLimit int64, tag ebml.Tag, dc *decodeContext) // nop } - optionalMap := func(sm scalar.Mapper) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - if sm != nil { - return sm.MapScalar(s) - } - return s, nil - }) - } - switch a.Type { case ebml.Unknown: d.FieldRawLen("data", int64(tagSize)*8) case ebml.Integer: - d.FieldS("value", int(tagSize)*8, optionalMap(a.IntegerEnums)) + var sm []scalar.SintMapper + if a.IntegerEnums != nil { + sm = append(sm, a.IntegerEnums) + } + d.FieldS("value", int(tagSize)*8, sm...) case ebml.Uinteger: - v := d.FieldU("value", int(tagSize)*8, optionalMap(a.UintegerEnums)) + var sm []scalar.UintMapper + if a.UintegerEnums != nil { + sm = append(sm, a.UintegerEnums) + } + v := d.FieldU("value", int(tagSize)*8, sm...) if dc.currentTrack != nil && tagID == ebml_matroska.TrackNumberID { dc.currentTrack.number = int(v) } case ebml.Float: d.FieldF("value", int(tagSize)*8) case ebml.String: - v := d.FieldUTF8("value", int(tagSize), optionalMap(a.StringEnums)) + var sm []scalar.StrMapper + if a.StringEnums != nil { + sm = append(sm, a.StringEnums) + } + v := d.FieldUTF8("value", int(tagSize), sm...) if dc.currentTrack != nil && tagID == ebml_matroska.CodecIDID { dc.currentTrack.codec = v } @@ -450,7 +453,7 @@ func matroskaDecode(d *decode.D, _ any) any { case "A_FLAC": t.parentD.RangeFn(t.codecPrivatePos, t.codecPrivateTagSize, func(d *decode.D) { d.FieldStruct("value", func(d *decode.D) { - d.FieldUTF8("magic", 4, d.AssertStr("fLaC")) + d.FieldUTF8("magic", 4, d.StrAssert("fLaC")) dv, v := d.FieldFormat("metadatablocks", flacMetadatablocksFormat, nil) flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut) if dv != nil && !ok { @@ -489,7 +492,7 @@ func matroskaDecode(d *decode.D, _ any) any { for _, b := range dc.blocks { b.d.RangeFn(b.r.Start, b.r.Len, func(d *decode.D) { var lacing uint64 - trackNumber := d.FieldUFn("track_number", decodeVint) + trackNumber := d.FieldUintFn("track_number", decodeVint) d.FieldU16("timestamp") if b.simple { d.FieldStruct("flags", func(d *decode.D) { diff --git a/format/media.go b/format/media.go index fdd81381..7d0990bb 100644 --- a/format/media.go +++ b/format/media.go @@ -46,7 +46,7 @@ const ( MPEGObjectTypeNONE = 0 ) -var MpegObjectTypeNames = scalar.UToSymStr{ +var MpegObjectTypeNames = scalar.UintMapSymStr{ MPEGObjectTypeMOV_TEXT: "MPEGObjectTypeMOV_TEXT", MPEGObjectTypeMPEG4: "MPEGObjectTypeMPEG4", MPEGObjectTypeH264: "MPEGObjectTypeH264", @@ -142,7 +142,7 @@ const ( MPEGAudioObjectTypePS = 29 ) -var MPEGAudioObjectTypeNames = scalar.UToScalar{ +var MPEGAudioObjectTypeNames = scalar.UintMap{ 0: {Sym: "mull", Description: "Null"}, MPEGAudioObjectTypeMain: {Sym: "aac_main", Description: "AAC Main"}, MPEGAudioObjectTypeLC: {Sym: "aac_lc", Description: "AAC Low Complexity)"}, @@ -194,7 +194,7 @@ var MPEGAudioObjectTypeNames = scalar.UToScalar{ // based on ffmpeg/libavutil/pixfmt.h // //nolint:revive -var ISO_23091_2_ColourPrimariesMap = scalar.UToScalar{ +var ISO_23091_2_ColourPrimariesMap = scalar.UintMap{ 1: {Sym: "bt709", Description: "ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B"}, 2: {Sym: "unspecified", Description: "Unspecified"}, 3: {Sym: "reserved", Description: "Reserved"}, @@ -211,7 +211,7 @@ var ISO_23091_2_ColourPrimariesMap = scalar.UToScalar{ } //nolint:revive -var ISO_23091_2_TransferCharacteristicMap = scalar.UToScalar{ +var ISO_23091_2_TransferCharacteristicMap = scalar.UintMap{ 1: {Sym: "bt709", Description: "ITU-R BT1361"}, 2: {Sym: "unspecified", Description: "Unspecified"}, 3: {Sym: "reserved", Description: "Reserved"}, @@ -233,7 +233,7 @@ var ISO_23091_2_TransferCharacteristicMap = scalar.UToScalar{ } //nolint:revive -var ISO_23091_2_MatrixCoefficients = scalar.UToScalar{ +var ISO_23091_2_MatrixCoefficients = scalar.UintMap{ 0: {Sym: "rgb", Description: "GBR, IEC 61966-2-1 (sRGB), YZX and ST 428-1"}, 1: {Sym: "bt709", Description: "ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B"}, 2: {Sym: "unspecified", Description: "Unspecified"}, @@ -329,7 +329,7 @@ const ( WAVTagVORBIS = 0x566f ) -var WAVTagNames = scalar.UToSymStr{ +var WAVTagNames = scalar.UintMapSymStr{ WAVTagPCM_S16LE: "pcm_s16le", WAVTagADPCM_MS: "adpcm_ms", WAVTagPCM_F32LE: "pcm_f32le", diff --git a/format/mp3/mp3_tags.go b/format/mp3/mp3_tags.go index c8f633ed..b687693e 100644 --- a/format/mp3/mp3_tags.go +++ b/format/mp3/mp3_tags.go @@ -19,14 +19,14 @@ func init() { }) } -var headerDescription = scalar.StrToDescription{ +var headerUintDescription = scalar.StrMapDescription{ "Xing": "XING variable bitrate", "Info": "XING variable bitrate", "VBRI": "Fraunhofer Encoder variable bitrate info", } func mp3FrameTagsDecode(d *decode.D, _ any) any { - switch d.FieldUTF8("header", 4, headerDescription) { + switch d.FieldUTF8("header", 4, headerUintDescription) { case "Xing", "Info": qualityPresent := false @@ -80,12 +80,12 @@ func mp3FrameTagsDecode(d *decode.D, _ any) any { d.FieldU16("version_id") d.FieldU16("delay") d.FieldU16("quality") - d.FieldU32("length", scalar.Description("Number of bytes")) - d.FieldU32("frames", scalar.Description("Number of frames")) - tocEntries := d.FieldU16("toc_entries", scalar.Description("Number of entries within TOC table")) - d.FieldU16("scale_factor", scalar.Description("Scale factor of TOC table entries")) - tocEntrySize := d.FieldU16("toc_entry_size", d.AssertU(1, 2, 3, 4), scalar.Description("Size per table entry")) - d.FieldU16("frame_per_entry", scalar.Description("Frames per table entry")) + d.FieldU32("length", scalar.UintDescription("Number of bytes")) + d.FieldU32("frames", scalar.UintDescription("Number of frames")) + tocEntries := d.FieldU16("toc_entries", scalar.UintDescription("Number of entries within TOC table")) + d.FieldU16("scale_factor", scalar.UintDescription("Scale factor of TOC table entries")) + tocEntrySize := d.FieldU16("toc_entry_size", d.UintAssert(1, 2, 3, 4), scalar.UintDescription("Size per table entry")) + d.FieldU16("frame_per_entry", scalar.UintDescription("Frames per table entry")) d.FieldArray("toc", func(d *decode.D) { for i := 0; i < int(tocEntries); i++ { d.FieldU("entry", int(tocEntrySize)*8) diff --git a/format/mp4/boxes.go b/format/mp4/boxes.go index dbd6bb0a..04d1d692 100644 --- a/format/mp4/boxes.go +++ b/format/mp4/boxes.go @@ -22,16 +22,16 @@ const ( boxSizeUse64bitSize = 1 ) -var boxSizeNames = scalar.UToDescription{ +var boxSizeNames = scalar.UintMapDescription{ boxSizeRestOfFile: "Rest of file", boxSizeUse64bitSize: "Use 64 bit size", } -var mediaTimeNames = scalar.SToDescription{ +var mediaTimeNames = scalar.SintMapDescription{ -1: "empty", } -var subTypeNames = scalar.StrToDescription{ +var subTypeNames = scalar.StrMapDescription{ "alis": "Alias Data", "camm": "Camera Metadata", "crsm": "Clock Reference", @@ -59,7 +59,7 @@ var subTypeNames = scalar.StrToDescription{ "vide": "Video Track", } -var dataFormatNames = scalar.StrToDescription{ +var dataFormatNames = scalar.StrMapDescription{ // additional codecs "apch": "Apple ProRes 422 High Quality", "apcn": "Apple ProRes 422 Standard Definition", @@ -185,15 +185,15 @@ var ( uuidIpodBytes = [16]byte{0x6b, 0x68, 0x40, 0xf2, 0x5f, 0x24, 0x4f, 0xc5, 0xba, 0x39, 0xa5, 0x1b, 0xcf, 0x03, 0x23, 0xf3} ) -var uuidNames = scalar.BytesToScalar{ - {Bytes: uuidIsmlManifestBytes[:], Scalar: scalar.S{Sym: "isml_manifest"}}, - {Bytes: uuidXmpBytes[:], Scalar: scalar.S{Sym: "xmp"}}, - {Bytes: uuidSphericalBytes[:], Scalar: scalar.S{Sym: "spherical"}}, - {Bytes: uuidPspUsmtBytes[:], Scalar: scalar.S{Sym: "psp_usmt"}}, - {Bytes: uuidTfxdBytes[:], Scalar: scalar.S{Sym: "tfxd"}}, - {Bytes: uuidTfrfBytes[:], Scalar: scalar.S{Sym: "tfrf"}}, - {Bytes: uuidProfBytes[:], Scalar: scalar.S{Sym: "prof"}}, - {Bytes: uuidIpodBytes[:], Scalar: scalar.S{Sym: "ipod"}}, +var uuidNames = scalar.RawBytesMap{ + {Bytes: uuidIsmlManifestBytes[:], Scalar: scalar.BitBuf{Sym: "isml_manifest"}}, + {Bytes: uuidXmpBytes[:], Scalar: scalar.BitBuf{Sym: "xmp"}}, + {Bytes: uuidSphericalBytes[:], Scalar: scalar.BitBuf{Sym: "spherical"}}, + {Bytes: uuidPspUsmtBytes[:], Scalar: scalar.BitBuf{Sym: "psp_usmt"}}, + {Bytes: uuidTfxdBytes[:], Scalar: scalar.BitBuf{Sym: "tfxd"}}, + {Bytes: uuidTfrfBytes[:], Scalar: scalar.BitBuf{Sym: "tfrf"}}, + {Bytes: uuidProfBytes[:], Scalar: scalar.BitBuf{Sym: "prof"}}, + {Bytes: uuidIpodBytes[:], Scalar: scalar.BitBuf{Sym: "ipod"}}, } // ISO 639-2/T language code 3 * 5bit packed uint + 1 zero bit @@ -208,7 +208,8 @@ func decodeLang(d *decode.D) string { // Quicktime time seconds in January 1, 1904 UTC var quicktimeEpochDate = time.Date(1904, time.January, 4, 0, 0, 0, 0, time.UTC) -var quicktimeEpoch = scalar.DescriptionTimeFn(scalar.S.TryActualU, quicktimeEpochDate, time.RFC3339) + +var uintActualQuicktimeEpoch = scalar.UintActualDate(quicktimeEpochDate, time.RFC3339) func decodeMvhdFieldMatrix(d *decode.D, name string) { d.FieldStruct(name, func(d *decode.D) { @@ -228,29 +229,29 @@ func decodeMvhdFieldMatrix(d *decode.D, name string) { func decodeSampleFlags(d *decode.D) { d.FieldU4("reserved0") d.FieldU2("is_leading") - d.FieldU2("sample_depends_on", scalar.UToScalar{ - 0: scalar.S{Sym: "unknown"}, - 1: scalar.S{Sym: "other", Description: "Not I-picture"}, - 2: scalar.S{Sym: "none", Description: "Is I-picture"}, + d.FieldU2("sample_depends_on", scalar.UintMap{ + 0: scalar.Uint{Sym: "unknown"}, + 1: scalar.Uint{Sym: "other", Description: "Not I-picture"}, + 2: scalar.Uint{Sym: "none", Description: "Is I-picture"}, }) - d.FieldU2("sample_is_depended_on", scalar.UToScalar{ - 0: scalar.S{Sym: "unknown"}, - 1: scalar.S{Sym: "other", Description: "Not disposable"}, - 2: scalar.S{Sym: "none", Description: "Is disposable"}, + d.FieldU2("sample_is_depended_on", scalar.UintMap{ + 0: scalar.Uint{Sym: "unknown"}, + 1: scalar.Uint{Sym: "other", Description: "Not disposable"}, + 2: scalar.Uint{Sym: "none", Description: "Is disposable"}, }) - d.FieldU2("sample_has_redundancy", scalar.UToScalar{ - 0: scalar.S{Sym: "unknown"}, - 2: scalar.S{Sym: "none", Description: "No redundant coding"}, + d.FieldU2("sample_has_redundancy", scalar.UintMap{ + 0: scalar.Uint{Sym: "unknown"}, + 2: scalar.Uint{Sym: "none", Description: "No redundant coding"}, }) d.FieldU3("sample_padding_value") d.FieldU1("sample_is_non_sync_sample") d.FieldU16("sample_degradation_priority") } -func decodeBoxWithParentData(ctx *decodeContext, d *decode.D, parentData any, extraTypeMappers ...scalar.Mapper) { +func decodeBoxWithParentData(ctx *decodeContext, d *decode.D, parentData any, extraTypeMappers ...scalar.StrMapper) { var typ string var dataSize uint64 - typeMappers := []scalar.Mapper{boxDescriptions} + typeMappers := []scalar.StrMapper{boxDescriptions} if len(extraTypeMappers) > 0 { typeMappers = append(typeMappers, extraTypeMappers...) } @@ -283,11 +284,11 @@ func decodeBoxWithParentData(ctx *decodeContext, d *decode.D, parentData any, ex ctx.path = ctx.path[0 : len(ctx.path)-1] } -func decodeBoxes(ctx *decodeContext, d *decode.D, extraTypeMappers ...scalar.Mapper) { +func decodeBoxes(ctx *decodeContext, d *decode.D, extraTypeMappers ...scalar.StrMapper) { decodeBoxesWithParentData(ctx, d, nil, extraTypeMappers...) } -func decodeBoxesWithParentData(ctx *decodeContext, d *decode.D, parentData any, extraTypeMappers ...scalar.Mapper) { +func decodeBoxesWithParentData(ctx *decodeContext, d *decode.D, parentData any, extraTypeMappers ...scalar.StrMapper) { d.FieldStructArrayLoop("boxes", "box", func() bool { return d.BitsLeft() >= 8*8 }, func(d *decode.D) { @@ -381,13 +382,13 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { d.FieldU24("flags") switch version { case 0: - d.FieldU32("creation_time", quicktimeEpoch) - d.FieldU32("modification_time", quicktimeEpoch) + d.FieldU32("creation_time", uintActualQuicktimeEpoch) + d.FieldU32("modification_time", uintActualQuicktimeEpoch) d.FieldU32("time_scale") d.FieldU32("duration") case 1: - d.FieldU64("creation_time", quicktimeEpoch) - d.FieldU64("modification_time", quicktimeEpoch) + d.FieldU64("creation_time", uintActualQuicktimeEpoch) + d.FieldU64("modification_time", uintActualQuicktimeEpoch) d.FieldU32("time_scale") d.FieldU64("duration") default: @@ -435,14 +436,14 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { d.FieldU24("flags") switch version { case 0: - d.FieldU32("creation_time", quicktimeEpoch) - d.FieldU32("modification_time", quicktimeEpoch) + d.FieldU32("creation_time", uintActualQuicktimeEpoch) + d.FieldU32("modification_time", uintActualQuicktimeEpoch) trackID = int(d.FieldU32("track_id")) d.FieldU32("reserved1") d.FieldU32("duration") case 1: - d.FieldU64("creation_time", quicktimeEpoch) - d.FieldU64("modification_time", quicktimeEpoch) + d.FieldU64("creation_time", uintActualQuicktimeEpoch) + d.FieldU64("modification_time", uintActualQuicktimeEpoch) trackID = int(d.FieldU32("track_id")) d.FieldU32("reserved1") d.FieldU64("duration") @@ -470,13 +471,13 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { // TODO: timestamps switch version { case 0: - d.FieldU32("creation_time", quicktimeEpoch) - d.FieldU32("modification_time", quicktimeEpoch) + d.FieldU32("creation_time", uintActualQuicktimeEpoch) + d.FieldU32("modification_time", uintActualQuicktimeEpoch) d.FieldU32("time_scale") d.FieldU32("duration") case 1: - d.FieldU64("creation_time", quicktimeEpoch) - d.FieldU64("modification_time", quicktimeEpoch) + d.FieldU64("creation_time", uintActualQuicktimeEpoch) + d.FieldU64("modification_time", uintActualQuicktimeEpoch) d.FieldU32("time_scale") d.FieldU64("duration") default: @@ -827,7 +828,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { for d.NotEnd() { d.FieldStruct("entry", func(d *decode.D) { d.FieldU2("reserved") - values := scalar.UToSymStr{ + values := scalar.UintMapSymStr{ 0: "unknown", 1: "yes", 2: "no", @@ -900,7 +901,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { if mb := ctx.currentMetaBox(); mb != nil && mb.keys != nil && len(mb.keys.keys) > 0 { // meta box had a keys box var b [4]byte - typeSymMapper := scalar.StrToSymStr{} + typeSymMapper := scalar.StrMapSymStr{} for k, v := range mb.keys.keys { // type will be a uint32 be integer // +1 as they seem to be counted from 1 @@ -1206,11 +1207,11 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { systemIDPlayReady = [16]byte{0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95} systemIDFairPlay = [16]byte{0x94, 0xce, 0x86, 0xfb, 0x07, 0xff, 0x4f, 0x43, 0xad, 0xb8, 0x93, 0xd2, 0xfa, 0x96, 0x8c, 0xa2} ) - systemIDNames := scalar.BytesToScalar{ - {Bytes: systemIDCommon[:], Scalar: scalar.S{Sym: "common"}}, - {Bytes: systemIDWidevine[:], Scalar: scalar.S{Sym: "widevine"}}, - {Bytes: systemIDPlayReady[:], Scalar: scalar.S{Sym: "playready"}}, - {Bytes: systemIDFairPlay[:], Scalar: scalar.S{Sym: "fairplay"}}, + systemIDNames := scalar.RawBytesMap{ + {Bytes: systemIDCommon[:], Scalar: scalar.BitBuf{Sym: "common"}}, + {Bytes: systemIDWidevine[:], Scalar: scalar.BitBuf{Sym: "widevine"}}, + {Bytes: systemIDPlayReady[:], Scalar: scalar.BitBuf{Sym: "playready"}}, + {Bytes: systemIDFairPlay[:], Scalar: scalar.BitBuf{Sym: "fairplay"}}, } version := d.FieldU8("version") @@ -1495,7 +1496,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { // for i := uint64(0); i < nPresentation; i++ { // d.FieldStruct("presentation", func(d *decode.D) { // d.FieldU8("presentation_version") - // presBytes := d.FieldUFn("pres_bytes", func() (uint64, decode.DisplayFormat, string) { + // presBytes := d.FieldUintFn("pres_bytes", func() (uint64, decode.DisplayFormat, string) { // n := d.U8() // if n == 0x0ff { // n += d.U16() @@ -1611,7 +1612,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) { case "cdsc": decodeBoxIrefEntry(ctx, d) case "irot": - d.FieldU8("rotation", scalar.UToSymU{ + d.FieldU8("rotation", scalar.UintMapSymUint{ 0: 0, 1: 90, 2: 180, diff --git a/format/mp4/brands.go b/format/mp4/brands.go index 4f464c51..37f9a3af 100644 --- a/format/mp4/brands.go +++ b/format/mp4/brands.go @@ -5,7 +5,7 @@ import "github.com/wader/fq/pkg/scalar" // from: // https://cconcolato.github.io/mp4ra/filetype.html // https://exiftool.org/TagNames/QuickTime.html -var brandDescriptions = scalar.StrToDescription{ +var brandDescriptions = scalar.StrMapDescription{ "3g2a": "3GPP2", "3g2b": "3GPP2 Media (.3G2) compliant with 3GPP2 C.S0050-A V1.0.0", "3g2c": "3GPP2 Media (.3G2) compliant with 3GPP2 C.S0050-B v1.0", diff --git a/format/mp4/desc.go b/format/mp4/desc.go index 8fc48fdf..d0bef8f9 100644 --- a/format/mp4/desc.go +++ b/format/mp4/desc.go @@ -4,7 +4,7 @@ import "github.com/wader/fq/pkg/scalar" // based on https://github.com/HexFiend/HexFiend/blob/master/templates/Media/MOV.tcl -var boxDescriptions = scalar.StrToDescription{ +var boxDescriptions = scalar.StrMapDescription{ "dimg": "Derived image", "cdsc": "Content description", "ainf": "Asset information to identify, license and play", diff --git a/format/mp4/mp4.go b/format/mp4/mp4.go index d5a8cb39..a0f8b543 100644 --- a/format/mp4/mp4.go +++ b/format/mp4/mp4.go @@ -270,7 +270,7 @@ func mp4Tracks(d *decode.D, ctx *decodeContext) { } d.FieldStruct("track", func(d *decode.D) { - d.FieldValueU("id", uint64(t.id)) + d.FieldValueUint("id", uint64(t.id)) trackSDDataFormat := "unknown" if len(t.sampleDescriptions) > 0 { diff --git a/format/mp4/pssh_playready.go b/format/mp4/pssh_playready.go index 3f5a0889..d28caf86 100644 --- a/format/mp4/pssh_playready.go +++ b/format/mp4/pssh_playready.go @@ -20,7 +20,7 @@ const ( recordTypeLicenseStore = 2 ) -var recordTypeNames = scalar.UToSymStr{ +var recordTypeNames = scalar.UintMapSymStr{ recordTypeRightsManagementHeader: "Rights management header", recordTypeLicenseStore: "License store", } diff --git a/format/mpeg/aac_frame.go b/format/mpeg/aac_frame.go index 3dd1b873..2e92de8c 100644 --- a/format/mpeg/aac_frame.go +++ b/format/mpeg/aac_frame.go @@ -37,7 +37,7 @@ const ( TERM = 0b111 ) -var syntaxElementNames = scalar.UToSymStr{ +var syntaxElementNames = scalar.UintMapSymStr{ SCE: "SCE", CPE: "CPE", CCE: "CCE", @@ -58,7 +58,7 @@ const ( EXT_SBR_DATA_CRC = 0xe ) -var extensionPayloadIDNames = scalar.UToSymStr{ +var extensionPayloadIDNames = scalar.UintMapSymStr{ EXT_FILL: "EXT_FILL", EXT_FILL_DATA: "EXT_FILL_DATA", EXT_DATA_ELEMENT: "EXT_DATA_ELEMENT", @@ -75,7 +75,7 @@ const ( LONG_STOP_SEQUENCE = 0x3 ) -var windowSequenceNames = scalar.UToSymStr{ +var windowSequenceNames = scalar.UintMapSymStr{ ONLY_LONG_SEQUENCE: "ONLY_LONG_SEQUENCE", LONG_START_SEQUENCE: "LONG_START_SEQUENCE", EIGHT_SHORT_SEQUENCE: "EIGHT_SHORT_SEQUENCE", @@ -254,7 +254,7 @@ func aacFillElement(d *decode.D) { cnt += escCount - 1 } }) - d.FieldValueU("payload_length", cnt) + d.FieldValueUint("payload_length", cnt) d.FieldStruct("extension_payload", func(d *decode.D) { d.FramedFn(int64(cnt)*8, func(d *decode.D) { diff --git a/format/mpeg/adts_frame.go b/format/mpeg/adts_frame.go index f11292f9..f823c3cc 100644 --- a/format/mpeg/adts_frame.go +++ b/format/mpeg/adts_frame.go @@ -24,7 +24,7 @@ func init() { }) } -var protectionAbsentNames = scalar.BoolToDescription{ +var protectionAbsentNames = scalar.BoolMapDescription{ true: "No CRC", false: "Has CRC", } @@ -65,13 +65,13 @@ func adtsFrameDecoder(d *decode.D, _ any) any { // P 2 Number of AAC frames (RDBs) in ADTS frame minus 1, for maximum compatibility always use 1 AAC frame per ADTS frame // Q 16 CRC if protection absent is 0 - d.FieldU12("syncword", d.AssertU(0b1111_1111_1111), scalar.ActualBin) - d.FieldU1("mpeg_version", scalar.UToSymStr{0: "mpeg4", 1: "mpeg2_aac"}) - d.FieldU2("layer", d.AssertU(0)) + d.FieldU12("syncword", d.UintAssert(0b1111_1111_1111), scalar.UintBin) + d.FieldU1("mpeg_version", scalar.UintMapSymStr{0: "mpeg4", 1: "mpeg2_aac"}) + d.FieldU2("layer", d.UintAssert(0)) protectionAbsent := d.FieldBool("protection_absent", protectionAbsentNames) - objectType := d.FieldU2("profile", scalar.ActualUAdd(1), format.MPEGAudioObjectTypeNames) - d.FieldUFn("sampling_frequency", decodeEscapeValueAbsFn(4, 24, 0), frequencyIndexHzMap) + objectType := d.FieldU2("profile", scalar.UintActualAdd(1), format.MPEGAudioObjectTypeNames) + d.FieldUintFn("sampling_frequency", decodeEscapeValueAbsFn(4, 24, 0), frequencyIndexHzMap) d.FieldU1("private_bit") d.FieldU3("channel_configuration", channelConfigurationNames) d.FieldU1("originality") @@ -86,7 +86,7 @@ func adtsFrameDecoder(d *decode.D, _ any) any { } d.FieldU11("buffer_fullness") - numberOfRDBs := d.FieldU2("number_of_rdbs", scalar.ActualUAdd(1)) + numberOfRDBs := d.FieldU2("number_of_rdbs", scalar.UintActualAdd(1)) if !protectionAbsent { d.FieldU16("crc") } diff --git a/format/mpeg/avc_dcr.go b/format/mpeg/avc_dcr.go index 3b7e507a..3fb13a8b 100644 --- a/format/mpeg/avc_dcr.go +++ b/format/mpeg/avc_dcr.go @@ -25,7 +25,7 @@ func init() { }) } -var avcProfileNames = scalar.UToSymStr{ +var avcProfileNames = scalar.UintMapSymStr{ // 66: "constrained_baseline_profile", // (CBP, 66 with constraint set 1) 66: "baseline_profile", 88: "extended_profile", @@ -48,7 +48,7 @@ var avcProfileNames = scalar.UToSymStr{ } // TODO: 1b contraint flag 1? -var avcLevelNames = scalar.UToSymStr{ +var avcLevelNames = scalar.UintMapSymStr{ 10: "1", //10: "1b" 11: "1.1", @@ -122,7 +122,7 @@ func avcDcrDecode(d *decode.D, _ any) any { d.FieldU8("profile_compatibility") d.FieldU8("level_indication", avcLevelNames) d.FieldU6("reserved0") - lengthSize := d.FieldU2("length_size", scalar.ActualUAdd(1)) + lengthSize := d.FieldU2("length_size", scalar.UintActualAdd(1)) d.FieldU3("reserved1") numSeqParamSets := d.FieldU5("num_of_sequence_parameter_sets") d.FieldArray("sequence_parameter_sets", func(d *decode.D) { diff --git a/format/mpeg/avc_nalu.go b/format/mpeg/avc_nalu.go index 2ff28da5..a6959f44 100644 --- a/format/mpeg/avc_nalu.go +++ b/format/mpeg/avc_nalu.go @@ -65,7 +65,7 @@ const ( avcNALCodedSliceExtension = 20 ) -var avcNALNames = scalar.UToScalar{ +var avcNALNames = scalar.UintMap{ 1: {Sym: "slice", Description: "Coded slice of a non-IDR picture"}, 2: {Sym: "dpa", Description: "Coded slice data partition A"}, 3: {Sym: "dpb", Description: "Coded slice data partition B"}, @@ -85,7 +85,7 @@ var avcNALNames = scalar.UToScalar{ 20: {Sym: "exten_slice", Description: "Coded slice extension"}, } -var sliceNames = scalar.UToSymStr{ +var sliceNames = scalar.UintMapSymStr{ 0: "p", 1: "b", 2: "i", @@ -113,9 +113,9 @@ func avcNALUDecode(d *decode.D, _ any) any { avcNALCodedSliceAuxWithoutPartition, avcNALCodedSliceExtension: d.FieldStruct("slice_header", func(d *decode.D) { - d.FieldUFn("first_mb_in_slice", uEV) - d.FieldUFn("slice_type", uEV, sliceNames) - d.FieldUFn("pic_parameter_set_id", uEV) + d.FieldUintFn("first_mb_in_slice", uEV) + d.FieldUintFn("slice_type", uEV, sliceNames) + d.FieldUintFn("pic_parameter_set_id", uEV) // TODO: if ( separate_colour_plane_flag from SPS ) colour_plane_id; frame_num }) case avcNALSupplementalEnhancementInformation: diff --git a/format/mpeg/avc_pps.go b/format/mpeg/avc_pps.go index 45d54b21..fabc4e87 100644 --- a/format/mpeg/avc_pps.go +++ b/format/mpeg/avc_pps.go @@ -21,26 +21,26 @@ func moreRBSPData(d *decode.D) bool { } func avcPPSDecode(d *decode.D, _ any) any { - d.FieldUFn("pic_parameter_set_id", uEV) - d.FieldUFn("seq_parameter_set_id", uEV) + d.FieldUintFn("pic_parameter_set_id", uEV) + d.FieldUintFn("seq_parameter_set_id", uEV) d.FieldBool("entropy_coding_mode_flag") d.FieldBool("bottom_field_pic_order_in_frame_present_flag") - numSliceGroups := d.FieldUFn("num_slice_groups", uEV, scalar.ActualUAdd(1)) + numSliceGroups := d.FieldUintFn("num_slice_groups", uEV, scalar.UintActualAdd(1)) if numSliceGroups > 1 { - sliceGroupMapType := d.FieldUFn("slice_group_map_type", uEV) + sliceGroupMapType := d.FieldUintFn("slice_group_map_type", uEV) switch sliceGroupMapType { case 0: d.FieldArray("slice_groups", func(d *decode.D) { for i := uint64(0); i < numSliceGroups; i++ { - d.FieldUFn("slice_group", uEV) + d.FieldUintFn("slice_group", uEV) } }) case 2: d.FieldArray("slice_groups", func(d *decode.D) { for i := uint64(0); i < numSliceGroups; i++ { d.FieldStruct("slice_group", func(d *decode.D) { - d.FieldUFn("top_left", uEV) - d.FieldUFn("bottom_right", uEV) + d.FieldUintFn("top_left", uEV) + d.FieldUintFn("bottom_right", uEV) }) } }) @@ -49,12 +49,12 @@ func avcPPSDecode(d *decode.D, _ any) any { for i := uint64(0); i < numSliceGroups; i++ { d.FieldStruct("slice_group", func(d *decode.D) { d.FieldBool("change_direction_flag") - d.FieldUFn("change_rate", uEV, scalar.ActualUAdd(1)) + d.FieldUintFn("change_rate", uEV, scalar.UintActualAdd(1)) }) } }) case 6: - picSizeInMapUnits := d.FieldUFn("pic_size_in_map_units", uEV, scalar.ActualUAdd(1)) + picSizeInMapUnits := d.FieldUintFn("pic_size_in_map_units", uEV, scalar.UintActualAdd(1)) for i := uint64(0); i < picSizeInMapUnits; i++ { d.FieldStruct("slice_group", func(d *decode.D) { d.FieldBool("id") @@ -63,13 +63,13 @@ func avcPPSDecode(d *decode.D, _ any) any { } } - d.FieldUFn("num_ref_idx_l0_default_active", uEV, scalar.ActualUAdd(1)) - d.FieldUFn("num_ref_idx_l1_default_active", uEV, scalar.ActualUAdd(1)) + d.FieldUintFn("num_ref_idx_l0_default_active", uEV, scalar.UintActualAdd(1)) + d.FieldUintFn("num_ref_idx_l1_default_active", uEV, scalar.UintActualAdd(1)) d.FieldBool("weighted_pred_flag") d.FieldU2("weighted_bipred_idc") - d.FieldSFn("pic_init_qp", sEV, scalar.ActualSAdd(26)) - d.FieldSFn("pic_init_qs", sEV, scalar.ActualSAdd(26)) - d.FieldSFn("chroma_qp_index_offset", sEV) + d.FieldSintFn("pic_init_qp", sEV, scalar.SintActualAdd(26)) + d.FieldSintFn("pic_init_qs", sEV, scalar.SintActualAdd(26)) + d.FieldSintFn("chroma_qp_index_offset", sEV) d.FieldBool("deblocking_filter_control_present_flag") d.FieldBool("constrained_intra_pred_flag") d.FieldBool("redundant_pic_cnt_present_flag") @@ -84,7 +84,7 @@ func avcPPSDecode(d *decode.D, _ any) any { } }) } - d.FieldSFn("second_chroma_qp_index_offset", sEV) + d.FieldSintFn("second_chroma_qp_index_offset", sEV) } else { d.FieldBool("rbsp_stop_one_bit") } diff --git a/format/mpeg/avc_sei.go b/format/mpeg/avc_sei.go index 5c2e0b99..abea4bea 100644 --- a/format/mpeg/avc_sei.go +++ b/format/mpeg/avc_sei.go @@ -19,7 +19,7 @@ const ( avcSEIUserDataUnregistered = 5 ) -var seiNames = scalar.UToSymStr{ +var seiNames = scalar.UintMapSymStr{ 0: "buffering_period", 1: "pic_timing", 2: "pan_scan_rect", @@ -84,8 +84,8 @@ var ( x264Bytes = [16]byte{0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef} ) -var userDataUnregisteredNames = scalar.BytesToScalar{ - {Bytes: x264Bytes[:], Scalar: scalar.S{Sym: "x264"}}, +var userDataUnregisteredNames = scalar.RawBytesMap{ + {Bytes: x264Bytes[:], Scalar: scalar.BitBuf{Sym: "x264"}}, } // sum bytes until < 0xff @@ -102,8 +102,8 @@ func ffSum(d *decode.D) uint64 { } func avcSEIDecode(d *decode.D, _ any) any { - payloadType := d.FieldUFn("payload_type", func(d *decode.D) uint64 { return ffSum(d) }, seiNames) - payloadSize := d.FieldUFn("payload_size", func(d *decode.D) uint64 { return ffSum(d) }) + payloadType := d.FieldUintFn("payload_type", func(d *decode.D) uint64 { return ffSum(d) }, seiNames) + payloadSize := d.FieldUintFn("payload_size", func(d *decode.D) uint64 { return ffSum(d) }) d.FramedFn(int64(payloadSize)*8, func(d *decode.D) { switch payloadType { diff --git a/format/mpeg/avc_sps.go b/format/mpeg/avc_sps.go index af921ee4..c283020c 100644 --- a/format/mpeg/avc_sps.go +++ b/format/mpeg/avc_sps.go @@ -15,7 +15,7 @@ func init() { }) } -var avcVideoFormatMap = scalar.UToSymStr{ +var avcVideoFormatMap = scalar.UintMapSymStr{ 0: "component", 1: "pal", 2: "ntsc", @@ -26,7 +26,7 @@ var avcVideoFormatMap = scalar.UToSymStr{ 7: "reserved", } -var avcAspectRatioIdcMap = scalar.UToSymStr{ +var avcAspectRatioIdcMap = scalar.UintMapSymStr{ 0: "unspecified", 1: "1:1", 2: "12:11", @@ -46,7 +46,7 @@ var avcAspectRatioIdcMap = scalar.UToSymStr{ 16: "2:1", } -var chromaFormatMap = scalar.UToSymStr{ +var chromaFormatMap = scalar.UintMapSymStr{ 0: "monochrome", 1: "4:2:0", 2: "4:2:2", @@ -80,8 +80,8 @@ func avcVuiParameters(d *decode.D) { } chromaLocInfoPresentFlag := d.FieldBool("chroma_loc_info_present_flag") if chromaLocInfoPresentFlag { - d.FieldUFn("chroma_sample_loc_type_top_field", uEV) - d.FieldUFn("chroma_sample_loc_type_bottom_field", uEV) + d.FieldUintFn("chroma_sample_loc_type_top_field", uEV) + d.FieldUintFn("chroma_sample_loc_type_bottom_field", uEV) } timingInfoPresentFlag := d.FieldBool("timing_info_present_flag") @@ -106,31 +106,31 @@ func avcVuiParameters(d *decode.D) { bitstreamRestrictionFlag := d.FieldBool("bitstream_restriction_flag") if bitstreamRestrictionFlag { d.FieldBool("motion_vectors_over_pic_boundaries_flag") - d.FieldUFn("max_bytes_per_pic_denom", uEV) - d.FieldUFn("max_bits_per_mb_denom", uEV) - d.FieldUFn("log2_max_mv_length_horizontal", uEV) - d.FieldUFn("log2_max_mv_length_vertical", uEV) - d.FieldUFn("max_num_reorder_frames", uEV) - d.FieldUFn("max_dec_frame_buffering", uEV) + d.FieldUintFn("max_bytes_per_pic_denom", uEV) + d.FieldUintFn("max_bits_per_mb_denom", uEV) + d.FieldUintFn("log2_max_mv_length_horizontal", uEV) + d.FieldUintFn("log2_max_mv_length_vertical", uEV) + d.FieldUintFn("max_num_reorder_frames", uEV) + d.FieldUintFn("max_dec_frame_buffering", uEV) } } func avcHdrParameters(d *decode.D) { - cpbCnt := d.FieldUFn("cpb_cnt", uEV, scalar.ActualUAdd(1)) + cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UintActualAdd(1)) d.FieldU4("bit_rate_scale") d.FieldU4("cpb_size_scale") d.FieldArray("sched_sels", func(d *decode.D) { for i := uint64(0); i < cpbCnt; i++ { d.FieldStruct("sched_sel", func(d *decode.D) { - d.FieldUFn("bit_rate_value", uEV, scalar.ActualUAdd(1)) - d.FieldUFn("cpb_size_value", uEV, scalar.ActualUAdd(1)) + d.FieldUintFn("bit_rate_value", uEV, scalar.UintActualAdd(1)) + d.FieldUintFn("cpb_size_value", uEV, scalar.UintActualAdd(1)) d.FieldBool("cbr_flag") }) } }) - d.FieldU5("initial_cpb_removal_delay_length", scalar.ActualUAdd(1)) - d.FieldU5("cpb_removal_delay_length", scalar.ActualUAdd(1)) - d.FieldU5("dpb_output_delay_length", scalar.ActualUAdd(1)) + d.FieldU5("initial_cpb_removal_delay_length", scalar.UintActualAdd(1)) + d.FieldU5("cpb_removal_delay_length", scalar.UintActualAdd(1)) + d.FieldU5("dpb_output_delay_length", scalar.UintActualAdd(1)) d.FieldU5("time_offset_length") } @@ -144,18 +144,18 @@ func avcSPSDecode(d *decode.D, _ any) any { d.FieldBool("constraint_set5_flag") d.FieldU2("reserved_zero_2bits") d.FieldU8("level_idc", avcLevelNames) - d.FieldUFn("seq_parameter_set_id", uEV) + d.FieldUintFn("seq_parameter_set_id", uEV) switch profileIdc { // TODO: ffmpeg has some more (legacy values?) case 100, 110, 122, 244, 44, 83, 86, 118, 128, 138, 139, 134, 135: - chromaFormatIdc := d.FieldUFn("chroma_format_idc", uEV, chromaFormatMap) + chromaFormatIdc := d.FieldUintFn("chroma_format_idc", uEV, chromaFormatMap) if chromaFormatIdc == 3 { d.FieldBool("separate_colour_plane_flag") } - d.FieldUFn("bit_depth_luma", uEV, scalar.ActualUAdd(8)) - d.FieldUFn("bit_depth_chroma", uEV, scalar.ActualUAdd(8)) + d.FieldUintFn("bit_depth_luma", uEV, scalar.UintActualAdd(8)) + d.FieldUintFn("bit_depth_chroma", uEV, scalar.UintActualAdd(8)) d.FieldBool("qpprime_y_zero_transform_bypass_flag") seqScalingMatrixPresentFlag := d.FieldBool("seq_scaling_matrix_present_flag") if seqScalingMatrixPresentFlag { @@ -164,16 +164,16 @@ func avcSPSDecode(d *decode.D, _ any) any { } } - d.FieldUFn("log2_max_frame_num", uEV, scalar.ActualUAdd(4)) + d.FieldUintFn("log2_max_frame_num", uEV, scalar.UintActualAdd(4)) - picOrderCntType := d.FieldUFn("pic_order_cnt_type", uEV) + picOrderCntType := d.FieldUintFn("pic_order_cnt_type", uEV) if picOrderCntType == 0 { - d.FieldUFn("log2_max_pic_order_cnt_lsb", uEV, scalar.ActualUAdd(4)) + d.FieldUintFn("log2_max_pic_order_cnt_lsb", uEV, scalar.UintActualAdd(4)) } else if picOrderCntType == 1 { d.FieldBool("delta_pic_order_always_zero_flag") - d.FieldSFn("offset_for_non_ref_pic", sEV) - d.FieldSFn("offset_for_top_to_bottom_field", sEV) - numRefFramesInPicOrderCntCycle := d.FieldUFn("num_ref_frames_in_pic_order_cnt_cycle", uEV) + d.FieldSintFn("offset_for_non_ref_pic", sEV) + d.FieldSintFn("offset_for_top_to_bottom_field", sEV) + numRefFramesInPicOrderCntCycle := d.FieldUintFn("num_ref_frames_in_pic_order_cnt_cycle", uEV) d.FieldArray("offset_for_ref_frames", func(d *decode.D) { for i := uint64(0); i < numRefFramesInPicOrderCntCycle; i++ { sEV(d) @@ -181,10 +181,10 @@ func avcSPSDecode(d *decode.D, _ any) any { }) } - d.FieldUFn("max_num_ref_frames", uEV) + d.FieldUintFn("max_num_ref_frames", uEV) d.FieldBool("gaps_in_frame_num_value_allowed_flag") - d.FieldUFn("pic_width_in_mbs", uEV, scalar.ActualUAdd(1)) - d.FieldUFn("pic_height_in_map_units", uEV, scalar.ActualUAdd(1)) + d.FieldUintFn("pic_width_in_mbs", uEV, scalar.UintActualAdd(1)) + d.FieldUintFn("pic_height_in_map_units", uEV, scalar.UintActualAdd(1)) frameMbsOnlyFlag := d.FieldBool("frame_mbs_only_flag") if !frameMbsOnlyFlag { d.FieldBool("mb_adaptive_frame_field_flag") @@ -192,10 +192,10 @@ func avcSPSDecode(d *decode.D, _ any) any { d.FieldBool("direct_8x8_inference_flag") frameCroppingFlag := d.FieldBool("frame_cropping_flag") if frameCroppingFlag { - d.FieldUFn("frame_crop_left_offset", uEV) - d.FieldUFn("frame_crop_right_offset", uEV) - d.FieldUFn("frame_crop_top_offset", uEV) - d.FieldUFn("frame_crop_bottom_offset", uEV) + d.FieldUintFn("frame_crop_left_offset", uEV) + d.FieldUintFn("frame_crop_right_offset", uEV) + d.FieldUintFn("frame_crop_top_offset", uEV) + d.FieldUintFn("frame_crop_bottom_offset", uEV) } vuiParametersPresentFlag := d.FieldBool("vui_parameters_present_flag") if vuiParametersPresentFlag { diff --git a/format/mpeg/hevc_dcr.go b/format/mpeg/hevc_dcr.go index f080b24b..1a029a12 100644 --- a/format/mpeg/hevc_dcr.go +++ b/format/mpeg/hevc_dcr.go @@ -35,14 +35,14 @@ func hevcDcrDecode(d *decode.D, _ any) any { d.FieldU6("reserved2") d.FieldU2("chroma_format_idc") d.FieldU5("reserved3") - d.FieldU3("bit_depth_luma", scalar.ActualUAdd(8)) + d.FieldU3("bit_depth_luma", scalar.UintActualAdd(8)) d.FieldU5("reserved4") - d.FieldU3("bit_depth_chroma", scalar.ActualUAdd(8)) + d.FieldU3("bit_depth_chroma", scalar.UintActualAdd(8)) d.FieldU16("avg_frame_rate") d.FieldU2("constant_frame_rate") d.FieldU3("num_temporal_layers") d.FieldU1("temporal_id_nested") - lengthSize := d.FieldU2("length_size", scalar.ActualUAdd(1)) + lengthSize := d.FieldU2("length_size", scalar.UintActualAdd(1)) numArrays := d.FieldU8("num_of_arrays") d.FieldArray("arrays", func(d *decode.D) { for i := uint64(0); i < numArrays; i++ { diff --git a/format/mpeg/hevc_nalu.go b/format/mpeg/hevc_nalu.go index 86dff61a..32ce8ff9 100644 --- a/format/mpeg/hevc_nalu.go +++ b/format/mpeg/hevc_nalu.go @@ -31,7 +31,7 @@ const ( hevcNALNUTPPS = 34 ) -var hevcNALNames = scalar.UToSymStr{ +var hevcNALNames = scalar.UintMapSymStr{ 0: "TRAIL_N", 1: "TRAIL_R", 2: "TSA_N", diff --git a/format/mpeg/hevc_pps.go b/format/mpeg/hevc_pps.go index 1184f83f..47187163 100644 --- a/format/mpeg/hevc_pps.go +++ b/format/mpeg/hevc_pps.go @@ -18,24 +18,24 @@ func init() { // H.265 page 36 func hevcPPSDecode(d *decode.D, _ any) any { - d.FieldUFn("pps_pic_parameter_set_id", uEV) - d.FieldUFn("pps_seq_parameter_set_id", uEV) + d.FieldUintFn("pps_pic_parameter_set_id", uEV) + d.FieldUintFn("pps_seq_parameter_set_id", uEV) d.FieldBool("dependent_slice_segments_enabled_flag") d.FieldBool("output_flag_present_flag") d.FieldU3("num_extra_slice_header_bits") d.FieldBool("sign_data_hiding_enabled_flag") d.FieldBool("cabac_init_present_flag") - d.FieldUFn("num_ref_idx_l0_default_active_minus1", uEV) - d.FieldUFn("num_ref_idx_l1_default_active_minus1", uEV) - d.FieldSFn("init_qp_minus26", sEV) + d.FieldUintFn("num_ref_idx_l0_default_active_minus1", uEV) + d.FieldUintFn("num_ref_idx_l1_default_active_minus1", uEV) + d.FieldSintFn("init_qp_minus26", sEV) d.FieldBool("constrained_intra_pred_flag") d.FieldBool("transform_skip_enabled_flag") cuQpDeltaEnabledFlag := d.FieldBool("cu_qp_delta_enabled_flag") if cuQpDeltaEnabledFlag { - d.FieldUFn("diff_cu_qp_delta_depth", uEV) + d.FieldUintFn("diff_cu_qp_delta_depth", uEV) } - d.FieldSFn("pps_cb_qp_offset", sEV) - d.FieldSFn("pps_cr_qp_offset", sEV) + d.FieldSintFn("pps_cb_qp_offset", sEV) + d.FieldSintFn("pps_cr_qp_offset", sEV) d.FieldBool("pps_slice_chroma_qp_offsets_present_flag") d.FieldBool("weighted_pred_flag") d.FieldBool("weighted_bipred_flag") @@ -43,18 +43,18 @@ func hevcPPSDecode(d *decode.D, _ any) any { tilesEnabledFlag := d.FieldBool("tiles_enabled_flag") d.FieldBool("entropy_coding_sync_enabled_flag") if tilesEnabledFlag { - numTileColumnsMinus1 := d.FieldUFn("num_tile_columns_minus1", uEV) - numTileRowsMinus1 := d.FieldUFn("num_tile_rows_minus1", uEV) + numTileColumnsMinus1 := d.FieldUintFn("num_tile_columns_minus1", uEV) + numTileRowsMinus1 := d.FieldUintFn("num_tile_rows_minus1", uEV) uniformSpacingFlag := d.FieldBool("uniform_spacing_flag") if !uniformSpacingFlag { d.FieldArray("column_widths", func(d *decode.D) { for i := uint64(0); i < numTileColumnsMinus1; i++ { - d.FieldUFn("column_width", uEV) + d.FieldUintFn("column_width", uEV) } }) d.FieldArray("row_heights", func(d *decode.D) { for i := uint64(0); i < numTileRowsMinus1; i++ { - d.FieldUFn("row_height", uEV) + d.FieldUintFn("row_height", uEV) } }) } @@ -66,8 +66,8 @@ func hevcPPSDecode(d *decode.D, _ any) any { d.FieldBool("deblocking_filter_override_enabled_flag") ppsDeblockingFilterDisabledFlag := d.FieldBool("pps_deblocking_filter_disabled_flag") if !ppsDeblockingFilterDisabledFlag { - d.FieldSFn("pps_beta_offset_div2", sEV) - d.FieldSFn("pps_tc_offset_div2", sEV) + d.FieldSintFn("pps_beta_offset_div2", sEV) + d.FieldSintFn("pps_tc_offset_div2", sEV) } } ppsScalingListDataPresentFlag := d.FieldBool("pps_scaling_list_data_present_flag") @@ -76,7 +76,7 @@ func hevcPPSDecode(d *decode.D, _ any) any { return nil } d.FieldBool("lists_modification_present_flag") - d.FieldUFn("log2_parallel_merge_level_minus2", uEV) + d.FieldUintFn("log2_parallel_merge_level_minus2", uEV) d.FieldBool("slice_segment_header_extension_present_flag") ppsExtensionPresentFlag := d.FieldBool("pps_extension_present_flag") if ppsExtensionPresentFlag { diff --git a/format/mpeg/hevc_sps.go b/format/mpeg/hevc_sps.go index 7c5d587a..bcdac024 100644 --- a/format/mpeg/hevc_sps.go +++ b/format/mpeg/hevc_sps.go @@ -106,11 +106,11 @@ func profileTierLevelDecode(d *decode.D, profilePresentFlag bool, maxNumSubLayer func hevcSubLayerHrdParameters(d *decode.D, subPicHrdParamsPresentFlag bool, cpbCntMinus1 int) { for i := 0; i <= cpbCntMinus1; i++ { d.FieldStruct("parameters", func(d *decode.D) { - d.FieldUFn("bit_rate_value_minus1", uEV) - d.FieldUFn("cpb_size_value_minus1", uEV) + d.FieldUintFn("bit_rate_value_minus1", uEV) + d.FieldUintFn("cpb_size_value_minus1", uEV) if subPicHrdParamsPresentFlag { - d.FieldUFn("cpb_size_du_value_minus1", uEV) - d.FieldUFn("bit_rate_du_value_minus1", uEV) + d.FieldUintFn("cpb_size_du_value_minus1", uEV) + d.FieldUintFn("bit_rate_du_value_minus1", uEV) } d.FieldBool("cbr_flag") }) @@ -152,13 +152,13 @@ func hevcHrdParameters(d *decode.D, commonInfPresentFlag bool, maxNumSubLayersMi } var lowDelayHrdFlag bool if fixedPicRateWithinCvsFlag { - d.FieldUFn("elemental_duration_in_tc_minus1", uEV) + d.FieldUintFn("elemental_duration_in_tc_minus1", uEV) } else { lowDelayHrdFlag = d.FieldBool("low_delay_hrd_flag") } var cpbCntMinus1 int if !lowDelayHrdFlag { - cpbCntMinus1 = int(d.FieldUFn("cpb_cnt_minus1", uEV)) + cpbCntMinus1 = int(d.FieldUintFn("cpb_cnt_minus1", uEV)) } if nalHrdParametersPresentFlag { hevcSubLayerHrdParameters(d, subPicHrdParamsPresentFlag, cpbCntMinus1) @@ -198,8 +198,8 @@ func hevcVuiParameters(d *decode.D, spsMaxSubLayersMinus1 uint64) { } chromaLocInfoPresentFlag := d.FieldBool("chroma_loc_info_present_flag") if chromaLocInfoPresentFlag { - d.FieldUFn("chroma_sample_loc_type_top_field", uEV) - d.FieldUFn("chroma_sample_loc_type_bottom_field", uEV) + d.FieldUintFn("chroma_sample_loc_type_top_field", uEV) + d.FieldUintFn("chroma_sample_loc_type_bottom_field", uEV) } d.FieldBool("neutral_chroma_indication_flag") @@ -207,10 +207,10 @@ func hevcVuiParameters(d *decode.D, spsMaxSubLayersMinus1 uint64) { d.FieldBool("frame_field_info_present_flag") defaultDisplayWindowFlag := d.FieldBool("default_display_window_flag") if defaultDisplayWindowFlag { - d.FieldUFn("def_disp_win_left_offset", uEV) - d.FieldUFn("def_disp_win_right_offset", uEV) - d.FieldUFn("def_disp_win_top_offset", uEV) - d.FieldUFn("def_disp_win_bottom_offset", uEV) + d.FieldUintFn("def_disp_win_left_offset", uEV) + d.FieldUintFn("def_disp_win_right_offset", uEV) + d.FieldUintFn("def_disp_win_top_offset", uEV) + d.FieldUintFn("def_disp_win_bottom_offset", uEV) } vuiTimingInfoPresentFlag := d.FieldBool("vui_timing_info_present_flag") @@ -219,7 +219,7 @@ func hevcVuiParameters(d *decode.D, spsMaxSubLayersMinus1 uint64) { d.FieldU32("vui_time_scale") vuiPocProportionalToTimingFlag := d.FieldBool("vui_poc_proportional_to_timing_flag") if vuiPocProportionalToTimingFlag { - d.FieldUFn("vui_num_ticks_poc_diff_one_minus1", uEV) + d.FieldUintFn("vui_num_ticks_poc_diff_one_minus1", uEV) } vuiHrdParametersPresentFlag := d.FieldBool("vui_hrd_parameters_present_flag") if vuiHrdParametersPresentFlag { @@ -232,11 +232,11 @@ func hevcVuiParameters(d *decode.D, spsMaxSubLayersMinus1 uint64) { d.FieldBool("tiles_fixed_structure_flag") d.FieldBool("motion_vectors_over_pic_boundaries_flag") d.FieldBool("restricted_ref_pic_lists_flag") - d.FieldUFn("min_spatial_segmentation_idc", uEV) - d.FieldUFn("max_bytes_per_pic_denom", uEV) - d.FieldUFn("max_bits_per_min_cu_denom", uEV) - d.FieldUFn("log2_max_mv_length_horizontal", uEV) - d.FieldUFn("log2_max_mv_length_vertical", uEV) + d.FieldUintFn("min_spatial_segmentation_idc", uEV) + d.FieldUintFn("max_bytes_per_pic_denom", uEV) + d.FieldUintFn("max_bits_per_min_cu_denom", uEV) + d.FieldUintFn("log2_max_mv_length_horizontal", uEV) + d.FieldUintFn("log2_max_mv_length_vertical", uEV) } } @@ -246,23 +246,23 @@ func hevcSPSDecode(d *decode.D, _ any) any { spsMaxSubLayersMinus1 := d.FieldU3("sps_max_sub_layers_minus1") d.FieldBool("sps_temporal_id_nesting_flag") profileTierLevelDecode(d, true, spsMaxSubLayersMinus1) - d.FieldUFn("sps_seq_parameter_set_id", uEV) - chromaFormatIdc := d.FieldUFn("chroma_format_idc", uEV, chromaFormatMap) + d.FieldUintFn("sps_seq_parameter_set_id", uEV) + chromaFormatIdc := d.FieldUintFn("chroma_format_idc", uEV, chromaFormatMap) if chromaFormatIdc == 3 { d.FieldBool("separate_colour_plane_flag") } - d.FieldUFn("pic_width_in_luma_samples", uEV) - d.FieldUFn("pic_height_in_luma_samples", uEV) + d.FieldUintFn("pic_width_in_luma_samples", uEV) + d.FieldUintFn("pic_height_in_luma_samples", uEV) conformanceWindowFlag := d.FieldBool("conformance_window_flag") if conformanceWindowFlag { - d.FieldUFn("conf_win_left_offset", uEV) - d.FieldUFn("conf_win_right_offset", uEV) - d.FieldUFn("conf_win_top_offset", uEV) - d.FieldUFn("conf_win_bottom_offset", uEV) + d.FieldUintFn("conf_win_left_offset", uEV) + d.FieldUintFn("conf_win_right_offset", uEV) + d.FieldUintFn("conf_win_top_offset", uEV) + d.FieldUintFn("conf_win_bottom_offset", uEV) } - d.FieldUFn("bit_depth_luma_minus8", uEV) - d.FieldUFn("bit_depth_chroma_minus8", uEV) - d.FieldUFn("log2_max_pic_order_cnt_lsb_minus4", uEV) + d.FieldUintFn("bit_depth_luma_minus8", uEV) + d.FieldUintFn("bit_depth_chroma_minus8", uEV) + d.FieldUintFn("log2_max_pic_order_cnt_lsb_minus4", uEV) spsSubLayerOrderingInfoPresentFlag := d.FieldBool("sps_sub_layer_ordering_info_present_flag") d.FieldArray("sps_sub_layer_ordering_infos", func(d *decode.D) { i := spsMaxSubLayersMinus1 @@ -271,18 +271,18 @@ func hevcSPSDecode(d *decode.D, _ any) any { } for ; i <= spsMaxSubLayersMinus1; i++ { d.FieldStruct("sps_sub_layer_ordering_info", func(d *decode.D) { - d.FieldUFn("sps_max_dec_pic_buffering_minus1", uEV) - d.FieldUFn("sps_max_num_reorder_pics", uEV) - d.FieldUFn("sps_max_latency_increase_plus1", uEV) + d.FieldUintFn("sps_max_dec_pic_buffering_minus1", uEV) + d.FieldUintFn("sps_max_num_reorder_pics", uEV) + d.FieldUintFn("sps_max_latency_increase_plus1", uEV) }) } }) - d.FieldUFn("log2_min_luma_coding_block_size_minus3", uEV) - d.FieldUFn("log2_diff_max_min_luma_coding_block_size", uEV) - d.FieldUFn("log2_min_luma_transform_block_size_minus2", uEV) - d.FieldUFn("log2_diff_max_min_luma_transform_block_size", uEV) - d.FieldUFn("max_transform_hierarchy_depth_inter", uEV) - d.FieldUFn("max_transform_hierarchy_depth_intra", uEV) + d.FieldUintFn("log2_min_luma_coding_block_size_minus3", uEV) + d.FieldUintFn("log2_diff_max_min_luma_coding_block_size", uEV) + d.FieldUintFn("log2_min_luma_transform_block_size_minus2", uEV) + d.FieldUintFn("log2_diff_max_min_luma_transform_block_size", uEV) + d.FieldUintFn("max_transform_hierarchy_depth_inter", uEV) + d.FieldUintFn("max_transform_hierarchy_depth_intra", uEV) scalingListEnabledFlag := d.FieldBool("scaling_list_enabled_flag") if scalingListEnabledFlag { spsScalingListDataPresentFlag := d.FieldBool("sps_scaling_list_data_present_flag") @@ -297,11 +297,11 @@ func hevcSPSDecode(d *decode.D, _ any) any { if pcmEnabledFlag { d.FieldU4("pcm_sample_bit_depth_luma_minus1") d.FieldU4("pcm_sample_bit_depth_chroma_minus1") - d.FieldUFn("log2_min_pcm_luma_coding_block_size_minus3", uEV) - d.FieldUFn("log2_diff_max_min_pcm_luma_coding_block_size", uEV) + d.FieldUintFn("log2_min_pcm_luma_coding_block_size_minus3", uEV) + d.FieldUintFn("log2_diff_max_min_pcm_luma_coding_block_size", uEV) d.FieldBool("pcm_loop_filter_disabled_flag") } - numShortTermRefPicSets := d.FieldUFn("num_short_term_ref_pic_sets", uEV) + numShortTermRefPicSets := d.FieldUintFn("num_short_term_ref_pic_sets", uEV) if numShortTermRefPicSets > 0 { // TODO return nil diff --git a/format/mpeg/hevc_vps.go b/format/mpeg/hevc_vps.go index 6bb5a70e..e0b5212d 100644 --- a/format/mpeg/hevc_vps.go +++ b/format/mpeg/hevc_vps.go @@ -36,14 +36,14 @@ func hevcVPSDecode(d *decode.D, _ any) any { } for ; i <= vpsMaxSubLayersMinus1; i++ { d.FieldStruct("sps_sub_layer_ordering_info", func(d *decode.D) { - d.FieldUFn("sps_max_dec_pic_buffering_minus1", uEV) - d.FieldUFn("sps_max_num_reorder_pics", uEV) - d.FieldUFn("sps_max_latency_increase_plus1", uEV) + d.FieldUintFn("sps_max_dec_pic_buffering_minus1", uEV) + d.FieldUintFn("sps_max_num_reorder_pics", uEV) + d.FieldUintFn("sps_max_latency_increase_plus1", uEV) }) } }) vpsMaxLayerID := d.FieldU6("vps_max_layer_id") - vpsNumLayerSetsMinus1 := d.FieldUFn("vps_num_layer_sets_minus1", uEV) + vpsNumLayerSetsMinus1 := d.FieldUintFn("vps_num_layer_sets_minus1", uEV) if vpsNumLayerSetsMinus1 > maxVpsLayers { d.Errorf("too many vps layers %d > %d", vpsNumLayerSetsMinus1, maxVpsLayers) } @@ -62,7 +62,7 @@ func hevcVPSDecode(d *decode.D, _ any) any { d.FieldU32("vps_time_scale") vpsPocProportionalToTimingFlag := d.FieldBool("vps_poc_proportional_to_timing_flag") if vpsPocProportionalToTimingFlag { - d.FieldUFn("vps_num_ticks_poc_diff_one_minus1", uEV) + d.FieldUintFn("vps_num_ticks_poc_diff_one_minus1", uEV) } vpsHrdParametersPresentFlag := d.FieldBool("vps_hrd_parameters_present_flag") if vpsHrdParametersPresentFlag { diff --git a/format/mpeg/mp3_frame.go b/format/mpeg/mp3_frame.go index 18df2545..dfa68b13 100644 --- a/format/mpeg/mp3_frame.go +++ b/format/mpeg/mp3_frame.go @@ -14,6 +14,7 @@ package mpeg import ( "github.com/wader/fq/format" + "github.com/wader/fq/pkg/bitio" "github.com/wader/fq/pkg/checksum" "github.com/wader/fq/pkg/decode" "github.com/wader/fq/pkg/interp" @@ -92,7 +93,7 @@ func init() { // 15: {4, 3}, // } -var blockTypeNames = scalar.UToSymStr{ +var blockTypeNames = scalar.UintMapSymStr{ 0: "reserved", 1: "start block", 2: "3 short windows", @@ -105,7 +106,7 @@ const ( mpegVersion25 = 0b00 ) -var mpegVersionNames = scalar.UToScalar{ +var mpegVersionNames = scalar.UintMap{ mpegVersion1: {Sym: "1", Description: "MPEG Version 1"}, mpegVersion2: {Sym: "2", Description: "MPEG Version 2"}, mpegVersion25: {Sym: "2.5", Description: "MPEG Version 2.5"}, @@ -123,7 +124,7 @@ const ( mpegLayer3 = 0b01 ) -var mpegLayerNames = scalar.UToScalar{ +var mpegLayerNames = scalar.UintMap{ mpegLayer1: {Sym: 1, Description: "MPEG Layer 1"}, mpegLayer2: {Sym: 2, Description: "MPEG Layer 2"}, mpegLayer3: {Sym: 3, Description: "MPEG Layer 3"}, @@ -135,7 +136,7 @@ var mpegLayerN = map[uint64]uint64{ mpegLayer1: 1, } -var protectionNames = scalar.BoolToDescription{ +var protectionNames = scalar.BoolMapDescription{ true: "No CRC", false: "Has CRC", } @@ -158,7 +159,7 @@ func frameDecode(d *decode.D, _ any) any { var lsf bool // low sampling frequencies, 1 granule if true d.FieldStruct("header", func(d *decode.D) { - d.FieldU11("sync", d.AssertU(0b111_1111_1111), scalar.ActualBin) + d.FieldU11("sync", d.UintAssert(0b111_1111_1111), scalar.UintBin) // v = 3 means version 2.5 mpegVersion := d.FieldU2("mpeg_version", mpegVersionNames) @@ -172,6 +173,11 @@ func frameDecode(d *decode.D, _ any) any { lsf = true } mpegLayer := d.FieldU2("layer", mpegLayerNames) + + if mpegLayer > 0 { + mpegLayer = 1 + } + mpegLayerNr = mpegLayerN[mpegLayer] if mpegLayerNr != 3 { d.Errorf("Not layer 3") @@ -185,7 +191,7 @@ func frameDecode(d *decode.D, _ any) any { 3: [...]int{0, 1152, 576, 576}, } sampleCount = samplesFrameIndex[uint(mpegLayerNr)][uint(mpegVersionNr)] - d.FieldValueU("sample_count", uint64(sampleCount)) + d.FieldValueUint("sample_count", uint64(sampleCount)) protection := d.FieldBool("protection_absent", protectionNames) // note false mean has protection hasCRC := !protection @@ -206,8 +212,8 @@ func frameDecode(d *decode.D, _ any) any { 0b1101: [...]int{416, 320, 256, 224, 144, 144, 224, 144, 144}, 0b1110: [...]int{448, 384, 320, 256, 160, 160, 256, 160, 160}, } - d.FieldU4("bitrate", scalar.Fn(func(s scalar.S) (scalar.S, error) { - u := s.ActualU() + d.FieldU("bitrate", 4, scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + u := s.Actual switch u { case 0b0000: s.Description = "free" @@ -231,46 +237,46 @@ func frameDecode(d *decode.D, _ any) any { 0b01: [...]int{48000, 24000, 12000}, 0b10: [...]int{32000, 16000, 8000}, } - d.FieldU2("sample_rate", scalar.Fn(func(s scalar.S) (scalar.S, error) { - u := s.ActualU() - switch u { + d.FieldU2("sample_rate", scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + switch s.Actual { case 0b11: s.Description = "reserved" default: - sampleRate = sampleRateIndex[uint(u)][mpegVersionNr-1] + sampleRate = sampleRateIndex[uint(s.Actual)][mpegVersionNr-1] s.Sym = sampleRate } return s, nil })) - paddingBytes = int(d.FieldU1("padding", scalar.UToSymStr{ + paddingBytes = int(d.FieldU1("padding", scalar.UintMapSymStr{ 0: "not_padded", 1: "padded", - }, scalar.ActualBin)) + }, scalar.UintBin)) d.FieldU1("private") - channelsIndex = d.FieldU2("channels", scalar.UToSymStr{ + channelsIndex = d.FieldU2("channels", scalar.UintMapSymStr{ 0b00: "stereo", 0b01: "joint_stereo", 0b10: "dual", 0b11: "mono", - }, scalar.ActualBin) + }, scalar.UintBin) isStereo = channelsIndex != 0b11 - channelModeIndex = d.FieldU2("channel_mode", scalar.UToSymStr{ + channelModeIndex = d.FieldU2("channel_mode", scalar.UintMapSymStr{ 0b00: "none", 0b01: "intensity stereo", 0b10: "ms_stereo", 0b11: "intensity_stereo_ms_stereo", - }, scalar.ActualBin) + }, scalar.UintBin) d.FieldU1("copyright") d.FieldU1("original") - d.FieldU2("emphasis", scalar.UToSymStr{ + d.FieldU2("emphasis", scalar.UintMapSymStr{ 0b00: "none", 0b01: "50_15", 0b10: "reserved", 0b11: "ccit_j.17", - }, scalar.ActualBin) + }, scalar.UintBin) + if hasCRC { - d.FieldU16("crc", scalar.ActualHex) + d.FieldU16("crc", scalar.UintHex) crcValue = d.FieldGet("crc") crcBytes = 2 } @@ -379,9 +385,10 @@ func frameDecode(d *decode.D, _ any) any { d.CopyBits(crcHash, d.BitBufRange(6*8, int64(sideInfoBytes)*8)) if crcValue != nil { - _ = crcValue.TryScalarFn(d.ValidateUBytes(crcHash.Sum(nil))) + _ = crcValue.TryUintScalarFn(d.UintValidateBytes(crcHash.Sum(nil))) } - d.FieldValueRaw("crc_calculated", crcHash.Sum(nil), scalar.RawHex) + + d.FieldValueBitBuf("crc_calculated", bitio.NewBitReader(crcHash.Sum(nil), -1), scalar.RawHex) return format.MP3FrameOut{ MPEGVersion: int(mpegVersionNr), diff --git a/format/mpeg/mpeg_asc.go b/format/mpeg/mpeg_asc.go index d2bb576e..115d2c5d 100644 --- a/format/mpeg/mpeg_asc.go +++ b/format/mpeg/mpeg_asc.go @@ -17,7 +17,7 @@ func init() { }) } -var frequencyIndexHzMap = scalar.UToSymU{ +var frequencyIndexHzMap = scalar.UintMapSymUint{ 0x0: 96000, 0x1: 88200, 0x2: 64000, @@ -33,7 +33,7 @@ var frequencyIndexHzMap = scalar.UToSymU{ 0xc: 7350, } -var channelConfigurationNames = scalar.UToDescription{ +var channelConfigurationNames = scalar.UintMapDescription{ 0: "defined in AOT Specifc Config", 1: "front-center", 2: "front-left, front-right", @@ -45,8 +45,8 @@ var channelConfigurationNames = scalar.UToDescription{ } func ascDecoder(d *decode.D, _ any) any { - objectType := d.FieldUFn("object_type", decodeEscapeValueCarryFn(5, 6, 0), format.MPEGAudioObjectTypeNames) - d.FieldUFn("sampling_frequency", decodeEscapeValueAbsFn(4, 24, 0), frequencyIndexHzMap) + objectType := d.FieldUintFn("object_type", decodeEscapeValueCarryFn(5, 6, 0), format.MPEGAudioObjectTypeNames) + d.FieldUintFn("sampling_frequency", decodeEscapeValueAbsFn(4, 24, 0), frequencyIndexHzMap) d.FieldU4("channel_configuration", channelConfigurationNames) // TODO: GASpecificConfig etc d.FieldRawLen("var_aot_or_byte_align", d.BitsLeft()) diff --git a/format/mpeg/mpeg_es.go b/format/mpeg/mpeg_es.go index fbfd2145..7ccb44f2 100644 --- a/format/mpeg/mpeg_es.go +++ b/format/mpeg/mpeg_es.go @@ -73,7 +73,7 @@ const ( Forbidden1 = 0xFF ) -var odTagNames = scalar.UToSymStr{ +var odTagNames = scalar.UintMapSymStr{ Forbidden0: "Forbidden", ObjectDescrTag: "ObjectDescrTag", InitialObjectDescrTag: "InitialObjectDescrTag", @@ -136,7 +136,7 @@ const ( IPMPToolStream = 0x0B ) -var streamTypeNames = scalar.UToSymStr{ +var streamTypeNames = scalar.UintMapSymStr{ Forbidden: "Forbidden", ObjectDescriptorStream: "ObjectDescriptorStream", ClockReferenceStream: "ClockReferenceStream", @@ -220,7 +220,7 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D)) // Xiph-style lacing (similar to ogg) of n-1 packets, last is reset of block d.FieldArray("laces", func(d *decode.D) { for i := uint64(0); i < numPackets; i++ { - l := d.FieldUFn("lace", func(d *decode.D) uint64 { + l := d.FieldUintFn("lace", func(d *decode.D) uint64 { var l uint64 for { n := d.U8() @@ -266,7 +266,7 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D)) // TODO: expectedTagID tagID := d.FieldU8("tag_id", odTagNames) - tagLen := d.FieldUFn("length", esLengthEncoding) + tagLen := d.FieldUintFn("length", esLengthEncoding) if fn != nil { d.FramedFn(int64(tagLen)*8, fn) diff --git a/format/mpeg/mpeg_pes_packet.go b/format/mpeg/mpeg_pes_packet.go index cee963b7..26c030e8 100644 --- a/format/mpeg/mpeg_pes_packet.go +++ b/format/mpeg/mpeg_pes_packet.go @@ -30,41 +30,41 @@ type subStreamPacket struct { buf []byte } -var startAndStreamNames = scalar.URangeToScalar{ - {Range: [2]uint64{0x00, 0x00}, S: scalar.S{Sym: "picture"}}, - {Range: [2]uint64{0x01, 0xaf}, S: scalar.S{Sym: "slice"}}, - {Range: [2]uint64{0xb0, 0xb1}, S: scalar.S{Sym: "reserved"}}, - {Range: [2]uint64{0xb2, 0xb2}, S: scalar.S{Sym: "user_data"}}, - {Range: [2]uint64{0xb3, 0xb3}, S: scalar.S{Sym: "sequence_header"}}, - {Range: [2]uint64{0xb4, 0xb4}, S: scalar.S{Sym: "sequence_error"}}, - {Range: [2]uint64{0xb5, 0xb5}, S: scalar.S{Sym: "extension"}}, - {Range: [2]uint64{0xb6, 0xb6}, S: scalar.S{Sym: "reserved"}}, - {Range: [2]uint64{0xb7, 0xb7}, S: scalar.S{Sym: "sequence_end"}}, - {Range: [2]uint64{0xb8, 0xb8}, S: scalar.S{Sym: "group_of_pictures"}}, - {Range: [2]uint64{0xb9, 0xb9}, S: scalar.S{Sym: "program_end"}}, - {Range: [2]uint64{0xba, 0xba}, S: scalar.S{Sym: "pack_header"}}, - {Range: [2]uint64{0xbb, 0xbb}, S: scalar.S{Sym: "system_header"}}, - {Range: [2]uint64{0xbc, 0xbc}, S: scalar.S{Sym: "program_stream_map"}}, - {Range: [2]uint64{0xbd, 0xbd}, S: scalar.S{Sym: "private_stream1"}}, - {Range: [2]uint64{0xbe, 0xbe}, S: scalar.S{Sym: "padding_stream"}}, - {Range: [2]uint64{0xbf, 0xbf}, S: scalar.S{Sym: "private_stream2"}}, - {Range: [2]uint64{0xc0, 0xdf}, S: scalar.S{Sym: "audio_stream"}}, - {Range: [2]uint64{0xe0, 0xef}, S: scalar.S{Sym: "video_stream"}}, - {Range: [2]uint64{0xf0, 0xf0}, S: scalar.S{Sym: "ecm_stream"}}, - {Range: [2]uint64{0xf1, 0xf1}, S: scalar.S{Sym: "emm_stream"}}, - {Range: [2]uint64{0xf2, 0xf2}, S: scalar.S{Sym: "itu_t_rec_h_222_0"}}, - {Range: [2]uint64{0xf3, 0xf3}, S: scalar.S{Sym: "iso_iec_13522_stream"}}, - {Range: [2]uint64{0xf4, 0xf4}, S: scalar.S{Sym: "itu_t_rec_h_222_1_type_a"}}, - {Range: [2]uint64{0xf5, 0xf5}, S: scalar.S{Sym: "itu_t_rec_h_222_1_type_b"}}, - {Range: [2]uint64{0xf6, 0xf6}, S: scalar.S{Sym: "itu_t_rec_h_222_1_type_c"}}, - {Range: [2]uint64{0xf7, 0xf7}, S: scalar.S{Sym: "itu_t_rec_h_222_1_type_d"}}, - {Range: [2]uint64{0xf8, 0xf8}, S: scalar.S{Sym: "itu_t_rec_h_222_1_type_e"}}, - {Range: [2]uint64{0xf9, 0xf9}, S: scalar.S{Sym: "ancillary_stream"}}, - {Range: [2]uint64{0xfa, 0xfe}, S: scalar.S{Sym: "reserved"}}, - {Range: [2]uint64{0xff, 0xff}, S: scalar.S{Sym: "program_stream_directory"}}, +var startAndStreamNames = scalar.UintRangeToScalar{ + {Range: [2]uint64{0x00, 0x00}, S: scalar.Uint{Sym: "picture"}}, + {Range: [2]uint64{0x01, 0xaf}, S: scalar.Uint{Sym: "slice"}}, + {Range: [2]uint64{0xb0, 0xb1}, S: scalar.Uint{Sym: "reserved"}}, + {Range: [2]uint64{0xb2, 0xb2}, S: scalar.Uint{Sym: "user_data"}}, + {Range: [2]uint64{0xb3, 0xb3}, S: scalar.Uint{Sym: "sequence_header"}}, + {Range: [2]uint64{0xb4, 0xb4}, S: scalar.Uint{Sym: "sequence_error"}}, + {Range: [2]uint64{0xb5, 0xb5}, S: scalar.Uint{Sym: "extension"}}, + {Range: [2]uint64{0xb6, 0xb6}, S: scalar.Uint{Sym: "reserved"}}, + {Range: [2]uint64{0xb7, 0xb7}, S: scalar.Uint{Sym: "sequence_end"}}, + {Range: [2]uint64{0xb8, 0xb8}, S: scalar.Uint{Sym: "group_of_pictures"}}, + {Range: [2]uint64{0xb9, 0xb9}, S: scalar.Uint{Sym: "program_end"}}, + {Range: [2]uint64{0xba, 0xba}, S: scalar.Uint{Sym: "pack_header"}}, + {Range: [2]uint64{0xbb, 0xbb}, S: scalar.Uint{Sym: "system_header"}}, + {Range: [2]uint64{0xbc, 0xbc}, S: scalar.Uint{Sym: "program_stream_map"}}, + {Range: [2]uint64{0xbd, 0xbd}, S: scalar.Uint{Sym: "private_stream1"}}, + {Range: [2]uint64{0xbe, 0xbe}, S: scalar.Uint{Sym: "padding_stream"}}, + {Range: [2]uint64{0xbf, 0xbf}, S: scalar.Uint{Sym: "private_stream2"}}, + {Range: [2]uint64{0xc0, 0xdf}, S: scalar.Uint{Sym: "audio_stream"}}, + {Range: [2]uint64{0xe0, 0xef}, S: scalar.Uint{Sym: "video_stream"}}, + {Range: [2]uint64{0xf0, 0xf0}, S: scalar.Uint{Sym: "ecm_stream"}}, + {Range: [2]uint64{0xf1, 0xf1}, S: scalar.Uint{Sym: "emm_stream"}}, + {Range: [2]uint64{0xf2, 0xf2}, S: scalar.Uint{Sym: "itu_t_rec_h_222_0"}}, + {Range: [2]uint64{0xf3, 0xf3}, S: scalar.Uint{Sym: "iso_iec_13522_stream"}}, + {Range: [2]uint64{0xf4, 0xf4}, S: scalar.Uint{Sym: "itu_t_rec_h_222_1_type_a"}}, + {Range: [2]uint64{0xf5, 0xf5}, S: scalar.Uint{Sym: "itu_t_rec_h_222_1_type_b"}}, + {Range: [2]uint64{0xf6, 0xf6}, S: scalar.Uint{Sym: "itu_t_rec_h_222_1_type_c"}}, + {Range: [2]uint64{0xf7, 0xf7}, S: scalar.Uint{Sym: "itu_t_rec_h_222_1_type_d"}}, + {Range: [2]uint64{0xf8, 0xf8}, S: scalar.Uint{Sym: "itu_t_rec_h_222_1_type_e"}}, + {Range: [2]uint64{0xf9, 0xf9}, S: scalar.Uint{Sym: "ancillary_stream"}}, + {Range: [2]uint64{0xfa, 0xfe}, S: scalar.Uint{Sym: "reserved"}}, + {Range: [2]uint64{0xff, 0xff}, S: scalar.Uint{Sym: "program_stream_directory"}}, } -var mpegVersion = scalar.UToDescription{ +var mpegVersion = scalar.UintMapDescription{ 0b01: "MPEG2", 0b10: "MPEG1", } @@ -72,8 +72,8 @@ var mpegVersion = scalar.UToDescription{ func pesPacketDecode(d *decode.D, _ any) any { var v any - d.FieldU24("prefix", d.AssertU(0b0000_0000_0000_0000_0000_0001), scalar.ActualBin) - startCode := d.FieldU8("start_code", startAndStreamNames, scalar.ActualHex) + d.FieldU24("prefix", d.UintAssert(0b0000_0000_0000_0000_0000_0001), scalar.UintBin) + startCode := d.FieldU8("start_code", startAndStreamNames, scalar.UintHex) switch { case startCode == sequenceHeader: @@ -114,7 +114,7 @@ func pesPacketDecode(d *decode.D, _ any) any { } d.FieldU1("marker_bits4") scr := scr0<<30 | scr1<<15 | scr2 - d.FieldValueU("scr", scr) + d.FieldValueUint("scr", scr) d.FieldU22("mux_rate") d.FieldU1("marker_bits5") if isMPEG2 { diff --git a/format/mpeg/mpeg_spu.go b/format/mpeg/mpeg_spu.go index 3c1a23cc..e33850cd 100644 --- a/format/mpeg/mpeg_spu.go +++ b/format/mpeg/mpeg_spu.go @@ -35,7 +35,7 @@ const ( CHG_COLCON = 0x07 ) -var commandNames = scalar.UToSymStr{ +var commandNames = scalar.UintMapSymStr{ CMD_END: "CMD_END", FSTA_DSP: "FSTA_DSP", STA_DSP: "STA_DSP", diff --git a/format/mpeg/mpeg_ts.go b/format/mpeg/mpeg_ts.go index 53bd49c2..896a42d4 100644 --- a/format/mpeg/mpeg_ts.go +++ b/format/mpeg/mpeg_ts.go @@ -20,7 +20,7 @@ func init() { // TODO: ts_packet func tsDecode(d *decode.D, _ any) any { - d.FieldU8("sync", d.AssertU(0x47), scalar.ActualHex) + d.FieldU8("sync", d.UintAssert(0x47), scalar.UintHex) d.FieldBool("transport_error_indicator") d.FieldBool("payload_unit_start") d.FieldBool("transport_priority") diff --git a/format/msgpack/msgpack.go b/format/msgpack/msgpack.go index 4b47550f..4611bf7b 100644 --- a/format/msgpack/msgpack.go +++ b/format/msgpack/msgpack.go @@ -29,7 +29,7 @@ func init() { type formatEntry struct { r [2]byte - s scalar.S + s scalar.Uint d func(d *decode.D) } @@ -44,8 +44,8 @@ func (fes formatEntries) lookup(u byte) (formatEntry, bool) { return formatEntry{}, false } -func (fes formatEntries) MapScalar(s scalar.S) (scalar.S, error) { - u := s.ActualU() +func (fes formatEntries) MapUint(s scalar.Uint) (scalar.Uint, error) { + u := s.Actual if fe, ok := fes.lookup(byte(u)); ok { s = fe.s s.Actual = u @@ -89,64 +89,64 @@ func decodeMsgPackValue(d *decode.D) { // is defined here as a global map would cause a init dependency cycle formatMap := formatEntries{ - {r: [2]byte{0x00, 0x7f}, s: scalar.S{Sym: "positive_fixint"}, d: func(d *decode.D) { + {r: [2]byte{0x00, 0x7f}, s: scalar.Uint{Sym: "positive_fixint"}, d: func(d *decode.D) { d.SeekRel(-8) d.FieldU8("value") }}, - {r: [2]byte{0x80, 0x8f}, s: scalar.S{Sym: "fixmap"}, d: mapFn(-4, 4)}, - {r: [2]byte{0x90, 0x9f}, s: scalar.S{Sym: "fixarray"}, d: arrayFn(-4, 4)}, - {r: [2]byte{0xa0, 0xbf}, s: scalar.S{Sym: "fixstr"}, d: func(d *decode.D) { + {r: [2]byte{0x80, 0x8f}, s: scalar.Uint{Sym: "fixmap"}, d: mapFn(-4, 4)}, + {r: [2]byte{0x90, 0x9f}, s: scalar.Uint{Sym: "fixarray"}, d: arrayFn(-4, 4)}, + {r: [2]byte{0xa0, 0xbf}, s: scalar.Uint{Sym: "fixstr"}, d: func(d *decode.D) { d.SeekRel(-4) length := d.FieldU4("length") d.FieldUTF8("value", int(length)) }}, - {r: [2]byte{0xc0, 0xc0}, s: scalar.S{Sym: "nil"}, d: func(d *decode.D) { - d.FieldValueNil("value") + {r: [2]byte{0xc0, 0xc0}, s: scalar.Uint{Sym: "nil"}, d: func(d *decode.D) { + d.FieldValueAny("value", nil) }}, - {r: [2]byte{0xc1, 0xc1}, s: scalar.S{Sym: "never_used"}, d: func(d *decode.D) { + {r: [2]byte{0xc1, 0xc1}, s: scalar.Uint{Sym: "never_used"}, d: func(d *decode.D) { d.Fatalf("0xc1 never used") }}, - {r: [2]byte{0xc2, 0xc2}, s: scalar.S{Sym: "false"}, d: func(d *decode.D) { + {r: [2]byte{0xc2, 0xc2}, s: scalar.Uint{Sym: "false"}, d: func(d *decode.D) { d.FieldValueBool("value", false) }}, - {r: [2]byte{0xc3, 0xc3}, s: scalar.S{Sym: "true"}, d: func(d *decode.D) { + {r: [2]byte{0xc3, 0xc3}, s: scalar.Uint{Sym: "true"}, d: func(d *decode.D) { d.FieldValueBool("value", true) }}, - {r: [2]byte{0xc4, 0xc4}, s: scalar.S{Sym: "bin8"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU8("length"))*8) }}, - {r: [2]byte{0xc5, 0xc5}, s: scalar.S{Sym: "bin16"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU16("length"))*8) }}, - {r: [2]byte{0xc6, 0xc6}, s: scalar.S{Sym: "bin32"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU32("length"))*8) }}, - {r: [2]byte{0xc7, 0xc7}, s: scalar.S{Sym: "ext8"}, d: extFn(8)}, - {r: [2]byte{0xc8, 0xc8}, s: scalar.S{Sym: "ext16"}, d: extFn(16)}, - {r: [2]byte{0xc9, 0xc9}, s: scalar.S{Sym: "ext32"}, d: extFn(32)}, - {r: [2]byte{0xca, 0xca}, s: scalar.S{Sym: "float32"}, d: func(d *decode.D) { d.FieldF32("value") }}, - {r: [2]byte{0xcb, 0xcb}, s: scalar.S{Sym: "float64"}, d: func(d *decode.D) { d.FieldF64("value") }}, - {r: [2]byte{0xcc, 0xcc}, s: scalar.S{Sym: "uint8"}, d: func(d *decode.D) { d.FieldU8("value") }}, - {r: [2]byte{0xcd, 0xcd}, s: scalar.S{Sym: "uint16"}, d: func(d *decode.D) { d.FieldU16("value") }}, - {r: [2]byte{0xce, 0xce}, s: scalar.S{Sym: "uint32"}, d: func(d *decode.D) { d.FieldU32("value") }}, - {r: [2]byte{0xcf, 0xcf}, s: scalar.S{Sym: "uint64"}, d: func(d *decode.D) { d.FieldU64("value") }}, - {r: [2]byte{0xd0, 0xd0}, s: scalar.S{Sym: "int8"}, d: func(d *decode.D) { d.FieldS8("value") }}, - {r: [2]byte{0xd1, 0xd1}, s: scalar.S{Sym: "int16"}, d: func(d *decode.D) { d.FieldS16("value") }}, - {r: [2]byte{0xd2, 0xd2}, s: scalar.S{Sym: "int32"}, d: func(d *decode.D) { d.FieldS32("value") }}, - {r: [2]byte{0xd3, 0xd3}, s: scalar.S{Sym: "int64"}, d: func(d *decode.D) { d.FieldS64("value") }}, - {r: [2]byte{0xd4, 0xd4}, s: scalar.S{Sym: "fixext1"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 1*8) }}, - {r: [2]byte{0xd5, 0xd5}, s: scalar.S{Sym: "fixext2"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 2*8) }}, - {r: [2]byte{0xd6, 0xd6}, s: scalar.S{Sym: "fixext4"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 4*8) }}, - {r: [2]byte{0xd7, 0xd7}, s: scalar.S{Sym: "fixext8"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 8*8) }}, - {r: [2]byte{0xd8, 0xd8}, s: scalar.S{Sym: "fixext16"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 16*8) }}, - {r: [2]byte{0xd9, 0xd9}, s: scalar.S{Sym: "str8"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU8("length"))) }}, - {r: [2]byte{0xda, 0xda}, s: scalar.S{Sym: "str16"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU16("length"))) }}, - {r: [2]byte{0xdb, 0xdb}, s: scalar.S{Sym: "str32"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU32("length"))) }}, - {r: [2]byte{0xdc, 0xdc}, s: scalar.S{Sym: "array16"}, d: arrayFn(0, 16)}, - {r: [2]byte{0xdd, 0xdd}, s: scalar.S{Sym: "array32"}, d: arrayFn(0, 32)}, - {r: [2]byte{0xde, 0xde}, s: scalar.S{Sym: "map16"}, d: mapFn(0, 16)}, - {r: [2]byte{0xdf, 0xdf}, s: scalar.S{Sym: "map32"}, d: mapFn(0, 32)}, - {r: [2]byte{0xe0, 0xff}, s: scalar.S{Sym: "negative_fixint"}, d: func(d *decode.D) { + {r: [2]byte{0xc4, 0xc4}, s: scalar.Uint{Sym: "bin8"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU8("length"))*8) }}, + {r: [2]byte{0xc5, 0xc5}, s: scalar.Uint{Sym: "bin16"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU16("length"))*8) }}, + {r: [2]byte{0xc6, 0xc6}, s: scalar.Uint{Sym: "bin32"}, d: func(d *decode.D) { d.FieldRawLen("value", int64(d.FieldU32("length"))*8) }}, + {r: [2]byte{0xc7, 0xc7}, s: scalar.Uint{Sym: "ext8"}, d: extFn(8)}, + {r: [2]byte{0xc8, 0xc8}, s: scalar.Uint{Sym: "ext16"}, d: extFn(16)}, + {r: [2]byte{0xc9, 0xc9}, s: scalar.Uint{Sym: "ext32"}, d: extFn(32)}, + {r: [2]byte{0xca, 0xca}, s: scalar.Uint{Sym: "float32"}, d: func(d *decode.D) { d.FieldF32("value") }}, + {r: [2]byte{0xcb, 0xcb}, s: scalar.Uint{Sym: "float64"}, d: func(d *decode.D) { d.FieldF64("value") }}, + {r: [2]byte{0xcc, 0xcc}, s: scalar.Uint{Sym: "uint8"}, d: func(d *decode.D) { d.FieldU8("value") }}, + {r: [2]byte{0xcd, 0xcd}, s: scalar.Uint{Sym: "uint16"}, d: func(d *decode.D) { d.FieldU16("value") }}, + {r: [2]byte{0xce, 0xce}, s: scalar.Uint{Sym: "uint32"}, d: func(d *decode.D) { d.FieldU32("value") }}, + {r: [2]byte{0xcf, 0xcf}, s: scalar.Uint{Sym: "uint64"}, d: func(d *decode.D) { d.FieldU64("value") }}, + {r: [2]byte{0xd0, 0xd0}, s: scalar.Uint{Sym: "int8"}, d: func(d *decode.D) { d.FieldS8("value") }}, + {r: [2]byte{0xd1, 0xd1}, s: scalar.Uint{Sym: "int16"}, d: func(d *decode.D) { d.FieldS16("value") }}, + {r: [2]byte{0xd2, 0xd2}, s: scalar.Uint{Sym: "int32"}, d: func(d *decode.D) { d.FieldS32("value") }}, + {r: [2]byte{0xd3, 0xd3}, s: scalar.Uint{Sym: "int64"}, d: func(d *decode.D) { d.FieldS64("value") }}, + {r: [2]byte{0xd4, 0xd4}, s: scalar.Uint{Sym: "fixext1"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 1*8) }}, + {r: [2]byte{0xd5, 0xd5}, s: scalar.Uint{Sym: "fixext2"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 2*8) }}, + {r: [2]byte{0xd6, 0xd6}, s: scalar.Uint{Sym: "fixext4"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 4*8) }}, + {r: [2]byte{0xd7, 0xd7}, s: scalar.Uint{Sym: "fixext8"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 8*8) }}, + {r: [2]byte{0xd8, 0xd8}, s: scalar.Uint{Sym: "fixext16"}, d: func(d *decode.D) { d.FieldS8("fixtype"); d.FieldRawLen("value", 16*8) }}, + {r: [2]byte{0xd9, 0xd9}, s: scalar.Uint{Sym: "str8"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU8("length"))) }}, + {r: [2]byte{0xda, 0xda}, s: scalar.Uint{Sym: "str16"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU16("length"))) }}, + {r: [2]byte{0xdb, 0xdb}, s: scalar.Uint{Sym: "str32"}, d: func(d *decode.D) { d.FieldUTF8("value", int(d.FieldU32("length"))) }}, + {r: [2]byte{0xdc, 0xdc}, s: scalar.Uint{Sym: "array16"}, d: arrayFn(0, 16)}, + {r: [2]byte{0xdd, 0xdd}, s: scalar.Uint{Sym: "array32"}, d: arrayFn(0, 32)}, + {r: [2]byte{0xde, 0xde}, s: scalar.Uint{Sym: "map16"}, d: mapFn(0, 16)}, + {r: [2]byte{0xdf, 0xdf}, s: scalar.Uint{Sym: "map32"}, d: mapFn(0, 32)}, + {r: [2]byte{0xe0, 0xff}, s: scalar.Uint{Sym: "negative_fixint"}, d: func(d *decode.D) { d.SeekRel(-8) d.FieldS8("value") }}, } - typ := d.FieldU8("type", formatMap, scalar.ActualHex) + typ := d.FieldU8("type", formatMap, scalar.UintHex) if fe, ok := formatMap.lookup(byte(typ)); ok { fe.d(d) } else { diff --git a/format/ogg/ogg.go b/format/ogg/ogg.go index 5e5752ff..b26a01a6 100644 --- a/format/ogg/ogg.go +++ b/format/ogg/ogg.go @@ -77,7 +77,7 @@ func decodeOgg(d *decode.D, _ any) any { if !sFound { var packetsD *decode.D streamsD.FieldStruct("stream", func(d *decode.D) { - d.FieldValueU("serial_number", uint64(oggPageOut.StreamSerialNumber)) + d.FieldValueUint("serial_number", uint64(oggPageOut.StreamSerialNumber)) packetsD = d.FieldArrayValue("packets") }) s = &stream{ diff --git a/format/ogg/ogg_page.go b/format/ogg/ogg_page.go index 61048585..9ca5d6c1 100644 --- a/format/ogg/ogg_page.go +++ b/format/ogg/ogg_page.go @@ -25,8 +25,8 @@ func pageDecode(d *decode.D, _ any) any { d.Endian = decode.LittleEndian - d.FieldUTF8("capture_pattern", 4, d.AssertStr("OggS")) - d.FieldU8("version", d.AssertU(0)) + d.FieldUTF8("capture_pattern", 4, d.StrAssert("OggS")) + d.FieldU8("version", d.UintAssert(0)) d.FieldU5("unused_flags") p.IsLastPage = d.FieldBool("last_page") p.IsFirstPage = d.FieldBool("first_page") @@ -34,7 +34,7 @@ func pageDecode(d *decode.D, _ any) any { d.FieldU64("granule_position") p.StreamSerialNumber = uint32(d.FieldU32("bitstream_serial_number")) p.SequenceNo = uint32(d.FieldU32("page_sequence_no")) - d.FieldU32("crc", scalar.ActualHex) + d.FieldU32("crc", scalar.UintHex) pageSegments := d.FieldU8("page_segments") var segmentTable []uint64 d.FieldArray("segment_table", func(d *decode.D) { @@ -55,7 +55,7 @@ func pageDecode(d *decode.D, _ any) any { d.Copy(pageCRC, bitio.NewIOReader(d.BitBufRange(startPos, pageChecksumValue.Range.Start-startPos))) // header before checksum d.Copy(pageCRC, bytes.NewReader([]byte{0, 0, 0, 0})) // zero checksum bits d.Copy(pageCRC, bitio.NewIOReader(d.BitBufRange(pageChecksumValue.Range.Stop(), endPos-pageChecksumValue.Range.Stop()))) // rest of page - _ = pageChecksumValue.TryScalarFn(d.ValidateUBytes(pageCRC.Sum(nil))) + _ = pageChecksumValue.TryUintScalarFn(d.UintValidateBytes(pageCRC.Sum(nil))) return p } diff --git a/format/opus/opus_packet.go b/format/opus/opus_packet.go index 92aa234e..6c5a25d9 100644 --- a/format/opus/opus_packet.go +++ b/format/opus/opus_packet.go @@ -98,7 +98,7 @@ func opusDecode(d *decode.D, _ any) any { config := configurations[n] d.FieldValueStr("mode", config.mode) d.FieldValueStr("bandwidth", config.bandwidth) - d.FieldValueFloat("frame_size", config.frameSize) + d.FieldValueFlt("frame_size", config.frameSize) }) d.FieldBool("stereo") d.FieldStruct("frames_per_packet", func(d *decode.D) { @@ -113,7 +113,7 @@ func opusDecode(d *decode.D, _ any) any { } n := d.FieldU2("config") config := framesPerPacketConfigs[n] - d.FieldValueU("frames", config.frames) + d.FieldValueUint("frames", config.frames) d.FieldValueStr("mode", config.mode) }) d.FieldRawLen("data", d.BitsLeft()) diff --git a/format/pcap/pcap.go b/format/pcap/pcap.go index f01972d3..e6583ef1 100644 --- a/format/pcap/pcap.go +++ b/format/pcap/pcap.go @@ -31,7 +31,7 @@ const ( littleEndianNS = 0x4d3cb2a1 ) -var endianMap = scalar.UToSymStr{ +var endianMap = scalar.UintMapSymStr{ bigEndian: "big_endian", littleEndian: "little_endian", bigEndianNS: "big_endian_ns", @@ -59,12 +59,12 @@ func decodePcap(d *decode.D, _ any) any { timestampUNSStr := "ts_usec" d.FieldStruct("header", func(d *decode.D) { - magic := d.FieldU32("magic", d.AssertU( + magic := d.FieldU32("magic", d.UintAssert( bigEndian, littleEndian, bigEndianNS, littleEndianNS, - ), endianMap, scalar.ActualHex) + ), endianMap, scalar.UintHex) switch magic { case bigEndian: diff --git a/format/pcap/pcapng.go b/format/pcap/pcapng.go index 646e31fa..a0c7303c 100644 --- a/format/pcap/pcapng.go +++ b/format/pcap/pcapng.go @@ -37,7 +37,7 @@ const ( ngLittleEndian = 0x4d3c2b1a ) -var ngEndianMap = scalar.UToSymStr{ +var ngEndianMap = scalar.UintMapSymStr{ ngBigEndian: "big_endian", ngLittleEndian: "little_endian", } @@ -51,7 +51,7 @@ const ( ) // from https://pcapng.github.io/pcapng/draft-ietf-opsawg-pcapng.html#section_block_code_registry -var blockTypeMap = scalar.UToScalar{ +var blockTypeMap = scalar.UintMap{ blockTypeInterfaceDescription: {Sym: "interface_description", Description: "Interface Description Block"}, 0x00000002: {Description: "Packet Block"}, 0x00000003: {Description: "Simple Packet Block"}, @@ -120,7 +120,7 @@ const ( interfaceStatisticsUsrdeliv = 8 ) -var sectionHeaderOptionsMap = scalar.UToScalar{ +var sectionHeaderOptionsMap = scalar.UintMap{ optionEnd: {Sym: "end", Description: "End of options"}, optionComment: {Sym: "comment", Description: "Comment"}, sectionHeaderOptionHardware: {Sym: "hardware"}, @@ -128,7 +128,7 @@ var sectionHeaderOptionsMap = scalar.UToScalar{ sectionHeaderOptionUserAppl: {Sym: "userappl"}, } -var interfaceDescriptionOptionsMap = scalar.UToScalar{ +var interfaceDescriptionOptionsMap = scalar.UintMap{ optionEnd: {Sym: "end", Description: "End of options"}, optionComment: {Sym: "comment", Description: "Comment"}, interfaceDescriptionName: {Sym: "name"}, @@ -145,7 +145,7 @@ var interfaceDescriptionOptionsMap = scalar.UToScalar{ interfaceDescriptionTsoffset: {Sym: "tsoffset"}, } -var enhancedPacketOptionsMap = scalar.UToScalar{ +var enhancedPacketOptionsMap = scalar.UintMap{ optionEnd: {Sym: "end", Description: "End of options"}, optionComment: {Sym: "comment", Description: "Comment"}, enhancedPacketFlags: {Sym: "flags"}, @@ -153,7 +153,7 @@ var enhancedPacketOptionsMap = scalar.UToScalar{ enhancedPacketDropcount: {Sym: "dropcount"}, } -var nameResolutionOptionsMap = scalar.UToScalar{ +var nameResolutionOptionsMap = scalar.UintMap{ optionEnd: {Sym: "end", Description: "End of options"}, optionComment: {Sym: "comment", Description: "Comment"}, nameResolutionDNSName: {Sym: "dnsname"}, @@ -161,7 +161,7 @@ var nameResolutionOptionsMap = scalar.UToScalar{ nameResolutionDNSIP6addr: {Sym: "dnsip6addr"}, } -var interfaceStatisticsOptionsMap = scalar.UToScalar{ +var interfaceStatisticsOptionsMap = scalar.UintMap{ optionEnd: {Sym: "end", Description: "End of options"}, optionComment: {Sym: "comment", Description: "Comment"}, interfaceStatisticsStarttime: {Sym: "starttime"}, @@ -179,13 +179,13 @@ const ( nameResolutionRecordIpv6 = 0x0002 ) -var nameResolutionRecordMap = scalar.UToSymStr{ +var nameResolutionRecordMap = scalar.UintMapSymStr{ nameResolutionRecordEnd: "end", nameResolutionRecordIpv4: "ipv4", nameResolutionRecordIpv6: "ipv6", } -func decoodeOptions(d *decode.D, opts scalar.UToScalar) { +func decoodeOptions(d *decode.D, opts scalar.UintMap) { if d.BitsLeft() < 32 { return } @@ -205,9 +205,9 @@ func decoodeOptions(d *decode.D, opts scalar.UToScalar) { } // TODO: share -var mapUToIPv4Sym = scalar.Fn(func(s scalar.S) (scalar.S, error) { +var mapUToIPv4Sym = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { var b [4]byte - binary.BigEndian.PutUint32(b[:], uint32(s.ActualU())) + binary.BigEndian.PutUint32(b[:], uint32(s.Actual)) s.Sym = net.IP(b[:]).String() return s, nil }) @@ -266,7 +266,7 @@ var blockFns = map[uint64]func(d *decode.D, dc *decodeContext){ d.FramedFn(int64(length)*8, func(d *decode.D) { switch typ { case nameResolutionRecordIpv4: - d.FieldU32BE("address", mapUToIPv4Sym, scalar.ActualHex) + d.FieldU32BE("address", mapUToIPv4Sym, scalar.UintHex) d.FieldArray("entries", func(d *decode.D) { for !d.End() { d.FieldUTF8Null("string") @@ -292,7 +292,7 @@ var blockFns = map[uint64]func(d *decode.D, dc *decodeContext){ } func decodeBlock(d *decode.D, dc *decodeContext) { - typ := d.FieldU32("type", blockTypeMap, scalar.ActualHex) + typ := d.FieldU32("type", blockTypeMap, scalar.UintHex) length := d.FieldU32("length") - 8 const footerLengthSize = 32 blockLen := int64(length)*8 - footerLengthSize @@ -317,10 +317,10 @@ func decodeSection(d *decode.D, dc *decodeContext) { // treat header block differently as it has endian info d.FieldStruct("block", func(d *decode.D) { - d.FieldU32("type", d.AssertU(blockTypeSectionHeader), blockTypeMap, scalar.ActualHex) + d.FieldU32("type", d.UintAssert(blockTypeSectionHeader), blockTypeMap, scalar.UintHex) d.SeekRel(32) - endian := d.FieldU32("byte_order_magic", ngEndianMap, scalar.ActualHex) + endian := d.FieldU32("byte_order_magic", ngEndianMap, scalar.UintHex) // peeks length and byte-order magic and marks away length switch endian { case ngBigEndian: diff --git a/format/pcap/shared.go b/format/pcap/shared.go index d14f6232..578bb3bf 100644 --- a/format/pcap/shared.go +++ b/format/pcap/shared.go @@ -35,10 +35,10 @@ func fieldFlows(d *decode.D, fd *flowsdecoder.Decoder, tcpStreamFormat decode.Gr d.FieldStruct("tcp_connection", func(d *decode.D) { f := func(d *decode.D, td *flowsdecoder.TCPDirection, tsi format.TCPStreamIn) { d.FieldValueStr("ip", td.Endpoint.IP.String()) - d.FieldValueU("port", uint64(td.Endpoint.Port), format.TCPPortMap) + d.FieldValueUint("port", uint64(td.Endpoint.Port), format.TCPPortMap) d.FieldValueBool("has_start", td.HasStart) d.FieldValueBool("has_end", td.HasEnd) - d.FieldValueU("skipped_bytes", td.SkippedBytes) + d.FieldValueUint("skipped_bytes", td.SkippedBytes) br := bitio.NewBitReader(td.Buffer.Bytes(), -1) if dv, _, _ := d.TryFieldFormatBitBuf( diff --git a/format/png/png.go b/format/png/png.go index 28e7928e..dfa18259 100644 --- a/format/png/png.go +++ b/format/png/png.go @@ -35,7 +35,7 @@ const ( compressionDeflate = 0 ) -var compressionNames = scalar.UToSymStr{ +var compressionNames = scalar.UintMapSymStr{ compressionDeflate: "deflate", } @@ -45,7 +45,7 @@ const ( disposeOpPrevious = 2 ) -var disposeOpNames = scalar.UToSymStr{ +var disposeOpNames = scalar.UintMapSymStr{ disposeOpNone: "none", disposeOpBackground: "background", disposeOpPrevious: "previous", @@ -56,7 +56,7 @@ const ( blendOpBackground = 1 ) -var blendOpNames = scalar.UToSymStr{ +var blendOpNames = scalar.UintMapSymStr{ blendOpNone: "source", blendOpBackground: "over", } @@ -69,7 +69,7 @@ const ( colorTypeRGBA = 6 ) -var colorTypeMap = scalar.UToSymStr{ +var colorTypeMap = scalar.UintMapSymStr{ colorTypeGrayscale: "grayscale", colorTypeRGB: "rgb", colorTypePalette: "palette", @@ -106,10 +106,10 @@ func pngDecode(d *decode.D, _ any) any { d.FieldU8("bit_depth") colorType = d.FieldU8("color_type", colorTypeMap) d.FieldU8("compression_method", compressionNames) - d.FieldU8("filter_method", scalar.UToSymStr{ + d.FieldU8("filter_method", scalar.UintMapSymStr{ 0: "adaptive_filtering", }) - d.FieldU8("interlace_method", scalar.UToSymStr{ + d.FieldU8("interlace_method", scalar.UintMapSymStr{ 0: "none", 1: "adam7", }) @@ -167,14 +167,14 @@ func pngDecode(d *decode.D, _ any) any { d.FieldU32("value") case "cHRM": df := func(d *decode.D) float64 { return float64(d.U32()) / 1000.0 } - d.FieldFFn("white_point_x", df) - d.FieldFFn("white_point_y", df) - d.FieldFFn("red_x", df) - d.FieldFFn("red_y", df) - d.FieldFFn("green_x", df) - d.FieldFFn("green_y", df) - d.FieldFFn("blue_x", df) - d.FieldFFn("blue_y", df) + d.FieldFltFn("white_point_x", df) + d.FieldFltFn("white_point_y", df) + d.FieldFltFn("red_x", df) + d.FieldFltFn("red_y", df) + d.FieldFltFn("green_x", df) + d.FieldFltFn("green_y", df) + d.FieldFltFn("blue_x", df) + d.FieldFltFn("blue_y", df) case "eXIf": d.FieldFormatLen("exif", d.BitsLeft(), exifFormat, nil) case "acTL": @@ -229,7 +229,7 @@ func pngDecode(d *decode.D, _ any) any { chunkCRC := crc32.NewIEEE() d.Copy(chunkCRC, bitio.NewIOReader(d.BitBufRange(crcStartPos, d.Pos()-crcStartPos))) - d.FieldU32("crc", d.ValidateUBytes(chunkCRC.Sum(nil)), scalar.ActualHex) + d.FieldU32("crc", d.UintValidateBytes(chunkCRC.Sum(nil)), scalar.UintHex) }) return nil diff --git a/format/prores/prores_frame.go b/format/prores/prores_frame.go index d1ea3000..096e413d 100644 --- a/format/prores/prores_frame.go +++ b/format/prores/prores_frame.go @@ -21,7 +21,7 @@ func decodeProResFrame(d *decode.D, _ any) any { var size int64 d.FieldStruct("container", func(d *decode.D) { size = int64(d.FieldU32("size")) - d.FieldUTF8("type", 4, d.AssertStr("icpf")) + d.FieldUTF8("type", 4, d.StrAssert("icpf")) }) d.FramedFn((size-8)*8, func(d *decode.D) { d.FieldStruct("header", func(d *decode.D) { @@ -31,12 +31,12 @@ func decodeProResFrame(d *decode.D, _ any) any { d.FieldU16("width") d.FieldU16("height") d.FieldStruct("frame_flags", func(d *decode.D) { - d.FieldU2("chrominance_factor", scalar.UToSymStr{ + d.FieldU2("chrominance_factor", scalar.UintMapSymStr{ 2: "422", 3: "444", }) d.FieldU2("unused0") - d.FieldU2("frame_type", scalar.UToSymStr{ + d.FieldU2("frame_type", scalar.UintMapSymStr{ 0: "progressive", 1: "interlaced_top_first", 2: "interlaced_bottom_first", diff --git a/format/protobuf/protobuf.go b/format/protobuf/protobuf.go index 183a01af..541f3a94 100644 --- a/format/protobuf/protobuf.go +++ b/format/protobuf/protobuf.go @@ -7,6 +7,7 @@ import ( "github.com/wader/fq/format" "github.com/wader/fq/internal/mathex" + "github.com/wader/fq/pkg/bitio" "github.com/wader/fq/pkg/decode" "github.com/wader/fq/pkg/interp" "github.com/wader/fq/pkg/scalar" @@ -31,7 +32,7 @@ const ( wireType32Bit = 5 ) -var wireTypeNames = scalar.UToSymStr{ +var wireTypeNames = scalar.UintMapSymStr{ 0: "varint", 1: "64bit", 2: "length_delimited", @@ -43,8 +44,8 @@ func protobufDecodeField(d *decode.D, pbm *format.ProtoBufMessage) { keyN := d.FieldULEB128("key_n") fieldNumber := keyN >> 3 wireType := keyN & 0x7 - d.FieldValueU("field_number", fieldNumber) - d.FieldValueU("wire_type", wireType, scalar.Sym(wireTypeNames[wireType])) + d.FieldValueUint("field_number", fieldNumber) + d.FieldValueUint("wire_type", wireType, scalar.UintSym(wireTypeNames[wireType])) var value uint64 var length uint64 @@ -70,19 +71,19 @@ func protobufDecodeField(d *decode.D, pbm *format.ProtoBufMessage) { switch pbf.Type { case format.ProtoBufTypeInt32, format.ProtoBufTypeInt64: v := mathex.ZigZag[uint64, int64](value) - d.FieldValueS("value", v) + d.FieldValueSint("value", v) if len(pbf.Enums) > 0 { d.FieldValueStr("enum", pbf.Enums[uint64(v)]) } case format.ProtoBufTypeUInt32, format.ProtoBufTypeUInt64: - d.FieldValueU("value", value) + d.FieldValueUint("value", value) if len(pbf.Enums) > 0 { d.FieldValueStr("enum", pbf.Enums[value]) } case format.ProtoBufTypeSInt32, format.ProtoBufTypeSInt64: // TODO: correct? 32 different? v := mathex.TwosComplement(64, value) - d.FieldValueS("value", v) + d.FieldValueSint("value", v) if len(pbf.Enums) > 0 { d.FieldValueStr("enum", pbf.Enums[uint64(v)]) } @@ -99,7 +100,7 @@ func protobufDecodeField(d *decode.D, pbm *format.ProtoBufMessage) { case format.ProtoBufTypeString: d.FieldValueStr("value", string(d.BytesRange(valueStart, int(length)))) case format.ProtoBufTypeBytes: - d.FieldValueRaw("value", d.BytesRange(valueStart, int(length))) + d.FieldValueBitBuf("value", bitio.NewBitReader(d.BytesRange(valueStart, int(length)), -1)) case format.ProtoBufTypeMessage: // TODO: test d.FramedFn(int64(length)*8, func(d *decode.D) { diff --git a/format/protobuf/protobuf_widevine.go b/format/protobuf/protobuf_widevine.go index 968fd20f..73fbb223 100644 --- a/format/protobuf/protobuf_widevine.go +++ b/format/protobuf/protobuf_widevine.go @@ -24,7 +24,7 @@ func init() { func widevineDecode(d *decode.D, _ any) any { widewinePb := format.ProtoBufMessage{ - 1: {Type: format.ProtoBufTypeEnum, Name: "algorithm", Enums: scalar.UToSymStr{ + 1: {Type: format.ProtoBufTypeEnum, Name: "algorithm", Enums: scalar.UintMapSymStr{ 0: "unencrypted", 1: "aesctr", }}, @@ -34,7 +34,7 @@ func widevineDecode(d *decode.D, _ any) any { 6: {Type: format.ProtoBufTypeString, Name: "policy"}, 7: {Type: format.ProtoBufTypeUInt32, Name: "crypto_period_index"}, 8: {Type: format.ProtoBufTypeBytes, Name: "grouped_license"}, - 9: {Type: format.ProtoBufTypeUInt32, Name: "protection_scheme", Enums: scalar.UToSymStr{ + 9: {Type: format.ProtoBufTypeUInt32, Name: "protection_scheme", Enums: scalar.UintMapSymStr{ 1667591779: "cenc", 1667392305: "cbc1", 1667591795: "cens", diff --git a/format/riff/avi.go b/format/riff/avi.go index a6a26ce4..262ebd92 100644 --- a/format/riff/avi.go +++ b/format/riff/avi.go @@ -54,14 +54,14 @@ func init() { interp.RegisterFS(aviFS) } -var aviListTypeDescriptions = scalar.StrToDescription{ +var aviListTypeDescriptions = scalar.StrMapDescription{ "hdrl": "AVI main list", "strl": "Stream list", "movi": "Stream Data", "rec ": "Chunk group", } -var aviStrhTypeDescriptions = scalar.StrToDescription{ +var aviStrhTypeDescriptions = scalar.StrMapDescription{ "auds": "Audio stream", "mids": "MIDI stream", "txts": "Text stream", @@ -73,7 +73,7 @@ const ( aviIndexTypeChunks = 1 ) -var aviIndexTypeNames = scalar.UToSymStr{ +var aviIndexTypeNames = scalar.UintMapSymStr{ aviIndexTypeIndexes: "indexes", aviIndexTypeChunks: "chunks", } @@ -82,7 +82,7 @@ const ( aviIndexSubType2Fields = 1 ) -var aviIndexSubTypeNames = scalar.UToSymStr{ +var aviIndexSubTypeNames = scalar.UintMapSymStr{ aviIndexSubType2Fields: "2fields", } @@ -94,7 +94,7 @@ const ( aviStreamChunkTypeIndex = "ix" ) -var aviStreamChunkTypeDescriptions = scalar.StrToDescription{ +var aviStreamChunkTypeDescriptions = scalar.StrMapDescription{ aviStreamChunkTypeUncompressedVideo: "Uncompressed video frame", aviStreamChunkTypeCompressedVideo: "Compressed video frame", aviStreamChunkTypePaletteChange: "Palette change", @@ -176,7 +176,7 @@ func aviDecorateStreamID(d *decode.D, id string) (string, int) { typ, index, ok := aviParseChunkID(id) if ok && aviIsStreamType(typ) { d.FieldValueStr("stream_type", typ, aviStreamChunkTypeDescriptions) - d.FieldValueU("stream_nr", uint64(index)) + d.FieldValueUint("stream_nr", uint64(index)) return typ, index } return "", 0 @@ -200,7 +200,7 @@ func aviDecodeChunkIndex(d *decode.D) []ranges.Range { offset := int64(d.FieldU32("offset")) sizeKeyFrame := d.FieldU32("size_keyframe") size := sizeKeyFrame & 0x7f_ff_ff_ff - d.FieldValueU("size", size) + d.FieldValueUint("size", size) d.FieldValueBool("key_frame", sizeKeyFrame&0x80_00_00_00 == 0) rs = append(rs, ranges.Range{ Start: baseOffset*8 + offset*8, @@ -235,7 +235,7 @@ func aviDecode(d *decode.D, in any) any { func(d *decode.D, id string, path path) (bool, any) { switch id { case "RIFF": - riffType = d.FieldUTF8("type", 4, d.AssertStr(aviRiffType)) + riffType = d.FieldUTF8("type", 4, d.StrAssert(aviRiffType)) return true, nil case "LIST": diff --git a/format/riff/common.go b/format/riff/common.go index d7933985..f15a821d 100644 --- a/format/riff/common.go +++ b/format/riff/common.go @@ -43,7 +43,7 @@ func riffDecode(d *decode.D, path path, headFn func(d *decode.D, path path) (str } // TODO: sym name? -var chunkIDDescriptions = scalar.StrToDescription{ +var chunkIDDescriptions = scalar.StrMapDescription{ "LIST": "Chunk list", "JUNK": "Alignment", diff --git a/format/riff/wav.go b/format/riff/wav.go index c5947738..58255fa2 100644 --- a/format/riff/wav.go +++ b/format/riff/wav.go @@ -42,9 +42,9 @@ var ( const wavRiffType = "WAVE" -var subFormatNames = scalar.BytesToScalar{ - {Bytes: subFormatPCMBytes[:], Scalar: scalar.S{Sym: "pcm"}}, - {Bytes: subFormatIEEEFloat[:], Scalar: scalar.S{Sym: "ieee_float"}}, +var subFormatNames = scalar.RawBytesMap{ + {Bytes: subFormatPCMBytes[:], Scalar: scalar.BitBuf{Sym: "pcm"}}, + {Bytes: subFormatIEEEFloat[:], Scalar: scalar.BitBuf{Sym: "ieee_float"}}, } func wavDecode(d *decode.D, _ any) any { @@ -61,13 +61,13 @@ func wavDecode(d *decode.D, _ any) any { id := d.FieldUTF8("id", 4, chunkIDDescriptions) const restOfFileLen = 0xffffffff - size := int64(d.FieldUScalarFn("size", func(d *decode.D) scalar.S { + size := int64(d.FieldScalarUintFn("size", func(d *decode.D) scalar.Uint { l := d.U32() if l == restOfFileLen { - return scalar.S{Actual: l, ActualDisplay: scalar.NumberHex, Description: "Rest of file"} + return scalar.Uint{Actual: l, DisplayFormat: scalar.NumberHex, Description: "Rest of file"} } - return scalar.S{Actual: l, ActualDisplay: scalar.NumberDecimal} - })) + return scalar.Uint{Actual: l, DisplayFormat: scalar.NumberDecimal} + }).Actual) if size == restOfFileLen { size = d.BitsLeft() / 8 @@ -78,7 +78,7 @@ func wavDecode(d *decode.D, _ any) any { func(d *decode.D, id string, path path) (bool, any) { switch id { case "RIFF": - riffType = d.FieldUTF8("format", 4, d.AssertStr(wavRiffType)) + riffType = d.FieldUTF8("format", 4, d.StrAssert(wavRiffType)) return true, nil case "LIST": @@ -128,7 +128,7 @@ func wavDecode(d *decode.D, _ any) any { for i := 0; i < numSampleLoops; i++ { d.FieldStruct("sample_loop", func(d *decode.D) { d.FieldUTF8("id", 4) - d.FieldU32("type", scalar.UToSymStr{ + d.FieldU32("type", scalar.UintMapSymStr{ 0: "forward", 1: "forward_backward", 2: "backward", diff --git a/format/rtmp/amf0.go b/format/rtmp/amf0.go index 896b3baf..b5b1b358 100644 --- a/format/rtmp/amf0.go +++ b/format/rtmp/amf0.go @@ -37,7 +37,7 @@ const ( typeTypedObject = 0x10 ) -var typeNames = scalar.UToSymStr{ +var typeNames = scalar.UintMapSymStr{ typeNumber: "number", typeBoolean: "boolean", typeString: "string", @@ -83,9 +83,9 @@ func amf0DecodeValue(d *decode.D) { } }) case typeNull: - d.FieldValueNil("value") + d.FieldValueAny("value", nil) case typeUndefined: - d.FieldValueNil("value") // TODO: ? + d.FieldValueAny("value", nil) // TODO: ? case typeReference: d.FieldU16("value") // TODO: index pointer case typeECMAArray: diff --git a/format/rtmp/rtmp.go b/format/rtmp/rtmp.go index cc6c44d9..927826b9 100644 --- a/format/rtmp/rtmp.go +++ b/format/rtmp/rtmp.go @@ -65,7 +65,7 @@ const ( messageTypePresent = 23 // TODO: not in spec but in wikipedia article ) -var rtmpMessageTypeIDNames = scalar.UToSymStr{ +var rtmpMessageTypeIDNames = scalar.UintMapSymStr{ messageTypeSetChunkSize: "set_chunk_size", messageTypeAbortMessage: "abort_message", messageTypeAcknowledgment: "acknowledgment", @@ -96,7 +96,7 @@ const ( userControlEvenTypePingResponse = 7 ) -var userControlEvenTypNames = scalar.UToSymStr{ +var userControlEvenTypNames = scalar.UintMapSymStr{ userControlEvenTypeStreamBegin: "stream_begin", userControlEvenTypeStreamEOF: "stream_eof", userControlEvenTypeStreamDry: "stream_dry", @@ -106,7 +106,7 @@ var userControlEvenTypNames = scalar.UToSymStr{ userControlEvenTypePingResponse: "ping_response", } -var setPeerBandwidthLimitTypeName = scalar.UToSymStr{ +var setPeerBandwidthLimitTypeName = scalar.UintMapSymStr{ 0: "hard", 1: "soft", 2: "dynamic", @@ -114,7 +114,7 @@ var setPeerBandwidthLimitTypeName = scalar.UToSymStr{ const timestampExtended = 0xff_ff_ff -var timestampDescription = scalar.UToDescription{ +var timestampUintDescription = scalar.UintMapDescription{ timestampExtended: "extended", } @@ -124,7 +124,7 @@ const ( // based on https://github.com/wireshark/wireshark/blob/master/epan/dissectors/packet-rtmpt.c // which in turn is based on rtmp and swf specifications and FLV v10.1 section E.4.3.1 -var audioMessageCodecNames = scalar.UToSymStr{ +var audioMessageCodecNames = scalar.UintMapSymStr{ 0: "uncompressed", 1: "adpcm", 2: "mp3", @@ -144,29 +144,29 @@ const ( audioMessageAACPacketTypeRaw = 1 ) -var audioMessageAACPacketTypeNames = scalar.UToSymStr{ +var audioMessageAACPacketTypeNames = scalar.UintMapSymStr{ audioMessageAACPacketTypeASC: "asc", audioMessageAACPacketTypeRaw: "raw", } -var audioMessageRateNames = scalar.UToSymU{ +var audioMessageRateNames = scalar.UintMapSymUint{ 0: 5500, 1: 11025, 2: 22050, 3: 44100, } -var audioMessageSampleSize = scalar.UToSymU{ +var audioMessageSampleSize = scalar.UintMapSymUint{ 0: 8, 1: 16, } -var audioMessageChannels = scalar.UToSymU{ +var audioMessageChannels = scalar.UintMapSymUint{ 0: 1, 1: 2, } -var videoMessageTypeNames = scalar.UToSymStr{ +var videoMessageTypeNames = scalar.UintMapSymStr{ 1: "keyframe", 2: "inter_frame", 3: "disposable_inter_frame", @@ -178,7 +178,7 @@ const ( videoMessageCodecH264 = 7 ) -var videoMessageCodecNames = scalar.UToSymStr{ +var videoMessageCodecNames = scalar.UintMapSymStr{ 2: "h263", 3: "screen_video", 4: "vp6", @@ -187,7 +187,7 @@ var videoMessageCodecNames = scalar.UToSymStr{ videoMessageCodecH264: "h264", } -var videoMessageH264PacketTypeNames = scalar.UToSymStr{ +var videoMessageH264PacketTypeNames = scalar.UintMapSymStr{ 0: "dcr", 1: "au", // TODO: is access unit? 2: "empty", @@ -261,7 +261,7 @@ func rtmpDecodeMessageType(d *decode.D, typ int, chunkSize *int) { var h messageHeader h.messageTypeID = d.FieldU8("message_type_id", rtmpMessageTypeIDNames) h.messageLength = d.FieldU24("message_length") - h.timestamp = d.FieldU32("timestamp", timestampDescription) + h.timestamp = d.FieldU32("timestamp", timestampUintDescription) h.messageStreamID = d.FieldU24("message_stream_id") // TODO: possible to set chunk size in aggregated message? d.FramedFn(int64(h.messageLength*8), func(d *decode.D) { @@ -370,11 +370,11 @@ func rtmpDecode(d *decode.D, in any) any { case 0: // 64-319: 2 byte d.FieldU6("chunk_stream_id_prefix") - chunkSteamID = d.FieldU8("chunk_stream_id", scalar.ActualUAdd(64)) + chunkSteamID = d.FieldU8("chunk_stream_id", scalar.UintActualAdd(64)) case 1: // 64-65599: 3 byte d.FieldU6("chunk_stream_id_prefix") - chunkSteamID = d.FieldU16("chunk_stream_id", scalar.ActualUAdd(64)) + chunkSteamID = d.FieldU16("chunk_stream_id", scalar.UintActualAdd(64)) default: // 2-63: 1 byte chunkSteamID = d.FieldU6("chunk_stream_id") @@ -392,7 +392,7 @@ func rtmpDecode(d *decode.D, in any) any { switch fmt { case 0: - h.timestamp = d.FieldU24("timestamp", timestampDescription) + h.timestamp = d.FieldU24("timestamp", timestampUintDescription) h.messageLength = d.FieldU24("message_length") h.messageTypeID = d.FieldU8("message_type_id", rtmpMessageTypeIDNames) h.messageStreamID = d.FieldU32LE("message_stream_id") @@ -400,7 +400,7 @@ func rtmpDecode(d *decode.D, in any) any { h.timestamp = d.FieldU32("extended_timestamp") } case 1: - h.timestampDelta = d.FieldU24("timestamp_delta", timestampDescription) + h.timestampDelta = d.FieldU24("timestamp_delta", timestampUintDescription) h.messageLength = d.FieldU24("message_length") h.messageTypeID = d.FieldU8("message_type_id", rtmpMessageTypeIDNames) if h.timestamp == timestampExtended { @@ -408,10 +408,10 @@ func rtmpDecode(d *decode.D, in any) any { } h.timestamp = cs.prevHeader.timestamp h.messageStreamID = cs.prevHeader.messageStreamID - d.FieldValueU("message_stream_id", h.messageStreamID, scalar.Description("previous")) + d.FieldValueUint("message_stream_id", h.messageStreamID, scalar.UintDescription("previous")) case 2: - h.timestampDelta = d.FieldU24("timestamp_delta", timestampDescription) + h.timestampDelta = d.FieldU24("timestamp_delta", timestampUintDescription) if h.timestamp == timestampExtended { h.timestampDelta = d.FieldU32("extended_timestamp") } @@ -419,23 +419,23 @@ func rtmpDecode(d *decode.D, in any) any { h.messageLength = cs.prevHeader.messageLength h.messageStreamID = cs.prevHeader.messageStreamID h.messageTypeID = cs.prevHeader.messageTypeID - d.FieldValueU("message_length", h.messageLength, scalar.Description("previous")) - d.FieldValueU("message_type_id", h.messageTypeID, scalar.Description("previous")) - d.FieldValueU("message_stream_id", h.messageStreamID, scalar.Description("previous")) + d.FieldValueUint("message_length", h.messageLength, scalar.UintDescription("previous")) + d.FieldValueUint("message_type_id", h.messageTypeID, scalar.UintDescription("previous")) + d.FieldValueUint("message_stream_id", h.messageStreamID, scalar.UintDescription("previous")) case 3: h.timestamp = cs.prevHeader.timestamp h.timestampDelta = cs.prevHeader.timestampDelta h.messageLength = cs.prevHeader.messageLength h.messageStreamID = cs.prevHeader.messageStreamID h.messageTypeID = cs.prevHeader.messageTypeID - d.FieldValueU("message_length", h.messageLength, scalar.Description("previous")) - d.FieldValueU("message_type_id", h.messageTypeID, scalar.Description("previous")) - d.FieldValueU("message_stream_id", h.messageStreamID, scalar.Description("previous")) + d.FieldValueUint("message_length", h.messageLength, scalar.UintDescription("previous")) + d.FieldValueUint("message_type_id", h.messageTypeID, scalar.UintDescription("previous")) + d.FieldValueUint("message_stream_id", h.messageStreamID, scalar.UintDescription("previous")) } h.timestamp += h.timestampDelta - d.FieldValueU("calculated_timestamp", h.timestamp) + d.FieldValueUint("calculated_timestamp", h.timestamp) m, ok := cs.messageSteams[h.messageStreamID] if !ok { @@ -465,8 +465,8 @@ func rtmpDecode(d *decode.D, in any) any { if m.l == uint64(m.b.Len()) { messageBR := bitio.NewBitReader(m.b.Bytes(), -1) messages.FieldStructRootBitBufFn("message", messageBR, func(d *decode.D) { - d.FieldValueU("message_stream_id", h.messageStreamID) - d.FieldValueU("message_type_id", m.typ, rtmpMessageTypeIDNames) + d.FieldValueUint("message_stream_id", h.messageStreamID) + d.FieldValueUint("message_type_id", m.typ, rtmpMessageTypeIDNames) rtmpDecodeMessageType(d, int(m.typ), &chunkSize) }) diff --git a/format/shared.go b/format/shared.go index b07aa1ad..8431522c 100644 --- a/format/shared.go +++ b/format/shared.go @@ -23,7 +23,7 @@ const ( ProtoBufTypeFloat ) -var ProtoBufTypeNames = scalar.UToSymStr{ +var ProtoBufTypeNames = scalar.UintMapSymStr{ ProtoBufTypeInt32: "Int32", ProtoBufTypeInt64: "Int64", ProtoBufTypeUInt32: "UInt32", diff --git a/format/tar/tar.go b/format/tar/tar.go index d248586b..5c7fb73e 100644 --- a/format/tar/tar.go +++ b/format/tar/tar.go @@ -27,11 +27,13 @@ func init() { }) } +var unixTimeEpochDate = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) + func tarDecode(d *decode.D, _ any) any { const blockBytes = 512 const blockBits = blockBytes * 8 - mapTrimSpaceNull := scalar.ActualTrim(" \x00") + mapTrimSpaceNull := scalar.StrActualTrim(" \x00") blockPadding := func(d *decode.D) int64 { return (blockBits - (d.Pos() % blockBits)) % blockBits } @@ -46,28 +48,34 @@ func tarDecode(d *decode.D, _ any) any { for !d.End() { d.FieldStruct("file", func(d *decode.D) { d.FieldUTF8("name", 100, mapTrimSpaceNull) - d.FieldUTF8NullFixedLen("mode", 8, scalar.TrySymUParseUint(8)) - d.FieldUTF8NullFixedLen("uid", 8, scalar.TrySymUParseUint(8)) - d.FieldUTF8NullFixedLen("gid", 8, scalar.TrySymUParseUint(8)) - sizeS := d.FieldScalarUTF8NullFixedLen("size", 12, scalar.TrySymUParseUint(8)) - if sizeS.Sym == nil { + d.FieldUTF8NullFixedLen("mode", 8, scalar.TryStrSymParseUint(8)) + d.FieldUTF8NullFixedLen("uid", 8, scalar.TryStrSymParseUint(8)) + d.FieldUTF8NullFixedLen("gid", 8, scalar.TryStrSymParseUint(8)) + size, sizeOk := d.FieldScalarUTF8NullFixedLen("size", 12, scalar.TryStrSymParseUint(8)).TrySymUint() + if !sizeOk { d.Fatalf("could not decode size") } - size := int64(sizeS.SymU()) * 8 - d.FieldUTF8NullFixedLen("mtime", 12, scalar.TrySymUParseUint(8), scalar.DescriptionUnixTimeFn(scalar.S.TrySymU, time.RFC3339)) - d.FieldUTF8NullFixedLen("chksum", 8, scalar.TrySymUParseUint(8)) + size *= 8 + d.FieldUTF8NullFixedLen("mtime", 12, scalar.TryStrSymParseUint(8), scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { + // TODO: string might not be a number, move to scalar? + if v, ok := s.TrySymUint(); ok { + s.Description = unixTimeEpochDate.Add(time.Duration(v) * time.Second).Format(time.RFC3339) + } + return s, nil + })) + d.FieldUTF8NullFixedLen("chksum", 8, scalar.TryStrSymParseUint(8)) d.FieldUTF8("typeflag", 1, mapTrimSpaceNull) d.FieldUTF8("linkname", 100, mapTrimSpaceNull) - d.FieldUTF8("magic", 6, mapTrimSpaceNull, d.AssertStr("ustar")) - d.FieldUTF8NullFixedLen("version", 2, scalar.TrySymUParseUint(8)) + d.FieldUTF8("magic", 6, mapTrimSpaceNull, d.StrAssert("ustar")) + d.FieldUTF8NullFixedLen("version", 2, scalar.TryStrSymParseUint(8)) d.FieldUTF8("uname", 32, mapTrimSpaceNull) d.FieldUTF8("gname", 32, mapTrimSpaceNull) - d.FieldUTF8NullFixedLen("devmajor", 8, scalar.TrySymUParseUint(8)) - d.FieldUTF8NullFixedLen("devminor", 8, scalar.TrySymUParseUint(8)) + d.FieldUTF8NullFixedLen("devmajor", 8, scalar.TryStrSymParseUint(8)) + d.FieldUTF8NullFixedLen("devminor", 8, scalar.TryStrSymParseUint(8)) d.FieldUTF8("prefix", 155, mapTrimSpaceNull) d.FieldRawLen("header_block_padding", blockPadding(d), d.BitBufIsZero()) - d.FieldFormatOrRawLen("data", size, probeFormat, nil) + d.FieldFormatOrRawLen("data", int64(size), probeFormat, nil) d.FieldRawLen("data_block_padding", blockPadding(d), d.BitBufIsZero()) }) diff --git a/format/tiff/tags.go b/format/tiff/tags.go index 5a239421..9a156f6e 100644 --- a/format/tiff/tags.go +++ b/format/tiff/tags.go @@ -365,7 +365,7 @@ const ( PaletteHistogram = 0x5113 ) -var tiffTagNames = scalar.UToSymStr{ +var tiffTagNames = scalar.UintMapSymStr{ NewSubfileType: "NewSubfileType", SubfileType: "SubfileType", ImageWidth: "ImageWidth", @@ -761,7 +761,7 @@ const ( GPSHPositioningError = 0x001f ) -var gpsInfoTagNames = scalar.UToSymStr{ +var gpsInfoTagNames = scalar.UintMapSymStr{ GPSVersionID: "GPSVersionID", GPSLatitudeRef: "GPSLatitudeRef", GPSLatitude: "GPSLatitude", diff --git a/format/tiff/tiff.go b/format/tiff/tiff.go index 70b7e01f..73d11e23 100644 --- a/format/tiff/tiff.go +++ b/format/tiff/tiff.go @@ -26,7 +26,7 @@ func init() { const littleEndian = 0x49492a00 // "II*\0" const bigEndian = 0x4d4d002a // "MM\0*" -var endianNames = scalar.UToSymStr{ +var endianNames = scalar.UintMapSymStr{ littleEndian: "little-endian", bigEndian: "big-endian", } @@ -42,7 +42,7 @@ const ( SRATIONAL = 10 ) -var typeNames = scalar.UToSymStr{ +var typeNames = scalar.UintMapSymStr{ BYTE: "BYTE", ASCII: "ASCII", SHORT: "SHORT", @@ -71,7 +71,7 @@ func fieldRational(d *decode.D, name string) float64 { numerator := d.FieldU32("numerator") denominator := d.FieldU32("denominator") v := float64(numerator) / float64(denominator) - d.FieldValueFloat("float", v) + d.FieldValueFlt("float", v) }) return v } @@ -82,7 +82,7 @@ func fieldSRational(d *decode.D, name string) float64 { numerator := d.FieldS32("numerator") denominator := d.FieldS32("denominator") v := float64(numerator) / float64(denominator) - d.FieldValueFloat("float", v) + d.FieldValueFlt("float", v) }) return v } @@ -92,7 +92,7 @@ type strips struct { byteCounts []int64 } -func decodeIfd(d *decode.D, s *strips, tagNames scalar.UToSymStr) int64 { +func decodeIfd(d *decode.D, s *strips, tagNames scalar.UintMapSymStr) int64 { var nextIfdOffset int64 d.FieldStruct("ifd", func(d *decode.D) { @@ -100,7 +100,7 @@ func decodeIfd(d *decode.D, s *strips, tagNames scalar.UToSymStr) int64 { d.FieldArray("entries", func(d *decode.D) { for i := uint64(0); i < numberOfFields; i++ { d.FieldStruct("entry", func(d *decode.D) { - tag := d.FieldU16("tag", tagNames, scalar.ActualHex) + tag := d.FieldU16("tag", tagNames, scalar.UintHex) typ := d.FieldU16("type", typeNames) count := d.FieldU32("count") valueOrByteOffset := d.FieldU32("value_offset") @@ -202,7 +202,7 @@ func decodeIfd(d *decode.D, s *strips, tagNames scalar.UToSymStr) int64 { } func tiffDecode(d *decode.D, _ any) any { - endian := d.FieldU32("endian", endianNames, scalar.ActualHex) + endian := d.FieldU32("endian", endianNames, scalar.UintHex) switch endian { case littleEndian: @@ -215,8 +215,8 @@ func tiffDecode(d *decode.D, _ any) any { d.SeekRel(-4 * 8) - d.FieldUTF8("order", 2, d.AssertStr("II", "MM")) - d.FieldU16("integer_42", d.AssertU(42)) + d.FieldUTF8("order", 2, d.StrAssert("II", "MM")) + d.FieldU16("integer_42", d.UintAssert(42)) ifdOffset := int64(d.FieldU32("first_ifd")) s := &strips{} diff --git a/format/toml/toml.go b/format/toml/toml.go index c8e6751d..4d315233 100644 --- a/format/toml/toml.go +++ b/format/toml/toml.go @@ -36,7 +36,7 @@ func decodeTOML(d *decode.D, _ any) any { if _, err := toml.NewDecoder(bitio.NewIOReader(br)).Decode(&r); err != nil { d.Fatalf("%s", err) } - var s scalar.S + var s scalar.Any s.Actual = gojqex.Normalize(r) // TODO: better way to handle that an empty file is valid toml and parsed as an object diff --git a/format/tzif/tzif.go b/format/tzif/tzif.go index 408d16fc..f8b317be 100644 --- a/format/tzif/tzif.go +++ b/format/tzif/tzif.go @@ -2,7 +2,6 @@ package tzif import ( "embed" - "fmt" "time" "github.com/wader/fq/format" @@ -50,7 +49,7 @@ type tzifHeader struct { charcnt uint32 } -var versionToSymMapper = scalar.UToSymStr{ +var versionToSymMapper = scalar.UintMapSymStr{ 0x00: "1", 0x32: "2", 0x33: "3", @@ -60,8 +59,8 @@ func decodeTZifHeader(d *decode.D, name string) tzifHeader { var h tzifHeader d.FieldStruct(name, func(d *decode.D) { - h.magic = uint32(d.FieldU32("magic", scalar.ActualHex, d.AssertU(0x545a6966))) - h.ver = uint8(d.FieldU8("ver", d.AssertU(0x00, 0x32, 0x33), scalar.ActualHex, versionToSymMapper)) + h.magic = uint32(d.FieldU32("magic", scalar.UintHex, d.UintAssert(0x545a6966))) + h.ver = uint8(d.FieldU8("ver", d.UintAssert(0x00, 0x32, 0x33), scalar.UintHex, versionToSymMapper)) d.FieldRawLen("reserved", 15*8) h.isutcnt = uint32(d.FieldU32("isutcnt")) h.isstdcnt = uint32(d.FieldU32("isstdcnt")) @@ -87,13 +86,8 @@ func decodeTZifHeader(d *decode.D, name string) tzifHeader { return h } -var unixTimeToStr = scalar.Fn(func(s scalar.S) (scalar.S, error) { - i, ok := s.Value().(int64) - if !ok { - return s, fmt.Errorf("expected int64 but got %T", s.Value()) - } - - s.Sym = time.Unix(i, 0).UTC().Format(time.RFC3339) +var unixTimeToStr = scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { + s.Sym = time.Unix(s.Actual, 0).UTC().Format(time.RFC3339) return s, nil }) @@ -126,9 +120,9 @@ func decodeTZifDataBlock(d *decode.D, h tzifHeader, decodeAsVer int, name string d.FieldArray("local_time_type_records", func(d *decode.D) { for i := uint32(0); i < h.typecnt; i++ { d.FieldStruct("local_time_type", func(d *decode.D) { - d.FieldS32("utoff", d.AssertSRange(-89999, 93599)) - d.FieldU8("dst", d.AssertU(0, 1)) - d.FieldU8("idx", d.AssertURange(0, uint64(h.charcnt)-1)) + d.FieldS32("utoff", d.SintAssertRange(-89999, 93599)) + d.FieldU8("dst", d.UintAssert(0, 1)) + d.FieldU8("idx", d.UintAssertRange(0, uint64(h.charcnt)-1)) }) } }) @@ -175,13 +169,13 @@ func decodeTZifDataBlock(d *decode.D, h tzifHeader, decodeAsVer int, name string d.FieldArray("standard_wall_indicators", func(d *decode.D) { for i := uint32(0); i < h.isstdcnt; i++ { - d.FieldU8("standard_wall_indicator", d.AssertU(0, 1)) + d.FieldU8("standard_wall_indicator", d.UintAssert(0, 1)) } }) d.FieldArray("ut_local_indicators", func(d *decode.D) { for i := uint32(0); i < h.isutcnt; i++ { - d.FieldU8("ut_local_indicator", d.AssertU(0, 1)) + d.FieldU8("ut_local_indicator", d.UintAssert(0, 1)) } }) }) @@ -189,9 +183,9 @@ func decodeTZifDataBlock(d *decode.D, h tzifHeader, decodeAsVer int, name string func decodeTZifFooter(d *decode.D) { d.FieldStruct("footer", func(d *decode.D) { - d.FieldU8("nl1", d.AssertU(0x0a)) + d.FieldU8("nl1", d.UintAssert(0x0a)) n := d.PeekFindByte(0x0a, d.BitsLeft()/8) d.FieldScalarUTF8("tz_string", int(n)) - d.FieldU8("nl2", d.AssertU(0x0a)) + d.FieldU8("nl2", d.UintAssert(0x0a)) }) } diff --git a/format/vorbis/vorbis_packet.go b/format/vorbis/vorbis_packet.go index 9d5980f5..d2004c77 100644 --- a/format/vorbis/vorbis_packet.go +++ b/format/vorbis/vorbis_packet.go @@ -41,7 +41,7 @@ var packetTypeNames = map[uint]string{ func vorbisDecode(d *decode.D, _ any) any { d.Endian = decode.LittleEndian - packetType := d.FieldUScalarFn("packet_type", func(d *decode.D) scalar.S { + packetType := d.FieldScalarUintFn("packet_type", func(d *decode.D) scalar.Uint { packetTypeName := "unknown" t := d.U8() // 4.2.1. Common header decode @@ -52,18 +52,18 @@ func vorbisDecode(d *decode.D, _ any) any { if n, ok := packetTypeNames[uint(t)]; ok { packetTypeName = n } - return scalar.S{Actual: t, Sym: packetTypeName} + return scalar.Uint{Actual: t, Sym: packetTypeName} }) - switch packetType { + switch packetType.Actual { case packetTypeIdentification, packetTypeSetup, packetTypeComment: - d.FieldUTF8("magic", 6, d.AssertStr("vorbis")) + d.FieldUTF8("magic", 6, d.StrAssert("vorbis")) case packetTypeAudio: default: - d.Fatalf("unknown packet type %d", packetType) + d.Fatalf("unknown packet type %d", packetType.Actual) } - switch packetType { + switch packetType.Actual { case packetTypeAudio: case packetTypeIdentification: // 1 1) [vorbis_version] = read 32 bits as unsigned integer @@ -75,22 +75,22 @@ func vorbisDecode(d *decode.D, _ any) any { // 7 7) [blocksize_0] = 2 exponent (read 4 bits as unsigned integer) // 8 8) [blocksize_1] = 2 exponent (read 4 bits as unsigned integer) // 9 9) [framing_flag] = read one bit - d.FieldU32("vorbis_version", d.ValidateU(0)) + d.FieldU32("vorbis_version", d.UintValidate(0)) d.FieldU8("audio_channels") d.FieldU32("audio_sample_rate") d.FieldU32("bitrate_maximum") d.FieldU32("bitrate_nominal") d.FieldU32("bitrate_minimum") // TODO: code/comment about 2.1.4. coding bits into byte sequences - d.FieldUFn("blocksize_1", func(d *decode.D) uint64 { return 1 << d.U4() }) - d.FieldUFn("blocksize_0", func(d *decode.D) uint64 { return 1 << d.U4() }) + d.FieldUintFn("blocksize_1", func(d *decode.D) uint64 { return 1 << d.U4() }) + d.FieldUintFn("blocksize_0", func(d *decode.D) uint64 { return 1 << d.U4() }) // TODO: warning if blocksize0 > blocksize1 // TODO: warning if not 64-8192 d.FieldRawLen("padding0", 7, d.BitBufIsZero()) - d.FieldU1("framing_flag", d.ValidateU(1)) + d.FieldU1("framing_flag", d.UintValidate(1)) case packetTypeSetup: - d.FieldUFn("vorbis_codebook_count", func(d *decode.D) uint64 { return d.U8() + 1 }) - d.FieldU24("codecooke_sync", d.ValidateU(0x564342), scalar.ActualHex) + d.FieldUintFn("vorbis_codebook_count", func(d *decode.D) uint64 { return d.U8() + 1 }) + d.FieldU24("codecooke_sync", d.UintValidate(0x564342), scalar.UintHex) d.FieldU16("codebook_dimensions") d.FieldU24("codebook_entries") @@ -118,7 +118,7 @@ func vorbisDecode(d *decode.D, _ any) any { // note this uses vorbis bitpacking convention, bits are added LSB first per byte d.FieldRawLen("padding0", 7, d.BitBufIsZero()) - d.FieldU1("frame_bit", d.ValidateU(1)) + d.FieldU1("frame_bit", d.UintValidate(1)) } if d.BitsLeft() > 0 { diff --git a/format/vpx/vp8_frame.go b/format/vpx/vp8_frame.go index a9cc954d..ef381885 100644 --- a/format/vpx/vp8_frame.go +++ b/format/vpx/vp8_frame.go @@ -37,11 +37,11 @@ func vp8Decode(d *decode.D, _ any) any { firstPartSize0 := d.FieldU3("first_part_size0") d.FieldU1("show_frame") version := d.FieldU3("version") - keyFrameV := d.FieldBool("frame_type", scalar.BoolToSymStr{true: "non_key_frame", false: "key_frame"}) + keyFrameV := d.FieldBool("frame_type", scalar.BoolMapSymStr{true: "non_key_frame", false: "key_frame"}) firstPartSize1 := d.FieldU16LE("first_part_size1") firstPartSize := firstPartSize0 | firstPartSize1<<3 - d.FieldValueU("first_part_size", firstPartSize) + d.FieldValueUint("first_part_size", firstPartSize) isKeyFrame = !keyFrameV if v, ok := versions[version]; ok { @@ -51,18 +51,18 @@ func vp8Decode(d *decode.D, _ any) any { }) if isKeyFrame { - d.FieldU24("start_code", d.ValidateU(0x9d012a), scalar.ActualHex) + d.FieldU24("start_code", d.UintValidate(0x9d012a), scalar.UintHex) // width and height are not contiguous bits width0 := d.FieldU8("width0") d.FieldU2("horizontal_scale") width1 := d.FieldU6("width1") - d.FieldValueU("width", width0|width1<<8) + d.FieldValueUint("width", width0|width1<<8) height0 := d.FieldU8("height0") d.FieldU2("vertical_scale") height1 := d.FieldU6("height1") - d.FieldValueU("height", height0|height1<<8) + d.FieldValueUint("height", height0|height1<<8) } d.FieldRawLen("data", d.BitsLeft()) diff --git a/format/vpx/vp9_frame.go b/format/vpx/vp9_frame.go index cb54753d..aa347b62 100644 --- a/format/vpx/vp9_frame.go +++ b/format/vpx/vp9_frame.go @@ -18,7 +18,7 @@ const ( vp9FeatureChromaSubsampling = 4 ) -var vp9FeatureIDNames = scalar.UToSymStr{ +var vp9FeatureIDNames = scalar.UintMapSymStr{ vp9FeatureProfile: "Profile", vp9FeatureLevel: "Level", vp9FeatureBitDepth: "Bit Depth", @@ -37,7 +37,7 @@ const ( CS_RGB = 7 ) -var vp9ColorSpaceNames = scalar.UToSymStr{ +var vp9ColorSpaceNames = scalar.UintMapSymStr{ CS_UNKNOWN: "unknown", CS_BT_601: "bt_601", CS_BT_709: "bt_709", @@ -48,7 +48,7 @@ var vp9ColorSpaceNames = scalar.UToSymStr{ CS_RGB: "rgb", } -var vp9ProfilesMap = scalar.UToDescription{ +var vp9ProfilesMap = scalar.UintMapDescription{ 0: "8 bit/sample, chroma subsampling: 4:2:0", 1: "8 bit, chroma subsampling: 4:2:2, 4:4:0, 4:4:4", 2: "10–12 bit, chroma subsampling: 4:2:0", @@ -79,7 +79,7 @@ func vp9DecodeColorConfig(d *decode.D, profile int) { bitDepth = 10 } } - d.FieldValueU("bit_depth", uint64(bitDepth)) + d.FieldValueUint("bit_depth", uint64(bitDepth)) colorSpace := d.FieldU3("color_space", vp9ColorSpaceNames) _, colorSpaceOk := vp9ColorSpaceNames[colorSpace] if !colorSpaceOk || colorSpace != CS_RGB { @@ -89,22 +89,22 @@ func vp9DecodeColorConfig(d *decode.D, profile int) { d.FieldU1("subsampling_y") d.FieldU1("reserved_zero1") } else { - d.FieldValueU("subsampling_x", 1) - d.FieldValueU("subsampling_y", 1) + d.FieldValueUint("subsampling_x", 1) + d.FieldValueUint("subsampling_y", 1) } } else { - d.FieldValueU("color_range", 1) + d.FieldValueUint("color_range", 1) if profile == 1 || profile == 3 { - d.FieldValueU("subsampling_x", 0) - d.FieldValueU("subsampling_y", 0) + d.FieldValueUint("subsampling_x", 0) + d.FieldValueUint("subsampling_y", 0) d.FieldU1("reserved_zero2") } } } func vp9DecodeFrameSize(d *decode.D) { - d.FieldUFn("frame_width", func(d *decode.D) uint64 { return d.U16() + 1 }) - d.FieldUFn("frame_height", func(d *decode.D) uint64 { return d.U16() + 1 }) + d.FieldUintFn("frame_width", func(d *decode.D) uint64 { return d.U16() + 1 }) + d.FieldUintFn("frame_height", func(d *decode.D) uint64 { return d.U16() + 1 }) } func vp9Decode(d *decode.D, _ any) any { @@ -115,7 +115,7 @@ func vp9Decode(d *decode.D, _ any) any { profileLowBit := d.FieldU1("profile_low_bit") profileHighBit := d.FieldU1("profile_high_bit") profile := int(profileHighBit<<1 + profileLowBit) - d.FieldValueU("profile", uint64(profile), vp9ProfilesMap) + d.FieldValueUint("profile", uint64(profile), vp9ProfilesMap) if profile == 3 { d.FieldU1("reserved_zero0") } @@ -125,7 +125,7 @@ func vp9Decode(d *decode.D, _ any) any { return nil } - frameType := d.FieldBool("frame_type", scalar.BoolToSymStr{true: "non_key_frame", false: "key_frame"}) + frameType := d.FieldBool("frame_type", scalar.BoolMapSymStr{true: "non_key_frame", false: "key_frame"}) d.FieldU1("show_frame") d.FieldU1("error_resilient_mode") diff --git a/format/vpx/vpx.go b/format/vpx/vpx.go index 17cbed45..a946ac34 100644 --- a/format/vpx/vpx.go +++ b/format/vpx/vpx.go @@ -2,7 +2,7 @@ package vpx import "github.com/wader/fq/pkg/scalar" -var vpxLevelNames = scalar.UToSymStr{ +var vpxLevelNames = scalar.UintMapSymStr{ 10: "level_1", 11: "level_1.1", 20: "level_2", @@ -19,7 +19,7 @@ var vpxLevelNames = scalar.UToSymStr{ 62: "level_6.2", } -var vpxChromeSubsamplingNames = scalar.UToSymStr{ +var vpxChromeSubsamplingNames = scalar.UintMapSymStr{ 0: "4:2:0 vertical", 1: "4:2:0 colocated with luma (0,0)", 2: "4:2:2", diff --git a/format/wasm/instructions.go b/format/wasm/instructions.go index 5024d179..8017169e 100644 --- a/format/wasm/instructions.go +++ b/format/wasm/instructions.go @@ -9,7 +9,7 @@ func decodeBlockType(d *decode.D, name string) { b := d.PeekBytes(1)[0] switch b { case 0x40: - d.FieldU8(name, scalar.Sym("ε")) + d.FieldU8(name, scalar.UintSym("ε")) case 0x6f, 0x70, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f: d.FieldU8(name, valtypeToSymMapper) default: @@ -48,8 +48,8 @@ type instructionInfo struct { type instructionMap map[Opcode]instructionInfo -func (m instructionMap) MapScalar(s scalar.S) (scalar.S, error) { - opcode := s.ActualU() +func (m instructionMap) MapUint(s scalar.Uint) (scalar.Uint, error) { + opcode := s.Actual instr, found := m[Opcode(opcode)] if !found { return s, nil @@ -277,15 +277,15 @@ func decodeInstruction(d *decode.D) { } func decodeOpcode(d *decode.D) Opcode { - return Opcode(d.FieldU8("opcode", instrMap, scalar.ActualHex)) + return Opcode(d.FieldU8("opcode", instrMap, scalar.UintHex)) } func decodeElse(d *decode.D) { - d.FieldU8("else", d.AssertU(uint64(0x05)), scalar.ActualHex) + d.FieldU8("else", d.UintAssert(uint64(0x05)), scalar.UintHex) } func decodeEnd(d *decode.D) { - d.FieldU8("end", d.AssertU(uint64(0x0b)), scalar.ActualHex) + d.FieldU8("end", d.UintAssert(uint64(0x0b)), scalar.UintHex) } func decodeBlock(d *decode.D) { @@ -402,11 +402,11 @@ func decodeMemArgWithName(name string) func(d *decode.D) { } func decodeMemorySize(d *decode.D) { - d.FieldU8("reserved", d.AssertU(0x00), scalar.ActualHex) + d.FieldU8("reserved", d.UintAssert(0x00), scalar.UintHex) } func decodeMemoryGrow(d *decode.D) { - d.FieldU8("reserved", d.AssertU(0x00), scalar.ActualHex) + d.FieldU8("reserved", d.UintAssert(0x00), scalar.UintHex) } func decodeI32Const(d *decode.D) { @@ -469,7 +469,7 @@ func decodePrefixedOpcode(d *decode.D) Opcode { func decodeMemoryInit(d *decode.D) { decodeDataIdx(d, "x") - d.FieldU8("reserved", scalar.ActualHex, d.AssertU(0)) + d.FieldU8("reserved", scalar.UintHex, d.UintAssert(0)) } func decodeDataDrop(d *decode.D) { @@ -477,12 +477,12 @@ func decodeDataDrop(d *decode.D) { } func decodeMemoryCopy(d *decode.D) { - d.FieldU8("reserved1", scalar.ActualHex, d.AssertU(0)) - d.FieldU8("reserved2", scalar.ActualHex, d.AssertU(0)) + d.FieldU8("reserved1", scalar.UintHex, d.UintAssert(0)) + d.FieldU8("reserved2", scalar.UintHex, d.UintAssert(0)) } func decodeMemoryFill(d *decode.D) { - d.FieldU8("reserved", scalar.ActualHex, d.AssertU(0)) + d.FieldU8("reserved", scalar.UintHex, d.UintAssert(0)) } func decodeTableInit(d *decode.D) { diff --git a/format/wasm/mappers.go b/format/wasm/mappers.go index 0554756f..299df56b 100644 --- a/format/wasm/mappers.go +++ b/format/wasm/mappers.go @@ -4,7 +4,7 @@ import ( "github.com/wader/fq/pkg/scalar" ) -var sectionIDToSym = scalar.UToSymStr{ +var sectionIDToSym = scalar.UintMapSymStr{ sectionIDCustom: "custom_section", sectionIDType: "type_section", sectionIDImport: "import_section", @@ -35,7 +35,7 @@ var sectionIDToSym = scalar.UToSymStr{ // // reftype ::= 0x70 => funcref // | 0x6F => externref -var valtypeToSymMapper = scalar.UToSymStr{ +var valtypeToSymMapper = scalar.UintMapSymStr{ 0x7f: "i32", 0x7e: "i64", 0x7d: "f32", @@ -51,7 +51,7 @@ var valtypeToSymMapper = scalar.UToSymStr{ // | 0x01 tt:tabletype => table tt // | 0x02 mt:memtype => mem mt // | 0x03 gt:globaltype => global gt -var importdescTagToSym = scalar.UToSymStr{ +var importdescTagToSym = scalar.UintMapSymStr{ 0x00: "func", 0x01: "table", 0x02: "mem", @@ -64,7 +64,7 @@ var importdescTagToSym = scalar.UToSymStr{ // | 0x01 x:tableidx => table x // | 0x02 x:memidx => mem x // | 0x03 x:globalidx => global x -var exportdescTagToSym = scalar.UToSymStr{ +var exportdescTagToSym = scalar.UintMapSymStr{ 0x00: "funcidx", 0x01: "tableidx", 0x02: "memidx", @@ -75,7 +75,7 @@ var exportdescTagToSym = scalar.UToSymStr{ // // reftype ::= 0x70 => funcref // | 0x6F => externref -var reftypeTagToSym = scalar.UToSymStr{ +var reftypeTagToSym = scalar.UintMapSymStr{ 0x70: "funcref", 0x6f: "externref", } @@ -84,7 +84,7 @@ var reftypeTagToSym = scalar.UToSymStr{ // // mut ::= 0x00 => const // | 0x01 => var -var mutToSym = scalar.UToSymStr{ +var mutToSym = scalar.UintMapSymStr{ 0x00: "const", 0x01: "var", } @@ -92,6 +92,6 @@ var mutToSym = scalar.UToSymStr{ // A map to convert elemkind to symbols. // // elemkind ::= 0x00 => funcref -var elemkindTagToSym = scalar.UToSymStr{ +var elemkindTagToSym = scalar.UintMapSymStr{ 0x00: "funcref", } diff --git a/format/wasm/wasm.go b/format/wasm/wasm.go index 18c536c7..c2c39799 100644 --- a/format/wasm/wasm.go +++ b/format/wasm/wasm.go @@ -64,11 +64,11 @@ func decodeVecByte(d *decode.D, name string) { } func fieldU32(d *decode.D, name string) uint64 { - return d.FieldULEB128(name, d.AssertURange(0, math.MaxUint32)) + return d.FieldULEB128(name, d.UintAssertRange(0, math.MaxUint32)) } func fieldI32(d *decode.D, name string) int64 { - return d.FieldSLEB128(name, d.AssertSRange(math.MinInt32, math.MaxInt32)) + return d.FieldSLEB128(name, d.SintAssertRange(math.MinInt32, math.MaxInt32)) } func fieldI64(d *decode.D, name string) int64 { @@ -104,7 +104,7 @@ func decodeRefType(d *decode.D, name string) { // //nolint:unparam func decodeValType(d *decode.D, name string) { - d.FieldU8(name, valtypeToSymMapper, scalar.ActualHex) + d.FieldU8(name, valtypeToSymMapper, scalar.UintHex) } // Decode resulttype. @@ -121,7 +121,7 @@ func decodeResultType(d *decode.D, name string) { // functype ::= 0x60 rt1:resulttype rt2:resulttype => rt1 -> rt2 func decodeFuncType(d *decode.D, name string) { d.FieldStruct(name, func(d *decode.D) { - d.FieldU8("tag", d.AssertU(0x60), scalar.ActualHex) + d.FieldU8("tag", d.UintAssert(0x60), scalar.UintHex) decodeResultType(d, "rt1") decodeResultType(d, "rt2") }) @@ -133,7 +133,7 @@ func decodeFuncType(d *decode.D, name string) { // | 0x01 n:u32 m:u32 => {min: n, max: m} func decodeLimits(d *decode.D, name string) { d.FieldStruct(name, func(d *decode.D) { - tag := d.FieldU8("tag", scalar.ActualHex) + tag := d.FieldU8("tag", scalar.UintHex) switch tag { case 0x00: fieldU32(d, "n") @@ -282,7 +282,7 @@ func decodeImportSegment(d *decode.D, name string) { func decodeImportDesc(d *decode.D, name string) { d.FieldStruct(name, func(d *decode.D) { - tag := d.FieldU8("tag", importdescTagToSym, scalar.ActualHex) + tag := d.FieldU8("tag", importdescTagToSym, scalar.UintHex) switch tag { case 0x00: decodeTypeIdx(d, "x") @@ -367,7 +367,7 @@ func decodeExport(d *decode.D, name string) { func decodeExportDesc(d *decode.D, name string) { d.FieldStruct(name, func(d *decode.D) { - tag := d.FieldU8("tag", exportdescTagToSym, scalar.ActualHex) + tag := d.FieldU8("tag", exportdescTagToSym, scalar.UintHex) switch tag { case 0x00: decodeFuncIdx(d, "x") @@ -459,7 +459,7 @@ func decodeElem(d *decode.D, name string) { } func decodeElemKind(d *decode.D, name string) { - d.FieldU8(name, d.AssertU(0x00), elemkindTagToSym) + d.FieldU8(name, d.UintAssert(0x00), elemkindTagToSym) } // Decode code section. diff --git a/format/webp/webp.go b/format/webp/webp.go index db4caaed..2145246f 100644 --- a/format/webp/webp.go +++ b/format/webp/webp.go @@ -42,9 +42,9 @@ func decodeChunk(d *decode.D, expectedChunkID string, fn func(d *decode.D)) { func webpDecode(d *decode.D, _ any) any { d.Endian = decode.LittleEndian - d.FieldUTF8("riff_id", 4, d.AssertStr("RIFF")) + d.FieldUTF8("riff_id", 4, d.StrAssert("RIFF")) riffLength := d.FieldU32("riff_length") - d.FieldUTF8("webp_id", 4, d.AssertStr("WEBP")) + d.FieldUTF8("webp_id", 4, d.StrAssert("WEBP")) d.FramedFn(int64(riffLength-4)*8, func(d *decode.D) { p := d.PeekBytes(4) diff --git a/format/xml/html.go b/format/xml/html.go index a65658c4..eacf8e88 100644 --- a/format/xml/html.go +++ b/format/xml/html.go @@ -212,7 +212,7 @@ func decodeHTML(d *decode.D, in any) any { if err != nil { d.Fatalf("%s", err) } - var s scalar.S + var s scalar.Any s.Actual = r d.Value.V = &s diff --git a/format/xml/xml.go b/format/xml/xml.go index 8391b7f6..bd040266 100644 --- a/format/xml/xml.go +++ b/format/xml/xml.go @@ -269,7 +269,7 @@ func decodeXML(d *decode.D, in any) any { if err != nil { d.Fatalf("%s", err) } - var s scalar.S + var s scalar.Any s.Actual = r switch s.Actual.(type) { diff --git a/format/yaml/yaml.go b/format/yaml/yaml.go index a32704fd..9d517a5b 100644 --- a/format/yaml/yaml.go +++ b/format/yaml/yaml.go @@ -44,7 +44,7 @@ func decodeYAML(d *decode.D, _ any) any { d.Fatalf("trialing data after top-level value") } - var s scalar.S + var s scalar.Any s.Actual = gojqex.Normalize(r) switch s.Actual.(type) { diff --git a/format/zip/zip.go b/format/zip/zip.go index 9d78adba..15823bdd 100644 --- a/format/zip/zip.go +++ b/format/zip/zip.go @@ -54,7 +54,7 @@ const ( compressionMethodPPMd = 98 ) -var compressionMethodMap = scalar.UToSymStr{ +var compressionMethodMap = scalar.UintMapSymStr{ compressionMethodNone: "none", compressionMethodShrunk: "shrunk", compressionMethodReducedCompressionFactor1: "reduced_compression_factor1", @@ -87,7 +87,7 @@ const ( headerIDZip64ExtendedInformation = 0x001 ) -var headerIDMap = scalar.UToDescription{ +var headerIDMap = scalar.UintMapDescription{ headerIDZip64ExtendedInformation: "ZIP64 extended information extra field", 0x0007: "AV Info", 0x0009: "OS/2 extended attributes", @@ -209,7 +209,7 @@ func zipDecode(d *decode.D, in any) any { d.FramedFn(int64(sizeEOCD-sizeOfFixedFields)*8, func(d *decode.D) { for !d.End() { d.FieldStruct("extra_field", func(d *decode.D) { - d.FieldU16("header_id", headerIDMap, scalar.ActualHex) + d.FieldU16("header_id", headerIDMap, scalar.UintHex) dataSize := d.FieldU32("data_size") d.FieldRawLen("data", int64(dataSize)*8) }) @@ -248,7 +248,7 @@ func zipDecode(d *decode.D, in any) any { d.FieldU16("compression_method", compressionMethodMap) d.FieldStruct("last_modification_date", fieldMSDOSTime) d.FieldStruct("last_modification_time", fieldMSDOSDate) - d.FieldU32("crc32_uncompressed", scalar.ActualHex) + d.FieldU32("crc32_uncompressed", scalar.UintHex) d.FieldU32("compressed_size") d.FieldU32("uncompressed_size") fileNameLength := d.FieldU16("file_name_length") @@ -263,7 +263,7 @@ func zipDecode(d *decode.D, in any) any { d.FramedFn(int64(extraFieldLength)*8, func(d *decode.D) { for !d.End() { d.FieldStruct("extra_field", func(d *decode.D) { - headerID := d.FieldU16("header_id", headerIDMap, scalar.ActualHex) + headerID := d.FieldU16("header_id", headerIDMap, scalar.UintHex) dataSize := d.FieldU16("data_size") d.FramedFn(int64(dataSize)*8, func(d *decode.D) { switch headerID { @@ -324,7 +324,7 @@ func zipDecode(d *decode.D, in any) any { compressionMethod := d.FieldU16("compression_method", compressionMethodMap) d.FieldStruct("last_modification_date", fieldMSDOSTime) d.FieldStruct("last_modification_time", fieldMSDOSDate) - d.FieldU32("crc32_uncompressed", scalar.ActualHex) + d.FieldU32("crc32_uncompressed", scalar.UintHex) compressedSizeBytes := d.FieldU32("compressed_size") d.FieldU32("uncompressed_size") fileNameLength := d.FieldU16("file_name_length") @@ -334,7 +334,7 @@ func zipDecode(d *decode.D, in any) any { d.FramedFn(int64(extraFieldLength)*8, func(d *decode.D) { for !d.End() { d.FieldStruct("extra_field", func(d *decode.D) { - headerID := d.FieldU16("header_id", headerIDMap, scalar.ActualHex) + headerID := d.FieldU16("header_id", headerIDMap, scalar.UintHex) dataSize := d.FieldU16("data_size") d.FramedFn(int64(dataSize)*8, func(d *decode.D) { switch headerID { @@ -397,7 +397,7 @@ func zipDecode(d *decode.D, in any) any { if bytes.Equal(d.PeekBytes(4), dataIndicatorSignature) { d.FieldRawLen("signature", 4*8, d.AssertBitBuf(dataIndicatorSignature)) } - d.FieldU32("crc32_uncompressed", scalar.ActualHex) + d.FieldU32("crc32_uncompressed", scalar.UintHex) d.FieldU32("compressed_size") d.FieldU32("uncompressed_size") }) diff --git a/pkg/decode/decode.go b/pkg/decode/decode.go index 4140a615..e0583d73 100644 --- a/pkg/decode/decode.go +++ b/pkg/decode/decode.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "math/big" "regexp" "github.com/wader/fq/internal/bitioex" @@ -308,7 +307,7 @@ func (d *D) FillGaps(r ranges.Range, namePrefix string) { v := &Value{ Name: fmt.Sprintf("%s%d", namePrefix, i), - V: &scalar.S{ + V: &scalar.BitBuf{ Actual: br, Gap: true, }, @@ -771,7 +770,7 @@ func (d *D) FieldMustGet(name string) *Value { } // FieldArray decode array of fields. Will not be range sorted. -func (d *D) FieldArray(name string, fn func(d *D), sms ...scalar.Mapper) *D { +func (d *D) FieldArray(name string, fn func(d *D)) *D { c := &Compound{IsArray: true} cd := d.fieldDecoder(name, d.bitBuf, c) d.AddChild(cd.Value) @@ -855,41 +854,6 @@ func (d *D) AssertLeastBytesLeft(nBytes int64) { } } -// TODO: rethink -func (d *D) FieldValueU(name string, a uint64, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueS(name string, a int64, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueBigInt(name string, a *big.Int, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueBool(name string, a bool, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueFloat(name string, a float64, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueStr(name string, a string, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: a}, nil }, sms...) -} - -func (d *D) FieldValueNil(name string, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return scalar.S{Actual: nil}, nil }, sms...) -} - -func (d *D) FieldValueRaw(name string, a []byte, sms ...scalar.Mapper) { - d.FieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - return scalar.S{Actual: bitio.NewBitReader(a, -1)}, nil - }, sms...) -} - // FramedFn decode from current position nBits forward. When done position will be nBits forward. func (d *D) FramedFn(nBits int64, fn func(d *D)) int64 { if nBits < 0 { @@ -1097,22 +1061,22 @@ func (d *D) FieldFormatBitBuf(name string, br bitio.ReaderAtSeeker, group Group, // TODO: rethink these -func (d *D) FieldRootBitBuf(name string, br bitio.ReaderAtSeeker, sms ...scalar.Mapper) *Value { +func (d *D) FieldRootBitBuf(name string, br bitio.ReaderAtSeeker, sms ...scalar.BitBufMapper) *Value { brLen, err := bitioex.Len(br) if err != nil { d.IOPanic(err, "br Len") } v := &Value{} - v.V = &scalar.S{Actual: br} + v.V = &scalar.BitBuf{Actual: br} v.Name = name v.RootReader = br v.IsRoot = true v.Range = ranges.Range{Start: d.Pos(), Len: brLen} - if err := v.TryScalarFn(sms...); err != nil { - d.Fatalf("%v", err) - } + // if err := v.TryScalarFn(sms...); err != nil { + // d.Fatalf("%v", err) + // } d.AddChild(v) @@ -1220,39 +1184,6 @@ func (d *D) FieldValue(name string, fn func() *Value) *Value { return v } -// looks a bit weird to force at least one ScalarFn arg -func (d *D) TryFieldScalarFn(name string, sfn scalar.Fn, sms ...scalar.Mapper) (*scalar.S, error) { - v, err := d.TryFieldValue(name, func() (*Value, error) { - s, err := sfn(scalar.S{}) - if err != nil { - return &Value{V: &s}, err - } - for _, sm := range sms { - s, err = sm.MapScalar(s) - if err != nil { - return &Value{V: &s}, err - } - } - return &Value{V: &s}, nil - }) - if err != nil { - return &scalar.S{}, err - } - sr, ok := v.V.(*scalar.S) - if !ok { - panic("not a scalar value") - } - return sr, nil -} - -func (d *D) FieldScalarFn(name string, sfn scalar.Fn, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarFn(name, sfn, sms...) - if err != nil { - d.IOPanic(err, "FieldScalarFn: TryFieldScalarFn") - } - return v -} - func (d *D) RE(reRef **regexp.Regexp, reStr string) []ranges.Range { if *reRef == nil { *reRef = regexp.MustCompile(reStr) @@ -1284,7 +1215,7 @@ func (d *D) RE(reRef **regexp.Regexp, reStr string) []ranges.Range { return rs } -func (d *D) FieldRE(reRef **regexp.Regexp, reStr string, mRef *map[string]string, sms ...scalar.Mapper) { +func (d *D) FieldRE(reRef **regexp.Regexp, reStr string, mRef *map[string]string, sms ...scalar.StrMapper) { if *reRef == nil { *reRef = regexp.MustCompile(reStr) } diff --git a/pkg/decode/decode_gen.go b/pkg/decode/decode_gen.go index c9bd7ce5..0fc8fd88 100644 --- a/pkg/decode/decode_gen.go +++ b/pkg/decode/decode_gen.go @@ -10,360 +10,578 @@ import ( "golang.org/x/text/encoding" ) -// Type BigInt +// Type Any -// TryFieldBigIntScalarFn tries to add a field, calls scalar functions and returns actual value as a BigInt -func (d *D) TryFieldBigIntScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (*big.Int, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +// TryFieldAnyScalarFn tries to add a field, calls scalar functions and returns actual value as a Any +func (d *D) TryFieldAnyScalarFn(name string, fn func(d *D) (scalar.Any, error), sms ...scalar.AnyMapper) (any, error) { + v, err := d.TryFieldScalarAnyFn(name, func(d *D) (scalar.Any, error) { return fn(d) }, sms...) if err != nil { return nil, err } - return v.ActualBigInt(), err + return v.Actual, err } -// FieldBigIntScalarFn adds a field, calls scalar functions and returns actual value as a BigInt -func (d *D) FieldBigIntScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) *big.Int { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +// FieldAnyScalarFn adds a field, calls scalar functions and returns actual value as a Any +func (d *D) FieldAnyScalarFn(name string, fn func(d *D) scalar.Any, sms ...scalar.AnyMapper) any { + v, err := d.TryFieldScalarAnyFn(name, func(d *D) (scalar.Any, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "BigInt", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Any", Pos: d.Pos()}) } - return v.ActualBigInt() + return v.Actual } -// FieldBigIntFn adds a field, calls *big.Int decode function and returns actual value as a BigInt -func (d *D) FieldBigIntFn(name string, fn func(d *D) *big.Int, sms ...scalar.Mapper) *big.Int { - return d.FieldBigIntScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +// FieldAnyFn adds a field, calls any decode function and returns actual value as a Any +func (d *D) FieldAnyFn(name string, fn func(d *D) any, sms ...scalar.AnyMapper) any { + return d.FieldAnyScalarFn(name, func(d *D) scalar.Any { return scalar.Any{Actual: fn(d)} }, sms...) } -// TryFieldBigIntFn tries to add a field, calls *big.Int decode function and returns actual value as a BigInt -func (d *D) TryFieldBigIntFn(name string, fn func(d *D) (*big.Int, error), sms ...scalar.Mapper) (*big.Int, error) { - return d.TryFieldBigIntScalarFn(name, func(d *D) (scalar.S, error) { +// TryFieldAnyFn tries to add a field, calls any decode function and returns actual value as a Any +func (d *D) TryFieldAnyFn(name string, fn func(d *D) (any, error), sms ...scalar.AnyMapper) (any, error) { + return d.TryFieldAnyScalarFn(name, func(d *D) (scalar.Any, error) { v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Any{Actual: v}, err }, sms...) } -// TryFieldScalarBigIntFn tries to add a field, calls *big.Int decode function and returns scalar -func (d *D) TryFieldScalarBigIntFn(name string, fn func(d *D) (*big.Int, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { +// FieldScalarAnyFn tries to add a field, calls any decode function and returns scalar +func (d *D) FieldScalarAnyFn(name string, fn func(d *D) scalar.Any, sms ...scalar.AnyMapper) *scalar.Any { + v, err := d.TryFieldScalarAnyFn(name, func(d *D) (scalar.Any, error) { return fn(d), nil }, sms...) + if err != nil { + panic(IOError{Err: err, Name: name, Op: "Any", Pos: d.Pos()}) + } + return v +} + +func (d *D) FieldValueAny(name string, a any, sms ...scalar.AnyMapper) { + d.FieldScalarAnyFn(name, func(_ *D) scalar.Any { return scalar.Any{Actual: a} }, sms...) +} + +// TryFieldScalarAnyFn tries to add a field, calls any decode function and returns scalar +func (d *D) TryFieldScalarAnyFn(name string, fn func(d *D) (scalar.Any, error), sms ...scalar.AnyMapper) (*scalar.Any, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapAny(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Any{}, err + } + sr, ok := v.V.(*scalar.Any) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + +// Type BigInt + +// TryFieldBigIntScalarFn tries to add a field, calls scalar functions and returns actual value as a BigInt +func (d *D) TryFieldBigIntScalarFn(name string, fn func(d *D) (scalar.BigInt, error), sms ...scalar.BigIntMapper) (*big.Int, error) { + v, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { return fn(d) }, sms...) + if err != nil { + return nil, err + } + return v.Actual, err +} + +// FieldBigIntScalarFn adds a field, calls scalar functions and returns actual value as a BigInt +func (d *D) FieldBigIntScalarFn(name string, fn func(d *D) scalar.BigInt, sms ...scalar.BigIntMapper) *big.Int { + v, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { return fn(d), nil }, sms...) + if err != nil { + panic(IOError{Err: err, Name: name, Op: "BigInt", Pos: d.Pos()}) + } + return v.Actual +} + +// FieldBigIntFn adds a field, calls *big.Int decode function and returns actual value as a BigInt +func (d *D) FieldBigIntFn(name string, fn func(d *D) *big.Int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldBigIntScalarFn(name, func(d *D) scalar.BigInt { return scalar.BigInt{Actual: fn(d)} }, sms...) +} + +// TryFieldBigIntFn tries to add a field, calls *big.Int decode function and returns actual value as a BigInt +func (d *D) TryFieldBigIntFn(name string, fn func(d *D) (*big.Int, error), sms ...scalar.BigIntMapper) (*big.Int, error) { + return d.TryFieldBigIntScalarFn(name, func(d *D) (scalar.BigInt, error) { v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.BigInt{Actual: v}, err }, sms...) } // FieldScalarBigIntFn tries to add a field, calls *big.Int decode function and returns scalar -func (d *D) FieldScalarBigIntFn(name string, fn func(d *D) *big.Int, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarBigIntFn(name, func(d *D) (*big.Int, error) { return fn(d), nil }, sms...) +func (d *D) FieldScalarBigIntFn(name string, fn func(d *D) scalar.BigInt, sms ...scalar.BigIntMapper) *scalar.BigInt { + v, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "BigInt", Pos: d.Pos()}) } return v } +func (d *D) FieldValueBigInt(name string, a *big.Int, sms ...scalar.BigIntMapper) { + d.FieldScalarBigIntFn(name, func(_ *D) scalar.BigInt { return scalar.BigInt{Actual: a} }, sms...) +} + +// TryFieldScalarBigIntFn tries to add a field, calls *big.Int decode function and returns scalar +func (d *D) TryFieldScalarBigIntFn(name string, fn func(d *D) (scalar.BigInt, error), sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapBigInt(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.BigInt{}, err + } + sr, ok := v.V.(*scalar.BigInt) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + // Type BitBuf // TryFieldBitBufScalarFn tries to add a field, calls scalar functions and returns actual value as a BitBuf -func (d *D) TryFieldBitBufScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (bitio.ReaderAtSeeker, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +func (d *D) TryFieldBitBufScalarFn(name string, fn func(d *D) (scalar.BitBuf, error), sms ...scalar.BitBufMapper) (bitio.ReaderAtSeeker, error) { + v, err := d.TryFieldScalarBitBufFn(name, func(d *D) (scalar.BitBuf, error) { return fn(d) }, sms...) if err != nil { return nil, err } - return v.ActualBitBuf(), err + return v.Actual, err } // FieldBitBufScalarFn adds a field, calls scalar functions and returns actual value as a BitBuf -func (d *D) FieldBitBufScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) bitio.ReaderAtSeeker { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +func (d *D) FieldBitBufScalarFn(name string, fn func(d *D) scalar.BitBuf, sms ...scalar.BitBufMapper) bitio.ReaderAtSeeker { + v, err := d.TryFieldScalarBitBufFn(name, func(d *D) (scalar.BitBuf, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "BitBuf", Pos: d.Pos()}) } - return v.ActualBitBuf() + return v.Actual } // FieldBitBufFn adds a field, calls bitio.ReaderAtSeeker decode function and returns actual value as a BitBuf -func (d *D) FieldBitBufFn(name string, fn func(d *D) bitio.ReaderAtSeeker, sms ...scalar.Mapper) bitio.ReaderAtSeeker { - return d.FieldBitBufScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +func (d *D) FieldBitBufFn(name string, fn func(d *D) bitio.ReaderAtSeeker, sms ...scalar.BitBufMapper) bitio.ReaderAtSeeker { + return d.FieldBitBufScalarFn(name, func(d *D) scalar.BitBuf { return scalar.BitBuf{Actual: fn(d)} }, sms...) } // TryFieldBitBufFn tries to add a field, calls bitio.ReaderAtSeeker decode function and returns actual value as a BitBuf -func (d *D) TryFieldBitBufFn(name string, fn func(d *D) (bitio.ReaderAtSeeker, error), sms ...scalar.Mapper) (bitio.ReaderAtSeeker, error) { - return d.TryFieldBitBufScalarFn(name, func(d *D) (scalar.S, error) { +func (d *D) TryFieldBitBufFn(name string, fn func(d *D) (bitio.ReaderAtSeeker, error), sms ...scalar.BitBufMapper) (bitio.ReaderAtSeeker, error) { + return d.TryFieldBitBufScalarFn(name, func(d *D) (scalar.BitBuf, error) { v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// TryFieldScalarBitBufFn tries to add a field, calls bitio.ReaderAtSeeker decode function and returns scalar -func (d *D) TryFieldScalarBitBufFn(name string, fn func(d *D) (bitio.ReaderAtSeeker, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.BitBuf{Actual: v}, err }, sms...) } // FieldScalarBitBufFn tries to add a field, calls bitio.ReaderAtSeeker decode function and returns scalar -func (d *D) FieldScalarBitBufFn(name string, fn func(d *D) bitio.ReaderAtSeeker, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarBitBufFn(name, func(d *D) (bitio.ReaderAtSeeker, error) { return fn(d), nil }, sms...) +func (d *D) FieldScalarBitBufFn(name string, fn func(d *D) scalar.BitBuf, sms ...scalar.BitBufMapper) *scalar.BitBuf { + v, err := d.TryFieldScalarBitBufFn(name, func(d *D) (scalar.BitBuf, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "BitBuf", Pos: d.Pos()}) } return v } +func (d *D) FieldValueBitBuf(name string, a bitio.ReaderAtSeeker, sms ...scalar.BitBufMapper) { + d.FieldScalarBitBufFn(name, func(_ *D) scalar.BitBuf { return scalar.BitBuf{Actual: a} }, sms...) +} + +// TryFieldScalarBitBufFn tries to add a field, calls bitio.ReaderAtSeeker decode function and returns scalar +func (d *D) TryFieldScalarBitBufFn(name string, fn func(d *D) (scalar.BitBuf, error), sms ...scalar.BitBufMapper) (*scalar.BitBuf, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapBitBuf(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.BitBuf{}, err + } + sr, ok := v.V.(*scalar.BitBuf) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + // Type Bool // TryFieldBoolScalarFn tries to add a field, calls scalar functions and returns actual value as a Bool -func (d *D) TryFieldBoolScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (bool, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +func (d *D) TryFieldBoolScalarFn(name string, fn func(d *D) (scalar.Bool, error), sms ...scalar.BoolMapper) (bool, error) { + v, err := d.TryFieldScalarBoolFn(name, func(d *D) (scalar.Bool, error) { return fn(d) }, sms...) if err != nil { return false, err } - return v.ActualBool(), err + return v.Actual, err } // FieldBoolScalarFn adds a field, calls scalar functions and returns actual value as a Bool -func (d *D) FieldBoolScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) bool { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +func (d *D) FieldBoolScalarFn(name string, fn func(d *D) scalar.Bool, sms ...scalar.BoolMapper) bool { + v, err := d.TryFieldScalarBoolFn(name, func(d *D) (scalar.Bool, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Bool", Pos: d.Pos()}) } - return v.ActualBool() + return v.Actual } // FieldBoolFn adds a field, calls bool decode function and returns actual value as a Bool -func (d *D) FieldBoolFn(name string, fn func(d *D) bool, sms ...scalar.Mapper) bool { - return d.FieldBoolScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +func (d *D) FieldBoolFn(name string, fn func(d *D) bool, sms ...scalar.BoolMapper) bool { + return d.FieldBoolScalarFn(name, func(d *D) scalar.Bool { return scalar.Bool{Actual: fn(d)} }, sms...) } // TryFieldBoolFn tries to add a field, calls bool decode function and returns actual value as a Bool -func (d *D) TryFieldBoolFn(name string, fn func(d *D) (bool, error), sms ...scalar.Mapper) (bool, error) { - return d.TryFieldBoolScalarFn(name, func(d *D) (scalar.S, error) { +func (d *D) TryFieldBoolFn(name string, fn func(d *D) (bool, error), sms ...scalar.BoolMapper) (bool, error) { + return d.TryFieldBoolScalarFn(name, func(d *D) (scalar.Bool, error) { v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// TryFieldScalarBoolFn tries to add a field, calls bool decode function and returns scalar -func (d *D) TryFieldScalarBoolFn(name string, fn func(d *D) (bool, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Bool{Actual: v}, err }, sms...) } // FieldScalarBoolFn tries to add a field, calls bool decode function and returns scalar -func (d *D) FieldScalarBoolFn(name string, fn func(d *D) bool, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarBoolFn(name, func(d *D) (bool, error) { return fn(d), nil }, sms...) +func (d *D) FieldScalarBoolFn(name string, fn func(d *D) scalar.Bool, sms ...scalar.BoolMapper) *scalar.Bool { + v, err := d.TryFieldScalarBoolFn(name, func(d *D) (scalar.Bool, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Bool", Pos: d.Pos()}) } return v } -// Type F +func (d *D) FieldValueBool(name string, a bool, sms ...scalar.BoolMapper) { + d.FieldScalarBoolFn(name, func(_ *D) scalar.Bool { return scalar.Bool{Actual: a} }, sms...) +} -// TryFieldFScalarFn tries to add a field, calls scalar functions and returns actual value as a F -func (d *D) TryFieldFScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (float64, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +// TryFieldScalarBoolFn tries to add a field, calls bool decode function and returns scalar +func (d *D) TryFieldScalarBoolFn(name string, fn func(d *D) (scalar.Bool, error), sms ...scalar.BoolMapper) (*scalar.Bool, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapBool(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Bool{}, err + } + sr, ok := v.V.(*scalar.Bool) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + +// Type Flt + +// TryFieldFltScalarFn tries to add a field, calls scalar functions and returns actual value as a Flt +func (d *D) TryFieldFltScalarFn(name string, fn func(d *D) (scalar.Flt, error), sms ...scalar.FltMapper) (float64, error) { + v, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { return fn(d) }, sms...) if err != nil { return 0, err } - return v.ActualF(), err + return v.Actual, err } -// FieldFScalarFn adds a field, calls scalar functions and returns actual value as a F -func (d *D) FieldFScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) float64 { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +// FieldFltScalarFn adds a field, calls scalar functions and returns actual value as a Flt +func (d *D) FieldFltScalarFn(name string, fn func(d *D) scalar.Flt, sms ...scalar.FltMapper) float64 { + v, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "F", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Flt", Pos: d.Pos()}) } - return v.ActualF() + return v.Actual } -// FieldFFn adds a field, calls float64 decode function and returns actual value as a F -func (d *D) FieldFFn(name string, fn func(d *D) float64, sms ...scalar.Mapper) float64 { - return d.FieldFScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +// FieldFltFn adds a field, calls float64 decode function and returns actual value as a Flt +func (d *D) FieldFltFn(name string, fn func(d *D) float64, sms ...scalar.FltMapper) float64 { + return d.FieldFltScalarFn(name, func(d *D) scalar.Flt { return scalar.Flt{Actual: fn(d)} }, sms...) } -// TryFieldFFn tries to add a field, calls float64 decode function and returns actual value as a F -func (d *D) TryFieldFFn(name string, fn func(d *D) (float64, error), sms ...scalar.Mapper) (float64, error) { - return d.TryFieldFScalarFn(name, func(d *D) (scalar.S, error) { +// TryFieldFltFn tries to add a field, calls float64 decode function and returns actual value as a Flt +func (d *D) TryFieldFltFn(name string, fn func(d *D) (float64, error), sms ...scalar.FltMapper) (float64, error) { + return d.TryFieldFltScalarFn(name, func(d *D) (scalar.Flt, error) { v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Flt{Actual: v}, err }, sms...) } -// TryFieldScalarFFn tries to add a field, calls float64 decode function and returns scalar -func (d *D) TryFieldScalarFFn(name string, fn func(d *D) (float64, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// FieldScalarFFn tries to add a field, calls float64 decode function and returns scalar -func (d *D) FieldScalarFFn(name string, fn func(d *D) float64, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarFFn(name, func(d *D) (float64, error) { return fn(d), nil }, sms...) +// FieldScalarFltFn tries to add a field, calls float64 decode function and returns scalar +func (d *D) FieldScalarFltFn(name string, fn func(d *D) scalar.Flt, sms ...scalar.FltMapper) *scalar.Flt { + v, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "F", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Flt", Pos: d.Pos()}) } return v } -// Type S +func (d *D) FieldValueFlt(name string, a float64, sms ...scalar.FltMapper) { + d.FieldScalarFltFn(name, func(_ *D) scalar.Flt { return scalar.Flt{Actual: a} }, sms...) +} -// TryFieldSScalarFn tries to add a field, calls scalar functions and returns actual value as a S -func (d *D) TryFieldSScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (int64, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +// TryFieldScalarFltFn tries to add a field, calls float64 decode function and returns scalar +func (d *D) TryFieldScalarFltFn(name string, fn func(d *D) (scalar.Flt, error), sms ...scalar.FltMapper) (*scalar.Flt, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapFlt(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Flt{}, err + } + sr, ok := v.V.(*scalar.Flt) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + +// Type Sint + +// TryFieldSintScalarFn tries to add a field, calls scalar functions and returns actual value as a Sint +func (d *D) TryFieldSintScalarFn(name string, fn func(d *D) (scalar.Sint, error), sms ...scalar.SintMapper) (int64, error) { + v, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { return fn(d) }, sms...) if err != nil { return 0, err } - return v.ActualS(), err + return v.Actual, err } -// FieldSScalarFn adds a field, calls scalar functions and returns actual value as a S -func (d *D) FieldSScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) int64 { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +// FieldSintScalarFn adds a field, calls scalar functions and returns actual value as a Sint +func (d *D) FieldSintScalarFn(name string, fn func(d *D) scalar.Sint, sms ...scalar.SintMapper) int64 { + v, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "S", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Sint", Pos: d.Pos()}) } - return v.ActualS() + return v.Actual } -// FieldSFn adds a field, calls int64 decode function and returns actual value as a S -func (d *D) FieldSFn(name string, fn func(d *D) int64, sms ...scalar.Mapper) int64 { - return d.FieldSScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +// FieldSintFn adds a field, calls int64 decode function and returns actual value as a Sint +func (d *D) FieldSintFn(name string, fn func(d *D) int64, sms ...scalar.SintMapper) int64 { + return d.FieldSintScalarFn(name, func(d *D) scalar.Sint { return scalar.Sint{Actual: fn(d)} }, sms...) } -// TryFieldSFn tries to add a field, calls int64 decode function and returns actual value as a S -func (d *D) TryFieldSFn(name string, fn func(d *D) (int64, error), sms ...scalar.Mapper) (int64, error) { - return d.TryFieldSScalarFn(name, func(d *D) (scalar.S, error) { +// TryFieldSintFn tries to add a field, calls int64 decode function and returns actual value as a Sint +func (d *D) TryFieldSintFn(name string, fn func(d *D) (int64, error), sms ...scalar.SintMapper) (int64, error) { + return d.TryFieldSintScalarFn(name, func(d *D) (scalar.Sint, error) { v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Sint{Actual: v}, err }, sms...) } -// TryFieldScalarSFn tries to add a field, calls int64 decode function and returns scalar -func (d *D) TryFieldScalarSFn(name string, fn func(d *D) (int64, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// FieldScalarSFn tries to add a field, calls int64 decode function and returns scalar -func (d *D) FieldScalarSFn(name string, fn func(d *D) int64, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarSFn(name, func(d *D) (int64, error) { return fn(d), nil }, sms...) +// FieldScalarSintFn tries to add a field, calls int64 decode function and returns scalar +func (d *D) FieldScalarSintFn(name string, fn func(d *D) scalar.Sint, sms ...scalar.SintMapper) *scalar.Sint { + v, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "S", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Sint", Pos: d.Pos()}) } return v } +func (d *D) FieldValueSint(name string, a int64, sms ...scalar.SintMapper) { + d.FieldScalarSintFn(name, func(_ *D) scalar.Sint { return scalar.Sint{Actual: a} }, sms...) +} + +// TryFieldScalarSintFn tries to add a field, calls int64 decode function and returns scalar +func (d *D) TryFieldScalarSintFn(name string, fn func(d *D) (scalar.Sint, error), sms ...scalar.SintMapper) (*scalar.Sint, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapSint(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Sint{}, err + } + sr, ok := v.V.(*scalar.Sint) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + // Type Str // TryFieldStrScalarFn tries to add a field, calls scalar functions and returns actual value as a Str -func (d *D) TryFieldStrScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (string, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +func (d *D) TryFieldStrScalarFn(name string, fn func(d *D) (scalar.Str, error), sms ...scalar.StrMapper) (string, error) { + v, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { return fn(d) }, sms...) if err != nil { return "", err } - return v.ActualStr(), err + return v.Actual, err } // FieldStrScalarFn adds a field, calls scalar functions and returns actual value as a Str -func (d *D) FieldStrScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) string { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +func (d *D) FieldStrScalarFn(name string, fn func(d *D) scalar.Str, sms ...scalar.StrMapper) string { + v, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Str", Pos: d.Pos()}) } - return v.ActualStr() + return v.Actual } // FieldStrFn adds a field, calls string decode function and returns actual value as a Str -func (d *D) FieldStrFn(name string, fn func(d *D) string, sms ...scalar.Mapper) string { - return d.FieldStrScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +func (d *D) FieldStrFn(name string, fn func(d *D) string, sms ...scalar.StrMapper) string { + return d.FieldStrScalarFn(name, func(d *D) scalar.Str { return scalar.Str{Actual: fn(d)} }, sms...) } // TryFieldStrFn tries to add a field, calls string decode function and returns actual value as a Str -func (d *D) TryFieldStrFn(name string, fn func(d *D) (string, error), sms ...scalar.Mapper) (string, error) { - return d.TryFieldStrScalarFn(name, func(d *D) (scalar.S, error) { +func (d *D) TryFieldStrFn(name string, fn func(d *D) (string, error), sms ...scalar.StrMapper) (string, error) { + return d.TryFieldStrScalarFn(name, func(d *D) (scalar.Str, error) { v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// TryFieldScalarStrFn tries to add a field, calls string decode function and returns scalar -func (d *D) TryFieldScalarStrFn(name string, fn func(d *D) (string, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Str{Actual: v}, err }, sms...) } // FieldScalarStrFn tries to add a field, calls string decode function and returns scalar -func (d *D) FieldScalarStrFn(name string, fn func(d *D) string, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarStrFn(name, func(d *D) (string, error) { return fn(d), nil }, sms...) +func (d *D) FieldScalarStrFn(name string, fn func(d *D) scalar.Str, sms ...scalar.StrMapper) *scalar.Str { + v, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Str", Pos: d.Pos()}) } return v } -// Type U +func (d *D) FieldValueStr(name string, a string, sms ...scalar.StrMapper) { + d.FieldScalarStrFn(name, func(_ *D) scalar.Str { return scalar.Str{Actual: a} }, sms...) +} -// TryFieldUScalarFn tries to add a field, calls scalar functions and returns actual value as a U -func (d *D) TryFieldUScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) (uint64, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) +// TryFieldScalarStrFn tries to add a field, calls string decode function and returns scalar +func (d *D) TryFieldScalarStrFn(name string, fn func(d *D) (scalar.Str, error), sms ...scalar.StrMapper) (*scalar.Str, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapStr(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Str{}, err + } + sr, ok := v.V.(*scalar.Str) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + +// Type Uint + +// TryFieldUintScalarFn tries to add a field, calls scalar functions and returns actual value as a Uint +func (d *D) TryFieldUintScalarFn(name string, fn func(d *D) (scalar.Uint, error), sms ...scalar.UintMapper) (uint64, error) { + v, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { return fn(d) }, sms...) if err != nil { return 0, err } - return v.ActualU(), err + return v.Actual, err } -// FieldUScalarFn adds a field, calls scalar functions and returns actual value as a U -func (d *D) FieldUScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) uint64 { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) +// FieldUintScalarFn adds a field, calls scalar functions and returns actual value as a Uint +func (d *D) FieldUintScalarFn(name string, fn func(d *D) scalar.Uint, sms ...scalar.UintMapper) uint64 { + v, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "U", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Uint", Pos: d.Pos()}) } - return v.ActualU() + return v.Actual } -// FieldUFn adds a field, calls uint64 decode function and returns actual value as a U -func (d *D) FieldUFn(name string, fn func(d *D) uint64, sms ...scalar.Mapper) uint64 { - return d.FieldUScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d)} }, sms...) +// FieldUintFn adds a field, calls uint64 decode function and returns actual value as a Uint +func (d *D) FieldUintFn(name string, fn func(d *D) uint64, sms ...scalar.UintMapper) uint64 { + return d.FieldUintScalarFn(name, func(d *D) scalar.Uint { return scalar.Uint{Actual: fn(d)} }, sms...) } -// TryFieldUFn tries to add a field, calls uint64 decode function and returns actual value as a U -func (d *D) TryFieldUFn(name string, fn func(d *D) (uint64, error), sms ...scalar.Mapper) (uint64, error) { - return d.TryFieldUScalarFn(name, func(d *D) (scalar.S, error) { +// TryFieldUintFn tries to add a field, calls uint64 decode function and returns actual value as a Uint +func (d *D) TryFieldUintFn(name string, fn func(d *D) (uint64, error), sms ...scalar.UintMapper) (uint64, error) { + return d.TryFieldUintScalarFn(name, func(d *D) (scalar.Uint, error) { v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.Uint{Actual: v}, err }, sms...) } -// TryFieldScalarUFn tries to add a field, calls uint64 decode function and returns scalar -func (d *D) TryFieldScalarUFn(name string, fn func(d *D) (uint64, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) -} - -// FieldScalarUFn tries to add a field, calls uint64 decode function and returns scalar -func (d *D) FieldScalarUFn(name string, fn func(d *D) uint64, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalarUFn(name, func(d *D) (uint64, error) { return fn(d), nil }, sms...) +// FieldScalarUintFn tries to add a field, calls uint64 decode function and returns scalar +func (d *D) FieldScalarUintFn(name string, fn func(d *D) scalar.Uint, sms ...scalar.UintMapper) *scalar.Uint { + v, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { return fn(d), nil }, sms...) if err != nil { - panic(IOError{Err: err, Name: name, Op: "U", Pos: d.Pos()}) + panic(IOError{Err: err, Name: name, Op: "Uint", Pos: d.Pos()}) } return v } +func (d *D) FieldValueUint(name string, a uint64, sms ...scalar.UintMapper) { + d.FieldScalarUintFn(name, func(_ *D) scalar.Uint { return scalar.Uint{Actual: a} }, sms...) +} + +// TryFieldScalarUintFn tries to add a field, calls uint64 decode function and returns scalar +func (d *D) TryFieldScalarUintFn(name string, fn func(d *D) (scalar.Uint, error), sms ...scalar.UintMapper) (*scalar.Uint, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.MapUint(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.Uint{}, err + } + sr, ok := v.V.(*scalar.Uint) + if !ok { + panic("not a scalar value") + } + return sr, nil +} + // Require/Assert/Validate BigInt -func requireBigInt(name string, s scalar.S, desc bool, fail bool, vs ...*big.Int) (scalar.S, error) { - a := s.ActualBigInt() +func requireBigInt(name string, s scalar.BigInt, desc bool, fail bool, vs ...*big.Int) (scalar.BigInt, error) { + a := s.Actual for _, b := range vs { if a.Cmp(b) == 0 { if desc { @@ -381,25 +599,27 @@ func requireBigInt(name string, s scalar.S, desc bool, fail bool, vs ...*big.Int return s, nil } -// RequireBigInt that actual value is one of given *big.Int values -func (d *D) RequireBigInt(vs ...*big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBigInt("require", s, false, true, vs...) }) +// BigIntRequire that actual value is one of given *big.Int values +func (d *D) BigIntRequire(vs ...*big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { return requireBigInt("require", s, false, true, vs...) }) } -// AssertBigInt validate and asserts that actual value is one of given *big.Int values -func (d *D) AssertBigInt(vs ...*big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBigInt("assert", s, true, !d.Options.Force, vs...) }) +// BigIntAssert validate and asserts that actual value is one of given *big.Int values +func (d *D) BigIntAssert(vs ...*big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { + return requireBigInt("assert", s, true, !d.Options.Force, vs...) + }) } -// ValidateBigInt validates that actual value is one of given *big.Int values -func (d *D) ValidateBigInt(vs ...*big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBigInt("validate", s, true, false, vs...) }) +// BigIntValidate validates that actual value is one of given *big.Int values +func (d *D) BigIntValidate(vs ...*big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { return requireBigInt("validate", s, true, false, vs...) }) } -// Require/Assert/ValidatRange BigInt +// Require/Assert/ValidateRange BigInt -func requireRangeBigInt(name string, s scalar.S, desc bool, fail bool, start, end *big.Int) (scalar.S, error) { - a := s.ActualBigInt() +func requireRangeBigInt(name string, s scalar.BigInt, desc bool, fail bool, start, end *big.Int) (scalar.BigInt, error) { + a := s.Actual if a.Cmp(start) >= 0 && a.Cmp(end) <= 0 { if desc { s.Description = "valid" @@ -415,27 +635,31 @@ func requireRangeBigInt(name string, s scalar.S, desc bool, fail bool, start, en return s, nil } -// RequireBigIntRange require that actual value is in range -func (d *D) RequireBigIntRange(start, end *big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeBigInt("require", s, false, true, start, end) }) +// BigIntRequireRange require that actual value is in range +func (d *D) BigIntRequireRange(start, end *big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { + return requireRangeBigInt("require", s, false, true, start, end) + }) } -// AssertBigIntRange asserts that actual value is in range -func (d *D) AssertBigIntRange(start, end *big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +// BigIntAssertRange asserts that actual value is in range +func (d *D) BigIntAssertRange(start, end *big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { return requireRangeBigInt("assert", s, true, !d.Options.Force, start, end) }) } -// ValidateBigIntRange validates that actual value is in range -func (d *D) ValidateBigIntRange(start, end *big.Int) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeBigInt("validate", s, true, false, start, end) }) +// BigIntValidateRange validates that actual value is in range +func (d *D) BigIntValidateRange(start, end *big.Int) scalar.BigIntMapper { + return scalar.BigIntFn(func(s scalar.BigInt) (scalar.BigInt, error) { + return requireRangeBigInt("validate", s, true, false, start, end) + }) } // Require/Assert/Validate Bool -func requireBool(name string, s scalar.S, desc bool, fail bool, vs ...bool) (scalar.S, error) { - a := s.ActualBool() +func requireBool(name string, s scalar.Bool, desc bool, fail bool, vs ...bool) (scalar.Bool, error) { + a := s.Actual for _, b := range vs { if a == b { if desc { @@ -453,25 +677,27 @@ func requireBool(name string, s scalar.S, desc bool, fail bool, vs ...bool) (sca return s, nil } -// RequireBool that actual value is one of given bool values -func (d *D) RequireBool(vs ...bool) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBool("require", s, false, true, vs...) }) +// BoolRequire that actual value is one of given bool values +func (d *D) BoolRequire(vs ...bool) scalar.BoolMapper { + return scalar.BoolFn(func(s scalar.Bool) (scalar.Bool, error) { return requireBool("require", s, false, true, vs...) }) } -// AssertBool validate and asserts that actual value is one of given bool values -func (d *D) AssertBool(vs ...bool) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBool("assert", s, true, !d.Options.Force, vs...) }) +// BoolAssert validate and asserts that actual value is one of given bool values +func (d *D) BoolAssert(vs ...bool) scalar.BoolMapper { + return scalar.BoolFn(func(s scalar.Bool) (scalar.Bool, error) { + return requireBool("assert", s, true, !d.Options.Force, vs...) + }) } -// ValidateBool validates that actual value is one of given bool values -func (d *D) ValidateBool(vs ...bool) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireBool("validate", s, true, false, vs...) }) +// BoolValidate validates that actual value is one of given bool values +func (d *D) BoolValidate(vs ...bool) scalar.BoolMapper { + return scalar.BoolFn(func(s scalar.Bool) (scalar.Bool, error) { return requireBool("validate", s, true, false, vs...) }) } -// Require/Assert/Validate F +// Require/Assert/Validate Flt -func requireF(name string, s scalar.S, desc bool, fail bool, vs ...float64) (scalar.S, error) { - a := s.ActualF() +func requireFlt(name string, s scalar.Flt, desc bool, fail bool, vs ...float64) (scalar.Flt, error) { + a := s.Actual for _, b := range vs { if a == b { if desc { @@ -484,30 +710,30 @@ func requireF(name string, s scalar.S, desc bool, fail bool, vs ...float64) (sca s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s F", name) + return s, fmt.Errorf("failed to %s Flt", name) } return s, nil } -// RequireF that actual value is one of given float64 values -func (d *D) RequireF(vs ...float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireF("require", s, false, true, vs...) }) +// FltRequire that actual value is one of given float64 values +func (d *D) FltRequire(vs ...float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { return requireFlt("require", s, false, true, vs...) }) } -// AssertF validate and asserts that actual value is one of given float64 values -func (d *D) AssertF(vs ...float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireF("assert", s, true, !d.Options.Force, vs...) }) +// FltAssert validate and asserts that actual value is one of given float64 values +func (d *D) FltAssert(vs ...float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { return requireFlt("assert", s, true, !d.Options.Force, vs...) }) } -// ValidateF validates that actual value is one of given float64 values -func (d *D) ValidateF(vs ...float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireF("validate", s, true, false, vs...) }) +// FltValidate validates that actual value is one of given float64 values +func (d *D) FltValidate(vs ...float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { return requireFlt("validate", s, true, false, vs...) }) } -// Require/Assert/ValidatRange F +// Require/Assert/ValidateRange Flt -func requireRangeF(name string, s scalar.S, desc bool, fail bool, start, end float64) (scalar.S, error) { - a := s.ActualF() +func requireRangeFlt(name string, s scalar.Flt, desc bool, fail bool, start, end float64) (scalar.Flt, error) { + a := s.Actual if a >= start && a <= end { if desc { s.Description = "valid" @@ -518,32 +744,32 @@ func requireRangeF(name string, s scalar.S, desc bool, fail bool, start, end flo s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s F range %v-%v", name, start, end) + return s, fmt.Errorf("failed to %s Flt range %v-%v", name, start, end) } return s, nil } -// RequireFRange require that actual value is in range -func (d *D) RequireFRange(start, end float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeF("require", s, false, true, start, end) }) +// FltRequireRange require that actual value is in range +func (d *D) FltRequireRange(start, end float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { return requireRangeFlt("require", s, false, true, start, end) }) } -// AssertFRange asserts that actual value is in range -func (d *D) AssertFRange(start, end float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return requireRangeF("assert", s, true, !d.Options.Force, start, end) +// FltAssertRange asserts that actual value is in range +func (d *D) FltAssertRange(start, end float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { + return requireRangeFlt("assert", s, true, !d.Options.Force, start, end) }) } -// ValidateFRange validates that actual value is in range -func (d *D) ValidateFRange(start, end float64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeF("validate", s, true, false, start, end) }) +// FltValidateRange validates that actual value is in range +func (d *D) FltValidateRange(start, end float64) scalar.FltMapper { + return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) { return requireRangeFlt("validate", s, true, false, start, end) }) } -// Require/Assert/Validate S +// Require/Assert/Validate Sint -func requireS(name string, s scalar.S, desc bool, fail bool, vs ...int64) (scalar.S, error) { - a := s.ActualS() +func requireSint(name string, s scalar.Sint, desc bool, fail bool, vs ...int64) (scalar.Sint, error) { + a := s.Actual for _, b := range vs { if a == b { if desc { @@ -556,30 +782,32 @@ func requireS(name string, s scalar.S, desc bool, fail bool, vs ...int64) (scala s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s S", name) + return s, fmt.Errorf("failed to %s Sint", name) } return s, nil } -// RequireS that actual value is one of given int64 values -func (d *D) RequireS(vs ...int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireS("require", s, false, true, vs...) }) +// SintRequire that actual value is one of given int64 values +func (d *D) SintRequire(vs ...int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { return requireSint("require", s, false, true, vs...) }) } -// AssertS validate and asserts that actual value is one of given int64 values -func (d *D) AssertS(vs ...int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireS("assert", s, true, !d.Options.Force, vs...) }) +// SintAssert validate and asserts that actual value is one of given int64 values +func (d *D) SintAssert(vs ...int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { + return requireSint("assert", s, true, !d.Options.Force, vs...) + }) } -// ValidateS validates that actual value is one of given int64 values -func (d *D) ValidateS(vs ...int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireS("validate", s, true, false, vs...) }) +// SintValidate validates that actual value is one of given int64 values +func (d *D) SintValidate(vs ...int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { return requireSint("validate", s, true, false, vs...) }) } -// Require/Assert/ValidatRange S +// Require/Assert/ValidateRange Sint -func requireRangeS(name string, s scalar.S, desc bool, fail bool, start, end int64) (scalar.S, error) { - a := s.ActualS() +func requireRangeSint(name string, s scalar.Sint, desc bool, fail bool, start, end int64) (scalar.Sint, error) { + a := s.Actual if a >= start && a <= end { if desc { s.Description = "valid" @@ -590,32 +818,36 @@ func requireRangeS(name string, s scalar.S, desc bool, fail bool, start, end int s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s S range %v-%v", name, start, end) + return s, fmt.Errorf("failed to %s Sint range %v-%v", name, start, end) } return s, nil } -// RequireSRange require that actual value is in range -func (d *D) RequireSRange(start, end int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeS("require", s, false, true, start, end) }) -} - -// AssertSRange asserts that actual value is in range -func (d *D) AssertSRange(start, end int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return requireRangeS("assert", s, true, !d.Options.Force, start, end) +// SintRequireRange require that actual value is in range +func (d *D) SintRequireRange(start, end int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { + return requireRangeSint("require", s, false, true, start, end) }) } -// ValidateSRange validates that actual value is in range -func (d *D) ValidateSRange(start, end int64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeS("validate", s, true, false, start, end) }) +// SintAssertRange asserts that actual value is in range +func (d *D) SintAssertRange(start, end int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { + return requireRangeSint("assert", s, true, !d.Options.Force, start, end) + }) +} + +// SintValidateRange validates that actual value is in range +func (d *D) SintValidateRange(start, end int64) scalar.SintMapper { + return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) { + return requireRangeSint("validate", s, true, false, start, end) + }) } // Require/Assert/Validate Str -func requireStr(name string, s scalar.S, desc bool, fail bool, vs ...string) (scalar.S, error) { - a := s.ActualStr() +func requireStr(name string, s scalar.Str, desc bool, fail bool, vs ...string) (scalar.Str, error) { + a := s.Actual for _, b := range vs { if a == b { if desc { @@ -633,25 +865,25 @@ func requireStr(name string, s scalar.S, desc bool, fail bool, vs ...string) (sc return s, nil } -// RequireStr that actual value is one of given string values -func (d *D) RequireStr(vs ...string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireStr("require", s, false, true, vs...) }) +// StrRequire that actual value is one of given string values +func (d *D) StrRequire(vs ...string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireStr("require", s, false, true, vs...) }) } -// AssertStr validate and asserts that actual value is one of given string values -func (d *D) AssertStr(vs ...string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireStr("assert", s, true, !d.Options.Force, vs...) }) +// StrAssert validate and asserts that actual value is one of given string values +func (d *D) StrAssert(vs ...string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireStr("assert", s, true, !d.Options.Force, vs...) }) } -// ValidateStr validates that actual value is one of given string values -func (d *D) ValidateStr(vs ...string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireStr("validate", s, true, false, vs...) }) +// StrValidate validates that actual value is one of given string values +func (d *D) StrValidate(vs ...string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireStr("validate", s, true, false, vs...) }) } -// Require/Assert/ValidatRange Str +// Require/Assert/ValidateRange Str -func requireRangeStr(name string, s scalar.S, desc bool, fail bool, start, end string) (scalar.S, error) { - a := s.ActualStr() +func requireRangeStr(name string, s scalar.Str, desc bool, fail bool, start, end string) (scalar.Str, error) { + a := s.Actual if a >= start && a <= end { if desc { s.Description = "valid" @@ -667,27 +899,27 @@ func requireRangeStr(name string, s scalar.S, desc bool, fail bool, start, end s return s, nil } -// RequireStrRange require that actual value is in range -func (d *D) RequireStrRange(start, end string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeStr("require", s, false, true, start, end) }) +// StrRequireRange require that actual value is in range +func (d *D) StrRequireRange(start, end string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireRangeStr("require", s, false, true, start, end) }) } -// AssertStrRange asserts that actual value is in range -func (d *D) AssertStrRange(start, end string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +// StrAssertRange asserts that actual value is in range +func (d *D) StrAssertRange(start, end string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireRangeStr("assert", s, true, !d.Options.Force, start, end) }) } -// ValidateStrRange validates that actual value is in range -func (d *D) ValidateStrRange(start, end string) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeStr("validate", s, true, false, start, end) }) +// StrValidateRange validates that actual value is in range +func (d *D) StrValidateRange(start, end string) scalar.StrMapper { + return scalar.StrFn(func(s scalar.Str) (scalar.Str, error) { return requireRangeStr("validate", s, true, false, start, end) }) } -// Require/Assert/Validate U +// Require/Assert/Validate Uint -func requireU(name string, s scalar.S, desc bool, fail bool, vs ...uint64) (scalar.S, error) { - a := s.ActualU() +func requireUint(name string, s scalar.Uint, desc bool, fail bool, vs ...uint64) (scalar.Uint, error) { + a := s.Actual for _, b := range vs { if a == b { if desc { @@ -700,30 +932,32 @@ func requireU(name string, s scalar.S, desc bool, fail bool, vs ...uint64) (scal s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s U", name) + return s, fmt.Errorf("failed to %s Uint", name) } return s, nil } -// RequireU that actual value is one of given uint64 values -func (d *D) RequireU(vs ...uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireU("require", s, false, true, vs...) }) +// UintRequire that actual value is one of given uint64 values +func (d *D) UintRequire(vs ...uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { return requireUint("require", s, false, true, vs...) }) } -// AssertU validate and asserts that actual value is one of given uint64 values -func (d *D) AssertU(vs ...uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireU("assert", s, true, !d.Options.Force, vs...) }) +// UintAssert validate and asserts that actual value is one of given uint64 values +func (d *D) UintAssert(vs ...uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return requireUint("assert", s, true, !d.Options.Force, vs...) + }) } -// ValidateU validates that actual value is one of given uint64 values -func (d *D) ValidateU(vs ...uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireU("validate", s, true, false, vs...) }) +// UintValidate validates that actual value is one of given uint64 values +func (d *D) UintValidate(vs ...uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { return requireUint("validate", s, true, false, vs...) }) } -// Require/Assert/ValidatRange U +// Require/Assert/ValidateRange Uint -func requireRangeU(name string, s scalar.S, desc bool, fail bool, start, end uint64) (scalar.S, error) { - a := s.ActualU() +func requireRangeUint(name string, s scalar.Uint, desc bool, fail bool, start, end uint64) (scalar.Uint, error) { + a := s.Actual if a >= start && a <= end { if desc { s.Description = "valid" @@ -734,26 +968,30 @@ func requireRangeU(name string, s scalar.S, desc bool, fail bool, start, end uin s.Description = "invalid" } if fail { - return s, fmt.Errorf("failed to %s U range %v-%v", name, start, end) + return s, fmt.Errorf("failed to %s Uint range %v-%v", name, start, end) } return s, nil } -// RequireURange require that actual value is in range -func (d *D) RequireURange(start, end uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeU("require", s, false, true, start, end) }) -} - -// AssertURange asserts that actual value is in range -func (d *D) AssertURange(start, end uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return requireRangeU("assert", s, true, !d.Options.Force, start, end) +// UintRequireRange require that actual value is in range +func (d *D) UintRequireRange(start, end uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return requireRangeUint("require", s, false, true, start, end) }) } -// ValidateURange validates that actual value is in range -func (d *D) ValidateURange(start, end uint64) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRangeU("validate", s, true, false, start, end) }) +// UintAssertRange asserts that actual value is in range +func (d *D) UintAssertRange(start, end uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return requireRangeUint("assert", s, true, !d.Options.Force, start, end) + }) +} + +// UintValidateRange validates that actual value is in range +func (d *D) UintValidateRange(start, end uint64) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return requireRangeUint("validate", s, true, false, start, end) + }) } // Reader RawLen @@ -771,11 +1009,10 @@ func (d *D) RawLen(nBits int64) bitio.ReaderAtSeeker { } // TryFieldScalarRawLen tries to add a field and read nBits raw bits -func (d *D) TryFieldScalarRawLen(name string, nBits int64, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarRawLen(name string, nBits int64, sms ...scalar.BitBufMapper) (*scalar.BitBuf, error) { + s, err := d.TryFieldScalarBitBufFn(name, func(d *D) (scalar.BitBuf, error) { v, err := d.tryBitBuf(nBits) - s.Actual = v - return s, err + return scalar.BitBuf{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -784,7 +1021,7 @@ func (d *D) TryFieldScalarRawLen(name string, nBits int64, sms ...scalar.Mapper) } // FieldScalarRawLen adds a field and reads nBits raw bits -func (d *D) FieldScalarRawLen(name string, nBits int64, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarRawLen(name string, nBits int64, sms ...scalar.BitBufMapper) *scalar.BitBuf { s, err := d.TryFieldScalarRawLen(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "RawLen", Pos: d.Pos()}) @@ -793,14 +1030,14 @@ func (d *D) FieldScalarRawLen(name string, nBits int64, sms ...scalar.Mapper) *s } // TryFieldRawLen tries to add a field and read nBits raw bits -func (d *D) TryFieldRawLen(name string, nBits int64, sms ...scalar.Mapper) (bitio.ReaderAtSeeker, error) { +func (d *D) TryFieldRawLen(name string, nBits int64, sms ...scalar.BitBufMapper) (bitio.ReaderAtSeeker, error) { s, err := d.TryFieldScalarRawLen(name, nBits, sms...) - return s.ActualBitBuf(), err + return s.Actual, err } // FieldRawLen adds a field and reads nBits raw bits -func (d *D) FieldRawLen(name string, nBits int64, sms ...scalar.Mapper) bitio.ReaderAtSeeker { - return d.FieldScalarRawLen(name, nBits, sms...).ActualBitBuf() +func (d *D) FieldRawLen(name string, nBits int64, sms ...scalar.BitBufMapper) bitio.ReaderAtSeeker { + return d.FieldScalarRawLen(name, nBits, sms...).Actual } // Reader Bool @@ -818,11 +1055,10 @@ func (d *D) Bool() bool { } // TryFieldScalarBool tries to add a field and read 1 bit boolean -func (d *D) TryFieldScalarBool(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarBool(name string, sms ...scalar.BoolMapper) (*scalar.Bool, error) { + s, err := d.TryFieldScalarBoolFn(name, func(d *D) (scalar.Bool, error) { v, err := d.tryBool() - s.Actual = v - return s, err + return scalar.Bool{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -831,7 +1067,7 @@ func (d *D) TryFieldScalarBool(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarBool adds a field and reads 1 bit boolean -func (d *D) FieldScalarBool(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarBool(name string, sms ...scalar.BoolMapper) *scalar.Bool { s, err := d.TryFieldScalarBool(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Bool", Pos: d.Pos()}) @@ -840,14 +1076,14 @@ func (d *D) FieldScalarBool(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldBool tries to add a field and read 1 bit boolean -func (d *D) TryFieldBool(name string, sms ...scalar.Mapper) (bool, error) { +func (d *D) TryFieldBool(name string, sms ...scalar.BoolMapper) (bool, error) { s, err := d.TryFieldScalarBool(name, sms...) - return s.ActualBool(), err + return s.Actual, err } // FieldBool adds a field and reads 1 bit boolean -func (d *D) FieldBool(name string, sms ...scalar.Mapper) bool { - return d.FieldScalarBool(name, sms...).ActualBool() +func (d *D) FieldBool(name string, sms ...scalar.BoolMapper) bool { + return d.FieldScalarBool(name, sms...).Actual } // Reader U @@ -865,11 +1101,10 @@ func (d *D) U(nBits int) uint64 { } // TryFieldScalarU tries to add a field and read nBits bits unsigned integer in current endian -func (d *D) TryFieldScalarU(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU(name string, nBits int, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(nBits, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -878,7 +1113,7 @@ func (d *D) TryFieldScalarU(name string, nBits int, sms ...scalar.Mapper) (*scal } // FieldScalarU adds a field and reads nBits bits unsigned integer in current endian -func (d *D) FieldScalarU(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU(name string, nBits int, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U", Pos: d.Pos()}) @@ -887,14 +1122,14 @@ func (d *D) FieldScalarU(name string, nBits int, sms ...scalar.Mapper) *scalar.S } // TryFieldU tries to add a field and read nBits bits unsigned integer in current endian -func (d *D) TryFieldU(name string, nBits int, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU(name string, nBits int, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU(name, nBits, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU adds a field and reads nBits bits unsigned integer in current endian -func (d *D) FieldU(name string, nBits int, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU(name, nBits, sms...).ActualU() +func (d *D) FieldU(name string, nBits int, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU(name, nBits, sms...).Actual } // Reader UE @@ -912,11 +1147,10 @@ func (d *D) UE(nBits int, endian Endian) uint64 { } // TryFieldScalarUE tries to add a field and read nBits unsigned integer in specified endian -func (d *D) TryFieldScalarUE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUE(name string, nBits int, endian Endian, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(nBits, endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -925,7 +1159,7 @@ func (d *D) TryFieldScalarUE(name string, nBits int, endian Endian, sms ...scala } // FieldScalarUE adds a field and reads nBits unsigned integer in specified endian -func (d *D) FieldScalarUE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUE(name string, nBits int, endian Endian, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarUE(name, nBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UE", Pos: d.Pos()}) @@ -934,14 +1168,14 @@ func (d *D) FieldScalarUE(name string, nBits int, endian Endian, sms ...scalar.M } // TryFieldUE tries to add a field and read nBits unsigned integer in specified endian -func (d *D) TryFieldUE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldUE(name string, nBits int, endian Endian, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarUE(name, nBits, endian, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldUE adds a field and reads nBits unsigned integer in specified endian -func (d *D) FieldUE(name string, nBits int, endian Endian, sms ...scalar.Mapper) uint64 { - return d.FieldScalarUE(name, nBits, endian, sms...).ActualU() +func (d *D) FieldUE(name string, nBits int, endian Endian, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarUE(name, nBits, endian, sms...).Actual } // Reader U1 @@ -959,11 +1193,10 @@ func (d *D) U1() uint64 { } // TryFieldScalarU1 tries to add a field and read 1 bit unsigned integer in current endian -func (d *D) TryFieldScalarU1(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU1(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(1, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -972,7 +1205,7 @@ func (d *D) TryFieldScalarU1(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU1 adds a field and reads 1 bit unsigned integer in current endian -func (d *D) FieldScalarU1(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU1(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU1(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U1", Pos: d.Pos()}) @@ -981,14 +1214,14 @@ func (d *D) FieldScalarU1(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU1 tries to add a field and read 1 bit unsigned integer in current endian -func (d *D) TryFieldU1(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU1(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU1(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU1 adds a field and reads 1 bit unsigned integer in current endian -func (d *D) FieldU1(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU1(name, sms...).ActualU() +func (d *D) FieldU1(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU1(name, sms...).Actual } // Reader U2 @@ -1006,11 +1239,10 @@ func (d *D) U2() uint64 { } // TryFieldScalarU2 tries to add a field and read 2 bit unsigned integer in current endian -func (d *D) TryFieldScalarU2(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU2(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(2, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1019,7 +1251,7 @@ func (d *D) TryFieldScalarU2(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU2 adds a field and reads 2 bit unsigned integer in current endian -func (d *D) FieldScalarU2(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU2(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU2(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U2", Pos: d.Pos()}) @@ -1028,14 +1260,14 @@ func (d *D) FieldScalarU2(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU2 tries to add a field and read 2 bit unsigned integer in current endian -func (d *D) TryFieldU2(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU2(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU2(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU2 adds a field and reads 2 bit unsigned integer in current endian -func (d *D) FieldU2(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU2(name, sms...).ActualU() +func (d *D) FieldU2(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU2(name, sms...).Actual } // Reader U3 @@ -1053,11 +1285,10 @@ func (d *D) U3() uint64 { } // TryFieldScalarU3 tries to add a field and read 3 bit unsigned integer in current endian -func (d *D) TryFieldScalarU3(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU3(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(3, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1066,7 +1297,7 @@ func (d *D) TryFieldScalarU3(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU3 adds a field and reads 3 bit unsigned integer in current endian -func (d *D) FieldScalarU3(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU3(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU3(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U3", Pos: d.Pos()}) @@ -1075,14 +1306,14 @@ func (d *D) FieldScalarU3(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU3 tries to add a field and read 3 bit unsigned integer in current endian -func (d *D) TryFieldU3(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU3(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU3(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU3 adds a field and reads 3 bit unsigned integer in current endian -func (d *D) FieldU3(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU3(name, sms...).ActualU() +func (d *D) FieldU3(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU3(name, sms...).Actual } // Reader U4 @@ -1100,11 +1331,10 @@ func (d *D) U4() uint64 { } // TryFieldScalarU4 tries to add a field and read 4 bit unsigned integer in current endian -func (d *D) TryFieldScalarU4(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU4(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(4, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1113,7 +1343,7 @@ func (d *D) TryFieldScalarU4(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU4 adds a field and reads 4 bit unsigned integer in current endian -func (d *D) FieldScalarU4(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU4(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU4(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U4", Pos: d.Pos()}) @@ -1122,14 +1352,14 @@ func (d *D) FieldScalarU4(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU4 tries to add a field and read 4 bit unsigned integer in current endian -func (d *D) TryFieldU4(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU4(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU4(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU4 adds a field and reads 4 bit unsigned integer in current endian -func (d *D) FieldU4(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU4(name, sms...).ActualU() +func (d *D) FieldU4(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU4(name, sms...).Actual } // Reader U5 @@ -1147,11 +1377,10 @@ func (d *D) U5() uint64 { } // TryFieldScalarU5 tries to add a field and read 5 bit unsigned integer in current endian -func (d *D) TryFieldScalarU5(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU5(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(5, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1160,7 +1389,7 @@ func (d *D) TryFieldScalarU5(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU5 adds a field and reads 5 bit unsigned integer in current endian -func (d *D) FieldScalarU5(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU5(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU5(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U5", Pos: d.Pos()}) @@ -1169,14 +1398,14 @@ func (d *D) FieldScalarU5(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU5 tries to add a field and read 5 bit unsigned integer in current endian -func (d *D) TryFieldU5(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU5(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU5(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU5 adds a field and reads 5 bit unsigned integer in current endian -func (d *D) FieldU5(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU5(name, sms...).ActualU() +func (d *D) FieldU5(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU5(name, sms...).Actual } // Reader U6 @@ -1194,11 +1423,10 @@ func (d *D) U6() uint64 { } // TryFieldScalarU6 tries to add a field and read 6 bit unsigned integer in current endian -func (d *D) TryFieldScalarU6(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU6(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(6, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1207,7 +1435,7 @@ func (d *D) TryFieldScalarU6(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU6 adds a field and reads 6 bit unsigned integer in current endian -func (d *D) FieldScalarU6(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU6(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU6(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U6", Pos: d.Pos()}) @@ -1216,14 +1444,14 @@ func (d *D) FieldScalarU6(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU6 tries to add a field and read 6 bit unsigned integer in current endian -func (d *D) TryFieldU6(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU6(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU6(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU6 adds a field and reads 6 bit unsigned integer in current endian -func (d *D) FieldU6(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU6(name, sms...).ActualU() +func (d *D) FieldU6(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU6(name, sms...).Actual } // Reader U7 @@ -1241,11 +1469,10 @@ func (d *D) U7() uint64 { } // TryFieldScalarU7 tries to add a field and read 7 bit unsigned integer in current endian -func (d *D) TryFieldScalarU7(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU7(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(7, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1254,7 +1481,7 @@ func (d *D) TryFieldScalarU7(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU7 adds a field and reads 7 bit unsigned integer in current endian -func (d *D) FieldScalarU7(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU7(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU7(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U7", Pos: d.Pos()}) @@ -1263,14 +1490,14 @@ func (d *D) FieldScalarU7(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU7 tries to add a field and read 7 bit unsigned integer in current endian -func (d *D) TryFieldU7(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU7(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU7(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU7 adds a field and reads 7 bit unsigned integer in current endian -func (d *D) FieldU7(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU7(name, sms...).ActualU() +func (d *D) FieldU7(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU7(name, sms...).Actual } // Reader U8 @@ -1288,11 +1515,10 @@ func (d *D) U8() uint64 { } // TryFieldScalarU8 tries to add a field and read 8 bit unsigned integer in current endian -func (d *D) TryFieldScalarU8(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU8(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(8, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1301,7 +1527,7 @@ func (d *D) TryFieldScalarU8(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU8 adds a field and reads 8 bit unsigned integer in current endian -func (d *D) FieldScalarU8(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU8(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU8(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U8", Pos: d.Pos()}) @@ -1310,14 +1536,14 @@ func (d *D) FieldScalarU8(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU8 tries to add a field and read 8 bit unsigned integer in current endian -func (d *D) TryFieldU8(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU8(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU8(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU8 adds a field and reads 8 bit unsigned integer in current endian -func (d *D) FieldU8(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU8(name, sms...).ActualU() +func (d *D) FieldU8(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU8(name, sms...).Actual } // Reader U9 @@ -1335,11 +1561,10 @@ func (d *D) U9() uint64 { } // TryFieldScalarU9 tries to add a field and read 9 bit unsigned integer in current endian -func (d *D) TryFieldScalarU9(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU9(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(9, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1348,7 +1573,7 @@ func (d *D) TryFieldScalarU9(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarU9 adds a field and reads 9 bit unsigned integer in current endian -func (d *D) FieldScalarU9(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU9(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU9(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U9", Pos: d.Pos()}) @@ -1357,14 +1582,14 @@ func (d *D) FieldScalarU9(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU9 tries to add a field and read 9 bit unsigned integer in current endian -func (d *D) TryFieldU9(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU9(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU9(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU9 adds a field and reads 9 bit unsigned integer in current endian -func (d *D) FieldU9(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU9(name, sms...).ActualU() +func (d *D) FieldU9(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU9(name, sms...).Actual } // Reader U10 @@ -1382,11 +1607,10 @@ func (d *D) U10() uint64 { } // TryFieldScalarU10 tries to add a field and read 10 bit unsigned integer in current endian -func (d *D) TryFieldScalarU10(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU10(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(10, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1395,7 +1619,7 @@ func (d *D) TryFieldScalarU10(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU10 adds a field and reads 10 bit unsigned integer in current endian -func (d *D) FieldScalarU10(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU10(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU10(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U10", Pos: d.Pos()}) @@ -1404,14 +1628,14 @@ func (d *D) FieldScalarU10(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU10 tries to add a field and read 10 bit unsigned integer in current endian -func (d *D) TryFieldU10(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU10(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU10(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU10 adds a field and reads 10 bit unsigned integer in current endian -func (d *D) FieldU10(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU10(name, sms...).ActualU() +func (d *D) FieldU10(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU10(name, sms...).Actual } // Reader U11 @@ -1429,11 +1653,10 @@ func (d *D) U11() uint64 { } // TryFieldScalarU11 tries to add a field and read 11 bit unsigned integer in current endian -func (d *D) TryFieldScalarU11(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU11(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(11, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1442,7 +1665,7 @@ func (d *D) TryFieldScalarU11(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU11 adds a field and reads 11 bit unsigned integer in current endian -func (d *D) FieldScalarU11(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU11(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU11(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U11", Pos: d.Pos()}) @@ -1451,14 +1674,14 @@ func (d *D) FieldScalarU11(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU11 tries to add a field and read 11 bit unsigned integer in current endian -func (d *D) TryFieldU11(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU11(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU11(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU11 adds a field and reads 11 bit unsigned integer in current endian -func (d *D) FieldU11(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU11(name, sms...).ActualU() +func (d *D) FieldU11(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU11(name, sms...).Actual } // Reader U12 @@ -1476,11 +1699,10 @@ func (d *D) U12() uint64 { } // TryFieldScalarU12 tries to add a field and read 12 bit unsigned integer in current endian -func (d *D) TryFieldScalarU12(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU12(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(12, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1489,7 +1711,7 @@ func (d *D) TryFieldScalarU12(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU12 adds a field and reads 12 bit unsigned integer in current endian -func (d *D) FieldScalarU12(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU12(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU12(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U12", Pos: d.Pos()}) @@ -1498,14 +1720,14 @@ func (d *D) FieldScalarU12(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU12 tries to add a field and read 12 bit unsigned integer in current endian -func (d *D) TryFieldU12(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU12(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU12(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU12 adds a field and reads 12 bit unsigned integer in current endian -func (d *D) FieldU12(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU12(name, sms...).ActualU() +func (d *D) FieldU12(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU12(name, sms...).Actual } // Reader U13 @@ -1523,11 +1745,10 @@ func (d *D) U13() uint64 { } // TryFieldScalarU13 tries to add a field and read 13 bit unsigned integer in current endian -func (d *D) TryFieldScalarU13(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU13(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(13, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1536,7 +1757,7 @@ func (d *D) TryFieldScalarU13(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU13 adds a field and reads 13 bit unsigned integer in current endian -func (d *D) FieldScalarU13(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU13(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU13(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U13", Pos: d.Pos()}) @@ -1545,14 +1766,14 @@ func (d *D) FieldScalarU13(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU13 tries to add a field and read 13 bit unsigned integer in current endian -func (d *D) TryFieldU13(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU13(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU13(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU13 adds a field and reads 13 bit unsigned integer in current endian -func (d *D) FieldU13(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU13(name, sms...).ActualU() +func (d *D) FieldU13(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU13(name, sms...).Actual } // Reader U14 @@ -1570,11 +1791,10 @@ func (d *D) U14() uint64 { } // TryFieldScalarU14 tries to add a field and read 14 bit unsigned integer in current endian -func (d *D) TryFieldScalarU14(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU14(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(14, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1583,7 +1803,7 @@ func (d *D) TryFieldScalarU14(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU14 adds a field and reads 14 bit unsigned integer in current endian -func (d *D) FieldScalarU14(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU14(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU14(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U14", Pos: d.Pos()}) @@ -1592,14 +1812,14 @@ func (d *D) FieldScalarU14(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU14 tries to add a field and read 14 bit unsigned integer in current endian -func (d *D) TryFieldU14(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU14(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU14(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU14 adds a field and reads 14 bit unsigned integer in current endian -func (d *D) FieldU14(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU14(name, sms...).ActualU() +func (d *D) FieldU14(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU14(name, sms...).Actual } // Reader U15 @@ -1617,11 +1837,10 @@ func (d *D) U15() uint64 { } // TryFieldScalarU15 tries to add a field and read 15 bit unsigned integer in current endian -func (d *D) TryFieldScalarU15(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU15(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(15, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1630,7 +1849,7 @@ func (d *D) TryFieldScalarU15(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU15 adds a field and reads 15 bit unsigned integer in current endian -func (d *D) FieldScalarU15(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU15(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU15(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U15", Pos: d.Pos()}) @@ -1639,14 +1858,14 @@ func (d *D) FieldScalarU15(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU15 tries to add a field and read 15 bit unsigned integer in current endian -func (d *D) TryFieldU15(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU15(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU15(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU15 adds a field and reads 15 bit unsigned integer in current endian -func (d *D) FieldU15(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU15(name, sms...).ActualU() +func (d *D) FieldU15(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU15(name, sms...).Actual } // Reader U16 @@ -1664,11 +1883,10 @@ func (d *D) U16() uint64 { } // TryFieldScalarU16 tries to add a field and read 16 bit unsigned integer in current endian -func (d *D) TryFieldScalarU16(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU16(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(16, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1677,7 +1895,7 @@ func (d *D) TryFieldScalarU16(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU16 adds a field and reads 16 bit unsigned integer in current endian -func (d *D) FieldScalarU16(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU16(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU16(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U16", Pos: d.Pos()}) @@ -1686,14 +1904,14 @@ func (d *D) FieldScalarU16(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU16 tries to add a field and read 16 bit unsigned integer in current endian -func (d *D) TryFieldU16(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU16(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU16(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU16 adds a field and reads 16 bit unsigned integer in current endian -func (d *D) FieldU16(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU16(name, sms...).ActualU() +func (d *D) FieldU16(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU16(name, sms...).Actual } // Reader U17 @@ -1711,11 +1929,10 @@ func (d *D) U17() uint64 { } // TryFieldScalarU17 tries to add a field and read 17 bit unsigned integer in current endian -func (d *D) TryFieldScalarU17(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU17(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(17, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1724,7 +1941,7 @@ func (d *D) TryFieldScalarU17(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU17 adds a field and reads 17 bit unsigned integer in current endian -func (d *D) FieldScalarU17(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU17(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU17(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U17", Pos: d.Pos()}) @@ -1733,14 +1950,14 @@ func (d *D) FieldScalarU17(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU17 tries to add a field and read 17 bit unsigned integer in current endian -func (d *D) TryFieldU17(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU17(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU17(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU17 adds a field and reads 17 bit unsigned integer in current endian -func (d *D) FieldU17(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU17(name, sms...).ActualU() +func (d *D) FieldU17(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU17(name, sms...).Actual } // Reader U18 @@ -1758,11 +1975,10 @@ func (d *D) U18() uint64 { } // TryFieldScalarU18 tries to add a field and read 18 bit unsigned integer in current endian -func (d *D) TryFieldScalarU18(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU18(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(18, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1771,7 +1987,7 @@ func (d *D) TryFieldScalarU18(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU18 adds a field and reads 18 bit unsigned integer in current endian -func (d *D) FieldScalarU18(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU18(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU18(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U18", Pos: d.Pos()}) @@ -1780,14 +1996,14 @@ func (d *D) FieldScalarU18(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU18 tries to add a field and read 18 bit unsigned integer in current endian -func (d *D) TryFieldU18(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU18(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU18(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU18 adds a field and reads 18 bit unsigned integer in current endian -func (d *D) FieldU18(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU18(name, sms...).ActualU() +func (d *D) FieldU18(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU18(name, sms...).Actual } // Reader U19 @@ -1805,11 +2021,10 @@ func (d *D) U19() uint64 { } // TryFieldScalarU19 tries to add a field and read 19 bit unsigned integer in current endian -func (d *D) TryFieldScalarU19(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU19(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(19, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1818,7 +2033,7 @@ func (d *D) TryFieldScalarU19(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU19 adds a field and reads 19 bit unsigned integer in current endian -func (d *D) FieldScalarU19(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU19(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU19(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U19", Pos: d.Pos()}) @@ -1827,14 +2042,14 @@ func (d *D) FieldScalarU19(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU19 tries to add a field and read 19 bit unsigned integer in current endian -func (d *D) TryFieldU19(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU19(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU19(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU19 adds a field and reads 19 bit unsigned integer in current endian -func (d *D) FieldU19(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU19(name, sms...).ActualU() +func (d *D) FieldU19(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU19(name, sms...).Actual } // Reader U20 @@ -1852,11 +2067,10 @@ func (d *D) U20() uint64 { } // TryFieldScalarU20 tries to add a field and read 20 bit unsigned integer in current endian -func (d *D) TryFieldScalarU20(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU20(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(20, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1865,7 +2079,7 @@ func (d *D) TryFieldScalarU20(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU20 adds a field and reads 20 bit unsigned integer in current endian -func (d *D) FieldScalarU20(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU20(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU20(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U20", Pos: d.Pos()}) @@ -1874,14 +2088,14 @@ func (d *D) FieldScalarU20(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU20 tries to add a field and read 20 bit unsigned integer in current endian -func (d *D) TryFieldU20(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU20(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU20(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU20 adds a field and reads 20 bit unsigned integer in current endian -func (d *D) FieldU20(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU20(name, sms...).ActualU() +func (d *D) FieldU20(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU20(name, sms...).Actual } // Reader U21 @@ -1899,11 +2113,10 @@ func (d *D) U21() uint64 { } // TryFieldScalarU21 tries to add a field and read 21 bit unsigned integer in current endian -func (d *D) TryFieldScalarU21(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU21(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(21, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1912,7 +2125,7 @@ func (d *D) TryFieldScalarU21(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU21 adds a field and reads 21 bit unsigned integer in current endian -func (d *D) FieldScalarU21(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU21(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU21(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U21", Pos: d.Pos()}) @@ -1921,14 +2134,14 @@ func (d *D) FieldScalarU21(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU21 tries to add a field and read 21 bit unsigned integer in current endian -func (d *D) TryFieldU21(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU21(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU21(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU21 adds a field and reads 21 bit unsigned integer in current endian -func (d *D) FieldU21(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU21(name, sms...).ActualU() +func (d *D) FieldU21(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU21(name, sms...).Actual } // Reader U22 @@ -1946,11 +2159,10 @@ func (d *D) U22() uint64 { } // TryFieldScalarU22 tries to add a field and read 22 bit unsigned integer in current endian -func (d *D) TryFieldScalarU22(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU22(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(22, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -1959,7 +2171,7 @@ func (d *D) TryFieldScalarU22(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU22 adds a field and reads 22 bit unsigned integer in current endian -func (d *D) FieldScalarU22(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU22(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU22(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U22", Pos: d.Pos()}) @@ -1968,14 +2180,14 @@ func (d *D) FieldScalarU22(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU22 tries to add a field and read 22 bit unsigned integer in current endian -func (d *D) TryFieldU22(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU22(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU22(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU22 adds a field and reads 22 bit unsigned integer in current endian -func (d *D) FieldU22(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU22(name, sms...).ActualU() +func (d *D) FieldU22(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU22(name, sms...).Actual } // Reader U23 @@ -1993,11 +2205,10 @@ func (d *D) U23() uint64 { } // TryFieldScalarU23 tries to add a field and read 23 bit unsigned integer in current endian -func (d *D) TryFieldScalarU23(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU23(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(23, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2006,7 +2217,7 @@ func (d *D) TryFieldScalarU23(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU23 adds a field and reads 23 bit unsigned integer in current endian -func (d *D) FieldScalarU23(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU23(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU23(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U23", Pos: d.Pos()}) @@ -2015,14 +2226,14 @@ func (d *D) FieldScalarU23(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU23 tries to add a field and read 23 bit unsigned integer in current endian -func (d *D) TryFieldU23(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU23(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU23(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU23 adds a field and reads 23 bit unsigned integer in current endian -func (d *D) FieldU23(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU23(name, sms...).ActualU() +func (d *D) FieldU23(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU23(name, sms...).Actual } // Reader U24 @@ -2040,11 +2251,10 @@ func (d *D) U24() uint64 { } // TryFieldScalarU24 tries to add a field and read 24 bit unsigned integer in current endian -func (d *D) TryFieldScalarU24(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU24(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(24, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2053,7 +2263,7 @@ func (d *D) TryFieldScalarU24(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU24 adds a field and reads 24 bit unsigned integer in current endian -func (d *D) FieldScalarU24(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU24(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU24(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U24", Pos: d.Pos()}) @@ -2062,14 +2272,14 @@ func (d *D) FieldScalarU24(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU24 tries to add a field and read 24 bit unsigned integer in current endian -func (d *D) TryFieldU24(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU24(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU24(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU24 adds a field and reads 24 bit unsigned integer in current endian -func (d *D) FieldU24(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU24(name, sms...).ActualU() +func (d *D) FieldU24(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU24(name, sms...).Actual } // Reader U25 @@ -2087,11 +2297,10 @@ func (d *D) U25() uint64 { } // TryFieldScalarU25 tries to add a field and read 25 bit unsigned integer in current endian -func (d *D) TryFieldScalarU25(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU25(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(25, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2100,7 +2309,7 @@ func (d *D) TryFieldScalarU25(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU25 adds a field and reads 25 bit unsigned integer in current endian -func (d *D) FieldScalarU25(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU25(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU25(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U25", Pos: d.Pos()}) @@ -2109,14 +2318,14 @@ func (d *D) FieldScalarU25(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU25 tries to add a field and read 25 bit unsigned integer in current endian -func (d *D) TryFieldU25(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU25(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU25(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU25 adds a field and reads 25 bit unsigned integer in current endian -func (d *D) FieldU25(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU25(name, sms...).ActualU() +func (d *D) FieldU25(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU25(name, sms...).Actual } // Reader U26 @@ -2134,11 +2343,10 @@ func (d *D) U26() uint64 { } // TryFieldScalarU26 tries to add a field and read 26 bit unsigned integer in current endian -func (d *D) TryFieldScalarU26(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU26(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(26, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2147,7 +2355,7 @@ func (d *D) TryFieldScalarU26(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU26 adds a field and reads 26 bit unsigned integer in current endian -func (d *D) FieldScalarU26(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU26(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU26(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U26", Pos: d.Pos()}) @@ -2156,14 +2364,14 @@ func (d *D) FieldScalarU26(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU26 tries to add a field and read 26 bit unsigned integer in current endian -func (d *D) TryFieldU26(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU26(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU26(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU26 adds a field and reads 26 bit unsigned integer in current endian -func (d *D) FieldU26(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU26(name, sms...).ActualU() +func (d *D) FieldU26(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU26(name, sms...).Actual } // Reader U27 @@ -2181,11 +2389,10 @@ func (d *D) U27() uint64 { } // TryFieldScalarU27 tries to add a field and read 27 bit unsigned integer in current endian -func (d *D) TryFieldScalarU27(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU27(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(27, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2194,7 +2401,7 @@ func (d *D) TryFieldScalarU27(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU27 adds a field and reads 27 bit unsigned integer in current endian -func (d *D) FieldScalarU27(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU27(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU27(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U27", Pos: d.Pos()}) @@ -2203,14 +2410,14 @@ func (d *D) FieldScalarU27(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU27 tries to add a field and read 27 bit unsigned integer in current endian -func (d *D) TryFieldU27(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU27(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU27(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU27 adds a field and reads 27 bit unsigned integer in current endian -func (d *D) FieldU27(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU27(name, sms...).ActualU() +func (d *D) FieldU27(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU27(name, sms...).Actual } // Reader U28 @@ -2228,11 +2435,10 @@ func (d *D) U28() uint64 { } // TryFieldScalarU28 tries to add a field and read 28 bit unsigned integer in current endian -func (d *D) TryFieldScalarU28(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU28(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(28, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2241,7 +2447,7 @@ func (d *D) TryFieldScalarU28(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU28 adds a field and reads 28 bit unsigned integer in current endian -func (d *D) FieldScalarU28(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU28(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU28(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U28", Pos: d.Pos()}) @@ -2250,14 +2456,14 @@ func (d *D) FieldScalarU28(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU28 tries to add a field and read 28 bit unsigned integer in current endian -func (d *D) TryFieldU28(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU28(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU28(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU28 adds a field and reads 28 bit unsigned integer in current endian -func (d *D) FieldU28(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU28(name, sms...).ActualU() +func (d *D) FieldU28(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU28(name, sms...).Actual } // Reader U29 @@ -2275,11 +2481,10 @@ func (d *D) U29() uint64 { } // TryFieldScalarU29 tries to add a field and read 29 bit unsigned integer in current endian -func (d *D) TryFieldScalarU29(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU29(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(29, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2288,7 +2493,7 @@ func (d *D) TryFieldScalarU29(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU29 adds a field and reads 29 bit unsigned integer in current endian -func (d *D) FieldScalarU29(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU29(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU29(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U29", Pos: d.Pos()}) @@ -2297,14 +2502,14 @@ func (d *D) FieldScalarU29(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU29 tries to add a field and read 29 bit unsigned integer in current endian -func (d *D) TryFieldU29(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU29(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU29(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU29 adds a field and reads 29 bit unsigned integer in current endian -func (d *D) FieldU29(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU29(name, sms...).ActualU() +func (d *D) FieldU29(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU29(name, sms...).Actual } // Reader U30 @@ -2322,11 +2527,10 @@ func (d *D) U30() uint64 { } // TryFieldScalarU30 tries to add a field and read 30 bit unsigned integer in current endian -func (d *D) TryFieldScalarU30(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU30(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(30, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2335,7 +2539,7 @@ func (d *D) TryFieldScalarU30(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU30 adds a field and reads 30 bit unsigned integer in current endian -func (d *D) FieldScalarU30(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU30(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU30(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U30", Pos: d.Pos()}) @@ -2344,14 +2548,14 @@ func (d *D) FieldScalarU30(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU30 tries to add a field and read 30 bit unsigned integer in current endian -func (d *D) TryFieldU30(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU30(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU30(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU30 adds a field and reads 30 bit unsigned integer in current endian -func (d *D) FieldU30(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU30(name, sms...).ActualU() +func (d *D) FieldU30(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU30(name, sms...).Actual } // Reader U31 @@ -2369,11 +2573,10 @@ func (d *D) U31() uint64 { } // TryFieldScalarU31 tries to add a field and read 31 bit unsigned integer in current endian -func (d *D) TryFieldScalarU31(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU31(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(31, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2382,7 +2585,7 @@ func (d *D) TryFieldScalarU31(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU31 adds a field and reads 31 bit unsigned integer in current endian -func (d *D) FieldScalarU31(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU31(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU31(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U31", Pos: d.Pos()}) @@ -2391,14 +2594,14 @@ func (d *D) FieldScalarU31(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU31 tries to add a field and read 31 bit unsigned integer in current endian -func (d *D) TryFieldU31(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU31(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU31(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU31 adds a field and reads 31 bit unsigned integer in current endian -func (d *D) FieldU31(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU31(name, sms...).ActualU() +func (d *D) FieldU31(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU31(name, sms...).Actual } // Reader U32 @@ -2416,11 +2619,10 @@ func (d *D) U32() uint64 { } // TryFieldScalarU32 tries to add a field and read 32 bit unsigned integer in current endian -func (d *D) TryFieldScalarU32(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU32(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(32, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2429,7 +2631,7 @@ func (d *D) TryFieldScalarU32(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU32 adds a field and reads 32 bit unsigned integer in current endian -func (d *D) FieldScalarU32(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU32(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU32(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U32", Pos: d.Pos()}) @@ -2438,14 +2640,14 @@ func (d *D) FieldScalarU32(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU32 tries to add a field and read 32 bit unsigned integer in current endian -func (d *D) TryFieldU32(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU32(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU32(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU32 adds a field and reads 32 bit unsigned integer in current endian -func (d *D) FieldU32(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU32(name, sms...).ActualU() +func (d *D) FieldU32(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU32(name, sms...).Actual } // Reader U33 @@ -2463,11 +2665,10 @@ func (d *D) U33() uint64 { } // TryFieldScalarU33 tries to add a field and read 33 bit unsigned integer in current endian -func (d *D) TryFieldScalarU33(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU33(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(33, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2476,7 +2677,7 @@ func (d *D) TryFieldScalarU33(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU33 adds a field and reads 33 bit unsigned integer in current endian -func (d *D) FieldScalarU33(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU33(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU33(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U33", Pos: d.Pos()}) @@ -2485,14 +2686,14 @@ func (d *D) FieldScalarU33(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU33 tries to add a field and read 33 bit unsigned integer in current endian -func (d *D) TryFieldU33(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU33(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU33(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU33 adds a field and reads 33 bit unsigned integer in current endian -func (d *D) FieldU33(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU33(name, sms...).ActualU() +func (d *D) FieldU33(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU33(name, sms...).Actual } // Reader U34 @@ -2510,11 +2711,10 @@ func (d *D) U34() uint64 { } // TryFieldScalarU34 tries to add a field and read 34 bit unsigned integer in current endian -func (d *D) TryFieldScalarU34(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU34(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(34, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2523,7 +2723,7 @@ func (d *D) TryFieldScalarU34(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU34 adds a field and reads 34 bit unsigned integer in current endian -func (d *D) FieldScalarU34(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU34(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU34(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U34", Pos: d.Pos()}) @@ -2532,14 +2732,14 @@ func (d *D) FieldScalarU34(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU34 tries to add a field and read 34 bit unsigned integer in current endian -func (d *D) TryFieldU34(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU34(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU34(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU34 adds a field and reads 34 bit unsigned integer in current endian -func (d *D) FieldU34(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU34(name, sms...).ActualU() +func (d *D) FieldU34(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU34(name, sms...).Actual } // Reader U35 @@ -2557,11 +2757,10 @@ func (d *D) U35() uint64 { } // TryFieldScalarU35 tries to add a field and read 35 bit unsigned integer in current endian -func (d *D) TryFieldScalarU35(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU35(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(35, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2570,7 +2769,7 @@ func (d *D) TryFieldScalarU35(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU35 adds a field and reads 35 bit unsigned integer in current endian -func (d *D) FieldScalarU35(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU35(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU35(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U35", Pos: d.Pos()}) @@ -2579,14 +2778,14 @@ func (d *D) FieldScalarU35(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU35 tries to add a field and read 35 bit unsigned integer in current endian -func (d *D) TryFieldU35(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU35(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU35(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU35 adds a field and reads 35 bit unsigned integer in current endian -func (d *D) FieldU35(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU35(name, sms...).ActualU() +func (d *D) FieldU35(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU35(name, sms...).Actual } // Reader U36 @@ -2604,11 +2803,10 @@ func (d *D) U36() uint64 { } // TryFieldScalarU36 tries to add a field and read 36 bit unsigned integer in current endian -func (d *D) TryFieldScalarU36(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU36(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(36, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2617,7 +2815,7 @@ func (d *D) TryFieldScalarU36(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU36 adds a field and reads 36 bit unsigned integer in current endian -func (d *D) FieldScalarU36(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU36(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU36(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U36", Pos: d.Pos()}) @@ -2626,14 +2824,14 @@ func (d *D) FieldScalarU36(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU36 tries to add a field and read 36 bit unsigned integer in current endian -func (d *D) TryFieldU36(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU36(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU36(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU36 adds a field and reads 36 bit unsigned integer in current endian -func (d *D) FieldU36(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU36(name, sms...).ActualU() +func (d *D) FieldU36(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU36(name, sms...).Actual } // Reader U37 @@ -2651,11 +2849,10 @@ func (d *D) U37() uint64 { } // TryFieldScalarU37 tries to add a field and read 37 bit unsigned integer in current endian -func (d *D) TryFieldScalarU37(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU37(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(37, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2664,7 +2861,7 @@ func (d *D) TryFieldScalarU37(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU37 adds a field and reads 37 bit unsigned integer in current endian -func (d *D) FieldScalarU37(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU37(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU37(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U37", Pos: d.Pos()}) @@ -2673,14 +2870,14 @@ func (d *D) FieldScalarU37(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU37 tries to add a field and read 37 bit unsigned integer in current endian -func (d *D) TryFieldU37(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU37(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU37(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU37 adds a field and reads 37 bit unsigned integer in current endian -func (d *D) FieldU37(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU37(name, sms...).ActualU() +func (d *D) FieldU37(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU37(name, sms...).Actual } // Reader U38 @@ -2698,11 +2895,10 @@ func (d *D) U38() uint64 { } // TryFieldScalarU38 tries to add a field and read 38 bit unsigned integer in current endian -func (d *D) TryFieldScalarU38(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU38(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(38, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2711,7 +2907,7 @@ func (d *D) TryFieldScalarU38(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU38 adds a field and reads 38 bit unsigned integer in current endian -func (d *D) FieldScalarU38(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU38(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU38(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U38", Pos: d.Pos()}) @@ -2720,14 +2916,14 @@ func (d *D) FieldScalarU38(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU38 tries to add a field and read 38 bit unsigned integer in current endian -func (d *D) TryFieldU38(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU38(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU38(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU38 adds a field and reads 38 bit unsigned integer in current endian -func (d *D) FieldU38(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU38(name, sms...).ActualU() +func (d *D) FieldU38(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU38(name, sms...).Actual } // Reader U39 @@ -2745,11 +2941,10 @@ func (d *D) U39() uint64 { } // TryFieldScalarU39 tries to add a field and read 39 bit unsigned integer in current endian -func (d *D) TryFieldScalarU39(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU39(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(39, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2758,7 +2953,7 @@ func (d *D) TryFieldScalarU39(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU39 adds a field and reads 39 bit unsigned integer in current endian -func (d *D) FieldScalarU39(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU39(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU39(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U39", Pos: d.Pos()}) @@ -2767,14 +2962,14 @@ func (d *D) FieldScalarU39(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU39 tries to add a field and read 39 bit unsigned integer in current endian -func (d *D) TryFieldU39(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU39(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU39(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU39 adds a field and reads 39 bit unsigned integer in current endian -func (d *D) FieldU39(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU39(name, sms...).ActualU() +func (d *D) FieldU39(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU39(name, sms...).Actual } // Reader U40 @@ -2792,11 +2987,10 @@ func (d *D) U40() uint64 { } // TryFieldScalarU40 tries to add a field and read 40 bit unsigned integer in current endian -func (d *D) TryFieldScalarU40(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU40(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(40, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2805,7 +2999,7 @@ func (d *D) TryFieldScalarU40(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU40 adds a field and reads 40 bit unsigned integer in current endian -func (d *D) FieldScalarU40(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU40(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU40(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U40", Pos: d.Pos()}) @@ -2814,14 +3008,14 @@ func (d *D) FieldScalarU40(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU40 tries to add a field and read 40 bit unsigned integer in current endian -func (d *D) TryFieldU40(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU40(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU40(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU40 adds a field and reads 40 bit unsigned integer in current endian -func (d *D) FieldU40(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU40(name, sms...).ActualU() +func (d *D) FieldU40(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU40(name, sms...).Actual } // Reader U41 @@ -2839,11 +3033,10 @@ func (d *D) U41() uint64 { } // TryFieldScalarU41 tries to add a field and read 41 bit unsigned integer in current endian -func (d *D) TryFieldScalarU41(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU41(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(41, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2852,7 +3045,7 @@ func (d *D) TryFieldScalarU41(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU41 adds a field and reads 41 bit unsigned integer in current endian -func (d *D) FieldScalarU41(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU41(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU41(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U41", Pos: d.Pos()}) @@ -2861,14 +3054,14 @@ func (d *D) FieldScalarU41(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU41 tries to add a field and read 41 bit unsigned integer in current endian -func (d *D) TryFieldU41(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU41(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU41(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU41 adds a field and reads 41 bit unsigned integer in current endian -func (d *D) FieldU41(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU41(name, sms...).ActualU() +func (d *D) FieldU41(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU41(name, sms...).Actual } // Reader U42 @@ -2886,11 +3079,10 @@ func (d *D) U42() uint64 { } // TryFieldScalarU42 tries to add a field and read 42 bit unsigned integer in current endian -func (d *D) TryFieldScalarU42(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU42(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(42, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2899,7 +3091,7 @@ func (d *D) TryFieldScalarU42(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU42 adds a field and reads 42 bit unsigned integer in current endian -func (d *D) FieldScalarU42(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU42(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU42(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U42", Pos: d.Pos()}) @@ -2908,14 +3100,14 @@ func (d *D) FieldScalarU42(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU42 tries to add a field and read 42 bit unsigned integer in current endian -func (d *D) TryFieldU42(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU42(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU42(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU42 adds a field and reads 42 bit unsigned integer in current endian -func (d *D) FieldU42(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU42(name, sms...).ActualU() +func (d *D) FieldU42(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU42(name, sms...).Actual } // Reader U43 @@ -2933,11 +3125,10 @@ func (d *D) U43() uint64 { } // TryFieldScalarU43 tries to add a field and read 43 bit unsigned integer in current endian -func (d *D) TryFieldScalarU43(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU43(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(43, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2946,7 +3137,7 @@ func (d *D) TryFieldScalarU43(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU43 adds a field and reads 43 bit unsigned integer in current endian -func (d *D) FieldScalarU43(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU43(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU43(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U43", Pos: d.Pos()}) @@ -2955,14 +3146,14 @@ func (d *D) FieldScalarU43(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU43 tries to add a field and read 43 bit unsigned integer in current endian -func (d *D) TryFieldU43(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU43(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU43(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU43 adds a field and reads 43 bit unsigned integer in current endian -func (d *D) FieldU43(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU43(name, sms...).ActualU() +func (d *D) FieldU43(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU43(name, sms...).Actual } // Reader U44 @@ -2980,11 +3171,10 @@ func (d *D) U44() uint64 { } // TryFieldScalarU44 tries to add a field and read 44 bit unsigned integer in current endian -func (d *D) TryFieldScalarU44(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU44(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(44, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -2993,7 +3183,7 @@ func (d *D) TryFieldScalarU44(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU44 adds a field and reads 44 bit unsigned integer in current endian -func (d *D) FieldScalarU44(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU44(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU44(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U44", Pos: d.Pos()}) @@ -3002,14 +3192,14 @@ func (d *D) FieldScalarU44(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU44 tries to add a field and read 44 bit unsigned integer in current endian -func (d *D) TryFieldU44(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU44(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU44(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU44 adds a field and reads 44 bit unsigned integer in current endian -func (d *D) FieldU44(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU44(name, sms...).ActualU() +func (d *D) FieldU44(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU44(name, sms...).Actual } // Reader U45 @@ -3027,11 +3217,10 @@ func (d *D) U45() uint64 { } // TryFieldScalarU45 tries to add a field and read 45 bit unsigned integer in current endian -func (d *D) TryFieldScalarU45(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU45(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(45, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3040,7 +3229,7 @@ func (d *D) TryFieldScalarU45(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU45 adds a field and reads 45 bit unsigned integer in current endian -func (d *D) FieldScalarU45(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU45(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU45(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U45", Pos: d.Pos()}) @@ -3049,14 +3238,14 @@ func (d *D) FieldScalarU45(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU45 tries to add a field and read 45 bit unsigned integer in current endian -func (d *D) TryFieldU45(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU45(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU45(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU45 adds a field and reads 45 bit unsigned integer in current endian -func (d *D) FieldU45(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU45(name, sms...).ActualU() +func (d *D) FieldU45(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU45(name, sms...).Actual } // Reader U46 @@ -3074,11 +3263,10 @@ func (d *D) U46() uint64 { } // TryFieldScalarU46 tries to add a field and read 46 bit unsigned integer in current endian -func (d *D) TryFieldScalarU46(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU46(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(46, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3087,7 +3275,7 @@ func (d *D) TryFieldScalarU46(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU46 adds a field and reads 46 bit unsigned integer in current endian -func (d *D) FieldScalarU46(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU46(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU46(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U46", Pos: d.Pos()}) @@ -3096,14 +3284,14 @@ func (d *D) FieldScalarU46(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU46 tries to add a field and read 46 bit unsigned integer in current endian -func (d *D) TryFieldU46(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU46(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU46(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU46 adds a field and reads 46 bit unsigned integer in current endian -func (d *D) FieldU46(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU46(name, sms...).ActualU() +func (d *D) FieldU46(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU46(name, sms...).Actual } // Reader U47 @@ -3121,11 +3309,10 @@ func (d *D) U47() uint64 { } // TryFieldScalarU47 tries to add a field and read 47 bit unsigned integer in current endian -func (d *D) TryFieldScalarU47(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU47(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(47, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3134,7 +3321,7 @@ func (d *D) TryFieldScalarU47(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU47 adds a field and reads 47 bit unsigned integer in current endian -func (d *D) FieldScalarU47(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU47(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU47(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U47", Pos: d.Pos()}) @@ -3143,14 +3330,14 @@ func (d *D) FieldScalarU47(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU47 tries to add a field and read 47 bit unsigned integer in current endian -func (d *D) TryFieldU47(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU47(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU47(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU47 adds a field and reads 47 bit unsigned integer in current endian -func (d *D) FieldU47(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU47(name, sms...).ActualU() +func (d *D) FieldU47(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU47(name, sms...).Actual } // Reader U48 @@ -3168,11 +3355,10 @@ func (d *D) U48() uint64 { } // TryFieldScalarU48 tries to add a field and read 48 bit unsigned integer in current endian -func (d *D) TryFieldScalarU48(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU48(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(48, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3181,7 +3367,7 @@ func (d *D) TryFieldScalarU48(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU48 adds a field and reads 48 bit unsigned integer in current endian -func (d *D) FieldScalarU48(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU48(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU48(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U48", Pos: d.Pos()}) @@ -3190,14 +3376,14 @@ func (d *D) FieldScalarU48(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU48 tries to add a field and read 48 bit unsigned integer in current endian -func (d *D) TryFieldU48(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU48(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU48(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU48 adds a field and reads 48 bit unsigned integer in current endian -func (d *D) FieldU48(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU48(name, sms...).ActualU() +func (d *D) FieldU48(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU48(name, sms...).Actual } // Reader U49 @@ -3215,11 +3401,10 @@ func (d *D) U49() uint64 { } // TryFieldScalarU49 tries to add a field and read 49 bit unsigned integer in current endian -func (d *D) TryFieldScalarU49(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU49(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(49, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3228,7 +3413,7 @@ func (d *D) TryFieldScalarU49(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU49 adds a field and reads 49 bit unsigned integer in current endian -func (d *D) FieldScalarU49(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU49(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU49(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U49", Pos: d.Pos()}) @@ -3237,14 +3422,14 @@ func (d *D) FieldScalarU49(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU49 tries to add a field and read 49 bit unsigned integer in current endian -func (d *D) TryFieldU49(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU49(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU49(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU49 adds a field and reads 49 bit unsigned integer in current endian -func (d *D) FieldU49(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU49(name, sms...).ActualU() +func (d *D) FieldU49(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU49(name, sms...).Actual } // Reader U50 @@ -3262,11 +3447,10 @@ func (d *D) U50() uint64 { } // TryFieldScalarU50 tries to add a field and read 50 bit unsigned integer in current endian -func (d *D) TryFieldScalarU50(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU50(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(50, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3275,7 +3459,7 @@ func (d *D) TryFieldScalarU50(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU50 adds a field and reads 50 bit unsigned integer in current endian -func (d *D) FieldScalarU50(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU50(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU50(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U50", Pos: d.Pos()}) @@ -3284,14 +3468,14 @@ func (d *D) FieldScalarU50(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU50 tries to add a field and read 50 bit unsigned integer in current endian -func (d *D) TryFieldU50(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU50(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU50(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU50 adds a field and reads 50 bit unsigned integer in current endian -func (d *D) FieldU50(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU50(name, sms...).ActualU() +func (d *D) FieldU50(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU50(name, sms...).Actual } // Reader U51 @@ -3309,11 +3493,10 @@ func (d *D) U51() uint64 { } // TryFieldScalarU51 tries to add a field and read 51 bit unsigned integer in current endian -func (d *D) TryFieldScalarU51(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU51(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(51, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3322,7 +3505,7 @@ func (d *D) TryFieldScalarU51(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU51 adds a field and reads 51 bit unsigned integer in current endian -func (d *D) FieldScalarU51(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU51(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU51(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U51", Pos: d.Pos()}) @@ -3331,14 +3514,14 @@ func (d *D) FieldScalarU51(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU51 tries to add a field and read 51 bit unsigned integer in current endian -func (d *D) TryFieldU51(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU51(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU51(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU51 adds a field and reads 51 bit unsigned integer in current endian -func (d *D) FieldU51(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU51(name, sms...).ActualU() +func (d *D) FieldU51(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU51(name, sms...).Actual } // Reader U52 @@ -3356,11 +3539,10 @@ func (d *D) U52() uint64 { } // TryFieldScalarU52 tries to add a field and read 52 bit unsigned integer in current endian -func (d *D) TryFieldScalarU52(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU52(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(52, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3369,7 +3551,7 @@ func (d *D) TryFieldScalarU52(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU52 adds a field and reads 52 bit unsigned integer in current endian -func (d *D) FieldScalarU52(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU52(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU52(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U52", Pos: d.Pos()}) @@ -3378,14 +3560,14 @@ func (d *D) FieldScalarU52(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU52 tries to add a field and read 52 bit unsigned integer in current endian -func (d *D) TryFieldU52(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU52(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU52(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU52 adds a field and reads 52 bit unsigned integer in current endian -func (d *D) FieldU52(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU52(name, sms...).ActualU() +func (d *D) FieldU52(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU52(name, sms...).Actual } // Reader U53 @@ -3403,11 +3585,10 @@ func (d *D) U53() uint64 { } // TryFieldScalarU53 tries to add a field and read 53 bit unsigned integer in current endian -func (d *D) TryFieldScalarU53(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU53(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(53, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3416,7 +3597,7 @@ func (d *D) TryFieldScalarU53(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU53 adds a field and reads 53 bit unsigned integer in current endian -func (d *D) FieldScalarU53(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU53(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU53(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U53", Pos: d.Pos()}) @@ -3425,14 +3606,14 @@ func (d *D) FieldScalarU53(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU53 tries to add a field and read 53 bit unsigned integer in current endian -func (d *D) TryFieldU53(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU53(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU53(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU53 adds a field and reads 53 bit unsigned integer in current endian -func (d *D) FieldU53(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU53(name, sms...).ActualU() +func (d *D) FieldU53(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU53(name, sms...).Actual } // Reader U54 @@ -3450,11 +3631,10 @@ func (d *D) U54() uint64 { } // TryFieldScalarU54 tries to add a field and read 54 bit unsigned integer in current endian -func (d *D) TryFieldScalarU54(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU54(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(54, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3463,7 +3643,7 @@ func (d *D) TryFieldScalarU54(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU54 adds a field and reads 54 bit unsigned integer in current endian -func (d *D) FieldScalarU54(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU54(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU54(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U54", Pos: d.Pos()}) @@ -3472,14 +3652,14 @@ func (d *D) FieldScalarU54(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU54 tries to add a field and read 54 bit unsigned integer in current endian -func (d *D) TryFieldU54(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU54(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU54(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU54 adds a field and reads 54 bit unsigned integer in current endian -func (d *D) FieldU54(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU54(name, sms...).ActualU() +func (d *D) FieldU54(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU54(name, sms...).Actual } // Reader U55 @@ -3497,11 +3677,10 @@ func (d *D) U55() uint64 { } // TryFieldScalarU55 tries to add a field and read 55 bit unsigned integer in current endian -func (d *D) TryFieldScalarU55(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU55(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(55, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3510,7 +3689,7 @@ func (d *D) TryFieldScalarU55(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU55 adds a field and reads 55 bit unsigned integer in current endian -func (d *D) FieldScalarU55(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU55(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU55(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U55", Pos: d.Pos()}) @@ -3519,14 +3698,14 @@ func (d *D) FieldScalarU55(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU55 tries to add a field and read 55 bit unsigned integer in current endian -func (d *D) TryFieldU55(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU55(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU55(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU55 adds a field and reads 55 bit unsigned integer in current endian -func (d *D) FieldU55(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU55(name, sms...).ActualU() +func (d *D) FieldU55(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU55(name, sms...).Actual } // Reader U56 @@ -3544,11 +3723,10 @@ func (d *D) U56() uint64 { } // TryFieldScalarU56 tries to add a field and read 56 bit unsigned integer in current endian -func (d *D) TryFieldScalarU56(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU56(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(56, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3557,7 +3735,7 @@ func (d *D) TryFieldScalarU56(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU56 adds a field and reads 56 bit unsigned integer in current endian -func (d *D) FieldScalarU56(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU56(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU56(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U56", Pos: d.Pos()}) @@ -3566,14 +3744,14 @@ func (d *D) FieldScalarU56(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU56 tries to add a field and read 56 bit unsigned integer in current endian -func (d *D) TryFieldU56(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU56(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU56(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU56 adds a field and reads 56 bit unsigned integer in current endian -func (d *D) FieldU56(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU56(name, sms...).ActualU() +func (d *D) FieldU56(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU56(name, sms...).Actual } // Reader U57 @@ -3591,11 +3769,10 @@ func (d *D) U57() uint64 { } // TryFieldScalarU57 tries to add a field and read 57 bit unsigned integer in current endian -func (d *D) TryFieldScalarU57(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU57(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(57, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3604,7 +3781,7 @@ func (d *D) TryFieldScalarU57(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU57 adds a field and reads 57 bit unsigned integer in current endian -func (d *D) FieldScalarU57(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU57(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU57(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U57", Pos: d.Pos()}) @@ -3613,14 +3790,14 @@ func (d *D) FieldScalarU57(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU57 tries to add a field and read 57 bit unsigned integer in current endian -func (d *D) TryFieldU57(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU57(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU57(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU57 adds a field and reads 57 bit unsigned integer in current endian -func (d *D) FieldU57(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU57(name, sms...).ActualU() +func (d *D) FieldU57(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU57(name, sms...).Actual } // Reader U58 @@ -3638,11 +3815,10 @@ func (d *D) U58() uint64 { } // TryFieldScalarU58 tries to add a field and read 58 bit unsigned integer in current endian -func (d *D) TryFieldScalarU58(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU58(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(58, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3651,7 +3827,7 @@ func (d *D) TryFieldScalarU58(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU58 adds a field and reads 58 bit unsigned integer in current endian -func (d *D) FieldScalarU58(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU58(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU58(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U58", Pos: d.Pos()}) @@ -3660,14 +3836,14 @@ func (d *D) FieldScalarU58(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU58 tries to add a field and read 58 bit unsigned integer in current endian -func (d *D) TryFieldU58(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU58(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU58(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU58 adds a field and reads 58 bit unsigned integer in current endian -func (d *D) FieldU58(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU58(name, sms...).ActualU() +func (d *D) FieldU58(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU58(name, sms...).Actual } // Reader U59 @@ -3685,11 +3861,10 @@ func (d *D) U59() uint64 { } // TryFieldScalarU59 tries to add a field and read 59 bit unsigned integer in current endian -func (d *D) TryFieldScalarU59(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU59(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(59, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3698,7 +3873,7 @@ func (d *D) TryFieldScalarU59(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU59 adds a field and reads 59 bit unsigned integer in current endian -func (d *D) FieldScalarU59(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU59(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU59(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U59", Pos: d.Pos()}) @@ -3707,14 +3882,14 @@ func (d *D) FieldScalarU59(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU59 tries to add a field and read 59 bit unsigned integer in current endian -func (d *D) TryFieldU59(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU59(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU59(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU59 adds a field and reads 59 bit unsigned integer in current endian -func (d *D) FieldU59(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU59(name, sms...).ActualU() +func (d *D) FieldU59(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU59(name, sms...).Actual } // Reader U60 @@ -3732,11 +3907,10 @@ func (d *D) U60() uint64 { } // TryFieldScalarU60 tries to add a field and read 60 bit unsigned integer in current endian -func (d *D) TryFieldScalarU60(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU60(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(60, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3745,7 +3919,7 @@ func (d *D) TryFieldScalarU60(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU60 adds a field and reads 60 bit unsigned integer in current endian -func (d *D) FieldScalarU60(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU60(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU60(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U60", Pos: d.Pos()}) @@ -3754,14 +3928,14 @@ func (d *D) FieldScalarU60(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU60 tries to add a field and read 60 bit unsigned integer in current endian -func (d *D) TryFieldU60(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU60(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU60(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU60 adds a field and reads 60 bit unsigned integer in current endian -func (d *D) FieldU60(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU60(name, sms...).ActualU() +func (d *D) FieldU60(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU60(name, sms...).Actual } // Reader U61 @@ -3779,11 +3953,10 @@ func (d *D) U61() uint64 { } // TryFieldScalarU61 tries to add a field and read 61 bit unsigned integer in current endian -func (d *D) TryFieldScalarU61(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU61(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(61, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3792,7 +3965,7 @@ func (d *D) TryFieldScalarU61(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU61 adds a field and reads 61 bit unsigned integer in current endian -func (d *D) FieldScalarU61(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU61(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU61(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U61", Pos: d.Pos()}) @@ -3801,14 +3974,14 @@ func (d *D) FieldScalarU61(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU61 tries to add a field and read 61 bit unsigned integer in current endian -func (d *D) TryFieldU61(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU61(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU61(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU61 adds a field and reads 61 bit unsigned integer in current endian -func (d *D) FieldU61(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU61(name, sms...).ActualU() +func (d *D) FieldU61(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU61(name, sms...).Actual } // Reader U62 @@ -3826,11 +3999,10 @@ func (d *D) U62() uint64 { } // TryFieldScalarU62 tries to add a field and read 62 bit unsigned integer in current endian -func (d *D) TryFieldScalarU62(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU62(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(62, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3839,7 +4011,7 @@ func (d *D) TryFieldScalarU62(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU62 adds a field and reads 62 bit unsigned integer in current endian -func (d *D) FieldScalarU62(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU62(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU62(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U62", Pos: d.Pos()}) @@ -3848,14 +4020,14 @@ func (d *D) FieldScalarU62(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU62 tries to add a field and read 62 bit unsigned integer in current endian -func (d *D) TryFieldU62(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU62(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU62(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU62 adds a field and reads 62 bit unsigned integer in current endian -func (d *D) FieldU62(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU62(name, sms...).ActualU() +func (d *D) FieldU62(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU62(name, sms...).Actual } // Reader U63 @@ -3873,11 +4045,10 @@ func (d *D) U63() uint64 { } // TryFieldScalarU63 tries to add a field and read 63 bit unsigned integer in current endian -func (d *D) TryFieldScalarU63(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU63(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(63, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3886,7 +4057,7 @@ func (d *D) TryFieldScalarU63(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU63 adds a field and reads 63 bit unsigned integer in current endian -func (d *D) FieldScalarU63(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU63(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU63(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U63", Pos: d.Pos()}) @@ -3895,14 +4066,14 @@ func (d *D) FieldScalarU63(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU63 tries to add a field and read 63 bit unsigned integer in current endian -func (d *D) TryFieldU63(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU63(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU63(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU63 adds a field and reads 63 bit unsigned integer in current endian -func (d *D) FieldU63(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU63(name, sms...).ActualU() +func (d *D) FieldU63(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU63(name, sms...).Actual } // Reader U64 @@ -3920,11 +4091,10 @@ func (d *D) U64() uint64 { } // TryFieldScalarU64 tries to add a field and read 64 bit unsigned integer in current endian -func (d *D) TryFieldScalarU64(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU64(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(64, d.Endian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3933,7 +4103,7 @@ func (d *D) TryFieldScalarU64(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarU64 adds a field and reads 64 bit unsigned integer in current endian -func (d *D) FieldScalarU64(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU64(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU64(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U64", Pos: d.Pos()}) @@ -3942,14 +4112,14 @@ func (d *D) FieldScalarU64(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU64 tries to add a field and read 64 bit unsigned integer in current endian -func (d *D) TryFieldU64(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU64(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU64(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU64 adds a field and reads 64 bit unsigned integer in current endian -func (d *D) FieldU64(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU64(name, sms...).ActualU() +func (d *D) FieldU64(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU64(name, sms...).Actual } // Reader U8LE @@ -3967,11 +4137,10 @@ func (d *D) U8LE() uint64 { } // TryFieldScalarU8LE tries to add a field and read 8 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU8LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU8LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(8, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -3980,7 +4149,7 @@ func (d *D) TryFieldScalarU8LE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarU8LE adds a field and reads 8 bit unsigned integer in little-endian -func (d *D) FieldScalarU8LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU8LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU8LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U8LE", Pos: d.Pos()}) @@ -3989,14 +4158,14 @@ func (d *D) FieldScalarU8LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU8LE tries to add a field and read 8 bit unsigned integer in little-endian -func (d *D) TryFieldU8LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU8LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU8LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU8LE adds a field and reads 8 bit unsigned integer in little-endian -func (d *D) FieldU8LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU8LE(name, sms...).ActualU() +func (d *D) FieldU8LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU8LE(name, sms...).Actual } // Reader U9LE @@ -4014,11 +4183,10 @@ func (d *D) U9LE() uint64 { } // TryFieldScalarU9LE tries to add a field and read 9 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU9LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU9LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(9, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4027,7 +4195,7 @@ func (d *D) TryFieldScalarU9LE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarU9LE adds a field and reads 9 bit unsigned integer in little-endian -func (d *D) FieldScalarU9LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU9LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU9LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U9LE", Pos: d.Pos()}) @@ -4036,14 +4204,14 @@ func (d *D) FieldScalarU9LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU9LE tries to add a field and read 9 bit unsigned integer in little-endian -func (d *D) TryFieldU9LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU9LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU9LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU9LE adds a field and reads 9 bit unsigned integer in little-endian -func (d *D) FieldU9LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU9LE(name, sms...).ActualU() +func (d *D) FieldU9LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU9LE(name, sms...).Actual } // Reader U10LE @@ -4061,11 +4229,10 @@ func (d *D) U10LE() uint64 { } // TryFieldScalarU10LE tries to add a field and read 10 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU10LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU10LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(10, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4074,7 +4241,7 @@ func (d *D) TryFieldScalarU10LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU10LE adds a field and reads 10 bit unsigned integer in little-endian -func (d *D) FieldScalarU10LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU10LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU10LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U10LE", Pos: d.Pos()}) @@ -4083,14 +4250,14 @@ func (d *D) FieldScalarU10LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU10LE tries to add a field and read 10 bit unsigned integer in little-endian -func (d *D) TryFieldU10LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU10LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU10LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU10LE adds a field and reads 10 bit unsigned integer in little-endian -func (d *D) FieldU10LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU10LE(name, sms...).ActualU() +func (d *D) FieldU10LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU10LE(name, sms...).Actual } // Reader U11LE @@ -4108,11 +4275,10 @@ func (d *D) U11LE() uint64 { } // TryFieldScalarU11LE tries to add a field and read 11 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU11LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU11LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(11, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4121,7 +4287,7 @@ func (d *D) TryFieldScalarU11LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU11LE adds a field and reads 11 bit unsigned integer in little-endian -func (d *D) FieldScalarU11LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU11LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU11LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U11LE", Pos: d.Pos()}) @@ -4130,14 +4296,14 @@ func (d *D) FieldScalarU11LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU11LE tries to add a field and read 11 bit unsigned integer in little-endian -func (d *D) TryFieldU11LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU11LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU11LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU11LE adds a field and reads 11 bit unsigned integer in little-endian -func (d *D) FieldU11LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU11LE(name, sms...).ActualU() +func (d *D) FieldU11LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU11LE(name, sms...).Actual } // Reader U12LE @@ -4155,11 +4321,10 @@ func (d *D) U12LE() uint64 { } // TryFieldScalarU12LE tries to add a field and read 12 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU12LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU12LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(12, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4168,7 +4333,7 @@ func (d *D) TryFieldScalarU12LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU12LE adds a field and reads 12 bit unsigned integer in little-endian -func (d *D) FieldScalarU12LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU12LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU12LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U12LE", Pos: d.Pos()}) @@ -4177,14 +4342,14 @@ func (d *D) FieldScalarU12LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU12LE tries to add a field and read 12 bit unsigned integer in little-endian -func (d *D) TryFieldU12LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU12LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU12LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU12LE adds a field and reads 12 bit unsigned integer in little-endian -func (d *D) FieldU12LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU12LE(name, sms...).ActualU() +func (d *D) FieldU12LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU12LE(name, sms...).Actual } // Reader U13LE @@ -4202,11 +4367,10 @@ func (d *D) U13LE() uint64 { } // TryFieldScalarU13LE tries to add a field and read 13 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU13LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU13LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(13, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4215,7 +4379,7 @@ func (d *D) TryFieldScalarU13LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU13LE adds a field and reads 13 bit unsigned integer in little-endian -func (d *D) FieldScalarU13LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU13LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU13LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U13LE", Pos: d.Pos()}) @@ -4224,14 +4388,14 @@ func (d *D) FieldScalarU13LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU13LE tries to add a field and read 13 bit unsigned integer in little-endian -func (d *D) TryFieldU13LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU13LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU13LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU13LE adds a field and reads 13 bit unsigned integer in little-endian -func (d *D) FieldU13LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU13LE(name, sms...).ActualU() +func (d *D) FieldU13LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU13LE(name, sms...).Actual } // Reader U14LE @@ -4249,11 +4413,10 @@ func (d *D) U14LE() uint64 { } // TryFieldScalarU14LE tries to add a field and read 14 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU14LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU14LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(14, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4262,7 +4425,7 @@ func (d *D) TryFieldScalarU14LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU14LE adds a field and reads 14 bit unsigned integer in little-endian -func (d *D) FieldScalarU14LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU14LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU14LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U14LE", Pos: d.Pos()}) @@ -4271,14 +4434,14 @@ func (d *D) FieldScalarU14LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU14LE tries to add a field and read 14 bit unsigned integer in little-endian -func (d *D) TryFieldU14LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU14LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU14LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU14LE adds a field and reads 14 bit unsigned integer in little-endian -func (d *D) FieldU14LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU14LE(name, sms...).ActualU() +func (d *D) FieldU14LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU14LE(name, sms...).Actual } // Reader U15LE @@ -4296,11 +4459,10 @@ func (d *D) U15LE() uint64 { } // TryFieldScalarU15LE tries to add a field and read 15 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU15LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU15LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(15, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4309,7 +4471,7 @@ func (d *D) TryFieldScalarU15LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU15LE adds a field and reads 15 bit unsigned integer in little-endian -func (d *D) FieldScalarU15LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU15LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU15LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U15LE", Pos: d.Pos()}) @@ -4318,14 +4480,14 @@ func (d *D) FieldScalarU15LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU15LE tries to add a field and read 15 bit unsigned integer in little-endian -func (d *D) TryFieldU15LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU15LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU15LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU15LE adds a field and reads 15 bit unsigned integer in little-endian -func (d *D) FieldU15LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU15LE(name, sms...).ActualU() +func (d *D) FieldU15LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU15LE(name, sms...).Actual } // Reader U16LE @@ -4343,11 +4505,10 @@ func (d *D) U16LE() uint64 { } // TryFieldScalarU16LE tries to add a field and read 16 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU16LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU16LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(16, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4356,7 +4517,7 @@ func (d *D) TryFieldScalarU16LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU16LE adds a field and reads 16 bit unsigned integer in little-endian -func (d *D) FieldScalarU16LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU16LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU16LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U16LE", Pos: d.Pos()}) @@ -4365,14 +4526,14 @@ func (d *D) FieldScalarU16LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU16LE tries to add a field and read 16 bit unsigned integer in little-endian -func (d *D) TryFieldU16LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU16LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU16LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU16LE adds a field and reads 16 bit unsigned integer in little-endian -func (d *D) FieldU16LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU16LE(name, sms...).ActualU() +func (d *D) FieldU16LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU16LE(name, sms...).Actual } // Reader U17LE @@ -4390,11 +4551,10 @@ func (d *D) U17LE() uint64 { } // TryFieldScalarU17LE tries to add a field and read 17 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU17LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU17LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(17, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4403,7 +4563,7 @@ func (d *D) TryFieldScalarU17LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU17LE adds a field and reads 17 bit unsigned integer in little-endian -func (d *D) FieldScalarU17LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU17LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU17LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U17LE", Pos: d.Pos()}) @@ -4412,14 +4572,14 @@ func (d *D) FieldScalarU17LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU17LE tries to add a field and read 17 bit unsigned integer in little-endian -func (d *D) TryFieldU17LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU17LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU17LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU17LE adds a field and reads 17 bit unsigned integer in little-endian -func (d *D) FieldU17LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU17LE(name, sms...).ActualU() +func (d *D) FieldU17LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU17LE(name, sms...).Actual } // Reader U18LE @@ -4437,11 +4597,10 @@ func (d *D) U18LE() uint64 { } // TryFieldScalarU18LE tries to add a field and read 18 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU18LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU18LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(18, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4450,7 +4609,7 @@ func (d *D) TryFieldScalarU18LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU18LE adds a field and reads 18 bit unsigned integer in little-endian -func (d *D) FieldScalarU18LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU18LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU18LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U18LE", Pos: d.Pos()}) @@ -4459,14 +4618,14 @@ func (d *D) FieldScalarU18LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU18LE tries to add a field and read 18 bit unsigned integer in little-endian -func (d *D) TryFieldU18LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU18LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU18LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU18LE adds a field and reads 18 bit unsigned integer in little-endian -func (d *D) FieldU18LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU18LE(name, sms...).ActualU() +func (d *D) FieldU18LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU18LE(name, sms...).Actual } // Reader U19LE @@ -4484,11 +4643,10 @@ func (d *D) U19LE() uint64 { } // TryFieldScalarU19LE tries to add a field and read 19 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU19LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU19LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(19, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4497,7 +4655,7 @@ func (d *D) TryFieldScalarU19LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU19LE adds a field and reads 19 bit unsigned integer in little-endian -func (d *D) FieldScalarU19LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU19LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU19LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U19LE", Pos: d.Pos()}) @@ -4506,14 +4664,14 @@ func (d *D) FieldScalarU19LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU19LE tries to add a field and read 19 bit unsigned integer in little-endian -func (d *D) TryFieldU19LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU19LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU19LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU19LE adds a field and reads 19 bit unsigned integer in little-endian -func (d *D) FieldU19LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU19LE(name, sms...).ActualU() +func (d *D) FieldU19LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU19LE(name, sms...).Actual } // Reader U20LE @@ -4531,11 +4689,10 @@ func (d *D) U20LE() uint64 { } // TryFieldScalarU20LE tries to add a field and read 20 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU20LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU20LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(20, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4544,7 +4701,7 @@ func (d *D) TryFieldScalarU20LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU20LE adds a field and reads 20 bit unsigned integer in little-endian -func (d *D) FieldScalarU20LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU20LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU20LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U20LE", Pos: d.Pos()}) @@ -4553,14 +4710,14 @@ func (d *D) FieldScalarU20LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU20LE tries to add a field and read 20 bit unsigned integer in little-endian -func (d *D) TryFieldU20LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU20LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU20LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU20LE adds a field and reads 20 bit unsigned integer in little-endian -func (d *D) FieldU20LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU20LE(name, sms...).ActualU() +func (d *D) FieldU20LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU20LE(name, sms...).Actual } // Reader U21LE @@ -4578,11 +4735,10 @@ func (d *D) U21LE() uint64 { } // TryFieldScalarU21LE tries to add a field and read 21 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU21LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU21LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(21, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4591,7 +4747,7 @@ func (d *D) TryFieldScalarU21LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU21LE adds a field and reads 21 bit unsigned integer in little-endian -func (d *D) FieldScalarU21LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU21LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU21LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U21LE", Pos: d.Pos()}) @@ -4600,14 +4756,14 @@ func (d *D) FieldScalarU21LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU21LE tries to add a field and read 21 bit unsigned integer in little-endian -func (d *D) TryFieldU21LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU21LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU21LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU21LE adds a field and reads 21 bit unsigned integer in little-endian -func (d *D) FieldU21LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU21LE(name, sms...).ActualU() +func (d *D) FieldU21LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU21LE(name, sms...).Actual } // Reader U22LE @@ -4625,11 +4781,10 @@ func (d *D) U22LE() uint64 { } // TryFieldScalarU22LE tries to add a field and read 22 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU22LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU22LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(22, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4638,7 +4793,7 @@ func (d *D) TryFieldScalarU22LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU22LE adds a field and reads 22 bit unsigned integer in little-endian -func (d *D) FieldScalarU22LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU22LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU22LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U22LE", Pos: d.Pos()}) @@ -4647,14 +4802,14 @@ func (d *D) FieldScalarU22LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU22LE tries to add a field and read 22 bit unsigned integer in little-endian -func (d *D) TryFieldU22LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU22LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU22LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU22LE adds a field and reads 22 bit unsigned integer in little-endian -func (d *D) FieldU22LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU22LE(name, sms...).ActualU() +func (d *D) FieldU22LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU22LE(name, sms...).Actual } // Reader U23LE @@ -4672,11 +4827,10 @@ func (d *D) U23LE() uint64 { } // TryFieldScalarU23LE tries to add a field and read 23 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU23LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU23LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(23, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4685,7 +4839,7 @@ func (d *D) TryFieldScalarU23LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU23LE adds a field and reads 23 bit unsigned integer in little-endian -func (d *D) FieldScalarU23LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU23LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU23LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U23LE", Pos: d.Pos()}) @@ -4694,14 +4848,14 @@ func (d *D) FieldScalarU23LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU23LE tries to add a field and read 23 bit unsigned integer in little-endian -func (d *D) TryFieldU23LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU23LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU23LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU23LE adds a field and reads 23 bit unsigned integer in little-endian -func (d *D) FieldU23LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU23LE(name, sms...).ActualU() +func (d *D) FieldU23LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU23LE(name, sms...).Actual } // Reader U24LE @@ -4719,11 +4873,10 @@ func (d *D) U24LE() uint64 { } // TryFieldScalarU24LE tries to add a field and read 24 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU24LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU24LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(24, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4732,7 +4885,7 @@ func (d *D) TryFieldScalarU24LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU24LE adds a field and reads 24 bit unsigned integer in little-endian -func (d *D) FieldScalarU24LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU24LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU24LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U24LE", Pos: d.Pos()}) @@ -4741,14 +4894,14 @@ func (d *D) FieldScalarU24LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU24LE tries to add a field and read 24 bit unsigned integer in little-endian -func (d *D) TryFieldU24LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU24LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU24LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU24LE adds a field and reads 24 bit unsigned integer in little-endian -func (d *D) FieldU24LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU24LE(name, sms...).ActualU() +func (d *D) FieldU24LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU24LE(name, sms...).Actual } // Reader U25LE @@ -4766,11 +4919,10 @@ func (d *D) U25LE() uint64 { } // TryFieldScalarU25LE tries to add a field and read 25 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU25LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU25LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(25, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4779,7 +4931,7 @@ func (d *D) TryFieldScalarU25LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU25LE adds a field and reads 25 bit unsigned integer in little-endian -func (d *D) FieldScalarU25LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU25LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU25LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U25LE", Pos: d.Pos()}) @@ -4788,14 +4940,14 @@ func (d *D) FieldScalarU25LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU25LE tries to add a field and read 25 bit unsigned integer in little-endian -func (d *D) TryFieldU25LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU25LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU25LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU25LE adds a field and reads 25 bit unsigned integer in little-endian -func (d *D) FieldU25LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU25LE(name, sms...).ActualU() +func (d *D) FieldU25LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU25LE(name, sms...).Actual } // Reader U26LE @@ -4813,11 +4965,10 @@ func (d *D) U26LE() uint64 { } // TryFieldScalarU26LE tries to add a field and read 26 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU26LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU26LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(26, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4826,7 +4977,7 @@ func (d *D) TryFieldScalarU26LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU26LE adds a field and reads 26 bit unsigned integer in little-endian -func (d *D) FieldScalarU26LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU26LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU26LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U26LE", Pos: d.Pos()}) @@ -4835,14 +4986,14 @@ func (d *D) FieldScalarU26LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU26LE tries to add a field and read 26 bit unsigned integer in little-endian -func (d *D) TryFieldU26LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU26LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU26LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU26LE adds a field and reads 26 bit unsigned integer in little-endian -func (d *D) FieldU26LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU26LE(name, sms...).ActualU() +func (d *D) FieldU26LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU26LE(name, sms...).Actual } // Reader U27LE @@ -4860,11 +5011,10 @@ func (d *D) U27LE() uint64 { } // TryFieldScalarU27LE tries to add a field and read 27 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU27LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU27LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(27, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4873,7 +5023,7 @@ func (d *D) TryFieldScalarU27LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU27LE adds a field and reads 27 bit unsigned integer in little-endian -func (d *D) FieldScalarU27LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU27LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU27LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U27LE", Pos: d.Pos()}) @@ -4882,14 +5032,14 @@ func (d *D) FieldScalarU27LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU27LE tries to add a field and read 27 bit unsigned integer in little-endian -func (d *D) TryFieldU27LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU27LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU27LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU27LE adds a field and reads 27 bit unsigned integer in little-endian -func (d *D) FieldU27LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU27LE(name, sms...).ActualU() +func (d *D) FieldU27LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU27LE(name, sms...).Actual } // Reader U28LE @@ -4907,11 +5057,10 @@ func (d *D) U28LE() uint64 { } // TryFieldScalarU28LE tries to add a field and read 28 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU28LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU28LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(28, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4920,7 +5069,7 @@ func (d *D) TryFieldScalarU28LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU28LE adds a field and reads 28 bit unsigned integer in little-endian -func (d *D) FieldScalarU28LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU28LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU28LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U28LE", Pos: d.Pos()}) @@ -4929,14 +5078,14 @@ func (d *D) FieldScalarU28LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU28LE tries to add a field and read 28 bit unsigned integer in little-endian -func (d *D) TryFieldU28LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU28LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU28LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU28LE adds a field and reads 28 bit unsigned integer in little-endian -func (d *D) FieldU28LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU28LE(name, sms...).ActualU() +func (d *D) FieldU28LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU28LE(name, sms...).Actual } // Reader U29LE @@ -4954,11 +5103,10 @@ func (d *D) U29LE() uint64 { } // TryFieldScalarU29LE tries to add a field and read 29 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU29LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU29LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(29, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -4967,7 +5115,7 @@ func (d *D) TryFieldScalarU29LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU29LE adds a field and reads 29 bit unsigned integer in little-endian -func (d *D) FieldScalarU29LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU29LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU29LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U29LE", Pos: d.Pos()}) @@ -4976,14 +5124,14 @@ func (d *D) FieldScalarU29LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU29LE tries to add a field and read 29 bit unsigned integer in little-endian -func (d *D) TryFieldU29LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU29LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU29LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU29LE adds a field and reads 29 bit unsigned integer in little-endian -func (d *D) FieldU29LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU29LE(name, sms...).ActualU() +func (d *D) FieldU29LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU29LE(name, sms...).Actual } // Reader U30LE @@ -5001,11 +5149,10 @@ func (d *D) U30LE() uint64 { } // TryFieldScalarU30LE tries to add a field and read 30 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU30LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU30LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(30, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5014,7 +5161,7 @@ func (d *D) TryFieldScalarU30LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU30LE adds a field and reads 30 bit unsigned integer in little-endian -func (d *D) FieldScalarU30LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU30LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU30LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U30LE", Pos: d.Pos()}) @@ -5023,14 +5170,14 @@ func (d *D) FieldScalarU30LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU30LE tries to add a field and read 30 bit unsigned integer in little-endian -func (d *D) TryFieldU30LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU30LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU30LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU30LE adds a field and reads 30 bit unsigned integer in little-endian -func (d *D) FieldU30LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU30LE(name, sms...).ActualU() +func (d *D) FieldU30LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU30LE(name, sms...).Actual } // Reader U31LE @@ -5048,11 +5195,10 @@ func (d *D) U31LE() uint64 { } // TryFieldScalarU31LE tries to add a field and read 31 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU31LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU31LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(31, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5061,7 +5207,7 @@ func (d *D) TryFieldScalarU31LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU31LE adds a field and reads 31 bit unsigned integer in little-endian -func (d *D) FieldScalarU31LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU31LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU31LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U31LE", Pos: d.Pos()}) @@ -5070,14 +5216,14 @@ func (d *D) FieldScalarU31LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU31LE tries to add a field and read 31 bit unsigned integer in little-endian -func (d *D) TryFieldU31LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU31LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU31LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU31LE adds a field and reads 31 bit unsigned integer in little-endian -func (d *D) FieldU31LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU31LE(name, sms...).ActualU() +func (d *D) FieldU31LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU31LE(name, sms...).Actual } // Reader U32LE @@ -5095,11 +5241,10 @@ func (d *D) U32LE() uint64 { } // TryFieldScalarU32LE tries to add a field and read 32 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU32LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU32LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(32, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5108,7 +5253,7 @@ func (d *D) TryFieldScalarU32LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU32LE adds a field and reads 32 bit unsigned integer in little-endian -func (d *D) FieldScalarU32LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU32LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU32LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U32LE", Pos: d.Pos()}) @@ -5117,14 +5262,14 @@ func (d *D) FieldScalarU32LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU32LE tries to add a field and read 32 bit unsigned integer in little-endian -func (d *D) TryFieldU32LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU32LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU32LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU32LE adds a field and reads 32 bit unsigned integer in little-endian -func (d *D) FieldU32LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU32LE(name, sms...).ActualU() +func (d *D) FieldU32LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU32LE(name, sms...).Actual } // Reader U33LE @@ -5142,11 +5287,10 @@ func (d *D) U33LE() uint64 { } // TryFieldScalarU33LE tries to add a field and read 33 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU33LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU33LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(33, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5155,7 +5299,7 @@ func (d *D) TryFieldScalarU33LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU33LE adds a field and reads 33 bit unsigned integer in little-endian -func (d *D) FieldScalarU33LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU33LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU33LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U33LE", Pos: d.Pos()}) @@ -5164,14 +5308,14 @@ func (d *D) FieldScalarU33LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU33LE tries to add a field and read 33 bit unsigned integer in little-endian -func (d *D) TryFieldU33LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU33LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU33LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU33LE adds a field and reads 33 bit unsigned integer in little-endian -func (d *D) FieldU33LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU33LE(name, sms...).ActualU() +func (d *D) FieldU33LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU33LE(name, sms...).Actual } // Reader U34LE @@ -5189,11 +5333,10 @@ func (d *D) U34LE() uint64 { } // TryFieldScalarU34LE tries to add a field and read 34 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU34LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU34LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(34, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5202,7 +5345,7 @@ func (d *D) TryFieldScalarU34LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU34LE adds a field and reads 34 bit unsigned integer in little-endian -func (d *D) FieldScalarU34LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU34LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU34LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U34LE", Pos: d.Pos()}) @@ -5211,14 +5354,14 @@ func (d *D) FieldScalarU34LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU34LE tries to add a field and read 34 bit unsigned integer in little-endian -func (d *D) TryFieldU34LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU34LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU34LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU34LE adds a field and reads 34 bit unsigned integer in little-endian -func (d *D) FieldU34LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU34LE(name, sms...).ActualU() +func (d *D) FieldU34LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU34LE(name, sms...).Actual } // Reader U35LE @@ -5236,11 +5379,10 @@ func (d *D) U35LE() uint64 { } // TryFieldScalarU35LE tries to add a field and read 35 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU35LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU35LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(35, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5249,7 +5391,7 @@ func (d *D) TryFieldScalarU35LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU35LE adds a field and reads 35 bit unsigned integer in little-endian -func (d *D) FieldScalarU35LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU35LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU35LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U35LE", Pos: d.Pos()}) @@ -5258,14 +5400,14 @@ func (d *D) FieldScalarU35LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU35LE tries to add a field and read 35 bit unsigned integer in little-endian -func (d *D) TryFieldU35LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU35LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU35LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU35LE adds a field and reads 35 bit unsigned integer in little-endian -func (d *D) FieldU35LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU35LE(name, sms...).ActualU() +func (d *D) FieldU35LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU35LE(name, sms...).Actual } // Reader U36LE @@ -5283,11 +5425,10 @@ func (d *D) U36LE() uint64 { } // TryFieldScalarU36LE tries to add a field and read 36 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU36LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU36LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(36, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5296,7 +5437,7 @@ func (d *D) TryFieldScalarU36LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU36LE adds a field and reads 36 bit unsigned integer in little-endian -func (d *D) FieldScalarU36LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU36LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU36LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U36LE", Pos: d.Pos()}) @@ -5305,14 +5446,14 @@ func (d *D) FieldScalarU36LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU36LE tries to add a field and read 36 bit unsigned integer in little-endian -func (d *D) TryFieldU36LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU36LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU36LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU36LE adds a field and reads 36 bit unsigned integer in little-endian -func (d *D) FieldU36LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU36LE(name, sms...).ActualU() +func (d *D) FieldU36LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU36LE(name, sms...).Actual } // Reader U37LE @@ -5330,11 +5471,10 @@ func (d *D) U37LE() uint64 { } // TryFieldScalarU37LE tries to add a field and read 37 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU37LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU37LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(37, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5343,7 +5483,7 @@ func (d *D) TryFieldScalarU37LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU37LE adds a field and reads 37 bit unsigned integer in little-endian -func (d *D) FieldScalarU37LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU37LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU37LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U37LE", Pos: d.Pos()}) @@ -5352,14 +5492,14 @@ func (d *D) FieldScalarU37LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU37LE tries to add a field and read 37 bit unsigned integer in little-endian -func (d *D) TryFieldU37LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU37LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU37LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU37LE adds a field and reads 37 bit unsigned integer in little-endian -func (d *D) FieldU37LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU37LE(name, sms...).ActualU() +func (d *D) FieldU37LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU37LE(name, sms...).Actual } // Reader U38LE @@ -5377,11 +5517,10 @@ func (d *D) U38LE() uint64 { } // TryFieldScalarU38LE tries to add a field and read 38 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU38LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU38LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(38, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5390,7 +5529,7 @@ func (d *D) TryFieldScalarU38LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU38LE adds a field and reads 38 bit unsigned integer in little-endian -func (d *D) FieldScalarU38LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU38LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU38LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U38LE", Pos: d.Pos()}) @@ -5399,14 +5538,14 @@ func (d *D) FieldScalarU38LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU38LE tries to add a field and read 38 bit unsigned integer in little-endian -func (d *D) TryFieldU38LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU38LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU38LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU38LE adds a field and reads 38 bit unsigned integer in little-endian -func (d *D) FieldU38LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU38LE(name, sms...).ActualU() +func (d *D) FieldU38LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU38LE(name, sms...).Actual } // Reader U39LE @@ -5424,11 +5563,10 @@ func (d *D) U39LE() uint64 { } // TryFieldScalarU39LE tries to add a field and read 39 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU39LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU39LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(39, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5437,7 +5575,7 @@ func (d *D) TryFieldScalarU39LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU39LE adds a field and reads 39 bit unsigned integer in little-endian -func (d *D) FieldScalarU39LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU39LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU39LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U39LE", Pos: d.Pos()}) @@ -5446,14 +5584,14 @@ func (d *D) FieldScalarU39LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU39LE tries to add a field and read 39 bit unsigned integer in little-endian -func (d *D) TryFieldU39LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU39LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU39LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU39LE adds a field and reads 39 bit unsigned integer in little-endian -func (d *D) FieldU39LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU39LE(name, sms...).ActualU() +func (d *D) FieldU39LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU39LE(name, sms...).Actual } // Reader U40LE @@ -5471,11 +5609,10 @@ func (d *D) U40LE() uint64 { } // TryFieldScalarU40LE tries to add a field and read 40 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU40LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU40LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(40, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5484,7 +5621,7 @@ func (d *D) TryFieldScalarU40LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU40LE adds a field and reads 40 bit unsigned integer in little-endian -func (d *D) FieldScalarU40LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU40LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU40LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U40LE", Pos: d.Pos()}) @@ -5493,14 +5630,14 @@ func (d *D) FieldScalarU40LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU40LE tries to add a field and read 40 bit unsigned integer in little-endian -func (d *D) TryFieldU40LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU40LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU40LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU40LE adds a field and reads 40 bit unsigned integer in little-endian -func (d *D) FieldU40LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU40LE(name, sms...).ActualU() +func (d *D) FieldU40LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU40LE(name, sms...).Actual } // Reader U41LE @@ -5518,11 +5655,10 @@ func (d *D) U41LE() uint64 { } // TryFieldScalarU41LE tries to add a field and read 41 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU41LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU41LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(41, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5531,7 +5667,7 @@ func (d *D) TryFieldScalarU41LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU41LE adds a field and reads 41 bit unsigned integer in little-endian -func (d *D) FieldScalarU41LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU41LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU41LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U41LE", Pos: d.Pos()}) @@ -5540,14 +5676,14 @@ func (d *D) FieldScalarU41LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU41LE tries to add a field and read 41 bit unsigned integer in little-endian -func (d *D) TryFieldU41LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU41LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU41LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU41LE adds a field and reads 41 bit unsigned integer in little-endian -func (d *D) FieldU41LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU41LE(name, sms...).ActualU() +func (d *D) FieldU41LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU41LE(name, sms...).Actual } // Reader U42LE @@ -5565,11 +5701,10 @@ func (d *D) U42LE() uint64 { } // TryFieldScalarU42LE tries to add a field and read 42 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU42LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU42LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(42, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5578,7 +5713,7 @@ func (d *D) TryFieldScalarU42LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU42LE adds a field and reads 42 bit unsigned integer in little-endian -func (d *D) FieldScalarU42LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU42LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU42LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U42LE", Pos: d.Pos()}) @@ -5587,14 +5722,14 @@ func (d *D) FieldScalarU42LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU42LE tries to add a field and read 42 bit unsigned integer in little-endian -func (d *D) TryFieldU42LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU42LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU42LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU42LE adds a field and reads 42 bit unsigned integer in little-endian -func (d *D) FieldU42LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU42LE(name, sms...).ActualU() +func (d *D) FieldU42LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU42LE(name, sms...).Actual } // Reader U43LE @@ -5612,11 +5747,10 @@ func (d *D) U43LE() uint64 { } // TryFieldScalarU43LE tries to add a field and read 43 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU43LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU43LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(43, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5625,7 +5759,7 @@ func (d *D) TryFieldScalarU43LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU43LE adds a field and reads 43 bit unsigned integer in little-endian -func (d *D) FieldScalarU43LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU43LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU43LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U43LE", Pos: d.Pos()}) @@ -5634,14 +5768,14 @@ func (d *D) FieldScalarU43LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU43LE tries to add a field and read 43 bit unsigned integer in little-endian -func (d *D) TryFieldU43LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU43LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU43LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU43LE adds a field and reads 43 bit unsigned integer in little-endian -func (d *D) FieldU43LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU43LE(name, sms...).ActualU() +func (d *D) FieldU43LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU43LE(name, sms...).Actual } // Reader U44LE @@ -5659,11 +5793,10 @@ func (d *D) U44LE() uint64 { } // TryFieldScalarU44LE tries to add a field and read 44 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU44LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU44LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(44, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5672,7 +5805,7 @@ func (d *D) TryFieldScalarU44LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU44LE adds a field and reads 44 bit unsigned integer in little-endian -func (d *D) FieldScalarU44LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU44LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU44LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U44LE", Pos: d.Pos()}) @@ -5681,14 +5814,14 @@ func (d *D) FieldScalarU44LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU44LE tries to add a field and read 44 bit unsigned integer in little-endian -func (d *D) TryFieldU44LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU44LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU44LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU44LE adds a field and reads 44 bit unsigned integer in little-endian -func (d *D) FieldU44LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU44LE(name, sms...).ActualU() +func (d *D) FieldU44LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU44LE(name, sms...).Actual } // Reader U45LE @@ -5706,11 +5839,10 @@ func (d *D) U45LE() uint64 { } // TryFieldScalarU45LE tries to add a field and read 45 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU45LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU45LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(45, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5719,7 +5851,7 @@ func (d *D) TryFieldScalarU45LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU45LE adds a field and reads 45 bit unsigned integer in little-endian -func (d *D) FieldScalarU45LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU45LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU45LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U45LE", Pos: d.Pos()}) @@ -5728,14 +5860,14 @@ func (d *D) FieldScalarU45LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU45LE tries to add a field and read 45 bit unsigned integer in little-endian -func (d *D) TryFieldU45LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU45LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU45LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU45LE adds a field and reads 45 bit unsigned integer in little-endian -func (d *D) FieldU45LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU45LE(name, sms...).ActualU() +func (d *D) FieldU45LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU45LE(name, sms...).Actual } // Reader U46LE @@ -5753,11 +5885,10 @@ func (d *D) U46LE() uint64 { } // TryFieldScalarU46LE tries to add a field and read 46 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU46LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU46LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(46, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5766,7 +5897,7 @@ func (d *D) TryFieldScalarU46LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU46LE adds a field and reads 46 bit unsigned integer in little-endian -func (d *D) FieldScalarU46LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU46LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU46LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U46LE", Pos: d.Pos()}) @@ -5775,14 +5906,14 @@ func (d *D) FieldScalarU46LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU46LE tries to add a field and read 46 bit unsigned integer in little-endian -func (d *D) TryFieldU46LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU46LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU46LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU46LE adds a field and reads 46 bit unsigned integer in little-endian -func (d *D) FieldU46LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU46LE(name, sms...).ActualU() +func (d *D) FieldU46LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU46LE(name, sms...).Actual } // Reader U47LE @@ -5800,11 +5931,10 @@ func (d *D) U47LE() uint64 { } // TryFieldScalarU47LE tries to add a field and read 47 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU47LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU47LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(47, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5813,7 +5943,7 @@ func (d *D) TryFieldScalarU47LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU47LE adds a field and reads 47 bit unsigned integer in little-endian -func (d *D) FieldScalarU47LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU47LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU47LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U47LE", Pos: d.Pos()}) @@ -5822,14 +5952,14 @@ func (d *D) FieldScalarU47LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU47LE tries to add a field and read 47 bit unsigned integer in little-endian -func (d *D) TryFieldU47LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU47LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU47LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU47LE adds a field and reads 47 bit unsigned integer in little-endian -func (d *D) FieldU47LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU47LE(name, sms...).ActualU() +func (d *D) FieldU47LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU47LE(name, sms...).Actual } // Reader U48LE @@ -5847,11 +5977,10 @@ func (d *D) U48LE() uint64 { } // TryFieldScalarU48LE tries to add a field and read 48 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU48LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU48LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(48, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5860,7 +5989,7 @@ func (d *D) TryFieldScalarU48LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU48LE adds a field and reads 48 bit unsigned integer in little-endian -func (d *D) FieldScalarU48LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU48LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU48LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U48LE", Pos: d.Pos()}) @@ -5869,14 +5998,14 @@ func (d *D) FieldScalarU48LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU48LE tries to add a field and read 48 bit unsigned integer in little-endian -func (d *D) TryFieldU48LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU48LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU48LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU48LE adds a field and reads 48 bit unsigned integer in little-endian -func (d *D) FieldU48LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU48LE(name, sms...).ActualU() +func (d *D) FieldU48LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU48LE(name, sms...).Actual } // Reader U49LE @@ -5894,11 +6023,10 @@ func (d *D) U49LE() uint64 { } // TryFieldScalarU49LE tries to add a field and read 49 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU49LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU49LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(49, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5907,7 +6035,7 @@ func (d *D) TryFieldScalarU49LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU49LE adds a field and reads 49 bit unsigned integer in little-endian -func (d *D) FieldScalarU49LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU49LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU49LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U49LE", Pos: d.Pos()}) @@ -5916,14 +6044,14 @@ func (d *D) FieldScalarU49LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU49LE tries to add a field and read 49 bit unsigned integer in little-endian -func (d *D) TryFieldU49LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU49LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU49LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU49LE adds a field and reads 49 bit unsigned integer in little-endian -func (d *D) FieldU49LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU49LE(name, sms...).ActualU() +func (d *D) FieldU49LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU49LE(name, sms...).Actual } // Reader U50LE @@ -5941,11 +6069,10 @@ func (d *D) U50LE() uint64 { } // TryFieldScalarU50LE tries to add a field and read 50 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU50LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU50LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(50, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -5954,7 +6081,7 @@ func (d *D) TryFieldScalarU50LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU50LE adds a field and reads 50 bit unsigned integer in little-endian -func (d *D) FieldScalarU50LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU50LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU50LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U50LE", Pos: d.Pos()}) @@ -5963,14 +6090,14 @@ func (d *D) FieldScalarU50LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU50LE tries to add a field and read 50 bit unsigned integer in little-endian -func (d *D) TryFieldU50LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU50LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU50LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU50LE adds a field and reads 50 bit unsigned integer in little-endian -func (d *D) FieldU50LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU50LE(name, sms...).ActualU() +func (d *D) FieldU50LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU50LE(name, sms...).Actual } // Reader U51LE @@ -5988,11 +6115,10 @@ func (d *D) U51LE() uint64 { } // TryFieldScalarU51LE tries to add a field and read 51 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU51LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU51LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(51, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6001,7 +6127,7 @@ func (d *D) TryFieldScalarU51LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU51LE adds a field and reads 51 bit unsigned integer in little-endian -func (d *D) FieldScalarU51LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU51LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU51LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U51LE", Pos: d.Pos()}) @@ -6010,14 +6136,14 @@ func (d *D) FieldScalarU51LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU51LE tries to add a field and read 51 bit unsigned integer in little-endian -func (d *D) TryFieldU51LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU51LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU51LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU51LE adds a field and reads 51 bit unsigned integer in little-endian -func (d *D) FieldU51LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU51LE(name, sms...).ActualU() +func (d *D) FieldU51LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU51LE(name, sms...).Actual } // Reader U52LE @@ -6035,11 +6161,10 @@ func (d *D) U52LE() uint64 { } // TryFieldScalarU52LE tries to add a field and read 52 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU52LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU52LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(52, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6048,7 +6173,7 @@ func (d *D) TryFieldScalarU52LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU52LE adds a field and reads 52 bit unsigned integer in little-endian -func (d *D) FieldScalarU52LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU52LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU52LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U52LE", Pos: d.Pos()}) @@ -6057,14 +6182,14 @@ func (d *D) FieldScalarU52LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU52LE tries to add a field and read 52 bit unsigned integer in little-endian -func (d *D) TryFieldU52LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU52LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU52LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU52LE adds a field and reads 52 bit unsigned integer in little-endian -func (d *D) FieldU52LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU52LE(name, sms...).ActualU() +func (d *D) FieldU52LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU52LE(name, sms...).Actual } // Reader U53LE @@ -6082,11 +6207,10 @@ func (d *D) U53LE() uint64 { } // TryFieldScalarU53LE tries to add a field and read 53 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU53LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU53LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(53, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6095,7 +6219,7 @@ func (d *D) TryFieldScalarU53LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU53LE adds a field and reads 53 bit unsigned integer in little-endian -func (d *D) FieldScalarU53LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU53LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU53LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U53LE", Pos: d.Pos()}) @@ -6104,14 +6228,14 @@ func (d *D) FieldScalarU53LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU53LE tries to add a field and read 53 bit unsigned integer in little-endian -func (d *D) TryFieldU53LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU53LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU53LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU53LE adds a field and reads 53 bit unsigned integer in little-endian -func (d *D) FieldU53LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU53LE(name, sms...).ActualU() +func (d *D) FieldU53LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU53LE(name, sms...).Actual } // Reader U54LE @@ -6129,11 +6253,10 @@ func (d *D) U54LE() uint64 { } // TryFieldScalarU54LE tries to add a field and read 54 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU54LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU54LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(54, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6142,7 +6265,7 @@ func (d *D) TryFieldScalarU54LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU54LE adds a field and reads 54 bit unsigned integer in little-endian -func (d *D) FieldScalarU54LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU54LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU54LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U54LE", Pos: d.Pos()}) @@ -6151,14 +6274,14 @@ func (d *D) FieldScalarU54LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU54LE tries to add a field and read 54 bit unsigned integer in little-endian -func (d *D) TryFieldU54LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU54LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU54LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU54LE adds a field and reads 54 bit unsigned integer in little-endian -func (d *D) FieldU54LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU54LE(name, sms...).ActualU() +func (d *D) FieldU54LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU54LE(name, sms...).Actual } // Reader U55LE @@ -6176,11 +6299,10 @@ func (d *D) U55LE() uint64 { } // TryFieldScalarU55LE tries to add a field and read 55 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU55LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU55LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(55, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6189,7 +6311,7 @@ func (d *D) TryFieldScalarU55LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU55LE adds a field and reads 55 bit unsigned integer in little-endian -func (d *D) FieldScalarU55LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU55LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU55LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U55LE", Pos: d.Pos()}) @@ -6198,14 +6320,14 @@ func (d *D) FieldScalarU55LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU55LE tries to add a field and read 55 bit unsigned integer in little-endian -func (d *D) TryFieldU55LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU55LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU55LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU55LE adds a field and reads 55 bit unsigned integer in little-endian -func (d *D) FieldU55LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU55LE(name, sms...).ActualU() +func (d *D) FieldU55LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU55LE(name, sms...).Actual } // Reader U56LE @@ -6223,11 +6345,10 @@ func (d *D) U56LE() uint64 { } // TryFieldScalarU56LE tries to add a field and read 56 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU56LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU56LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(56, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6236,7 +6357,7 @@ func (d *D) TryFieldScalarU56LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU56LE adds a field and reads 56 bit unsigned integer in little-endian -func (d *D) FieldScalarU56LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU56LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU56LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U56LE", Pos: d.Pos()}) @@ -6245,14 +6366,14 @@ func (d *D) FieldScalarU56LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU56LE tries to add a field and read 56 bit unsigned integer in little-endian -func (d *D) TryFieldU56LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU56LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU56LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU56LE adds a field and reads 56 bit unsigned integer in little-endian -func (d *D) FieldU56LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU56LE(name, sms...).ActualU() +func (d *D) FieldU56LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU56LE(name, sms...).Actual } // Reader U57LE @@ -6270,11 +6391,10 @@ func (d *D) U57LE() uint64 { } // TryFieldScalarU57LE tries to add a field and read 57 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU57LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU57LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(57, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6283,7 +6403,7 @@ func (d *D) TryFieldScalarU57LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU57LE adds a field and reads 57 bit unsigned integer in little-endian -func (d *D) FieldScalarU57LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU57LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU57LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U57LE", Pos: d.Pos()}) @@ -6292,14 +6412,14 @@ func (d *D) FieldScalarU57LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU57LE tries to add a field and read 57 bit unsigned integer in little-endian -func (d *D) TryFieldU57LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU57LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU57LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU57LE adds a field and reads 57 bit unsigned integer in little-endian -func (d *D) FieldU57LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU57LE(name, sms...).ActualU() +func (d *D) FieldU57LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU57LE(name, sms...).Actual } // Reader U58LE @@ -6317,11 +6437,10 @@ func (d *D) U58LE() uint64 { } // TryFieldScalarU58LE tries to add a field and read 58 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU58LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU58LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(58, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6330,7 +6449,7 @@ func (d *D) TryFieldScalarU58LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU58LE adds a field and reads 58 bit unsigned integer in little-endian -func (d *D) FieldScalarU58LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU58LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU58LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U58LE", Pos: d.Pos()}) @@ -6339,14 +6458,14 @@ func (d *D) FieldScalarU58LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU58LE tries to add a field and read 58 bit unsigned integer in little-endian -func (d *D) TryFieldU58LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU58LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU58LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU58LE adds a field and reads 58 bit unsigned integer in little-endian -func (d *D) FieldU58LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU58LE(name, sms...).ActualU() +func (d *D) FieldU58LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU58LE(name, sms...).Actual } // Reader U59LE @@ -6364,11 +6483,10 @@ func (d *D) U59LE() uint64 { } // TryFieldScalarU59LE tries to add a field and read 59 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU59LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU59LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(59, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6377,7 +6495,7 @@ func (d *D) TryFieldScalarU59LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU59LE adds a field and reads 59 bit unsigned integer in little-endian -func (d *D) FieldScalarU59LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU59LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU59LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U59LE", Pos: d.Pos()}) @@ -6386,14 +6504,14 @@ func (d *D) FieldScalarU59LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU59LE tries to add a field and read 59 bit unsigned integer in little-endian -func (d *D) TryFieldU59LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU59LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU59LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU59LE adds a field and reads 59 bit unsigned integer in little-endian -func (d *D) FieldU59LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU59LE(name, sms...).ActualU() +func (d *D) FieldU59LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU59LE(name, sms...).Actual } // Reader U60LE @@ -6411,11 +6529,10 @@ func (d *D) U60LE() uint64 { } // TryFieldScalarU60LE tries to add a field and read 60 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU60LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU60LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(60, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6424,7 +6541,7 @@ func (d *D) TryFieldScalarU60LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU60LE adds a field and reads 60 bit unsigned integer in little-endian -func (d *D) FieldScalarU60LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU60LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU60LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U60LE", Pos: d.Pos()}) @@ -6433,14 +6550,14 @@ func (d *D) FieldScalarU60LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU60LE tries to add a field and read 60 bit unsigned integer in little-endian -func (d *D) TryFieldU60LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU60LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU60LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU60LE adds a field and reads 60 bit unsigned integer in little-endian -func (d *D) FieldU60LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU60LE(name, sms...).ActualU() +func (d *D) FieldU60LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU60LE(name, sms...).Actual } // Reader U61LE @@ -6458,11 +6575,10 @@ func (d *D) U61LE() uint64 { } // TryFieldScalarU61LE tries to add a field and read 61 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU61LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU61LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(61, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6471,7 +6587,7 @@ func (d *D) TryFieldScalarU61LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU61LE adds a field and reads 61 bit unsigned integer in little-endian -func (d *D) FieldScalarU61LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU61LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU61LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U61LE", Pos: d.Pos()}) @@ -6480,14 +6596,14 @@ func (d *D) FieldScalarU61LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU61LE tries to add a field and read 61 bit unsigned integer in little-endian -func (d *D) TryFieldU61LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU61LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU61LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU61LE adds a field and reads 61 bit unsigned integer in little-endian -func (d *D) FieldU61LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU61LE(name, sms...).ActualU() +func (d *D) FieldU61LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU61LE(name, sms...).Actual } // Reader U62LE @@ -6505,11 +6621,10 @@ func (d *D) U62LE() uint64 { } // TryFieldScalarU62LE tries to add a field and read 62 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU62LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU62LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(62, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6518,7 +6633,7 @@ func (d *D) TryFieldScalarU62LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU62LE adds a field and reads 62 bit unsigned integer in little-endian -func (d *D) FieldScalarU62LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU62LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU62LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U62LE", Pos: d.Pos()}) @@ -6527,14 +6642,14 @@ func (d *D) FieldScalarU62LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU62LE tries to add a field and read 62 bit unsigned integer in little-endian -func (d *D) TryFieldU62LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU62LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU62LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU62LE adds a field and reads 62 bit unsigned integer in little-endian -func (d *D) FieldU62LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU62LE(name, sms...).ActualU() +func (d *D) FieldU62LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU62LE(name, sms...).Actual } // Reader U63LE @@ -6552,11 +6667,10 @@ func (d *D) U63LE() uint64 { } // TryFieldScalarU63LE tries to add a field and read 63 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU63LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU63LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(63, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6565,7 +6679,7 @@ func (d *D) TryFieldScalarU63LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU63LE adds a field and reads 63 bit unsigned integer in little-endian -func (d *D) FieldScalarU63LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU63LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU63LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U63LE", Pos: d.Pos()}) @@ -6574,14 +6688,14 @@ func (d *D) FieldScalarU63LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU63LE tries to add a field and read 63 bit unsigned integer in little-endian -func (d *D) TryFieldU63LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU63LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU63LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU63LE adds a field and reads 63 bit unsigned integer in little-endian -func (d *D) FieldU63LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU63LE(name, sms...).ActualU() +func (d *D) FieldU63LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU63LE(name, sms...).Actual } // Reader U64LE @@ -6599,11 +6713,10 @@ func (d *D) U64LE() uint64 { } // TryFieldScalarU64LE tries to add a field and read 64 bit unsigned integer in little-endian -func (d *D) TryFieldScalarU64LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU64LE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(64, LittleEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6612,7 +6725,7 @@ func (d *D) TryFieldScalarU64LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU64LE adds a field and reads 64 bit unsigned integer in little-endian -func (d *D) FieldScalarU64LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU64LE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU64LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U64LE", Pos: d.Pos()}) @@ -6621,14 +6734,14 @@ func (d *D) FieldScalarU64LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU64LE tries to add a field and read 64 bit unsigned integer in little-endian -func (d *D) TryFieldU64LE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU64LE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU64LE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU64LE adds a field and reads 64 bit unsigned integer in little-endian -func (d *D) FieldU64LE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU64LE(name, sms...).ActualU() +func (d *D) FieldU64LE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU64LE(name, sms...).Actual } // Reader U8BE @@ -6646,11 +6759,10 @@ func (d *D) U8BE() uint64 { } // TryFieldScalarU8BE tries to add a field and read 8 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU8BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU8BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(8, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6659,7 +6771,7 @@ func (d *D) TryFieldScalarU8BE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarU8BE adds a field and reads 8 bit unsigned integer in big-endian -func (d *D) FieldScalarU8BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU8BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU8BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U8BE", Pos: d.Pos()}) @@ -6668,14 +6780,14 @@ func (d *D) FieldScalarU8BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU8BE tries to add a field and read 8 bit unsigned integer in big-endian -func (d *D) TryFieldU8BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU8BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU8BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU8BE adds a field and reads 8 bit unsigned integer in big-endian -func (d *D) FieldU8BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU8BE(name, sms...).ActualU() +func (d *D) FieldU8BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU8BE(name, sms...).Actual } // Reader U9BE @@ -6693,11 +6805,10 @@ func (d *D) U9BE() uint64 { } // TryFieldScalarU9BE tries to add a field and read 9 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU9BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU9BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(9, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6706,7 +6817,7 @@ func (d *D) TryFieldScalarU9BE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarU9BE adds a field and reads 9 bit unsigned integer in big-endian -func (d *D) FieldScalarU9BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU9BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU9BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U9BE", Pos: d.Pos()}) @@ -6715,14 +6826,14 @@ func (d *D) FieldScalarU9BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU9BE tries to add a field and read 9 bit unsigned integer in big-endian -func (d *D) TryFieldU9BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU9BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU9BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU9BE adds a field and reads 9 bit unsigned integer in big-endian -func (d *D) FieldU9BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU9BE(name, sms...).ActualU() +func (d *D) FieldU9BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU9BE(name, sms...).Actual } // Reader U10BE @@ -6740,11 +6851,10 @@ func (d *D) U10BE() uint64 { } // TryFieldScalarU10BE tries to add a field and read 10 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU10BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU10BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(10, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6753,7 +6863,7 @@ func (d *D) TryFieldScalarU10BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU10BE adds a field and reads 10 bit unsigned integer in big-endian -func (d *D) FieldScalarU10BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU10BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU10BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U10BE", Pos: d.Pos()}) @@ -6762,14 +6872,14 @@ func (d *D) FieldScalarU10BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU10BE tries to add a field and read 10 bit unsigned integer in big-endian -func (d *D) TryFieldU10BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU10BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU10BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU10BE adds a field and reads 10 bit unsigned integer in big-endian -func (d *D) FieldU10BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU10BE(name, sms...).ActualU() +func (d *D) FieldU10BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU10BE(name, sms...).Actual } // Reader U11BE @@ -6787,11 +6897,10 @@ func (d *D) U11BE() uint64 { } // TryFieldScalarU11BE tries to add a field and read 11 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU11BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU11BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(11, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6800,7 +6909,7 @@ func (d *D) TryFieldScalarU11BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU11BE adds a field and reads 11 bit unsigned integer in big-endian -func (d *D) FieldScalarU11BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU11BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU11BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U11BE", Pos: d.Pos()}) @@ -6809,14 +6918,14 @@ func (d *D) FieldScalarU11BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU11BE tries to add a field and read 11 bit unsigned integer in big-endian -func (d *D) TryFieldU11BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU11BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU11BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU11BE adds a field and reads 11 bit unsigned integer in big-endian -func (d *D) FieldU11BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU11BE(name, sms...).ActualU() +func (d *D) FieldU11BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU11BE(name, sms...).Actual } // Reader U12BE @@ -6834,11 +6943,10 @@ func (d *D) U12BE() uint64 { } // TryFieldScalarU12BE tries to add a field and read 12 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU12BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU12BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(12, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6847,7 +6955,7 @@ func (d *D) TryFieldScalarU12BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU12BE adds a field and reads 12 bit unsigned integer in big-endian -func (d *D) FieldScalarU12BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU12BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU12BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U12BE", Pos: d.Pos()}) @@ -6856,14 +6964,14 @@ func (d *D) FieldScalarU12BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU12BE tries to add a field and read 12 bit unsigned integer in big-endian -func (d *D) TryFieldU12BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU12BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU12BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU12BE adds a field and reads 12 bit unsigned integer in big-endian -func (d *D) FieldU12BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU12BE(name, sms...).ActualU() +func (d *D) FieldU12BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU12BE(name, sms...).Actual } // Reader U13BE @@ -6881,11 +6989,10 @@ func (d *D) U13BE() uint64 { } // TryFieldScalarU13BE tries to add a field and read 13 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU13BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU13BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(13, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6894,7 +7001,7 @@ func (d *D) TryFieldScalarU13BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU13BE adds a field and reads 13 bit unsigned integer in big-endian -func (d *D) FieldScalarU13BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU13BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU13BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U13BE", Pos: d.Pos()}) @@ -6903,14 +7010,14 @@ func (d *D) FieldScalarU13BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU13BE tries to add a field and read 13 bit unsigned integer in big-endian -func (d *D) TryFieldU13BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU13BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU13BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU13BE adds a field and reads 13 bit unsigned integer in big-endian -func (d *D) FieldU13BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU13BE(name, sms...).ActualU() +func (d *D) FieldU13BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU13BE(name, sms...).Actual } // Reader U14BE @@ -6928,11 +7035,10 @@ func (d *D) U14BE() uint64 { } // TryFieldScalarU14BE tries to add a field and read 14 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU14BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU14BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(14, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6941,7 +7047,7 @@ func (d *D) TryFieldScalarU14BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU14BE adds a field and reads 14 bit unsigned integer in big-endian -func (d *D) FieldScalarU14BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU14BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU14BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U14BE", Pos: d.Pos()}) @@ -6950,14 +7056,14 @@ func (d *D) FieldScalarU14BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU14BE tries to add a field and read 14 bit unsigned integer in big-endian -func (d *D) TryFieldU14BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU14BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU14BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU14BE adds a field and reads 14 bit unsigned integer in big-endian -func (d *D) FieldU14BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU14BE(name, sms...).ActualU() +func (d *D) FieldU14BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU14BE(name, sms...).Actual } // Reader U15BE @@ -6975,11 +7081,10 @@ func (d *D) U15BE() uint64 { } // TryFieldScalarU15BE tries to add a field and read 15 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU15BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU15BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(15, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -6988,7 +7093,7 @@ func (d *D) TryFieldScalarU15BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU15BE adds a field and reads 15 bit unsigned integer in big-endian -func (d *D) FieldScalarU15BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU15BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU15BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U15BE", Pos: d.Pos()}) @@ -6997,14 +7102,14 @@ func (d *D) FieldScalarU15BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU15BE tries to add a field and read 15 bit unsigned integer in big-endian -func (d *D) TryFieldU15BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU15BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU15BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU15BE adds a field and reads 15 bit unsigned integer in big-endian -func (d *D) FieldU15BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU15BE(name, sms...).ActualU() +func (d *D) FieldU15BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU15BE(name, sms...).Actual } // Reader U16BE @@ -7022,11 +7127,10 @@ func (d *D) U16BE() uint64 { } // TryFieldScalarU16BE tries to add a field and read 16 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU16BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU16BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(16, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7035,7 +7139,7 @@ func (d *D) TryFieldScalarU16BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU16BE adds a field and reads 16 bit unsigned integer in big-endian -func (d *D) FieldScalarU16BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU16BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU16BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U16BE", Pos: d.Pos()}) @@ -7044,14 +7148,14 @@ func (d *D) FieldScalarU16BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU16BE tries to add a field and read 16 bit unsigned integer in big-endian -func (d *D) TryFieldU16BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU16BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU16BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU16BE adds a field and reads 16 bit unsigned integer in big-endian -func (d *D) FieldU16BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU16BE(name, sms...).ActualU() +func (d *D) FieldU16BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU16BE(name, sms...).Actual } // Reader U17BE @@ -7069,11 +7173,10 @@ func (d *D) U17BE() uint64 { } // TryFieldScalarU17BE tries to add a field and read 17 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU17BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU17BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(17, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7082,7 +7185,7 @@ func (d *D) TryFieldScalarU17BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU17BE adds a field and reads 17 bit unsigned integer in big-endian -func (d *D) FieldScalarU17BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU17BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU17BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U17BE", Pos: d.Pos()}) @@ -7091,14 +7194,14 @@ func (d *D) FieldScalarU17BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU17BE tries to add a field and read 17 bit unsigned integer in big-endian -func (d *D) TryFieldU17BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU17BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU17BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU17BE adds a field and reads 17 bit unsigned integer in big-endian -func (d *D) FieldU17BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU17BE(name, sms...).ActualU() +func (d *D) FieldU17BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU17BE(name, sms...).Actual } // Reader U18BE @@ -7116,11 +7219,10 @@ func (d *D) U18BE() uint64 { } // TryFieldScalarU18BE tries to add a field and read 18 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU18BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU18BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(18, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7129,7 +7231,7 @@ func (d *D) TryFieldScalarU18BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU18BE adds a field and reads 18 bit unsigned integer in big-endian -func (d *D) FieldScalarU18BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU18BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU18BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U18BE", Pos: d.Pos()}) @@ -7138,14 +7240,14 @@ func (d *D) FieldScalarU18BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU18BE tries to add a field and read 18 bit unsigned integer in big-endian -func (d *D) TryFieldU18BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU18BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU18BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU18BE adds a field and reads 18 bit unsigned integer in big-endian -func (d *D) FieldU18BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU18BE(name, sms...).ActualU() +func (d *D) FieldU18BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU18BE(name, sms...).Actual } // Reader U19BE @@ -7163,11 +7265,10 @@ func (d *D) U19BE() uint64 { } // TryFieldScalarU19BE tries to add a field and read 19 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU19BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU19BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(19, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7176,7 +7277,7 @@ func (d *D) TryFieldScalarU19BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU19BE adds a field and reads 19 bit unsigned integer in big-endian -func (d *D) FieldScalarU19BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU19BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU19BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U19BE", Pos: d.Pos()}) @@ -7185,14 +7286,14 @@ func (d *D) FieldScalarU19BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU19BE tries to add a field and read 19 bit unsigned integer in big-endian -func (d *D) TryFieldU19BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU19BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU19BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU19BE adds a field and reads 19 bit unsigned integer in big-endian -func (d *D) FieldU19BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU19BE(name, sms...).ActualU() +func (d *D) FieldU19BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU19BE(name, sms...).Actual } // Reader U20BE @@ -7210,11 +7311,10 @@ func (d *D) U20BE() uint64 { } // TryFieldScalarU20BE tries to add a field and read 20 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU20BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU20BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(20, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7223,7 +7323,7 @@ func (d *D) TryFieldScalarU20BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU20BE adds a field and reads 20 bit unsigned integer in big-endian -func (d *D) FieldScalarU20BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU20BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU20BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U20BE", Pos: d.Pos()}) @@ -7232,14 +7332,14 @@ func (d *D) FieldScalarU20BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU20BE tries to add a field and read 20 bit unsigned integer in big-endian -func (d *D) TryFieldU20BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU20BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU20BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU20BE adds a field and reads 20 bit unsigned integer in big-endian -func (d *D) FieldU20BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU20BE(name, sms...).ActualU() +func (d *D) FieldU20BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU20BE(name, sms...).Actual } // Reader U21BE @@ -7257,11 +7357,10 @@ func (d *D) U21BE() uint64 { } // TryFieldScalarU21BE tries to add a field and read 21 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU21BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU21BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(21, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7270,7 +7369,7 @@ func (d *D) TryFieldScalarU21BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU21BE adds a field and reads 21 bit unsigned integer in big-endian -func (d *D) FieldScalarU21BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU21BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU21BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U21BE", Pos: d.Pos()}) @@ -7279,14 +7378,14 @@ func (d *D) FieldScalarU21BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU21BE tries to add a field and read 21 bit unsigned integer in big-endian -func (d *D) TryFieldU21BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU21BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU21BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU21BE adds a field and reads 21 bit unsigned integer in big-endian -func (d *D) FieldU21BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU21BE(name, sms...).ActualU() +func (d *D) FieldU21BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU21BE(name, sms...).Actual } // Reader U22BE @@ -7304,11 +7403,10 @@ func (d *D) U22BE() uint64 { } // TryFieldScalarU22BE tries to add a field and read 22 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU22BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU22BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(22, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7317,7 +7415,7 @@ func (d *D) TryFieldScalarU22BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU22BE adds a field and reads 22 bit unsigned integer in big-endian -func (d *D) FieldScalarU22BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU22BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU22BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U22BE", Pos: d.Pos()}) @@ -7326,14 +7424,14 @@ func (d *D) FieldScalarU22BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU22BE tries to add a field and read 22 bit unsigned integer in big-endian -func (d *D) TryFieldU22BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU22BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU22BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU22BE adds a field and reads 22 bit unsigned integer in big-endian -func (d *D) FieldU22BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU22BE(name, sms...).ActualU() +func (d *D) FieldU22BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU22BE(name, sms...).Actual } // Reader U23BE @@ -7351,11 +7449,10 @@ func (d *D) U23BE() uint64 { } // TryFieldScalarU23BE tries to add a field and read 23 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU23BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU23BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(23, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7364,7 +7461,7 @@ func (d *D) TryFieldScalarU23BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU23BE adds a field and reads 23 bit unsigned integer in big-endian -func (d *D) FieldScalarU23BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU23BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU23BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U23BE", Pos: d.Pos()}) @@ -7373,14 +7470,14 @@ func (d *D) FieldScalarU23BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU23BE tries to add a field and read 23 bit unsigned integer in big-endian -func (d *D) TryFieldU23BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU23BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU23BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU23BE adds a field and reads 23 bit unsigned integer in big-endian -func (d *D) FieldU23BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU23BE(name, sms...).ActualU() +func (d *D) FieldU23BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU23BE(name, sms...).Actual } // Reader U24BE @@ -7398,11 +7495,10 @@ func (d *D) U24BE() uint64 { } // TryFieldScalarU24BE tries to add a field and read 24 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU24BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU24BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(24, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7411,7 +7507,7 @@ func (d *D) TryFieldScalarU24BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU24BE adds a field and reads 24 bit unsigned integer in big-endian -func (d *D) FieldScalarU24BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU24BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU24BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U24BE", Pos: d.Pos()}) @@ -7420,14 +7516,14 @@ func (d *D) FieldScalarU24BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU24BE tries to add a field and read 24 bit unsigned integer in big-endian -func (d *D) TryFieldU24BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU24BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU24BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU24BE adds a field and reads 24 bit unsigned integer in big-endian -func (d *D) FieldU24BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU24BE(name, sms...).ActualU() +func (d *D) FieldU24BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU24BE(name, sms...).Actual } // Reader U25BE @@ -7445,11 +7541,10 @@ func (d *D) U25BE() uint64 { } // TryFieldScalarU25BE tries to add a field and read 25 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU25BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU25BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(25, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7458,7 +7553,7 @@ func (d *D) TryFieldScalarU25BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU25BE adds a field and reads 25 bit unsigned integer in big-endian -func (d *D) FieldScalarU25BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU25BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU25BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U25BE", Pos: d.Pos()}) @@ -7467,14 +7562,14 @@ func (d *D) FieldScalarU25BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU25BE tries to add a field and read 25 bit unsigned integer in big-endian -func (d *D) TryFieldU25BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU25BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU25BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU25BE adds a field and reads 25 bit unsigned integer in big-endian -func (d *D) FieldU25BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU25BE(name, sms...).ActualU() +func (d *D) FieldU25BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU25BE(name, sms...).Actual } // Reader U26BE @@ -7492,11 +7587,10 @@ func (d *D) U26BE() uint64 { } // TryFieldScalarU26BE tries to add a field and read 26 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU26BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU26BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(26, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7505,7 +7599,7 @@ func (d *D) TryFieldScalarU26BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU26BE adds a field and reads 26 bit unsigned integer in big-endian -func (d *D) FieldScalarU26BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU26BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU26BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U26BE", Pos: d.Pos()}) @@ -7514,14 +7608,14 @@ func (d *D) FieldScalarU26BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU26BE tries to add a field and read 26 bit unsigned integer in big-endian -func (d *D) TryFieldU26BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU26BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU26BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU26BE adds a field and reads 26 bit unsigned integer in big-endian -func (d *D) FieldU26BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU26BE(name, sms...).ActualU() +func (d *D) FieldU26BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU26BE(name, sms...).Actual } // Reader U27BE @@ -7539,11 +7633,10 @@ func (d *D) U27BE() uint64 { } // TryFieldScalarU27BE tries to add a field and read 27 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU27BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU27BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(27, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7552,7 +7645,7 @@ func (d *D) TryFieldScalarU27BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU27BE adds a field and reads 27 bit unsigned integer in big-endian -func (d *D) FieldScalarU27BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU27BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU27BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U27BE", Pos: d.Pos()}) @@ -7561,14 +7654,14 @@ func (d *D) FieldScalarU27BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU27BE tries to add a field and read 27 bit unsigned integer in big-endian -func (d *D) TryFieldU27BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU27BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU27BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU27BE adds a field and reads 27 bit unsigned integer in big-endian -func (d *D) FieldU27BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU27BE(name, sms...).ActualU() +func (d *D) FieldU27BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU27BE(name, sms...).Actual } // Reader U28BE @@ -7586,11 +7679,10 @@ func (d *D) U28BE() uint64 { } // TryFieldScalarU28BE tries to add a field and read 28 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU28BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU28BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(28, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7599,7 +7691,7 @@ func (d *D) TryFieldScalarU28BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU28BE adds a field and reads 28 bit unsigned integer in big-endian -func (d *D) FieldScalarU28BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU28BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU28BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U28BE", Pos: d.Pos()}) @@ -7608,14 +7700,14 @@ func (d *D) FieldScalarU28BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU28BE tries to add a field and read 28 bit unsigned integer in big-endian -func (d *D) TryFieldU28BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU28BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU28BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU28BE adds a field and reads 28 bit unsigned integer in big-endian -func (d *D) FieldU28BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU28BE(name, sms...).ActualU() +func (d *D) FieldU28BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU28BE(name, sms...).Actual } // Reader U29BE @@ -7633,11 +7725,10 @@ func (d *D) U29BE() uint64 { } // TryFieldScalarU29BE tries to add a field and read 29 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU29BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU29BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(29, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7646,7 +7737,7 @@ func (d *D) TryFieldScalarU29BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU29BE adds a field and reads 29 bit unsigned integer in big-endian -func (d *D) FieldScalarU29BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU29BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU29BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U29BE", Pos: d.Pos()}) @@ -7655,14 +7746,14 @@ func (d *D) FieldScalarU29BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU29BE tries to add a field and read 29 bit unsigned integer in big-endian -func (d *D) TryFieldU29BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU29BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU29BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU29BE adds a field and reads 29 bit unsigned integer in big-endian -func (d *D) FieldU29BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU29BE(name, sms...).ActualU() +func (d *D) FieldU29BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU29BE(name, sms...).Actual } // Reader U30BE @@ -7680,11 +7771,10 @@ func (d *D) U30BE() uint64 { } // TryFieldScalarU30BE tries to add a field and read 30 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU30BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU30BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(30, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7693,7 +7783,7 @@ func (d *D) TryFieldScalarU30BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU30BE adds a field and reads 30 bit unsigned integer in big-endian -func (d *D) FieldScalarU30BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU30BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU30BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U30BE", Pos: d.Pos()}) @@ -7702,14 +7792,14 @@ func (d *D) FieldScalarU30BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU30BE tries to add a field and read 30 bit unsigned integer in big-endian -func (d *D) TryFieldU30BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU30BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU30BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU30BE adds a field and reads 30 bit unsigned integer in big-endian -func (d *D) FieldU30BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU30BE(name, sms...).ActualU() +func (d *D) FieldU30BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU30BE(name, sms...).Actual } // Reader U31BE @@ -7727,11 +7817,10 @@ func (d *D) U31BE() uint64 { } // TryFieldScalarU31BE tries to add a field and read 31 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU31BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU31BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(31, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7740,7 +7829,7 @@ func (d *D) TryFieldScalarU31BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU31BE adds a field and reads 31 bit unsigned integer in big-endian -func (d *D) FieldScalarU31BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU31BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU31BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U31BE", Pos: d.Pos()}) @@ -7749,14 +7838,14 @@ func (d *D) FieldScalarU31BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU31BE tries to add a field and read 31 bit unsigned integer in big-endian -func (d *D) TryFieldU31BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU31BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU31BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU31BE adds a field and reads 31 bit unsigned integer in big-endian -func (d *D) FieldU31BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU31BE(name, sms...).ActualU() +func (d *D) FieldU31BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU31BE(name, sms...).Actual } // Reader U32BE @@ -7774,11 +7863,10 @@ func (d *D) U32BE() uint64 { } // TryFieldScalarU32BE tries to add a field and read 32 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU32BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU32BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(32, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7787,7 +7875,7 @@ func (d *D) TryFieldScalarU32BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU32BE adds a field and reads 32 bit unsigned integer in big-endian -func (d *D) FieldScalarU32BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU32BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU32BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U32BE", Pos: d.Pos()}) @@ -7796,14 +7884,14 @@ func (d *D) FieldScalarU32BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU32BE tries to add a field and read 32 bit unsigned integer in big-endian -func (d *D) TryFieldU32BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU32BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU32BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU32BE adds a field and reads 32 bit unsigned integer in big-endian -func (d *D) FieldU32BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU32BE(name, sms...).ActualU() +func (d *D) FieldU32BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU32BE(name, sms...).Actual } // Reader U33BE @@ -7821,11 +7909,10 @@ func (d *D) U33BE() uint64 { } // TryFieldScalarU33BE tries to add a field and read 33 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU33BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU33BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(33, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7834,7 +7921,7 @@ func (d *D) TryFieldScalarU33BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU33BE adds a field and reads 33 bit unsigned integer in big-endian -func (d *D) FieldScalarU33BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU33BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU33BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U33BE", Pos: d.Pos()}) @@ -7843,14 +7930,14 @@ func (d *D) FieldScalarU33BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU33BE tries to add a field and read 33 bit unsigned integer in big-endian -func (d *D) TryFieldU33BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU33BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU33BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU33BE adds a field and reads 33 bit unsigned integer in big-endian -func (d *D) FieldU33BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU33BE(name, sms...).ActualU() +func (d *D) FieldU33BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU33BE(name, sms...).Actual } // Reader U34BE @@ -7868,11 +7955,10 @@ func (d *D) U34BE() uint64 { } // TryFieldScalarU34BE tries to add a field and read 34 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU34BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU34BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(34, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7881,7 +7967,7 @@ func (d *D) TryFieldScalarU34BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU34BE adds a field and reads 34 bit unsigned integer in big-endian -func (d *D) FieldScalarU34BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU34BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU34BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U34BE", Pos: d.Pos()}) @@ -7890,14 +7976,14 @@ func (d *D) FieldScalarU34BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU34BE tries to add a field and read 34 bit unsigned integer in big-endian -func (d *D) TryFieldU34BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU34BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU34BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU34BE adds a field and reads 34 bit unsigned integer in big-endian -func (d *D) FieldU34BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU34BE(name, sms...).ActualU() +func (d *D) FieldU34BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU34BE(name, sms...).Actual } // Reader U35BE @@ -7915,11 +8001,10 @@ func (d *D) U35BE() uint64 { } // TryFieldScalarU35BE tries to add a field and read 35 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU35BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU35BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(35, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7928,7 +8013,7 @@ func (d *D) TryFieldScalarU35BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU35BE adds a field and reads 35 bit unsigned integer in big-endian -func (d *D) FieldScalarU35BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU35BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU35BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U35BE", Pos: d.Pos()}) @@ -7937,14 +8022,14 @@ func (d *D) FieldScalarU35BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU35BE tries to add a field and read 35 bit unsigned integer in big-endian -func (d *D) TryFieldU35BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU35BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU35BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU35BE adds a field and reads 35 bit unsigned integer in big-endian -func (d *D) FieldU35BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU35BE(name, sms...).ActualU() +func (d *D) FieldU35BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU35BE(name, sms...).Actual } // Reader U36BE @@ -7962,11 +8047,10 @@ func (d *D) U36BE() uint64 { } // TryFieldScalarU36BE tries to add a field and read 36 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU36BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU36BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(36, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -7975,7 +8059,7 @@ func (d *D) TryFieldScalarU36BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU36BE adds a field and reads 36 bit unsigned integer in big-endian -func (d *D) FieldScalarU36BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU36BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU36BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U36BE", Pos: d.Pos()}) @@ -7984,14 +8068,14 @@ func (d *D) FieldScalarU36BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU36BE tries to add a field and read 36 bit unsigned integer in big-endian -func (d *D) TryFieldU36BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU36BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU36BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU36BE adds a field and reads 36 bit unsigned integer in big-endian -func (d *D) FieldU36BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU36BE(name, sms...).ActualU() +func (d *D) FieldU36BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU36BE(name, sms...).Actual } // Reader U37BE @@ -8009,11 +8093,10 @@ func (d *D) U37BE() uint64 { } // TryFieldScalarU37BE tries to add a field and read 37 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU37BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU37BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(37, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8022,7 +8105,7 @@ func (d *D) TryFieldScalarU37BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU37BE adds a field and reads 37 bit unsigned integer in big-endian -func (d *D) FieldScalarU37BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU37BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU37BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U37BE", Pos: d.Pos()}) @@ -8031,14 +8114,14 @@ func (d *D) FieldScalarU37BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU37BE tries to add a field and read 37 bit unsigned integer in big-endian -func (d *D) TryFieldU37BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU37BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU37BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU37BE adds a field and reads 37 bit unsigned integer in big-endian -func (d *D) FieldU37BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU37BE(name, sms...).ActualU() +func (d *D) FieldU37BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU37BE(name, sms...).Actual } // Reader U38BE @@ -8056,11 +8139,10 @@ func (d *D) U38BE() uint64 { } // TryFieldScalarU38BE tries to add a field and read 38 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU38BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU38BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(38, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8069,7 +8151,7 @@ func (d *D) TryFieldScalarU38BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU38BE adds a field and reads 38 bit unsigned integer in big-endian -func (d *D) FieldScalarU38BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU38BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU38BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U38BE", Pos: d.Pos()}) @@ -8078,14 +8160,14 @@ func (d *D) FieldScalarU38BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU38BE tries to add a field and read 38 bit unsigned integer in big-endian -func (d *D) TryFieldU38BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU38BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU38BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU38BE adds a field and reads 38 bit unsigned integer in big-endian -func (d *D) FieldU38BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU38BE(name, sms...).ActualU() +func (d *D) FieldU38BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU38BE(name, sms...).Actual } // Reader U39BE @@ -8103,11 +8185,10 @@ func (d *D) U39BE() uint64 { } // TryFieldScalarU39BE tries to add a field and read 39 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU39BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU39BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(39, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8116,7 +8197,7 @@ func (d *D) TryFieldScalarU39BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU39BE adds a field and reads 39 bit unsigned integer in big-endian -func (d *D) FieldScalarU39BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU39BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU39BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U39BE", Pos: d.Pos()}) @@ -8125,14 +8206,14 @@ func (d *D) FieldScalarU39BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU39BE tries to add a field and read 39 bit unsigned integer in big-endian -func (d *D) TryFieldU39BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU39BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU39BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU39BE adds a field and reads 39 bit unsigned integer in big-endian -func (d *D) FieldU39BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU39BE(name, sms...).ActualU() +func (d *D) FieldU39BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU39BE(name, sms...).Actual } // Reader U40BE @@ -8150,11 +8231,10 @@ func (d *D) U40BE() uint64 { } // TryFieldScalarU40BE tries to add a field and read 40 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU40BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU40BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(40, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8163,7 +8243,7 @@ func (d *D) TryFieldScalarU40BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU40BE adds a field and reads 40 bit unsigned integer in big-endian -func (d *D) FieldScalarU40BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU40BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU40BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U40BE", Pos: d.Pos()}) @@ -8172,14 +8252,14 @@ func (d *D) FieldScalarU40BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU40BE tries to add a field and read 40 bit unsigned integer in big-endian -func (d *D) TryFieldU40BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU40BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU40BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU40BE adds a field and reads 40 bit unsigned integer in big-endian -func (d *D) FieldU40BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU40BE(name, sms...).ActualU() +func (d *D) FieldU40BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU40BE(name, sms...).Actual } // Reader U41BE @@ -8197,11 +8277,10 @@ func (d *D) U41BE() uint64 { } // TryFieldScalarU41BE tries to add a field and read 41 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU41BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU41BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(41, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8210,7 +8289,7 @@ func (d *D) TryFieldScalarU41BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU41BE adds a field and reads 41 bit unsigned integer in big-endian -func (d *D) FieldScalarU41BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU41BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU41BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U41BE", Pos: d.Pos()}) @@ -8219,14 +8298,14 @@ func (d *D) FieldScalarU41BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU41BE tries to add a field and read 41 bit unsigned integer in big-endian -func (d *D) TryFieldU41BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU41BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU41BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU41BE adds a field and reads 41 bit unsigned integer in big-endian -func (d *D) FieldU41BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU41BE(name, sms...).ActualU() +func (d *D) FieldU41BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU41BE(name, sms...).Actual } // Reader U42BE @@ -8244,11 +8323,10 @@ func (d *D) U42BE() uint64 { } // TryFieldScalarU42BE tries to add a field and read 42 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU42BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU42BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(42, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8257,7 +8335,7 @@ func (d *D) TryFieldScalarU42BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU42BE adds a field and reads 42 bit unsigned integer in big-endian -func (d *D) FieldScalarU42BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU42BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU42BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U42BE", Pos: d.Pos()}) @@ -8266,14 +8344,14 @@ func (d *D) FieldScalarU42BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU42BE tries to add a field and read 42 bit unsigned integer in big-endian -func (d *D) TryFieldU42BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU42BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU42BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU42BE adds a field and reads 42 bit unsigned integer in big-endian -func (d *D) FieldU42BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU42BE(name, sms...).ActualU() +func (d *D) FieldU42BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU42BE(name, sms...).Actual } // Reader U43BE @@ -8291,11 +8369,10 @@ func (d *D) U43BE() uint64 { } // TryFieldScalarU43BE tries to add a field and read 43 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU43BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU43BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(43, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8304,7 +8381,7 @@ func (d *D) TryFieldScalarU43BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU43BE adds a field and reads 43 bit unsigned integer in big-endian -func (d *D) FieldScalarU43BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU43BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU43BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U43BE", Pos: d.Pos()}) @@ -8313,14 +8390,14 @@ func (d *D) FieldScalarU43BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU43BE tries to add a field and read 43 bit unsigned integer in big-endian -func (d *D) TryFieldU43BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU43BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU43BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU43BE adds a field and reads 43 bit unsigned integer in big-endian -func (d *D) FieldU43BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU43BE(name, sms...).ActualU() +func (d *D) FieldU43BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU43BE(name, sms...).Actual } // Reader U44BE @@ -8338,11 +8415,10 @@ func (d *D) U44BE() uint64 { } // TryFieldScalarU44BE tries to add a field and read 44 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU44BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU44BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(44, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8351,7 +8427,7 @@ func (d *D) TryFieldScalarU44BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU44BE adds a field and reads 44 bit unsigned integer in big-endian -func (d *D) FieldScalarU44BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU44BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU44BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U44BE", Pos: d.Pos()}) @@ -8360,14 +8436,14 @@ func (d *D) FieldScalarU44BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU44BE tries to add a field and read 44 bit unsigned integer in big-endian -func (d *D) TryFieldU44BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU44BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU44BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU44BE adds a field and reads 44 bit unsigned integer in big-endian -func (d *D) FieldU44BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU44BE(name, sms...).ActualU() +func (d *D) FieldU44BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU44BE(name, sms...).Actual } // Reader U45BE @@ -8385,11 +8461,10 @@ func (d *D) U45BE() uint64 { } // TryFieldScalarU45BE tries to add a field and read 45 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU45BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU45BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(45, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8398,7 +8473,7 @@ func (d *D) TryFieldScalarU45BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU45BE adds a field and reads 45 bit unsigned integer in big-endian -func (d *D) FieldScalarU45BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU45BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU45BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U45BE", Pos: d.Pos()}) @@ -8407,14 +8482,14 @@ func (d *D) FieldScalarU45BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU45BE tries to add a field and read 45 bit unsigned integer in big-endian -func (d *D) TryFieldU45BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU45BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU45BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU45BE adds a field and reads 45 bit unsigned integer in big-endian -func (d *D) FieldU45BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU45BE(name, sms...).ActualU() +func (d *D) FieldU45BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU45BE(name, sms...).Actual } // Reader U46BE @@ -8432,11 +8507,10 @@ func (d *D) U46BE() uint64 { } // TryFieldScalarU46BE tries to add a field and read 46 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU46BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU46BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(46, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8445,7 +8519,7 @@ func (d *D) TryFieldScalarU46BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU46BE adds a field and reads 46 bit unsigned integer in big-endian -func (d *D) FieldScalarU46BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU46BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU46BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U46BE", Pos: d.Pos()}) @@ -8454,14 +8528,14 @@ func (d *D) FieldScalarU46BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU46BE tries to add a field and read 46 bit unsigned integer in big-endian -func (d *D) TryFieldU46BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU46BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU46BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU46BE adds a field and reads 46 bit unsigned integer in big-endian -func (d *D) FieldU46BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU46BE(name, sms...).ActualU() +func (d *D) FieldU46BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU46BE(name, sms...).Actual } // Reader U47BE @@ -8479,11 +8553,10 @@ func (d *D) U47BE() uint64 { } // TryFieldScalarU47BE tries to add a field and read 47 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU47BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU47BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(47, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8492,7 +8565,7 @@ func (d *D) TryFieldScalarU47BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU47BE adds a field and reads 47 bit unsigned integer in big-endian -func (d *D) FieldScalarU47BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU47BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU47BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U47BE", Pos: d.Pos()}) @@ -8501,14 +8574,14 @@ func (d *D) FieldScalarU47BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU47BE tries to add a field and read 47 bit unsigned integer in big-endian -func (d *D) TryFieldU47BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU47BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU47BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU47BE adds a field and reads 47 bit unsigned integer in big-endian -func (d *D) FieldU47BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU47BE(name, sms...).ActualU() +func (d *D) FieldU47BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU47BE(name, sms...).Actual } // Reader U48BE @@ -8526,11 +8599,10 @@ func (d *D) U48BE() uint64 { } // TryFieldScalarU48BE tries to add a field and read 48 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU48BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU48BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(48, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8539,7 +8611,7 @@ func (d *D) TryFieldScalarU48BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU48BE adds a field and reads 48 bit unsigned integer in big-endian -func (d *D) FieldScalarU48BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU48BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU48BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U48BE", Pos: d.Pos()}) @@ -8548,14 +8620,14 @@ func (d *D) FieldScalarU48BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU48BE tries to add a field and read 48 bit unsigned integer in big-endian -func (d *D) TryFieldU48BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU48BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU48BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU48BE adds a field and reads 48 bit unsigned integer in big-endian -func (d *D) FieldU48BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU48BE(name, sms...).ActualU() +func (d *D) FieldU48BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU48BE(name, sms...).Actual } // Reader U49BE @@ -8573,11 +8645,10 @@ func (d *D) U49BE() uint64 { } // TryFieldScalarU49BE tries to add a field and read 49 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU49BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU49BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(49, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8586,7 +8657,7 @@ func (d *D) TryFieldScalarU49BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU49BE adds a field and reads 49 bit unsigned integer in big-endian -func (d *D) FieldScalarU49BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU49BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU49BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U49BE", Pos: d.Pos()}) @@ -8595,14 +8666,14 @@ func (d *D) FieldScalarU49BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU49BE tries to add a field and read 49 bit unsigned integer in big-endian -func (d *D) TryFieldU49BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU49BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU49BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU49BE adds a field and reads 49 bit unsigned integer in big-endian -func (d *D) FieldU49BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU49BE(name, sms...).ActualU() +func (d *D) FieldU49BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU49BE(name, sms...).Actual } // Reader U50BE @@ -8620,11 +8691,10 @@ func (d *D) U50BE() uint64 { } // TryFieldScalarU50BE tries to add a field and read 50 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU50BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU50BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(50, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8633,7 +8703,7 @@ func (d *D) TryFieldScalarU50BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU50BE adds a field and reads 50 bit unsigned integer in big-endian -func (d *D) FieldScalarU50BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU50BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU50BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U50BE", Pos: d.Pos()}) @@ -8642,14 +8712,14 @@ func (d *D) FieldScalarU50BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU50BE tries to add a field and read 50 bit unsigned integer in big-endian -func (d *D) TryFieldU50BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU50BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU50BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU50BE adds a field and reads 50 bit unsigned integer in big-endian -func (d *D) FieldU50BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU50BE(name, sms...).ActualU() +func (d *D) FieldU50BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU50BE(name, sms...).Actual } // Reader U51BE @@ -8667,11 +8737,10 @@ func (d *D) U51BE() uint64 { } // TryFieldScalarU51BE tries to add a field and read 51 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU51BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU51BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(51, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8680,7 +8749,7 @@ func (d *D) TryFieldScalarU51BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU51BE adds a field and reads 51 bit unsigned integer in big-endian -func (d *D) FieldScalarU51BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU51BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU51BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U51BE", Pos: d.Pos()}) @@ -8689,14 +8758,14 @@ func (d *D) FieldScalarU51BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU51BE tries to add a field and read 51 bit unsigned integer in big-endian -func (d *D) TryFieldU51BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU51BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU51BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU51BE adds a field and reads 51 bit unsigned integer in big-endian -func (d *D) FieldU51BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU51BE(name, sms...).ActualU() +func (d *D) FieldU51BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU51BE(name, sms...).Actual } // Reader U52BE @@ -8714,11 +8783,10 @@ func (d *D) U52BE() uint64 { } // TryFieldScalarU52BE tries to add a field and read 52 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU52BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU52BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(52, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8727,7 +8795,7 @@ func (d *D) TryFieldScalarU52BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU52BE adds a field and reads 52 bit unsigned integer in big-endian -func (d *D) FieldScalarU52BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU52BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU52BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U52BE", Pos: d.Pos()}) @@ -8736,14 +8804,14 @@ func (d *D) FieldScalarU52BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU52BE tries to add a field and read 52 bit unsigned integer in big-endian -func (d *D) TryFieldU52BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU52BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU52BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU52BE adds a field and reads 52 bit unsigned integer in big-endian -func (d *D) FieldU52BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU52BE(name, sms...).ActualU() +func (d *D) FieldU52BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU52BE(name, sms...).Actual } // Reader U53BE @@ -8761,11 +8829,10 @@ func (d *D) U53BE() uint64 { } // TryFieldScalarU53BE tries to add a field and read 53 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU53BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU53BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(53, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8774,7 +8841,7 @@ func (d *D) TryFieldScalarU53BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU53BE adds a field and reads 53 bit unsigned integer in big-endian -func (d *D) FieldScalarU53BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU53BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU53BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U53BE", Pos: d.Pos()}) @@ -8783,14 +8850,14 @@ func (d *D) FieldScalarU53BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU53BE tries to add a field and read 53 bit unsigned integer in big-endian -func (d *D) TryFieldU53BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU53BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU53BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU53BE adds a field and reads 53 bit unsigned integer in big-endian -func (d *D) FieldU53BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU53BE(name, sms...).ActualU() +func (d *D) FieldU53BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU53BE(name, sms...).Actual } // Reader U54BE @@ -8808,11 +8875,10 @@ func (d *D) U54BE() uint64 { } // TryFieldScalarU54BE tries to add a field and read 54 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU54BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU54BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(54, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8821,7 +8887,7 @@ func (d *D) TryFieldScalarU54BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU54BE adds a field and reads 54 bit unsigned integer in big-endian -func (d *D) FieldScalarU54BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU54BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU54BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U54BE", Pos: d.Pos()}) @@ -8830,14 +8896,14 @@ func (d *D) FieldScalarU54BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU54BE tries to add a field and read 54 bit unsigned integer in big-endian -func (d *D) TryFieldU54BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU54BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU54BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU54BE adds a field and reads 54 bit unsigned integer in big-endian -func (d *D) FieldU54BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU54BE(name, sms...).ActualU() +func (d *D) FieldU54BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU54BE(name, sms...).Actual } // Reader U55BE @@ -8855,11 +8921,10 @@ func (d *D) U55BE() uint64 { } // TryFieldScalarU55BE tries to add a field and read 55 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU55BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU55BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(55, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8868,7 +8933,7 @@ func (d *D) TryFieldScalarU55BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU55BE adds a field and reads 55 bit unsigned integer in big-endian -func (d *D) FieldScalarU55BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU55BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU55BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U55BE", Pos: d.Pos()}) @@ -8877,14 +8942,14 @@ func (d *D) FieldScalarU55BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU55BE tries to add a field and read 55 bit unsigned integer in big-endian -func (d *D) TryFieldU55BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU55BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU55BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU55BE adds a field and reads 55 bit unsigned integer in big-endian -func (d *D) FieldU55BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU55BE(name, sms...).ActualU() +func (d *D) FieldU55BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU55BE(name, sms...).Actual } // Reader U56BE @@ -8902,11 +8967,10 @@ func (d *D) U56BE() uint64 { } // TryFieldScalarU56BE tries to add a field and read 56 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU56BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU56BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(56, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8915,7 +8979,7 @@ func (d *D) TryFieldScalarU56BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU56BE adds a field and reads 56 bit unsigned integer in big-endian -func (d *D) FieldScalarU56BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU56BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU56BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U56BE", Pos: d.Pos()}) @@ -8924,14 +8988,14 @@ func (d *D) FieldScalarU56BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU56BE tries to add a field and read 56 bit unsigned integer in big-endian -func (d *D) TryFieldU56BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU56BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU56BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU56BE adds a field and reads 56 bit unsigned integer in big-endian -func (d *D) FieldU56BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU56BE(name, sms...).ActualU() +func (d *D) FieldU56BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU56BE(name, sms...).Actual } // Reader U57BE @@ -8949,11 +9013,10 @@ func (d *D) U57BE() uint64 { } // TryFieldScalarU57BE tries to add a field and read 57 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU57BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU57BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(57, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -8962,7 +9025,7 @@ func (d *D) TryFieldScalarU57BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU57BE adds a field and reads 57 bit unsigned integer in big-endian -func (d *D) FieldScalarU57BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU57BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU57BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U57BE", Pos: d.Pos()}) @@ -8971,14 +9034,14 @@ func (d *D) FieldScalarU57BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU57BE tries to add a field and read 57 bit unsigned integer in big-endian -func (d *D) TryFieldU57BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU57BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU57BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU57BE adds a field and reads 57 bit unsigned integer in big-endian -func (d *D) FieldU57BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU57BE(name, sms...).ActualU() +func (d *D) FieldU57BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU57BE(name, sms...).Actual } // Reader U58BE @@ -8996,11 +9059,10 @@ func (d *D) U58BE() uint64 { } // TryFieldScalarU58BE tries to add a field and read 58 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU58BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU58BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(58, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9009,7 +9071,7 @@ func (d *D) TryFieldScalarU58BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU58BE adds a field and reads 58 bit unsigned integer in big-endian -func (d *D) FieldScalarU58BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU58BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU58BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U58BE", Pos: d.Pos()}) @@ -9018,14 +9080,14 @@ func (d *D) FieldScalarU58BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU58BE tries to add a field and read 58 bit unsigned integer in big-endian -func (d *D) TryFieldU58BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU58BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU58BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU58BE adds a field and reads 58 bit unsigned integer in big-endian -func (d *D) FieldU58BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU58BE(name, sms...).ActualU() +func (d *D) FieldU58BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU58BE(name, sms...).Actual } // Reader U59BE @@ -9043,11 +9105,10 @@ func (d *D) U59BE() uint64 { } // TryFieldScalarU59BE tries to add a field and read 59 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU59BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU59BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(59, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9056,7 +9117,7 @@ func (d *D) TryFieldScalarU59BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU59BE adds a field and reads 59 bit unsigned integer in big-endian -func (d *D) FieldScalarU59BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU59BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU59BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U59BE", Pos: d.Pos()}) @@ -9065,14 +9126,14 @@ func (d *D) FieldScalarU59BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU59BE tries to add a field and read 59 bit unsigned integer in big-endian -func (d *D) TryFieldU59BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU59BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU59BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU59BE adds a field and reads 59 bit unsigned integer in big-endian -func (d *D) FieldU59BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU59BE(name, sms...).ActualU() +func (d *D) FieldU59BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU59BE(name, sms...).Actual } // Reader U60BE @@ -9090,11 +9151,10 @@ func (d *D) U60BE() uint64 { } // TryFieldScalarU60BE tries to add a field and read 60 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU60BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU60BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(60, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9103,7 +9163,7 @@ func (d *D) TryFieldScalarU60BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU60BE adds a field and reads 60 bit unsigned integer in big-endian -func (d *D) FieldScalarU60BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU60BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU60BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U60BE", Pos: d.Pos()}) @@ -9112,14 +9172,14 @@ func (d *D) FieldScalarU60BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU60BE tries to add a field and read 60 bit unsigned integer in big-endian -func (d *D) TryFieldU60BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU60BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU60BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU60BE adds a field and reads 60 bit unsigned integer in big-endian -func (d *D) FieldU60BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU60BE(name, sms...).ActualU() +func (d *D) FieldU60BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU60BE(name, sms...).Actual } // Reader U61BE @@ -9137,11 +9197,10 @@ func (d *D) U61BE() uint64 { } // TryFieldScalarU61BE tries to add a field and read 61 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU61BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU61BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(61, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9150,7 +9209,7 @@ func (d *D) TryFieldScalarU61BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU61BE adds a field and reads 61 bit unsigned integer in big-endian -func (d *D) FieldScalarU61BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU61BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU61BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U61BE", Pos: d.Pos()}) @@ -9159,14 +9218,14 @@ func (d *D) FieldScalarU61BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU61BE tries to add a field and read 61 bit unsigned integer in big-endian -func (d *D) TryFieldU61BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU61BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU61BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU61BE adds a field and reads 61 bit unsigned integer in big-endian -func (d *D) FieldU61BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU61BE(name, sms...).ActualU() +func (d *D) FieldU61BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU61BE(name, sms...).Actual } // Reader U62BE @@ -9184,11 +9243,10 @@ func (d *D) U62BE() uint64 { } // TryFieldScalarU62BE tries to add a field and read 62 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU62BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU62BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(62, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9197,7 +9255,7 @@ func (d *D) TryFieldScalarU62BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU62BE adds a field and reads 62 bit unsigned integer in big-endian -func (d *D) FieldScalarU62BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU62BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU62BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U62BE", Pos: d.Pos()}) @@ -9206,14 +9264,14 @@ func (d *D) FieldScalarU62BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU62BE tries to add a field and read 62 bit unsigned integer in big-endian -func (d *D) TryFieldU62BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU62BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU62BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU62BE adds a field and reads 62 bit unsigned integer in big-endian -func (d *D) FieldU62BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU62BE(name, sms...).ActualU() +func (d *D) FieldU62BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU62BE(name, sms...).Actual } // Reader U63BE @@ -9231,11 +9289,10 @@ func (d *D) U63BE() uint64 { } // TryFieldScalarU63BE tries to add a field and read 63 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU63BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU63BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(63, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9244,7 +9301,7 @@ func (d *D) TryFieldScalarU63BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU63BE adds a field and reads 63 bit unsigned integer in big-endian -func (d *D) FieldScalarU63BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU63BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU63BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U63BE", Pos: d.Pos()}) @@ -9253,14 +9310,14 @@ func (d *D) FieldScalarU63BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU63BE tries to add a field and read 63 bit unsigned integer in big-endian -func (d *D) TryFieldU63BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU63BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU63BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU63BE adds a field and reads 63 bit unsigned integer in big-endian -func (d *D) FieldU63BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU63BE(name, sms...).ActualU() +func (d *D) FieldU63BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU63BE(name, sms...).Actual } // Reader U64BE @@ -9278,11 +9335,10 @@ func (d *D) U64BE() uint64 { } // TryFieldScalarU64BE tries to add a field and read 64 bit unsigned integer in big-endian -func (d *D) TryFieldScalarU64BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarU64BE(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUEndian(64, BigEndian) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9291,7 +9347,7 @@ func (d *D) TryFieldScalarU64BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarU64BE adds a field and reads 64 bit unsigned integer in big-endian -func (d *D) FieldScalarU64BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarU64BE(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarU64BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "U64BE", Pos: d.Pos()}) @@ -9300,14 +9356,14 @@ func (d *D) FieldScalarU64BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldU64BE tries to add a field and read 64 bit unsigned integer in big-endian -func (d *D) TryFieldU64BE(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldU64BE(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarU64BE(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldU64BE adds a field and reads 64 bit unsigned integer in big-endian -func (d *D) FieldU64BE(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarU64BE(name, sms...).ActualU() +func (d *D) FieldU64BE(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarU64BE(name, sms...).Actual } // Reader S @@ -9325,11 +9381,10 @@ func (d *D) S(nBits int) int64 { } // TryFieldScalarS tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldScalarS(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS(name string, nBits int, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(nBits, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9338,7 +9393,7 @@ func (d *D) TryFieldScalarS(name string, nBits int, sms ...scalar.Mapper) (*scal } // FieldScalarS adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldScalarS(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS(name string, nBits int, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S", Pos: d.Pos()}) @@ -9347,14 +9402,14 @@ func (d *D) FieldScalarS(name string, nBits int, sms ...scalar.Mapper) *scalar.S } // TryFieldS tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldS(name string, nBits int, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS(name string, nBits int, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS(name, nBits, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldS(name string, nBits int, sms ...scalar.Mapper) int64 { - return d.FieldScalarS(name, nBits, sms...).ActualS() +func (d *D) FieldS(name string, nBits int, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS(name, nBits, sms...).Actual } // Reader SE @@ -9372,11 +9427,10 @@ func (d *D) SE(nBits int, endian Endian) int64 { } // TryFieldScalarSE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldScalarSE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSE(name string, nBits int, endian Endian, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(nBits, endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9385,7 +9439,7 @@ func (d *D) TryFieldScalarSE(name string, nBits int, endian Endian, sms ...scala } // FieldScalarSE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldScalarSE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSE(name string, nBits int, endian Endian, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarSE(name, nBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SE", Pos: d.Pos()}) @@ -9394,14 +9448,14 @@ func (d *D) FieldScalarSE(name string, nBits int, endian Endian, sms ...scalar.M } // TryFieldSE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldSE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldSE(name string, nBits int, endian Endian, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarSE(name, nBits, endian, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldSE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldSE(name string, nBits int, endian Endian, sms ...scalar.Mapper) int64 { - return d.FieldScalarSE(name, nBits, endian, sms...).ActualS() +func (d *D) FieldSE(name string, nBits int, endian Endian, sms ...scalar.SintMapper) int64 { + return d.FieldScalarSE(name, nBits, endian, sms...).Actual } // Reader S1 @@ -9419,11 +9473,10 @@ func (d *D) S1() int64 { } // TryFieldScalarS1 tries to add a field and read 1 bit signed integer in current endian -func (d *D) TryFieldScalarS1(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS1(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(1, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9432,7 +9485,7 @@ func (d *D) TryFieldScalarS1(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS1 adds a field and reads 1 bit signed integer in current endian -func (d *D) FieldScalarS1(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS1(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS1(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S1", Pos: d.Pos()}) @@ -9441,14 +9494,14 @@ func (d *D) FieldScalarS1(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS1 tries to add a field and read 1 bit signed integer in current endian -func (d *D) TryFieldS1(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS1(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS1(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS1 adds a field and reads 1 bit signed integer in current endian -func (d *D) FieldS1(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS1(name, sms...).ActualS() +func (d *D) FieldS1(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS1(name, sms...).Actual } // Reader S2 @@ -9466,11 +9519,10 @@ func (d *D) S2() int64 { } // TryFieldScalarS2 tries to add a field and read 2 bit signed integer in current endian -func (d *D) TryFieldScalarS2(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS2(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(2, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9479,7 +9531,7 @@ func (d *D) TryFieldScalarS2(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS2 adds a field and reads 2 bit signed integer in current endian -func (d *D) FieldScalarS2(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS2(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS2(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S2", Pos: d.Pos()}) @@ -9488,14 +9540,14 @@ func (d *D) FieldScalarS2(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS2 tries to add a field and read 2 bit signed integer in current endian -func (d *D) TryFieldS2(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS2(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS2(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS2 adds a field and reads 2 bit signed integer in current endian -func (d *D) FieldS2(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS2(name, sms...).ActualS() +func (d *D) FieldS2(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS2(name, sms...).Actual } // Reader S3 @@ -9513,11 +9565,10 @@ func (d *D) S3() int64 { } // TryFieldScalarS3 tries to add a field and read 3 bit signed integer in current endian -func (d *D) TryFieldScalarS3(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS3(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(3, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9526,7 +9577,7 @@ func (d *D) TryFieldScalarS3(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS3 adds a field and reads 3 bit signed integer in current endian -func (d *D) FieldScalarS3(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS3(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS3(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S3", Pos: d.Pos()}) @@ -9535,14 +9586,14 @@ func (d *D) FieldScalarS3(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS3 tries to add a field and read 3 bit signed integer in current endian -func (d *D) TryFieldS3(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS3(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS3(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS3 adds a field and reads 3 bit signed integer in current endian -func (d *D) FieldS3(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS3(name, sms...).ActualS() +func (d *D) FieldS3(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS3(name, sms...).Actual } // Reader S4 @@ -9560,11 +9611,10 @@ func (d *D) S4() int64 { } // TryFieldScalarS4 tries to add a field and read 4 bit signed integer in current endian -func (d *D) TryFieldScalarS4(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS4(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(4, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9573,7 +9623,7 @@ func (d *D) TryFieldScalarS4(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS4 adds a field and reads 4 bit signed integer in current endian -func (d *D) FieldScalarS4(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS4(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS4(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S4", Pos: d.Pos()}) @@ -9582,14 +9632,14 @@ func (d *D) FieldScalarS4(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS4 tries to add a field and read 4 bit signed integer in current endian -func (d *D) TryFieldS4(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS4(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS4(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS4 adds a field and reads 4 bit signed integer in current endian -func (d *D) FieldS4(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS4(name, sms...).ActualS() +func (d *D) FieldS4(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS4(name, sms...).Actual } // Reader S5 @@ -9607,11 +9657,10 @@ func (d *D) S5() int64 { } // TryFieldScalarS5 tries to add a field and read 5 bit signed integer in current endian -func (d *D) TryFieldScalarS5(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS5(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(5, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9620,7 +9669,7 @@ func (d *D) TryFieldScalarS5(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS5 adds a field and reads 5 bit signed integer in current endian -func (d *D) FieldScalarS5(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS5(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS5(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S5", Pos: d.Pos()}) @@ -9629,14 +9678,14 @@ func (d *D) FieldScalarS5(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS5 tries to add a field and read 5 bit signed integer in current endian -func (d *D) TryFieldS5(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS5(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS5(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS5 adds a field and reads 5 bit signed integer in current endian -func (d *D) FieldS5(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS5(name, sms...).ActualS() +func (d *D) FieldS5(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS5(name, sms...).Actual } // Reader S6 @@ -9654,11 +9703,10 @@ func (d *D) S6() int64 { } // TryFieldScalarS6 tries to add a field and read 6 bit signed integer in current endian -func (d *D) TryFieldScalarS6(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS6(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(6, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9667,7 +9715,7 @@ func (d *D) TryFieldScalarS6(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS6 adds a field and reads 6 bit signed integer in current endian -func (d *D) FieldScalarS6(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS6(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS6(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S6", Pos: d.Pos()}) @@ -9676,14 +9724,14 @@ func (d *D) FieldScalarS6(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS6 tries to add a field and read 6 bit signed integer in current endian -func (d *D) TryFieldS6(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS6(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS6(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS6 adds a field and reads 6 bit signed integer in current endian -func (d *D) FieldS6(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS6(name, sms...).ActualS() +func (d *D) FieldS6(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS6(name, sms...).Actual } // Reader S7 @@ -9701,11 +9749,10 @@ func (d *D) S7() int64 { } // TryFieldScalarS7 tries to add a field and read 7 bit signed integer in current endian -func (d *D) TryFieldScalarS7(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS7(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(7, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9714,7 +9761,7 @@ func (d *D) TryFieldScalarS7(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS7 adds a field and reads 7 bit signed integer in current endian -func (d *D) FieldScalarS7(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS7(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS7(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S7", Pos: d.Pos()}) @@ -9723,14 +9770,14 @@ func (d *D) FieldScalarS7(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS7 tries to add a field and read 7 bit signed integer in current endian -func (d *D) TryFieldS7(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS7(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS7(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS7 adds a field and reads 7 bit signed integer in current endian -func (d *D) FieldS7(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS7(name, sms...).ActualS() +func (d *D) FieldS7(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS7(name, sms...).Actual } // Reader S8 @@ -9748,11 +9795,10 @@ func (d *D) S8() int64 { } // TryFieldScalarS8 tries to add a field and read 8 bit signed integer in current endian -func (d *D) TryFieldScalarS8(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS8(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(8, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9761,7 +9807,7 @@ func (d *D) TryFieldScalarS8(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS8 adds a field and reads 8 bit signed integer in current endian -func (d *D) FieldScalarS8(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS8(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS8(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S8", Pos: d.Pos()}) @@ -9770,14 +9816,14 @@ func (d *D) FieldScalarS8(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS8 tries to add a field and read 8 bit signed integer in current endian -func (d *D) TryFieldS8(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS8(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS8(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS8 adds a field and reads 8 bit signed integer in current endian -func (d *D) FieldS8(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS8(name, sms...).ActualS() +func (d *D) FieldS8(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS8(name, sms...).Actual } // Reader S9 @@ -9795,11 +9841,10 @@ func (d *D) S9() int64 { } // TryFieldScalarS9 tries to add a field and read 9 bit signed integer in current endian -func (d *D) TryFieldScalarS9(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS9(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(9, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9808,7 +9853,7 @@ func (d *D) TryFieldScalarS9(name string, sms ...scalar.Mapper) (*scalar.S, erro } // FieldScalarS9 adds a field and reads 9 bit signed integer in current endian -func (d *D) FieldScalarS9(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS9(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS9(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S9", Pos: d.Pos()}) @@ -9817,14 +9862,14 @@ func (d *D) FieldScalarS9(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS9 tries to add a field and read 9 bit signed integer in current endian -func (d *D) TryFieldS9(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS9(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS9(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS9 adds a field and reads 9 bit signed integer in current endian -func (d *D) FieldS9(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS9(name, sms...).ActualS() +func (d *D) FieldS9(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS9(name, sms...).Actual } // Reader S10 @@ -9842,11 +9887,10 @@ func (d *D) S10() int64 { } // TryFieldScalarS10 tries to add a field and read 10 bit signed integer in current endian -func (d *D) TryFieldScalarS10(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS10(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(10, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9855,7 +9899,7 @@ func (d *D) TryFieldScalarS10(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS10 adds a field and reads 10 bit signed integer in current endian -func (d *D) FieldScalarS10(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS10(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS10(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S10", Pos: d.Pos()}) @@ -9864,14 +9908,14 @@ func (d *D) FieldScalarS10(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS10 tries to add a field and read 10 bit signed integer in current endian -func (d *D) TryFieldS10(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS10(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS10(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS10 adds a field and reads 10 bit signed integer in current endian -func (d *D) FieldS10(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS10(name, sms...).ActualS() +func (d *D) FieldS10(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS10(name, sms...).Actual } // Reader S11 @@ -9889,11 +9933,10 @@ func (d *D) S11() int64 { } // TryFieldScalarS11 tries to add a field and read 11 bit signed integer in current endian -func (d *D) TryFieldScalarS11(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS11(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(11, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9902,7 +9945,7 @@ func (d *D) TryFieldScalarS11(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS11 adds a field and reads 11 bit signed integer in current endian -func (d *D) FieldScalarS11(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS11(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS11(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S11", Pos: d.Pos()}) @@ -9911,14 +9954,14 @@ func (d *D) FieldScalarS11(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS11 tries to add a field and read 11 bit signed integer in current endian -func (d *D) TryFieldS11(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS11(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS11(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS11 adds a field and reads 11 bit signed integer in current endian -func (d *D) FieldS11(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS11(name, sms...).ActualS() +func (d *D) FieldS11(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS11(name, sms...).Actual } // Reader S12 @@ -9936,11 +9979,10 @@ func (d *D) S12() int64 { } // TryFieldScalarS12 tries to add a field and read 12 bit signed integer in current endian -func (d *D) TryFieldScalarS12(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS12(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(12, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9949,7 +9991,7 @@ func (d *D) TryFieldScalarS12(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS12 adds a field and reads 12 bit signed integer in current endian -func (d *D) FieldScalarS12(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS12(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS12(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S12", Pos: d.Pos()}) @@ -9958,14 +10000,14 @@ func (d *D) FieldScalarS12(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS12 tries to add a field and read 12 bit signed integer in current endian -func (d *D) TryFieldS12(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS12(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS12(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS12 adds a field and reads 12 bit signed integer in current endian -func (d *D) FieldS12(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS12(name, sms...).ActualS() +func (d *D) FieldS12(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS12(name, sms...).Actual } // Reader S13 @@ -9983,11 +10025,10 @@ func (d *D) S13() int64 { } // TryFieldScalarS13 tries to add a field and read 13 bit signed integer in current endian -func (d *D) TryFieldScalarS13(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS13(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(13, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -9996,7 +10037,7 @@ func (d *D) TryFieldScalarS13(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS13 adds a field and reads 13 bit signed integer in current endian -func (d *D) FieldScalarS13(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS13(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS13(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S13", Pos: d.Pos()}) @@ -10005,14 +10046,14 @@ func (d *D) FieldScalarS13(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS13 tries to add a field and read 13 bit signed integer in current endian -func (d *D) TryFieldS13(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS13(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS13(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS13 adds a field and reads 13 bit signed integer in current endian -func (d *D) FieldS13(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS13(name, sms...).ActualS() +func (d *D) FieldS13(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS13(name, sms...).Actual } // Reader S14 @@ -10030,11 +10071,10 @@ func (d *D) S14() int64 { } // TryFieldScalarS14 tries to add a field and read 14 bit signed integer in current endian -func (d *D) TryFieldScalarS14(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS14(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(14, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10043,7 +10083,7 @@ func (d *D) TryFieldScalarS14(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS14 adds a field and reads 14 bit signed integer in current endian -func (d *D) FieldScalarS14(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS14(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS14(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S14", Pos: d.Pos()}) @@ -10052,14 +10092,14 @@ func (d *D) FieldScalarS14(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS14 tries to add a field and read 14 bit signed integer in current endian -func (d *D) TryFieldS14(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS14(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS14(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS14 adds a field and reads 14 bit signed integer in current endian -func (d *D) FieldS14(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS14(name, sms...).ActualS() +func (d *D) FieldS14(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS14(name, sms...).Actual } // Reader S15 @@ -10077,11 +10117,10 @@ func (d *D) S15() int64 { } // TryFieldScalarS15 tries to add a field and read 15 bit signed integer in current endian -func (d *D) TryFieldScalarS15(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS15(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(15, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10090,7 +10129,7 @@ func (d *D) TryFieldScalarS15(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS15 adds a field and reads 15 bit signed integer in current endian -func (d *D) FieldScalarS15(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS15(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS15(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S15", Pos: d.Pos()}) @@ -10099,14 +10138,14 @@ func (d *D) FieldScalarS15(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS15 tries to add a field and read 15 bit signed integer in current endian -func (d *D) TryFieldS15(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS15(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS15(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS15 adds a field and reads 15 bit signed integer in current endian -func (d *D) FieldS15(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS15(name, sms...).ActualS() +func (d *D) FieldS15(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS15(name, sms...).Actual } // Reader S16 @@ -10124,11 +10163,10 @@ func (d *D) S16() int64 { } // TryFieldScalarS16 tries to add a field and read 16 bit signed integer in current endian -func (d *D) TryFieldScalarS16(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS16(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(16, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10137,7 +10175,7 @@ func (d *D) TryFieldScalarS16(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS16 adds a field and reads 16 bit signed integer in current endian -func (d *D) FieldScalarS16(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS16(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS16(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S16", Pos: d.Pos()}) @@ -10146,14 +10184,14 @@ func (d *D) FieldScalarS16(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS16 tries to add a field and read 16 bit signed integer in current endian -func (d *D) TryFieldS16(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS16(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS16(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS16 adds a field and reads 16 bit signed integer in current endian -func (d *D) FieldS16(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS16(name, sms...).ActualS() +func (d *D) FieldS16(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS16(name, sms...).Actual } // Reader S17 @@ -10171,11 +10209,10 @@ func (d *D) S17() int64 { } // TryFieldScalarS17 tries to add a field and read 17 bit signed integer in current endian -func (d *D) TryFieldScalarS17(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS17(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(17, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10184,7 +10221,7 @@ func (d *D) TryFieldScalarS17(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS17 adds a field and reads 17 bit signed integer in current endian -func (d *D) FieldScalarS17(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS17(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS17(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S17", Pos: d.Pos()}) @@ -10193,14 +10230,14 @@ func (d *D) FieldScalarS17(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS17 tries to add a field and read 17 bit signed integer in current endian -func (d *D) TryFieldS17(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS17(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS17(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS17 adds a field and reads 17 bit signed integer in current endian -func (d *D) FieldS17(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS17(name, sms...).ActualS() +func (d *D) FieldS17(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS17(name, sms...).Actual } // Reader S18 @@ -10218,11 +10255,10 @@ func (d *D) S18() int64 { } // TryFieldScalarS18 tries to add a field and read 18 bit signed integer in current endian -func (d *D) TryFieldScalarS18(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS18(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(18, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10231,7 +10267,7 @@ func (d *D) TryFieldScalarS18(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS18 adds a field and reads 18 bit signed integer in current endian -func (d *D) FieldScalarS18(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS18(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS18(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S18", Pos: d.Pos()}) @@ -10240,14 +10276,14 @@ func (d *D) FieldScalarS18(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS18 tries to add a field and read 18 bit signed integer in current endian -func (d *D) TryFieldS18(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS18(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS18(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS18 adds a field and reads 18 bit signed integer in current endian -func (d *D) FieldS18(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS18(name, sms...).ActualS() +func (d *D) FieldS18(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS18(name, sms...).Actual } // Reader S19 @@ -10265,11 +10301,10 @@ func (d *D) S19() int64 { } // TryFieldScalarS19 tries to add a field and read 19 bit signed integer in current endian -func (d *D) TryFieldScalarS19(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS19(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(19, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10278,7 +10313,7 @@ func (d *D) TryFieldScalarS19(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS19 adds a field and reads 19 bit signed integer in current endian -func (d *D) FieldScalarS19(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS19(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS19(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S19", Pos: d.Pos()}) @@ -10287,14 +10322,14 @@ func (d *D) FieldScalarS19(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS19 tries to add a field and read 19 bit signed integer in current endian -func (d *D) TryFieldS19(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS19(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS19(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS19 adds a field and reads 19 bit signed integer in current endian -func (d *D) FieldS19(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS19(name, sms...).ActualS() +func (d *D) FieldS19(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS19(name, sms...).Actual } // Reader S20 @@ -10312,11 +10347,10 @@ func (d *D) S20() int64 { } // TryFieldScalarS20 tries to add a field and read 20 bit signed integer in current endian -func (d *D) TryFieldScalarS20(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS20(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(20, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10325,7 +10359,7 @@ func (d *D) TryFieldScalarS20(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS20 adds a field and reads 20 bit signed integer in current endian -func (d *D) FieldScalarS20(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS20(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS20(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S20", Pos: d.Pos()}) @@ -10334,14 +10368,14 @@ func (d *D) FieldScalarS20(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS20 tries to add a field and read 20 bit signed integer in current endian -func (d *D) TryFieldS20(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS20(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS20(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS20 adds a field and reads 20 bit signed integer in current endian -func (d *D) FieldS20(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS20(name, sms...).ActualS() +func (d *D) FieldS20(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS20(name, sms...).Actual } // Reader S21 @@ -10359,11 +10393,10 @@ func (d *D) S21() int64 { } // TryFieldScalarS21 tries to add a field and read 21 bit signed integer in current endian -func (d *D) TryFieldScalarS21(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS21(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(21, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10372,7 +10405,7 @@ func (d *D) TryFieldScalarS21(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS21 adds a field and reads 21 bit signed integer in current endian -func (d *D) FieldScalarS21(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS21(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS21(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S21", Pos: d.Pos()}) @@ -10381,14 +10414,14 @@ func (d *D) FieldScalarS21(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS21 tries to add a field and read 21 bit signed integer in current endian -func (d *D) TryFieldS21(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS21(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS21(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS21 adds a field and reads 21 bit signed integer in current endian -func (d *D) FieldS21(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS21(name, sms...).ActualS() +func (d *D) FieldS21(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS21(name, sms...).Actual } // Reader S22 @@ -10406,11 +10439,10 @@ func (d *D) S22() int64 { } // TryFieldScalarS22 tries to add a field and read 22 bit signed integer in current endian -func (d *D) TryFieldScalarS22(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS22(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(22, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10419,7 +10451,7 @@ func (d *D) TryFieldScalarS22(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS22 adds a field and reads 22 bit signed integer in current endian -func (d *D) FieldScalarS22(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS22(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS22(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S22", Pos: d.Pos()}) @@ -10428,14 +10460,14 @@ func (d *D) FieldScalarS22(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS22 tries to add a field and read 22 bit signed integer in current endian -func (d *D) TryFieldS22(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS22(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS22(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS22 adds a field and reads 22 bit signed integer in current endian -func (d *D) FieldS22(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS22(name, sms...).ActualS() +func (d *D) FieldS22(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS22(name, sms...).Actual } // Reader S23 @@ -10453,11 +10485,10 @@ func (d *D) S23() int64 { } // TryFieldScalarS23 tries to add a field and read 23 bit signed integer in current endian -func (d *D) TryFieldScalarS23(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS23(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(23, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10466,7 +10497,7 @@ func (d *D) TryFieldScalarS23(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS23 adds a field and reads 23 bit signed integer in current endian -func (d *D) FieldScalarS23(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS23(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS23(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S23", Pos: d.Pos()}) @@ -10475,14 +10506,14 @@ func (d *D) FieldScalarS23(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS23 tries to add a field and read 23 bit signed integer in current endian -func (d *D) TryFieldS23(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS23(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS23(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS23 adds a field and reads 23 bit signed integer in current endian -func (d *D) FieldS23(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS23(name, sms...).ActualS() +func (d *D) FieldS23(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS23(name, sms...).Actual } // Reader S24 @@ -10500,11 +10531,10 @@ func (d *D) S24() int64 { } // TryFieldScalarS24 tries to add a field and read 24 bit signed integer in current endian -func (d *D) TryFieldScalarS24(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS24(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(24, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10513,7 +10543,7 @@ func (d *D) TryFieldScalarS24(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS24 adds a field and reads 24 bit signed integer in current endian -func (d *D) FieldScalarS24(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS24(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS24(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S24", Pos: d.Pos()}) @@ -10522,14 +10552,14 @@ func (d *D) FieldScalarS24(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS24 tries to add a field and read 24 bit signed integer in current endian -func (d *D) TryFieldS24(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS24(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS24(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS24 adds a field and reads 24 bit signed integer in current endian -func (d *D) FieldS24(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS24(name, sms...).ActualS() +func (d *D) FieldS24(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS24(name, sms...).Actual } // Reader S25 @@ -10547,11 +10577,10 @@ func (d *D) S25() int64 { } // TryFieldScalarS25 tries to add a field and read 25 bit signed integer in current endian -func (d *D) TryFieldScalarS25(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS25(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(25, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10560,7 +10589,7 @@ func (d *D) TryFieldScalarS25(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS25 adds a field and reads 25 bit signed integer in current endian -func (d *D) FieldScalarS25(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS25(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS25(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S25", Pos: d.Pos()}) @@ -10569,14 +10598,14 @@ func (d *D) FieldScalarS25(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS25 tries to add a field and read 25 bit signed integer in current endian -func (d *D) TryFieldS25(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS25(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS25(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS25 adds a field and reads 25 bit signed integer in current endian -func (d *D) FieldS25(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS25(name, sms...).ActualS() +func (d *D) FieldS25(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS25(name, sms...).Actual } // Reader S26 @@ -10594,11 +10623,10 @@ func (d *D) S26() int64 { } // TryFieldScalarS26 tries to add a field and read 26 bit signed integer in current endian -func (d *D) TryFieldScalarS26(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS26(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(26, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10607,7 +10635,7 @@ func (d *D) TryFieldScalarS26(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS26 adds a field and reads 26 bit signed integer in current endian -func (d *D) FieldScalarS26(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS26(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS26(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S26", Pos: d.Pos()}) @@ -10616,14 +10644,14 @@ func (d *D) FieldScalarS26(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS26 tries to add a field and read 26 bit signed integer in current endian -func (d *D) TryFieldS26(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS26(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS26(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS26 adds a field and reads 26 bit signed integer in current endian -func (d *D) FieldS26(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS26(name, sms...).ActualS() +func (d *D) FieldS26(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS26(name, sms...).Actual } // Reader S27 @@ -10641,11 +10669,10 @@ func (d *D) S27() int64 { } // TryFieldScalarS27 tries to add a field and read 27 bit signed integer in current endian -func (d *D) TryFieldScalarS27(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS27(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(27, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10654,7 +10681,7 @@ func (d *D) TryFieldScalarS27(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS27 adds a field and reads 27 bit signed integer in current endian -func (d *D) FieldScalarS27(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS27(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS27(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S27", Pos: d.Pos()}) @@ -10663,14 +10690,14 @@ func (d *D) FieldScalarS27(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS27 tries to add a field and read 27 bit signed integer in current endian -func (d *D) TryFieldS27(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS27(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS27(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS27 adds a field and reads 27 bit signed integer in current endian -func (d *D) FieldS27(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS27(name, sms...).ActualS() +func (d *D) FieldS27(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS27(name, sms...).Actual } // Reader S28 @@ -10688,11 +10715,10 @@ func (d *D) S28() int64 { } // TryFieldScalarS28 tries to add a field and read 28 bit signed integer in current endian -func (d *D) TryFieldScalarS28(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS28(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(28, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10701,7 +10727,7 @@ func (d *D) TryFieldScalarS28(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS28 adds a field and reads 28 bit signed integer in current endian -func (d *D) FieldScalarS28(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS28(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS28(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S28", Pos: d.Pos()}) @@ -10710,14 +10736,14 @@ func (d *D) FieldScalarS28(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS28 tries to add a field and read 28 bit signed integer in current endian -func (d *D) TryFieldS28(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS28(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS28(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS28 adds a field and reads 28 bit signed integer in current endian -func (d *D) FieldS28(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS28(name, sms...).ActualS() +func (d *D) FieldS28(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS28(name, sms...).Actual } // Reader S29 @@ -10735,11 +10761,10 @@ func (d *D) S29() int64 { } // TryFieldScalarS29 tries to add a field and read 29 bit signed integer in current endian -func (d *D) TryFieldScalarS29(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS29(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(29, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10748,7 +10773,7 @@ func (d *D) TryFieldScalarS29(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS29 adds a field and reads 29 bit signed integer in current endian -func (d *D) FieldScalarS29(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS29(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS29(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S29", Pos: d.Pos()}) @@ -10757,14 +10782,14 @@ func (d *D) FieldScalarS29(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS29 tries to add a field and read 29 bit signed integer in current endian -func (d *D) TryFieldS29(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS29(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS29(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS29 adds a field and reads 29 bit signed integer in current endian -func (d *D) FieldS29(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS29(name, sms...).ActualS() +func (d *D) FieldS29(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS29(name, sms...).Actual } // Reader S30 @@ -10782,11 +10807,10 @@ func (d *D) S30() int64 { } // TryFieldScalarS30 tries to add a field and read 30 bit signed integer in current endian -func (d *D) TryFieldScalarS30(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS30(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(30, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10795,7 +10819,7 @@ func (d *D) TryFieldScalarS30(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS30 adds a field and reads 30 bit signed integer in current endian -func (d *D) FieldScalarS30(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS30(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS30(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S30", Pos: d.Pos()}) @@ -10804,14 +10828,14 @@ func (d *D) FieldScalarS30(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS30 tries to add a field and read 30 bit signed integer in current endian -func (d *D) TryFieldS30(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS30(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS30(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS30 adds a field and reads 30 bit signed integer in current endian -func (d *D) FieldS30(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS30(name, sms...).ActualS() +func (d *D) FieldS30(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS30(name, sms...).Actual } // Reader S31 @@ -10829,11 +10853,10 @@ func (d *D) S31() int64 { } // TryFieldScalarS31 tries to add a field and read 31 bit signed integer in current endian -func (d *D) TryFieldScalarS31(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS31(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(31, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10842,7 +10865,7 @@ func (d *D) TryFieldScalarS31(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS31 adds a field and reads 31 bit signed integer in current endian -func (d *D) FieldScalarS31(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS31(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS31(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S31", Pos: d.Pos()}) @@ -10851,14 +10874,14 @@ func (d *D) FieldScalarS31(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS31 tries to add a field and read 31 bit signed integer in current endian -func (d *D) TryFieldS31(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS31(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS31(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS31 adds a field and reads 31 bit signed integer in current endian -func (d *D) FieldS31(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS31(name, sms...).ActualS() +func (d *D) FieldS31(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS31(name, sms...).Actual } // Reader S32 @@ -10876,11 +10899,10 @@ func (d *D) S32() int64 { } // TryFieldScalarS32 tries to add a field and read 32 bit signed integer in current endian -func (d *D) TryFieldScalarS32(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS32(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(32, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10889,7 +10911,7 @@ func (d *D) TryFieldScalarS32(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS32 adds a field and reads 32 bit signed integer in current endian -func (d *D) FieldScalarS32(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS32(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS32(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S32", Pos: d.Pos()}) @@ -10898,14 +10920,14 @@ func (d *D) FieldScalarS32(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS32 tries to add a field and read 32 bit signed integer in current endian -func (d *D) TryFieldS32(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS32(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS32(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS32 adds a field and reads 32 bit signed integer in current endian -func (d *D) FieldS32(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS32(name, sms...).ActualS() +func (d *D) FieldS32(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS32(name, sms...).Actual } // Reader S33 @@ -10923,11 +10945,10 @@ func (d *D) S33() int64 { } // TryFieldScalarS33 tries to add a field and read 33 bit signed integer in current endian -func (d *D) TryFieldScalarS33(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS33(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(33, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10936,7 +10957,7 @@ func (d *D) TryFieldScalarS33(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS33 adds a field and reads 33 bit signed integer in current endian -func (d *D) FieldScalarS33(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS33(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS33(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S33", Pos: d.Pos()}) @@ -10945,14 +10966,14 @@ func (d *D) FieldScalarS33(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS33 tries to add a field and read 33 bit signed integer in current endian -func (d *D) TryFieldS33(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS33(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS33(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS33 adds a field and reads 33 bit signed integer in current endian -func (d *D) FieldS33(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS33(name, sms...).ActualS() +func (d *D) FieldS33(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS33(name, sms...).Actual } // Reader S34 @@ -10970,11 +10991,10 @@ func (d *D) S34() int64 { } // TryFieldScalarS34 tries to add a field and read 34 bit signed integer in current endian -func (d *D) TryFieldScalarS34(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS34(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(34, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -10983,7 +11003,7 @@ func (d *D) TryFieldScalarS34(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS34 adds a field and reads 34 bit signed integer in current endian -func (d *D) FieldScalarS34(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS34(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS34(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S34", Pos: d.Pos()}) @@ -10992,14 +11012,14 @@ func (d *D) FieldScalarS34(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS34 tries to add a field and read 34 bit signed integer in current endian -func (d *D) TryFieldS34(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS34(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS34(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS34 adds a field and reads 34 bit signed integer in current endian -func (d *D) FieldS34(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS34(name, sms...).ActualS() +func (d *D) FieldS34(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS34(name, sms...).Actual } // Reader S35 @@ -11017,11 +11037,10 @@ func (d *D) S35() int64 { } // TryFieldScalarS35 tries to add a field and read 35 bit signed integer in current endian -func (d *D) TryFieldScalarS35(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS35(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(35, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11030,7 +11049,7 @@ func (d *D) TryFieldScalarS35(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS35 adds a field and reads 35 bit signed integer in current endian -func (d *D) FieldScalarS35(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS35(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS35(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S35", Pos: d.Pos()}) @@ -11039,14 +11058,14 @@ func (d *D) FieldScalarS35(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS35 tries to add a field and read 35 bit signed integer in current endian -func (d *D) TryFieldS35(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS35(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS35(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS35 adds a field and reads 35 bit signed integer in current endian -func (d *D) FieldS35(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS35(name, sms...).ActualS() +func (d *D) FieldS35(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS35(name, sms...).Actual } // Reader S36 @@ -11064,11 +11083,10 @@ func (d *D) S36() int64 { } // TryFieldScalarS36 tries to add a field and read 36 bit signed integer in current endian -func (d *D) TryFieldScalarS36(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS36(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(36, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11077,7 +11095,7 @@ func (d *D) TryFieldScalarS36(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS36 adds a field and reads 36 bit signed integer in current endian -func (d *D) FieldScalarS36(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS36(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS36(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S36", Pos: d.Pos()}) @@ -11086,14 +11104,14 @@ func (d *D) FieldScalarS36(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS36 tries to add a field and read 36 bit signed integer in current endian -func (d *D) TryFieldS36(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS36(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS36(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS36 adds a field and reads 36 bit signed integer in current endian -func (d *D) FieldS36(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS36(name, sms...).ActualS() +func (d *D) FieldS36(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS36(name, sms...).Actual } // Reader S37 @@ -11111,11 +11129,10 @@ func (d *D) S37() int64 { } // TryFieldScalarS37 tries to add a field and read 37 bit signed integer in current endian -func (d *D) TryFieldScalarS37(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS37(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(37, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11124,7 +11141,7 @@ func (d *D) TryFieldScalarS37(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS37 adds a field and reads 37 bit signed integer in current endian -func (d *D) FieldScalarS37(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS37(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS37(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S37", Pos: d.Pos()}) @@ -11133,14 +11150,14 @@ func (d *D) FieldScalarS37(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS37 tries to add a field and read 37 bit signed integer in current endian -func (d *D) TryFieldS37(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS37(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS37(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS37 adds a field and reads 37 bit signed integer in current endian -func (d *D) FieldS37(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS37(name, sms...).ActualS() +func (d *D) FieldS37(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS37(name, sms...).Actual } // Reader S38 @@ -11158,11 +11175,10 @@ func (d *D) S38() int64 { } // TryFieldScalarS38 tries to add a field and read 38 bit signed integer in current endian -func (d *D) TryFieldScalarS38(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS38(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(38, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11171,7 +11187,7 @@ func (d *D) TryFieldScalarS38(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS38 adds a field and reads 38 bit signed integer in current endian -func (d *D) FieldScalarS38(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS38(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS38(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S38", Pos: d.Pos()}) @@ -11180,14 +11196,14 @@ func (d *D) FieldScalarS38(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS38 tries to add a field and read 38 bit signed integer in current endian -func (d *D) TryFieldS38(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS38(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS38(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS38 adds a field and reads 38 bit signed integer in current endian -func (d *D) FieldS38(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS38(name, sms...).ActualS() +func (d *D) FieldS38(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS38(name, sms...).Actual } // Reader S39 @@ -11205,11 +11221,10 @@ func (d *D) S39() int64 { } // TryFieldScalarS39 tries to add a field and read 39 bit signed integer in current endian -func (d *D) TryFieldScalarS39(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS39(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(39, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11218,7 +11233,7 @@ func (d *D) TryFieldScalarS39(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS39 adds a field and reads 39 bit signed integer in current endian -func (d *D) FieldScalarS39(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS39(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS39(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S39", Pos: d.Pos()}) @@ -11227,14 +11242,14 @@ func (d *D) FieldScalarS39(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS39 tries to add a field and read 39 bit signed integer in current endian -func (d *D) TryFieldS39(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS39(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS39(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS39 adds a field and reads 39 bit signed integer in current endian -func (d *D) FieldS39(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS39(name, sms...).ActualS() +func (d *D) FieldS39(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS39(name, sms...).Actual } // Reader S40 @@ -11252,11 +11267,10 @@ func (d *D) S40() int64 { } // TryFieldScalarS40 tries to add a field and read 40 bit signed integer in current endian -func (d *D) TryFieldScalarS40(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS40(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(40, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11265,7 +11279,7 @@ func (d *D) TryFieldScalarS40(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS40 adds a field and reads 40 bit signed integer in current endian -func (d *D) FieldScalarS40(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS40(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS40(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S40", Pos: d.Pos()}) @@ -11274,14 +11288,14 @@ func (d *D) FieldScalarS40(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS40 tries to add a field and read 40 bit signed integer in current endian -func (d *D) TryFieldS40(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS40(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS40(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS40 adds a field and reads 40 bit signed integer in current endian -func (d *D) FieldS40(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS40(name, sms...).ActualS() +func (d *D) FieldS40(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS40(name, sms...).Actual } // Reader S41 @@ -11299,11 +11313,10 @@ func (d *D) S41() int64 { } // TryFieldScalarS41 tries to add a field and read 41 bit signed integer in current endian -func (d *D) TryFieldScalarS41(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS41(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(41, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11312,7 +11325,7 @@ func (d *D) TryFieldScalarS41(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS41 adds a field and reads 41 bit signed integer in current endian -func (d *D) FieldScalarS41(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS41(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS41(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S41", Pos: d.Pos()}) @@ -11321,14 +11334,14 @@ func (d *D) FieldScalarS41(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS41 tries to add a field and read 41 bit signed integer in current endian -func (d *D) TryFieldS41(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS41(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS41(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS41 adds a field and reads 41 bit signed integer in current endian -func (d *D) FieldS41(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS41(name, sms...).ActualS() +func (d *D) FieldS41(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS41(name, sms...).Actual } // Reader S42 @@ -11346,11 +11359,10 @@ func (d *D) S42() int64 { } // TryFieldScalarS42 tries to add a field and read 42 bit signed integer in current endian -func (d *D) TryFieldScalarS42(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS42(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(42, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11359,7 +11371,7 @@ func (d *D) TryFieldScalarS42(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS42 adds a field and reads 42 bit signed integer in current endian -func (d *D) FieldScalarS42(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS42(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS42(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S42", Pos: d.Pos()}) @@ -11368,14 +11380,14 @@ func (d *D) FieldScalarS42(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS42 tries to add a field and read 42 bit signed integer in current endian -func (d *D) TryFieldS42(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS42(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS42(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS42 adds a field and reads 42 bit signed integer in current endian -func (d *D) FieldS42(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS42(name, sms...).ActualS() +func (d *D) FieldS42(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS42(name, sms...).Actual } // Reader S43 @@ -11393,11 +11405,10 @@ func (d *D) S43() int64 { } // TryFieldScalarS43 tries to add a field and read 43 bit signed integer in current endian -func (d *D) TryFieldScalarS43(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS43(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(43, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11406,7 +11417,7 @@ func (d *D) TryFieldScalarS43(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS43 adds a field and reads 43 bit signed integer in current endian -func (d *D) FieldScalarS43(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS43(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS43(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S43", Pos: d.Pos()}) @@ -11415,14 +11426,14 @@ func (d *D) FieldScalarS43(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS43 tries to add a field and read 43 bit signed integer in current endian -func (d *D) TryFieldS43(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS43(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS43(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS43 adds a field and reads 43 bit signed integer in current endian -func (d *D) FieldS43(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS43(name, sms...).ActualS() +func (d *D) FieldS43(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS43(name, sms...).Actual } // Reader S44 @@ -11440,11 +11451,10 @@ func (d *D) S44() int64 { } // TryFieldScalarS44 tries to add a field and read 44 bit signed integer in current endian -func (d *D) TryFieldScalarS44(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS44(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(44, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11453,7 +11463,7 @@ func (d *D) TryFieldScalarS44(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS44 adds a field and reads 44 bit signed integer in current endian -func (d *D) FieldScalarS44(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS44(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS44(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S44", Pos: d.Pos()}) @@ -11462,14 +11472,14 @@ func (d *D) FieldScalarS44(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS44 tries to add a field and read 44 bit signed integer in current endian -func (d *D) TryFieldS44(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS44(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS44(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS44 adds a field and reads 44 bit signed integer in current endian -func (d *D) FieldS44(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS44(name, sms...).ActualS() +func (d *D) FieldS44(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS44(name, sms...).Actual } // Reader S45 @@ -11487,11 +11497,10 @@ func (d *D) S45() int64 { } // TryFieldScalarS45 tries to add a field and read 45 bit signed integer in current endian -func (d *D) TryFieldScalarS45(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS45(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(45, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11500,7 +11509,7 @@ func (d *D) TryFieldScalarS45(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS45 adds a field and reads 45 bit signed integer in current endian -func (d *D) FieldScalarS45(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS45(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS45(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S45", Pos: d.Pos()}) @@ -11509,14 +11518,14 @@ func (d *D) FieldScalarS45(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS45 tries to add a field and read 45 bit signed integer in current endian -func (d *D) TryFieldS45(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS45(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS45(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS45 adds a field and reads 45 bit signed integer in current endian -func (d *D) FieldS45(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS45(name, sms...).ActualS() +func (d *D) FieldS45(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS45(name, sms...).Actual } // Reader S46 @@ -11534,11 +11543,10 @@ func (d *D) S46() int64 { } // TryFieldScalarS46 tries to add a field and read 46 bit signed integer in current endian -func (d *D) TryFieldScalarS46(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS46(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(46, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11547,7 +11555,7 @@ func (d *D) TryFieldScalarS46(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS46 adds a field and reads 46 bit signed integer in current endian -func (d *D) FieldScalarS46(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS46(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS46(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S46", Pos: d.Pos()}) @@ -11556,14 +11564,14 @@ func (d *D) FieldScalarS46(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS46 tries to add a field and read 46 bit signed integer in current endian -func (d *D) TryFieldS46(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS46(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS46(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS46 adds a field and reads 46 bit signed integer in current endian -func (d *D) FieldS46(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS46(name, sms...).ActualS() +func (d *D) FieldS46(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS46(name, sms...).Actual } // Reader S47 @@ -11581,11 +11589,10 @@ func (d *D) S47() int64 { } // TryFieldScalarS47 tries to add a field and read 47 bit signed integer in current endian -func (d *D) TryFieldScalarS47(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS47(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(47, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11594,7 +11601,7 @@ func (d *D) TryFieldScalarS47(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS47 adds a field and reads 47 bit signed integer in current endian -func (d *D) FieldScalarS47(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS47(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS47(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S47", Pos: d.Pos()}) @@ -11603,14 +11610,14 @@ func (d *D) FieldScalarS47(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS47 tries to add a field and read 47 bit signed integer in current endian -func (d *D) TryFieldS47(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS47(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS47(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS47 adds a field and reads 47 bit signed integer in current endian -func (d *D) FieldS47(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS47(name, sms...).ActualS() +func (d *D) FieldS47(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS47(name, sms...).Actual } // Reader S48 @@ -11628,11 +11635,10 @@ func (d *D) S48() int64 { } // TryFieldScalarS48 tries to add a field and read 48 bit signed integer in current endian -func (d *D) TryFieldScalarS48(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS48(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(48, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11641,7 +11647,7 @@ func (d *D) TryFieldScalarS48(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS48 adds a field and reads 48 bit signed integer in current endian -func (d *D) FieldScalarS48(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS48(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS48(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S48", Pos: d.Pos()}) @@ -11650,14 +11656,14 @@ func (d *D) FieldScalarS48(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS48 tries to add a field and read 48 bit signed integer in current endian -func (d *D) TryFieldS48(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS48(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS48(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS48 adds a field and reads 48 bit signed integer in current endian -func (d *D) FieldS48(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS48(name, sms...).ActualS() +func (d *D) FieldS48(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS48(name, sms...).Actual } // Reader S49 @@ -11675,11 +11681,10 @@ func (d *D) S49() int64 { } // TryFieldScalarS49 tries to add a field and read 49 bit signed integer in current endian -func (d *D) TryFieldScalarS49(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS49(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(49, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11688,7 +11693,7 @@ func (d *D) TryFieldScalarS49(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS49 adds a field and reads 49 bit signed integer in current endian -func (d *D) FieldScalarS49(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS49(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS49(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S49", Pos: d.Pos()}) @@ -11697,14 +11702,14 @@ func (d *D) FieldScalarS49(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS49 tries to add a field and read 49 bit signed integer in current endian -func (d *D) TryFieldS49(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS49(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS49(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS49 adds a field and reads 49 bit signed integer in current endian -func (d *D) FieldS49(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS49(name, sms...).ActualS() +func (d *D) FieldS49(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS49(name, sms...).Actual } // Reader S50 @@ -11722,11 +11727,10 @@ func (d *D) S50() int64 { } // TryFieldScalarS50 tries to add a field and read 50 bit signed integer in current endian -func (d *D) TryFieldScalarS50(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS50(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(50, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11735,7 +11739,7 @@ func (d *D) TryFieldScalarS50(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS50 adds a field and reads 50 bit signed integer in current endian -func (d *D) FieldScalarS50(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS50(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS50(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S50", Pos: d.Pos()}) @@ -11744,14 +11748,14 @@ func (d *D) FieldScalarS50(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS50 tries to add a field and read 50 bit signed integer in current endian -func (d *D) TryFieldS50(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS50(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS50(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS50 adds a field and reads 50 bit signed integer in current endian -func (d *D) FieldS50(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS50(name, sms...).ActualS() +func (d *D) FieldS50(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS50(name, sms...).Actual } // Reader S51 @@ -11769,11 +11773,10 @@ func (d *D) S51() int64 { } // TryFieldScalarS51 tries to add a field and read 51 bit signed integer in current endian -func (d *D) TryFieldScalarS51(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS51(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(51, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11782,7 +11785,7 @@ func (d *D) TryFieldScalarS51(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS51 adds a field and reads 51 bit signed integer in current endian -func (d *D) FieldScalarS51(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS51(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS51(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S51", Pos: d.Pos()}) @@ -11791,14 +11794,14 @@ func (d *D) FieldScalarS51(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS51 tries to add a field and read 51 bit signed integer in current endian -func (d *D) TryFieldS51(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS51(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS51(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS51 adds a field and reads 51 bit signed integer in current endian -func (d *D) FieldS51(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS51(name, sms...).ActualS() +func (d *D) FieldS51(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS51(name, sms...).Actual } // Reader S52 @@ -11816,11 +11819,10 @@ func (d *D) S52() int64 { } // TryFieldScalarS52 tries to add a field and read 52 bit signed integer in current endian -func (d *D) TryFieldScalarS52(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS52(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(52, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11829,7 +11831,7 @@ func (d *D) TryFieldScalarS52(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS52 adds a field and reads 52 bit signed integer in current endian -func (d *D) FieldScalarS52(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS52(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS52(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S52", Pos: d.Pos()}) @@ -11838,14 +11840,14 @@ func (d *D) FieldScalarS52(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS52 tries to add a field and read 52 bit signed integer in current endian -func (d *D) TryFieldS52(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS52(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS52(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS52 adds a field and reads 52 bit signed integer in current endian -func (d *D) FieldS52(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS52(name, sms...).ActualS() +func (d *D) FieldS52(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS52(name, sms...).Actual } // Reader S53 @@ -11863,11 +11865,10 @@ func (d *D) S53() int64 { } // TryFieldScalarS53 tries to add a field and read 53 bit signed integer in current endian -func (d *D) TryFieldScalarS53(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS53(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(53, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11876,7 +11877,7 @@ func (d *D) TryFieldScalarS53(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS53 adds a field and reads 53 bit signed integer in current endian -func (d *D) FieldScalarS53(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS53(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS53(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S53", Pos: d.Pos()}) @@ -11885,14 +11886,14 @@ func (d *D) FieldScalarS53(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS53 tries to add a field and read 53 bit signed integer in current endian -func (d *D) TryFieldS53(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS53(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS53(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS53 adds a field and reads 53 bit signed integer in current endian -func (d *D) FieldS53(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS53(name, sms...).ActualS() +func (d *D) FieldS53(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS53(name, sms...).Actual } // Reader S54 @@ -11910,11 +11911,10 @@ func (d *D) S54() int64 { } // TryFieldScalarS54 tries to add a field and read 54 bit signed integer in current endian -func (d *D) TryFieldScalarS54(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS54(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(54, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11923,7 +11923,7 @@ func (d *D) TryFieldScalarS54(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS54 adds a field and reads 54 bit signed integer in current endian -func (d *D) FieldScalarS54(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS54(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS54(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S54", Pos: d.Pos()}) @@ -11932,14 +11932,14 @@ func (d *D) FieldScalarS54(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS54 tries to add a field and read 54 bit signed integer in current endian -func (d *D) TryFieldS54(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS54(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS54(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS54 adds a field and reads 54 bit signed integer in current endian -func (d *D) FieldS54(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS54(name, sms...).ActualS() +func (d *D) FieldS54(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS54(name, sms...).Actual } // Reader S55 @@ -11957,11 +11957,10 @@ func (d *D) S55() int64 { } // TryFieldScalarS55 tries to add a field and read 55 bit signed integer in current endian -func (d *D) TryFieldScalarS55(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS55(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(55, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -11970,7 +11969,7 @@ func (d *D) TryFieldScalarS55(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS55 adds a field and reads 55 bit signed integer in current endian -func (d *D) FieldScalarS55(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS55(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS55(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S55", Pos: d.Pos()}) @@ -11979,14 +11978,14 @@ func (d *D) FieldScalarS55(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS55 tries to add a field and read 55 bit signed integer in current endian -func (d *D) TryFieldS55(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS55(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS55(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS55 adds a field and reads 55 bit signed integer in current endian -func (d *D) FieldS55(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS55(name, sms...).ActualS() +func (d *D) FieldS55(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS55(name, sms...).Actual } // Reader S56 @@ -12004,11 +12003,10 @@ func (d *D) S56() int64 { } // TryFieldScalarS56 tries to add a field and read 56 bit signed integer in current endian -func (d *D) TryFieldScalarS56(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS56(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(56, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12017,7 +12015,7 @@ func (d *D) TryFieldScalarS56(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS56 adds a field and reads 56 bit signed integer in current endian -func (d *D) FieldScalarS56(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS56(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS56(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S56", Pos: d.Pos()}) @@ -12026,14 +12024,14 @@ func (d *D) FieldScalarS56(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS56 tries to add a field and read 56 bit signed integer in current endian -func (d *D) TryFieldS56(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS56(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS56(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS56 adds a field and reads 56 bit signed integer in current endian -func (d *D) FieldS56(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS56(name, sms...).ActualS() +func (d *D) FieldS56(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS56(name, sms...).Actual } // Reader S57 @@ -12051,11 +12049,10 @@ func (d *D) S57() int64 { } // TryFieldScalarS57 tries to add a field and read 57 bit signed integer in current endian -func (d *D) TryFieldScalarS57(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS57(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(57, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12064,7 +12061,7 @@ func (d *D) TryFieldScalarS57(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS57 adds a field and reads 57 bit signed integer in current endian -func (d *D) FieldScalarS57(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS57(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS57(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S57", Pos: d.Pos()}) @@ -12073,14 +12070,14 @@ func (d *D) FieldScalarS57(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS57 tries to add a field and read 57 bit signed integer in current endian -func (d *D) TryFieldS57(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS57(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS57(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS57 adds a field and reads 57 bit signed integer in current endian -func (d *D) FieldS57(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS57(name, sms...).ActualS() +func (d *D) FieldS57(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS57(name, sms...).Actual } // Reader S58 @@ -12098,11 +12095,10 @@ func (d *D) S58() int64 { } // TryFieldScalarS58 tries to add a field and read 58 bit signed integer in current endian -func (d *D) TryFieldScalarS58(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS58(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(58, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12111,7 +12107,7 @@ func (d *D) TryFieldScalarS58(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS58 adds a field and reads 58 bit signed integer in current endian -func (d *D) FieldScalarS58(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS58(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS58(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S58", Pos: d.Pos()}) @@ -12120,14 +12116,14 @@ func (d *D) FieldScalarS58(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS58 tries to add a field and read 58 bit signed integer in current endian -func (d *D) TryFieldS58(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS58(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS58(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS58 adds a field and reads 58 bit signed integer in current endian -func (d *D) FieldS58(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS58(name, sms...).ActualS() +func (d *D) FieldS58(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS58(name, sms...).Actual } // Reader S59 @@ -12145,11 +12141,10 @@ func (d *D) S59() int64 { } // TryFieldScalarS59 tries to add a field and read 59 bit signed integer in current endian -func (d *D) TryFieldScalarS59(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS59(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(59, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12158,7 +12153,7 @@ func (d *D) TryFieldScalarS59(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS59 adds a field and reads 59 bit signed integer in current endian -func (d *D) FieldScalarS59(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS59(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS59(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S59", Pos: d.Pos()}) @@ -12167,14 +12162,14 @@ func (d *D) FieldScalarS59(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS59 tries to add a field and read 59 bit signed integer in current endian -func (d *D) TryFieldS59(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS59(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS59(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS59 adds a field and reads 59 bit signed integer in current endian -func (d *D) FieldS59(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS59(name, sms...).ActualS() +func (d *D) FieldS59(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS59(name, sms...).Actual } // Reader S60 @@ -12192,11 +12187,10 @@ func (d *D) S60() int64 { } // TryFieldScalarS60 tries to add a field and read 60 bit signed integer in current endian -func (d *D) TryFieldScalarS60(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS60(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(60, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12205,7 +12199,7 @@ func (d *D) TryFieldScalarS60(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS60 adds a field and reads 60 bit signed integer in current endian -func (d *D) FieldScalarS60(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS60(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS60(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S60", Pos: d.Pos()}) @@ -12214,14 +12208,14 @@ func (d *D) FieldScalarS60(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS60 tries to add a field and read 60 bit signed integer in current endian -func (d *D) TryFieldS60(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS60(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS60(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS60 adds a field and reads 60 bit signed integer in current endian -func (d *D) FieldS60(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS60(name, sms...).ActualS() +func (d *D) FieldS60(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS60(name, sms...).Actual } // Reader S61 @@ -12239,11 +12233,10 @@ func (d *D) S61() int64 { } // TryFieldScalarS61 tries to add a field and read 61 bit signed integer in current endian -func (d *D) TryFieldScalarS61(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS61(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(61, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12252,7 +12245,7 @@ func (d *D) TryFieldScalarS61(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS61 adds a field and reads 61 bit signed integer in current endian -func (d *D) FieldScalarS61(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS61(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS61(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S61", Pos: d.Pos()}) @@ -12261,14 +12254,14 @@ func (d *D) FieldScalarS61(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS61 tries to add a field and read 61 bit signed integer in current endian -func (d *D) TryFieldS61(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS61(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS61(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS61 adds a field and reads 61 bit signed integer in current endian -func (d *D) FieldS61(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS61(name, sms...).ActualS() +func (d *D) FieldS61(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS61(name, sms...).Actual } // Reader S62 @@ -12286,11 +12279,10 @@ func (d *D) S62() int64 { } // TryFieldScalarS62 tries to add a field and read 62 bit signed integer in current endian -func (d *D) TryFieldScalarS62(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS62(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(62, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12299,7 +12291,7 @@ func (d *D) TryFieldScalarS62(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS62 adds a field and reads 62 bit signed integer in current endian -func (d *D) FieldScalarS62(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS62(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS62(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S62", Pos: d.Pos()}) @@ -12308,14 +12300,14 @@ func (d *D) FieldScalarS62(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS62 tries to add a field and read 62 bit signed integer in current endian -func (d *D) TryFieldS62(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS62(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS62(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS62 adds a field and reads 62 bit signed integer in current endian -func (d *D) FieldS62(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS62(name, sms...).ActualS() +func (d *D) FieldS62(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS62(name, sms...).Actual } // Reader S63 @@ -12333,11 +12325,10 @@ func (d *D) S63() int64 { } // TryFieldScalarS63 tries to add a field and read 63 bit signed integer in current endian -func (d *D) TryFieldScalarS63(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS63(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(63, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12346,7 +12337,7 @@ func (d *D) TryFieldScalarS63(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS63 adds a field and reads 63 bit signed integer in current endian -func (d *D) FieldScalarS63(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS63(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS63(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S63", Pos: d.Pos()}) @@ -12355,14 +12346,14 @@ func (d *D) FieldScalarS63(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS63 tries to add a field and read 63 bit signed integer in current endian -func (d *D) TryFieldS63(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS63(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS63(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS63 adds a field and reads 63 bit signed integer in current endian -func (d *D) FieldS63(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS63(name, sms...).ActualS() +func (d *D) FieldS63(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS63(name, sms...).Actual } // Reader S64 @@ -12380,11 +12371,10 @@ func (d *D) S64() int64 { } // TryFieldScalarS64 tries to add a field and read 64 bit signed integer in current endian -func (d *D) TryFieldScalarS64(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS64(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(64, d.Endian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12393,7 +12383,7 @@ func (d *D) TryFieldScalarS64(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarS64 adds a field and reads 64 bit signed integer in current endian -func (d *D) FieldScalarS64(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS64(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS64(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S64", Pos: d.Pos()}) @@ -12402,14 +12392,14 @@ func (d *D) FieldScalarS64(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS64 tries to add a field and read 64 bit signed integer in current endian -func (d *D) TryFieldS64(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS64(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS64(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS64 adds a field and reads 64 bit signed integer in current endian -func (d *D) FieldS64(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS64(name, sms...).ActualS() +func (d *D) FieldS64(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS64(name, sms...).Actual } // Reader S8LE @@ -12427,11 +12417,10 @@ func (d *D) S8LE() int64 { } // TryFieldScalarS8LE tries to add a field and read 8 bit signed integer in little-endian -func (d *D) TryFieldScalarS8LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS8LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(8, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12440,7 +12429,7 @@ func (d *D) TryFieldScalarS8LE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarS8LE adds a field and reads 8 bit signed integer in little-endian -func (d *D) FieldScalarS8LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS8LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS8LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S8LE", Pos: d.Pos()}) @@ -12449,14 +12438,14 @@ func (d *D) FieldScalarS8LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS8LE tries to add a field and read 8 bit signed integer in little-endian -func (d *D) TryFieldS8LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS8LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS8LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS8LE adds a field and reads 8 bit signed integer in little-endian -func (d *D) FieldS8LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS8LE(name, sms...).ActualS() +func (d *D) FieldS8LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS8LE(name, sms...).Actual } // Reader S9LE @@ -12474,11 +12463,10 @@ func (d *D) S9LE() int64 { } // TryFieldScalarS9LE tries to add a field and read 9 bit signed integer in little-endian -func (d *D) TryFieldScalarS9LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS9LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(9, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12487,7 +12475,7 @@ func (d *D) TryFieldScalarS9LE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarS9LE adds a field and reads 9 bit signed integer in little-endian -func (d *D) FieldScalarS9LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS9LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS9LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S9LE", Pos: d.Pos()}) @@ -12496,14 +12484,14 @@ func (d *D) FieldScalarS9LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS9LE tries to add a field and read 9 bit signed integer in little-endian -func (d *D) TryFieldS9LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS9LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS9LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS9LE adds a field and reads 9 bit signed integer in little-endian -func (d *D) FieldS9LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS9LE(name, sms...).ActualS() +func (d *D) FieldS9LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS9LE(name, sms...).Actual } // Reader S10LE @@ -12521,11 +12509,10 @@ func (d *D) S10LE() int64 { } // TryFieldScalarS10LE tries to add a field and read 10 bit signed integer in little-endian -func (d *D) TryFieldScalarS10LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS10LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(10, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12534,7 +12521,7 @@ func (d *D) TryFieldScalarS10LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS10LE adds a field and reads 10 bit signed integer in little-endian -func (d *D) FieldScalarS10LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS10LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS10LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S10LE", Pos: d.Pos()}) @@ -12543,14 +12530,14 @@ func (d *D) FieldScalarS10LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS10LE tries to add a field and read 10 bit signed integer in little-endian -func (d *D) TryFieldS10LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS10LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS10LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS10LE adds a field and reads 10 bit signed integer in little-endian -func (d *D) FieldS10LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS10LE(name, sms...).ActualS() +func (d *D) FieldS10LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS10LE(name, sms...).Actual } // Reader S11LE @@ -12568,11 +12555,10 @@ func (d *D) S11LE() int64 { } // TryFieldScalarS11LE tries to add a field and read 11 bit signed integer in little-endian -func (d *D) TryFieldScalarS11LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS11LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(11, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12581,7 +12567,7 @@ func (d *D) TryFieldScalarS11LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS11LE adds a field and reads 11 bit signed integer in little-endian -func (d *D) FieldScalarS11LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS11LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS11LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S11LE", Pos: d.Pos()}) @@ -12590,14 +12576,14 @@ func (d *D) FieldScalarS11LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS11LE tries to add a field and read 11 bit signed integer in little-endian -func (d *D) TryFieldS11LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS11LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS11LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS11LE adds a field and reads 11 bit signed integer in little-endian -func (d *D) FieldS11LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS11LE(name, sms...).ActualS() +func (d *D) FieldS11LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS11LE(name, sms...).Actual } // Reader S12LE @@ -12615,11 +12601,10 @@ func (d *D) S12LE() int64 { } // TryFieldScalarS12LE tries to add a field and read 12 bit signed integer in little-endian -func (d *D) TryFieldScalarS12LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS12LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(12, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12628,7 +12613,7 @@ func (d *D) TryFieldScalarS12LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS12LE adds a field and reads 12 bit signed integer in little-endian -func (d *D) FieldScalarS12LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS12LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS12LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S12LE", Pos: d.Pos()}) @@ -12637,14 +12622,14 @@ func (d *D) FieldScalarS12LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS12LE tries to add a field and read 12 bit signed integer in little-endian -func (d *D) TryFieldS12LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS12LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS12LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS12LE adds a field and reads 12 bit signed integer in little-endian -func (d *D) FieldS12LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS12LE(name, sms...).ActualS() +func (d *D) FieldS12LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS12LE(name, sms...).Actual } // Reader S13LE @@ -12662,11 +12647,10 @@ func (d *D) S13LE() int64 { } // TryFieldScalarS13LE tries to add a field and read 13 bit signed integer in little-endian -func (d *D) TryFieldScalarS13LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS13LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(13, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12675,7 +12659,7 @@ func (d *D) TryFieldScalarS13LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS13LE adds a field and reads 13 bit signed integer in little-endian -func (d *D) FieldScalarS13LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS13LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS13LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S13LE", Pos: d.Pos()}) @@ -12684,14 +12668,14 @@ func (d *D) FieldScalarS13LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS13LE tries to add a field and read 13 bit signed integer in little-endian -func (d *D) TryFieldS13LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS13LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS13LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS13LE adds a field and reads 13 bit signed integer in little-endian -func (d *D) FieldS13LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS13LE(name, sms...).ActualS() +func (d *D) FieldS13LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS13LE(name, sms...).Actual } // Reader S14LE @@ -12709,11 +12693,10 @@ func (d *D) S14LE() int64 { } // TryFieldScalarS14LE tries to add a field and read 14 bit signed integer in little-endian -func (d *D) TryFieldScalarS14LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS14LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(14, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12722,7 +12705,7 @@ func (d *D) TryFieldScalarS14LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS14LE adds a field and reads 14 bit signed integer in little-endian -func (d *D) FieldScalarS14LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS14LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS14LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S14LE", Pos: d.Pos()}) @@ -12731,14 +12714,14 @@ func (d *D) FieldScalarS14LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS14LE tries to add a field and read 14 bit signed integer in little-endian -func (d *D) TryFieldS14LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS14LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS14LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS14LE adds a field and reads 14 bit signed integer in little-endian -func (d *D) FieldS14LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS14LE(name, sms...).ActualS() +func (d *D) FieldS14LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS14LE(name, sms...).Actual } // Reader S15LE @@ -12756,11 +12739,10 @@ func (d *D) S15LE() int64 { } // TryFieldScalarS15LE tries to add a field and read 15 bit signed integer in little-endian -func (d *D) TryFieldScalarS15LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS15LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(15, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12769,7 +12751,7 @@ func (d *D) TryFieldScalarS15LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS15LE adds a field and reads 15 bit signed integer in little-endian -func (d *D) FieldScalarS15LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS15LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS15LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S15LE", Pos: d.Pos()}) @@ -12778,14 +12760,14 @@ func (d *D) FieldScalarS15LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS15LE tries to add a field and read 15 bit signed integer in little-endian -func (d *D) TryFieldS15LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS15LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS15LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS15LE adds a field and reads 15 bit signed integer in little-endian -func (d *D) FieldS15LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS15LE(name, sms...).ActualS() +func (d *D) FieldS15LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS15LE(name, sms...).Actual } // Reader S16LE @@ -12803,11 +12785,10 @@ func (d *D) S16LE() int64 { } // TryFieldScalarS16LE tries to add a field and read 16 bit signed integer in little-endian -func (d *D) TryFieldScalarS16LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS16LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(16, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12816,7 +12797,7 @@ func (d *D) TryFieldScalarS16LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS16LE adds a field and reads 16 bit signed integer in little-endian -func (d *D) FieldScalarS16LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS16LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS16LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S16LE", Pos: d.Pos()}) @@ -12825,14 +12806,14 @@ func (d *D) FieldScalarS16LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS16LE tries to add a field and read 16 bit signed integer in little-endian -func (d *D) TryFieldS16LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS16LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS16LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS16LE adds a field and reads 16 bit signed integer in little-endian -func (d *D) FieldS16LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS16LE(name, sms...).ActualS() +func (d *D) FieldS16LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS16LE(name, sms...).Actual } // Reader S17LE @@ -12850,11 +12831,10 @@ func (d *D) S17LE() int64 { } // TryFieldScalarS17LE tries to add a field and read 17 bit signed integer in little-endian -func (d *D) TryFieldScalarS17LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS17LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(17, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12863,7 +12843,7 @@ func (d *D) TryFieldScalarS17LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS17LE adds a field and reads 17 bit signed integer in little-endian -func (d *D) FieldScalarS17LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS17LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS17LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S17LE", Pos: d.Pos()}) @@ -12872,14 +12852,14 @@ func (d *D) FieldScalarS17LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS17LE tries to add a field and read 17 bit signed integer in little-endian -func (d *D) TryFieldS17LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS17LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS17LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS17LE adds a field and reads 17 bit signed integer in little-endian -func (d *D) FieldS17LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS17LE(name, sms...).ActualS() +func (d *D) FieldS17LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS17LE(name, sms...).Actual } // Reader S18LE @@ -12897,11 +12877,10 @@ func (d *D) S18LE() int64 { } // TryFieldScalarS18LE tries to add a field and read 18 bit signed integer in little-endian -func (d *D) TryFieldScalarS18LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS18LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(18, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12910,7 +12889,7 @@ func (d *D) TryFieldScalarS18LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS18LE adds a field and reads 18 bit signed integer in little-endian -func (d *D) FieldScalarS18LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS18LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS18LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S18LE", Pos: d.Pos()}) @@ -12919,14 +12898,14 @@ func (d *D) FieldScalarS18LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS18LE tries to add a field and read 18 bit signed integer in little-endian -func (d *D) TryFieldS18LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS18LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS18LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS18LE adds a field and reads 18 bit signed integer in little-endian -func (d *D) FieldS18LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS18LE(name, sms...).ActualS() +func (d *D) FieldS18LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS18LE(name, sms...).Actual } // Reader S19LE @@ -12944,11 +12923,10 @@ func (d *D) S19LE() int64 { } // TryFieldScalarS19LE tries to add a field and read 19 bit signed integer in little-endian -func (d *D) TryFieldScalarS19LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS19LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(19, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -12957,7 +12935,7 @@ func (d *D) TryFieldScalarS19LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS19LE adds a field and reads 19 bit signed integer in little-endian -func (d *D) FieldScalarS19LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS19LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS19LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S19LE", Pos: d.Pos()}) @@ -12966,14 +12944,14 @@ func (d *D) FieldScalarS19LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS19LE tries to add a field and read 19 bit signed integer in little-endian -func (d *D) TryFieldS19LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS19LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS19LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS19LE adds a field and reads 19 bit signed integer in little-endian -func (d *D) FieldS19LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS19LE(name, sms...).ActualS() +func (d *D) FieldS19LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS19LE(name, sms...).Actual } // Reader S20LE @@ -12991,11 +12969,10 @@ func (d *D) S20LE() int64 { } // TryFieldScalarS20LE tries to add a field and read 20 bit signed integer in little-endian -func (d *D) TryFieldScalarS20LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS20LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(20, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13004,7 +12981,7 @@ func (d *D) TryFieldScalarS20LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS20LE adds a field and reads 20 bit signed integer in little-endian -func (d *D) FieldScalarS20LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS20LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS20LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S20LE", Pos: d.Pos()}) @@ -13013,14 +12990,14 @@ func (d *D) FieldScalarS20LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS20LE tries to add a field and read 20 bit signed integer in little-endian -func (d *D) TryFieldS20LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS20LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS20LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS20LE adds a field and reads 20 bit signed integer in little-endian -func (d *D) FieldS20LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS20LE(name, sms...).ActualS() +func (d *D) FieldS20LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS20LE(name, sms...).Actual } // Reader S21LE @@ -13038,11 +13015,10 @@ func (d *D) S21LE() int64 { } // TryFieldScalarS21LE tries to add a field and read 21 bit signed integer in little-endian -func (d *D) TryFieldScalarS21LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS21LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(21, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13051,7 +13027,7 @@ func (d *D) TryFieldScalarS21LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS21LE adds a field and reads 21 bit signed integer in little-endian -func (d *D) FieldScalarS21LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS21LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS21LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S21LE", Pos: d.Pos()}) @@ -13060,14 +13036,14 @@ func (d *D) FieldScalarS21LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS21LE tries to add a field and read 21 bit signed integer in little-endian -func (d *D) TryFieldS21LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS21LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS21LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS21LE adds a field and reads 21 bit signed integer in little-endian -func (d *D) FieldS21LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS21LE(name, sms...).ActualS() +func (d *D) FieldS21LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS21LE(name, sms...).Actual } // Reader S22LE @@ -13085,11 +13061,10 @@ func (d *D) S22LE() int64 { } // TryFieldScalarS22LE tries to add a field and read 22 bit signed integer in little-endian -func (d *D) TryFieldScalarS22LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS22LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(22, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13098,7 +13073,7 @@ func (d *D) TryFieldScalarS22LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS22LE adds a field and reads 22 bit signed integer in little-endian -func (d *D) FieldScalarS22LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS22LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS22LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S22LE", Pos: d.Pos()}) @@ -13107,14 +13082,14 @@ func (d *D) FieldScalarS22LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS22LE tries to add a field and read 22 bit signed integer in little-endian -func (d *D) TryFieldS22LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS22LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS22LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS22LE adds a field and reads 22 bit signed integer in little-endian -func (d *D) FieldS22LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS22LE(name, sms...).ActualS() +func (d *D) FieldS22LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS22LE(name, sms...).Actual } // Reader S23LE @@ -13132,11 +13107,10 @@ func (d *D) S23LE() int64 { } // TryFieldScalarS23LE tries to add a field and read 23 bit signed integer in little-endian -func (d *D) TryFieldScalarS23LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS23LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(23, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13145,7 +13119,7 @@ func (d *D) TryFieldScalarS23LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS23LE adds a field and reads 23 bit signed integer in little-endian -func (d *D) FieldScalarS23LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS23LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS23LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S23LE", Pos: d.Pos()}) @@ -13154,14 +13128,14 @@ func (d *D) FieldScalarS23LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS23LE tries to add a field and read 23 bit signed integer in little-endian -func (d *D) TryFieldS23LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS23LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS23LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS23LE adds a field and reads 23 bit signed integer in little-endian -func (d *D) FieldS23LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS23LE(name, sms...).ActualS() +func (d *D) FieldS23LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS23LE(name, sms...).Actual } // Reader S24LE @@ -13179,11 +13153,10 @@ func (d *D) S24LE() int64 { } // TryFieldScalarS24LE tries to add a field and read 24 bit signed integer in little-endian -func (d *D) TryFieldScalarS24LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS24LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(24, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13192,7 +13165,7 @@ func (d *D) TryFieldScalarS24LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS24LE adds a field and reads 24 bit signed integer in little-endian -func (d *D) FieldScalarS24LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS24LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS24LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S24LE", Pos: d.Pos()}) @@ -13201,14 +13174,14 @@ func (d *D) FieldScalarS24LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS24LE tries to add a field and read 24 bit signed integer in little-endian -func (d *D) TryFieldS24LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS24LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS24LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS24LE adds a field and reads 24 bit signed integer in little-endian -func (d *D) FieldS24LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS24LE(name, sms...).ActualS() +func (d *D) FieldS24LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS24LE(name, sms...).Actual } // Reader S25LE @@ -13226,11 +13199,10 @@ func (d *D) S25LE() int64 { } // TryFieldScalarS25LE tries to add a field and read 25 bit signed integer in little-endian -func (d *D) TryFieldScalarS25LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS25LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(25, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13239,7 +13211,7 @@ func (d *D) TryFieldScalarS25LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS25LE adds a field and reads 25 bit signed integer in little-endian -func (d *D) FieldScalarS25LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS25LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS25LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S25LE", Pos: d.Pos()}) @@ -13248,14 +13220,14 @@ func (d *D) FieldScalarS25LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS25LE tries to add a field and read 25 bit signed integer in little-endian -func (d *D) TryFieldS25LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS25LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS25LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS25LE adds a field and reads 25 bit signed integer in little-endian -func (d *D) FieldS25LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS25LE(name, sms...).ActualS() +func (d *D) FieldS25LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS25LE(name, sms...).Actual } // Reader S26LE @@ -13273,11 +13245,10 @@ func (d *D) S26LE() int64 { } // TryFieldScalarS26LE tries to add a field and read 26 bit signed integer in little-endian -func (d *D) TryFieldScalarS26LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS26LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(26, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13286,7 +13257,7 @@ func (d *D) TryFieldScalarS26LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS26LE adds a field and reads 26 bit signed integer in little-endian -func (d *D) FieldScalarS26LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS26LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS26LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S26LE", Pos: d.Pos()}) @@ -13295,14 +13266,14 @@ func (d *D) FieldScalarS26LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS26LE tries to add a field and read 26 bit signed integer in little-endian -func (d *D) TryFieldS26LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS26LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS26LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS26LE adds a field and reads 26 bit signed integer in little-endian -func (d *D) FieldS26LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS26LE(name, sms...).ActualS() +func (d *D) FieldS26LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS26LE(name, sms...).Actual } // Reader S27LE @@ -13320,11 +13291,10 @@ func (d *D) S27LE() int64 { } // TryFieldScalarS27LE tries to add a field and read 27 bit signed integer in little-endian -func (d *D) TryFieldScalarS27LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS27LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(27, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13333,7 +13303,7 @@ func (d *D) TryFieldScalarS27LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS27LE adds a field and reads 27 bit signed integer in little-endian -func (d *D) FieldScalarS27LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS27LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS27LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S27LE", Pos: d.Pos()}) @@ -13342,14 +13312,14 @@ func (d *D) FieldScalarS27LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS27LE tries to add a field and read 27 bit signed integer in little-endian -func (d *D) TryFieldS27LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS27LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS27LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS27LE adds a field and reads 27 bit signed integer in little-endian -func (d *D) FieldS27LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS27LE(name, sms...).ActualS() +func (d *D) FieldS27LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS27LE(name, sms...).Actual } // Reader S28LE @@ -13367,11 +13337,10 @@ func (d *D) S28LE() int64 { } // TryFieldScalarS28LE tries to add a field and read 28 bit signed integer in little-endian -func (d *D) TryFieldScalarS28LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS28LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(28, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13380,7 +13349,7 @@ func (d *D) TryFieldScalarS28LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS28LE adds a field and reads 28 bit signed integer in little-endian -func (d *D) FieldScalarS28LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS28LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS28LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S28LE", Pos: d.Pos()}) @@ -13389,14 +13358,14 @@ func (d *D) FieldScalarS28LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS28LE tries to add a field and read 28 bit signed integer in little-endian -func (d *D) TryFieldS28LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS28LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS28LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS28LE adds a field and reads 28 bit signed integer in little-endian -func (d *D) FieldS28LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS28LE(name, sms...).ActualS() +func (d *D) FieldS28LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS28LE(name, sms...).Actual } // Reader S29LE @@ -13414,11 +13383,10 @@ func (d *D) S29LE() int64 { } // TryFieldScalarS29LE tries to add a field and read 29 bit signed integer in little-endian -func (d *D) TryFieldScalarS29LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS29LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(29, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13427,7 +13395,7 @@ func (d *D) TryFieldScalarS29LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS29LE adds a field and reads 29 bit signed integer in little-endian -func (d *D) FieldScalarS29LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS29LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS29LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S29LE", Pos: d.Pos()}) @@ -13436,14 +13404,14 @@ func (d *D) FieldScalarS29LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS29LE tries to add a field and read 29 bit signed integer in little-endian -func (d *D) TryFieldS29LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS29LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS29LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS29LE adds a field and reads 29 bit signed integer in little-endian -func (d *D) FieldS29LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS29LE(name, sms...).ActualS() +func (d *D) FieldS29LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS29LE(name, sms...).Actual } // Reader S30LE @@ -13461,11 +13429,10 @@ func (d *D) S30LE() int64 { } // TryFieldScalarS30LE tries to add a field and read 30 bit signed integer in little-endian -func (d *D) TryFieldScalarS30LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS30LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(30, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13474,7 +13441,7 @@ func (d *D) TryFieldScalarS30LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS30LE adds a field and reads 30 bit signed integer in little-endian -func (d *D) FieldScalarS30LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS30LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS30LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S30LE", Pos: d.Pos()}) @@ -13483,14 +13450,14 @@ func (d *D) FieldScalarS30LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS30LE tries to add a field and read 30 bit signed integer in little-endian -func (d *D) TryFieldS30LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS30LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS30LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS30LE adds a field and reads 30 bit signed integer in little-endian -func (d *D) FieldS30LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS30LE(name, sms...).ActualS() +func (d *D) FieldS30LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS30LE(name, sms...).Actual } // Reader S31LE @@ -13508,11 +13475,10 @@ func (d *D) S31LE() int64 { } // TryFieldScalarS31LE tries to add a field and read 31 bit signed integer in little-endian -func (d *D) TryFieldScalarS31LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS31LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(31, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13521,7 +13487,7 @@ func (d *D) TryFieldScalarS31LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS31LE adds a field and reads 31 bit signed integer in little-endian -func (d *D) FieldScalarS31LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS31LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS31LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S31LE", Pos: d.Pos()}) @@ -13530,14 +13496,14 @@ func (d *D) FieldScalarS31LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS31LE tries to add a field and read 31 bit signed integer in little-endian -func (d *D) TryFieldS31LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS31LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS31LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS31LE adds a field and reads 31 bit signed integer in little-endian -func (d *D) FieldS31LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS31LE(name, sms...).ActualS() +func (d *D) FieldS31LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS31LE(name, sms...).Actual } // Reader S32LE @@ -13555,11 +13521,10 @@ func (d *D) S32LE() int64 { } // TryFieldScalarS32LE tries to add a field and read 32 bit signed integer in little-endian -func (d *D) TryFieldScalarS32LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS32LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(32, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13568,7 +13533,7 @@ func (d *D) TryFieldScalarS32LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS32LE adds a field and reads 32 bit signed integer in little-endian -func (d *D) FieldScalarS32LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS32LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS32LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S32LE", Pos: d.Pos()}) @@ -13577,14 +13542,14 @@ func (d *D) FieldScalarS32LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS32LE tries to add a field and read 32 bit signed integer in little-endian -func (d *D) TryFieldS32LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS32LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS32LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS32LE adds a field and reads 32 bit signed integer in little-endian -func (d *D) FieldS32LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS32LE(name, sms...).ActualS() +func (d *D) FieldS32LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS32LE(name, sms...).Actual } // Reader S33LE @@ -13602,11 +13567,10 @@ func (d *D) S33LE() int64 { } // TryFieldScalarS33LE tries to add a field and read 33 bit signed integer in little-endian -func (d *D) TryFieldScalarS33LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS33LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(33, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13615,7 +13579,7 @@ func (d *D) TryFieldScalarS33LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS33LE adds a field and reads 33 bit signed integer in little-endian -func (d *D) FieldScalarS33LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS33LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS33LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S33LE", Pos: d.Pos()}) @@ -13624,14 +13588,14 @@ func (d *D) FieldScalarS33LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS33LE tries to add a field and read 33 bit signed integer in little-endian -func (d *D) TryFieldS33LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS33LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS33LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS33LE adds a field and reads 33 bit signed integer in little-endian -func (d *D) FieldS33LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS33LE(name, sms...).ActualS() +func (d *D) FieldS33LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS33LE(name, sms...).Actual } // Reader S34LE @@ -13649,11 +13613,10 @@ func (d *D) S34LE() int64 { } // TryFieldScalarS34LE tries to add a field and read 34 bit signed integer in little-endian -func (d *D) TryFieldScalarS34LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS34LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(34, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13662,7 +13625,7 @@ func (d *D) TryFieldScalarS34LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS34LE adds a field and reads 34 bit signed integer in little-endian -func (d *D) FieldScalarS34LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS34LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS34LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S34LE", Pos: d.Pos()}) @@ -13671,14 +13634,14 @@ func (d *D) FieldScalarS34LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS34LE tries to add a field and read 34 bit signed integer in little-endian -func (d *D) TryFieldS34LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS34LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS34LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS34LE adds a field and reads 34 bit signed integer in little-endian -func (d *D) FieldS34LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS34LE(name, sms...).ActualS() +func (d *D) FieldS34LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS34LE(name, sms...).Actual } // Reader S35LE @@ -13696,11 +13659,10 @@ func (d *D) S35LE() int64 { } // TryFieldScalarS35LE tries to add a field and read 35 bit signed integer in little-endian -func (d *D) TryFieldScalarS35LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS35LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(35, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13709,7 +13671,7 @@ func (d *D) TryFieldScalarS35LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS35LE adds a field and reads 35 bit signed integer in little-endian -func (d *D) FieldScalarS35LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS35LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS35LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S35LE", Pos: d.Pos()}) @@ -13718,14 +13680,14 @@ func (d *D) FieldScalarS35LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS35LE tries to add a field and read 35 bit signed integer in little-endian -func (d *D) TryFieldS35LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS35LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS35LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS35LE adds a field and reads 35 bit signed integer in little-endian -func (d *D) FieldS35LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS35LE(name, sms...).ActualS() +func (d *D) FieldS35LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS35LE(name, sms...).Actual } // Reader S36LE @@ -13743,11 +13705,10 @@ func (d *D) S36LE() int64 { } // TryFieldScalarS36LE tries to add a field and read 36 bit signed integer in little-endian -func (d *D) TryFieldScalarS36LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS36LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(36, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13756,7 +13717,7 @@ func (d *D) TryFieldScalarS36LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS36LE adds a field and reads 36 bit signed integer in little-endian -func (d *D) FieldScalarS36LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS36LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS36LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S36LE", Pos: d.Pos()}) @@ -13765,14 +13726,14 @@ func (d *D) FieldScalarS36LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS36LE tries to add a field and read 36 bit signed integer in little-endian -func (d *D) TryFieldS36LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS36LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS36LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS36LE adds a field and reads 36 bit signed integer in little-endian -func (d *D) FieldS36LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS36LE(name, sms...).ActualS() +func (d *D) FieldS36LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS36LE(name, sms...).Actual } // Reader S37LE @@ -13790,11 +13751,10 @@ func (d *D) S37LE() int64 { } // TryFieldScalarS37LE tries to add a field and read 37 bit signed integer in little-endian -func (d *D) TryFieldScalarS37LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS37LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(37, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13803,7 +13763,7 @@ func (d *D) TryFieldScalarS37LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS37LE adds a field and reads 37 bit signed integer in little-endian -func (d *D) FieldScalarS37LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS37LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS37LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S37LE", Pos: d.Pos()}) @@ -13812,14 +13772,14 @@ func (d *D) FieldScalarS37LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS37LE tries to add a field and read 37 bit signed integer in little-endian -func (d *D) TryFieldS37LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS37LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS37LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS37LE adds a field and reads 37 bit signed integer in little-endian -func (d *D) FieldS37LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS37LE(name, sms...).ActualS() +func (d *D) FieldS37LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS37LE(name, sms...).Actual } // Reader S38LE @@ -13837,11 +13797,10 @@ func (d *D) S38LE() int64 { } // TryFieldScalarS38LE tries to add a field and read 38 bit signed integer in little-endian -func (d *D) TryFieldScalarS38LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS38LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(38, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13850,7 +13809,7 @@ func (d *D) TryFieldScalarS38LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS38LE adds a field and reads 38 bit signed integer in little-endian -func (d *D) FieldScalarS38LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS38LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS38LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S38LE", Pos: d.Pos()}) @@ -13859,14 +13818,14 @@ func (d *D) FieldScalarS38LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS38LE tries to add a field and read 38 bit signed integer in little-endian -func (d *D) TryFieldS38LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS38LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS38LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS38LE adds a field and reads 38 bit signed integer in little-endian -func (d *D) FieldS38LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS38LE(name, sms...).ActualS() +func (d *D) FieldS38LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS38LE(name, sms...).Actual } // Reader S39LE @@ -13884,11 +13843,10 @@ func (d *D) S39LE() int64 { } // TryFieldScalarS39LE tries to add a field and read 39 bit signed integer in little-endian -func (d *D) TryFieldScalarS39LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS39LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(39, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13897,7 +13855,7 @@ func (d *D) TryFieldScalarS39LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS39LE adds a field and reads 39 bit signed integer in little-endian -func (d *D) FieldScalarS39LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS39LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS39LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S39LE", Pos: d.Pos()}) @@ -13906,14 +13864,14 @@ func (d *D) FieldScalarS39LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS39LE tries to add a field and read 39 bit signed integer in little-endian -func (d *D) TryFieldS39LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS39LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS39LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS39LE adds a field and reads 39 bit signed integer in little-endian -func (d *D) FieldS39LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS39LE(name, sms...).ActualS() +func (d *D) FieldS39LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS39LE(name, sms...).Actual } // Reader S40LE @@ -13931,11 +13889,10 @@ func (d *D) S40LE() int64 { } // TryFieldScalarS40LE tries to add a field and read 40 bit signed integer in little-endian -func (d *D) TryFieldScalarS40LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS40LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(40, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13944,7 +13901,7 @@ func (d *D) TryFieldScalarS40LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS40LE adds a field and reads 40 bit signed integer in little-endian -func (d *D) FieldScalarS40LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS40LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS40LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S40LE", Pos: d.Pos()}) @@ -13953,14 +13910,14 @@ func (d *D) FieldScalarS40LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS40LE tries to add a field and read 40 bit signed integer in little-endian -func (d *D) TryFieldS40LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS40LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS40LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS40LE adds a field and reads 40 bit signed integer in little-endian -func (d *D) FieldS40LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS40LE(name, sms...).ActualS() +func (d *D) FieldS40LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS40LE(name, sms...).Actual } // Reader S41LE @@ -13978,11 +13935,10 @@ func (d *D) S41LE() int64 { } // TryFieldScalarS41LE tries to add a field and read 41 bit signed integer in little-endian -func (d *D) TryFieldScalarS41LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS41LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(41, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -13991,7 +13947,7 @@ func (d *D) TryFieldScalarS41LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS41LE adds a field and reads 41 bit signed integer in little-endian -func (d *D) FieldScalarS41LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS41LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS41LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S41LE", Pos: d.Pos()}) @@ -14000,14 +13956,14 @@ func (d *D) FieldScalarS41LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS41LE tries to add a field and read 41 bit signed integer in little-endian -func (d *D) TryFieldS41LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS41LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS41LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS41LE adds a field and reads 41 bit signed integer in little-endian -func (d *D) FieldS41LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS41LE(name, sms...).ActualS() +func (d *D) FieldS41LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS41LE(name, sms...).Actual } // Reader S42LE @@ -14025,11 +13981,10 @@ func (d *D) S42LE() int64 { } // TryFieldScalarS42LE tries to add a field and read 42 bit signed integer in little-endian -func (d *D) TryFieldScalarS42LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS42LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(42, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14038,7 +13993,7 @@ func (d *D) TryFieldScalarS42LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS42LE adds a field and reads 42 bit signed integer in little-endian -func (d *D) FieldScalarS42LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS42LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS42LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S42LE", Pos: d.Pos()}) @@ -14047,14 +14002,14 @@ func (d *D) FieldScalarS42LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS42LE tries to add a field and read 42 bit signed integer in little-endian -func (d *D) TryFieldS42LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS42LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS42LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS42LE adds a field and reads 42 bit signed integer in little-endian -func (d *D) FieldS42LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS42LE(name, sms...).ActualS() +func (d *D) FieldS42LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS42LE(name, sms...).Actual } // Reader S43LE @@ -14072,11 +14027,10 @@ func (d *D) S43LE() int64 { } // TryFieldScalarS43LE tries to add a field and read 43 bit signed integer in little-endian -func (d *D) TryFieldScalarS43LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS43LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(43, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14085,7 +14039,7 @@ func (d *D) TryFieldScalarS43LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS43LE adds a field and reads 43 bit signed integer in little-endian -func (d *D) FieldScalarS43LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS43LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS43LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S43LE", Pos: d.Pos()}) @@ -14094,14 +14048,14 @@ func (d *D) FieldScalarS43LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS43LE tries to add a field and read 43 bit signed integer in little-endian -func (d *D) TryFieldS43LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS43LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS43LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS43LE adds a field and reads 43 bit signed integer in little-endian -func (d *D) FieldS43LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS43LE(name, sms...).ActualS() +func (d *D) FieldS43LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS43LE(name, sms...).Actual } // Reader S44LE @@ -14119,11 +14073,10 @@ func (d *D) S44LE() int64 { } // TryFieldScalarS44LE tries to add a field and read 44 bit signed integer in little-endian -func (d *D) TryFieldScalarS44LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS44LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(44, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14132,7 +14085,7 @@ func (d *D) TryFieldScalarS44LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS44LE adds a field and reads 44 bit signed integer in little-endian -func (d *D) FieldScalarS44LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS44LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS44LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S44LE", Pos: d.Pos()}) @@ -14141,14 +14094,14 @@ func (d *D) FieldScalarS44LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS44LE tries to add a field and read 44 bit signed integer in little-endian -func (d *D) TryFieldS44LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS44LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS44LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS44LE adds a field and reads 44 bit signed integer in little-endian -func (d *D) FieldS44LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS44LE(name, sms...).ActualS() +func (d *D) FieldS44LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS44LE(name, sms...).Actual } // Reader S45LE @@ -14166,11 +14119,10 @@ func (d *D) S45LE() int64 { } // TryFieldScalarS45LE tries to add a field and read 45 bit signed integer in little-endian -func (d *D) TryFieldScalarS45LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS45LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(45, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14179,7 +14131,7 @@ func (d *D) TryFieldScalarS45LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS45LE adds a field and reads 45 bit signed integer in little-endian -func (d *D) FieldScalarS45LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS45LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS45LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S45LE", Pos: d.Pos()}) @@ -14188,14 +14140,14 @@ func (d *D) FieldScalarS45LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS45LE tries to add a field and read 45 bit signed integer in little-endian -func (d *D) TryFieldS45LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS45LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS45LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS45LE adds a field and reads 45 bit signed integer in little-endian -func (d *D) FieldS45LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS45LE(name, sms...).ActualS() +func (d *D) FieldS45LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS45LE(name, sms...).Actual } // Reader S46LE @@ -14213,11 +14165,10 @@ func (d *D) S46LE() int64 { } // TryFieldScalarS46LE tries to add a field and read 46 bit signed integer in little-endian -func (d *D) TryFieldScalarS46LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS46LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(46, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14226,7 +14177,7 @@ func (d *D) TryFieldScalarS46LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS46LE adds a field and reads 46 bit signed integer in little-endian -func (d *D) FieldScalarS46LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS46LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS46LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S46LE", Pos: d.Pos()}) @@ -14235,14 +14186,14 @@ func (d *D) FieldScalarS46LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS46LE tries to add a field and read 46 bit signed integer in little-endian -func (d *D) TryFieldS46LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS46LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS46LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS46LE adds a field and reads 46 bit signed integer in little-endian -func (d *D) FieldS46LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS46LE(name, sms...).ActualS() +func (d *D) FieldS46LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS46LE(name, sms...).Actual } // Reader S47LE @@ -14260,11 +14211,10 @@ func (d *D) S47LE() int64 { } // TryFieldScalarS47LE tries to add a field and read 47 bit signed integer in little-endian -func (d *D) TryFieldScalarS47LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS47LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(47, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14273,7 +14223,7 @@ func (d *D) TryFieldScalarS47LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS47LE adds a field and reads 47 bit signed integer in little-endian -func (d *D) FieldScalarS47LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS47LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS47LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S47LE", Pos: d.Pos()}) @@ -14282,14 +14232,14 @@ func (d *D) FieldScalarS47LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS47LE tries to add a field and read 47 bit signed integer in little-endian -func (d *D) TryFieldS47LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS47LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS47LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS47LE adds a field and reads 47 bit signed integer in little-endian -func (d *D) FieldS47LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS47LE(name, sms...).ActualS() +func (d *D) FieldS47LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS47LE(name, sms...).Actual } // Reader S48LE @@ -14307,11 +14257,10 @@ func (d *D) S48LE() int64 { } // TryFieldScalarS48LE tries to add a field and read 48 bit signed integer in little-endian -func (d *D) TryFieldScalarS48LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS48LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(48, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14320,7 +14269,7 @@ func (d *D) TryFieldScalarS48LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS48LE adds a field and reads 48 bit signed integer in little-endian -func (d *D) FieldScalarS48LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS48LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS48LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S48LE", Pos: d.Pos()}) @@ -14329,14 +14278,14 @@ func (d *D) FieldScalarS48LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS48LE tries to add a field and read 48 bit signed integer in little-endian -func (d *D) TryFieldS48LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS48LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS48LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS48LE adds a field and reads 48 bit signed integer in little-endian -func (d *D) FieldS48LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS48LE(name, sms...).ActualS() +func (d *D) FieldS48LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS48LE(name, sms...).Actual } // Reader S49LE @@ -14354,11 +14303,10 @@ func (d *D) S49LE() int64 { } // TryFieldScalarS49LE tries to add a field and read 49 bit signed integer in little-endian -func (d *D) TryFieldScalarS49LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS49LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(49, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14367,7 +14315,7 @@ func (d *D) TryFieldScalarS49LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS49LE adds a field and reads 49 bit signed integer in little-endian -func (d *D) FieldScalarS49LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS49LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS49LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S49LE", Pos: d.Pos()}) @@ -14376,14 +14324,14 @@ func (d *D) FieldScalarS49LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS49LE tries to add a field and read 49 bit signed integer in little-endian -func (d *D) TryFieldS49LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS49LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS49LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS49LE adds a field and reads 49 bit signed integer in little-endian -func (d *D) FieldS49LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS49LE(name, sms...).ActualS() +func (d *D) FieldS49LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS49LE(name, sms...).Actual } // Reader S50LE @@ -14401,11 +14349,10 @@ func (d *D) S50LE() int64 { } // TryFieldScalarS50LE tries to add a field and read 50 bit signed integer in little-endian -func (d *D) TryFieldScalarS50LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS50LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(50, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14414,7 +14361,7 @@ func (d *D) TryFieldScalarS50LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS50LE adds a field and reads 50 bit signed integer in little-endian -func (d *D) FieldScalarS50LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS50LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS50LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S50LE", Pos: d.Pos()}) @@ -14423,14 +14370,14 @@ func (d *D) FieldScalarS50LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS50LE tries to add a field and read 50 bit signed integer in little-endian -func (d *D) TryFieldS50LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS50LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS50LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS50LE adds a field and reads 50 bit signed integer in little-endian -func (d *D) FieldS50LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS50LE(name, sms...).ActualS() +func (d *D) FieldS50LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS50LE(name, sms...).Actual } // Reader S51LE @@ -14448,11 +14395,10 @@ func (d *D) S51LE() int64 { } // TryFieldScalarS51LE tries to add a field and read 51 bit signed integer in little-endian -func (d *D) TryFieldScalarS51LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS51LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(51, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14461,7 +14407,7 @@ func (d *D) TryFieldScalarS51LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS51LE adds a field and reads 51 bit signed integer in little-endian -func (d *D) FieldScalarS51LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS51LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS51LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S51LE", Pos: d.Pos()}) @@ -14470,14 +14416,14 @@ func (d *D) FieldScalarS51LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS51LE tries to add a field and read 51 bit signed integer in little-endian -func (d *D) TryFieldS51LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS51LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS51LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS51LE adds a field and reads 51 bit signed integer in little-endian -func (d *D) FieldS51LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS51LE(name, sms...).ActualS() +func (d *D) FieldS51LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS51LE(name, sms...).Actual } // Reader S52LE @@ -14495,11 +14441,10 @@ func (d *D) S52LE() int64 { } // TryFieldScalarS52LE tries to add a field and read 52 bit signed integer in little-endian -func (d *D) TryFieldScalarS52LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS52LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(52, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14508,7 +14453,7 @@ func (d *D) TryFieldScalarS52LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS52LE adds a field and reads 52 bit signed integer in little-endian -func (d *D) FieldScalarS52LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS52LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS52LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S52LE", Pos: d.Pos()}) @@ -14517,14 +14462,14 @@ func (d *D) FieldScalarS52LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS52LE tries to add a field and read 52 bit signed integer in little-endian -func (d *D) TryFieldS52LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS52LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS52LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS52LE adds a field and reads 52 bit signed integer in little-endian -func (d *D) FieldS52LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS52LE(name, sms...).ActualS() +func (d *D) FieldS52LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS52LE(name, sms...).Actual } // Reader S53LE @@ -14542,11 +14487,10 @@ func (d *D) S53LE() int64 { } // TryFieldScalarS53LE tries to add a field and read 53 bit signed integer in little-endian -func (d *D) TryFieldScalarS53LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS53LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(53, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14555,7 +14499,7 @@ func (d *D) TryFieldScalarS53LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS53LE adds a field and reads 53 bit signed integer in little-endian -func (d *D) FieldScalarS53LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS53LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS53LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S53LE", Pos: d.Pos()}) @@ -14564,14 +14508,14 @@ func (d *D) FieldScalarS53LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS53LE tries to add a field and read 53 bit signed integer in little-endian -func (d *D) TryFieldS53LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS53LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS53LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS53LE adds a field and reads 53 bit signed integer in little-endian -func (d *D) FieldS53LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS53LE(name, sms...).ActualS() +func (d *D) FieldS53LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS53LE(name, sms...).Actual } // Reader S54LE @@ -14589,11 +14533,10 @@ func (d *D) S54LE() int64 { } // TryFieldScalarS54LE tries to add a field and read 54 bit signed integer in little-endian -func (d *D) TryFieldScalarS54LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS54LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(54, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14602,7 +14545,7 @@ func (d *D) TryFieldScalarS54LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS54LE adds a field and reads 54 bit signed integer in little-endian -func (d *D) FieldScalarS54LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS54LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS54LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S54LE", Pos: d.Pos()}) @@ -14611,14 +14554,14 @@ func (d *D) FieldScalarS54LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS54LE tries to add a field and read 54 bit signed integer in little-endian -func (d *D) TryFieldS54LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS54LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS54LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS54LE adds a field and reads 54 bit signed integer in little-endian -func (d *D) FieldS54LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS54LE(name, sms...).ActualS() +func (d *D) FieldS54LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS54LE(name, sms...).Actual } // Reader S55LE @@ -14636,11 +14579,10 @@ func (d *D) S55LE() int64 { } // TryFieldScalarS55LE tries to add a field and read 55 bit signed integer in little-endian -func (d *D) TryFieldScalarS55LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS55LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(55, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14649,7 +14591,7 @@ func (d *D) TryFieldScalarS55LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS55LE adds a field and reads 55 bit signed integer in little-endian -func (d *D) FieldScalarS55LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS55LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS55LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S55LE", Pos: d.Pos()}) @@ -14658,14 +14600,14 @@ func (d *D) FieldScalarS55LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS55LE tries to add a field and read 55 bit signed integer in little-endian -func (d *D) TryFieldS55LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS55LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS55LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS55LE adds a field and reads 55 bit signed integer in little-endian -func (d *D) FieldS55LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS55LE(name, sms...).ActualS() +func (d *D) FieldS55LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS55LE(name, sms...).Actual } // Reader S56LE @@ -14683,11 +14625,10 @@ func (d *D) S56LE() int64 { } // TryFieldScalarS56LE tries to add a field and read 56 bit signed integer in little-endian -func (d *D) TryFieldScalarS56LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS56LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(56, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14696,7 +14637,7 @@ func (d *D) TryFieldScalarS56LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS56LE adds a field and reads 56 bit signed integer in little-endian -func (d *D) FieldScalarS56LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS56LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS56LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S56LE", Pos: d.Pos()}) @@ -14705,14 +14646,14 @@ func (d *D) FieldScalarS56LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS56LE tries to add a field and read 56 bit signed integer in little-endian -func (d *D) TryFieldS56LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS56LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS56LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS56LE adds a field and reads 56 bit signed integer in little-endian -func (d *D) FieldS56LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS56LE(name, sms...).ActualS() +func (d *D) FieldS56LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS56LE(name, sms...).Actual } // Reader S57LE @@ -14730,11 +14671,10 @@ func (d *D) S57LE() int64 { } // TryFieldScalarS57LE tries to add a field and read 57 bit signed integer in little-endian -func (d *D) TryFieldScalarS57LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS57LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(57, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14743,7 +14683,7 @@ func (d *D) TryFieldScalarS57LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS57LE adds a field and reads 57 bit signed integer in little-endian -func (d *D) FieldScalarS57LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS57LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS57LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S57LE", Pos: d.Pos()}) @@ -14752,14 +14692,14 @@ func (d *D) FieldScalarS57LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS57LE tries to add a field and read 57 bit signed integer in little-endian -func (d *D) TryFieldS57LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS57LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS57LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS57LE adds a field and reads 57 bit signed integer in little-endian -func (d *D) FieldS57LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS57LE(name, sms...).ActualS() +func (d *D) FieldS57LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS57LE(name, sms...).Actual } // Reader S58LE @@ -14777,11 +14717,10 @@ func (d *D) S58LE() int64 { } // TryFieldScalarS58LE tries to add a field and read 58 bit signed integer in little-endian -func (d *D) TryFieldScalarS58LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS58LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(58, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14790,7 +14729,7 @@ func (d *D) TryFieldScalarS58LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS58LE adds a field and reads 58 bit signed integer in little-endian -func (d *D) FieldScalarS58LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS58LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS58LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S58LE", Pos: d.Pos()}) @@ -14799,14 +14738,14 @@ func (d *D) FieldScalarS58LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS58LE tries to add a field and read 58 bit signed integer in little-endian -func (d *D) TryFieldS58LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS58LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS58LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS58LE adds a field and reads 58 bit signed integer in little-endian -func (d *D) FieldS58LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS58LE(name, sms...).ActualS() +func (d *D) FieldS58LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS58LE(name, sms...).Actual } // Reader S59LE @@ -14824,11 +14763,10 @@ func (d *D) S59LE() int64 { } // TryFieldScalarS59LE tries to add a field and read 59 bit signed integer in little-endian -func (d *D) TryFieldScalarS59LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS59LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(59, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14837,7 +14775,7 @@ func (d *D) TryFieldScalarS59LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS59LE adds a field and reads 59 bit signed integer in little-endian -func (d *D) FieldScalarS59LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS59LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS59LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S59LE", Pos: d.Pos()}) @@ -14846,14 +14784,14 @@ func (d *D) FieldScalarS59LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS59LE tries to add a field and read 59 bit signed integer in little-endian -func (d *D) TryFieldS59LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS59LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS59LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS59LE adds a field and reads 59 bit signed integer in little-endian -func (d *D) FieldS59LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS59LE(name, sms...).ActualS() +func (d *D) FieldS59LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS59LE(name, sms...).Actual } // Reader S60LE @@ -14871,11 +14809,10 @@ func (d *D) S60LE() int64 { } // TryFieldScalarS60LE tries to add a field and read 60 bit signed integer in little-endian -func (d *D) TryFieldScalarS60LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS60LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(60, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14884,7 +14821,7 @@ func (d *D) TryFieldScalarS60LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS60LE adds a field and reads 60 bit signed integer in little-endian -func (d *D) FieldScalarS60LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS60LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS60LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S60LE", Pos: d.Pos()}) @@ -14893,14 +14830,14 @@ func (d *D) FieldScalarS60LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS60LE tries to add a field and read 60 bit signed integer in little-endian -func (d *D) TryFieldS60LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS60LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS60LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS60LE adds a field and reads 60 bit signed integer in little-endian -func (d *D) FieldS60LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS60LE(name, sms...).ActualS() +func (d *D) FieldS60LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS60LE(name, sms...).Actual } // Reader S61LE @@ -14918,11 +14855,10 @@ func (d *D) S61LE() int64 { } // TryFieldScalarS61LE tries to add a field and read 61 bit signed integer in little-endian -func (d *D) TryFieldScalarS61LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS61LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(61, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14931,7 +14867,7 @@ func (d *D) TryFieldScalarS61LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS61LE adds a field and reads 61 bit signed integer in little-endian -func (d *D) FieldScalarS61LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS61LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS61LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S61LE", Pos: d.Pos()}) @@ -14940,14 +14876,14 @@ func (d *D) FieldScalarS61LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS61LE tries to add a field and read 61 bit signed integer in little-endian -func (d *D) TryFieldS61LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS61LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS61LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS61LE adds a field and reads 61 bit signed integer in little-endian -func (d *D) FieldS61LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS61LE(name, sms...).ActualS() +func (d *D) FieldS61LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS61LE(name, sms...).Actual } // Reader S62LE @@ -14965,11 +14901,10 @@ func (d *D) S62LE() int64 { } // TryFieldScalarS62LE tries to add a field and read 62 bit signed integer in little-endian -func (d *D) TryFieldScalarS62LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS62LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(62, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -14978,7 +14913,7 @@ func (d *D) TryFieldScalarS62LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS62LE adds a field and reads 62 bit signed integer in little-endian -func (d *D) FieldScalarS62LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS62LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS62LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S62LE", Pos: d.Pos()}) @@ -14987,14 +14922,14 @@ func (d *D) FieldScalarS62LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS62LE tries to add a field and read 62 bit signed integer in little-endian -func (d *D) TryFieldS62LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS62LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS62LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS62LE adds a field and reads 62 bit signed integer in little-endian -func (d *D) FieldS62LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS62LE(name, sms...).ActualS() +func (d *D) FieldS62LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS62LE(name, sms...).Actual } // Reader S63LE @@ -15012,11 +14947,10 @@ func (d *D) S63LE() int64 { } // TryFieldScalarS63LE tries to add a field and read 63 bit signed integer in little-endian -func (d *D) TryFieldScalarS63LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS63LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(63, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15025,7 +14959,7 @@ func (d *D) TryFieldScalarS63LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS63LE adds a field and reads 63 bit signed integer in little-endian -func (d *D) FieldScalarS63LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS63LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS63LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S63LE", Pos: d.Pos()}) @@ -15034,14 +14968,14 @@ func (d *D) FieldScalarS63LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS63LE tries to add a field and read 63 bit signed integer in little-endian -func (d *D) TryFieldS63LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS63LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS63LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS63LE adds a field and reads 63 bit signed integer in little-endian -func (d *D) FieldS63LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS63LE(name, sms...).ActualS() +func (d *D) FieldS63LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS63LE(name, sms...).Actual } // Reader S64LE @@ -15059,11 +14993,10 @@ func (d *D) S64LE() int64 { } // TryFieldScalarS64LE tries to add a field and read 64 bit signed integer in little-endian -func (d *D) TryFieldScalarS64LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS64LE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(64, LittleEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15072,7 +15005,7 @@ func (d *D) TryFieldScalarS64LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS64LE adds a field and reads 64 bit signed integer in little-endian -func (d *D) FieldScalarS64LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS64LE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS64LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S64LE", Pos: d.Pos()}) @@ -15081,14 +15014,14 @@ func (d *D) FieldScalarS64LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS64LE tries to add a field and read 64 bit signed integer in little-endian -func (d *D) TryFieldS64LE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS64LE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS64LE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS64LE adds a field and reads 64 bit signed integer in little-endian -func (d *D) FieldS64LE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS64LE(name, sms...).ActualS() +func (d *D) FieldS64LE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS64LE(name, sms...).Actual } // Reader S8BE @@ -15106,11 +15039,10 @@ func (d *D) S8BE() int64 { } // TryFieldScalarS8BE tries to add a field and read 8 bit signed integer in big-endian -func (d *D) TryFieldScalarS8BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS8BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(8, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15119,7 +15051,7 @@ func (d *D) TryFieldScalarS8BE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarS8BE adds a field and reads 8 bit signed integer in big-endian -func (d *D) FieldScalarS8BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS8BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS8BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S8BE", Pos: d.Pos()}) @@ -15128,14 +15060,14 @@ func (d *D) FieldScalarS8BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS8BE tries to add a field and read 8 bit signed integer in big-endian -func (d *D) TryFieldS8BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS8BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS8BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS8BE adds a field and reads 8 bit signed integer in big-endian -func (d *D) FieldS8BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS8BE(name, sms...).ActualS() +func (d *D) FieldS8BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS8BE(name, sms...).Actual } // Reader S9BE @@ -15153,11 +15085,10 @@ func (d *D) S9BE() int64 { } // TryFieldScalarS9BE tries to add a field and read 9 bit signed integer in big-endian -func (d *D) TryFieldScalarS9BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS9BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(9, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15166,7 +15097,7 @@ func (d *D) TryFieldScalarS9BE(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarS9BE adds a field and reads 9 bit signed integer in big-endian -func (d *D) FieldScalarS9BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS9BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS9BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S9BE", Pos: d.Pos()}) @@ -15175,14 +15106,14 @@ func (d *D) FieldScalarS9BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS9BE tries to add a field and read 9 bit signed integer in big-endian -func (d *D) TryFieldS9BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS9BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS9BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS9BE adds a field and reads 9 bit signed integer in big-endian -func (d *D) FieldS9BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS9BE(name, sms...).ActualS() +func (d *D) FieldS9BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS9BE(name, sms...).Actual } // Reader S10BE @@ -15200,11 +15131,10 @@ func (d *D) S10BE() int64 { } // TryFieldScalarS10BE tries to add a field and read 10 bit signed integer in big-endian -func (d *D) TryFieldScalarS10BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS10BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(10, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15213,7 +15143,7 @@ func (d *D) TryFieldScalarS10BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS10BE adds a field and reads 10 bit signed integer in big-endian -func (d *D) FieldScalarS10BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS10BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS10BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S10BE", Pos: d.Pos()}) @@ -15222,14 +15152,14 @@ func (d *D) FieldScalarS10BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS10BE tries to add a field and read 10 bit signed integer in big-endian -func (d *D) TryFieldS10BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS10BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS10BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS10BE adds a field and reads 10 bit signed integer in big-endian -func (d *D) FieldS10BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS10BE(name, sms...).ActualS() +func (d *D) FieldS10BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS10BE(name, sms...).Actual } // Reader S11BE @@ -15247,11 +15177,10 @@ func (d *D) S11BE() int64 { } // TryFieldScalarS11BE tries to add a field and read 11 bit signed integer in big-endian -func (d *D) TryFieldScalarS11BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS11BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(11, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15260,7 +15189,7 @@ func (d *D) TryFieldScalarS11BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS11BE adds a field and reads 11 bit signed integer in big-endian -func (d *D) FieldScalarS11BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS11BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS11BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S11BE", Pos: d.Pos()}) @@ -15269,14 +15198,14 @@ func (d *D) FieldScalarS11BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS11BE tries to add a field and read 11 bit signed integer in big-endian -func (d *D) TryFieldS11BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS11BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS11BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS11BE adds a field and reads 11 bit signed integer in big-endian -func (d *D) FieldS11BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS11BE(name, sms...).ActualS() +func (d *D) FieldS11BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS11BE(name, sms...).Actual } // Reader S12BE @@ -15294,11 +15223,10 @@ func (d *D) S12BE() int64 { } // TryFieldScalarS12BE tries to add a field and read 12 bit signed integer in big-endian -func (d *D) TryFieldScalarS12BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS12BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(12, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15307,7 +15235,7 @@ func (d *D) TryFieldScalarS12BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS12BE adds a field and reads 12 bit signed integer in big-endian -func (d *D) FieldScalarS12BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS12BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS12BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S12BE", Pos: d.Pos()}) @@ -15316,14 +15244,14 @@ func (d *D) FieldScalarS12BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS12BE tries to add a field and read 12 bit signed integer in big-endian -func (d *D) TryFieldS12BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS12BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS12BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS12BE adds a field and reads 12 bit signed integer in big-endian -func (d *D) FieldS12BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS12BE(name, sms...).ActualS() +func (d *D) FieldS12BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS12BE(name, sms...).Actual } // Reader S13BE @@ -15341,11 +15269,10 @@ func (d *D) S13BE() int64 { } // TryFieldScalarS13BE tries to add a field and read 13 bit signed integer in big-endian -func (d *D) TryFieldScalarS13BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS13BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(13, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15354,7 +15281,7 @@ func (d *D) TryFieldScalarS13BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS13BE adds a field and reads 13 bit signed integer in big-endian -func (d *D) FieldScalarS13BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS13BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS13BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S13BE", Pos: d.Pos()}) @@ -15363,14 +15290,14 @@ func (d *D) FieldScalarS13BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS13BE tries to add a field and read 13 bit signed integer in big-endian -func (d *D) TryFieldS13BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS13BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS13BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS13BE adds a field and reads 13 bit signed integer in big-endian -func (d *D) FieldS13BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS13BE(name, sms...).ActualS() +func (d *D) FieldS13BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS13BE(name, sms...).Actual } // Reader S14BE @@ -15388,11 +15315,10 @@ func (d *D) S14BE() int64 { } // TryFieldScalarS14BE tries to add a field and read 14 bit signed integer in big-endian -func (d *D) TryFieldScalarS14BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS14BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(14, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15401,7 +15327,7 @@ func (d *D) TryFieldScalarS14BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS14BE adds a field and reads 14 bit signed integer in big-endian -func (d *D) FieldScalarS14BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS14BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS14BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S14BE", Pos: d.Pos()}) @@ -15410,14 +15336,14 @@ func (d *D) FieldScalarS14BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS14BE tries to add a field and read 14 bit signed integer in big-endian -func (d *D) TryFieldS14BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS14BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS14BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS14BE adds a field and reads 14 bit signed integer in big-endian -func (d *D) FieldS14BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS14BE(name, sms...).ActualS() +func (d *D) FieldS14BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS14BE(name, sms...).Actual } // Reader S15BE @@ -15435,11 +15361,10 @@ func (d *D) S15BE() int64 { } // TryFieldScalarS15BE tries to add a field and read 15 bit signed integer in big-endian -func (d *D) TryFieldScalarS15BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS15BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(15, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15448,7 +15373,7 @@ func (d *D) TryFieldScalarS15BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS15BE adds a field and reads 15 bit signed integer in big-endian -func (d *D) FieldScalarS15BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS15BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS15BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S15BE", Pos: d.Pos()}) @@ -15457,14 +15382,14 @@ func (d *D) FieldScalarS15BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS15BE tries to add a field and read 15 bit signed integer in big-endian -func (d *D) TryFieldS15BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS15BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS15BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS15BE adds a field and reads 15 bit signed integer in big-endian -func (d *D) FieldS15BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS15BE(name, sms...).ActualS() +func (d *D) FieldS15BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS15BE(name, sms...).Actual } // Reader S16BE @@ -15482,11 +15407,10 @@ func (d *D) S16BE() int64 { } // TryFieldScalarS16BE tries to add a field and read 16 bit signed integer in big-endian -func (d *D) TryFieldScalarS16BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS16BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(16, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15495,7 +15419,7 @@ func (d *D) TryFieldScalarS16BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS16BE adds a field and reads 16 bit signed integer in big-endian -func (d *D) FieldScalarS16BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS16BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS16BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S16BE", Pos: d.Pos()}) @@ -15504,14 +15428,14 @@ func (d *D) FieldScalarS16BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS16BE tries to add a field and read 16 bit signed integer in big-endian -func (d *D) TryFieldS16BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS16BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS16BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS16BE adds a field and reads 16 bit signed integer in big-endian -func (d *D) FieldS16BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS16BE(name, sms...).ActualS() +func (d *D) FieldS16BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS16BE(name, sms...).Actual } // Reader S17BE @@ -15529,11 +15453,10 @@ func (d *D) S17BE() int64 { } // TryFieldScalarS17BE tries to add a field and read 17 bit signed integer in big-endian -func (d *D) TryFieldScalarS17BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS17BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(17, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15542,7 +15465,7 @@ func (d *D) TryFieldScalarS17BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS17BE adds a field and reads 17 bit signed integer in big-endian -func (d *D) FieldScalarS17BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS17BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS17BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S17BE", Pos: d.Pos()}) @@ -15551,14 +15474,14 @@ func (d *D) FieldScalarS17BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS17BE tries to add a field and read 17 bit signed integer in big-endian -func (d *D) TryFieldS17BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS17BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS17BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS17BE adds a field and reads 17 bit signed integer in big-endian -func (d *D) FieldS17BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS17BE(name, sms...).ActualS() +func (d *D) FieldS17BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS17BE(name, sms...).Actual } // Reader S18BE @@ -15576,11 +15499,10 @@ func (d *D) S18BE() int64 { } // TryFieldScalarS18BE tries to add a field and read 18 bit signed integer in big-endian -func (d *D) TryFieldScalarS18BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS18BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(18, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15589,7 +15511,7 @@ func (d *D) TryFieldScalarS18BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS18BE adds a field and reads 18 bit signed integer in big-endian -func (d *D) FieldScalarS18BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS18BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS18BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S18BE", Pos: d.Pos()}) @@ -15598,14 +15520,14 @@ func (d *D) FieldScalarS18BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS18BE tries to add a field and read 18 bit signed integer in big-endian -func (d *D) TryFieldS18BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS18BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS18BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS18BE adds a field and reads 18 bit signed integer in big-endian -func (d *D) FieldS18BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS18BE(name, sms...).ActualS() +func (d *D) FieldS18BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS18BE(name, sms...).Actual } // Reader S19BE @@ -15623,11 +15545,10 @@ func (d *D) S19BE() int64 { } // TryFieldScalarS19BE tries to add a field and read 19 bit signed integer in big-endian -func (d *D) TryFieldScalarS19BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS19BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(19, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15636,7 +15557,7 @@ func (d *D) TryFieldScalarS19BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS19BE adds a field and reads 19 bit signed integer in big-endian -func (d *D) FieldScalarS19BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS19BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS19BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S19BE", Pos: d.Pos()}) @@ -15645,14 +15566,14 @@ func (d *D) FieldScalarS19BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS19BE tries to add a field and read 19 bit signed integer in big-endian -func (d *D) TryFieldS19BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS19BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS19BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS19BE adds a field and reads 19 bit signed integer in big-endian -func (d *D) FieldS19BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS19BE(name, sms...).ActualS() +func (d *D) FieldS19BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS19BE(name, sms...).Actual } // Reader S20BE @@ -15670,11 +15591,10 @@ func (d *D) S20BE() int64 { } // TryFieldScalarS20BE tries to add a field and read 20 bit signed integer in big-endian -func (d *D) TryFieldScalarS20BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS20BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(20, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15683,7 +15603,7 @@ func (d *D) TryFieldScalarS20BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS20BE adds a field and reads 20 bit signed integer in big-endian -func (d *D) FieldScalarS20BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS20BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS20BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S20BE", Pos: d.Pos()}) @@ -15692,14 +15612,14 @@ func (d *D) FieldScalarS20BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS20BE tries to add a field and read 20 bit signed integer in big-endian -func (d *D) TryFieldS20BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS20BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS20BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS20BE adds a field and reads 20 bit signed integer in big-endian -func (d *D) FieldS20BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS20BE(name, sms...).ActualS() +func (d *D) FieldS20BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS20BE(name, sms...).Actual } // Reader S21BE @@ -15717,11 +15637,10 @@ func (d *D) S21BE() int64 { } // TryFieldScalarS21BE tries to add a field and read 21 bit signed integer in big-endian -func (d *D) TryFieldScalarS21BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS21BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(21, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15730,7 +15649,7 @@ func (d *D) TryFieldScalarS21BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS21BE adds a field and reads 21 bit signed integer in big-endian -func (d *D) FieldScalarS21BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS21BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS21BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S21BE", Pos: d.Pos()}) @@ -15739,14 +15658,14 @@ func (d *D) FieldScalarS21BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS21BE tries to add a field and read 21 bit signed integer in big-endian -func (d *D) TryFieldS21BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS21BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS21BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS21BE adds a field and reads 21 bit signed integer in big-endian -func (d *D) FieldS21BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS21BE(name, sms...).ActualS() +func (d *D) FieldS21BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS21BE(name, sms...).Actual } // Reader S22BE @@ -15764,11 +15683,10 @@ func (d *D) S22BE() int64 { } // TryFieldScalarS22BE tries to add a field and read 22 bit signed integer in big-endian -func (d *D) TryFieldScalarS22BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS22BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(22, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15777,7 +15695,7 @@ func (d *D) TryFieldScalarS22BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS22BE adds a field and reads 22 bit signed integer in big-endian -func (d *D) FieldScalarS22BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS22BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS22BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S22BE", Pos: d.Pos()}) @@ -15786,14 +15704,14 @@ func (d *D) FieldScalarS22BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS22BE tries to add a field and read 22 bit signed integer in big-endian -func (d *D) TryFieldS22BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS22BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS22BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS22BE adds a field and reads 22 bit signed integer in big-endian -func (d *D) FieldS22BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS22BE(name, sms...).ActualS() +func (d *D) FieldS22BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS22BE(name, sms...).Actual } // Reader S23BE @@ -15811,11 +15729,10 @@ func (d *D) S23BE() int64 { } // TryFieldScalarS23BE tries to add a field and read 23 bit signed integer in big-endian -func (d *D) TryFieldScalarS23BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS23BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(23, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15824,7 +15741,7 @@ func (d *D) TryFieldScalarS23BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS23BE adds a field and reads 23 bit signed integer in big-endian -func (d *D) FieldScalarS23BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS23BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS23BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S23BE", Pos: d.Pos()}) @@ -15833,14 +15750,14 @@ func (d *D) FieldScalarS23BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS23BE tries to add a field and read 23 bit signed integer in big-endian -func (d *D) TryFieldS23BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS23BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS23BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS23BE adds a field and reads 23 bit signed integer in big-endian -func (d *D) FieldS23BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS23BE(name, sms...).ActualS() +func (d *D) FieldS23BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS23BE(name, sms...).Actual } // Reader S24BE @@ -15858,11 +15775,10 @@ func (d *D) S24BE() int64 { } // TryFieldScalarS24BE tries to add a field and read 24 bit signed integer in big-endian -func (d *D) TryFieldScalarS24BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS24BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(24, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15871,7 +15787,7 @@ func (d *D) TryFieldScalarS24BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS24BE adds a field and reads 24 bit signed integer in big-endian -func (d *D) FieldScalarS24BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS24BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS24BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S24BE", Pos: d.Pos()}) @@ -15880,14 +15796,14 @@ func (d *D) FieldScalarS24BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS24BE tries to add a field and read 24 bit signed integer in big-endian -func (d *D) TryFieldS24BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS24BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS24BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS24BE adds a field and reads 24 bit signed integer in big-endian -func (d *D) FieldS24BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS24BE(name, sms...).ActualS() +func (d *D) FieldS24BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS24BE(name, sms...).Actual } // Reader S25BE @@ -15905,11 +15821,10 @@ func (d *D) S25BE() int64 { } // TryFieldScalarS25BE tries to add a field and read 25 bit signed integer in big-endian -func (d *D) TryFieldScalarS25BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS25BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(25, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15918,7 +15833,7 @@ func (d *D) TryFieldScalarS25BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS25BE adds a field and reads 25 bit signed integer in big-endian -func (d *D) FieldScalarS25BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS25BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS25BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S25BE", Pos: d.Pos()}) @@ -15927,14 +15842,14 @@ func (d *D) FieldScalarS25BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS25BE tries to add a field and read 25 bit signed integer in big-endian -func (d *D) TryFieldS25BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS25BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS25BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS25BE adds a field and reads 25 bit signed integer in big-endian -func (d *D) FieldS25BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS25BE(name, sms...).ActualS() +func (d *D) FieldS25BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS25BE(name, sms...).Actual } // Reader S26BE @@ -15952,11 +15867,10 @@ func (d *D) S26BE() int64 { } // TryFieldScalarS26BE tries to add a field and read 26 bit signed integer in big-endian -func (d *D) TryFieldScalarS26BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS26BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(26, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -15965,7 +15879,7 @@ func (d *D) TryFieldScalarS26BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS26BE adds a field and reads 26 bit signed integer in big-endian -func (d *D) FieldScalarS26BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS26BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS26BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S26BE", Pos: d.Pos()}) @@ -15974,14 +15888,14 @@ func (d *D) FieldScalarS26BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS26BE tries to add a field and read 26 bit signed integer in big-endian -func (d *D) TryFieldS26BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS26BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS26BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS26BE adds a field and reads 26 bit signed integer in big-endian -func (d *D) FieldS26BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS26BE(name, sms...).ActualS() +func (d *D) FieldS26BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS26BE(name, sms...).Actual } // Reader S27BE @@ -15999,11 +15913,10 @@ func (d *D) S27BE() int64 { } // TryFieldScalarS27BE tries to add a field and read 27 bit signed integer in big-endian -func (d *D) TryFieldScalarS27BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS27BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(27, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16012,7 +15925,7 @@ func (d *D) TryFieldScalarS27BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS27BE adds a field and reads 27 bit signed integer in big-endian -func (d *D) FieldScalarS27BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS27BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS27BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S27BE", Pos: d.Pos()}) @@ -16021,14 +15934,14 @@ func (d *D) FieldScalarS27BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS27BE tries to add a field and read 27 bit signed integer in big-endian -func (d *D) TryFieldS27BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS27BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS27BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS27BE adds a field and reads 27 bit signed integer in big-endian -func (d *D) FieldS27BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS27BE(name, sms...).ActualS() +func (d *D) FieldS27BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS27BE(name, sms...).Actual } // Reader S28BE @@ -16046,11 +15959,10 @@ func (d *D) S28BE() int64 { } // TryFieldScalarS28BE tries to add a field and read 28 bit signed integer in big-endian -func (d *D) TryFieldScalarS28BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS28BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(28, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16059,7 +15971,7 @@ func (d *D) TryFieldScalarS28BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS28BE adds a field and reads 28 bit signed integer in big-endian -func (d *D) FieldScalarS28BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS28BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS28BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S28BE", Pos: d.Pos()}) @@ -16068,14 +15980,14 @@ func (d *D) FieldScalarS28BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS28BE tries to add a field and read 28 bit signed integer in big-endian -func (d *D) TryFieldS28BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS28BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS28BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS28BE adds a field and reads 28 bit signed integer in big-endian -func (d *D) FieldS28BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS28BE(name, sms...).ActualS() +func (d *D) FieldS28BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS28BE(name, sms...).Actual } // Reader S29BE @@ -16093,11 +16005,10 @@ func (d *D) S29BE() int64 { } // TryFieldScalarS29BE tries to add a field and read 29 bit signed integer in big-endian -func (d *D) TryFieldScalarS29BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS29BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(29, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16106,7 +16017,7 @@ func (d *D) TryFieldScalarS29BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS29BE adds a field and reads 29 bit signed integer in big-endian -func (d *D) FieldScalarS29BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS29BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS29BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S29BE", Pos: d.Pos()}) @@ -16115,14 +16026,14 @@ func (d *D) FieldScalarS29BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS29BE tries to add a field and read 29 bit signed integer in big-endian -func (d *D) TryFieldS29BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS29BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS29BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS29BE adds a field and reads 29 bit signed integer in big-endian -func (d *D) FieldS29BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS29BE(name, sms...).ActualS() +func (d *D) FieldS29BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS29BE(name, sms...).Actual } // Reader S30BE @@ -16140,11 +16051,10 @@ func (d *D) S30BE() int64 { } // TryFieldScalarS30BE tries to add a field and read 30 bit signed integer in big-endian -func (d *D) TryFieldScalarS30BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS30BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(30, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16153,7 +16063,7 @@ func (d *D) TryFieldScalarS30BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS30BE adds a field and reads 30 bit signed integer in big-endian -func (d *D) FieldScalarS30BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS30BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS30BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S30BE", Pos: d.Pos()}) @@ -16162,14 +16072,14 @@ func (d *D) FieldScalarS30BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS30BE tries to add a field and read 30 bit signed integer in big-endian -func (d *D) TryFieldS30BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS30BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS30BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS30BE adds a field and reads 30 bit signed integer in big-endian -func (d *D) FieldS30BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS30BE(name, sms...).ActualS() +func (d *D) FieldS30BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS30BE(name, sms...).Actual } // Reader S31BE @@ -16187,11 +16097,10 @@ func (d *D) S31BE() int64 { } // TryFieldScalarS31BE tries to add a field and read 31 bit signed integer in big-endian -func (d *D) TryFieldScalarS31BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS31BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(31, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16200,7 +16109,7 @@ func (d *D) TryFieldScalarS31BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS31BE adds a field and reads 31 bit signed integer in big-endian -func (d *D) FieldScalarS31BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS31BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS31BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S31BE", Pos: d.Pos()}) @@ -16209,14 +16118,14 @@ func (d *D) FieldScalarS31BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS31BE tries to add a field and read 31 bit signed integer in big-endian -func (d *D) TryFieldS31BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS31BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS31BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS31BE adds a field and reads 31 bit signed integer in big-endian -func (d *D) FieldS31BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS31BE(name, sms...).ActualS() +func (d *D) FieldS31BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS31BE(name, sms...).Actual } // Reader S32BE @@ -16234,11 +16143,10 @@ func (d *D) S32BE() int64 { } // TryFieldScalarS32BE tries to add a field and read 32 bit signed integer in big-endian -func (d *D) TryFieldScalarS32BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS32BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(32, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16247,7 +16155,7 @@ func (d *D) TryFieldScalarS32BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS32BE adds a field and reads 32 bit signed integer in big-endian -func (d *D) FieldScalarS32BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS32BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS32BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S32BE", Pos: d.Pos()}) @@ -16256,14 +16164,14 @@ func (d *D) FieldScalarS32BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS32BE tries to add a field and read 32 bit signed integer in big-endian -func (d *D) TryFieldS32BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS32BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS32BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS32BE adds a field and reads 32 bit signed integer in big-endian -func (d *D) FieldS32BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS32BE(name, sms...).ActualS() +func (d *D) FieldS32BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS32BE(name, sms...).Actual } // Reader S33BE @@ -16281,11 +16189,10 @@ func (d *D) S33BE() int64 { } // TryFieldScalarS33BE tries to add a field and read 33 bit signed integer in big-endian -func (d *D) TryFieldScalarS33BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS33BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(33, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16294,7 +16201,7 @@ func (d *D) TryFieldScalarS33BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS33BE adds a field and reads 33 bit signed integer in big-endian -func (d *D) FieldScalarS33BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS33BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS33BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S33BE", Pos: d.Pos()}) @@ -16303,14 +16210,14 @@ func (d *D) FieldScalarS33BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS33BE tries to add a field and read 33 bit signed integer in big-endian -func (d *D) TryFieldS33BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS33BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS33BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS33BE adds a field and reads 33 bit signed integer in big-endian -func (d *D) FieldS33BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS33BE(name, sms...).ActualS() +func (d *D) FieldS33BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS33BE(name, sms...).Actual } // Reader S34BE @@ -16328,11 +16235,10 @@ func (d *D) S34BE() int64 { } // TryFieldScalarS34BE tries to add a field and read 34 bit signed integer in big-endian -func (d *D) TryFieldScalarS34BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS34BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(34, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16341,7 +16247,7 @@ func (d *D) TryFieldScalarS34BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS34BE adds a field and reads 34 bit signed integer in big-endian -func (d *D) FieldScalarS34BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS34BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS34BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S34BE", Pos: d.Pos()}) @@ -16350,14 +16256,14 @@ func (d *D) FieldScalarS34BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS34BE tries to add a field and read 34 bit signed integer in big-endian -func (d *D) TryFieldS34BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS34BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS34BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS34BE adds a field and reads 34 bit signed integer in big-endian -func (d *D) FieldS34BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS34BE(name, sms...).ActualS() +func (d *D) FieldS34BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS34BE(name, sms...).Actual } // Reader S35BE @@ -16375,11 +16281,10 @@ func (d *D) S35BE() int64 { } // TryFieldScalarS35BE tries to add a field and read 35 bit signed integer in big-endian -func (d *D) TryFieldScalarS35BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS35BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(35, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16388,7 +16293,7 @@ func (d *D) TryFieldScalarS35BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS35BE adds a field and reads 35 bit signed integer in big-endian -func (d *D) FieldScalarS35BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS35BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS35BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S35BE", Pos: d.Pos()}) @@ -16397,14 +16302,14 @@ func (d *D) FieldScalarS35BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS35BE tries to add a field and read 35 bit signed integer in big-endian -func (d *D) TryFieldS35BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS35BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS35BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS35BE adds a field and reads 35 bit signed integer in big-endian -func (d *D) FieldS35BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS35BE(name, sms...).ActualS() +func (d *D) FieldS35BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS35BE(name, sms...).Actual } // Reader S36BE @@ -16422,11 +16327,10 @@ func (d *D) S36BE() int64 { } // TryFieldScalarS36BE tries to add a field and read 36 bit signed integer in big-endian -func (d *D) TryFieldScalarS36BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS36BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(36, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16435,7 +16339,7 @@ func (d *D) TryFieldScalarS36BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS36BE adds a field and reads 36 bit signed integer in big-endian -func (d *D) FieldScalarS36BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS36BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS36BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S36BE", Pos: d.Pos()}) @@ -16444,14 +16348,14 @@ func (d *D) FieldScalarS36BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS36BE tries to add a field and read 36 bit signed integer in big-endian -func (d *D) TryFieldS36BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS36BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS36BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS36BE adds a field and reads 36 bit signed integer in big-endian -func (d *D) FieldS36BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS36BE(name, sms...).ActualS() +func (d *D) FieldS36BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS36BE(name, sms...).Actual } // Reader S37BE @@ -16469,11 +16373,10 @@ func (d *D) S37BE() int64 { } // TryFieldScalarS37BE tries to add a field and read 37 bit signed integer in big-endian -func (d *D) TryFieldScalarS37BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS37BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(37, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16482,7 +16385,7 @@ func (d *D) TryFieldScalarS37BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS37BE adds a field and reads 37 bit signed integer in big-endian -func (d *D) FieldScalarS37BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS37BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS37BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S37BE", Pos: d.Pos()}) @@ -16491,14 +16394,14 @@ func (d *D) FieldScalarS37BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS37BE tries to add a field and read 37 bit signed integer in big-endian -func (d *D) TryFieldS37BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS37BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS37BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS37BE adds a field and reads 37 bit signed integer in big-endian -func (d *D) FieldS37BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS37BE(name, sms...).ActualS() +func (d *D) FieldS37BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS37BE(name, sms...).Actual } // Reader S38BE @@ -16516,11 +16419,10 @@ func (d *D) S38BE() int64 { } // TryFieldScalarS38BE tries to add a field and read 38 bit signed integer in big-endian -func (d *D) TryFieldScalarS38BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS38BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(38, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16529,7 +16431,7 @@ func (d *D) TryFieldScalarS38BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS38BE adds a field and reads 38 bit signed integer in big-endian -func (d *D) FieldScalarS38BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS38BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS38BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S38BE", Pos: d.Pos()}) @@ -16538,14 +16440,14 @@ func (d *D) FieldScalarS38BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS38BE tries to add a field and read 38 bit signed integer in big-endian -func (d *D) TryFieldS38BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS38BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS38BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS38BE adds a field and reads 38 bit signed integer in big-endian -func (d *D) FieldS38BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS38BE(name, sms...).ActualS() +func (d *D) FieldS38BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS38BE(name, sms...).Actual } // Reader S39BE @@ -16563,11 +16465,10 @@ func (d *D) S39BE() int64 { } // TryFieldScalarS39BE tries to add a field and read 39 bit signed integer in big-endian -func (d *D) TryFieldScalarS39BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS39BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(39, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16576,7 +16477,7 @@ func (d *D) TryFieldScalarS39BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS39BE adds a field and reads 39 bit signed integer in big-endian -func (d *D) FieldScalarS39BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS39BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS39BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S39BE", Pos: d.Pos()}) @@ -16585,14 +16486,14 @@ func (d *D) FieldScalarS39BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS39BE tries to add a field and read 39 bit signed integer in big-endian -func (d *D) TryFieldS39BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS39BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS39BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS39BE adds a field and reads 39 bit signed integer in big-endian -func (d *D) FieldS39BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS39BE(name, sms...).ActualS() +func (d *D) FieldS39BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS39BE(name, sms...).Actual } // Reader S40BE @@ -16610,11 +16511,10 @@ func (d *D) S40BE() int64 { } // TryFieldScalarS40BE tries to add a field and read 40 bit signed integer in big-endian -func (d *D) TryFieldScalarS40BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS40BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(40, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16623,7 +16523,7 @@ func (d *D) TryFieldScalarS40BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS40BE adds a field and reads 40 bit signed integer in big-endian -func (d *D) FieldScalarS40BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS40BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS40BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S40BE", Pos: d.Pos()}) @@ -16632,14 +16532,14 @@ func (d *D) FieldScalarS40BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS40BE tries to add a field and read 40 bit signed integer in big-endian -func (d *D) TryFieldS40BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS40BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS40BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS40BE adds a field and reads 40 bit signed integer in big-endian -func (d *D) FieldS40BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS40BE(name, sms...).ActualS() +func (d *D) FieldS40BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS40BE(name, sms...).Actual } // Reader S41BE @@ -16657,11 +16557,10 @@ func (d *D) S41BE() int64 { } // TryFieldScalarS41BE tries to add a field and read 41 bit signed integer in big-endian -func (d *D) TryFieldScalarS41BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS41BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(41, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16670,7 +16569,7 @@ func (d *D) TryFieldScalarS41BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS41BE adds a field and reads 41 bit signed integer in big-endian -func (d *D) FieldScalarS41BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS41BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS41BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S41BE", Pos: d.Pos()}) @@ -16679,14 +16578,14 @@ func (d *D) FieldScalarS41BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS41BE tries to add a field and read 41 bit signed integer in big-endian -func (d *D) TryFieldS41BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS41BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS41BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS41BE adds a field and reads 41 bit signed integer in big-endian -func (d *D) FieldS41BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS41BE(name, sms...).ActualS() +func (d *D) FieldS41BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS41BE(name, sms...).Actual } // Reader S42BE @@ -16704,11 +16603,10 @@ func (d *D) S42BE() int64 { } // TryFieldScalarS42BE tries to add a field and read 42 bit signed integer in big-endian -func (d *D) TryFieldScalarS42BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS42BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(42, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16717,7 +16615,7 @@ func (d *D) TryFieldScalarS42BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS42BE adds a field and reads 42 bit signed integer in big-endian -func (d *D) FieldScalarS42BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS42BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS42BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S42BE", Pos: d.Pos()}) @@ -16726,14 +16624,14 @@ func (d *D) FieldScalarS42BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS42BE tries to add a field and read 42 bit signed integer in big-endian -func (d *D) TryFieldS42BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS42BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS42BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS42BE adds a field and reads 42 bit signed integer in big-endian -func (d *D) FieldS42BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS42BE(name, sms...).ActualS() +func (d *D) FieldS42BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS42BE(name, sms...).Actual } // Reader S43BE @@ -16751,11 +16649,10 @@ func (d *D) S43BE() int64 { } // TryFieldScalarS43BE tries to add a field and read 43 bit signed integer in big-endian -func (d *D) TryFieldScalarS43BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS43BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(43, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16764,7 +16661,7 @@ func (d *D) TryFieldScalarS43BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS43BE adds a field and reads 43 bit signed integer in big-endian -func (d *D) FieldScalarS43BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS43BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS43BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S43BE", Pos: d.Pos()}) @@ -16773,14 +16670,14 @@ func (d *D) FieldScalarS43BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS43BE tries to add a field and read 43 bit signed integer in big-endian -func (d *D) TryFieldS43BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS43BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS43BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS43BE adds a field and reads 43 bit signed integer in big-endian -func (d *D) FieldS43BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS43BE(name, sms...).ActualS() +func (d *D) FieldS43BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS43BE(name, sms...).Actual } // Reader S44BE @@ -16798,11 +16695,10 @@ func (d *D) S44BE() int64 { } // TryFieldScalarS44BE tries to add a field and read 44 bit signed integer in big-endian -func (d *D) TryFieldScalarS44BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS44BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(44, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16811,7 +16707,7 @@ func (d *D) TryFieldScalarS44BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS44BE adds a field and reads 44 bit signed integer in big-endian -func (d *D) FieldScalarS44BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS44BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS44BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S44BE", Pos: d.Pos()}) @@ -16820,14 +16716,14 @@ func (d *D) FieldScalarS44BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS44BE tries to add a field and read 44 bit signed integer in big-endian -func (d *D) TryFieldS44BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS44BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS44BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS44BE adds a field and reads 44 bit signed integer in big-endian -func (d *D) FieldS44BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS44BE(name, sms...).ActualS() +func (d *D) FieldS44BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS44BE(name, sms...).Actual } // Reader S45BE @@ -16845,11 +16741,10 @@ func (d *D) S45BE() int64 { } // TryFieldScalarS45BE tries to add a field and read 45 bit signed integer in big-endian -func (d *D) TryFieldScalarS45BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS45BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(45, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16858,7 +16753,7 @@ func (d *D) TryFieldScalarS45BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS45BE adds a field and reads 45 bit signed integer in big-endian -func (d *D) FieldScalarS45BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS45BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS45BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S45BE", Pos: d.Pos()}) @@ -16867,14 +16762,14 @@ func (d *D) FieldScalarS45BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS45BE tries to add a field and read 45 bit signed integer in big-endian -func (d *D) TryFieldS45BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS45BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS45BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS45BE adds a field and reads 45 bit signed integer in big-endian -func (d *D) FieldS45BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS45BE(name, sms...).ActualS() +func (d *D) FieldS45BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS45BE(name, sms...).Actual } // Reader S46BE @@ -16892,11 +16787,10 @@ func (d *D) S46BE() int64 { } // TryFieldScalarS46BE tries to add a field and read 46 bit signed integer in big-endian -func (d *D) TryFieldScalarS46BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS46BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(46, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16905,7 +16799,7 @@ func (d *D) TryFieldScalarS46BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS46BE adds a field and reads 46 bit signed integer in big-endian -func (d *D) FieldScalarS46BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS46BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS46BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S46BE", Pos: d.Pos()}) @@ -16914,14 +16808,14 @@ func (d *D) FieldScalarS46BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS46BE tries to add a field and read 46 bit signed integer in big-endian -func (d *D) TryFieldS46BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS46BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS46BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS46BE adds a field and reads 46 bit signed integer in big-endian -func (d *D) FieldS46BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS46BE(name, sms...).ActualS() +func (d *D) FieldS46BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS46BE(name, sms...).Actual } // Reader S47BE @@ -16939,11 +16833,10 @@ func (d *D) S47BE() int64 { } // TryFieldScalarS47BE tries to add a field and read 47 bit signed integer in big-endian -func (d *D) TryFieldScalarS47BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS47BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(47, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16952,7 +16845,7 @@ func (d *D) TryFieldScalarS47BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS47BE adds a field and reads 47 bit signed integer in big-endian -func (d *D) FieldScalarS47BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS47BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS47BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S47BE", Pos: d.Pos()}) @@ -16961,14 +16854,14 @@ func (d *D) FieldScalarS47BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS47BE tries to add a field and read 47 bit signed integer in big-endian -func (d *D) TryFieldS47BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS47BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS47BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS47BE adds a field and reads 47 bit signed integer in big-endian -func (d *D) FieldS47BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS47BE(name, sms...).ActualS() +func (d *D) FieldS47BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS47BE(name, sms...).Actual } // Reader S48BE @@ -16986,11 +16879,10 @@ func (d *D) S48BE() int64 { } // TryFieldScalarS48BE tries to add a field and read 48 bit signed integer in big-endian -func (d *D) TryFieldScalarS48BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS48BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(48, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -16999,7 +16891,7 @@ func (d *D) TryFieldScalarS48BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS48BE adds a field and reads 48 bit signed integer in big-endian -func (d *D) FieldScalarS48BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS48BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS48BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S48BE", Pos: d.Pos()}) @@ -17008,14 +16900,14 @@ func (d *D) FieldScalarS48BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS48BE tries to add a field and read 48 bit signed integer in big-endian -func (d *D) TryFieldS48BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS48BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS48BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS48BE adds a field and reads 48 bit signed integer in big-endian -func (d *D) FieldS48BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS48BE(name, sms...).ActualS() +func (d *D) FieldS48BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS48BE(name, sms...).Actual } // Reader S49BE @@ -17033,11 +16925,10 @@ func (d *D) S49BE() int64 { } // TryFieldScalarS49BE tries to add a field and read 49 bit signed integer in big-endian -func (d *D) TryFieldScalarS49BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS49BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(49, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17046,7 +16937,7 @@ func (d *D) TryFieldScalarS49BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS49BE adds a field and reads 49 bit signed integer in big-endian -func (d *D) FieldScalarS49BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS49BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS49BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S49BE", Pos: d.Pos()}) @@ -17055,14 +16946,14 @@ func (d *D) FieldScalarS49BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS49BE tries to add a field and read 49 bit signed integer in big-endian -func (d *D) TryFieldS49BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS49BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS49BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS49BE adds a field and reads 49 bit signed integer in big-endian -func (d *D) FieldS49BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS49BE(name, sms...).ActualS() +func (d *D) FieldS49BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS49BE(name, sms...).Actual } // Reader S50BE @@ -17080,11 +16971,10 @@ func (d *D) S50BE() int64 { } // TryFieldScalarS50BE tries to add a field and read 50 bit signed integer in big-endian -func (d *D) TryFieldScalarS50BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS50BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(50, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17093,7 +16983,7 @@ func (d *D) TryFieldScalarS50BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS50BE adds a field and reads 50 bit signed integer in big-endian -func (d *D) FieldScalarS50BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS50BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS50BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S50BE", Pos: d.Pos()}) @@ -17102,14 +16992,14 @@ func (d *D) FieldScalarS50BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS50BE tries to add a field and read 50 bit signed integer in big-endian -func (d *D) TryFieldS50BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS50BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS50BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS50BE adds a field and reads 50 bit signed integer in big-endian -func (d *D) FieldS50BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS50BE(name, sms...).ActualS() +func (d *D) FieldS50BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS50BE(name, sms...).Actual } // Reader S51BE @@ -17127,11 +17017,10 @@ func (d *D) S51BE() int64 { } // TryFieldScalarS51BE tries to add a field and read 51 bit signed integer in big-endian -func (d *D) TryFieldScalarS51BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS51BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(51, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17140,7 +17029,7 @@ func (d *D) TryFieldScalarS51BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS51BE adds a field and reads 51 bit signed integer in big-endian -func (d *D) FieldScalarS51BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS51BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS51BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S51BE", Pos: d.Pos()}) @@ -17149,14 +17038,14 @@ func (d *D) FieldScalarS51BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS51BE tries to add a field and read 51 bit signed integer in big-endian -func (d *D) TryFieldS51BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS51BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS51BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS51BE adds a field and reads 51 bit signed integer in big-endian -func (d *D) FieldS51BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS51BE(name, sms...).ActualS() +func (d *D) FieldS51BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS51BE(name, sms...).Actual } // Reader S52BE @@ -17174,11 +17063,10 @@ func (d *D) S52BE() int64 { } // TryFieldScalarS52BE tries to add a field and read 52 bit signed integer in big-endian -func (d *D) TryFieldScalarS52BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS52BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(52, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17187,7 +17075,7 @@ func (d *D) TryFieldScalarS52BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS52BE adds a field and reads 52 bit signed integer in big-endian -func (d *D) FieldScalarS52BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS52BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS52BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S52BE", Pos: d.Pos()}) @@ -17196,14 +17084,14 @@ func (d *D) FieldScalarS52BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS52BE tries to add a field and read 52 bit signed integer in big-endian -func (d *D) TryFieldS52BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS52BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS52BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS52BE adds a field and reads 52 bit signed integer in big-endian -func (d *D) FieldS52BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS52BE(name, sms...).ActualS() +func (d *D) FieldS52BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS52BE(name, sms...).Actual } // Reader S53BE @@ -17221,11 +17109,10 @@ func (d *D) S53BE() int64 { } // TryFieldScalarS53BE tries to add a field and read 53 bit signed integer in big-endian -func (d *D) TryFieldScalarS53BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS53BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(53, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17234,7 +17121,7 @@ func (d *D) TryFieldScalarS53BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS53BE adds a field and reads 53 bit signed integer in big-endian -func (d *D) FieldScalarS53BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS53BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS53BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S53BE", Pos: d.Pos()}) @@ -17243,14 +17130,14 @@ func (d *D) FieldScalarS53BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS53BE tries to add a field and read 53 bit signed integer in big-endian -func (d *D) TryFieldS53BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS53BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS53BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS53BE adds a field and reads 53 bit signed integer in big-endian -func (d *D) FieldS53BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS53BE(name, sms...).ActualS() +func (d *D) FieldS53BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS53BE(name, sms...).Actual } // Reader S54BE @@ -17268,11 +17155,10 @@ func (d *D) S54BE() int64 { } // TryFieldScalarS54BE tries to add a field and read 54 bit signed integer in big-endian -func (d *D) TryFieldScalarS54BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS54BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(54, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17281,7 +17167,7 @@ func (d *D) TryFieldScalarS54BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS54BE adds a field and reads 54 bit signed integer in big-endian -func (d *D) FieldScalarS54BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS54BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS54BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S54BE", Pos: d.Pos()}) @@ -17290,14 +17176,14 @@ func (d *D) FieldScalarS54BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS54BE tries to add a field and read 54 bit signed integer in big-endian -func (d *D) TryFieldS54BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS54BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS54BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS54BE adds a field and reads 54 bit signed integer in big-endian -func (d *D) FieldS54BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS54BE(name, sms...).ActualS() +func (d *D) FieldS54BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS54BE(name, sms...).Actual } // Reader S55BE @@ -17315,11 +17201,10 @@ func (d *D) S55BE() int64 { } // TryFieldScalarS55BE tries to add a field and read 55 bit signed integer in big-endian -func (d *D) TryFieldScalarS55BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS55BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(55, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17328,7 +17213,7 @@ func (d *D) TryFieldScalarS55BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS55BE adds a field and reads 55 bit signed integer in big-endian -func (d *D) FieldScalarS55BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS55BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS55BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S55BE", Pos: d.Pos()}) @@ -17337,14 +17222,14 @@ func (d *D) FieldScalarS55BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS55BE tries to add a field and read 55 bit signed integer in big-endian -func (d *D) TryFieldS55BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS55BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS55BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS55BE adds a field and reads 55 bit signed integer in big-endian -func (d *D) FieldS55BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS55BE(name, sms...).ActualS() +func (d *D) FieldS55BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS55BE(name, sms...).Actual } // Reader S56BE @@ -17362,11 +17247,10 @@ func (d *D) S56BE() int64 { } // TryFieldScalarS56BE tries to add a field and read 56 bit signed integer in big-endian -func (d *D) TryFieldScalarS56BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS56BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(56, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17375,7 +17259,7 @@ func (d *D) TryFieldScalarS56BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS56BE adds a field and reads 56 bit signed integer in big-endian -func (d *D) FieldScalarS56BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS56BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS56BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S56BE", Pos: d.Pos()}) @@ -17384,14 +17268,14 @@ func (d *D) FieldScalarS56BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS56BE tries to add a field and read 56 bit signed integer in big-endian -func (d *D) TryFieldS56BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS56BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS56BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS56BE adds a field and reads 56 bit signed integer in big-endian -func (d *D) FieldS56BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS56BE(name, sms...).ActualS() +func (d *D) FieldS56BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS56BE(name, sms...).Actual } // Reader S57BE @@ -17409,11 +17293,10 @@ func (d *D) S57BE() int64 { } // TryFieldScalarS57BE tries to add a field and read 57 bit signed integer in big-endian -func (d *D) TryFieldScalarS57BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS57BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(57, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17422,7 +17305,7 @@ func (d *D) TryFieldScalarS57BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS57BE adds a field and reads 57 bit signed integer in big-endian -func (d *D) FieldScalarS57BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS57BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS57BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S57BE", Pos: d.Pos()}) @@ -17431,14 +17314,14 @@ func (d *D) FieldScalarS57BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS57BE tries to add a field and read 57 bit signed integer in big-endian -func (d *D) TryFieldS57BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS57BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS57BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS57BE adds a field and reads 57 bit signed integer in big-endian -func (d *D) FieldS57BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS57BE(name, sms...).ActualS() +func (d *D) FieldS57BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS57BE(name, sms...).Actual } // Reader S58BE @@ -17456,11 +17339,10 @@ func (d *D) S58BE() int64 { } // TryFieldScalarS58BE tries to add a field and read 58 bit signed integer in big-endian -func (d *D) TryFieldScalarS58BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS58BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(58, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17469,7 +17351,7 @@ func (d *D) TryFieldScalarS58BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS58BE adds a field and reads 58 bit signed integer in big-endian -func (d *D) FieldScalarS58BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS58BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS58BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S58BE", Pos: d.Pos()}) @@ -17478,14 +17360,14 @@ func (d *D) FieldScalarS58BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS58BE tries to add a field and read 58 bit signed integer in big-endian -func (d *D) TryFieldS58BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS58BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS58BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS58BE adds a field and reads 58 bit signed integer in big-endian -func (d *D) FieldS58BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS58BE(name, sms...).ActualS() +func (d *D) FieldS58BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS58BE(name, sms...).Actual } // Reader S59BE @@ -17503,11 +17385,10 @@ func (d *D) S59BE() int64 { } // TryFieldScalarS59BE tries to add a field and read 59 bit signed integer in big-endian -func (d *D) TryFieldScalarS59BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS59BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(59, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17516,7 +17397,7 @@ func (d *D) TryFieldScalarS59BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS59BE adds a field and reads 59 bit signed integer in big-endian -func (d *D) FieldScalarS59BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS59BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS59BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S59BE", Pos: d.Pos()}) @@ -17525,14 +17406,14 @@ func (d *D) FieldScalarS59BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS59BE tries to add a field and read 59 bit signed integer in big-endian -func (d *D) TryFieldS59BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS59BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS59BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS59BE adds a field and reads 59 bit signed integer in big-endian -func (d *D) FieldS59BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS59BE(name, sms...).ActualS() +func (d *D) FieldS59BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS59BE(name, sms...).Actual } // Reader S60BE @@ -17550,11 +17431,10 @@ func (d *D) S60BE() int64 { } // TryFieldScalarS60BE tries to add a field and read 60 bit signed integer in big-endian -func (d *D) TryFieldScalarS60BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS60BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(60, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17563,7 +17443,7 @@ func (d *D) TryFieldScalarS60BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS60BE adds a field and reads 60 bit signed integer in big-endian -func (d *D) FieldScalarS60BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS60BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS60BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S60BE", Pos: d.Pos()}) @@ -17572,14 +17452,14 @@ func (d *D) FieldScalarS60BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS60BE tries to add a field and read 60 bit signed integer in big-endian -func (d *D) TryFieldS60BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS60BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS60BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS60BE adds a field and reads 60 bit signed integer in big-endian -func (d *D) FieldS60BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS60BE(name, sms...).ActualS() +func (d *D) FieldS60BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS60BE(name, sms...).Actual } // Reader S61BE @@ -17597,11 +17477,10 @@ func (d *D) S61BE() int64 { } // TryFieldScalarS61BE tries to add a field and read 61 bit signed integer in big-endian -func (d *D) TryFieldScalarS61BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS61BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(61, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17610,7 +17489,7 @@ func (d *D) TryFieldScalarS61BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS61BE adds a field and reads 61 bit signed integer in big-endian -func (d *D) FieldScalarS61BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS61BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS61BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S61BE", Pos: d.Pos()}) @@ -17619,14 +17498,14 @@ func (d *D) FieldScalarS61BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS61BE tries to add a field and read 61 bit signed integer in big-endian -func (d *D) TryFieldS61BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS61BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS61BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS61BE adds a field and reads 61 bit signed integer in big-endian -func (d *D) FieldS61BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS61BE(name, sms...).ActualS() +func (d *D) FieldS61BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS61BE(name, sms...).Actual } // Reader S62BE @@ -17644,11 +17523,10 @@ func (d *D) S62BE() int64 { } // TryFieldScalarS62BE tries to add a field and read 62 bit signed integer in big-endian -func (d *D) TryFieldScalarS62BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS62BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(62, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17657,7 +17535,7 @@ func (d *D) TryFieldScalarS62BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS62BE adds a field and reads 62 bit signed integer in big-endian -func (d *D) FieldScalarS62BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS62BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS62BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S62BE", Pos: d.Pos()}) @@ -17666,14 +17544,14 @@ func (d *D) FieldScalarS62BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS62BE tries to add a field and read 62 bit signed integer in big-endian -func (d *D) TryFieldS62BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS62BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS62BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS62BE adds a field and reads 62 bit signed integer in big-endian -func (d *D) FieldS62BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS62BE(name, sms...).ActualS() +func (d *D) FieldS62BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS62BE(name, sms...).Actual } // Reader S63BE @@ -17691,11 +17569,10 @@ func (d *D) S63BE() int64 { } // TryFieldScalarS63BE tries to add a field and read 63 bit signed integer in big-endian -func (d *D) TryFieldScalarS63BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS63BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(63, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17704,7 +17581,7 @@ func (d *D) TryFieldScalarS63BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS63BE adds a field and reads 63 bit signed integer in big-endian -func (d *D) FieldScalarS63BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS63BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS63BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S63BE", Pos: d.Pos()}) @@ -17713,14 +17590,14 @@ func (d *D) FieldScalarS63BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS63BE tries to add a field and read 63 bit signed integer in big-endian -func (d *D) TryFieldS63BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS63BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS63BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS63BE adds a field and reads 63 bit signed integer in big-endian -func (d *D) FieldS63BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS63BE(name, sms...).ActualS() +func (d *D) FieldS63BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS63BE(name, sms...).Actual } // Reader S64BE @@ -17738,11 +17615,10 @@ func (d *D) S64BE() int64 { } // TryFieldScalarS64BE tries to add a field and read 64 bit signed integer in big-endian -func (d *D) TryFieldScalarS64BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarS64BE(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySEndian(64, BigEndian) - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17751,7 +17627,7 @@ func (d *D) TryFieldScalarS64BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarS64BE adds a field and reads 64 bit signed integer in big-endian -func (d *D) FieldScalarS64BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarS64BE(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarS64BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "S64BE", Pos: d.Pos()}) @@ -17760,14 +17636,14 @@ func (d *D) FieldScalarS64BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldS64BE tries to add a field and read 64 bit signed integer in big-endian -func (d *D) TryFieldS64BE(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldS64BE(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarS64BE(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldS64BE adds a field and reads 64 bit signed integer in big-endian -func (d *D) FieldS64BE(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarS64BE(name, sms...).ActualS() +func (d *D) FieldS64BE(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarS64BE(name, sms...).Actual } // Reader UBigInt @@ -17787,11 +17663,10 @@ func (d *D) UBigInt(nBits int) *big.Int { } // TryFieldScalarUBigInt tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldScalarUBigInt(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUBigInt(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, d.Endian, false) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17800,7 +17675,7 @@ func (d *D) TryFieldScalarUBigInt(name string, nBits int, sms ...scalar.Mapper) } // FieldScalarUBigInt adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldScalarUBigInt(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUBigInt(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarUBigInt(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UBigInt", Pos: d.Pos()}) @@ -17809,14 +17684,14 @@ func (d *D) FieldScalarUBigInt(name string, nBits int, sms ...scalar.Mapper) *sc } // TryFieldUBigInt tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldUBigInt(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldUBigInt(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarUBigInt(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldUBigInt adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldUBigInt(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarUBigInt(name, nBits, sms...).ActualBigInt() +func (d *D) FieldUBigInt(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarUBigInt(name, nBits, sms...).Actual } // Reader UBigIntE @@ -17836,11 +17711,10 @@ func (d *D) UBigIntE(nBits int, endian Endian) *big.Int { } // TryFieldScalarUBigIntE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldScalarUBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, endian, false) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17849,7 +17723,7 @@ func (d *D) TryFieldScalarUBigIntE(name string, nBits int, endian Endian, sms .. } // FieldScalarUBigIntE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldScalarUBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarUBigIntE(name, nBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UBigIntE", Pos: d.Pos()}) @@ -17858,14 +17732,14 @@ func (d *D) FieldScalarUBigIntE(name string, nBits int, endian Endian, sms ...sc } // TryFieldUBigIntE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldUBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldUBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarUBigIntE(name, nBits, endian, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldUBigIntE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldUBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarUBigIntE(name, nBits, endian, sms...).ActualBigInt() +func (d *D) FieldUBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarUBigIntE(name, nBits, endian, sms...).Actual } // Reader UBigIntLE @@ -17885,11 +17759,10 @@ func (d *D) UBigIntLE(nBits int) *big.Int { } // TryFieldScalarUBigIntLE tries to add a field and read nBits bit signed integer in little-endian -func (d *D) TryFieldScalarUBigIntLE(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, LittleEndian, false) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17898,7 +17771,7 @@ func (d *D) TryFieldScalarUBigIntLE(name string, nBits int, sms ...scalar.Mapper } // FieldScalarUBigIntLE adds a field and reads nBits bit signed integer in little-endian -func (d *D) FieldScalarUBigIntLE(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarUBigIntLE(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UBigIntLE", Pos: d.Pos()}) @@ -17907,14 +17780,14 @@ func (d *D) FieldScalarUBigIntLE(name string, nBits int, sms ...scalar.Mapper) * } // TryFieldUBigIntLE tries to add a field and read nBits bit signed integer in little-endian -func (d *D) TryFieldUBigIntLE(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldUBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarUBigIntLE(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldUBigIntLE adds a field and reads nBits bit signed integer in little-endian -func (d *D) FieldUBigIntLE(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarUBigIntLE(name, nBits, sms...).ActualBigInt() +func (d *D) FieldUBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarUBigIntLE(name, nBits, sms...).Actual } // Reader UBigIntBE @@ -17934,11 +17807,10 @@ func (d *D) UBigIntBE(nBits int) *big.Int { } // TryFieldScalarUBigIntBE tries to add a field and read nBits bit signed integer in big-endian -func (d *D) TryFieldScalarUBigIntBE(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, BigEndian, false) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17947,7 +17819,7 @@ func (d *D) TryFieldScalarUBigIntBE(name string, nBits int, sms ...scalar.Mapper } // FieldScalarUBigIntBE adds a field and reads nBits bit signed integer in big-endian -func (d *D) FieldScalarUBigIntBE(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarUBigIntBE(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UBigIntBE", Pos: d.Pos()}) @@ -17956,14 +17828,14 @@ func (d *D) FieldScalarUBigIntBE(name string, nBits int, sms ...scalar.Mapper) * } // TryFieldUBigIntBE tries to add a field and read nBits bit signed integer in big-endian -func (d *D) TryFieldUBigIntBE(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldUBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarUBigIntBE(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldUBigIntBE adds a field and reads nBits bit signed integer in big-endian -func (d *D) FieldUBigIntBE(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarUBigIntBE(name, nBits, sms...).ActualBigInt() +func (d *D) FieldUBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarUBigIntBE(name, nBits, sms...).Actual } // Reader SBigInt @@ -17983,11 +17855,10 @@ func (d *D) SBigInt(nBits int) *big.Int { } // TryFieldScalarSBigInt tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldScalarSBigInt(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSBigInt(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, d.Endian, true) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -17996,7 +17867,7 @@ func (d *D) TryFieldScalarSBigInt(name string, nBits int, sms ...scalar.Mapper) } // FieldScalarSBigInt adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldScalarSBigInt(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSBigInt(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarSBigInt(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SBigInt", Pos: d.Pos()}) @@ -18005,14 +17876,14 @@ func (d *D) FieldScalarSBigInt(name string, nBits int, sms ...scalar.Mapper) *sc } // TryFieldSBigInt tries to add a field and read nBits bits signed integer in current endian -func (d *D) TryFieldSBigInt(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldSBigInt(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarSBigInt(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldSBigInt adds a field and reads nBits bits signed integer in current endian -func (d *D) FieldSBigInt(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarSBigInt(name, nBits, sms...).ActualBigInt() +func (d *D) FieldSBigInt(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarSBigInt(name, nBits, sms...).Actual } // Reader SBigIntE @@ -18032,11 +17903,10 @@ func (d *D) SBigIntE(nBits int, endian Endian) *big.Int { } // TryFieldScalarSBigIntE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldScalarSBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, endian, true) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18045,7 +17915,7 @@ func (d *D) TryFieldScalarSBigIntE(name string, nBits int, endian Endian, sms .. } // FieldScalarSBigIntE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldScalarSBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarSBigIntE(name, nBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SBigIntE", Pos: d.Pos()}) @@ -18054,14 +17924,14 @@ func (d *D) FieldScalarSBigIntE(name string, nBits int, endian Endian, sms ...sc } // TryFieldSBigIntE tries to add a field and read nBits signed integer in specified endian -func (d *D) TryFieldSBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldSBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarSBigIntE(name, nBits, endian, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldSBigIntE adds a field and reads nBits signed integer in specified endian -func (d *D) FieldSBigIntE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarSBigIntE(name, nBits, endian, sms...).ActualBigInt() +func (d *D) FieldSBigIntE(name string, nBits int, endian Endian, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarSBigIntE(name, nBits, endian, sms...).Actual } // Reader SBigIntLE @@ -18081,11 +17951,10 @@ func (d *D) SBigIntLE(nBits int) *big.Int { } // TryFieldScalarSBigIntLE tries to add a field and read nBits bit signed integer in little-endian -func (d *D) TryFieldScalarSBigIntLE(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, LittleEndian, true) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18094,7 +17963,7 @@ func (d *D) TryFieldScalarSBigIntLE(name string, nBits int, sms ...scalar.Mapper } // FieldScalarSBigIntLE adds a field and reads nBits bit signed integer in little-endian -func (d *D) FieldScalarSBigIntLE(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarSBigIntLE(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SBigIntLE", Pos: d.Pos()}) @@ -18103,14 +17972,14 @@ func (d *D) FieldScalarSBigIntLE(name string, nBits int, sms ...scalar.Mapper) * } // TryFieldSBigIntLE tries to add a field and read nBits bit signed integer in little-endian -func (d *D) TryFieldSBigIntLE(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldSBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarSBigIntLE(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldSBigIntLE adds a field and reads nBits bit signed integer in little-endian -func (d *D) FieldSBigIntLE(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarSBigIntLE(name, nBits, sms...).ActualBigInt() +func (d *D) FieldSBigIntLE(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarSBigIntLE(name, nBits, sms...).Actual } // Reader SBigIntBE @@ -18130,11 +17999,10 @@ func (d *D) SBigIntBE(nBits int) *big.Int { } // TryFieldScalarSBigIntBE tries to add a field and read nBits bit signed integer in big-endian -func (d *D) TryFieldScalarSBigIntBE(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) (*scalar.BigInt, error) { + s, err := d.TryFieldScalarBigIntFn(name, func(d *D) (scalar.BigInt, error) { v, err := d.tryBigIntEndianSign(nBits, BigEndian, true) - s.Actual = v - return s, err + return scalar.BigInt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18143,7 +18011,7 @@ func (d *D) TryFieldScalarSBigIntBE(name string, nBits int, sms ...scalar.Mapper } // FieldScalarSBigIntBE adds a field and reads nBits bit signed integer in big-endian -func (d *D) FieldScalarSBigIntBE(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) *scalar.BigInt { s, err := d.TryFieldScalarSBigIntBE(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SBigIntBE", Pos: d.Pos()}) @@ -18152,14 +18020,14 @@ func (d *D) FieldScalarSBigIntBE(name string, nBits int, sms ...scalar.Mapper) * } // TryFieldSBigIntBE tries to add a field and read nBits bit signed integer in big-endian -func (d *D) TryFieldSBigIntBE(name string, nBits int, sms ...scalar.Mapper) (*big.Int, error) { +func (d *D) TryFieldSBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) (*big.Int, error) { s, err := d.TryFieldScalarSBigIntBE(name, nBits, sms...) - return s.ActualBigInt(), err + return s.Actual, err } // FieldSBigIntBE adds a field and reads nBits bit signed integer in big-endian -func (d *D) FieldSBigIntBE(name string, nBits int, sms ...scalar.Mapper) *big.Int { - return d.FieldScalarSBigIntBE(name, nBits, sms...).ActualBigInt() +func (d *D) FieldSBigIntBE(name string, nBits int, sms ...scalar.BigIntMapper) *big.Int { + return d.FieldScalarSBigIntBE(name, nBits, sms...).Actual } // Reader F @@ -18177,11 +18045,10 @@ func (d *D) F(nBits int) float64 { } // TryFieldScalarF tries to add a field and read nBit IEEE 754 float in current endian -func (d *D) TryFieldScalarF(name string, nBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF(name string, nBits int, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(nBits, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18190,7 +18057,7 @@ func (d *D) TryFieldScalarF(name string, nBits int, sms ...scalar.Mapper) (*scal } // FieldScalarF adds a field and reads nBit IEEE 754 float in current endian -func (d *D) FieldScalarF(name string, nBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF(name string, nBits int, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF(name, nBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F", Pos: d.Pos()}) @@ -18199,14 +18066,14 @@ func (d *D) FieldScalarF(name string, nBits int, sms ...scalar.Mapper) *scalar.S } // TryFieldF tries to add a field and read nBit IEEE 754 float in current endian -func (d *D) TryFieldF(name string, nBits int, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF(name string, nBits int, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF(name, nBits, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF adds a field and reads nBit IEEE 754 float in current endian -func (d *D) FieldF(name string, nBits int, sms ...scalar.Mapper) float64 { - return d.FieldScalarF(name, nBits, sms...).ActualF() +func (d *D) FieldF(name string, nBits int, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF(name, nBits, sms...).Actual } // Reader FE @@ -18224,11 +18091,10 @@ func (d *D) FE(nBits int, endian Endian) float64 { } // TryFieldScalarFE tries to add a field and read nBit IEEE 754 float in specified endian -func (d *D) TryFieldScalarFE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFE(name string, nBits int, endian Endian, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(nBits, endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18237,7 +18103,7 @@ func (d *D) TryFieldScalarFE(name string, nBits int, endian Endian, sms ...scala } // FieldScalarFE adds a field and reads nBit IEEE 754 float in specified endian -func (d *D) FieldScalarFE(name string, nBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFE(name string, nBits int, endian Endian, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFE(name, nBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FE", Pos: d.Pos()}) @@ -18246,14 +18112,14 @@ func (d *D) FieldScalarFE(name string, nBits int, endian Endian, sms ...scalar.M } // TryFieldFE tries to add a field and read nBit IEEE 754 float in specified endian -func (d *D) TryFieldFE(name string, nBits int, endian Endian, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFE(name string, nBits int, endian Endian, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFE(name, nBits, endian, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFE adds a field and reads nBit IEEE 754 float in specified endian -func (d *D) FieldFE(name string, nBits int, endian Endian, sms ...scalar.Mapper) float64 { - return d.FieldScalarFE(name, nBits, endian, sms...).ActualF() +func (d *D) FieldFE(name string, nBits int, endian Endian, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFE(name, nBits, endian, sms...).Actual } // Reader F16 @@ -18271,11 +18137,10 @@ func (d *D) F16() float64 { } // TryFieldScalarF16 tries to add a field and read 16 bit IEEE 754 float in current endian -func (d *D) TryFieldScalarF16(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF16(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(16, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18284,7 +18149,7 @@ func (d *D) TryFieldScalarF16(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarF16 adds a field and reads 16 bit IEEE 754 float in current endian -func (d *D) FieldScalarF16(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF16(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF16(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F16", Pos: d.Pos()}) @@ -18293,14 +18158,14 @@ func (d *D) FieldScalarF16(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF16 tries to add a field and read 16 bit IEEE 754 float in current endian -func (d *D) TryFieldF16(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF16(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF16(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF16 adds a field and reads 16 bit IEEE 754 float in current endian -func (d *D) FieldF16(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF16(name, sms...).ActualF() +func (d *D) FieldF16(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF16(name, sms...).Actual } // Reader F32 @@ -18318,11 +18183,10 @@ func (d *D) F32() float64 { } // TryFieldScalarF32 tries to add a field and read 32 bit IEEE 754 float in current endian -func (d *D) TryFieldScalarF32(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF32(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(32, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18331,7 +18195,7 @@ func (d *D) TryFieldScalarF32(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarF32 adds a field and reads 32 bit IEEE 754 float in current endian -func (d *D) FieldScalarF32(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF32(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF32(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F32", Pos: d.Pos()}) @@ -18340,14 +18204,14 @@ func (d *D) FieldScalarF32(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF32 tries to add a field and read 32 bit IEEE 754 float in current endian -func (d *D) TryFieldF32(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF32(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF32(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF32 adds a field and reads 32 bit IEEE 754 float in current endian -func (d *D) FieldF32(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF32(name, sms...).ActualF() +func (d *D) FieldF32(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF32(name, sms...).Actual } // Reader F64 @@ -18365,11 +18229,10 @@ func (d *D) F64() float64 { } // TryFieldScalarF64 tries to add a field and read 64 bit IEEE 754 float in current endian -func (d *D) TryFieldScalarF64(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF64(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(64, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18378,7 +18241,7 @@ func (d *D) TryFieldScalarF64(name string, sms ...scalar.Mapper) (*scalar.S, err } // FieldScalarF64 adds a field and reads 64 bit IEEE 754 float in current endian -func (d *D) FieldScalarF64(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF64(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF64(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F64", Pos: d.Pos()}) @@ -18387,14 +18250,14 @@ func (d *D) FieldScalarF64(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF64 tries to add a field and read 64 bit IEEE 754 float in current endian -func (d *D) TryFieldF64(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF64(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF64(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF64 adds a field and reads 64 bit IEEE 754 float in current endian -func (d *D) FieldF64(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF64(name, sms...).ActualF() +func (d *D) FieldF64(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF64(name, sms...).Actual } // Reader F16LE @@ -18412,11 +18275,10 @@ func (d *D) F16LE() float64 { } // TryFieldScalarF16LE tries to add a field and read 16 bit IEEE 754 float in little-endian -func (d *D) TryFieldScalarF16LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF16LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(16, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18425,7 +18287,7 @@ func (d *D) TryFieldScalarF16LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF16LE adds a field and reads 16 bit IEEE 754 float in little-endian -func (d *D) FieldScalarF16LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF16LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF16LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F16LE", Pos: d.Pos()}) @@ -18434,14 +18296,14 @@ func (d *D) FieldScalarF16LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF16LE tries to add a field and read 16 bit IEEE 754 float in little-endian -func (d *D) TryFieldF16LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF16LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF16LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF16LE adds a field and reads 16 bit IEEE 754 float in little-endian -func (d *D) FieldF16LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF16LE(name, sms...).ActualF() +func (d *D) FieldF16LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF16LE(name, sms...).Actual } // Reader F32LE @@ -18459,11 +18321,10 @@ func (d *D) F32LE() float64 { } // TryFieldScalarF32LE tries to add a field and read 32 bit IEEE 754 float in little-endian -func (d *D) TryFieldScalarF32LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF32LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(32, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18472,7 +18333,7 @@ func (d *D) TryFieldScalarF32LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF32LE adds a field and reads 32 bit IEEE 754 float in little-endian -func (d *D) FieldScalarF32LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF32LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF32LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F32LE", Pos: d.Pos()}) @@ -18481,14 +18342,14 @@ func (d *D) FieldScalarF32LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF32LE tries to add a field and read 32 bit IEEE 754 float in little-endian -func (d *D) TryFieldF32LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF32LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF32LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF32LE adds a field and reads 32 bit IEEE 754 float in little-endian -func (d *D) FieldF32LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF32LE(name, sms...).ActualF() +func (d *D) FieldF32LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF32LE(name, sms...).Actual } // Reader F64LE @@ -18506,11 +18367,10 @@ func (d *D) F64LE() float64 { } // TryFieldScalarF64LE tries to add a field and read 64 bit IEEE 754 float in little-endian -func (d *D) TryFieldScalarF64LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF64LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(64, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18519,7 +18379,7 @@ func (d *D) TryFieldScalarF64LE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF64LE adds a field and reads 64 bit IEEE 754 float in little-endian -func (d *D) FieldScalarF64LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF64LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF64LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F64LE", Pos: d.Pos()}) @@ -18528,14 +18388,14 @@ func (d *D) FieldScalarF64LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF64LE tries to add a field and read 64 bit IEEE 754 float in little-endian -func (d *D) TryFieldF64LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF64LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF64LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF64LE adds a field and reads 64 bit IEEE 754 float in little-endian -func (d *D) FieldF64LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF64LE(name, sms...).ActualF() +func (d *D) FieldF64LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF64LE(name, sms...).Actual } // Reader F16BE @@ -18553,11 +18413,10 @@ func (d *D) F16BE() float64 { } // TryFieldScalarF16BE tries to add a field and read 16 bit IEEE 754 float in big-endian -func (d *D) TryFieldScalarF16BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF16BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(16, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18566,7 +18425,7 @@ func (d *D) TryFieldScalarF16BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF16BE adds a field and reads 16 bit IEEE 754 float in big-endian -func (d *D) FieldScalarF16BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF16BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF16BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F16BE", Pos: d.Pos()}) @@ -18575,14 +18434,14 @@ func (d *D) FieldScalarF16BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF16BE tries to add a field and read 16 bit IEEE 754 float in big-endian -func (d *D) TryFieldF16BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF16BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF16BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF16BE adds a field and reads 16 bit IEEE 754 float in big-endian -func (d *D) FieldF16BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF16BE(name, sms...).ActualF() +func (d *D) FieldF16BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF16BE(name, sms...).Actual } // Reader F32BE @@ -18600,11 +18459,10 @@ func (d *D) F32BE() float64 { } // TryFieldScalarF32BE tries to add a field and read 32 bit IEEE 754 float in big-endian -func (d *D) TryFieldScalarF32BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF32BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(32, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18613,7 +18471,7 @@ func (d *D) TryFieldScalarF32BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF32BE adds a field and reads 32 bit IEEE 754 float in big-endian -func (d *D) FieldScalarF32BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF32BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF32BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F32BE", Pos: d.Pos()}) @@ -18622,14 +18480,14 @@ func (d *D) FieldScalarF32BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF32BE tries to add a field and read 32 bit IEEE 754 float in big-endian -func (d *D) TryFieldF32BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF32BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF32BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF32BE adds a field and reads 32 bit IEEE 754 float in big-endian -func (d *D) FieldF32BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF32BE(name, sms...).ActualF() +func (d *D) FieldF32BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF32BE(name, sms...).Actual } // Reader F64BE @@ -18647,11 +18505,10 @@ func (d *D) F64BE() float64 { } // TryFieldScalarF64BE tries to add a field and read 64 bit IEEE 754 float in big-endian -func (d *D) TryFieldScalarF64BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarF64BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFEndian(64, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18660,7 +18517,7 @@ func (d *D) TryFieldScalarF64BE(name string, sms ...scalar.Mapper) (*scalar.S, e } // FieldScalarF64BE adds a field and reads 64 bit IEEE 754 float in big-endian -func (d *D) FieldScalarF64BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarF64BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarF64BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "F64BE", Pos: d.Pos()}) @@ -18669,14 +18526,14 @@ func (d *D) FieldScalarF64BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldF64BE tries to add a field and read 64 bit IEEE 754 float in big-endian -func (d *D) TryFieldF64BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldF64BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarF64BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldF64BE adds a field and reads 64 bit IEEE 754 float in big-endian -func (d *D) FieldF64BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarF64BE(name, sms...).ActualF() +func (d *D) FieldF64BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarF64BE(name, sms...).Actual } // Reader FP @@ -18696,11 +18553,10 @@ func (d *D) FP(nBits int, fBits int) float64 { } // TryFieldScalarFP tries to add a field and read nBits fixed-point number in current endian -func (d *D) TryFieldScalarFP(name string, nBits int, fBits int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP(name string, nBits int, fBits int, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(nBits, fBits, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18709,7 +18565,7 @@ func (d *D) TryFieldScalarFP(name string, nBits int, fBits int, sms ...scalar.Ma } // FieldScalarFP adds a field and reads nBits fixed-point number in current endian -func (d *D) FieldScalarFP(name string, nBits int, fBits int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP(name string, nBits int, fBits int, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP(name, nBits, fBits, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP", Pos: d.Pos()}) @@ -18718,14 +18574,14 @@ func (d *D) FieldScalarFP(name string, nBits int, fBits int, sms ...scalar.Mappe } // TryFieldFP tries to add a field and read nBits fixed-point number in current endian -func (d *D) TryFieldFP(name string, nBits int, fBits int, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP(name string, nBits int, fBits int, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP(name, nBits, fBits, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP adds a field and reads nBits fixed-point number in current endian -func (d *D) FieldFP(name string, nBits int, fBits int, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP(name, nBits, fBits, sms...).ActualF() +func (d *D) FieldFP(name string, nBits int, fBits int, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP(name, nBits, fBits, sms...).Actual } // Reader FPE @@ -18745,11 +18601,10 @@ func (d *D) FPE(nBits int, fBits int, endian Endian) float64 { } // TryFieldScalarFPE tries to add a field and read nBits fixed-point number in specified endian -func (d *D) TryFieldScalarFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(nBits, fBits, endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18758,7 +18613,7 @@ func (d *D) TryFieldScalarFPE(name string, nBits int, fBits int, endian Endian, } // FieldScalarFPE adds a field and reads nBits fixed-point number in specified endian -func (d *D) FieldScalarFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFPE(name, nBits, fBits, endian, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FPE", Pos: d.Pos()}) @@ -18767,14 +18622,14 @@ func (d *D) FieldScalarFPE(name string, nBits int, fBits int, endian Endian, sms } // TryFieldFPE tries to add a field and read nBits fixed-point number in specified endian -func (d *D) TryFieldFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFPE(name, nBits, fBits, endian, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFPE adds a field and reads nBits fixed-point number in specified endian -func (d *D) FieldFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.Mapper) float64 { - return d.FieldScalarFPE(name, nBits, fBits, endian, sms...).ActualF() +func (d *D) FieldFPE(name string, nBits int, fBits int, endian Endian, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFPE(name, nBits, fBits, endian, sms...).Actual } // Reader FP16 @@ -18792,11 +18647,10 @@ func (d *D) FP16() float64 { } // TryFieldScalarFP16 tries to add a field and read 16 bit fixed-point number in current endian -func (d *D) TryFieldScalarFP16(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP16(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(16, 8, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18805,7 +18659,7 @@ func (d *D) TryFieldScalarFP16(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarFP16 adds a field and reads 16 bit fixed-point number in current endian -func (d *D) FieldScalarFP16(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP16(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP16(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP16", Pos: d.Pos()}) @@ -18814,14 +18668,14 @@ func (d *D) FieldScalarFP16(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP16 tries to add a field and read 16 bit fixed-point number in current endian -func (d *D) TryFieldFP16(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP16(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP16(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP16 adds a field and reads 16 bit fixed-point number in current endian -func (d *D) FieldFP16(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP16(name, sms...).ActualF() +func (d *D) FieldFP16(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP16(name, sms...).Actual } // Reader FP32 @@ -18839,11 +18693,10 @@ func (d *D) FP32() float64 { } // TryFieldScalarFP32 tries to add a field and read 32 bit fixed-point number in current endian -func (d *D) TryFieldScalarFP32(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP32(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(32, 16, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18852,7 +18705,7 @@ func (d *D) TryFieldScalarFP32(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarFP32 adds a field and reads 32 bit fixed-point number in current endian -func (d *D) FieldScalarFP32(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP32(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP32(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP32", Pos: d.Pos()}) @@ -18861,14 +18714,14 @@ func (d *D) FieldScalarFP32(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP32 tries to add a field and read 32 bit fixed-point number in current endian -func (d *D) TryFieldFP32(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP32(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP32(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP32 adds a field and reads 32 bit fixed-point number in current endian -func (d *D) FieldFP32(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP32(name, sms...).ActualF() +func (d *D) FieldFP32(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP32(name, sms...).Actual } // Reader FP64 @@ -18886,11 +18739,10 @@ func (d *D) FP64() float64 { } // TryFieldScalarFP64 tries to add a field and read 64 bit fixed-point number in current endian -func (d *D) TryFieldScalarFP64(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP64(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(64, 32, d.Endian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18899,7 +18751,7 @@ func (d *D) TryFieldScalarFP64(name string, sms ...scalar.Mapper) (*scalar.S, er } // FieldScalarFP64 adds a field and reads 64 bit fixed-point number in current endian -func (d *D) FieldScalarFP64(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP64(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP64(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP64", Pos: d.Pos()}) @@ -18908,14 +18760,14 @@ func (d *D) FieldScalarFP64(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP64 tries to add a field and read 64 bit fixed-point number in current endian -func (d *D) TryFieldFP64(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP64(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP64(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP64 adds a field and reads 64 bit fixed-point number in current endian -func (d *D) FieldFP64(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP64(name, sms...).ActualF() +func (d *D) FieldFP64(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP64(name, sms...).Actual } // Reader FP16LE @@ -18933,11 +18785,10 @@ func (d *D) FP16LE() float64 { } // TryFieldScalarFP16LE tries to add a field and read 16 bit fixed-point number in little-endian -func (d *D) TryFieldScalarFP16LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP16LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(16, 8, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18946,7 +18797,7 @@ func (d *D) TryFieldScalarFP16LE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP16LE adds a field and reads 16 bit fixed-point number in little-endian -func (d *D) FieldScalarFP16LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP16LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP16LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP16LE", Pos: d.Pos()}) @@ -18955,14 +18806,14 @@ func (d *D) FieldScalarFP16LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP16LE tries to add a field and read 16 bit fixed-point number in little-endian -func (d *D) TryFieldFP16LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP16LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP16LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP16LE adds a field and reads 16 bit fixed-point number in little-endian -func (d *D) FieldFP16LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP16LE(name, sms...).ActualF() +func (d *D) FieldFP16LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP16LE(name, sms...).Actual } // Reader FP32LE @@ -18980,11 +18831,10 @@ func (d *D) FP32LE() float64 { } // TryFieldScalarFP32LE tries to add a field and read 32 bit fixed-point number in little-endian -func (d *D) TryFieldScalarFP32LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP32LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(32, 16, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -18993,7 +18843,7 @@ func (d *D) TryFieldScalarFP32LE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP32LE adds a field and reads 32 bit fixed-point number in little-endian -func (d *D) FieldScalarFP32LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP32LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP32LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP32LE", Pos: d.Pos()}) @@ -19002,14 +18852,14 @@ func (d *D) FieldScalarFP32LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP32LE tries to add a field and read 32 bit fixed-point number in little-endian -func (d *D) TryFieldFP32LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP32LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP32LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP32LE adds a field and reads 32 bit fixed-point number in little-endian -func (d *D) FieldFP32LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP32LE(name, sms...).ActualF() +func (d *D) FieldFP32LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP32LE(name, sms...).Actual } // Reader FP64LE @@ -19027,11 +18877,10 @@ func (d *D) FP64LE() float64 { } // TryFieldScalarFP64LE tries to add a field and read 64 bit fixed-point number in little-endian -func (d *D) TryFieldScalarFP64LE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP64LE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(64, 32, LittleEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19040,7 +18889,7 @@ func (d *D) TryFieldScalarFP64LE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP64LE adds a field and reads 64 bit fixed-point number in little-endian -func (d *D) FieldScalarFP64LE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP64LE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP64LE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP64LE", Pos: d.Pos()}) @@ -19049,14 +18898,14 @@ func (d *D) FieldScalarFP64LE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP64LE tries to add a field and read 64 bit fixed-point number in little-endian -func (d *D) TryFieldFP64LE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP64LE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP64LE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP64LE adds a field and reads 64 bit fixed-point number in little-endian -func (d *D) FieldFP64LE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP64LE(name, sms...).ActualF() +func (d *D) FieldFP64LE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP64LE(name, sms...).Actual } // Reader FP16BE @@ -19074,11 +18923,10 @@ func (d *D) FP16BE() float64 { } // TryFieldScalarFP16BE tries to add a field and read 16 bit fixed-point number in big-endian -func (d *D) TryFieldScalarFP16BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP16BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(16, 8, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19087,7 +18935,7 @@ func (d *D) TryFieldScalarFP16BE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP16BE adds a field and reads 16 bit fixed-point number in big-endian -func (d *D) FieldScalarFP16BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP16BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP16BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP16BE", Pos: d.Pos()}) @@ -19096,14 +18944,14 @@ func (d *D) FieldScalarFP16BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP16BE tries to add a field and read 16 bit fixed-point number in big-endian -func (d *D) TryFieldFP16BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP16BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP16BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP16BE adds a field and reads 16 bit fixed-point number in big-endian -func (d *D) FieldFP16BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP16BE(name, sms...).ActualF() +func (d *D) FieldFP16BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP16BE(name, sms...).Actual } // Reader FP32BE @@ -19121,11 +18969,10 @@ func (d *D) FP32BE() float64 { } // TryFieldScalarFP32BE tries to add a field and read 32 bit fixed-point number in big-endian -func (d *D) TryFieldScalarFP32BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP32BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(32, 16, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19134,7 +18981,7 @@ func (d *D) TryFieldScalarFP32BE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP32BE adds a field and reads 32 bit fixed-point number in big-endian -func (d *D) FieldScalarFP32BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP32BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP32BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP32BE", Pos: d.Pos()}) @@ -19143,14 +18990,14 @@ func (d *D) FieldScalarFP32BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP32BE tries to add a field and read 32 bit fixed-point number in big-endian -func (d *D) TryFieldFP32BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP32BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP32BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP32BE adds a field and reads 32 bit fixed-point number in big-endian -func (d *D) FieldFP32BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP32BE(name, sms...).ActualF() +func (d *D) FieldFP32BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP32BE(name, sms...).Actual } // Reader FP64BE @@ -19168,11 +19015,10 @@ func (d *D) FP64BE() float64 { } // TryFieldScalarFP64BE tries to add a field and read 64 bit fixed-point number in big-endian -func (d *D) TryFieldScalarFP64BE(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarFP64BE(name string, sms ...scalar.FltMapper) (*scalar.Flt, error) { + s, err := d.TryFieldScalarFltFn(name, func(d *D) (scalar.Flt, error) { v, err := d.tryFPEndian(64, 32, BigEndian) - s.Actual = v - return s, err + return scalar.Flt{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19181,7 +19027,7 @@ func (d *D) TryFieldScalarFP64BE(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarFP64BE adds a field and reads 64 bit fixed-point number in big-endian -func (d *D) FieldScalarFP64BE(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarFP64BE(name string, sms ...scalar.FltMapper) *scalar.Flt { s, err := d.TryFieldScalarFP64BE(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "FP64BE", Pos: d.Pos()}) @@ -19190,14 +19036,14 @@ func (d *D) FieldScalarFP64BE(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldFP64BE tries to add a field and read 64 bit fixed-point number in big-endian -func (d *D) TryFieldFP64BE(name string, sms ...scalar.Mapper) (float64, error) { +func (d *D) TryFieldFP64BE(name string, sms ...scalar.FltMapper) (float64, error) { s, err := d.TryFieldScalarFP64BE(name, sms...) - return s.ActualF(), err + return s.Actual, err } // FieldFP64BE adds a field and reads 64 bit fixed-point number in big-endian -func (d *D) FieldFP64BE(name string, sms ...scalar.Mapper) float64 { - return d.FieldScalarFP64BE(name, sms...).ActualF() +func (d *D) FieldFP64BE(name string, sms ...scalar.FltMapper) float64 { + return d.FieldScalarFP64BE(name, sms...).Actual } // Reader Unary @@ -19215,11 +19061,10 @@ func (d *D) Unary(ov uint64) uint64 { } // TryFieldScalarUnary tries to add a field and read unary integer using ov as "one" value -func (d *D) TryFieldScalarUnary(name string, ov uint64, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUnary(name string, ov uint64, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryUnary(ov) - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19228,7 +19073,7 @@ func (d *D) TryFieldScalarUnary(name string, ov uint64, sms ...scalar.Mapper) (* } // FieldScalarUnary adds a field and reads unary integer using ov as "one" value -func (d *D) FieldScalarUnary(name string, ov uint64, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUnary(name string, ov uint64, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarUnary(name, ov, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Unary", Pos: d.Pos()}) @@ -19237,14 +19082,14 @@ func (d *D) FieldScalarUnary(name string, ov uint64, sms ...scalar.Mapper) *scal } // TryFieldUnary tries to add a field and read unary integer using ov as "one" value -func (d *D) TryFieldUnary(name string, ov uint64, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldUnary(name string, ov uint64, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarUnary(name, ov, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldUnary adds a field and reads unary integer using ov as "one" value -func (d *D) FieldUnary(name string, ov uint64, sms ...scalar.Mapper) uint64 { - return d.FieldScalarUnary(name, ov, sms...).ActualU() +func (d *D) FieldUnary(name string, ov uint64, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarUnary(name, ov, sms...).Actual } // Reader ULEB128 @@ -19262,11 +19107,10 @@ func (d *D) ULEB128() uint64 { } // TryFieldScalarULEB128 tries to add a field and read unsigned LEB128 integer -func (d *D) TryFieldScalarULEB128(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarULEB128(name string, sms ...scalar.UintMapper) (*scalar.Uint, error) { + s, err := d.TryFieldScalarUintFn(name, func(d *D) (scalar.Uint, error) { v, err := d.tryULEB128() - s.Actual = v - return s, err + return scalar.Uint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19275,7 +19119,7 @@ func (d *D) TryFieldScalarULEB128(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarULEB128 adds a field and reads unsigned LEB128 integer -func (d *D) FieldScalarULEB128(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarULEB128(name string, sms ...scalar.UintMapper) *scalar.Uint { s, err := d.TryFieldScalarULEB128(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "ULEB128", Pos: d.Pos()}) @@ -19284,14 +19128,14 @@ func (d *D) FieldScalarULEB128(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldULEB128 tries to add a field and read unsigned LEB128 integer -func (d *D) TryFieldULEB128(name string, sms ...scalar.Mapper) (uint64, error) { +func (d *D) TryFieldULEB128(name string, sms ...scalar.UintMapper) (uint64, error) { s, err := d.TryFieldScalarULEB128(name, sms...) - return s.ActualU(), err + return s.Actual, err } // FieldULEB128 adds a field and reads unsigned LEB128 integer -func (d *D) FieldULEB128(name string, sms ...scalar.Mapper) uint64 { - return d.FieldScalarULEB128(name, sms...).ActualU() +func (d *D) FieldULEB128(name string, sms ...scalar.UintMapper) uint64 { + return d.FieldScalarULEB128(name, sms...).Actual } // Reader SLEB128 @@ -19309,11 +19153,10 @@ func (d *D) SLEB128() int64 { } // TryFieldScalarSLEB128 tries to add a field and read signed LEB128 integer -func (d *D) TryFieldScalarSLEB128(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarSLEB128(name string, sms ...scalar.SintMapper) (*scalar.Sint, error) { + s, err := d.TryFieldScalarSintFn(name, func(d *D) (scalar.Sint, error) { v, err := d.trySLEB128() - s.Actual = v - return s, err + return scalar.Sint{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19322,7 +19165,7 @@ func (d *D) TryFieldScalarSLEB128(name string, sms ...scalar.Mapper) (*scalar.S, } // FieldScalarSLEB128 adds a field and reads signed LEB128 integer -func (d *D) FieldScalarSLEB128(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarSLEB128(name string, sms ...scalar.SintMapper) *scalar.Sint { s, err := d.TryFieldScalarSLEB128(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "SLEB128", Pos: d.Pos()}) @@ -19331,14 +19174,14 @@ func (d *D) FieldScalarSLEB128(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldSLEB128 tries to add a field and read signed LEB128 integer -func (d *D) TryFieldSLEB128(name string, sms ...scalar.Mapper) (int64, error) { +func (d *D) TryFieldSLEB128(name string, sms ...scalar.SintMapper) (int64, error) { s, err := d.TryFieldScalarSLEB128(name, sms...) - return s.ActualS(), err + return s.Actual, err } // FieldSLEB128 adds a field and reads signed LEB128 integer -func (d *D) FieldSLEB128(name string, sms ...scalar.Mapper) int64 { - return d.FieldScalarSLEB128(name, sms...).ActualS() +func (d *D) FieldSLEB128(name string, sms ...scalar.SintMapper) int64 { + return d.FieldScalarSLEB128(name, sms...).Actual } // Reader UTF8 @@ -19356,11 +19199,10 @@ func (d *D) UTF8(nBytes int) string { } // TryFieldScalarUTF8 tries to add a field and read nBytes bytes UTF8 string -func (d *D) TryFieldScalarUTF8(name string, nBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF8(name string, nBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryText(nBytes, UTF8BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19369,7 +19211,7 @@ func (d *D) TryFieldScalarUTF8(name string, nBytes int, sms ...scalar.Mapper) (* } // FieldScalarUTF8 adds a field and reads nBytes bytes UTF8 string -func (d *D) FieldScalarUTF8(name string, nBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF8(name string, nBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF8(name, nBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF8", Pos: d.Pos()}) @@ -19378,14 +19220,14 @@ func (d *D) FieldScalarUTF8(name string, nBytes int, sms ...scalar.Mapper) *scal } // TryFieldUTF8 tries to add a field and read nBytes bytes UTF8 string -func (d *D) TryFieldUTF8(name string, nBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF8(name string, nBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF8(name, nBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF8 adds a field and reads nBytes bytes UTF8 string -func (d *D) FieldUTF8(name string, nBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF8(name, nBytes, sms...).ActualStr() +func (d *D) FieldUTF8(name string, nBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF8(name, nBytes, sms...).Actual } // Reader UTF16 @@ -19403,11 +19245,10 @@ func (d *D) UTF16(nBytes int) string { } // TryFieldScalarUTF16 tries to add a field and read nBytes bytes UTF16 string, default big-endian and accepts BOM -func (d *D) TryFieldScalarUTF16(name string, nBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16(name string, nBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryText(nBytes, UTF16BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19416,7 +19257,7 @@ func (d *D) TryFieldScalarUTF16(name string, nBytes int, sms ...scalar.Mapper) ( } // FieldScalarUTF16 adds a field and reads nBytes bytes UTF16 string, default big-endian and accepts BOM -func (d *D) FieldScalarUTF16(name string, nBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16(name string, nBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16(name, nBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16", Pos: d.Pos()}) @@ -19425,14 +19266,14 @@ func (d *D) FieldScalarUTF16(name string, nBytes int, sms ...scalar.Mapper) *sca } // TryFieldUTF16 tries to add a field and read nBytes bytes UTF16 string, default big-endian and accepts BOM -func (d *D) TryFieldUTF16(name string, nBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16(name string, nBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16(name, nBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16 adds a field and reads nBytes bytes UTF16 string, default big-endian and accepts BOM -func (d *D) FieldUTF16(name string, nBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16(name, nBytes, sms...).ActualStr() +func (d *D) FieldUTF16(name string, nBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16(name, nBytes, sms...).Actual } // Reader UTF16LE @@ -19450,11 +19291,10 @@ func (d *D) UTF16LE(nBytes int) string { } // TryFieldScalarUTF16LE tries to add a field and read nBytes bytes UTF16 little-endian string -func (d *D) TryFieldScalarUTF16LE(name string, nBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16LE(name string, nBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryText(nBytes, UTF16LE) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19463,7 +19303,7 @@ func (d *D) TryFieldScalarUTF16LE(name string, nBytes int, sms ...scalar.Mapper) } // FieldScalarUTF16LE adds a field and reads nBytes bytes UTF16 little-endian string -func (d *D) FieldScalarUTF16LE(name string, nBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16LE(name string, nBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16LE(name, nBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16LE", Pos: d.Pos()}) @@ -19472,14 +19312,14 @@ func (d *D) FieldScalarUTF16LE(name string, nBytes int, sms ...scalar.Mapper) *s } // TryFieldUTF16LE tries to add a field and read nBytes bytes UTF16 little-endian string -func (d *D) TryFieldUTF16LE(name string, nBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16LE(name string, nBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16LE(name, nBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16LE adds a field and reads nBytes bytes UTF16 little-endian string -func (d *D) FieldUTF16LE(name string, nBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16LE(name, nBytes, sms...).ActualStr() +func (d *D) FieldUTF16LE(name string, nBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16LE(name, nBytes, sms...).Actual } // Reader UTF16BE @@ -19497,11 +19337,10 @@ func (d *D) UTF16BE(nBytes int) string { } // TryFieldScalarUTF16BE tries to add a field and read nBytes bytes UTF16 big-endian string -func (d *D) TryFieldScalarUTF16BE(name string, nBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16BE(name string, nBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryText(nBytes, UTF16BE) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19510,7 +19349,7 @@ func (d *D) TryFieldScalarUTF16BE(name string, nBytes int, sms ...scalar.Mapper) } // FieldScalarUTF16BE adds a field and reads nBytes bytes UTF16 big-endian string -func (d *D) FieldScalarUTF16BE(name string, nBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16BE(name string, nBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16BE(name, nBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16BE", Pos: d.Pos()}) @@ -19519,14 +19358,14 @@ func (d *D) FieldScalarUTF16BE(name string, nBytes int, sms ...scalar.Mapper) *s } // TryFieldUTF16BE tries to add a field and read nBytes bytes UTF16 big-endian string -func (d *D) TryFieldUTF16BE(name string, nBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16BE(name string, nBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16BE(name, nBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16BE adds a field and reads nBytes bytes UTF16 big-endian string -func (d *D) FieldUTF16BE(name string, nBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16BE(name, nBytes, sms...).ActualStr() +func (d *D) FieldUTF16BE(name string, nBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16BE(name, nBytes, sms...).Actual } // Reader UTF8ShortString @@ -19544,11 +19383,10 @@ func (d *D) UTF8ShortString() string { } // TryFieldScalarUTF8ShortString tries to add a field and read one byte length fixed UTF8 string -func (d *D) TryFieldScalarUTF8ShortString(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF8ShortString(name string, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextLenPrefixed(8, -1, UTF8BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19557,7 +19395,7 @@ func (d *D) TryFieldScalarUTF8ShortString(name string, sms ...scalar.Mapper) (*s } // FieldScalarUTF8ShortString adds a field and reads one byte length fixed UTF8 string -func (d *D) FieldScalarUTF8ShortString(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF8ShortString(name string, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF8ShortString(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF8ShortString", Pos: d.Pos()}) @@ -19566,14 +19404,14 @@ func (d *D) FieldScalarUTF8ShortString(name string, sms ...scalar.Mapper) *scala } // TryFieldUTF8ShortString tries to add a field and read one byte length fixed UTF8 string -func (d *D) TryFieldUTF8ShortString(name string, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF8ShortString(name string, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF8ShortString(name, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF8ShortString adds a field and reads one byte length fixed UTF8 string -func (d *D) FieldUTF8ShortString(name string, sms ...scalar.Mapper) string { - return d.FieldScalarUTF8ShortString(name, sms...).ActualStr() +func (d *D) FieldUTF8ShortString(name string, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF8ShortString(name, sms...).Actual } // Reader UTF8ShortStringFixedLen @@ -19593,11 +19431,10 @@ func (d *D) UTF8ShortStringFixedLen(fixedBytes int) string { } // TryFieldScalarUTF8ShortStringFixedLen tries to add a field and read fixedBytes bytes long one byte length prefixed UTF8 string -func (d *D) TryFieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextLenPrefixed(8, fixedBytes, UTF8BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19606,7 +19443,7 @@ func (d *D) TryFieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, s } // FieldScalarUTF8ShortStringFixedLen adds a field and reads fixedBytes bytes long one byte length prefixed UTF8 string -func (d *D) FieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF8ShortStringFixedLen(name, fixedBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF8ShortStringFixedLen", Pos: d.Pos()}) @@ -19615,14 +19452,14 @@ func (d *D) FieldScalarUTF8ShortStringFixedLen(name string, fixedBytes int, sms } // TryFieldUTF8ShortStringFixedLen tries to add a field and read fixedBytes bytes long one byte length prefixed UTF8 string -func (d *D) TryFieldUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF8ShortStringFixedLen(name, fixedBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF8ShortStringFixedLen adds a field and reads fixedBytes bytes long one byte length prefixed UTF8 string -func (d *D) FieldUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF8ShortStringFixedLen(name, fixedBytes, sms...).ActualStr() +func (d *D) FieldUTF8ShortStringFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF8ShortStringFixedLen(name, fixedBytes, sms...).Actual } // Reader UTF8Null @@ -19640,11 +19477,10 @@ func (d *D) UTF8Null() string { } // TryFieldScalarUTF8Null tries to add a field and read null terminated UTF8 string -func (d *D) TryFieldScalarUTF8Null(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF8Null(name string, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextNull(1, UTF8BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19653,7 +19489,7 @@ func (d *D) TryFieldScalarUTF8Null(name string, sms ...scalar.Mapper) (*scalar.S } // FieldScalarUTF8Null adds a field and reads null terminated UTF8 string -func (d *D) FieldScalarUTF8Null(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF8Null(name string, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF8Null(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF8Null", Pos: d.Pos()}) @@ -19662,14 +19498,14 @@ func (d *D) FieldScalarUTF8Null(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldUTF8Null tries to add a field and read null terminated UTF8 string -func (d *D) TryFieldUTF8Null(name string, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF8Null(name string, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF8Null(name, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF8Null adds a field and reads null terminated UTF8 string -func (d *D) FieldUTF8Null(name string, sms ...scalar.Mapper) string { - return d.FieldScalarUTF8Null(name, sms...).ActualStr() +func (d *D) FieldUTF8Null(name string, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF8Null(name, sms...).Actual } // Reader UTF16Null @@ -19687,11 +19523,10 @@ func (d *D) UTF16Null() string { } // TryFieldScalarUTF16Null tries to add a field and read null terminated UTF16 string, default big-endian and accepts BOM -func (d *D) TryFieldScalarUTF16Null(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16Null(name string, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextNull(2, UTF16BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19700,7 +19535,7 @@ func (d *D) TryFieldScalarUTF16Null(name string, sms ...scalar.Mapper) (*scalar. } // FieldScalarUTF16Null adds a field and reads null terminated UTF16 string, default big-endian and accepts BOM -func (d *D) FieldScalarUTF16Null(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16Null(name string, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16Null(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16Null", Pos: d.Pos()}) @@ -19709,14 +19544,14 @@ func (d *D) FieldScalarUTF16Null(name string, sms ...scalar.Mapper) *scalar.S { } // TryFieldUTF16Null tries to add a field and read null terminated UTF16 string, default big-endian and accepts BOM -func (d *D) TryFieldUTF16Null(name string, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16Null(name string, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16Null(name, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16Null adds a field and reads null terminated UTF16 string, default big-endian and accepts BOM -func (d *D) FieldUTF16Null(name string, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16Null(name, sms...).ActualStr() +func (d *D) FieldUTF16Null(name string, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16Null(name, sms...).Actual } // Reader UTF16LENull @@ -19734,11 +19569,10 @@ func (d *D) UTF16LENull() string { } // TryFieldScalarUTF16LENull tries to add a field and read null terminated UTF16LE string -func (d *D) TryFieldScalarUTF16LENull(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16LENull(name string, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextNull(2, UTF16LE) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19747,7 +19581,7 @@ func (d *D) TryFieldScalarUTF16LENull(name string, sms ...scalar.Mapper) (*scala } // FieldScalarUTF16LENull adds a field and reads null terminated UTF16LE string -func (d *D) FieldScalarUTF16LENull(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16LENull(name string, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16LENull(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16LENull", Pos: d.Pos()}) @@ -19756,14 +19590,14 @@ func (d *D) FieldScalarUTF16LENull(name string, sms ...scalar.Mapper) *scalar.S } // TryFieldUTF16LENull tries to add a field and read null terminated UTF16LE string -func (d *D) TryFieldUTF16LENull(name string, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16LENull(name string, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16LENull(name, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16LENull adds a field and reads null terminated UTF16LE string -func (d *D) FieldUTF16LENull(name string, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16LENull(name, sms...).ActualStr() +func (d *D) FieldUTF16LENull(name string, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16LENull(name, sms...).Actual } // Reader UTF16BENull @@ -19781,11 +19615,10 @@ func (d *D) UTF16BENull() string { } // TryFieldScalarUTF16BENull tries to add a field and read null terminated UTF16BE string -func (d *D) TryFieldScalarUTF16BENull(name string, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF16BENull(name string, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextNull(2, UTF16BE) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19794,7 +19627,7 @@ func (d *D) TryFieldScalarUTF16BENull(name string, sms ...scalar.Mapper) (*scala } // FieldScalarUTF16BENull adds a field and reads null terminated UTF16BE string -func (d *D) FieldScalarUTF16BENull(name string, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF16BENull(name string, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF16BENull(name, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF16BENull", Pos: d.Pos()}) @@ -19803,14 +19636,14 @@ func (d *D) FieldScalarUTF16BENull(name string, sms ...scalar.Mapper) *scalar.S } // TryFieldUTF16BENull tries to add a field and read null terminated UTF16BE string -func (d *D) TryFieldUTF16BENull(name string, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF16BENull(name string, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF16BENull(name, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF16BENull adds a field and reads null terminated UTF16BE string -func (d *D) FieldUTF16BENull(name string, sms ...scalar.Mapper) string { - return d.FieldScalarUTF16BENull(name, sms...).ActualStr() +func (d *D) FieldUTF16BENull(name string, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF16BENull(name, sms...).Actual } // Reader UTF8NullFixedLen @@ -19830,11 +19663,10 @@ func (d *D) UTF8NullFixedLen(fixedBytes int) string { } // TryFieldScalarUTF8NullFixedLen tries to add a field and read fixedBytes bytes long null terminated UTF8 string -func (d *D) TryFieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryTextNullLen(fixedBytes, UTF8BOM) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19843,7 +19675,7 @@ func (d *D) TryFieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...s } // FieldScalarUTF8NullFixedLen adds a field and reads fixedBytes bytes long null terminated UTF8 string -func (d *D) FieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarUTF8NullFixedLen(name, fixedBytes, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "UTF8NullFixedLen", Pos: d.Pos()}) @@ -19852,14 +19684,14 @@ func (d *D) FieldScalarUTF8NullFixedLen(name string, fixedBytes int, sms ...scal } // TryFieldUTF8NullFixedLen tries to add a field and read fixedBytes bytes long null terminated UTF8 string -func (d *D) TryFieldUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarUTF8NullFixedLen(name, fixedBytes, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldUTF8NullFixedLen adds a field and reads fixedBytes bytes long null terminated UTF8 string -func (d *D) FieldUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.Mapper) string { - return d.FieldScalarUTF8NullFixedLen(name, fixedBytes, sms...).ActualStr() +func (d *D) FieldUTF8NullFixedLen(name string, fixedBytes int, sms ...scalar.StrMapper) string { + return d.FieldScalarUTF8NullFixedLen(name, fixedBytes, sms...).Actual } // Reader Str @@ -19877,11 +19709,10 @@ func (d *D) Str(nBytes int, e encoding.Encoding) string { } // TryFieldScalarStr tries to add a field and read nBytes bytes using encoding e -func (d *D) TryFieldScalarStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { +func (d *D) TryFieldScalarStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.StrMapper) (*scalar.Str, error) { + s, err := d.TryFieldScalarStrFn(name, func(d *D) (scalar.Str, error) { v, err := d.tryText(nBytes, e) - s.Actual = v - return s, err + return scalar.Str{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -19890,7 +19721,7 @@ func (d *D) TryFieldScalarStr(name string, nBytes int, e encoding.Encoding, sms } // FieldScalarStr adds a field and reads nBytes bytes using encoding e -func (d *D) FieldScalarStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.Mapper) *scalar.S { +func (d *D) FieldScalarStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.StrMapper) *scalar.Str { s, err := d.TryFieldScalarStr(name, nBytes, e, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "Str", Pos: d.Pos()}) @@ -19899,12 +19730,12 @@ func (d *D) FieldScalarStr(name string, nBytes int, e encoding.Encoding, sms ... } // TryFieldStr tries to add a field and read nBytes bytes using encoding e -func (d *D) TryFieldStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.Mapper) (string, error) { +func (d *D) TryFieldStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.StrMapper) (string, error) { s, err := d.TryFieldScalarStr(name, nBytes, e, sms...) - return s.ActualStr(), err + return s.Actual, err } // FieldStr adds a field and reads nBytes bytes using encoding e -func (d *D) FieldStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.Mapper) string { - return d.FieldScalarStr(name, nBytes, e, sms...).ActualStr() +func (d *D) FieldStr(name string, nBytes int, e encoding.Encoding, sms ...scalar.StrMapper) string { + return d.FieldScalarStr(name, nBytes, e, sms...).Actual } diff --git a/pkg/decode/decode_gen.go.tmpl b/pkg/decode/decode_gen.go.tmpl index fa515d29..3ab3da52 100644 --- a/pkg/decode/decode_gen.go.tmpl +++ b/pkg/decode/decode_gen.go.tmpl @@ -14,60 +14,82 @@ import ( // Type {{$name}} // TryField{{$name}}ScalarFn tries to add a field, calls scalar functions and returns actual value as a {{$name}} - func (d *D) TryField{{$name}}ScalarFn(name string, fn func(d *D) (scalar.S, error), sms ...scalar.Mapper) ({{$t.go_type}}, error) { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d) }, sms...) + func (d *D) TryField{{$name}}ScalarFn(name string, fn func(d *D) (scalar.{{$name}}, error), sms ...scalar.{{$name}}Mapper) ({{$t.go_type}}, error) { + v, err := d.TryFieldScalar{{$name}}Fn(name, func(d *D) (scalar.{{$name}}, error) { return fn(d) }, sms...) if err != nil { return {{$t.zero}}, err } - return v.Actual{{$name}}(), err + return v.Actual, err } // Field{{$name}}ScalarFn adds a field, calls scalar functions and returns actual value as a {{$name}} - func (d *D) Field{{$name}}ScalarFn(name string, fn func(d *D) scalar.S, sms ...scalar.Mapper) {{$t.go_type}} { - v, err := d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { return fn(d), nil }, sms...) + func (d *D) Field{{$name}}ScalarFn(name string, fn func(d *D) scalar.{{$name}}, sms ...scalar.{{$name}}Mapper) {{$t.go_type}} { + v, err := d.TryFieldScalar{{$name}}Fn(name, func(d *D) (scalar.{{$name}}, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "{{$name}}", Pos: d.Pos()}) } - return v.Actual{{$name}}() + return v.Actual } // Field{{$name}}Fn adds a field, calls {{$t.go_type}} decode function and returns actual value as a {{$name}} - func (d *D) Field{{$name}}Fn(name string, fn func(d *D) {{$t.go_type}}, sms ...scalar.Mapper) {{$t.go_type}} { - return d.Field{{$name}}ScalarFn(name, func(d *D) scalar.S { return scalar.S{Actual: fn(d) } }, sms...) + func (d *D) Field{{$name}}Fn(name string, fn func(d *D) {{$t.go_type}}, sms ...scalar.{{$name}}Mapper) {{$t.go_type}} { + return d.Field{{$name}}ScalarFn(name, func(d *D) scalar.{{$name}} { return scalar.{{$name}}{Actual: fn(d) } }, sms...) } // TryField{{$name}}Fn tries to add a field, calls {{$t.go_type}} decode function and returns actual value as a {{$name}} - func (d *D) TryField{{$name}}Fn(name string, fn func(d *D) ({{$t.go_type}}, error), sms ...scalar.Mapper) ({{$t.go_type}}, error) { - return d.TryField{{$name}}ScalarFn(name, func(d *D) (scalar.S, error) { + func (d *D) TryField{{$name}}Fn(name string, fn func(d *D) ({{$t.go_type}}, error), sms ...scalar.{{$name}}Mapper) ({{$t.go_type}}, error) { + return d.TryField{{$name}}ScalarFn(name, func(d *D) (scalar.{{$name}}, error) { v, err := fn(d) - return scalar.S{Actual: v}, err - }, sms...) - } - - // TryFieldScalar{{$name}}Fn tries to add a field, calls {{$t.go_type}} decode function and returns scalar - func (d *D) TryFieldScalar{{$name}}Fn(name string, fn func(d *D) ({{$t.go_type}}, error), sms ...scalar.Mapper) (*scalar.S, error) { - return d.TryFieldScalarFn(name, func(_ scalar.S) (scalar.S, error) { - v, err := fn(d) - return scalar.S{Actual: v}, err + return scalar.{{$name}}{Actual: v}, err }, sms...) } // FieldScalar{{$name}}Fn tries to add a field, calls {{$t.go_type}} decode function and returns scalar - func (d *D) FieldScalar{{$name}}Fn(name string, fn func(d *D) {{$t.go_type}}, sms ...scalar.Mapper) *scalar.S { - v, err := d.TryFieldScalar{{$name}}Fn(name, func(d *D) ({{$t.go_type}}, error) { return fn(d), nil }, sms...) + func (d *D) FieldScalar{{$name}}Fn(name string, fn func(d *D) scalar.{{$name}}, sms ...scalar.{{$name}}Mapper) *scalar.{{$name}} { + v, err := d.TryFieldScalar{{$name}}Fn(name, func(d *D) (scalar.{{$name}}, error) { return fn(d), nil }, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "{{$name}}", Pos: d.Pos()}) } return v } + + func (d *D) FieldValue{{$name}}(name string, a {{$t.go_type}}, sms ...scalar.{{$name}}Mapper) { + d.FieldScalar{{$name}}Fn(name, func(_ *D) scalar.{{$name}} { return scalar.{{$name}}{Actual: a}}, sms...) + } + + // TryFieldScalar{{$name}}Fn tries to add a field, calls {{$t.go_type}} decode function and returns scalar + func (d *D) TryFieldScalar{{$name}}Fn(name string, fn func(d *D) (scalar.{{$name}}, error), sms ...scalar.{{$name}}Mapper) (*scalar.{{$name}}, error) { + v, err := d.TryFieldValue(name, func() (*Value, error) { + s, err := fn(d) + if err != nil { + return &Value{V: &s}, err + } + for _, sm := range sms { + s, err = sm.Map{{$name}}(s) + if err != nil { + return &Value{V: &s}, err + } + } + return &Value{V: &s}, nil + }) + if err != nil { + return &scalar.{{$name}}{}, err + } + sr, ok := v.V.(*scalar.{{$name}}) + if !ok { + panic("not a scalar value") + } + return sr, nil + } + {{end}} {{- range $name, $t := $.types }} {{- if $t.compare}} // Require/Assert/Validate {{$name}} - func require{{$name}}(name string, s scalar.S, desc bool, fail bool, vs ...{{$t.go_type}}) (scalar.S, error) { - a := s.Actual{{$name}}() + func require{{$name}}(name string, s scalar.{{$name}}, desc bool, fail bool, vs ...{{$t.go_type}}) (scalar.{{$name}}, error) { + a := s.Actual for _, b := range vs { if {{$t.compare}} { if desc { @@ -85,26 +107,26 @@ import ( return s, nil } - // Require{{$name}} that actual value is one of given {{$t.go_type}} values - func (d *D) Require{{$name}}(vs ...{{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return require{{$name}}("require", s, false, true, vs...) }) + // {{$name}}Require that actual value is one of given {{$t.go_type}} values + func (d *D) {{$name}}Require(vs ...{{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return require{{$name}}("require", s, false, true, vs...) }) } - // Assert{{$name}} validate and asserts that actual value is one of given {{$t.go_type}} values - func (d *D) Assert{{$name}}(vs ...{{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return require{{$name}}("assert", s, true, !d.Options.Force, vs...) }) + // {{$name}}Assert validate and asserts that actual value is one of given {{$t.go_type}} values + func (d *D) {{$name}}Assert(vs ...{{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return require{{$name}}("assert", s, true, !d.Options.Force, vs...) }) } - // Validate{{$name}} validates that actual value is one of given {{$t.go_type}} values - func (d *D) Validate{{$name}}(vs ...{{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return require{{$name}}("validate", s, true, false, vs...) }) + // {{$name}}Validate validates that actual value is one of given {{$t.go_type}} values + func (d *D) {{$name}}Validate(vs ...{{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return require{{$name}}("validate", s, true, false, vs...) }) } {{- end}} {{- if $t.range}} - // Require/Assert/ValidatRange {{$name}} + // Require/Assert/ValidateRange {{$name}} - func requireRange{{$name}}(name string, s scalar.S, desc bool, fail bool, start, end {{$t.go_type}}) (scalar.S, error) { - a := s.Actual{{$name}}() + func requireRange{{$name}}(name string, s scalar.{{$name}}, desc bool, fail bool, start, end {{$t.go_type}}) (scalar.{{$name}}, error) { + a := s.Actual if {{$t.range}} { if desc { s.Description = "valid" @@ -120,19 +142,19 @@ import ( return s, nil } - // Require{{$name}}Range require that actual value is in range - func (d *D) Require{{$name}}Range(start, end {{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRange{{$name}}("require", s, false, true, start, end) }) + // {{$name}}RequireRange require that actual value is in range + func (d *D) {{$name}}RequireRange(start, end {{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return requireRange{{$name}}("require", s, false, true, start, end) }) } - // Assert{{$name}}Range asserts that actual value is in range - func (d *D) Assert{{$name}}Range(start, end {{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRange{{$name}}("assert", s, true, !d.Options.Force, start, end) }) + // {{$name}}AssertRange asserts that actual value is in range + func (d *D) {{$name}}AssertRange(start, end {{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return requireRange{{$name}}("assert", s, true, !d.Options.Force, start, end) }) } - // Validate{{$name}}Range validates that actual value is in range - func (d *D) Validate{{$name}}Range(start, end {{$t.go_type}}) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { return requireRange{{$name}}("validate", s, true, false, start, end) }) + // {{$name}}ValidateRange validates that actual value is in range + func (d *D) {{$name}}ValidateRange(start, end {{$t.go_type}}) scalar.{{$name}}Mapper { + return scalar.{{$name}}Fn(func(s scalar.{{$name}}) (scalar.{{$name}}, error) { return requireRange{{$name}}("validate", s, true, false, start, end) }) } {{- end}} {{- end}} @@ -165,11 +187,10 @@ import ( } // TryFieldScalar{{$r.name}}{{replace $v.name "$n" $n}} tries to add a field and read {{replace $v.doc "$n" $n}} - func (d *D) TryFieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.Mapper) (*scalar.S, error) { - s, err := d.TryFieldScalarFn(name, func(s scalar.S) (scalar.S, error) { + func (d *D) TryFieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.{{$r.type}}Mapper) (*scalar.{{$r.type}}, error) { + s, err := d.TryFieldScalar{{$r.type}}Fn(name, func(d *D) (scalar.{{$r.type}}, error) { v, err := {{replace $v.call "$n" $n}} - s.Actual = v - return s, err + return scalar.{{$r.type}}{Actual: v}, err }, sms...) if err != nil { return nil, err @@ -178,7 +199,7 @@ import ( } // FieldScalar{{$r.name}}{{replace $v.name "$n" $n}} adds a field and reads {{replace $v.doc "$n" $n}} - func (d *D) FieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.Mapper) *scalar.S { + func (d *D) FieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.{{$r.type}}Mapper) *scalar.{{$r.type}} { s, err := d.TryFieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name{{if $v.args}}, {{$v.args}}{{end}}, sms...) if err != nil { panic(IOError{Err: err, Name: name, Op: "{{$r.name}}{{replace $v.name "$n" $n}}", Pos: d.Pos()}) @@ -187,14 +208,14 @@ import ( } // TryField{{$r.name}}{{replace $v.name "$n" $n}} tries to add a field and read {{replace $v.doc "$n" $n}} - func (d *D) TryField{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.Mapper) ({{$t.go_type}}, error) { + func (d *D) TryField{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.{{$r.type}}Mapper) ({{$t.go_type}}, error) { s, err := d.TryFieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name{{if $v.args}}, {{$v.args}}{{end}}, sms...) - return s.Actual{{$r.type}}(), err + return s.Actual, err } // Field{{$r.name}}{{replace $v.name "$n" $n}} adds a field and reads {{replace $v.doc "$n" $n}} - func (d *D) Field{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.Mapper) {{$t.go_type}} { - return d.FieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name{{if $v.args}}, {{$v.args}}{{end}}, sms...).Actual{{$r.type}}() + func (d *D) Field{{$r.name}}{{replace $v.name "$n" $n}}(name string{{if $v.params}}, {{$v.params}}{{end}}, sms ...scalar.{{$r.type}}Mapper) {{$t.go_type}} { + return d.FieldScalar{{$r.name}}{{replace $v.name "$n" $n}}(name{{if $v.args}}, {{$v.args}}{{end}}, sms...).Actual } {{- end}} {{- end}} diff --git a/pkg/decode/scalar.go b/pkg/decode/scalar.go index 6487846f..4f87a51e 100644 --- a/pkg/decode/scalar.go +++ b/pkg/decode/scalar.go @@ -10,8 +10,8 @@ import ( "github.com/wader/fq/pkg/scalar" ) -func bitBufIsZero(s scalar.S, isValidate bool) (scalar.S, error) { - br := s.ActualBitBuf() +func bitBufIsZero(s scalar.BitBuf, isValidate bool) (scalar.BitBuf, error) { + br := s.Actual isZero := true // TODO: shared @@ -19,7 +19,7 @@ func bitBufIsZero(s scalar.S, isValidate bool) (scalar.S, error) { bLen := int64(len(b)) * 8 brLen, err := bitioex.Len(br) if err != nil { - return scalar.S{}, err + return scalar.BitBuf{}, err } brLeft := brLen brPos := int64(0) @@ -62,22 +62,22 @@ func bitBufIsZero(s scalar.S, isValidate bool) (scalar.S, error) { return s, nil } -func (d *D) BitBufIsZero() scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +func (d *D) BitBufIsZero() scalar.BitBufMapper { + return scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { return bitBufIsZero(s, false) }) } -func (d *D) BitBufValidateIsZero() scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +func (d *D) BitBufValidateIsZero() scalar.BitBufMapper { + return scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { return bitBufIsZero(s, !d.Options.Force) }) } // TODO: generate? -func assertBitBuf(s scalar.S, isErr bool, bss ...[]byte) (scalar.S, error) { +func assertBitBuf(s scalar.BitBuf, isErr bool, bss ...[]byte) (scalar.BitBuf, error) { bb := &bytes.Buffer{} - if _, err := bitioex.CopyBits(bb, s.ActualBitBuf()); err != nil { + if _, err := bitioex.CopyBits(bb, s.Actual); err != nil { return s, err } for _, bs := range bss { @@ -93,19 +93,19 @@ func assertBitBuf(s scalar.S, isErr bool, bss ...[]byte) (scalar.S, error) { return s, nil } -func (d *D) AssertBitBuf(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +func (d *D) AssertBitBuf(bss ...[]byte) scalar.BitBufMapper { + return scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { return assertBitBuf(s, !d.Options.Force, bss...) }) } -func (d *D) ValidateBitBuf(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { +func (d *D) ValidateBitBuf(bss ...[]byte) scalar.BitBufMapper { + return scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) { return assertBitBuf(s, false, bss...) }) } -func assertUBytes(s scalar.S, isErr bool, endian Endian, bss ...[]byte) (scalar.S, error) { +func UintAssertBytes(s scalar.Uint, isErr bool, endian Endian, bss ...[]byte) (scalar.Uint, error) { var bo binary.ByteOrder switch endian { case LittleEndian: @@ -116,7 +116,7 @@ func assertUBytes(s scalar.S, isErr bool, endian Endian, bss ...[]byte) (scalar. panic("invalid endian") } - au := s.ActualU() + au := s.Actual for _, bs := range bss { var bu uint64 switch len(bs) { @@ -144,33 +144,33 @@ func assertUBytes(s scalar.S, isErr bool, endian Endian, bss ...[]byte) (scalar. return s, nil } -func (d *D) AssertUBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, true, d.Endian, bss...) +func (d *D) UintAssertBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, true, d.Endian, bss...) }) } -func (d *D) ValidateUBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, false, d.Endian, bss...) +func (d *D) UintValidateBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, false, d.Endian, bss...) }) } -func (d *D) AssertULEBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, true, LittleEndian, bss...) +func (d *D) AssertULEBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, true, LittleEndian, bss...) }) } -func (d *D) ValidateULEBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, false, LittleEndian, bss...) +func (d *D) UintValidateLEBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, false, LittleEndian, bss...) }) } -func (d *D) AssertUBEBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, true, BigEndian, bss...) +func (d *D) AssertUBEBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, true, BigEndian, bss...) }) } -func (d *D) ValidateUBEBytes(bss ...[]byte) scalar.Mapper { - return scalar.Fn(func(s scalar.S) (scalar.S, error) { - return assertUBytes(s, false, BigEndian, bss...) +func (d *D) UintValidateBEBytes(bss ...[]byte) scalar.UintMapper { + return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) { + return UintAssertBytes(s, false, BigEndian, bss...) }) } diff --git a/pkg/decode/types.json b/pkg/decode/types.json index b3900a10..8f29f4dc 100644 --- a/pkg/decode/types.json +++ b/pkg/decode/types.json @@ -1,246 +1,574 @@ { "types": { - "Str": {"go_type": "string", "zero": "\"\"", "compare": "a == b", "range": "a >= start && a <= end"}, - "U": {"go_type": "uint64", "zero": "0", "compare": "a == b", "range": "a >= start && a <= end"}, - "S": {"go_type": "int64", "zero": "0", "compare": "a == b", "range": "a >= start && a <= end"}, - "F": {"go_type": "float64", "map_from": false, "zero": "0", "compare": "a == b", "range": "a >= start && a <= end"}, - "Bool": {"go_type": "bool", "zero": "false", "compare": "a == b"}, - "BitBuf": {"go_type": "bitio.ReaderAtSeeker", "zero": "nil", "map_from": false, "map_to": false}, - "BigInt": {"go_type": "*big.Int", "zero": "nil", "map_from": false, "map_to": false, "compare": "a.Cmp(b) == 0", "range": "a.Cmp(start) >= 0 && a.Cmp(end) <= 0"} - }, + "Any": { + "go_type": "any", + "zero": "nil", + "map_from": false, + "map_to": false, + "display_format": false + }, + "BitBuf": { + "go_type": "bitio.ReaderAtSeeker", + "zero": "nil", + "map_from": false, + "map_to": false, + "display_format": false + }, + "BigInt": { + "go_type": "*big.Int", + "zero": "nil", + "map_from": false, + "map_to": false, + "display_format": true, + "compare": "a.Cmp(b) == 0", + "range": "a.Cmp(start) >= 0 && a.Cmp(end) <= 0" + }, + "Bool": { + "go_type": "bool", + "zero": "false", + "map_from": true, + "map_to": true, + "compare": "a == b", + "display_format": false + }, + "Flt": { + "go_type": "float64", + "zero": "0", + "map_from": false, + "map_to": true, + "compare": "a == b", + "range": "a >= start && a <= end", + "display_format": false + }, + "Str": { + "go_type": "string", + "zero": "\"\"", + "map_from": true, + "map_to": true, + "compare": "a == b", + "range": "a >= start && a <= end", + "display_format": false + }, + "Uint": { + "go_type": "uint64", + "zero": "0", + "map_from": true, + "map_to": true, + "compare": "a == b", + "range": "a >= start && a <= end", + "display_format": true + }, + "Sint": { + "go_type": "int64", + "zero": "0", + "map_from": true, + "map_to": true, + "compare": "a == b", + "range": "a >= start && a <= end", + "display_format": true + } + }, "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.tryUEndian(nBits, d.Endian)", "doc": "nBits bits unsigned integer in current endian"}, - { - "name": "E", - "args": "nBits, endian", - "params": "nBits int, endian Endian", - "call": "d.tryUEndian(nBits, endian)", - "doc": "nBits unsigned integer in specified endian" - }, - { "name": "$n", "range": [1, 65], "args": "", "params": "", "call": "d.tryUEndian($n, d.Endian)", "doc": "$n bit unsigned integer in current endian" }, - { "name": "$nLE", "range": [8, 65], "args": "", "params": "", "call": "d.tryUEndian($n, LittleEndian)", "doc": "$n bit unsigned integer in little-endian" }, - { "name": "$nBE", "range": [8, 65], "args": "", "params": "", "call": "d.tryUEndian($n, BigEndian)", "doc": "$n bit unsigned integer in big-endian" } - ] - }, - { - "name": "S", - "type": "S", - "variants": [ - {"name": "", "args": "nBits", "params": "nBits int", "call": "d.trySEndian(nBits, d.Endian)", "doc": "nBits bits signed integer in current endian"}, - { - "name": "E", - "args": "nBits, endian", - "params": "nBits int, endian Endian", - "call": "d.trySEndian(nBits, endian)", - "doc": "nBits signed integer in specified endian" - }, - { "name": "$n", "range": [1, 65], "args": "", "params": "", "call": "d.trySEndian($n, d.Endian)", "doc": "$n bit signed integer in current endian" }, - { "name": "$nLE", "range": [8, 65], "args": "", "params": "", "call": "d.trySEndian($n, LittleEndian)", "doc": "$n bit signed integer in little-endian" }, - { "name": "$nBE", "range": [8, 65], "args": "", "params": "", "call": "d.trySEndian($n, BigEndian)", "doc": "$n bit signed integer in big-endian" } - ] - }, - { - "name": "UBigInt", - "type": "BigInt", + "name": "Raw", + "type": "BitBuf", "variants": [ { - "name": "", - "args": "nBits", - "params": "nBits int", - "call": "d.tryBigIntEndianSign(nBits, d.Endian, false)", - "doc": "nBits bits signed integer in current endian" - }, - { - "name": "E", - "args": "nBits, endian", - "params": "nBits int, endian Endian", - "call": "d.tryBigIntEndianSign(nBits, endian, false)", - "doc": "nBits signed integer in specified endian" - }, - { - "name": "LE", - "args": "nBits", - "params": "nBits int", - "call": "d.tryBigIntEndianSign(nBits, LittleEndian, false)", - "doc": "nBits bit signed integer in little-endian" - }, - { - "name": "BE", - "args": "nBits", - "params": "nBits int", - "call": "d.tryBigIntEndianSign(nBits, BigEndian, false)", - "doc": "nBits bit signed integer in big-endian" + "name" : "Len" , + "args" : "nBits" , + "params": "nBits int64" , + "call" : "d.tryBitBuf(nBits)", + "doc" : "nBits raw bits" } ] - }, + }, { - "name": "SBigInt", - "type": "BigInt", + "name": "Bool", + "type": "Bool", "variants": [ { - "name": "", - "args": "nBits", - "params": "nBits int", - "call": "d.tryBigIntEndianSign(nBits, d.Endian, true)", - "doc": "nBits bits signed integer in current endian" - }, + "name" : "" , + "args" : "" , + "params": "" , + "call" : "d.tryBool()" , + "doc" : "1 bit boolean" + } + ] + }, + { + "name": "U", + "type": "Uint", + "variants": [ { - "name": "E", - "args": "nBits, endian", - "params": "nBits int, endian Endian", - "call": "d.tryBigIntEndianSign(nBits, endian, true)", - "doc": "nBits signed integer in specified endian" - }, + "name" : "" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryUEndian(nBits, d.Endian)" , + "doc" : "nBits bits unsigned integer in current endian" + }, { - "name": "LE", - "args": "nBits", - "params": "nBits int", - "call": "d.tryBigIntEndianSign(nBits, LittleEndian, true)", + "name" : "E" , + "args" : "nBits, endian" , + "params": "nBits int, endian Endian" , + "call" : "d.tryUEndian(nBits, endian)" , + "doc" : "nBits unsigned integer in specified endian" + }, + { + "name": "$n", + "range": [1, 65], + "args": "", + "params": "", + "call": "d.tryUEndian($n, d.Endian)", + "doc": "$n bit unsigned integer in current endian" + }, + { + "name": "$nLE", + "range": [8, 65], + "args": "", + "params": "", + "call": "d.tryUEndian($n, LittleEndian)", + "doc": "$n bit unsigned integer in little-endian" + }, + { + "name": "$nBE", + "range": [8, 65], + "args": "", + "params": "", + "call": "d.tryUEndian($n, BigEndian)", + "doc": "$n bit unsigned integer in big-endian" + } + ] + }, + { + "name": "S", + "type": "Sint", + "variants": [ + { + "name" : "" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.trySEndian(nBits, d.Endian)" , + "doc" : "nBits bits signed integer in current endian" + }, + { + "name" : "E" , + "args" : "nBits, endian" , + "params": "nBits int, endian Endian" , + "call" : "d.trySEndian(nBits, endian)" , + "doc" : "nBits signed integer in specified endian" + }, + { + "name": "$n", + "range": [1, 65], + "args": "", + "params": "", + "call": "d.trySEndian($n, d.Endian)", + "doc": "$n bit signed integer in current endian" + }, + { + "name": "$nLE", + "range": [8, 65], + "args": "", + "params": "", + "call": "d.trySEndian($n, LittleEndian)", + "doc": "$n bit signed integer in little-endian" + }, + { + "name": "$nBE", + "range": [8, 65], + "args": "", + "params": "", + "call": "d.trySEndian($n, BigEndian)", + "doc": "$n bit signed integer in big-endian" + } + ] + }, + { + "name": "UBigInt", + "type": "BigInt", + "variants": [ + { + "name" : "" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryBigIntEndianSign(nBits, d.Endian, false)", + "doc" : "nBits bits signed integer in current endian" + }, + { + "name" : "E" , + "args" : "nBits, endian" , + "params": "nBits int, endian Endian" , + "call" : "d.tryBigIntEndianSign(nBits, endian, false)", + "doc" : "nBits signed integer in specified endian" + }, + { + "name": "LE", + "args": "nBits", + "params": "nBits int", + "call": "d.tryBigIntEndianSign(nBits, LittleEndian, false)", "doc": "nBits bit signed integer in little-endian" - }, - {"name": "BE", "args": "nBits", "params": "nBits int", "call": "d.tryBigIntEndianSign(nBits, BigEndian, true)", "doc": "nBits bit signed integer in big-endian"} - ] - }, - { - "name": "F", - "type": "F", - "variants": [ - {"name": "", "args": "nBits", "params": "nBits int", "call": "d.tryFEndian(nBits, d.Endian)", "doc": "nBit IEEE 754 float in current endian"}, + }, { - "name": "E", - "args": "nBits, endian", - "params": "nBits int, endian Endian", - "call": "d.tryFEndian(nBits, endian)", - "doc": "nBit IEEE 754 float in specified endian" - }, - {"name": "16", "args": "", "params": "", "call": "d.tryFEndian(16, d.Endian)", "doc": "16 bit IEEE 754 float in current endian"}, - {"name": "32", "args": "", "params": "", "call": "d.tryFEndian(32, d.Endian)", "doc": "32 bit IEEE 754 float in current endian"}, - {"name": "64", "args": "", "params": "", "call": "d.tryFEndian(64, d.Endian)", "doc": "64 bit IEEE 754 float in current endian"}, - {"name": "16LE", "args": "", "params": "", "call": "d.tryFEndian(16, LittleEndian)", "doc": "16 bit IEEE 754 float in little-endian"}, - {"name": "32LE", "args": "", "params": "", "call": "d.tryFEndian(32, LittleEndian)", "doc": "32 bit IEEE 754 float in little-endian"}, - {"name": "64LE", "args": "", "params": "", "call": "d.tryFEndian(64, LittleEndian)", "doc": "64 bit IEEE 754 float in little-endian"}, - {"name": "16BE", "args": "", "params": "", "call": "d.tryFEndian(16, BigEndian)", "doc": "16 bit IEEE 754 float in big-endian"}, - {"name": "32BE", "args": "", "params": "", "call": "d.tryFEndian(32, BigEndian)", "doc": "32 bit IEEE 754 float in big-endian"}, - {"name": "64BE", "args": "", "params": "", "call": "d.tryFEndian(64, BigEndian)", "doc": "64 bit IEEE 754 float in big-endian"} + "name" : "BE" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryBigIntEndianSign(nBits, BigEndian, false)", + "doc" : "nBits bit signed integer in big-endian" + } ] - }, + }, { - "name": "FP", - "type": "F", + "name": "SBigInt", + "type": "BigInt", "variants": [ { - "name": "", - "args": "nBits, fBits", - "params": "nBits int, fBits int", - "call": "d.tryFPEndian(nBits, fBits, d.Endian)", - "doc": "nBits fixed-point number in current endian" - }, + "name" : "" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryBigIntEndianSign(nBits, d.Endian, true)", + "doc" : "nBits bits signed integer in current endian" + }, { - "name": "E", - "args": "nBits, fBits, endian", - "params": "nBits int, fBits int, endian Endian", - "call": "d.tryFPEndian(nBits, fBits, endian)", - "doc": "nBits fixed-point number in specified endian" - }, - {"name": "16", "args": "", "params": "", "call": "d.tryFPEndian(16, 8, d.Endian)", "doc": "16 bit fixed-point number in current endian"}, - {"name": "32", "args": "", "params": "", "call": "d.tryFPEndian(32, 16, d.Endian)", "doc": "32 bit fixed-point number in current endian"}, - {"name": "64", "args": "", "params": "", "call": "d.tryFPEndian(64, 32, d.Endian)", "doc": "64 bit fixed-point number in current endian"}, - {"name": "16LE", "args": "", "params": "", "call": "d.tryFPEndian(16, 8, LittleEndian)", "doc": "16 bit fixed-point number in little-endian"}, - {"name": "32LE", "args": "", "params": "", "call": "d.tryFPEndian(32, 16, LittleEndian)", "doc": "32 bit fixed-point number in little-endian"}, - {"name": "64LE", "args": "", "params": "", "call": "d.tryFPEndian(64, 32, LittleEndian)", "doc": "64 bit fixed-point number in little-endian"}, - {"name": "16BE", "args": "", "params": "", "call": "d.tryFPEndian(16, 8, BigEndian)", "doc": "16 bit fixed-point number in big-endian"}, - {"name": "32BE", "args": "", "params": "", "call": "d.tryFPEndian(32, 16, BigEndian)", "doc": "32 bit fixed-point number in big-endian"}, - {"name": "64BE", "args": "", "params": "", "call": "d.tryFPEndian(64, 32, BigEndian)", "doc": "64 bit fixed-point number in big-endian"} + "name" : "E" , + "args" : "nBits, endian" , + "params": "nBits int, endian Endian" , + "call" : "d.tryBigIntEndianSign(nBits, endian, true)", + "doc" : "nBits signed integer in specified endian" + }, + { + "name": "LE", + "args": "nBits", + "params": "nBits int", + "call": "d.tryBigIntEndianSign(nBits, LittleEndian, true)", + "doc": "nBits bit signed integer in little-endian" + }, + { + "name" : "BE" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryBigIntEndianSign(nBits, BigEndian, true)", + "doc" : "nBits bit signed integer 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"} ] - }, - { - "name": "ULEB128", - "type": "U", - "variants": [ {"name": "", "args": "", "params": "", "call": "d.tryULEB128()", "doc": "unsigned LEB128 integer"} ] - }, - { - "name": "SLEB128", - "type": "S", - "variants": [ {"name": "", "args": "", "params": "", "call": "d.trySLEB128()", "doc": "signed LEB128 integer"} ] - }, - { - "type": "Str", - "name": "UTF", + "name": "F", + "type": "Flt", "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)", + "name" : "" , + "args" : "nBits" , + "params": "nBits int" , + "call" : "d.tryFEndian(nBits, d.Endian)" , + "doc" : "nBit IEEE 754 float in current endian" + }, + { + "name" : "E" , + "args" : "nBits, endian" , + "params": "nBits int, endian Endian" , + "call" : "d.tryFEndian(nBits, endian)" , + "doc" : "nBit IEEE 754 float in specified endian" + }, + { + "name" : "16" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(16, d.Endian)" , + "doc" : "16 bit IEEE 754 float in current endian" + }, + { + "name" : "32" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(32, d.Endian)" , + "doc" : "32 bit IEEE 754 float in current endian" + }, + { + "name" : "64" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(64, d.Endian)" , + "doc" : "64 bit IEEE 754 float in current endian" + }, + { + "name" : "16LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(16, LittleEndian)" , + "doc" : "16 bit IEEE 754 float in little-endian" + }, + { + "name" : "32LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(32, LittleEndian)" , + "doc" : "32 bit IEEE 754 float in little-endian" + }, + { + "name" : "64LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(64, LittleEndian)" , + "doc" : "64 bit IEEE 754 float in little-endian" + }, + { + "name" : "16BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(16, BigEndian)" , + "doc" : "16 bit IEEE 754 float in big-endian" + }, + { + "name" : "32BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(32, BigEndian)" , + "doc" : "32 bit IEEE 754 float in big-endian" + }, + { + "name" : "64BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFEndian(64, BigEndian)" , + "doc" : "64 bit IEEE 754 float in big-endian" + } + ] + }, + { + "name": "FP", + "type": "Flt", + "variants": [ + { + "name" : "" , + "args" : "nBits, fBits" , + "params": "nBits int, fBits int" , + "call" : "d.tryFPEndian(nBits, fBits, d.Endian)" , + "doc" : "nBits fixed-point number in current endian" + }, + { + "name" : "E" , + "args" : "nBits, fBits, endian" , + "params": "nBits int, fBits int, endian Endian" , + "call" : "d.tryFPEndian(nBits, fBits, endian)" , + "doc" : "nBits fixed-point number in specified endian" + }, + { + "name" : "16" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(16, 8, d.Endian)" , + "doc" : "16 bit fixed-point number in current endian" + }, + { + "name" : "32" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(32, 16, d.Endian)" , + "doc" : "32 bit fixed-point number in current endian" + }, + { + "name" : "64" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(64, 32, d.Endian)" , + "doc" : "64 bit fixed-point number in current endian" + }, + { + "name" : "16LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(16, 8, LittleEndian)" , + "doc" : "16 bit fixed-point number in little-endian" + }, + { + "name" : "32LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(32, 16, LittleEndian)" , + "doc" : "32 bit fixed-point number in little-endian" + }, + { + "name" : "64LE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(64, 32, LittleEndian)" , + "doc" : "64 bit fixed-point number in little-endian" + }, + { + "name" : "16BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(16, 8, BigEndian)" , + "doc" : "16 bit fixed-point number in big-endian" + }, + { + "name" : "32BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(32, 16, BigEndian)" , + "doc" : "32 bit fixed-point number in big-endian" + }, + { + "name" : "64BE" , + "args" : "" , + "params": "" , + "call" : "d.tryFPEndian(64, 32, BigEndian)" , + "doc" : "64 bit fixed-point number in big-endian" + } + ] + }, + { + "name": "Unary", + "type": "Uint", + "variants": [ + { + "name" : "" , + "args" : "ov" , + "params": "ov uint64" , + "call" : "d.tryUnary(ov)" , + "doc" : "unary integer using ov as \"one\" value" + } + ] + }, + { + "name": "ULEB128", + "type": "Uint", + "variants": [ + { + "name" : "" , + "args" : "" , + "params": "" , + "call" : "d.tryULEB128()" , + "doc" : "unsigned LEB128 integer" + } + ] + }, + { + "name": "SLEB128", + "type": "Sint", + "variants": [ + { + "name" : "" , + "args" : "" , + "params": "" , + "call" : "d.trySLEB128()" , + "doc" : "signed LEB128 integer" + } + ] + }, + { + "name": "UTF", + "type": "Str", + "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)", + "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": "UTF", - "type": "Str", - "variants": [ - {"name": "8Null", "args": "", "params": "", "call": "d.tryTextNull(1, UTF8BOM)", "doc": "null terminated UTF8 string"}, - {"name": "16Null", "args": "", "params": "", "call": "d.tryTextNull(2, UTF16BOM)", "doc": "null terminated UTF16 string, default big-endian and accepts BOM"}, - {"name": "16LENull", "args": "", "params": "", "call": "d.tryTextNull(2, UTF16LE)", "doc": "null terminated UTF16LE string"}, - {"name": "16BENull", "args": "", "params": "", "call": "d.tryTextNull(2, UTF16BE)", "doc": "null terminated UTF16BE string"} - ] - }, - { - "name": "UTF8NullFixedLen", - "type": "Str", + "name": "UTF", + "type": "Str", "variants": [ { - "name": "", - "args": "fixedBytes", - "params": "fixedBytes int", - "call": "d.tryTextNullLen(fixedBytes, UTF8BOM)", + "name" : "8Null" , + "args" : "" , + "params": "" , + "call" : "d.tryTextNull(1, UTF8BOM)" , + "doc" : "null terminated UTF8 string" + }, + { + "name": "16Null", + "args": "", + "params": "", + "call": "d.tryTextNull(2, UTF16BOM)", + "doc": "null terminated UTF16 string, default big-endian and accepts BOM" + }, + { + "name" : "16LENull" , + "args" : "" , + "params": "" , + "call" : "d.tryTextNull(2, UTF16LE)" , + "doc" : "null terminated UTF16LE string" + }, + { + "name" : "16BENull" , + "args" : "" , + "params": "" , + "call" : "d.tryTextNull(2, UTF16BE)" , + "doc" : "null terminated UTF16BE 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" } ] - }, + }, { - "name": "Str", - "type": "Str", + "name": "Str", + "type": "Str", "variants": [ - {"name": "", "args": "nBytes, e", "params": "nBytes int, e encoding.Encoding", "call": "d.tryText(nBytes, e)", "doc": "nBytes bytes using encoding e"} + { + "name" : "" , + "args" : "nBytes, e" , + "params": "nBytes int, e encoding.Encoding", + "call" : "d.tryText(nBytes, e)" , + "doc" : "nBytes bytes using encoding e" + } ] } ] -} \ No newline at end of file +} diff --git a/pkg/decode/value.go b/pkg/decode/value.go index 3156bff9..817eda66 100644 --- a/pkg/decode/value.go +++ b/pkg/decode/value.go @@ -219,15 +219,33 @@ func (v *Value) postProcess() { } } -func (v *Value) TryScalarFn(sms ...scalar.Mapper) error { +// TODO: rethink this +func (v *Value) TryUintScalarFn(sms ...scalar.UintMapper) error { var err error - sr, ok := v.V.(*scalar.S) + sr, ok := v.V.(*scalar.Uint) if !ok { panic("not a scalar value") } s := *sr for _, sm := range sms { - s, err = sm.MapScalar(s) + s, err = sm.MapUint(s) + if err != nil { + break + } + } + v.V = &s + return err +} + +func (v *Value) TryBitBufScalarFn(sms ...scalar.BitBufMapper) error { + var err error + sr, ok := v.V.(*scalar.BitBuf) + if !ok { + panic("not a scalar value") + } + s := *sr + for _, sm := range sms { + s, err = sm.MapBitBuf(s) if err != nil { break } diff --git a/pkg/interp/decode.go b/pkg/interp/decode.go index 80f6b645..7ecf45cd 100644 --- a/pkg/interp/decode.go +++ b/pkg/interp/decode.go @@ -17,7 +17,6 @@ import ( "github.com/wader/fq/internal/mapstruct" "github.com/wader/fq/pkg/bitio" "github.com/wader/fq/pkg/decode" - "github.com/wader/fq/pkg/scalar" "github.com/wader/gojq" ) @@ -346,16 +345,17 @@ func makeDecodeValueOut(dv *decode.Value, kind decodeValueKind, out any) any { return NewArrayDecodeValue(dv, out, vv) } return NewStructDecodeValue(dv, out, vv) - case *scalar.S: + + case Scalarable: // TODO: rethink value/actual/sym handling var vvv any switch kind { case decodeValueValue: - vvv = vv.Value() + vvv = vv.ScalarValue() case decodeValueActual: - vvv = vv.Actual + vvv = vv.ScalarActual() case decodeValueSym: - vvv = vv.Sym + vvv = vv.ScalarSym() } switch vvv := vvv.(type) { @@ -519,14 +519,14 @@ func (dvb decodeValueBase) JQValueKey(name string) any { return makeDecodeValue(dv.Parent, decodeValueValue) case "_actual": switch dv.V.(type) { - case *scalar.S: + case Scalarable: return makeDecodeValue(dv, decodeValueActual) default: return nil } case "_sym": switch dv.V.(type) { - case *scalar.S: + case Scalarable: return makeDecodeValue(dv, decodeValueSym) default: return nil @@ -538,11 +538,12 @@ func (dvb decodeValueBase) JQValueKey(name string) any { return nil } return vv.Description - case *scalar.S: - if vv.Description == "" { + case Scalarable: + desc := vv.ScalarDescription() + if desc == "" { return nil } - return vv.Description + return desc default: return nil } @@ -575,8 +576,8 @@ func (dvb decodeValueBase) JQValueKey(name string) any { return dvb.out case "_gap": switch vv := dv.V.(type) { - case *scalar.S: - return vv.Gap + case Scalarable: + return vv.ScalarGap() default: return false } diff --git a/pkg/interp/decorator.go b/pkg/interp/decorator.go index 8c358836..106b6747 100644 --- a/pkg/interp/decorator.go +++ b/pkg/interp/decorator.go @@ -1,6 +1,7 @@ package interp import ( + "fmt" "math/big" "github.com/wader/fq/internal/ansi" @@ -50,15 +51,20 @@ func decoratorFromOptions(opts Options) Decorator { return d.False case string, bitio.Reader: return d.String - case nil: - return d.Null case int, float64, int64, uint64: // TODO: clean up number types return d.Number case *big.Int: return d.Number + case []any: + return d.Array + case map[string]any: + return d.Object + case nil: + return d.Null + default: - panic("unreachable") + panic(fmt.Sprintf("unreachable %v (%T)", v, v)) } } byteDefaultColor := ansi.FromString("") diff --git a/pkg/interp/dump.go b/pkg/interp/dump.go index ba4fdd39..aebeb10a 100644 --- a/pkg/interp/dump.go +++ b/pkg/interp/dump.go @@ -77,6 +77,7 @@ func dumpEx(v *decode.Value, ctx *dumpCtx, depth int, rootV *decode.Value, rootD } isInArray := false + isCompound := isCompound(v) inArrayLen := 0 if v.Parent != nil { if dc, ok := v.Parent.V.(*decode.Compound); ok { @@ -113,7 +114,7 @@ func dumpEx(v *decode.Value, ctx *dumpCtx, depth int, rootV *decode.Value, rootD } innerRange := v.InnerRange() - willDisplayData := innerRange.Len > 0 && (!isCompound(v) || (opts.Depth != 0 && opts.Depth == depth)) + willDisplayData := innerRange.Len > 0 && (!isCompound || (opts.Depth != 0 && opts.Depth == depth)) // show address bar on root, nested root and format change if depth == 0 || v.IsRoot || v.Format != nil { @@ -130,10 +131,8 @@ func dumpEx(v *decode.Value, ctx *dumpCtx, depth int, rootV *decode.Value, rootD cfmt(colField, "%s%s%s", deco.Index.F("["), deco.Number.F(strconv.Itoa(v.Index)), deco.Index.F("]")) } - var valueErr error + var desc string - // TODO: cleanup map[string]any []any or json format - // dump should use some internal interface instead? switch vv := v.V.(type) { case *decode.Compound: if vv.IsArray { @@ -142,43 +141,45 @@ func dumpEx(v *decode.Value, ctx *dumpCtx, depth int, rootV *decode.Value, rootD cfmt(colField, "%s", deco.Object.F("{}")) } cprint(colField, ":") + desc = vv.Description + + case Scalarable: + cprint(colField, ":") + actual := vv.ScalarActual() + sym := vv.ScalarSym() + df := vv.ScalarDisplayFormat() + if sym == nil { + cfmt(colField, " %s", deco.ValueColor(actual).F(previewValue(actual, df))) + } else { + cfmt(colField, " %s", deco.ValueColor(sym).F(previewValue(sym, scalar.NumberDecimal))) + cfmt(colField, " (%s)", deco.ValueColor(actual).F(previewValue(actual, df))) + } + desc = vv.ScalarDescription() + + default: + panic(fmt.Sprintf("unreachable vv %#+v", vv)) + } + + if isCompound { if isInArray { cfmt(colField, " %s", v.Name) } - if vv.Description != "" { - cfmt(colField, " %s", deco.Value.F(vv.Description)) + if desc != "" { + cfmt(colField, " %s", deco.Value.F(desc)) } - case *scalar.S: - switch av := vv.Actual.(type) { - case map[string]any: - cfmt(colField, ": %s", deco.Object.F("{}")) - case []any: - // TODO: format? - cfmt(colField, ": %s%s:%s%s", deco.Index.F("["), deco.Number.F("0"), deco.Number.F(strconv.Itoa(len(av))), deco.Index.F("]")) - default: - cprint(colField, ":") - if vv.Sym == nil { - cfmt(colField, " %s", deco.ValueColor(vv.Actual).F(previewValue(vv.Actual, vv.ActualDisplay))) - } else { - cfmt(colField, " %s", deco.ValueColor(vv.Sym).F(previewValue(vv.Sym, vv.SymDisplay))) - cfmt(colField, " (%s)", deco.ValueColor(vv.Actual).F(previewValue(vv.Actual, vv.ActualDisplay))) - } - } - + } else { if opts.Verbose && isInArray { cfmt(colField, " %s", v.Name) } - if vv.Description != "" { - cfmt(colField, " (%s)", deco.Value.F(vv.Description)) + if desc != "" { + cfmt(colField, " (%s)", deco.Value.F(desc)) } - default: - panic(fmt.Sprintf("unreachable vv %#+v", vv)) } if v.Format != nil { cfmt(colField, " (%s)", deco.Value.F(v.Format.Name)) } - valueErr = v.Err + valueErr := v.Err if opts.Verbose { cfmt(colField, " %s (%s)", @@ -419,7 +420,7 @@ func hexdump(w io.Writer, bv Binary, opts Options) error { return dump( &decode.Value{ // TODO: hack - V: &scalar.S{Actual: br}, + V: &scalar.BitBuf{Actual: br}, Range: bv.r, RootReader: bv.br, }, diff --git a/pkg/interp/interp.go b/pkg/interp/interp.go index d4f1423e..6b71e7c6 100644 --- a/pkg/interp/interp.go +++ b/pkg/interp/interp.go @@ -28,6 +28,7 @@ import ( "github.com/wader/fq/internal/pos" "github.com/wader/fq/pkg/bitio" "github.com/wader/fq/pkg/decode" + "github.com/wader/fq/pkg/scalar" "github.com/wader/gojq" ) @@ -76,6 +77,15 @@ func init() { RegisterFunc0("_is_completing", (*Interp)._isCompleting) } +type Scalarable interface { + ScalarActual() any + ScalarValue() any + ScalarSym() any + ScalarDescription() string + ScalarGap() bool + ScalarDisplayFormat() scalar.DisplayFormat +} + type valueError struct { v any } diff --git a/pkg/interp/preview.go b/pkg/interp/preview.go index 58de2d05..66717895 100644 --- a/pkg/interp/preview.go +++ b/pkg/interp/preview.go @@ -2,6 +2,7 @@ package interp import ( "bytes" + "fmt" "math/big" "strconv" "strings" @@ -45,7 +46,12 @@ func previewValue(v any, df scalar.DisplayFormat) string { return "raw bits" case *big.Int: return mathex.PadFormatBigInt(vv, df.FormatBase(), true, 0) + case map[string]any: + return "{}" + case []any: + return "[]" + default: - panic("unreachable") + panic(fmt.Sprintf("unreachable %v (%T)", v, v)) } } diff --git a/pkg/interp/testdata/basic.fqtest b/pkg/interp/testdata/basic.fqtest index 0f218498..74009adb 100644 --- a/pkg/interp/testdata/basic.fqtest +++ b/pkg/interp/testdata/basic.fqtest @@ -27,7 +27,7 @@ mp3> ^D # TODO: use test format $ fq -d mp3_frame . |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3_frame) - | | | error: mp3_frame: U11(sync): failed at position 1.3 (read size 0 seek pos 0): failed to assert U + | | | error: mp3_frame: U11(sync): failed at position 1.3 (read size 0 seek pos 0): failed to assert Uint | | | header{}: 0x0|61 62 63 0a| |abc.| | gap0: raw bits stdin: diff --git a/pkg/scalar/scalar.go b/pkg/scalar/scalar.go index a443e09b..7a404ca9 100644 --- a/pkg/scalar/scalar.go +++ b/pkg/scalar/scalar.go @@ -14,7 +14,6 @@ import ( "github.com/wader/fq/internal/bitioex" "github.com/wader/fq/pkg/bitio" - "golang.org/x/exp/constraints" ) //go:generate sh -c "cat scalar_gen.go.tmpl | go run ../../dev/tmpl.go ../decode/types.json | gofmt > scalar_gen.go" @@ -43,70 +42,49 @@ func (df DisplayFormat) FormatBase() int { } } -type S struct { - Actual any // nil, int, int64, uint64, float64, string, bool, []byte, *bit.Int, bitio.BitReaderAtSeeker, - ActualDisplay DisplayFormat - Sym any - SymDisplay DisplayFormat - Description string - Gap bool -} +// TODO: todos +// rename raw? +// crc +// +// +// d.FieldU2("emphasis"). +// MapSym(). +// Actual +// Sym +// Value() +// Scalar() -func (s S) Value() any { - if s.Sym != nil { - return s.Sym - } - return s.Actual -} +var UintBin = UintFn(func(s Uint) (Uint, error) { s.DisplayFormat = NumberBinary; return s, nil }) +var UintOct = UintFn(func(s Uint) (Uint, error) { s.DisplayFormat = NumberOctal; return s, nil }) +var UintDec = UintFn(func(s Uint) (Uint, error) { s.DisplayFormat = NumberDecimal; return s, nil }) +var UintHex = UintFn(func(s Uint) (Uint, error) { s.DisplayFormat = NumberHex; return s, nil }) +var SintBin = SintFn(func(s Sint) (Sint, error) { s.DisplayFormat = NumberBinary; return s, nil }) +var SintOct = SintFn(func(s Sint) (Sint, error) { s.DisplayFormat = NumberOctal; return s, nil }) +var SintDec = SintFn(func(s Sint) (Sint, error) { s.DisplayFormat = NumberDecimal; return s, nil }) +var SintHex = SintFn(func(s Sint) (Sint, error) { s.DisplayFormat = NumberHex; return s, nil }) +var BigIntBin = BigIntFn(func(s BigInt) (BigInt, error) { s.DisplayFormat = NumberBinary; return s, nil }) +var BigIntOct = BigIntFn(func(s BigInt) (BigInt, error) { s.DisplayFormat = NumberOctal; return s, nil }) +var BigIntDec = BigIntFn(func(s BigInt) (BigInt, error) { s.DisplayFormat = NumberDecimal; return s, nil }) +var BigIntHex = BigIntFn(func(s BigInt) (BigInt, error) { s.DisplayFormat = NumberHex; return s, nil }) -type Mapper interface { - MapScalar(S) (S, error) -} - -type Fn func(S) (S, error) - -func (fn Fn) MapScalar(s S) (S, error) { - return fn(s) -} - -var ActualBin = Fn(func(s S) (S, error) { s.ActualDisplay = NumberBinary; return s, nil }) -var ActualOct = Fn(func(s S) (S, error) { s.ActualDisplay = NumberOctal; return s, nil }) -var ActualDec = Fn(func(s S) (S, error) { s.ActualDisplay = NumberDecimal; return s, nil }) -var ActualHex = Fn(func(s S) (S, error) { s.ActualDisplay = NumberHex; return s, nil }) - -var SymBin = Fn(func(s S) (S, error) { s.SymDisplay = NumberBinary; return s, nil }) -var SymOct = Fn(func(s S) (S, error) { s.SymDisplay = NumberOctal; return s, nil }) -var SymDec = Fn(func(s S) (S, error) { s.SymDisplay = NumberDecimal; return s, nil }) -var SymHex = Fn(func(s S) (S, error) { s.SymDisplay = NumberHex; return s, nil }) - -func Actual(v any) Mapper { - return Fn(func(s S) (S, error) { s.Actual = v; return s, nil }) -} -func Sym(v any) Mapper { - return Fn(func(s S) (S, error) { s.Sym = v; return s, nil }) -} -func Description(v string) Mapper { - return Fn(func(s S) (S, error) { s.Description = v; return s, nil }) -} - -func ActualUAdd(n int) ActualUFn { +func UintActualAdd(n int) UintActualFn { // TODO: use math.Add/Sub? - return ActualUFn(func(a uint64) uint64 { return uint64(int64(a) + int64(n)) }) + return UintActualFn(func(a uint64) uint64 { return uint64(int64(a) + int64(n)) }) } -func ActualSAdd(n int) ActualSFn { - return ActualSFn(func(a int64) int64 { return a + int64(n) }) +func SintActualAdd(n int) SintActualFn { + return SintActualFn(func(a int64) int64 { return a + int64(n) }) } -func ActualTrim(cutset string) ActualStrFn { - return ActualStrFn(func(a string) string { return strings.Trim(a, cutset) }) +func StrActualTrim(cutset string) StrActualFn { + return StrActualFn(func(a string) string { return strings.Trim(a, cutset) }) } -var ActualTrimSpace = ActualStrFn(strings.TrimSpace) +var ActualTrimSpace = StrActualFn(strings.TrimSpace) -func strMapToSym(fn func(s string) (any, error), try bool) Mapper { - return Fn(func(s S) (S, error) { - ts := strings.TrimSpace(s.ActualStr()) +func strMapToSym(fn func(s string) (any, error), try bool) StrMapper { + return StrFn(func(s Str) (Str, error) { + ts := strings.TrimSpace(s.Actual) n, err := fn(ts) if err != nil { if try { @@ -119,40 +97,40 @@ func strMapToSym(fn func(s string) (any, error), try bool) Mapper { }) } -func TrySymUParseUint(base int) Mapper { +func TryStrSymParseUint(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseUint(s, base, 64) }, true) } -func TrySymSParseInt(base int) Mapper { +func TryStrSymParseInt(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseInt(s, base, 64) }, true) } -func TrySymFParseFloat(base int) Mapper { +func TryStrSymParseFloat(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseFloat(s, base) }, true) } -func SymUParseUint(base int) Mapper { +func StrSymParseUint(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseUint(s, base, 64) }, false) } -func SymSParseInt(base int) Mapper { +func StrSymParseInt(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseInt(s, base, 64) }, false) } -func SymFParseFloat(base int) Mapper { +func StrSymParseFloat(base int) StrMapper { return strMapToSym(func(s string) (any, error) { return strconv.ParseFloat(s, base) }, false) } type URangeEntry struct { Range [2]uint64 - S S + S Uint } -// URangeToScalar maps uint64 ranges to a scalar, first in range is chosen -type URangeToScalar []URangeEntry +// UintRangeToScalar maps uint64 ranges to a scalar, first in range is chosen +type UintRangeToScalar []URangeEntry -func (rs URangeToScalar) MapScalar(s S) (S, error) { - n := s.ActualU() +func (rs UintRangeToScalar) MapUint(s Uint) (Uint, error) { + n := s.Actual for _, re := range rs { if n >= re.Range[0] && n <= re.Range[1] { ns := re.S @@ -167,14 +145,14 @@ func (rs URangeToScalar) MapScalar(s S) (S, error) { // SRangeToScalar maps ranges to a scalar, first in range is chosen type SRangeEntry struct { Range [2]int64 - S S + S Sint } // SRangeToScalar maps sint64 ranges to a scalar, first in range is chosen type SRangeToScalar []SRangeEntry -func (rs SRangeToScalar) MapScalar(s S) (S, error) { - n := s.ActualS() +func (rs SRangeToScalar) MapSint(s Sint) (Sint, error) { + n := s.Actual for _, re := range rs { if n >= re.Range[0] && n <= re.Range[1] { ns := re.S @@ -186,11 +164,11 @@ func (rs SRangeToScalar) MapScalar(s S) (S, error) { return s, nil } -func RawSym(s S, nBytes int, fn func(b []byte) string) (S, error) { - br := s.ActualBitBuf() +func RawSym(s BitBuf, nBytes int, fn func(b []byte) string) (BitBuf, error) { + br := s.Actual brLen, err := bitioex.Len(br) if err != nil { - return S{}, err + return BitBuf{}, err } if nBytes < 0 { nBytes = int(brLen) / 8 @@ -212,23 +190,23 @@ func RawSym(s S, nBytes int, fn func(b []byte) string) (S, error) { return s, nil } -var RawUUID = Fn(func(s S) (S, error) { +var RawUUID = BitBufFn(func(s BitBuf) (BitBuf, error) { return RawSym(s, -1, func(b []byte) string { return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]) }) }) -var RawHex = Fn(func(s S) (S, error) { +var RawHex = BitBufFn(func(s BitBuf) (BitBuf, error) { return RawSym(s, -1, func(b []byte) string { return fmt.Sprintf("%x", b) }) }) -type BytesToScalar []struct { +type RawBytesMap []struct { Bytes []byte - Scalar S + Scalar BitBuf } -func (m BytesToScalar) MapScalar(s S) (S, error) { - rc, err := bitio.CloneReader(s.ActualBitBuf()) +func (m RawBytesMap) MapBitBuf(s BitBuf) (BitBuf, error) { + rc, err := bitio.CloneReader(s.Actual) if err != nil { return s, err } @@ -247,48 +225,26 @@ func (m BytesToScalar) MapScalar(s S) (S, error) { return s, nil } -// TODO: nicer api, use generic, many generic Try function somehow? - -func mapFn[T any](tryVFn func(S) (T, bool), vFn func(S) T, fn func(s S, v T) S) Mapper { - return Fn(func(s S) (S, error) { - var v T - var ok bool - if tryVFn != nil { - v, ok = tryVFn(s) - if !ok { - return s, nil - } - } else { - v = vFn(s) - } - return fn(s, v), nil - }) -} - -func TryMapFn[T any](epoch time.Time, format string, vFn func(S) (T, bool), fn func(s S, v T) S) Mapper { - return mapFn(vFn, nil, fn) -} - -func MapFn[T any](epoch time.Time, format string, vFn func(S) T, fn func(s S, v T) S) Mapper { - return mapFn(nil, vFn, fn) -} - var unixTimeEpochDate = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) -func DescriptionFn[T any](vFn func(S) (T, bool), fn func(v T) string) Mapper { - return mapFn(vFn, nil, func(s S, v T) S { - s.Description = fn(v) - return s +func UintActualDate(epoch time.Time, format string) UintFn { + return UintFn(func(s Uint) (Uint, error) { + s.Description = epoch.Add(time.Duration(s.Actual) * time.Second).Format(format) + return s, nil }) } -// TODO: scalar types constraints -func DescriptionTimeFn[T constraints.Integer | constraints.Float](vFn func(S) (T, bool), epoch time.Time, format string) Mapper { - return DescriptionFn(vFn, func(v T) string { - return epoch.Add(time.Duration(v) * time.Second).Format(format) +func UintActualUnixTime(format string) UintFn { + return UintActualDate(unixTimeEpochDate, format) +} + +func FltActualDate(epoch time.Time, format string) FltFn { + return FltFn(func(s Flt) (Flt, error) { + s.Description = epoch.Add(time.Duration(s.Actual) * time.Second).Format(format) + return s, nil }) } -func DescriptionUnixTimeFn[T constraints.Integer | constraints.Float](vFn func(S) (T, bool), format string) Mapper { - return DescriptionTimeFn(vFn, unixTimeEpochDate, format) +func FltActualUnixTime(format string) FltFn { + return FltActualDate(unixTimeEpochDate, format) } diff --git a/pkg/scalar/scalar_gen.go b/pkg/scalar/scalar_gen.go index ee1861b7..4e1e8b0e 100644 --- a/pkg/scalar/scalar_gen.go +++ b/pkg/scalar/scalar_gen.go @@ -8,34 +8,281 @@ import ( "github.com/wader/fq/pkg/bitio" ) -// Type BigInt +// Type Any +// does not use embedding for common fields as it works poorly with struct literals +type Any struct { + Sym any + Description string + Gap bool + Actual any +} -// TryActualBigInt try assert actual value is a BigInt and return result -func (s S) TryActualBigInt() (*big.Int, bool) { - v, ok := s.Actual.(*big.Int) +// interp.Scalarable +func (s Any) ScalarActual() any { return s.Actual } +func (s Any) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Any) ScalarSym() any { return s.Sym } +func (s Any) ScalarDescription() string { return s.Description } +func (s Any) ScalarGap() bool { return s.Gap } +func (s Any) ScalarDisplayFormat() DisplayFormat { return 0 } + +func AnyActual(v any) AnyMapper { + return AnyFn(func(s Any) (Any, error) { s.Actual = v; return s, nil }) +} +func AnySym(v any) AnyMapper { + return AnyFn(func(s Any) (Any, error) { s.Sym = v; return s, nil }) +} +func AnyDescription(v string) AnyMapper { + return AnyFn(func(s Any) (Any, error) { s.Description = v; return s, nil }) +} + +type AnyMapper interface { + MapAny(Any) (Any, error) +} + +// AnyFn map actual Any using f +type AnyFn func(s Any) (Any, error) + +func (fn AnyFn) MapAny(s Any) (Any, error) { + return fn(s) +} + +// AnyActualFn map actual Any using f +type AnyActualFn func(a any) any + +// TODO: error? +func (fn AnyActualFn) MapAny(s Any) (Any, error) { + s.Actual = fn(s.Actual) + return s, nil +} + +// AnySymFn map sym Any using f +type AnySymFn func(a any) any + +func (f AnySymFn) MapAny(s Any) (Any, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// AnyDescriptionFn map sym Any using f +type AnyDescriptionFn func(a string) string + +func (f AnyDescriptionFn) MapAny(s Any) (Any, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Any) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) return v, ok } -// ActualBigInt asserts actual value is a BigInt and returns it -func (s S) ActualBigInt() *big.Int { - v, ok := s.TryActualBigInt() +// SymAny asserts symbolic value is a Any and returns it +func (s Any) SymAny() any { + v, ok := s.TrySymAny() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as *big.Int", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) } return v } -// ActualBigIntFn map actual BigInt using f -type ActualBigIntFn func(a *big.Int) *big.Int - -func (fn ActualBigIntFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualBigInt()) - return s, nil +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Any) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) + return v, ok } // SymBigInt asserts symbolic value is a BigInt and returns it -func (s S) SymBigInt() *big.Int { +func (s Any) SymBigInt() *big.Int { v, ok := s.TrySymBigInt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Any) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} + +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Any) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s Any) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s Any) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Any) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s Any) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Any) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Any) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s Any) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s Any) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s Any) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s Any) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as any", s.Sym, s.Sym)) + } + return v +} + +// Type BigInt +// does not use embedding for common fields as it works poorly with struct literals +type BigInt struct { + Sym any + Description string + Gap bool + Actual *big.Int + DisplayFormat DisplayFormat +} + +// interp.Scalarable +func (s BigInt) ScalarActual() any { return s.Actual } +func (s BigInt) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s BigInt) ScalarSym() any { return s.Sym } +func (s BigInt) ScalarDescription() string { return s.Description } +func (s BigInt) ScalarGap() bool { return s.Gap } +func (s BigInt) ScalarDisplayFormat() DisplayFormat { return s.DisplayFormat } + +func BigIntActual(v *big.Int) BigIntMapper { + return BigIntFn(func(s BigInt) (BigInt, error) { s.Actual = v; return s, nil }) +} +func BigIntSym(v any) BigIntMapper { + return BigIntFn(func(s BigInt) (BigInt, error) { s.Sym = v; return s, nil }) +} +func BigIntDescription(v string) BigIntMapper { + return BigIntFn(func(s BigInt) (BigInt, error) { s.Description = v; return s, nil }) +} + +type BigIntMapper interface { + MapBigInt(BigInt) (BigInt, error) +} + +// BigIntFn map actual BigInt using f +type BigIntFn func(s BigInt) (BigInt, error) + +func (fn BigIntFn) MapBigInt(s BigInt) (BigInt, error) { + return fn(s) +} + +// BigIntActualFn map actual BigInt using f +type BigIntActualFn func(a *big.Int) *big.Int + +// TODO: error? +func (fn BigIntActualFn) MapBigInt(s BigInt) (BigInt, error) { + s.Actual = fn(s.Actual) + return s, nil +} + +// BigIntSymFn map sym BigInt using f +type BigIntSymFn func(a any) any + +func (f BigIntSymFn) MapBigInt(s BigInt) (BigInt, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// BigIntDescriptionFn map sym BigInt using f +type BigIntDescriptionFn func(a string) string + +func (f BigIntDescriptionFn) MapBigInt(s BigInt) (BigInt, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s BigInt) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s BigInt) SymAny() any { + v, ok := s.TrySymAny() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) } @@ -43,47 +290,211 @@ func (s S) SymBigInt() *big.Int { } // TrySymBigInt try assert symbolic value is a BigInt and return result -func (s S) TrySymBigInt() (*big.Int, bool) { +func (s BigInt) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint v, ok := s.Sym.(*big.Int) return v, ok } -// SymBigIntFn map sym BigInt using f -type SymBigIntFn func(a *big.Int) *big.Int - -func (f SymBigIntFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymBigInt()) - return s, nil -} - -// Type BitBuf - -// TryActualBitBuf try assert actual value is a BitBuf and return result -func (s S) TryActualBitBuf() (bitio.ReaderAtSeeker, bool) { - v, ok := s.Actual.(bitio.ReaderAtSeeker) - return v, ok -} - -// ActualBitBuf asserts actual value is a BitBuf and returns it -func (s S) ActualBitBuf() bitio.ReaderAtSeeker { - v, ok := s.TryActualBitBuf() +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s BigInt) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as bitio.ReaderAtSeeker", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) } return v } -// ActualBitBufFn map actual BitBuf using f -type ActualBitBufFn func(a bitio.ReaderAtSeeker) bitio.ReaderAtSeeker - -func (fn ActualBitBufFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualBitBuf()) - return s, nil +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s BigInt) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok } // SymBitBuf asserts symbolic value is a BitBuf and returns it -func (s S) SymBitBuf() bitio.ReaderAtSeeker { +func (s BigInt) SymBitBuf() bitio.ReaderAtSeeker { v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s BigInt) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s BigInt) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s BigInt) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s BigInt) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s BigInt) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s BigInt) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s BigInt) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s BigInt) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s BigInt) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s BigInt) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as *big.Int", s.Sym, s.Sym)) + } + return v +} + +// Type BitBuf +// does not use embedding for common fields as it works poorly with struct literals +type BitBuf struct { + Sym any + Description string + Gap bool + Actual bitio.ReaderAtSeeker +} + +// interp.Scalarable +func (s BitBuf) ScalarActual() any { return s.Actual } +func (s BitBuf) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s BitBuf) ScalarSym() any { return s.Sym } +func (s BitBuf) ScalarDescription() string { return s.Description } +func (s BitBuf) ScalarGap() bool { return s.Gap } +func (s BitBuf) ScalarDisplayFormat() DisplayFormat { return 0 } + +func BitBufActual(v bitio.ReaderAtSeeker) BitBufMapper { + return BitBufFn(func(s BitBuf) (BitBuf, error) { s.Actual = v; return s, nil }) +} +func BitBufSym(v any) BitBufMapper { + return BitBufFn(func(s BitBuf) (BitBuf, error) { s.Sym = v; return s, nil }) +} +func BitBufDescription(v string) BitBufMapper { + return BitBufFn(func(s BitBuf) (BitBuf, error) { s.Description = v; return s, nil }) +} + +type BitBufMapper interface { + MapBitBuf(BitBuf) (BitBuf, error) +} + +// BitBufFn map actual BitBuf using f +type BitBufFn func(s BitBuf) (BitBuf, error) + +func (fn BitBufFn) MapBitBuf(s BitBuf) (BitBuf, error) { + return fn(s) +} + +// BitBufActualFn map actual BitBuf using f +type BitBufActualFn func(a bitio.ReaderAtSeeker) bitio.ReaderAtSeeker + +// TODO: error? +func (fn BitBufActualFn) MapBitBuf(s BitBuf) (BitBuf, error) { + s.Actual = fn(s.Actual) + return s, nil +} + +// BitBufSymFn map sym BitBuf using f +type BitBufSymFn func(a any) any + +func (f BitBufSymFn) MapBitBuf(s BitBuf) (BitBuf, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// BitBufDescriptionFn map sym BitBuf using f +type BitBufDescriptionFn func(a string) string + +func (f BitBufDescriptionFn) MapBitBuf(s BitBuf) (BitBuf, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s BitBuf) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s BitBuf) SymAny() any { + v, ok := s.TrySymAny() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s BitBuf) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) + return v, ok +} + +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s BitBuf) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) } @@ -91,47 +502,211 @@ func (s S) SymBitBuf() bitio.ReaderAtSeeker { } // TrySymBitBuf try assert symbolic value is a BitBuf and return result -func (s S) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { +func (s BitBuf) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint v, ok := s.Sym.(bitio.ReaderAtSeeker) return v, ok } -// SymBitBufFn map sym BitBuf using f -type SymBitBufFn func(a bitio.ReaderAtSeeker) bitio.ReaderAtSeeker - -func (f SymBitBufFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymBitBuf()) - return s, nil -} - -// Type Bool - -// TryActualBool try assert actual value is a Bool and return result -func (s S) TryActualBool() (bool, bool) { - v, ok := s.Actual.(bool) - return v, ok -} - -// ActualBool asserts actual value is a Bool and returns it -func (s S) ActualBool() bool { - v, ok := s.TryActualBool() +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s BitBuf) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as bool", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) } return v } -// ActualBoolFn map actual Bool using f -type ActualBoolFn func(a bool) bool - -func (fn ActualBoolFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualBool()) - return s, nil +// TrySymBool try assert symbolic value is a Bool and return result +func (s BitBuf) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok } // SymBool asserts symbolic value is a Bool and returns it -func (s S) SymBool() bool { +func (s BitBuf) SymBool() bool { v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s BitBuf) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s BitBuf) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s BitBuf) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s BitBuf) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s BitBuf) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s BitBuf) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s BitBuf) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s BitBuf) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bitio.ReaderAtSeeker", s.Sym, s.Sym)) + } + return v +} + +// Type Bool +// does not use embedding for common fields as it works poorly with struct literals +type Bool struct { + Sym any + Description string + Gap bool + Actual bool +} + +// interp.Scalarable +func (s Bool) ScalarActual() any { return s.Actual } +func (s Bool) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Bool) ScalarSym() any { return s.Sym } +func (s Bool) ScalarDescription() string { return s.Description } +func (s Bool) ScalarGap() bool { return s.Gap } +func (s Bool) ScalarDisplayFormat() DisplayFormat { return 0 } + +func BoolActual(v bool) BoolMapper { + return BoolFn(func(s Bool) (Bool, error) { s.Actual = v; return s, nil }) +} +func BoolSym(v any) BoolMapper { + return BoolFn(func(s Bool) (Bool, error) { s.Sym = v; return s, nil }) +} +func BoolDescription(v string) BoolMapper { + return BoolFn(func(s Bool) (Bool, error) { s.Description = v; return s, nil }) +} + +type BoolMapper interface { + MapBool(Bool) (Bool, error) +} + +// BoolFn map actual Bool using f +type BoolFn func(s Bool) (Bool, error) + +func (fn BoolFn) MapBool(s Bool) (Bool, error) { + return fn(s) +} + +// BoolActualFn map actual Bool using f +type BoolActualFn func(a bool) bool + +// TODO: error? +func (fn BoolActualFn) MapBool(s Bool) (Bool, error) { + s.Actual = fn(s.Actual) + return s, nil +} + +// BoolSymFn map sym Bool using f +type BoolSymFn func(a any) any + +func (f BoolSymFn) MapBool(s Bool) (Bool, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// BoolDescriptionFn map sym Bool using f +type BoolDescriptionFn func(a string) string + +func (f BoolDescriptionFn) MapBool(s Bool) (Bool, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Bool) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s Bool) SymAny() any { + v, ok := s.TrySymAny() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Bool) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) + return v, ok +} + +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s Bool) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Bool) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} + +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Bool) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) } @@ -139,143 +714,636 @@ func (s S) SymBool() bool { } // TrySymBool try assert symbolic value is a Bool and return result -func (s S) TrySymBool() (bool, bool) { +func (s Bool) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint v, ok := s.Sym.(bool) return v, ok } -// SymBoolFn map sym Bool using f -type SymBoolFn func(a bool) bool - -func (f SymBoolFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymBool()) - return s, nil -} - -// Type F - -// TryActualF try assert actual value is a F and return result -func (s S) TryActualF() (float64, bool) { - v, ok := s.Actual.(float64) - return v, ok -} - -// ActualF asserts actual value is a F and returns it -func (s S) ActualF() float64 { - v, ok := s.TryActualF() +// SymBool asserts symbolic value is a Bool and returns it +func (s Bool) SymBool() bool { + v, ok := s.TrySymBool() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as float64", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) } return v } -// ActualFFn map actual F using f -type ActualFFn func(a float64) float64 +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Bool) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} -func (fn ActualFFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualF()) +// SymFlt asserts symbolic value is a Flt and returns it +func (s Bool) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Bool) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Bool) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s Bool) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s Bool) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s Bool) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s Bool) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as bool", s.Sym, s.Sym)) + } + return v +} + +// Type Flt +// does not use embedding for common fields as it works poorly with struct literals +type Flt struct { + Sym any + Description string + Gap bool + Actual float64 +} + +// interp.Scalarable +func (s Flt) ScalarActual() any { return s.Actual } +func (s Flt) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Flt) ScalarSym() any { return s.Sym } +func (s Flt) ScalarDescription() string { return s.Description } +func (s Flt) ScalarGap() bool { return s.Gap } +func (s Flt) ScalarDisplayFormat() DisplayFormat { return 0 } + +func FltActual(v float64) FltMapper { + return FltFn(func(s Flt) (Flt, error) { s.Actual = v; return s, nil }) +} +func FltSym(v any) FltMapper { + return FltFn(func(s Flt) (Flt, error) { s.Sym = v; return s, nil }) +} +func FltDescription(v string) FltMapper { + return FltFn(func(s Flt) (Flt, error) { s.Description = v; return s, nil }) +} + +type FltMapper interface { + MapFlt(Flt) (Flt, error) +} + +// FltFn map actual Flt using f +type FltFn func(s Flt) (Flt, error) + +func (fn FltFn) MapFlt(s Flt) (Flt, error) { + return fn(s) +} + +// FltActualFn map actual Flt using f +type FltActualFn func(a float64) float64 + +// TODO: error? +func (fn FltActualFn) MapFlt(s Flt) (Flt, error) { + s.Actual = fn(s.Actual) return s, nil } -// SymF asserts symbolic value is a F and returns it -func (s S) SymF() float64 { - v, ok := s.TrySymF() +// FltSymFn map sym Flt using f +type FltSymFn func(a any) any + +func (f FltSymFn) MapFlt(s Flt) (Flt, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// FltDescriptionFn map sym Flt using f +type FltDescriptionFn func(a string) string + +func (f FltDescriptionFn) MapFlt(s Flt) (Flt, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Flt) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s Flt) SymAny() any { + v, ok := s.TrySymAny() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) } return v } -// TrySymF try assert symbolic value is a F and return result -func (s S) TrySymF() (float64, bool) { - v, ok := s.Sym.(float64) +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Flt) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) return v, ok } -// SymFFn map sym F using f -type SymFFn func(a float64) float64 - -func (f SymFFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymF()) - return s, nil -} - -// Type S - -// TryActualS try assert actual value is a S and return result -func (s S) TryActualS() (int64, bool) { - v, ok := s.Actual.(int64) - return v, ok -} - -// ActualS asserts actual value is a S and returns it -func (s S) ActualS() int64 { - v, ok := s.TryActualS() +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s Flt) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as int64", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) } return v } -// ActualSFn map actual S using f -type ActualSFn func(a int64) int64 +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Flt) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} -func (fn ActualSFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualS()) +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Flt) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s Flt) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s Flt) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Flt) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s Flt) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Flt) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Flt) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s Flt) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s Flt) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s Flt) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s Flt) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as float64", s.Sym, s.Sym)) + } + return v +} + +// Type Sint +// does not use embedding for common fields as it works poorly with struct literals +type Sint struct { + Sym any + Description string + Gap bool + Actual int64 + DisplayFormat DisplayFormat +} + +// interp.Scalarable +func (s Sint) ScalarActual() any { return s.Actual } +func (s Sint) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Sint) ScalarSym() any { return s.Sym } +func (s Sint) ScalarDescription() string { return s.Description } +func (s Sint) ScalarGap() bool { return s.Gap } +func (s Sint) ScalarDisplayFormat() DisplayFormat { return s.DisplayFormat } + +func SintActual(v int64) SintMapper { + return SintFn(func(s Sint) (Sint, error) { s.Actual = v; return s, nil }) +} +func SintSym(v any) SintMapper { + return SintFn(func(s Sint) (Sint, error) { s.Sym = v; return s, nil }) +} +func SintDescription(v string) SintMapper { + return SintFn(func(s Sint) (Sint, error) { s.Description = v; return s, nil }) +} + +type SintMapper interface { + MapSint(Sint) (Sint, error) +} + +// SintFn map actual Sint using f +type SintFn func(s Sint) (Sint, error) + +func (fn SintFn) MapSint(s Sint) (Sint, error) { + return fn(s) +} + +// SintActualFn map actual Sint using f +type SintActualFn func(a int64) int64 + +// TODO: error? +func (fn SintActualFn) MapSint(s Sint) (Sint, error) { + s.Actual = fn(s.Actual) return s, nil } -// SymS asserts symbolic value is a S and returns it -func (s S) SymS() int64 { - v, ok := s.TrySymS() +// SintSymFn map sym Sint using f +type SintSymFn func(a any) any + +func (f SintSymFn) MapSint(s Sint) (Sint, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// SintDescriptionFn map sym Sint using f +type SintDescriptionFn func(a string) string + +func (f SintDescriptionFn) MapSint(s Sint) (Sint, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Sint) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s Sint) SymAny() any { + v, ok := s.TrySymAny() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) } return v } -// TrySymS try assert symbolic value is a S and return result -func (s S) TrySymS() (int64, bool) { - v, ok := s.Sym.(int64) +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Sint) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) return v, ok } -// SymSFn map sym S using f -type SymSFn func(a int64) int64 - -func (f SymSFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymS()) - return s, nil -} - -// Type Str - -// TryActualStr try assert actual value is a Str and return result -func (s S) TryActualStr() (string, bool) { - v, ok := s.Actual.(string) - return v, ok -} - -// ActualStr asserts actual value is a Str and returns it -func (s S) ActualStr() string { - v, ok := s.TryActualStr() +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s Sint) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as string", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) } return v } -// ActualStrFn map actual Str using f -type ActualStrFn func(a string) string +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Sint) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} -func (fn ActualStrFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualStr()) - return s, nil +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Sint) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s Sint) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s Sint) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Sint) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s Sint) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Sint) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Sint) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s Sint) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok } // SymStr asserts symbolic value is a Str and returns it -func (s S) SymStr() string { +func (s Sint) SymStr() string { v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s Sint) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} + +// SymUint asserts symbolic value is a Uint and returns it +func (s Sint) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as int64", s.Sym, s.Sym)) + } + return v +} + +// Type Str +// does not use embedding for common fields as it works poorly with struct literals +type Str struct { + Sym any + Description string + Gap bool + Actual string +} + +// interp.Scalarable +func (s Str) ScalarActual() any { return s.Actual } +func (s Str) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Str) ScalarSym() any { return s.Sym } +func (s Str) ScalarDescription() string { return s.Description } +func (s Str) ScalarGap() bool { return s.Gap } +func (s Str) ScalarDisplayFormat() DisplayFormat { return 0 } + +func StrActual(v string) StrMapper { + return StrFn(func(s Str) (Str, error) { s.Actual = v; return s, nil }) +} +func StrSym(v any) StrMapper { + return StrFn(func(s Str) (Str, error) { s.Sym = v; return s, nil }) +} +func StrDescription(v string) StrMapper { + return StrFn(func(s Str) (Str, error) { s.Description = v; return s, nil }) +} + +type StrMapper interface { + MapStr(Str) (Str, error) +} + +// StrFn map actual Str using f +type StrFn func(s Str) (Str, error) + +func (fn StrFn) MapStr(s Str) (Str, error) { + return fn(s) +} + +// StrActualFn map actual Str using f +type StrActualFn func(a string) string + +// TODO: error? +func (fn StrActualFn) MapStr(s Str) (Str, error) { + s.Actual = fn(s.Actual) + return s, nil +} + +// StrSymFn map sym Str using f +type StrSymFn func(a any) any + +func (f StrSymFn) MapStr(s Str) (Str, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// StrDescriptionFn map sym Str using f +type StrDescriptionFn func(a string) string + +func (f StrDescriptionFn) MapStr(s Str) (Str, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Str) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s Str) SymAny() any { + v, ok := s.TrySymAny() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Str) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) + return v, ok +} + +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s Str) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Str) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} + +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Str) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s Str) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s Str) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Str) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s Str) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Str) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Str) SymSint() int64 { + v, ok := s.TrySymSint() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) } @@ -283,354 +1351,513 @@ func (s S) SymStr() string { } // TrySymStr try assert symbolic value is a Str and return result -func (s S) TrySymStr() (string, bool) { +func (s Str) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint v, ok := s.Sym.(string) return v, ok } -// SymStrFn map sym Str using f -type SymStrFn func(a string) string - -func (f SymStrFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymStr()) - return s, nil -} - -// Type U - -// TryActualU try assert actual value is a U and return result -func (s S) TryActualU() (uint64, bool) { - v, ok := s.Actual.(uint64) - return v, ok -} - -// ActualU asserts actual value is a U and returns it -func (s S) ActualU() uint64 { - v, ok := s.TryActualU() +// SymStr asserts symbolic value is a Str and returns it +func (s Str) SymStr() string { + v, ok := s.TrySymStr() if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as uint64", s.Actual, s.Actual)) + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) } return v } -// ActualUFn map actual U using f -type ActualUFn func(a uint64) uint64 +// TrySymUint try assert symbolic value is a Uint and return result +func (s Str) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(uint64) + return v, ok +} -func (fn ActualUFn) MapScalar(s S) (S, error) { - s.Actual = fn(s.ActualU()) +// SymUint asserts symbolic value is a Uint and returns it +func (s Str) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as string", s.Sym, s.Sym)) + } + return v +} + +// Type Uint +// does not use embedding for common fields as it works poorly with struct literals +type Uint struct { + Sym any + Description string + Gap bool + Actual uint64 + DisplayFormat DisplayFormat +} + +// interp.Scalarable +func (s Uint) ScalarActual() any { return s.Actual } +func (s Uint) ScalarValue() any { + if s.Sym != nil { + return s.Sym + } + return s.Actual +} +func (s Uint) ScalarSym() any { return s.Sym } +func (s Uint) ScalarDescription() string { return s.Description } +func (s Uint) ScalarGap() bool { return s.Gap } +func (s Uint) ScalarDisplayFormat() DisplayFormat { return s.DisplayFormat } + +func UintActual(v uint64) UintMapper { + return UintFn(func(s Uint) (Uint, error) { s.Actual = v; return s, nil }) +} +func UintSym(v any) UintMapper { + return UintFn(func(s Uint) (Uint, error) { s.Sym = v; return s, nil }) +} +func UintDescription(v string) UintMapper { + return UintFn(func(s Uint) (Uint, error) { s.Description = v; return s, nil }) +} + +type UintMapper interface { + MapUint(Uint) (Uint, error) +} + +// UintFn map actual Uint using f +type UintFn func(s Uint) (Uint, error) + +func (fn UintFn) MapUint(s Uint) (Uint, error) { + return fn(s) +} + +// UintActualFn map actual Uint using f +type UintActualFn func(a uint64) uint64 + +// TODO: error? +func (fn UintActualFn) MapUint(s Uint) (Uint, error) { + s.Actual = fn(s.Actual) return s, nil } -// SymU asserts symbolic value is a U and returns it -func (s S) SymU() uint64 { - v, ok := s.TrySymU() +// UintSymFn map sym Uint using f +type UintSymFn func(a any) any + +func (f UintSymFn) MapUint(s Uint) (Uint, error) { + s.Sym = f(s.Sym) + return s, nil +} + +// UintDescriptionFn map sym Uint using f +type UintDescriptionFn func(a string) string + +func (f UintDescriptionFn) MapUint(s Uint) (Uint, error) { + s.Description = f(s.Description) + return s, nil +} + +// TrySymAny try assert symbolic value is a Any and return result +func (s Uint) TrySymAny() (any, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(any) + return v, ok +} + +// SymAny asserts symbolic value is a Any and returns it +func (s Uint) SymAny() any { + v, ok := s.TrySymAny() if !ok { panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) } return v } -// TrySymU try assert symbolic value is a U and return result -func (s S) TrySymU() (uint64, bool) { +// TrySymBigInt try assert symbolic value is a BigInt and return result +func (s Uint) TrySymBigInt() (*big.Int, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(*big.Int) + return v, ok +} + +// SymBigInt asserts symbolic value is a BigInt and returns it +func (s Uint) SymBigInt() *big.Int { + v, ok := s.TrySymBigInt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymBitBuf try assert symbolic value is a BitBuf and return result +func (s Uint) TrySymBitBuf() (bitio.ReaderAtSeeker, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bitio.ReaderAtSeeker) + return v, ok +} + +// SymBitBuf asserts symbolic value is a BitBuf and returns it +func (s Uint) SymBitBuf() bitio.ReaderAtSeeker { + v, ok := s.TrySymBitBuf() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymBool try assert symbolic value is a Bool and return result +func (s Uint) TrySymBool() (bool, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(bool) + return v, ok +} + +// SymBool asserts symbolic value is a Bool and returns it +func (s Uint) SymBool() bool { + v, ok := s.TrySymBool() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymFlt try assert symbolic value is a Flt and return result +func (s Uint) TrySymFlt() (float64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(float64) + return v, ok +} + +// SymFlt asserts symbolic value is a Flt and returns it +func (s Uint) SymFlt() float64 { + v, ok := s.TrySymFlt() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymSint try assert symbolic value is a Sint and return result +func (s Uint) TrySymSint() (int64, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(int64) + return v, ok +} + +// SymSint asserts symbolic value is a Sint and returns it +func (s Uint) SymSint() int64 { + v, ok := s.TrySymSint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymStr try assert symbolic value is a Str and return result +func (s Uint) TrySymStr() (string, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.(string) + return v, ok +} + +// SymStr asserts symbolic value is a Str and returns it +func (s Uint) SymStr() string { + v, ok := s.TrySymStr() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v +} + +// TrySymUint try assert symbolic value is a Uint and return result +func (s Uint) TrySymUint() (uint64, bool) { + //nolint:gosimple,nolintlint v, ok := s.Sym.(uint64) return v, ok } -// SymUFn map sym U using f -type SymUFn func(a uint64) uint64 - -func (f SymUFn) MapScalar(s S) (S, error) { - s.Sym = f(s.SymU()) - return s, nil +// SymUint asserts symbolic value is a Uint and returns it +func (s Uint) SymUint() uint64 { + v, ok := s.TrySymUint() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as uint64", s.Sym, s.Sym)) + } + return v } -// Map Bool -> Scalar -type BoolToScalar map[bool]S +// Map Bool +type BoolMap map[bool]Bool -func (m BoolToScalar) MapScalar(s S) (S, error) { - a := s.ActualBool() - if ns, ok := m[a]; ok { - ns.Actual = a - s = ns +func (m BoolMap) MapBool(s Bool) (Bool, error) { + if ns, ok := m[s.Actual]; ok { + ns.Actual = s.Actual + return ns, nil } return s, nil } -// Map Bool -> Description -type BoolToDescription map[bool]string +// Map Bool description +type BoolMapDescription map[bool]string -func (m BoolToDescription) MapScalar(s S) (S, error) { - a := s.ActualBool() - if d, ok := m[a]; ok { +func (m BoolMapDescription) MapBool(s Bool) (Bool, error) { + if d, ok := m[s.Actual]; ok { s.Description = d } return s, nil } -// Map Bool -> Sym Bool -type BoolToSymBool map[bool]bool +// Map Bool sym Bool +type BoolMapSymBool map[bool]bool -func (m BoolToSymBool) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualBool()]; ok { +func (m BoolMapSymBool) MapBool(s Bool) (Bool, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Bool -> Sym F -type BoolToSymF map[bool]float64 +// Map Bool sym Flt +type BoolMapSymFlt map[bool]float64 -func (m BoolToSymF) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualBool()]; ok { +func (m BoolMapSymFlt) MapBool(s Bool) (Bool, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Bool -> Sym S -type BoolToSymS map[bool]int64 +// Map Bool sym Sint +type BoolMapSymSint map[bool]int64 -func (m BoolToSymS) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualBool()]; ok { +func (m BoolMapSymSint) MapBool(s Bool) (Bool, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Bool -> Sym Str -type BoolToSymStr map[bool]string +// Map Bool sym Str +type BoolMapSymStr map[bool]string -func (m BoolToSymStr) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualBool()]; ok { +func (m BoolMapSymStr) MapBool(s Bool) (Bool, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Bool -> Sym U -type BoolToSymU map[bool]uint64 +// Map Bool sym Uint +type BoolMapSymUint map[bool]uint64 -func (m BoolToSymU) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualBool()]; ok { +func (m BoolMapSymUint) MapBool(s Bool) (Bool, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map S -> Scalar -type SToScalar map[int64]S +// Map Sint +type SintMap map[int64]Sint -func (m SToScalar) MapScalar(s S) (S, error) { - a := s.ActualS() - if ns, ok := m[a]; ok { - ns.Actual = a - s = ns +func (m SintMap) MapSint(s Sint) (Sint, error) { + if ns, ok := m[s.Actual]; ok { + ns.Actual = s.Actual + return ns, nil } return s, nil } -// Map S -> Description -type SToDescription map[int64]string +// Map Sint description +type SintMapDescription map[int64]string -func (m SToDescription) MapScalar(s S) (S, error) { - a := s.ActualS() - if d, ok := m[a]; ok { +func (m SintMapDescription) MapSint(s Sint) (Sint, error) { + if d, ok := m[s.Actual]; ok { s.Description = d } return s, nil } -// Map S -> Sym Bool -type SToSymBool map[int64]bool +// Map Sint sym Bool +type SintMapSymBool map[int64]bool -func (m SToSymBool) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualS()]; ok { +func (m SintMapSymBool) MapSint(s Sint) (Sint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map S -> Sym F -type SToSymF map[int64]float64 +// Map Sint sym Flt +type SintMapSymFlt map[int64]float64 -func (m SToSymF) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualS()]; ok { +func (m SintMapSymFlt) MapSint(s Sint) (Sint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map S -> Sym S -type SToSymS map[int64]int64 +// Map Sint sym Sint +type SintMapSymSint map[int64]int64 -func (m SToSymS) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualS()]; ok { +func (m SintMapSymSint) MapSint(s Sint) (Sint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map S -> Sym Str -type SToSymStr map[int64]string +// Map Sint sym Str +type SintMapSymStr map[int64]string -func (m SToSymStr) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualS()]; ok { +func (m SintMapSymStr) MapSint(s Sint) (Sint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map S -> Sym U -type SToSymU map[int64]uint64 +// Map Sint sym Uint +type SintMapSymUint map[int64]uint64 -func (m SToSymU) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualS()]; ok { +func (m SintMapSymUint) MapSint(s Sint) (Sint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Str -> Scalar -type StrToScalar map[string]S +// Map Str +type StrMap map[string]Str -func (m StrToScalar) MapScalar(s S) (S, error) { - a := s.ActualStr() - if ns, ok := m[a]; ok { - ns.Actual = a - s = ns +func (m StrMap) MapStr(s Str) (Str, error) { + if ns, ok := m[s.Actual]; ok { + ns.Actual = s.Actual + return ns, nil } return s, nil } -// Map Str -> Description -type StrToDescription map[string]string +// Map Str description +type StrMapDescription map[string]string -func (m StrToDescription) MapScalar(s S) (S, error) { - a := s.ActualStr() - if d, ok := m[a]; ok { +func (m StrMapDescription) MapStr(s Str) (Str, error) { + if d, ok := m[s.Actual]; ok { s.Description = d } return s, nil } -// Map Str -> Sym Bool -type StrToSymBool map[string]bool +// Map Str sym Bool +type StrMapSymBool map[string]bool -func (m StrToSymBool) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualStr()]; ok { +func (m StrMapSymBool) MapStr(s Str) (Str, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Str -> Sym F -type StrToSymF map[string]float64 +// Map Str sym Flt +type StrMapSymFlt map[string]float64 -func (m StrToSymF) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualStr()]; ok { +func (m StrMapSymFlt) MapStr(s Str) (Str, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Str -> Sym S -type StrToSymS map[string]int64 +// Map Str sym Sint +type StrMapSymSint map[string]int64 -func (m StrToSymS) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualStr()]; ok { +func (m StrMapSymSint) MapStr(s Str) (Str, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Str -> Sym Str -type StrToSymStr map[string]string +// Map Str sym Str +type StrMapSymStr map[string]string -func (m StrToSymStr) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualStr()]; ok { +func (m StrMapSymStr) MapStr(s Str) (Str, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map Str -> Sym U -type StrToSymU map[string]uint64 +// Map Str sym Uint +type StrMapSymUint map[string]uint64 -func (m StrToSymU) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualStr()]; ok { +func (m StrMapSymUint) MapStr(s Str) (Str, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map U -> Scalar -type UToScalar map[uint64]S +// Map Uint +type UintMap map[uint64]Uint -func (m UToScalar) MapScalar(s S) (S, error) { - a := s.ActualU() - if ns, ok := m[a]; ok { - ns.Actual = a - s = ns +func (m UintMap) MapUint(s Uint) (Uint, error) { + if ns, ok := m[s.Actual]; ok { + ns.Actual = s.Actual + return ns, nil } return s, nil } -// Map U -> Description -type UToDescription map[uint64]string +// Map Uint description +type UintMapDescription map[uint64]string -func (m UToDescription) MapScalar(s S) (S, error) { - a := s.ActualU() - if d, ok := m[a]; ok { +func (m UintMapDescription) MapUint(s Uint) (Uint, error) { + if d, ok := m[s.Actual]; ok { s.Description = d } return s, nil } -// Map U -> Sym Bool -type UToSymBool map[uint64]bool +// Map Uint sym Bool +type UintMapSymBool map[uint64]bool -func (m UToSymBool) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualU()]; ok { +func (m UintMapSymBool) MapUint(s Uint) (Uint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map U -> Sym F -type UToSymF map[uint64]float64 +// Map Uint sym Flt +type UintMapSymFlt map[uint64]float64 -func (m UToSymF) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualU()]; ok { +func (m UintMapSymFlt) MapUint(s Uint) (Uint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map U -> Sym S -type UToSymS map[uint64]int64 +// Map Uint sym Sint +type UintMapSymSint map[uint64]int64 -func (m UToSymS) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualU()]; ok { +func (m UintMapSymSint) MapUint(s Uint) (Uint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map U -> Sym Str -type UToSymStr map[uint64]string +// Map Uint sym Str +type UintMapSymStr map[uint64]string -func (m UToSymStr) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualU()]; ok { +func (m UintMapSymStr) MapUint(s Uint) (Uint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil } -// Map U -> Sym U -type UToSymU map[uint64]uint64 +// Map Uint sym Uint +type UintMapSymUint map[uint64]uint64 -func (m UToSymU) MapScalar(s S) (S, error) { - if t, ok := m[s.ActualU()]; ok { +func (m UintMapSymUint) MapUint(s Uint) (Uint, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil diff --git a/pkg/scalar/scalar_gen.go.tmpl b/pkg/scalar/scalar_gen.go.tmpl index a2299a5c..0a7c5992 100644 --- a/pkg/scalar/scalar_gen.go.tmpl +++ b/pkg/scalar/scalar_gen.go.tmpl @@ -10,83 +10,126 @@ import ( {{- range $name, $t := $.types }} // Type {{$name}} - - // TryActual{{$name}} try assert actual value is a {{$name}} and return result - func (s S) TryActual{{$name}}() ({{$t.go_type}}, bool) { - v, ok := s.Actual.({{$t.go_type}}) - return v, ok + // does not use embedding for common fields as it works poorly with struct literals + type {{$name}} struct { + Sym any + Description string + Gap bool + Actual {{$t.go_type}} + {{- if $t.display_format}} + DisplayFormat DisplayFormat + {{- end}} } - // Actual{{$name}} asserts actual value is a {{$name}} and returns it - func (s S) Actual{{$name}}() {{$t.go_type}} { - v, ok := s.TryActual{{$name}}() - if !ok { - panic(fmt.Sprintf("failed to type assert s.Actual %v (%T) as {{$t.go_type}}", s.Actual, s.Actual)) + // interp.Scalarable + func (s {{$name}}) ScalarActual() any { return s.Actual } + func (s {{$name}}) ScalarValue() any { + if s.Sym != nil { + return s.Sym } - return v + return s.Actual + } + func (s {{$name}}) ScalarSym() any { return s.Sym } + func (s {{$name}}) ScalarDescription() string { return s.Description } + func (s {{$name}}) ScalarGap() bool { return s.Gap } + {{- if $t.display_format}} + func (s {{$name}}) ScalarDisplayFormat() DisplayFormat { return s.DisplayFormat } + {{- else }} + func (s {{$name}}) ScalarDisplayFormat() DisplayFormat { return 0 } + {{- end}} + + func {{$name}}Actual(v {{$t.go_type}}) {{$name}}Mapper { + return {{$name}}Fn(func(s {{$name}}) ({{$name}}, error) { s.Actual = v; return s, nil }) + } + func {{$name}}Sym(v any) {{$name}}Mapper { + return {{$name}}Fn(func(s {{$name}}) ({{$name}}, error) { s.Sym = v; return s, nil }) + } + func {{$name}}Description(v string) {{$name}}Mapper { + return {{$name}}Fn(func(s {{$name}}) ({{$name}}, error) { s.Description = v; return s, nil }) } - // Actual{{$name}}Fn map actual {{$name}} using f - type Actual{{$name}}Fn func(a {{$t.go_type}}) {{$t.go_type}} + type {{$name}}Mapper interface { + Map{{$name}}({{$name}}) ({{$name}}, error) + } - func (fn Actual{{$name}}Fn) MapScalar(s S) (S, error) { - s.Actual = fn(s.Actual{{$name}}()) + // {{$name}}Fn map actual {{$name}} using f + type {{$name}}Fn func(s {{$name}}) ({{$name}}, error) + + func (fn {{$name}}Fn) Map{{$name}}(s {{$name}}) ({{$name}}, error) { + return fn(s) + } + + // {{$name}}ActualFn map actual {{$name}} using f + type {{$name}}ActualFn func(a {{$t.go_type}}) {{$t.go_type}} + + // TODO: error? + func (fn {{$name}}ActualFn) Map{{$name}}(s {{$name}}) ({{$name}}, error) { + s.Actual = fn(s.Actual) return s, nil } - // Sym{{$name}} asserts symbolic value is a {{$name}} and returns it - func (s S) Sym{{$name}}() {{$t.go_type}} { - v, ok := s.TrySym{{$name}}() - if !ok { - panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as {{$t.go_type}}", s.Sym, s.Sym)) - } - return v - } + // {{$name}}SymFn map sym {{$name}} using f + type {{$name}}SymFn func(a any) any - // TrySym{{$name}} try assert symbolic value is a {{$name}} and return result - func (s S) TrySym{{$name}}() ({{$t.go_type}}, bool) { - v, ok := s.Sym.({{$t.go_type}}) - return v, ok - } - - // Sym{{$name}}Fn map sym {{$name}} using f - type Sym{{$name}}Fn func(a {{$t.go_type}}) {{$t.go_type}} - - func (f Sym{{$name}}Fn) MapScalar(s S) (S, error) { - s.Sym = f(s.Sym{{$name}}()) + func (f {{$name}}SymFn) Map{{$name}}(s {{$name}}) ({{$name}}, error) { + s.Sym = f(s.Sym) return s, nil } + + // {{$name}}DescriptionFn map sym {{$name}} using f + type {{$name}}DescriptionFn func(a string) string + + func (f {{$name}}DescriptionFn) Map{{$name}}(s {{$name}}) ({{$name}}, error) { + s.Description = f(s.Description) + return s, nil + } + + {{- range $sym_name, $sym_t := $.types }} + // TrySym{{$sym_name}} try assert symbolic value is a {{$sym_name}} and return result + func (s {{$name}}) TrySym{{$sym_name}}() ({{$sym_t.go_type}}, bool) { + //nolint:gosimple,nolintlint + v, ok := s.Sym.({{$sym_t.go_type}}) + return v, ok + } + + // Sym{{$sym_name}} asserts symbolic value is a {{$sym_name}} and returns it + func (s {{$name}}) Sym{{$sym_name}}() {{$sym_t.go_type}} { + v, ok := s.TrySym{{$sym_name}}() + if !ok { + panic(fmt.Sprintf("failed to type assert s.Sym %v (%T) as {{$t.go_type}}", s.Sym, s.Sym)) + } + return v + } + {{- end}} {{end}} {{- range $from_name, $from := $.types }} - {{- if ne $from.map_from false}} - // Map {{$from_name}} -> Scalar - type {{$from_name}}ToScalar map[{{$from.go_type}}]S - func (m {{$from_name}}ToScalar) MapScalar(s S) (S, error) { - a := s.Actual{{$from_name}}() - if ns, ok := m[a]; ok { - ns.Actual = a - s = ns + {{- if $from.map_from}} + // Map {{$from_name}} + type {{$from_name}}Map map[{{$from.go_type}}]{{$from_name}} + func (m {{$from_name}}Map) Map{{$from_name}}(s {{$from_name}}) ({{$from_name}}, error) { + if ns, ok := m[s.Actual]; ok { + ns.Actual = s.Actual + return ns, nil } return s, nil } - // Map {{$from_name}} -> Description - type {{$from_name}}ToDescription map[{{$from.go_type}}]string - func (m {{$from_name}}ToDescription) MapScalar(s S) (S, error) { - a := s.Actual{{$from_name}}() - if d, ok := m[a]; ok { + // Map {{$from_name}} description + type {{$from_name}}MapDescription map[{{$from.go_type}}]string + func (m {{$from_name}}MapDescription) Map{{$from_name}}(s {{$from_name}}) ({{$from_name}}, error) { + if d, ok := m[s.Actual]; ok { s.Description = d } return s, nil } {{- range $to_name, $to := $.types }} - {{- if ne $to.map_to false}} - // Map {{$from_name}} -> Sym {{$to_name}} - type {{$from_name}}ToSym{{$to_name}} map[{{$from.go_type}}]{{$to.go_type}} - func (m {{$from_name}}ToSym{{$to_name}}) MapScalar(s S) (S, error) { - if t, ok := m[s.Actual{{$from_name}}()]; ok { + {{- if $to.map_to}} + // Map {{$from_name}} sym {{$to_name}} + type {{$from_name}}MapSym{{$to_name}} map[{{$from.go_type}}]{{$to.go_type}} + func (m {{$from_name}}MapSym{{$to_name}}) Map{{$from_name}}(s {{$from_name}}) ({{$from_name}}, error) { + if t, ok := m[s.Actual]; ok { s.Sym = t } return s, nil