├── vendor ├── github.com │ ├── rs │ │ └── zerolog │ │ │ ├── CNAME │ │ │ ├── _config.yml │ │ │ ├── not_go112.go │ │ │ ├── pretty.png │ │ │ ├── go112.go │ │ │ ├── .gitignore │ │ │ ├── internal │ │ │ ├── cbor │ │ │ │ └── base.go │ │ │ └── json │ │ │ │ └── base.go │ │ │ ├── encoder_json.go │ │ │ ├── encoder_cbor.go │ │ │ ├── LICENSE │ │ │ └── ctx.go │ ├── mattn │ │ ├── go-isatty │ │ │ ├── doc.go │ │ │ ├── go.test.sh │ │ │ ├── isatty_others.go │ │ │ ├── isatty_tcgets.go │ │ │ ├── isatty_plan9.go │ │ │ ├── isatty_bsd.go │ │ │ ├── isatty_solaris.go │ │ │ ├── LICENSE │ │ │ └── README.md │ │ └── go-colorable │ │ │ ├── go.test.sh │ │ │ ├── colorable_appengine.go │ │ │ ├── colorable_others.go │ │ │ ├── LICENSE │ │ │ └── noncolorable.go │ └── x448 │ │ └── float16 │ │ ├── .travis.yml │ │ └── LICENSE ├── golang.org │ └── x │ │ └── sys │ │ ├── unix │ │ ├── .gitignore │ │ ├── ptrace_ios.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── ptrace_darwin.go │ │ ├── constants.go │ │ ├── endian_big.go │ │ ├── sysvshm_unix_other.go │ │ ├── asm_aix_ppc64.s │ │ ├── syscall_linux_gc_arm.go │ │ ├── endian_little.go │ │ ├── asm_solaris_amd64.s │ │ ├── readdirent_getdents.go │ │ ├── pagesize_unix.go │ │ ├── aliases.go │ │ ├── fcntl_linux_32bit.go │ │ ├── gccgo_linux_amd64.go │ │ ├── syscall_linux_gc.go │ │ ├── syscall_linux_alarm.go │ │ ├── sockcmsg_dragonfly.go │ │ ├── sysvshm_linux.go │ │ ├── syscall_linux_gc_386.go │ │ ├── syscall_linux_gccgo_arm.go │ │ ├── race0.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix_gc.go │ │ ├── race.go │ │ ├── readdirent_getdirentries.go │ │ ├── zptrace_linux_arm64.go │ │ ├── asm_openbsd_mips64.s │ │ ├── bluetooth_linux.go │ │ ├── asm_bsd_arm.s │ │ ├── dev_darwin.go │ │ ├── env_unix.go │ │ ├── asm_bsd_386.s │ │ ├── dev_aix_ppc.go │ │ ├── asm_bsd_arm64.s │ │ ├── asm_bsd_riscv64.s │ │ ├── asm_bsd_ppc64.s │ │ ├── asm_bsd_amd64.s │ │ ├── fcntl_darwin.go │ │ ├── syscall_unix_gc_ppc64x.go │ │ ├── dev_zos.go │ │ ├── fdset.go │ │ ├── dev_aix_ppc64.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_netbsd_arm64.go │ │ ├── dev_netbsd.go │ │ ├── dev_openbsd.go │ │ ├── dev_freebsd.go │ │ ├── syscall_openbsd_mips64.go │ │ ├── syscall_linux_gccgo_386.go │ │ ├── dev_dragonfly.go │ │ ├── asm_linux_ppc64x.s │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_openbsd_arm64.go │ │ ├── syscall_openbsd_ppc64.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_arm.go │ │ ├── syscall_openbsd_riscv64.go │ │ ├── unveil_openbsd.go │ │ ├── syscall_openbsd_libc.go │ │ ├── asm_linux_riscv64.s │ │ ├── fcntl.go │ │ ├── asm_linux_arm64.s │ │ ├── syscall_darwin_libSystem.go │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_s390x.s │ │ ├── zptrace_armnn_linux.go │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_loong64.s │ │ ├── asm_linux_amd64.s │ │ └── asm_linux_mips64x.s │ │ └── PATENTS └── modules.txt ├── .gitattributes ├── srec19 ├── tokens.go └── data.go ├── go.mod ├── ToDo.txt ├── ihex32 ├── data.go └── tokens.go ├── a2l ├── root.go ├── discrete.go ├── read_only.go ├── read_write.go ├── sign_extend.go ├── consistent_exchange.go ├── static_address_offsets.go ├── guard_rails.go ├── cpu_type.go ├── epk.go ├── ref_unit.go ├── user.go ├── ecu.go ├── formula_inv.go ├── phone_no.go ├── phys_unit.go ├── symbol_type_link.go ├── error_mask.go ├── customer.go ├── compu_tab_ref.go ├── customer_no.go ├── format.go ├── ecu_address.go ├── supplier.go ├── var_measurement.go ├── project_no.go ├── var_separator.go ├── version.go ├── curve_axis_ref.go ├── addr_epk.go ├── ref_memory_segment.go ├── default_value.go ├── deposit.go ├── comparison_quantity.go ├── var_naming.go ├── calibration_handle_text.go ├── display_identifier.go ├── a2ml.go ├── a2ml_test.go ├── annotation_label.go ├── layout.go ├── function_version.go ├── monotony.go ├── var_selection_characteristic.go ├── annotation_origin.go ├── byte_order.go ├── if_data.go ├── map_list.go ├── number.go ├── data_size.go ├── step_size.go ├── function_list.go ├── max_grad.go ├── var_address.go ├── left_shift.go ├── ref_group.go ├── sub_group.go ├── right_shift.go ├── sub_function.go ├── virtual.go ├── no_of_interfaces.go ├── in_measurement.go ├── loc_measurement.go ├── out_measurement.go ├── ref_measurement.go ├── def_characteristic.go ├── ref_characteristic.go ├── default_value_numeric.go ├── transformer_in_object.go ├── ar_prototype_of.go ├── transformer_out_object.go ├── fix_no_axis_pts_4.go ├── fix_no_axis_pts_5.go ├── fix_no_axis_pts_x.go ├── fix_no_axis_pts_y.go ├── fix_no_axis_pts_z.go ├── system_constant.go ├── static_record_layout.go ├── annotation_text.go ├── formula.go ├── array_size.go ├── fix_axis_par_list.go ├── addr_epk_test.go ├── frame_measurement.go ├── symbol_link.go ├── virtual_characteristic.go ├── dependent_characteristic.go ├── annotation_label_test.go ├── annotation_origin_test.go ├── alignment_byte.go ├── alignment_long.go ├── alignment_word.go ├── coeffs_linear.go ├── alignment_int64.go ├── ecu_calibration_offset.go ├── annotation_text_test.go └── calibration_handle.go ├── .github └── workflows │ ├── a2l-fuzzing.yml │ ├── ihex32-fuzzing.yml │ ├── srec19-fuzzing.yml │ ├── go-build-test-and-license.yml │ ├── codacy-coverage.yml │ └── devskim-analysis.yml ├── SECURITY.md ├── reserved.go ├── .gitignore ├── identification.go ├── no_rescale_x.go ├── LICENSE ├── licenses └── github.com │ ├── rs │ └── zerolog │ │ └── LICENSE │ └── asap2Go │ └── calibrationReader │ └── LICENSE └── go.sum /vendor/github.com/rs/zerolog/CNAME: -------------------------------------------------------------------------------- 1 | zerolog.io -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/_config.yml: -------------------------------------------------------------------------------- 1 | remote_theme: rs/gh-readme 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /srec19/tokens.go: -------------------------------------------------------------------------------- 1 | package srec19 2 | 3 | //const emptyToken = "" 4 | const beginLineToken = "S" 5 | const dataRecordToken = "3" 6 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/not_go112.go: -------------------------------------------------------------------------------- 1 | // +build !go1.12 2 | 3 | package zerolog 4 | 5 | const contextCallerSkipFrameCount = 3 6 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/pretty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asap2Go/calibrationReader/HEAD/vendor/github.com/rs/zerolog/pretty.png -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/go112.go: -------------------------------------------------------------------------------- 1 | // +build go1.12 2 | 3 | package zerolog 4 | 5 | // Since go 1.12, some auto generated init functions are hidden from 6 | // runtime.Caller. 7 | const contextCallerSkipFrameCount = 2 8 | -------------------------------------------------------------------------------- /vendor/github.com/x448/float16/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.11.x 5 | 6 | env: 7 | - GO111MODULE=on 8 | 9 | script: 10 | - go test -short -coverprofile=coverage.txt -covermode=count ./... 11 | 12 | after_success: 13 | - bash <(curl -s https://codecov.io/bash) 14 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/asap2Go/calibrationReader 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/rs/zerolog v1.28.0 7 | github.com/x448/float16 v0.8.4 8 | ) 9 | 10 | require ( 11 | github.com/mattn/go-colorable v0.1.12 // indirect 12 | github.com/mattn/go-isatty v0.0.14 // indirect 13 | golang.org/x/sys v0.1.0 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /ToDo.txt: -------------------------------------------------------------------------------- 1 | -Implement methods for axis_pts, axis_descr, record_layout and fnc_values to get the values for a Characteristic 2 | -Sort Tokens and tokenList 3 | -Add comments in a2l package documenting the function and context of the individual objects (continuing from "blob.go") 4 | -Add Fuzzing with Go 1.18 5 | -Create GUI similar to ETAS' A2L-Clip or other tools(?) -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/go.test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v vendor); do 7 | go test -race -coverprofile=profile.out -covermode=atomic "$d" 8 | if [ -f profile.out ]; then 9 | cat profile.out >> coverage.txt 10 | rm profile.out 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/go.test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v vendor); do 7 | go test -race -coverprofile=profile.out -covermode=atomic "$d" 8 | if [ -f profile.out ]; then 9 | cat profile.out >> coverage.txt 10 | rm profile.out 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /ihex32/data.go: -------------------------------------------------------------------------------- 1 | package ihex32 2 | 3 | //dataByte contains a 32bit address (as is standard for ihex32) and its corresponding byte value. 4 | //it is just used as a helper value for the parser. 5 | //the final datastructure returned by parseHex uses a map as it is more efficient for searching a given value. 6 | type dataByte struct { 7 | address uint32 8 | value byte 9 | } 10 | -------------------------------------------------------------------------------- /srec19/data.go: -------------------------------------------------------------------------------- 1 | package srec19 2 | 3 | //dataByte contains a 32bit address (as is standard for ihex32) and its corresponding byte value. 4 | //it is just used as a helper value for the parser. 5 | //the final datastructure returned by parseHex uses a map as it is more efficient for searching a given value. 6 | type dataByte struct { 7 | address uint32 8 | value byte 9 | } 10 | -------------------------------------------------------------------------------- /ihex32/tokens.go: -------------------------------------------------------------------------------- 1 | package ihex32 2 | 3 | //const emptyToken = "" 4 | const beginLineToken = ":" 5 | const dataRecordToken = "00" 6 | 7 | //const endOfFileToken = "01" 8 | 9 | //const extendedSegmentAddressRecordToken = "02" 10 | //const startSegmentAddressRecordToken = "03" 11 | const extendedLinearAddressRecordToken = "04" 12 | 13 | //const startLinearAddressRecordToken = "05" 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_ios.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ios 6 | // +build ios 7 | 8 | package unix 9 | 10 | func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { 11 | return ENOTSUP 12 | } 13 | -------------------------------------------------------------------------------- /a2l/root.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type rootKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseRoot(tok *tokenGenerator) (rootKeyword, error) { 11 | r := rootKeyword{} 12 | var err error 13 | if !r.valueSet { 14 | r.value = true 15 | r.valueSet = true 16 | log.Info().Msg("root value successfully parsed") 17 | } 18 | return r, err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | tmp 10 | 11 | # Architecture specific extensions/prefixes 12 | *.[568vq] 13 | [568vq].out 14 | 15 | *.cgo1.go 16 | *.cgo2.c 17 | _cgo_defun.c 18 | _cgo_gotypes.go 19 | _cgo_export.* 20 | 21 | _testmain.go 22 | 23 | *.exe 24 | *.test 25 | *.prof 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && linux && gc 6 | // +build amd64,linux,gc 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | // +build darwin,!ios 7 | 8 | package unix 9 | 10 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 11 | return ptrace1(request, pid, addr, data) 12 | } 13 | -------------------------------------------------------------------------------- /a2l/discrete.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type discreteKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseDiscrete(tok *tokenGenerator) (discreteKeyword, error) { 11 | d := discreteKeyword{} 12 | var err error 13 | if !d.valueSet { 14 | d.value = true 15 | d.valueSet = true 16 | log.Info().Msg("discrete value successfully parsed") 17 | } 18 | return d, err 19 | } 20 | -------------------------------------------------------------------------------- /a2l/read_only.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type readOnlyKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseReadOnly(tok *tokenGenerator) (readOnlyKeyword, error) { 11 | ro := readOnlyKeyword{} 12 | var err error 13 | if !ro.valueSet { 14 | ro.value = true 15 | ro.valueSet = true 16 | log.Info().Msg("readOnly value successfully parsed") 17 | } 18 | return ro, err 19 | } 20 | -------------------------------------------------------------------------------- /a2l/read_write.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type readWriteKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseReadWrite(tok *tokenGenerator) (readWriteKeyword, error) { 11 | rw := readWriteKeyword{} 12 | var err error 13 | if !rw.valueSet { 14 | rw.value = true 15 | rw.valueSet = true 16 | log.Info().Msg("readWrite value successfully parsed") 17 | } 18 | return rw, err 19 | } 20 | -------------------------------------------------------------------------------- /a2l/sign_extend.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type SignExtendKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseSignExtend(tok *tokenGenerator) (SignExtendKeyword, error) { 11 | se := SignExtendKeyword{} 12 | var err error 13 | if !se.valueSet { 14 | se.value = true 15 | se.valueSet = true 16 | log.Info().Msg("signExtend value successfully parsed") 17 | } 18 | return se, err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 7 | 8 | package unix 9 | 10 | const ( 11 | R_OK = 0x4 12 | W_OK = 0x2 13 | X_OK = 0x1 14 | ) 15 | -------------------------------------------------------------------------------- /.github/workflows/a2l-fuzzing.yml: -------------------------------------------------------------------------------- 1 | name: A2L Fuzzing 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Run A2L Fuzzing 22 | run: go test ./a2l -fuzz=FuzzParseA2l -fuzztime=60s -v 23 | -------------------------------------------------------------------------------- /.github/workflows/ihex32-fuzzing.yml: -------------------------------------------------------------------------------- 1 | name: iHex32 Fuzzing 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Run A2L Fuzzing 22 | run: go test ./ihex32 -fuzz=FuzzParseHex -fuzztime=30s -v 23 | -------------------------------------------------------------------------------- /.github/workflows/srec19-fuzzing.yml: -------------------------------------------------------------------------------- 1 | name: SREC19 Fuzzing 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Run A2L Fuzzing 22 | run: go test ./srec19 -fuzz=FuzzParseHex -fuzztime=30s -v 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 6 | // +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 7 | 8 | package unix 9 | 10 | const isBigEndian = true 11 | -------------------------------------------------------------------------------- /a2l/consistent_exchange.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type consistentExchangeKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseConsistentExchangeKeyword(tok *tokenGenerator) (consistentExchangeKeyword, error) { 11 | ce := consistentExchangeKeyword{} 12 | var err error 13 | if !ce.valueSet { 14 | ce.value = true 15 | ce.valueSet = true 16 | log.Info().Msg("consistentExchange value successfully parsed") 17 | } 18 | return ce, err 19 | } 20 | -------------------------------------------------------------------------------- /a2l/static_address_offsets.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | type staticAddressOffsetsKeyword struct { 6 | value bool 7 | valueSet bool 8 | } 9 | 10 | func parseStaticAddressOffsets(tok *tokenGenerator) (staticAddressOffsetsKeyword, error) { 11 | sao := staticAddressOffsetsKeyword{} 12 | var err error 13 | if !sao.valueSet { 14 | sao.value = true 15 | sao.valueSet = true 16 | log.Info().Msg("StaticAddressOffsets value successfully parsed") 17 | } 18 | return sao, err 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_unix_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | // +build darwin,!ios 7 | 8 | package unix 9 | 10 | // SysvShmCtl performs control operations on the shared memory segment 11 | // specified by id. 12 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 13 | return shmctl(id, cmd, desc) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 12 | // 13 | 14 | TEXT ·syscall6(SB),NOSPLIT,$0-88 15 | JMP syscall·syscall6(SB) 16 | 17 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 18 | JMP syscall·rawSyscall6(SB) 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && gc && linux 6 | // +build arm,gc,linux 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // Underlying system call writes to newoffset via pointer. 13 | // Implemented in assembly to avoid allocation. 14 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh 6 | // +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh 7 | 8 | package unix 9 | 10 | const isBigEndian = false 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 12 | // 13 | 14 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 15 | JMP syscall·sysvicall6(SB) 16 | 17 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 18 | JMP syscall·rawSysvicall6(SB) 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd 6 | // +build aix dragonfly freebsd linux netbsd openbsd 7 | 8 | package unix 9 | 10 | // ReadDirent reads directory entries from fd and writes them into buf. 11 | func ReadDirent(fd int, buf []byte) (n int, err error) { 12 | return Getdents(fd, buf) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 7 | 8 | // For Unix, get the pagesize from the runtime. 9 | 10 | package unix 11 | 12 | import "syscall" 13 | 14 | func Getpagesize() int { 15 | return syscall.Getpagesize() 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 7 | // +build go1.9 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | type Signal = syscall.Signal 14 | type Errno = syscall.Errno 15 | type SysProcAttr = syscall.SysProcAttr 16 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/mattn/go-colorable v0.1.12 2 | ## explicit; go 1.13 3 | github.com/mattn/go-colorable 4 | # github.com/mattn/go-isatty v0.0.14 5 | ## explicit; go 1.12 6 | github.com/mattn/go-isatty 7 | # github.com/rs/zerolog v1.28.0 8 | ## explicit; go 1.15 9 | github.com/rs/zerolog 10 | github.com/rs/zerolog/internal/cbor 11 | github.com/rs/zerolog/internal/json 12 | github.com/rs/zerolog/log 13 | # github.com/x448/float16 v0.8.4 14 | ## explicit; go 1.11 15 | github.com/x448/float16 16 | # golang.org/x/sys v0.1.0 17 | ## explicit; go 1.17 18 | golang.org/x/sys/unix 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | //go:build appengine || js || nacl || wasm 2 | // +build appengine js nacl wasm 3 | 4 | package isatty 5 | 6 | // IsTerminal returns true if the file descriptor is terminal which 7 | // is always false on js and appengine classic which is a sandboxed PaaS. 8 | func IsTerminal(fd uintptr) bool { 9 | return false 10 | } 11 | 12 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 13 | // terminal. This is also always false on this environment. 14 | func IsCygwinTerminal(fd uintptr) bool { 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) 6 | // +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc 7 | 8 | package unix 9 | 10 | func init() { 11 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 12 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 13 | fcntl64Syscall = SYS_FCNTL64 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gccgo && linux && amd64 6 | // +build gccgo,linux,amd64 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //extern gettimeofday 13 | func realGettimeofday(*Timeval, *byte) int32 14 | 15 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 16 | r := realGettimeofday(tv, nil) 17 | if r < 0 { 18 | return syscall.GetErrno() 19 | } 20 | return 0 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc 6 | // +build linux,gc 7 | 8 | package unix 9 | 10 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 11 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 12 | 13 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 14 | // fail. 15 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_tcgets.go: -------------------------------------------------------------------------------- 1 | //go:build (linux || aix || zos) && !appengine 2 | // +build linux aix zos 3 | // +build !appengine 4 | 5 | package isatty 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | // IsTerminal return true if the file descriptor is terminal. 10 | func IsTerminal(fd uintptr) bool { 11 | _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) 12 | return err == nil 13 | } 14 | 15 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 16 | // terminal. This is also always false on this environment. 17 | func IsCygwinTerminal(fd uintptr) bool { 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_alarm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) 6 | // +build linux 7 | // +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64 8 | 9 | package unix 10 | 11 | // SYS_ALARM is not defined on arm or riscv, but is available for other GOARCH 12 | // values. 13 | 14 | //sys Alarm(seconds uint) (remaining uint, err error) 15 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_plan9.go: -------------------------------------------------------------------------------- 1 | //go:build plan9 2 | // +build plan9 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | func IsTerminal(fd uintptr) bool { 12 | path, err := syscall.Fd2path(int(fd)) 13 | if err != nil { 14 | return false 15 | } 16 | return path == "/dev/cons" || path == "/mnt/term/dev/cons" 17 | } 18 | 19 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 20 | // terminal. This is also always false on this environment. 21 | func IsCygwinTerminal(fd uintptr) bool { 22 | return false 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | // Round the length of a raw sockaddr up to align it properly. 8 | func cmsgAlignOf(salen int) int { 9 | salign := SizeofPtr 10 | if SizeofPtr == 8 && !supportsABI(_dragonflyABIChangeVersion) { 11 | // 64-bit Dragonfly before the September 2019 ABI changes still requires 12 | // 32-bit aligned access to network subsystem. 13 | salign = 4 14 | } 15 | return (salen + salign - 1) & ^(salign - 1) 16 | } 17 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | There is no string exectution, buffer overflows (go is garbage collected) or the like. 3 | So most attack vectors should be closed. 4 | Additionally all dependancy are monitored and CodeQL is enabled to check for common errors on every push. 5 | In Case you find a vulnerability, then please contact me with the information below. 6 | 7 | ## Supported Versions 8 | Only the newest version is relevant. 9 | There will be no support for older versions as of right now. 10 | 11 | ## Reporting a Vulnerability 12 | You can reach me anytime via: marcel.maier-git@protonmail.com 13 | I will try to come back to you as soon as I can. 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux 6 | // +build linux 7 | 8 | package unix 9 | 10 | import "runtime" 11 | 12 | // SysvShmCtl performs control operations on the shared memory segment 13 | // specified by id. 14 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 15 | if runtime.GOARCH == "arm" || 16 | runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { 17 | cmd |= ipc_64 18 | } 19 | 20 | return shmctl(id, cmd, desc) 21 | } 22 | -------------------------------------------------------------------------------- /a2l/guard_rails.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type guardRailsKeyword struct { 10 | value bool 11 | valueSet bool 12 | } 13 | 14 | func parseGuardRails(tok *tokenGenerator) (guardRailsKeyword, error) { 15 | gr := guardRailsKeyword{} 16 | var err error 17 | if tok.current() == emptyToken { 18 | err = errors.New("unexpected end of file") 19 | log.Err(err).Msg("guardRails could not be parsed: unexpected end of file") 20 | } else if !gr.valueSet { 21 | gr.value = true 22 | gr.valueSet = true 23 | log.Info().Msg("guardRails value successfully parsed") 24 | } 25 | return gr, err 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | //go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine 2 | // +build darwin freebsd openbsd netbsd dragonfly 3 | // +build !appengine 4 | 5 | package isatty 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | // IsTerminal return true if the file descriptor is terminal. 10 | func IsTerminal(fd uintptr) bool { 11 | _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) 12 | return err == nil 13 | } 14 | 15 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 16 | // terminal. This is also always false on this environment. 17 | func IsCygwinTerminal(fd uintptr) bool { 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | //go:build solaris && !appengine 2 | // +build solaris,!appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | _, err := unix.IoctlGetTermio(int(fd), unix.TCGETA) 14 | return err == nil 15 | } 16 | 17 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 18 | // terminal. This is also always false on this environment. 19 | func IsCygwinTerminal(fd uintptr) bool { 20 | return false 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc && 386 6 | // +build linux,gc,386 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // Underlying system call writes to newoffset via pointer. 13 | // Implemented in assembly to avoid allocation. 14 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 15 | 16 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gccgo && arm 6 | // +build linux,gccgo,arm 7 | 8 | package unix 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 16 | var newoffset int64 17 | offsetLow := uint32(offset & 0xffffffff) 18 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 19 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 20 | return newoffset, err 21 | } 22 | -------------------------------------------------------------------------------- /a2l/cpu_type.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type cpuType struct { 10 | cpu string 11 | cpuSet bool 12 | } 13 | 14 | func parseCpuType(tok *tokenGenerator) (cpuType, error) { 15 | ct := cpuType{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("cpuType could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("cpuType could not be parsed") 24 | } else if !ct.cpuSet { 25 | ct.cpu = tok.current() 26 | ct.cpuSet = true 27 | log.Info().Msg("cpuType cpu successfully parsed") 28 | } 29 | return ct, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/epk.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type epk struct { 10 | identifier string 11 | identifierSet bool 12 | } 13 | 14 | func parseEpk(tok *tokenGenerator) (epk, error) { 15 | e := epk{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("epk could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("epk could not be parsed") 24 | } else if !e.identifierSet { 25 | e.identifier = tok.current() 26 | e.identifierSet = true 27 | log.Info().Msg("epk identifier successfully parsed") 28 | } 29 | return e, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/ref_unit.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type refUnit struct { 10 | unit string 11 | unitSet bool 12 | } 13 | 14 | func parseRefUnit(tok *tokenGenerator) (refUnit, error) { 15 | ru := refUnit{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("refUnit could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("refUnit could not be parsed") 24 | } else if !ru.unitSet { 25 | ru.unit = tok.current() 26 | ru.unitSet = true 27 | log.Info().Msg("refUnit unit successfully parsed") 28 | } 29 | return ru, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/user.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type user struct { 10 | userName string 11 | userNameSet bool 12 | } 13 | 14 | func parseUser(tok *tokenGenerator) (user, error) { 15 | u := user{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("user could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("user could not be parsed") 24 | } else if !u.userNameSet { 25 | u.userName = tok.current() 26 | u.userNameSet = true 27 | log.Info().Msg("user userName successfully parsed") 28 | } 29 | 30 | return u, err 31 | } 32 | -------------------------------------------------------------------------------- /a2l/ecu.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type ecu struct { 10 | controlUnit string 11 | controlUnitSet bool 12 | } 13 | 14 | func parseEcu(tok *tokenGenerator) (ecu, error) { 15 | e := ecu{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("ecu could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("ecu could not be parsed") 24 | } else if !e.controlUnitSet { 25 | e.controlUnit = tok.current() 26 | e.controlUnitSet = true 27 | log.Info().Msg("ecu controlUnit successfully parsed") 28 | } 29 | return e, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos 6 | // +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos 7 | 8 | package unix 9 | 10 | import ( 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = false 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | } 18 | 19 | func raceReleaseMerge(addr unsafe.Pointer) { 20 | } 21 | 22 | func raceReadRange(addr unsafe.Pointer, len int) { 23 | } 24 | 25 | func raceWriteRange(addr unsafe.Pointer, len int) { 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && solaris 6 | // +build amd64,solaris 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func (iov *Iovec) SetLen(length int) { 19 | iov.Len = uint64(length) 20 | } 21 | 22 | func (msghdr *Msghdr) SetIovlen(length int) { 23 | msghdr.Iovlen = int32(length) 24 | } 25 | 26 | func (cmsg *Cmsghdr) SetLen(length int) { 27 | cmsg.Len = uint32(length) 28 | } 29 | -------------------------------------------------------------------------------- /a2l/formula_inv.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type formulaInv struct { 10 | gx string 11 | gxSet bool 12 | } 13 | 14 | func parseFormulaInv(tok *tokenGenerator) (formulaInv, error) { 15 | fi := formulaInv{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("formulaInv could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("formulaInv could not be parsed") 24 | } else if !fi.gxSet { 25 | fi.gx = tok.current() 26 | fi.gxSet = true 27 | log.Info().Msg("formulaInv gx successfully parsed") 28 | } 29 | return fi, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/phone_no.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type phoneNo struct { 10 | telnum string 11 | telnumSet bool 12 | } 13 | 14 | func parsePhoneNo(tok *tokenGenerator) (phoneNo, error) { 15 | pn := phoneNo{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("phoneNo could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("phoneNo could not be parsed") 24 | } else if !pn.telnumSet { 25 | pn.telnum = tok.current() 26 | pn.telnumSet = true 27 | log.Info().Msg("phoneNo telnum successfully parsed") 28 | } 29 | return pn, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/phys_unit.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type physUnit struct { 10 | unit string 11 | unitSet bool 12 | } 13 | 14 | func parsePhysUnit(tok *tokenGenerator) (physUnit, error) { 15 | pu := physUnit{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("physUnit could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("physUnit could not be parsed") 24 | } else if !pu.unitSet { 25 | pu.unit = tok.current() 26 | pu.unitSet = true 27 | log.Info().Msg("physUnit unit successfully parsed") 28 | } 29 | return pu, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/symbol_type_link.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type symbolTypeLink struct { 10 | symbolName string 11 | } 12 | 13 | func parseSymbolTypeLink(tok *tokenGenerator) (symbolTypeLink, error) { 14 | var err error 15 | stl := symbolTypeLink{} 16 | tok.next() 17 | if tok.current() == emptyToken { 18 | err = errors.New("unexpected end of file") 19 | log.Err(err).Msg("symbolLink could not be parsed") 20 | } else if isKeyword(tok.current()) { 21 | err = errors.New("unexpected token " + tok.current()) 22 | log.Err(err).Msg("symbolTypeLink could not be parsed") 23 | } else { 24 | stl.symbolName = tok.current() 25 | log.Info().Msg("symbolTypeLink symbolName successfully parsed") 26 | } 27 | return stl, err 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/internal/cbor/base.go: -------------------------------------------------------------------------------- 1 | package cbor 2 | 3 | // JSONMarshalFunc is used to marshal interface to JSON encoded byte slice. 4 | // Making it package level instead of embedded in Encoder brings 5 | // some extra efforts at importing, but avoids value copy when the functions 6 | // of Encoder being invoked. 7 | // DO REMEMBER to set this variable at importing, or 8 | // you might get a nil pointer dereference panic at runtime. 9 | var JSONMarshalFunc func(v interface{}) ([]byte, error) 10 | 11 | type Encoder struct{} 12 | 13 | // AppendKey adds a key (string) to the binary encoded log message 14 | func (e Encoder) AppendKey(dst []byte, key string) []byte { 15 | if len(dst) < 1 { 16 | dst = e.AppendBeginMarker(dst) 17 | } 18 | return e.AppendString(dst, key) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/internal/json/base.go: -------------------------------------------------------------------------------- 1 | package json 2 | 3 | // JSONMarshalFunc is used to marshal interface to JSON encoded byte slice. 4 | // Making it package level instead of embedded in Encoder brings 5 | // some extra efforts at importing, but avoids value copy when the functions 6 | // of Encoder being invoked. 7 | // DO REMEMBER to set this variable at importing, or 8 | // you might get a nil pointer dereference panic at runtime. 9 | var JSONMarshalFunc func(v interface{}) ([]byte, error) 10 | 11 | type Encoder struct{} 12 | 13 | // AppendKey appends a new key to the output JSON. 14 | func (e Encoder) AppendKey(dst []byte, key string) []byte { 15 | if dst[len(dst)-1] != '{' { 16 | dst = append(dst, ',') 17 | } 18 | return append(e.AppendString(dst, key), ':') 19 | } 20 | -------------------------------------------------------------------------------- /a2l/error_mask.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type errorMask struct { 10 | mask string 11 | maskSet bool 12 | } 13 | 14 | func parseErrorMask(tok *tokenGenerator) (errorMask, error) { 15 | em := errorMask{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("errorMask could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("errorMask could not be parsed") 24 | } else if !em.maskSet { 25 | em.mask = tok.current() 26 | em.maskSet = true 27 | log.Info().Msg("errorMask mask successfully parsed") 28 | } 29 | return em, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/customer.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type customer struct { 10 | customer string 11 | customerSet bool 12 | } 13 | 14 | func parseCustomer(tok *tokenGenerator) (customer, error) { 15 | c := customer{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("customer could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("customer could not be parsed") 24 | } else if !c.customerSet { 25 | c.customer = tok.current() 26 | c.customerSet = true 27 | log.Info().Msg("customer customer successfully parsed") 28 | } 29 | return c, err 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/go-build-test-and-license.yml: -------------------------------------------------------------------------------- 1 | name: Build, Test and License 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Build 22 | run: go build -v ./... 23 | 24 | - name: Test RaceConditions Extended 25 | run: go test -bench=. -benchtime=100s -test.parallel 1 -race -v 26 | 27 | - name: Setup License Server 28 | run: go install github.com/google/go-licenses@latest 29 | 30 | - name: Check Licenses 31 | run: go-licenses check "github.com/asap2Go/calibrationReader" 32 | -------------------------------------------------------------------------------- /a2l/compu_tab_ref.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type CompuTabRef struct { 10 | ConversionTable string 11 | ConversionTableSet bool 12 | } 13 | 14 | func parseCompuTabRef(tok *tokenGenerator) (CompuTabRef, error) { 15 | ctr := CompuTabRef{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("compuTabRef could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("compuTabRef could not be parsed") 24 | } else if !ctr.ConversionTableSet { 25 | ctr.ConversionTable = tok.current() 26 | ctr.ConversionTableSet = true 27 | } 28 | return ctr, err 29 | } 30 | -------------------------------------------------------------------------------- /a2l/customer_no.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type customerNo struct { 10 | number string 11 | numberSet bool 12 | } 13 | 14 | func parseCustomerNo(tok *tokenGenerator) (customerNo, error) { 15 | cn := customerNo{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("customerNo could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("customerNo could not be parsed") 24 | } else if !cn.numberSet { 25 | cn.number = tok.current() 26 | cn.numberSet = true 27 | log.Info().Msg("customerNo number successfully parsed") 28 | } 29 | return cn, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/format.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type format struct { 10 | formatString string 11 | formatStringSet bool 12 | } 13 | 14 | func parseFormat(tok *tokenGenerator) (format, error) { 15 | f := format{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("format could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("format could not be parsed") 24 | } else if !f.formatStringSet { 25 | f.formatString = tok.current() 26 | f.formatStringSet = true 27 | log.Info().Msg("format formatString successfully parsed") 28 | } 29 | return f, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/ecu_address.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type ecuAddress struct { 10 | address string 11 | addressSet bool 12 | } 13 | 14 | func parseEcuAddress(tok *tokenGenerator) (ecuAddress, error) { 15 | ea := ecuAddress{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("ecuAddress could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("ecuAddress could not be parsed") 24 | } else if !ea.addressSet { 25 | ea.address = tok.current() 26 | ea.addressSet = true 27 | log.Info().Msg("ecuAddress address successfully parsed") 28 | } 29 | return ea, err 30 | } 31 | -------------------------------------------------------------------------------- /reserved.go: -------------------------------------------------------------------------------- 1 | package calibrationReader 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/asap2Go/calibrationReader/a2l" 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // getDistOpX retrieves the identifier in the deposit structure according to its layout 11 | // specified within the record layout and their values as calibrated in the hex file 12 | func (cd *CalibrationData) getReserved(rl *a2l.RecordLayout, curPos *uint32) error { 13 | if !rl.Reserved.DataSizeSet { 14 | err := errors.New("reserved datasize not set") 15 | log.Err(err).Msg("could not retrieve reserved datasize") 16 | return err 17 | } 18 | //Value of reserved is not relevant. Only its datasize and the resulting offset for other datastructres are necessary 19 | *curPos += uint32(rl.Reserved.DataSize.GetDataSizeLength()) 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | *.log 14 | 15 | # ASAM standards due to licensing restrictions 16 | *.pdf 17 | 18 | #Go coverage profile 19 | covprofile 20 | 21 | .VSCodeCounter/2022-11-18_23-56-11/details.md 22 | .VSCodeCounter/2022-11-18_23-56-11/diff-details.md 23 | .VSCodeCounter/2022-11-18_23-56-11/diff.csv 24 | .VSCodeCounter/2022-11-18_23-56-11/diff.md 25 | .VSCodeCounter/2022-11-18_23-56-11/diff.txt 26 | .VSCodeCounter/2022-11-18_23-56-11/results.csv 27 | .VSCodeCounter/2022-11-18_23-56-11/results.json 28 | .VSCodeCounter/2022-11-18_23-56-11/results.md 29 | .VSCodeCounter/2022-11-18_23-56-11/results.txt 30 | -------------------------------------------------------------------------------- /a2l/supplier.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type supplier struct { 10 | manufacturer string 11 | manufacturerSet bool 12 | } 13 | 14 | func parseSupplier(tok *tokenGenerator) (supplier, error) { 15 | s := supplier{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("supplier could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("supplier could not be parsed") 24 | } else if !s.manufacturerSet { 25 | s.manufacturer = tok.current() 26 | s.manufacturerSet = true 27 | log.Info().Msg("supplier manufacturer successfully parsed") 28 | } 29 | return s, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/var_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type varMeasurement struct { 10 | name string 11 | nameSet bool 12 | } 13 | 14 | func parseVarMeasurement(tok *tokenGenerator) (varMeasurement, error) { 15 | vm := varMeasurement{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("varMeasurement could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("varMeasurement could not be parsed") 24 | } else if !vm.nameSet { 25 | vm.name = tok.current() 26 | vm.nameSet = true 27 | log.Info().Msg("varMeasurement name successfully parsed") 28 | } 29 | return vm, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc 6 | // +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris 7 | // +build gc 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin && race) || (linux && race) || (freebsd && race) 6 | // +build darwin,race linux,race freebsd,race 7 | 8 | package unix 9 | 10 | import ( 11 | "runtime" 12 | "unsafe" 13 | ) 14 | 15 | const raceenabled = true 16 | 17 | func raceAcquire(addr unsafe.Pointer) { 18 | runtime.RaceAcquire(addr) 19 | } 20 | 21 | func raceReleaseMerge(addr unsafe.Pointer) { 22 | runtime.RaceReleaseMerge(addr) 23 | } 24 | 25 | func raceReadRange(addr unsafe.Pointer, len int) { 26 | runtime.RaceReadRange(addr, len) 27 | } 28 | 29 | func raceWriteRange(addr unsafe.Pointer, len int) { 30 | runtime.RaceWriteRange(addr, len) 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/codacy-coverage.yml: -------------------------------------------------------------------------------- 1 | name: Codacy Coverage Report 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Create Coverage File 22 | run: go test ./... -race -v -covermode atomic -coverprofile=covprofile ./... 23 | 24 | - name: Install goveralls 25 | run: go install github.com/mattn/goveralls@latest 26 | 27 | - name: Send Coverage Codacy 28 | run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report \ --force-coverage-parser go -r covprofile --project-token ${{ secrets.CODACY_PROJECT_TOKEN }} 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin 6 | // +build darwin 7 | 8 | package unix 9 | 10 | import "unsafe" 11 | 12 | // ReadDirent reads directory entries from fd and writes them into buf. 13 | func ReadDirent(fd int, buf []byte) (n int, err error) { 14 | // Final argument is (basep *uintptr) and the syscall doesn't take nil. 15 | // 64 bits should be enough. (32 bits isn't even on 386). Since the 16 | // actual system call is getdirentries64, 64 is a good guess. 17 | // TODO(rsc): Can we use a single global basep for all calls? 18 | var base = (*uintptr)(unsafe.Pointer(new(uint64))) 19 | return Getdirentries(fd, buf, base) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtraceRegSet("arm64"). DO NOT EDIT. 2 | 3 | package unix 4 | 5 | import "unsafe" 6 | 7 | // PtraceGetRegSetArm64 fetches the registers used by arm64 binaries. 8 | func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error { 9 | iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))} 10 | return ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec))) 11 | } 12 | 13 | // PtraceSetRegSetArm64 sets the registers used by arm64 binaries. 14 | func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error { 15 | iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))} 16 | return ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec))) 17 | } 18 | -------------------------------------------------------------------------------- /a2l/project_no.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type projectNo struct { 10 | projectNumber string 11 | projectNumberSet bool 12 | } 13 | 14 | func parseProjectNo(tok *tokenGenerator) (projectNo, error) { 15 | pn := projectNo{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("projectNo could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("projectNo could not be parsed") 24 | } else if !pn.projectNumberSet { 25 | pn.projectNumber = tok.current() 26 | pn.projectNumberSet = true 27 | log.Info().Msg("projectNo projectNumber successfully parsed") 28 | } 29 | return pn, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/var_separator.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type varSeparator struct { 10 | separator string 11 | separatorSet bool 12 | } 13 | 14 | func parseVarSeparator(tok *tokenGenerator) (varSeparator, error) { 15 | vs := varSeparator{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("varSeparator could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("varSeparator could not be parsed") 24 | } else if !vs.separatorSet { 25 | vs.separator = tok.current() 26 | vs.separatorSet = true 27 | log.Info().Msg("varSeparator separator successfully parsed") 28 | } 29 | return vs, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/version.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type version struct { 10 | versionIdentifier string 11 | versionIdentifierSet bool 12 | } 13 | 14 | func parseVersion(tok *tokenGenerator) (version, error) { 15 | v := version{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("version could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("version could not be parsed") 24 | } else if !v.versionIdentifierSet { 25 | v.versionIdentifier = tok.current() 26 | v.versionIdentifierSet = true 27 | log.Info().Msg("version versionIdentifier successfully parsed") 28 | } 29 | return v, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/curve_axis_ref.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type curveAxisRef struct { 10 | curveAxis string 11 | curveAxisSet bool 12 | } 13 | 14 | func parseCurveAxisRef(tok *tokenGenerator) (curveAxisRef, error) { 15 | car := curveAxisRef{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("curveAxisRef could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("curveAxisRef could not be parsed") 24 | } else if !car.curveAxisSet { 25 | car.curveAxis = tok.current() 26 | car.curveAxisSet = true 27 | log.Info().Msg("curveAxisRef curveAxis successfully parsed") 28 | } 29 | return car, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for mips64, OpenBSD 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | JMP syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | JMP syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | JMP syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /a2l/addr_epk.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type addrEpk struct { 10 | //address contains the Address of the EPROM identifier 11 | address string 12 | addressSet bool 13 | } 14 | 15 | func parseAddrEpk(tok *tokenGenerator) (addrEpk, error) { 16 | ae := addrEpk{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("addrEpk could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("addrEpk could not be parsed") 25 | } else if !ae.addressSet { 26 | ae.address = tok.current() 27 | ae.addressSet = true 28 | log.Info().Msg("addrEpk address successfully parsed") 29 | } 30 | return ae, err 31 | } 32 | -------------------------------------------------------------------------------- /a2l/ref_memory_segment.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type refMemorySegment struct { 10 | name string 11 | nameSet bool 12 | } 13 | 14 | func parseRefMemorySegment(tok *tokenGenerator) (refMemorySegment, error) { 15 | rms := refMemorySegment{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("refMemorySegment: could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("refMemorySegment could not be parsed") 24 | } else if !rms.nameSet { 25 | rms.name = tok.current() 26 | rms.nameSet = true 27 | log.Info().Msg("refMemorySegment name successfully parsed") 28 | } 29 | return rms, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/default_value.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type DefaultValue struct { 10 | DisplayString string 11 | DisplayStringSet bool 12 | } 13 | 14 | func parseDefaultValue(tok *tokenGenerator) (DefaultValue, error) { 15 | dv := DefaultValue{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("defaultValue could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("defaultValue could not be parsed") 24 | } else if !dv.DisplayStringSet { 25 | dv.DisplayString = tok.current() 26 | dv.DisplayStringSet = true 27 | log.Info().Msg("defaultValue displayString successfully parsed") 28 | } 29 | return dv, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/deposit.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type deposit struct { 10 | mode modeEnum 11 | modeSet bool 12 | } 13 | 14 | func parseDeposit(tok *tokenGenerator) (deposit, error) { 15 | d := deposit{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("deposit could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("deposit could not be parsed") 24 | } else if !d.modeSet { 25 | d.mode, err = parseModeEnum(tok) 26 | if err != nil { 27 | log.Err(err).Msg("deposit could not be parsed") 28 | } 29 | d.modeSet = true 30 | log.Info().Msg("deposit mode successfully parsed") 31 | } 32 | return d, err 33 | } 34 | -------------------------------------------------------------------------------- /a2l/comparison_quantity.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type comparisonQuantity struct { 10 | name string 11 | nameSet bool 12 | } 13 | 14 | func parseComparisonQuantity(tok *tokenGenerator) (comparisonQuantity, error) { 15 | cq := comparisonQuantity{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("comparisonQuantity name could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("comparisonQuantity name could not be parsed") 24 | } else if !cq.nameSet { 25 | cq.name = tok.current() 26 | cq.nameSet = true 27 | log.Info().Msg("comparisonQuantity name successfully parsed") 28 | } 29 | return cq, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | HCI_CHANNEL_LOGGING = 4 27 | ) 28 | 29 | // Socketoption Level 30 | const ( 31 | SOL_BLUETOOTH = 0x112 32 | SOL_HCI = 0x0 33 | SOL_L2CAP = 0x6 34 | SOL_RFCOMM = 0x12 35 | SOL_SCO = 0x11 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | // +build freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // System call support for ARM BSD 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 7 | 8 | // Unix environment variables. 9 | 10 | package unix 11 | 12 | import "syscall" 13 | 14 | func Getenv(key string) (value string, found bool) { 15 | return syscall.Getenv(key) 16 | } 17 | 18 | func Setenv(key, value string) error { 19 | return syscall.Setenv(key, value) 20 | } 21 | 22 | func Clearenv() { 23 | syscall.Clearenv() 24 | } 25 | 26 | func Environ() []string { 27 | return syscall.Environ() 28 | } 29 | 30 | func Unsetenv(key string) error { 31 | return syscall.Unsetenv(key) 32 | } 33 | -------------------------------------------------------------------------------- /a2l/var_naming.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type varNaming struct { 10 | tag tagEnum 11 | tagSet bool 12 | } 13 | 14 | func parseVarNaming(tok *tokenGenerator) (varNaming, error) { 15 | vn := varNaming{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("varNaming could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("varNaming could not be parsed") 24 | } else if !vn.tagSet { 25 | vn.tag, err = parseTagEnum(tok) 26 | if err != nil { 27 | log.Err(err).Msg("varNaming tag could not be parsed") 28 | } 29 | vn.tagSet = true 30 | log.Info().Msg("varNaming tag successfully parsed") 31 | } 32 | return vn, err 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/encoder_json.go: -------------------------------------------------------------------------------- 1 | // +build !binary_log 2 | 3 | package zerolog 4 | 5 | // encoder_json.go file contains bindings to generate 6 | // JSON encoded byte stream. 7 | 8 | import ( 9 | "github.com/rs/zerolog/internal/json" 10 | ) 11 | 12 | var ( 13 | _ encoder = (*json.Encoder)(nil) 14 | 15 | enc = json.Encoder{} 16 | ) 17 | 18 | func init() { 19 | // using closure to reflect the changes at runtime. 20 | json.JSONMarshalFunc = func(v interface{}) ([]byte, error) { 21 | return InterfaceMarshalFunc(v) 22 | } 23 | } 24 | 25 | func appendJSON(dst []byte, j []byte) []byte { 26 | return append(dst, j...) 27 | } 28 | 29 | func decodeIfBinaryToString(in []byte) string { 30 | return string(in) 31 | } 32 | 33 | func decodeObjectToStr(in []byte) string { 34 | return string(in) 35 | } 36 | 37 | func decodeIfBinaryToBytes(in []byte) []byte { 38 | return in 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | // +build freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // System call support for 386 BSD 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /a2l/calibration_handle_text.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type calibrationHandleText struct { 10 | text string 11 | textSet bool 12 | } 13 | 14 | func parseCalibrationHandleText(tok *tokenGenerator) (calibrationHandleText, error) { 15 | cht := calibrationHandleText{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("calibrationHandleText could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("calibrationHandleText could not be parsed") 24 | } else if !cht.textSet { 25 | cht.text = tok.current() 26 | cht.textSet = true 27 | log.Info().Msg("calibrationHandleText text successfully parsed") 28 | } 29 | return cht, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/display_identifier.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type DisplayIdentifier struct { 10 | displayName string 11 | displayNameSet bool 12 | } 13 | 14 | func parseDisplayIdentifier(tok *tokenGenerator) (DisplayIdentifier, error) { 15 | di := DisplayIdentifier{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("displayIdentifier could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("displayIdentifier could not be parsed") 24 | } else if !di.displayNameSet { 25 | di.displayName = tok.current() 26 | di.displayNameSet = true 27 | log.Info().Msg("displayIdentifier displayName successfully parsed") 28 | } 29 | return di, err 30 | } 31 | -------------------------------------------------------------------------------- /a2l/a2ml.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type a2ml struct { 10 | //formatSpecification contains the AML code for description of interface specific description data. 11 | formatSpecification string 12 | formatSpecificationSet bool 13 | } 14 | 15 | func parseA2ML(tok *tokenGenerator) (a2ml, error) { 16 | a2ml := a2ml{} 17 | var err error 18 | forLoop: 19 | for { 20 | tok.next() 21 | if tok.current() == emptyToken { 22 | err = errors.New("unexpected end of file") 23 | log.Err(err).Msg("a2ml could not be parsed") 24 | break forLoop 25 | } else if tok.current() == endA2mlToken { 26 | a2ml.formatSpecificationSet = true 27 | break forLoop 28 | } else if !a2ml.formatSpecificationSet { 29 | a2ml.formatSpecification = a2ml.formatSpecification + spaceToken + tok.current() 30 | } 31 | } 32 | return a2ml, err 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc 6 | // +build aix,ppc 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev >> 16) & 0xffff) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32(dev & 0xffff) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | return uint64(((major) << 16) | (minor)) 27 | } 28 | -------------------------------------------------------------------------------- /a2l/a2ml_test.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/rs/zerolog" 7 | ) 8 | 9 | //write a unit test for parseA2ML that checks the following: 10 | 11 | func TestParseA2ML_Valid(t *testing.T) { 12 | configureLogger() 13 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 14 | // valid a2ml file 15 | tokenList = []string{"/begin A2ML", "1.0", "stuff", "stuff", "stuff", "/end A2ML"} 16 | tok := newTokenGenerator() 17 | _, err := parseA2ML(&tok) 18 | if err != nil { 19 | t.Fatalf("failed parsing with error: %s.", err) 20 | } 21 | } 22 | 23 | func TestParseA2ML_Empty(t *testing.T) { 24 | configureLogger() 25 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 26 | // empty a2ml file 27 | tokenList = []string{emptyToken, emptyToken} 28 | tok := newTokenGenerator() 29 | _, err := parseA2ML(&tok) 30 | if err == nil { 31 | t.Fatalf("failed parsing with error: %s.", err) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /a2l/annotation_label.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | //annotationLabel is the label or title of the annotation 10 | type annotationLabel struct { 11 | label string 12 | labelSet bool 13 | } 14 | 15 | func parseAnnotationLabel(tok *tokenGenerator) (annotationLabel, error) { 16 | al := annotationLabel{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("annotationLabel could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("annotationLabel could not be parsed") 25 | } else if !al.labelSet { 26 | al.label = tok.current() 27 | al.labelSet = true 28 | log.Info().Msg("annotationLabel label successfully parsed") 29 | } 30 | return al, err 31 | } 32 | -------------------------------------------------------------------------------- /a2l/layout.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type layout struct { 10 | indexMode indexModeEnum 11 | indexModeSet bool 12 | } 13 | 14 | func parseLayout(tok *tokenGenerator) (layout, error) { 15 | l := layout{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("layout could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("layout could not be parsed") 24 | } else if !l.indexModeSet { 25 | l.indexMode, err = parseIndexModeEnum(tok) 26 | if err != nil { 27 | log.Err(err).Msg("layout indexMode could not be parsed") 28 | } 29 | l.indexModeSet = true 30 | log.Info().Msg("layout indexMode successfully parsed") 31 | } 32 | return l, err 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | // +build darwin freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // System call support for ARM64 BSD 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /a2l/function_version.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type functionVersion struct { 10 | versionIdentifier string 11 | versionIdentifierSet bool 12 | } 13 | 14 | func parseFunctionVersion(tok *tokenGenerator) (functionVersion, error) { 15 | fv := functionVersion{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("functionVersion could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("functionVersion could not be parsed") 24 | } else if !fv.versionIdentifierSet { 25 | fv.versionIdentifier = tok.current() 26 | fv.versionIdentifierSet = true 27 | log.Info().Msg("functionVersion versionIdentifier successfully parsed") 28 | } 29 | return fv, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | // +build darwin freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // System call support for RISCV64 BSD 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /a2l/monotony.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type Monotony struct { 10 | monotony monotonyTypeEnum 11 | monotonySet bool 12 | } 13 | 14 | func parseMonotony(tok *tokenGenerator) (Monotony, error) { 15 | m := Monotony{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("monotony could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("monotony could not be parsed") 24 | } else if !m.monotonySet { 25 | m.monotony, err = parseMonotonyTypeEnum(tok) 26 | if err != nil { 27 | log.Err(err).Msg("monotony monotony could not be parsed") 28 | } 29 | m.monotonySet = true 30 | log.Info().Msg("monotony monotony successfully parsed") 31 | } 32 | return m, err 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | // +build darwin freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System call support for ppc64, BSD 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 28 | JMP syscall·RawSyscall(SB) 29 | 30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 31 | JMP syscall·RawSyscall6(SB) 32 | -------------------------------------------------------------------------------- /a2l/var_selection_characteristic.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type varSelectionCharacteristic struct { 10 | name string 11 | nameSet bool 12 | } 13 | 14 | func parseVarSelectionCharacteristic(tok *tokenGenerator) (varSelectionCharacteristic, error) { 15 | vsc := varSelectionCharacteristic{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("varSelectionCharacteristic could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("varSelectionCharacteristic could not be parsed") 24 | } else if !vsc.nameSet { 25 | vsc.name = tok.current() 26 | vsc.nameSet = true 27 | log.Info().Msg("varSelectionCharacteristic name successfully parsed") 28 | } 29 | return vsc, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc 6 | // +build darwin dragonfly freebsd netbsd openbsd 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // System call support for AMD64 BSD 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /a2l/annotation_origin.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | //annotationOrigin specifies the creator or creating system of the annotation 10 | type annotationOrigin struct { 11 | origin string 12 | originSet bool 13 | } 14 | 15 | func parseAnnotationOrigin(tok *tokenGenerator) (annotationOrigin, error) { 16 | ao := annotationOrigin{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("annotationOrigin could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("annotationOrigin could not be parsed") 25 | } else if !ao.originSet { 26 | ao.origin = tok.current() 27 | ao.originSet = true 28 | log.Info().Msg("annotationOrigin origin successfully parsed") 29 | } 30 | return ao, err 31 | } 32 | -------------------------------------------------------------------------------- /identification.go: -------------------------------------------------------------------------------- 1 | package calibrationReader 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/asap2Go/calibrationReader/a2l" 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // getDistOpX retrieves the identifier in the deposit structure according to its layout 11 | // specified within the record layout and their values as calibrated in the hex file 12 | func (cd *CalibrationData) getIdentification(rl *a2l.RecordLayout, curPos *uint32) (interface{}, error) { 13 | if !rl.Identification.DatatypeSet { 14 | err := errors.New("identification datatype not set") 15 | log.Err(err).Msg("could not retrieve identification value") 16 | return nil, err 17 | } 18 | val, err := cd.getValue(curPos, rl.Identification.Datatype, rl) 19 | if err != nil { 20 | log.Err(err).Msg("could not retrieve identification value") 21 | return nil, err 22 | } 23 | *curPos += uint32(rl.Identification.Datatype.GetDatatypeLength()) 24 | return val, err 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | 20 | // FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. 21 | func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { 22 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) 23 | return err 24 | } 25 | -------------------------------------------------------------------------------- /a2l/byte_order.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type ByteOrder struct { 10 | ByteOrder ByteOrderEnum 11 | ByteOrderSet bool 12 | } 13 | 14 | func parseByteOrder(tok *tokenGenerator) (ByteOrder, error) { 15 | bo := ByteOrder{} 16 | var err error 17 | tok.next() 18 | if tok.current() == emptyToken { 19 | err = errors.New("unexpected end of file") 20 | log.Err(err).Msg("byteOrder could not be parsed") 21 | } else if isKeyword(tok.current()) { 22 | err = errors.New("unexpected token " + tok.current()) 23 | log.Err(err).Msg("byteOrder could not be parsed") 24 | } else if !bo.ByteOrderSet { 25 | bo.ByteOrder, err = parseByteOrderEnum(tok) 26 | if err != nil { 27 | log.Err(err).Msg("byteOrder byteOrder could not be parsed") 28 | } 29 | bo.ByteOrderSet = true 30 | log.Info().Msg("byteOrder byteOrder successfully parsed") 31 | } 32 | return bo, err 33 | } 34 | -------------------------------------------------------------------------------- /a2l/if_data.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type IfData struct { 10 | name string 11 | nameSet bool 12 | data []string 13 | dataSet bool 14 | } 15 | 16 | func parseIfData(tok *tokenGenerator) (IfData, error) { 17 | id := IfData{} 18 | var err error 19 | forLoop: 20 | for { 21 | tok.next() 22 | if tok.current() == emptyToken { 23 | err = errors.New("unexpected end of file") 24 | log.Err(err).Msg("ifData: could not be parsed") 25 | break forLoop 26 | } else if tok.current() == endIfDataToken { 27 | id.dataSet = true 28 | log.Info().Msg("ifData data successfully parsed") 29 | break forLoop 30 | } else if !id.nameSet { 31 | id.name = tok.current() 32 | id.nameSet = true 33 | log.Info().Msg("ifData name successfully parsed") 34 | } else if !id.dataSet { 35 | id.data = append(id.data, tok.current()) 36 | } 37 | } 38 | return id, err 39 | } 40 | -------------------------------------------------------------------------------- /a2l/map_list.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type MapList struct { 10 | name []string 11 | nameSet bool 12 | } 13 | 14 | func parseMapList(tok *tokenGenerator) (MapList, error) { 15 | l := MapList{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("mapList: could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endMapListToken { 25 | l.nameSet = true 26 | log.Info().Msg("mapList name successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("mapList could not be parsed") 31 | break forLoop 32 | } else if !l.nameSet { 33 | l.name = append(l.name, tok.current()) 34 | } 35 | } 36 | return l, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/number.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type Number struct { 11 | number uint16 12 | numberSet bool 13 | } 14 | 15 | func parseNumber(tok *tokenGenerator) (Number, error) { 16 | n := Number{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("number could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("number could not be parsed") 25 | } else if !n.numberSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("number number could not be parsed") 30 | } 31 | n.number = uint16(buf) 32 | n.numberSet = true 33 | log.Info().Msg("number number successfully parsed") 34 | } 35 | return n, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/data_size.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type dataSize struct { 11 | size uint16 12 | sizeSet bool 13 | } 14 | 15 | func parseDataSize(tok *tokenGenerator) (dataSize, error) { 16 | ds := dataSize{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("dataSize could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("dataSize could not be parsed") 25 | } else if !ds.sizeSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("dataSize size could not be parsed") 30 | } 31 | ds.size = uint16(buf) 32 | ds.sizeSet = true 33 | log.Info().Msg("dataSize size successfully parsed") 34 | } 35 | return ds, err 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/devskim-analysis.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: DevSkim 7 | 8 | on: 9 | push: 10 | branches: [ main ] 11 | pull_request: 12 | branches: [ main ] 13 | schedule: 14 | - cron: '41 15 * * 2' 15 | 16 | jobs: 17 | lint: 18 | name: DevSkim 19 | runs-on: ubuntu-20.04 20 | permissions: 21 | actions: read 22 | contents: read 23 | security-events: write 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@v2 27 | 28 | - name: Run DevSkim scanner 29 | uses: microsoft/DevSkim-Action@v1 30 | 31 | - name: Upload DevSkim scan results to GitHub Security tab 32 | uses: github/codeql-action/upload-sarif@v1 33 | with: 34 | sarif_file: devskim-results.sarif 35 | -------------------------------------------------------------------------------- /a2l/step_size.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type StepSize struct { 11 | stepSize float64 12 | stepSizeSet bool 13 | } 14 | 15 | func parseStepSize(tok *tokenGenerator) (StepSize, error) { 16 | ss := StepSize{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("stepSize could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("stepSize could not be parsed") 25 | } else if !ss.stepSizeSet { 26 | var buf float64 27 | buf, err = strconv.ParseFloat(tok.current(), 64) 28 | if err != nil { 29 | log.Err(err).Msg("stepSize stepSize could not be parsed") 30 | } 31 | ss.stepSize = buf 32 | ss.stepSizeSet = true 33 | log.Info().Msg("stepSize stepSize successfully parsed") 34 | } 35 | return ss, err 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64le || ppc64) && gc 6 | // +build linux 7 | // +build ppc64le ppc64 8 | // +build gc 9 | 10 | package unix 11 | 12 | import "syscall" 13 | 14 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 15 | return syscall.Syscall(trap, a1, a2, a3) 16 | } 17 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 19 | } 20 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 21 | return syscall.RawSyscall(trap, a1, a2, a3) 22 | } 23 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 24 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 25 | } 26 | -------------------------------------------------------------------------------- /a2l/function_list.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type FunctionList struct { 10 | name []string 11 | nameSet bool 12 | } 13 | 14 | func parseFunctionList(tok *tokenGenerator) (FunctionList, error) { 15 | fl := FunctionList{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("functionList could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endFunctionListToken { 25 | fl.nameSet = true 26 | log.Info().Msg("functionList name successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("functionList could not be parsed") 31 | break forLoop 32 | } else if !fl.nameSet { 33 | fl.name = append(fl.name, tok.current()) 34 | } 35 | } 36 | return fl, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/max_grad.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type MaxGrad struct { 11 | maxGradient float64 12 | maxGradientSet bool 13 | } 14 | 15 | func parseMaxGrad(tok *tokenGenerator) (MaxGrad, error) { 16 | mg := MaxGrad{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("maxGrad could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("maxGrad could not be parsed") 25 | } else if !mg.maxGradientSet { 26 | var buf float64 27 | buf, err = strconv.ParseFloat(tok.current(), 64) 28 | if err != nil { 29 | log.Err(err).Msg("maxGrad maxGradient could not be parsed") 30 | } 31 | mg.maxGradient = buf 32 | mg.maxGradientSet = true 33 | log.Info().Msg("maxGrad maxGradient successfully parsed") 34 | } 35 | return mg, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/var_address.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type varAddress struct { 10 | address []string 11 | addressSet bool 12 | } 13 | 14 | func parseVarAddress(tok *tokenGenerator) (varAddress, error) { 15 | va := varAddress{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("varAddress could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endVarAddressToken { 25 | va.addressSet = true 26 | log.Info().Msg("varAddress address successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("varAddress could not be parsed") 31 | break forLoop 32 | } else if !va.addressSet { 33 | va.address = append(va.address, tok.current()) 34 | } 35 | } 36 | return va, err 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_zos.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build zos && s390x 6 | // +build zos,s390x 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by z/OS. 10 | // 11 | // The information below is extracted and adapted from macros. 12 | 13 | package unix 14 | 15 | // Major returns the major component of a z/OS device number. 16 | func Major(dev uint64) uint32 { 17 | return uint32((dev >> 16) & 0x0000FFFF) 18 | } 19 | 20 | // Minor returns the minor component of a z/OS device number. 21 | func Minor(dev uint64) uint32 { 22 | return uint32(dev & 0x0000FFFF) 23 | } 24 | 25 | // Mkdev returns a z/OS device number generated from the given major and minor 26 | // components. 27 | func Mkdev(major, minor uint32) uint64 { 28 | return (uint64(major) << 16) | uint64(minor) 29 | } 30 | -------------------------------------------------------------------------------- /a2l/left_shift.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type LeftShift struct { 11 | bitcount uint32 12 | bitcountSet bool 13 | } 14 | 15 | func parseLeftShift(tok *tokenGenerator) (LeftShift, error) { 16 | ls := LeftShift{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("leftShift could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("leftShift could not be parsed") 25 | } else if !ls.bitcountSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 32) 28 | if err != nil { 29 | log.Err(err).Msg("leftShift bitcount could not be parsed") 30 | } 31 | ls.bitcount = uint32(buf) 32 | ls.bitcountSet = true 33 | log.Info().Msg("leftShift bitcount successfully parsed") 34 | } 35 | return ls, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/ref_group.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type refGroup struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseRefGroup(tok *tokenGenerator) (refGroup, error) { 15 | rg := refGroup{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("refGroup could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endRefGroupToken { 25 | rg.identifierSet = true 26 | log.Info().Msg("refGroup identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("refGroup could not be parsed") 31 | break forLoop 32 | } else if !rg.identifierSet { 33 | rg.identifier = append(rg.identifier, tok.current()) 34 | } 35 | } 36 | return rg, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/sub_group.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type subGroup struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseSubGroup(tok *tokenGenerator) (subGroup, error) { 15 | sg := subGroup{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("subGroup could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endSubGroupToken { 25 | sg.identifierSet = true 26 | log.Info().Msg("subGroup identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("subGroup could not be parsed") 31 | break forLoop 32 | } else if !sg.identifierSet { 33 | sg.identifier = append(sg.identifier, tok.current()) 34 | } 35 | } 36 | return sg, err 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fdset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 7 | 8 | package unix 9 | 10 | // Set adds fd to the set fds. 11 | func (fds *FdSet) Set(fd int) { 12 | fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS)) 13 | } 14 | 15 | // Clear removes fd from the set fds. 16 | func (fds *FdSet) Clear(fd int) { 17 | fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS)) 18 | } 19 | 20 | // IsSet returns whether fd is in the set fds. 21 | func (fds *FdSet) IsSet(fd int) bool { 22 | return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0 23 | } 24 | 25 | // Zero clears the set fds. 26 | func (fds *FdSet) Zero() { 27 | for i := range fds.Bits { 28 | fds.Bits[i] = 0 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /a2l/right_shift.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type RightShift struct { 11 | bitcount uint32 12 | bitcountSet bool 13 | } 14 | 15 | func parseRightShift(tok *tokenGenerator) (RightShift, error) { 16 | rs := RightShift{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("rightShift could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("rightShift could not be parsed") 25 | } else if !rs.bitcountSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 32) 28 | if err != nil { 29 | log.Err(err).Msg("rightShift bitcount could not be parsed") 30 | } 31 | rs.bitcount = uint32(buf) 32 | rs.bitcountSet = true 33 | log.Info().Msg("rightShift bitcount successfully parsed") 34 | } 35 | return rs, err 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_appengine.go: -------------------------------------------------------------------------------- 1 | //go:build appengine 2 | // +build appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable returns new instance of Writer which handles escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | 32 | // EnableColorsStdout enable colors if possible. 33 | func EnableColorsStdout(enabled *bool) func() { 34 | if enabled != nil { 35 | *enabled = true 36 | } 37 | return func() {} 38 | } 39 | -------------------------------------------------------------------------------- /a2l/sub_function.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type subFunction struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseSubFunction(tok *tokenGenerator) (subFunction, error) { 15 | sf := subFunction{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("subFunction could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endSubFunctionToken { 25 | sf.identifierSet = true 26 | log.Info().Msg("subFunction identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("subFunction could not be parsed") 31 | break forLoop 32 | } else if !sf.identifierSet { 33 | sf.identifier = append(sf.identifier, tok.current()) 34 | } 35 | } 36 | return sf, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/virtual.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type virtual struct { 10 | measuringChannel []string 11 | measuringChannelSet bool 12 | } 13 | 14 | func parseVirtual(tok *tokenGenerator) (virtual, error) { 15 | v := virtual{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("virtual could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endVirtualToken { 25 | v.measuringChannelSet = true 26 | log.Info().Msg("virtual measuringChannel successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("virtual could not be parsed") 31 | break forLoop 32 | } else if !v.measuringChannelSet { 33 | v.measuringChannel = append(v.measuringChannel, tok.current()) 34 | } 35 | } 36 | return v, err 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc64 6 | // +build aix,ppc64 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev & 0x3fffffff00000000) >> 32) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32((dev & 0x00000000ffffffff) >> 0) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | var DEVNO64 uint64 27 | DEVNO64 = 0x8000000000000000 28 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 29 | } 30 | -------------------------------------------------------------------------------- /a2l/no_of_interfaces.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type noOfInterfaces struct { 11 | num uint16 12 | numSet bool 13 | } 14 | 15 | func parseNoOfInterfaces(tok *tokenGenerator) (noOfInterfaces, error) { 16 | noi := noOfInterfaces{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("noOfInterfaces could not be parsed: unexpected end of file") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("noOfInterfaces could not be parsed") 25 | } else if !noi.numSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("attribute num could not be parsed") 30 | } 31 | noi.num = uint16(buf) 32 | noi.numSet = true 33 | log.Info().Msg("noOfInterfaces num successfully parsed") 34 | } 35 | return noi, err 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | //go:build !windows && !appengine 2 | // +build !windows,!appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable returns new instance of Writer which handles escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | 32 | // EnableColorsStdout enable colors if possible. 33 | func EnableColorsStdout(enabled *bool) func() { 34 | if enabled != nil { 35 | *enabled = true 36 | } 37 | return func() {} 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && netbsd 6 | // +build 386,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && netbsd 6 | // +build amd64,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && netbsd 6 | // +build arm,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && netbsd 6 | // +build arm64,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | -------------------------------------------------------------------------------- /a2l/in_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type inMeasurement struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseInMeasurement(tok *tokenGenerator) (inMeasurement, error) { 15 | im := inMeasurement{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("inMeasurement could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endInMeasurementToken { 25 | im.identifierSet = true 26 | log.Info().Msg("inMeasurement identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("inMeasurement could not be parsed") 31 | break forLoop 32 | } else if !im.identifierSet { 33 | im.identifier = append(im.identifier, tok.current()) 34 | } 35 | } 36 | return im, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/loc_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type locMeasurement struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseLocMeasurement(tok *tokenGenerator) (locMeasurement, error) { 15 | lm := locMeasurement{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("locMeasurement could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endLocMeasurementToken { 25 | lm.identifierSet = true 26 | log.Info().Msg("locMeasurement identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("locMeasurement could not be parsed") 31 | break forLoop 32 | } else if !lm.identifierSet { 33 | lm.identifier = append(lm.identifier, tok.current()) 34 | } 35 | } 36 | return lm, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/out_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type outMeasurement struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseOutMeasurement(tok *tokenGenerator) (outMeasurement, error) { 15 | om := outMeasurement{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("outMeasurement could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endOutMeasurementToken { 25 | om.identifierSet = true 26 | log.Info().Msg("outMeasurement identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("outMeasurement could not be parsed") 31 | break forLoop 32 | } else if !om.identifierSet { 33 | om.identifier = append(om.identifier, tok.current()) 34 | } 35 | } 36 | return om, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/ref_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type refMeasurement struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseRefMeasurement(tok *tokenGenerator) (refMeasurement, error) { 15 | rm := refMeasurement{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("refMeasurement could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endRefMeasurementToken { 25 | rm.identifierSet = true 26 | log.Info().Msg("refMeasurement identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("refMeasurement could not be parsed") 31 | break forLoop 32 | } else if !rm.identifierSet { 33 | rm.identifier = append(rm.identifier, tok.current()) 34 | } 35 | } 36 | return rm, err 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /a2l/def_characteristic.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type defCharacteristic struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseDefCharacteristic(tok *tokenGenerator) (defCharacteristic, error) { 15 | dc := defCharacteristic{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("defCharacteristic could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endDefCharacteristicToken { 25 | dc.identifierSet = true 26 | log.Info().Msg("defCharacteristic identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("defCharacteristic could not be parsed") 31 | break forLoop 32 | } else if !dc.identifierSet { 33 | dc.identifier = append(dc.identifier, tok.current()) 34 | } 35 | } 36 | return dc, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/ref_characteristic.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type refCharacteristic struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseRefCharacteristic(tok *tokenGenerator) (refCharacteristic, error) { 15 | rc := refCharacteristic{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("refCharacteristic could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endRefCharacteristicToken { 25 | rc.identifierSet = true 26 | log.Info().Msg("refCharacteristic identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("refCharacteristic could not be parsed") 31 | break forLoop 32 | } else if !rc.identifierSet { 33 | rc.identifier = append(rc.identifier, tok.current()) 34 | } 35 | } 36 | return rc, err 37 | } 38 | -------------------------------------------------------------------------------- /no_rescale_x.go: -------------------------------------------------------------------------------- 1 | package calibrationReader 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/asap2Go/calibrationReader/a2l" 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // getNoRescaleX retrieves the number of Rescale X-axis pairs according to its layout specified within the record layout and their values as calibrated in the hex file 11 | func (cd *CalibrationData) getNoRescaleX(rl *a2l.RecordLayout, curPos *uint32) (int64, error) { 12 | if !rl.NoRescaleX.DatatypeSet { 13 | err := errors.New("noRescaleX datatype not set") 14 | log.Err(err).Msg("could not retrieve noRescaleX value") 15 | return 0, err 16 | } 17 | bufBytes, err := cd.getValue(curPos, rl.NoRescaleX.Datatype, rl) 18 | if err != nil { 19 | log.Err(err).Msg("could not retrieve noRescaleX value") 20 | return 0, err 21 | } 22 | val, err := cd.convertByteSliceToDatatype(bufBytes, rl.NoRescaleX.Datatype) 23 | if err != nil { 24 | log.Err(err).Msg("could not retrieve noRescaleX value") 25 | return 0, err 26 | } 27 | *curPos += uint32(rl.NoRescaleX.Datatype.GetDatatypeLength()) 28 | return int64(val), err 29 | } 30 | -------------------------------------------------------------------------------- /a2l/default_value_numeric.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type DefaultValueNumeric struct { 11 | DisplayValue float64 12 | DisplayValueSet bool 13 | } 14 | 15 | func parseDefaultValueNumeric(tok *tokenGenerator) (DefaultValueNumeric, error) { 16 | dvn := DefaultValueNumeric{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("defaultValueNumeric could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("defaultValueNumeric could not be parsed") 25 | } else if !dvn.DisplayValueSet { 26 | var buf float64 27 | buf, err = strconv.ParseFloat(tok.current(), 64) 28 | if err != nil { 29 | log.Err(err).Msg("attribute displayValue could not be parsed") 30 | } 31 | dvn.DisplayValue = buf 32 | dvn.DisplayValueSet = true 33 | log.Info().Msg("defaultValueNumeric displayValue successfully parsed") 34 | } 35 | return dvn, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/transformer_in_object.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type transformerInObject struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseTransformerInObject(tok *tokenGenerator) (transformerInObject, error) { 15 | tio := transformerInObject{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("transformerInObject could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endTransformerInObjectsToken { 25 | tio.identifierSet = true 26 | log.Info().Msg("transformerInObject identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("transformerInObject could not be parsed") 31 | break forLoop 32 | } else if !tio.identifierSet { 33 | tio.identifier = append(tio.identifier, tok.current()) 34 | } 35 | } 36 | return tio, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/ar_prototype_of.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | //arPrototypeOf usage shall not lead to circular dependencies between functions and prototypes. 10 | //arPrototypeOf shall not reference to the FUNCTION where it is stated. 11 | type arPrototypeOf struct { 12 | //Name of the FUNCTION which describes the "SwComponentType" from which "SwComponentPrototype" is derived. 13 | name string 14 | nameSet bool 15 | } 16 | 17 | func parseArPrototypeOf(tok *tokenGenerator) (arPrototypeOf, error) { 18 | apo := arPrototypeOf{} 19 | var err error 20 | tok.next() 21 | if tok.current() == emptyToken { 22 | err = errors.New("unexpected end of file") 23 | log.Err(err).Msg("arPrototypeOf could not be parsed") 24 | } else if isKeyword(tok.current()) { 25 | err = errors.New("unexpected token " + tok.current()) 26 | log.Err(err).Msg("arPrototypeOf could not be parsed") 27 | } else if !apo.nameSet { 28 | apo.name = tok.current() 29 | apo.nameSet = true 30 | log.Info().Msg("arPrototypeOf name successfully parsed") 31 | } 32 | return apo, err 33 | } 34 | -------------------------------------------------------------------------------- /a2l/transformer_out_object.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type transformerOutObject struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseTransformerOutObject(tok *tokenGenerator) (transformerOutObject, error) { 15 | tio := transformerOutObject{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("transformerOutObject could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endTransformerOutObjectsToken { 25 | tio.identifierSet = true 26 | log.Info().Msg("transformerOutObject identifier successfully parsed") 27 | break forLoop 28 | } else if isKeyword(tok.current()) { 29 | err = errors.New("unexpected token " + tok.current()) 30 | log.Err(err).Msg("transformerOutObject could not be parsed") 31 | break forLoop 32 | } else if !tio.identifierSet { 33 | tio.identifier = append(tio.identifier, tok.current()) 34 | } 35 | } 36 | return tio, err 37 | } 38 | -------------------------------------------------------------------------------- /a2l/fix_no_axis_pts_4.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type FixNoAxisPts4 struct { 11 | NumberOfAxisPoints uint16 12 | NumberOfAxisPointsSet bool 13 | } 14 | 15 | func parseFixNoAxisPts4(tok *tokenGenerator) (FixNoAxisPts4, error) { 16 | fnap := FixNoAxisPts4{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("fixNoAxisPts4 could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("fixNoAxisPts4 could not be parsed") 25 | } else if !fnap.NumberOfAxisPointsSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("fixNoAxisPts4 numberOfAxisPoints could not be parsed") 30 | } 31 | fnap.NumberOfAxisPoints = uint16(buf) 32 | fnap.NumberOfAxisPointsSet = true 33 | log.Info().Msg("fixNoAxisPts4 numberOfAxisPoints successfully parsed") 34 | } 35 | return fnap, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/fix_no_axis_pts_5.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type FixNoAxisPts5 struct { 11 | NumberOfAxisPoints uint16 12 | NumberOfAxisPointsSet bool 13 | } 14 | 15 | func parseFixNoAxisPts5(tok *tokenGenerator) (FixNoAxisPts5, error) { 16 | fnap := FixNoAxisPts5{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("fixNoAxisPts5 could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("fixNoAxisPts5 could not be parsed") 25 | } else if !fnap.NumberOfAxisPointsSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("fixNoAxisPts5 numberOfAxisPoints could not be parsed") 30 | } 31 | fnap.NumberOfAxisPoints = uint16(buf) 32 | fnap.NumberOfAxisPointsSet = true 33 | log.Info().Msg("fixNoAxisPts5 numberOfAxisPoints successfully parsed") 34 | } 35 | return fnap, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/fix_no_axis_pts_x.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type FixNoAxisPtsX struct { 11 | NumberOfAxisPoints uint16 12 | NumberOfAxisPointsSet bool 13 | } 14 | 15 | func parseFixNoAxisPtsX(tok *tokenGenerator) (FixNoAxisPtsX, error) { 16 | fnapx := FixNoAxisPtsX{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("fixNoAxisPtsx could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("fixNoAxisPtsX could not be parsed") 25 | } else if !fnapx.NumberOfAxisPointsSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("fixNoAxisPtsx numberOfAxisPoints could not be parsed") 30 | } 31 | fnapx.NumberOfAxisPoints = uint16(buf) 32 | fnapx.NumberOfAxisPointsSet = true 33 | log.Info().Msg("fixNoAxisPtsx numberOfAxisPoints successfully parsed") 34 | } 35 | return fnapx, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/fix_no_axis_pts_y.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type FixNoAxisPtsY struct { 11 | NumberOfAxisPoints uint16 12 | NumberOfAxisPointsSet bool 13 | } 14 | 15 | func parseFixNoAxisPtsY(tok *tokenGenerator) (FixNoAxisPtsY, error) { 16 | fnapy := FixNoAxisPtsY{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("fixNoAxisPtsy could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("fixNoAxisPtsY could not be parsed") 25 | } else if !fnapy.NumberOfAxisPointsSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("fixNoAxisPtsy numberOfAxisPoints could not be parsed") 30 | } 31 | fnapy.NumberOfAxisPoints = uint16(buf) 32 | fnapy.NumberOfAxisPointsSet = true 33 | log.Info().Msg("fixNoAxisPtsy numberOfAxisPoints successfully parsed") 34 | } 35 | return fnapy, err 36 | } 37 | -------------------------------------------------------------------------------- /a2l/fix_no_axis_pts_z.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type FixNoAxisPtsZ struct { 11 | NumberOfAxisPoints uint16 12 | NumberOfAxisPointsSet bool 13 | } 14 | 15 | func parseFixNoAxisPtsZ(tok *tokenGenerator) (FixNoAxisPtsZ, error) { 16 | fnapz := FixNoAxisPtsZ{} 17 | var err error 18 | tok.next() 19 | if tok.current() == emptyToken { 20 | err = errors.New("unexpected end of file") 21 | log.Err(err).Msg("fixNoAxisPtsz could not be parsed") 22 | } else if isKeyword(tok.current()) { 23 | err = errors.New("unexpected token " + tok.current()) 24 | log.Err(err).Msg("fixNoAxisPtsZ could not be parsed") 25 | } else if !fnapz.NumberOfAxisPointsSet { 26 | var buf uint64 27 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 28 | if err != nil { 29 | log.Err(err).Msg("fixNoAxisPtsz numberOfAxisPoints could not be parsed") 30 | } 31 | fnapz.NumberOfAxisPoints = uint16(buf) 32 | fnapz.NumberOfAxisPointsSet = true 33 | log.Info().Msg("fixNoAxisPtsz numberOfAxisPoints successfully parsed") 34 | } 35 | return fnapz, err 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Marcel Maier 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /a2l/system_constant.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type SystemConstant struct { 10 | Name string 11 | NameSet bool 12 | Value string 13 | ValueSet bool 14 | } 15 | 16 | func parseSystemConstant(tok *tokenGenerator) (SystemConstant, error) { 17 | sc := SystemConstant{} 18 | var err error 19 | forLoop: 20 | for { 21 | tok.next() 22 | if tok.current() == emptyToken { 23 | err = errors.New("unexpected end of file") 24 | log.Err(err).Msg("systemConstant: " + sc.Name + " could not be parsed") 25 | break forLoop 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("systemConstant could not be parsed") 29 | break forLoop 30 | } else if !sc.NameSet { 31 | sc.Name = tok.current() 32 | sc.NameSet = true 33 | log.Info().Msg("systemConstant name successfully parsed") 34 | } else if !sc.ValueSet { 35 | sc.Value = tok.current() 36 | sc.ValueSet = true 37 | log.Info().Msg("systemConstant value successfully parsed") 38 | break forLoop 39 | } 40 | } 41 | return sc, err 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/encoder_cbor.go: -------------------------------------------------------------------------------- 1 | // +build binary_log 2 | 3 | package zerolog 4 | 5 | // This file contains bindings to do binary encoding. 6 | 7 | import ( 8 | "github.com/rs/zerolog/internal/cbor" 9 | ) 10 | 11 | var ( 12 | _ encoder = (*cbor.Encoder)(nil) 13 | 14 | enc = cbor.Encoder{} 15 | ) 16 | 17 | func init() { 18 | // using closure to reflect the changes at runtime. 19 | cbor.JSONMarshalFunc = func(v interface{}) ([]byte, error) { 20 | return InterfaceMarshalFunc(v) 21 | } 22 | } 23 | 24 | func appendJSON(dst []byte, j []byte) []byte { 25 | return cbor.AppendEmbeddedJSON(dst, j) 26 | } 27 | 28 | // decodeIfBinaryToString - converts a binary formatted log msg to a 29 | // JSON formatted String Log message. 30 | func decodeIfBinaryToString(in []byte) string { 31 | return cbor.DecodeIfBinaryToString(in) 32 | } 33 | 34 | func decodeObjectToStr(in []byte) string { 35 | return cbor.DecodeObjectToStr(in) 36 | } 37 | 38 | // decodeIfBinaryToBytes - converts a binary formatted log msg to a 39 | // JSON formatted Bytes Log message. 40 | func decodeIfBinaryToBytes(in []byte) []byte { 41 | return cbor.DecodeIfBinaryToBytes(in) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | func setTimespec(sec, nsec int64) Timespec { 8 | return Timespec{Sec: sec, Nsec: nsec} 9 | } 10 | 11 | func setTimeval(sec, usec int64) Timeval { 12 | return Timeval{Sec: sec, Usec: usec} 13 | } 14 | 15 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 16 | k.Ident = uint64(fd) 17 | k.Filter = int16(mode) 18 | k.Flags = uint16(flags) 19 | } 20 | 21 | func (iov *Iovec) SetLen(length int) { 22 | iov.Len = uint64(length) 23 | } 24 | 25 | func (msghdr *Msghdr) SetControllen(length int) { 26 | msghdr.Controllen = uint32(length) 27 | } 28 | 29 | func (msghdr *Msghdr) SetIovlen(length int) { 30 | msghdr.Iovlen = uint32(length) 31 | } 32 | 33 | func (cmsg *Cmsghdr) SetLen(length int) { 34 | cmsg.Len = uint32(length) 35 | } 36 | 37 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 38 | // of OpenBSD the syscall is called sysctl instead of __sysctl. 39 | const SYS___SYSCTL = SYS_SYSCTL 40 | -------------------------------------------------------------------------------- /licenses/github.com/rs/zerolog/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Olivier Poitrey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Olivier Poitrey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gccgo && 386 6 | // +build linux,gccgo,386 7 | 8 | package unix 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 16 | var newoffset int64 17 | offsetLow := uint32(offset & 0xffffffff) 18 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 19 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 20 | return newoffset, err 21 | } 22 | 23 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 24 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 25 | return int(fd), err 26 | } 27 | 28 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 29 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 30 | return int(fd), err 31 | } 32 | -------------------------------------------------------------------------------- /licenses/github.com/asap2Go/calibrationReader/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Marcel Maier 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /a2l/static_record_layout.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import "github.com/rs/zerolog/log" 4 | 5 | /*staticRecordLayoutKeyword states that 6 | for calibration objects with a dynamic number of axis points 7 | the calibration object does not compact or expand data 8 | when removing or inserting axis points. 9 | All record layout elements are stored at the same address 10 | as for the max. number of axis points specified at the calibration object - 11 | independent of the actual number of axis points. 12 | If the parameter STATIC_RECORD_LAYOUT is missing, 13 | the calibration objects referencing this record layout do compact / extend data when 14 | removing resp. inserting axis points and the addresses of the record layout elements 15 | depend on the actual number of axis points.*/ 16 | type staticRecordLayoutKeyword struct { 17 | value bool 18 | valueSet bool 19 | } 20 | 21 | func parseStaticRecordLayout(tok *tokenGenerator) (staticRecordLayoutKeyword, error) { 22 | srl := staticRecordLayoutKeyword{} 23 | var err error 24 | if !srl.valueSet { 25 | srl.value = true 26 | srl.valueSet = true 27 | log.Info().Msg("staticRecordLayout value successfully parsed") 28 | } 29 | return srl, err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64 || ppc64le) && gc 6 | // +build linux 7 | // +build ppc64 ppc64le 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for ppc64, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 20 | BL runtime·entersyscall(SB) 21 | MOVD a1+8(FP), R3 22 | MOVD a2+16(FP), R4 23 | MOVD a3+24(FP), R5 24 | MOVD R0, R6 25 | MOVD R0, R7 26 | MOVD R0, R8 27 | MOVD trap+0(FP), R9 // syscall entry 28 | SYSCALL R9 29 | MOVD R3, r1+32(FP) 30 | MOVD R4, r2+40(FP) 31 | BL runtime·exitsyscall(SB) 32 | RET 33 | 34 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 35 | MOVD a1+8(FP), R3 36 | MOVD a2+16(FP), R4 37 | MOVD a3+24(FP), R5 38 | MOVD R0, R6 39 | MOVD R0, R7 40 | MOVD R0, R8 41 | MOVD trap+0(FP), R9 // syscall entry 42 | SYSCALL R9 43 | MOVD R3, r1+32(FP) 44 | MOVD R4, r2+40(FP) 45 | RET 46 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/x448/float16/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /a2l/annotation_text.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | //annotationText may represent a multi-line ASCII description text (voluminous description). 10 | //Its purpose is to be an application note which explains the function of an identifier for the calibration engineer. 11 | type annotationText struct { 12 | annotationText string 13 | annotationTextSet bool 14 | } 15 | 16 | func parseAnnotationText(tok *tokenGenerator) (annotationText, error) { 17 | at := annotationText{} 18 | var err error 19 | forLoop: 20 | for { 21 | tok.next() 22 | if tok.current() == emptyToken { 23 | err = errors.New("unexpected end of file") 24 | log.Err(err).Msg("annotationText could not be parsed") 25 | break forLoop 26 | } else if tok.current() == endAnnotationTextToken { 27 | at.annotationTextSet = true 28 | break forLoop 29 | } else if isKeyword(tok.current()) { 30 | err = errors.New("unexpected token " + tok.current()) 31 | log.Err(err).Msg("annotationText could not be parsed") 32 | break forLoop 33 | } else if !at.annotationTextSet { 34 | at.annotationText = at.annotationText + spaceToken + tok.current() 35 | } 36 | } 37 | return at, err 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && openbsd 6 | // +build amd64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && openbsd 6 | // +build arm64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ppc64 && openbsd 6 | // +build ppc64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/ppc64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && openbsd 6 | // +build 386,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && openbsd 6 | // +build arm,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build riscv64 && openbsd 6 | // +build riscv64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/riscv64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/unveil_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | // Unveil implements the unveil syscall. 13 | // For more information see unveil(2). 14 | // Note that the special case of blocking further 15 | // unveil calls is handled by UnveilBlock. 16 | func Unveil(path string, flags string) error { 17 | pathPtr, err := syscall.BytePtrFromString(path) 18 | if err != nil { 19 | return err 20 | } 21 | flagsPtr, err := syscall.BytePtrFromString(flags) 22 | if err != nil { 23 | return err 24 | } 25 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 26 | if e != 0 { 27 | return e 28 | } 29 | return nil 30 | } 31 | 32 | // UnveilBlock blocks future unveil calls. 33 | // For more information see unveil(2). 34 | func UnveilBlock() error { 35 | // Both pointers must be nil. 36 | var pathUnsafe, flagsUnsafe unsafe.Pointer 37 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 38 | if e != 0 { 39 | return e 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /a2l/formula.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type Formula struct { 10 | fx []string 11 | fxSet bool 12 | formulaInv formulaInv 13 | } 14 | 15 | func parseFormula(tok *tokenGenerator) (Formula, error) { 16 | f := Formula{} 17 | var err error 18 | forLoop: 19 | for { 20 | switch tok.next() { 21 | case formulaInvToken: 22 | f.formulaInv, err = parseFormulaInv(tok) 23 | if err != nil { 24 | log.Err(err).Msg("formula formulaInv could not be parsed") 25 | break forLoop 26 | } 27 | log.Info().Msg("formula formulaInv successfully parsed") 28 | default: 29 | if tok.current() == emptyToken { 30 | err = errors.New("unexpected end of file") 31 | log.Err(err).Msg("formula could not be parsed") 32 | break forLoop 33 | } else if tok.current() == endFormulaToken { 34 | f.fxSet = true 35 | log.Info().Msg("formula fx successfully parsed") 36 | break forLoop 37 | } else if isKeyword(tok.current()) { 38 | err = errors.New("unexpected token " + tok.current()) 39 | log.Err(err).Msg("formula could not be parsed") 40 | break forLoop 41 | } else if !f.fxSet { 42 | f.fx = append(f.fx, tok.current()) 43 | } 44 | } 45 | } 46 | return f, err 47 | } 48 | -------------------------------------------------------------------------------- /a2l/array_size.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | //arraySize marks a measurement object as an array of measurement values. 11 | //The keyword ARRAY_SIZE is covered by the keyword MATRIX_DIM. 12 | //It isrecommended to use the MATRIX_DIM instead of ARRAY_SIZE. 13 | type arraySize struct { 14 | //Number of measurement values included in respective measurement object. 15 | number uint16 16 | numberSet bool 17 | } 18 | 19 | func parseArraySize(tok *tokenGenerator) (arraySize, error) { 20 | as := arraySize{} 21 | var err error 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("arraySize could not be parsed") 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("arraySize could not be parsed") 29 | } else if !as.numberSet { 30 | var buf uint64 31 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 32 | if err != nil { 33 | log.Err(err).Msg("arraySize number could not be parsed") 34 | } 35 | as.number = uint16(buf) 36 | as.numberSet = true 37 | log.Info().Msg("arraySize number successfully parsed") 38 | } 39 | return as, err 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | // NonColorable holds writer but removes escape sequence. 9 | type NonColorable struct { 10 | out io.Writer 11 | } 12 | 13 | // NewNonColorable returns new instance of Writer which removes escape sequence from Writer. 14 | func NewNonColorable(w io.Writer) io.Writer { 15 | return &NonColorable{out: w} 16 | } 17 | 18 | // Write writes data on console 19 | func (w *NonColorable) Write(data []byte) (n int, err error) { 20 | er := bytes.NewReader(data) 21 | var plaintext bytes.Buffer 22 | loop: 23 | for { 24 | c1, err := er.ReadByte() 25 | if err != nil { 26 | plaintext.WriteTo(w.out) 27 | break loop 28 | } 29 | if c1 != 0x1b { 30 | plaintext.WriteByte(c1) 31 | continue 32 | } 33 | _, err = plaintext.WriteTo(w.out) 34 | if err != nil { 35 | break loop 36 | } 37 | c2, err := er.ReadByte() 38 | if err != nil { 39 | break loop 40 | } 41 | if c2 != 0x5b { 42 | continue 43 | } 44 | 45 | for { 46 | c, err := er.ReadByte() 47 | if err != nil { 48 | break loop 49 | } 50 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 51 | break 52 | } 53 | } 54 | } 55 | 56 | return len(data), nil 57 | } 58 | -------------------------------------------------------------------------------- /a2l/fix_axis_par_list.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type fixAxisParList struct { 11 | axisPtsValue []float64 12 | axisPtsValueSet bool 13 | } 14 | 15 | func parseFixAxisParList(tok *tokenGenerator) (fixAxisParList, error) { 16 | fapl := fixAxisParList{} 17 | var err error 18 | forLoop: 19 | for { 20 | tok.next() 21 | if tok.current() == emptyToken { 22 | err = errors.New("unexpected end of file") 23 | log.Err(err).Msg("fixAxisParList could not be parsed") 24 | break forLoop 25 | } else if tok.current() == endFixAxisParListToken { 26 | fapl.axisPtsValueSet = true 27 | log.Info().Msg("fixAxisParList axisPtsValue successfully parsed") 28 | break forLoop 29 | } else if isKeyword(tok.current()) { 30 | err = errors.New("unexpected token " + tok.current()) 31 | log.Err(err).Msg("fixAxisParList could not be parsed") 32 | break forLoop 33 | } else if !fapl.axisPtsValueSet { 34 | var buf float64 35 | buf, err = strconv.ParseFloat(tok.current(), 64) 36 | if err != nil { 37 | log.Err(err).Msg("attribute axisPtsValue could not be parsed") 38 | break forLoop 39 | } 40 | fapl.axisPtsValue = append(fapl.axisPtsValue, buf) 41 | } 42 | } 43 | return fapl, err 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build openbsd && !mips64 6 | // +build openbsd,!mips64 7 | 8 | package unix 9 | 10 | import _ "unsafe" 11 | 12 | // Implemented in the runtime package (runtime/sys_openbsd3.go) 13 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2 uintptr, err Errno) 16 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 17 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 18 | 19 | //go:linkname syscall_syscall syscall.syscall 20 | //go:linkname syscall_syscall6 syscall.syscall6 21 | //go:linkname syscall_syscall10 syscall.syscall10 22 | //go:linkname syscall_rawSyscall syscall.rawSyscall 23 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 24 | 25 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { 26 | return syscall_syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, 0) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build riscv64 && gc 6 | // +build riscv64 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for linux/riscv64. 13 | // 14 | // Where available, just jump to package syscall's implementation of 15 | // these functions. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 24 | CALL runtime·entersyscall(SB) 25 | MOV a1+8(FP), A0 26 | MOV a2+16(FP), A1 27 | MOV a3+24(FP), A2 28 | MOV trap+0(FP), A7 // syscall entry 29 | ECALL 30 | MOV A0, r1+32(FP) // r1 31 | MOV A1, r2+40(FP) // r2 32 | CALL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | JMP syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | JMP syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOV a1+8(FP), A0 43 | MOV a2+16(FP), A1 44 | MOV a3+24(FP), A2 45 | MOV trap+0(FP), A7 // syscall entry 46 | ECALL 47 | MOV A0, r1+32(FP) 48 | MOV A1, r2+40(FP) 49 | RET 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build dragonfly || freebsd || linux || netbsd || openbsd 6 | // +build dragonfly freebsd linux netbsd openbsd 7 | 8 | package unix 9 | 10 | import "unsafe" 11 | 12 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 13 | // systems by fcntl_linux_32bit.go to be SYS_FCNTL64. 14 | var fcntl64Syscall uintptr = SYS_FCNTL 15 | 16 | func fcntl(fd int, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, uintptr(fd), uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 26 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 27 | return fcntl(int(fd), cmd, arg) 28 | } 29 | 30 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 31 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 32 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 33 | if errno == 0 { 34 | return nil 35 | } 36 | return errno 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) 4 | [![Codecov](https://codecov.io/gh/mattn/go-isatty/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-isatty) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) 7 | 8 | isatty for golang 9 | 10 | ## Usage 11 | 12 | ```go 13 | package main 14 | 15 | import ( 16 | "fmt" 17 | "github.com/mattn/go-isatty" 18 | "os" 19 | ) 20 | 21 | func main() { 22 | if isatty.IsTerminal(os.Stdout.Fd()) { 23 | fmt.Println("Is Terminal") 24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { 25 | fmt.Println("Is Cygwin/MSYS2 Terminal") 26 | } else { 27 | fmt.Println("Is Not Terminal") 28 | } 29 | } 30 | ``` 31 | 32 | ## Installation 33 | 34 | ``` 35 | $ go get github.com/mattn/go-isatty 36 | ``` 37 | 38 | ## License 39 | 40 | MIT 41 | 42 | ## Author 43 | 44 | Yasuhiro Matsumoto (a.k.a mattn) 45 | 46 | ## Thanks 47 | 48 | * k-takata: base idea for IsCygwinTerminal 49 | 50 | https://github.com/k-takata/go-iscygpty 51 | -------------------------------------------------------------------------------- /a2l/addr_epk_test.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/rs/zerolog" 7 | ) 8 | 9 | //create unit tests for the following functions: parseAddrEpk 10 | // - valid addrEpk 11 | // - empty addrEpk 12 | // - invalid addrEpk 13 | // - unexpected token 14 | 15 | func TestParseAddrEpk_Valid(t *testing.T) { 16 | configureLogger() 17 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 18 | // valid addrEpk 19 | tokenList = []string{emptyToken, "0x2000"} 20 | tok := newTokenGenerator() 21 | _, err := parseAddrEpk(&tok) 22 | if err != nil { 23 | t.Fatalf("failed parsing with error: %s.", err) 24 | } 25 | } 26 | 27 | func TestParseAddrEpk_Empty(t *testing.T) { 28 | configureLogger() 29 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 30 | // empty addrEpk 31 | tokenList = []string{emptyToken, emptyToken} 32 | tok := newTokenGenerator() 33 | _, err := parseAddrEpk(&tok) 34 | if err == nil { 35 | t.Fatalf("failed test with undetected error: %s.", err) 36 | } 37 | } 38 | 39 | func TestParseAddrEpk_UnexpectedKeyword(t *testing.T) { 40 | configureLogger() 41 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 42 | // invalid addrEpk 43 | tokenList = []string{emptyToken, beginA2mlToken} 44 | tok := newTokenGenerator() 45 | _, err := parseAddrEpk(&tok) 46 | if err == nil { 47 | t.Fatalf("failed test with undetected error: %s.", err) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /a2l/frame_measurement.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type frameMeasurement struct { 10 | identifier []string 11 | identifierSet bool 12 | } 13 | 14 | func parseFrameMeasurement(tok *tokenGenerator) (frameMeasurement, error) { 15 | fm := frameMeasurement{} 16 | var err error 17 | forLoop: 18 | for { 19 | tok.next() 20 | if tok.current() == emptyToken { 21 | err = errors.New("unexpected end of file") 22 | log.Err(err).Msg("frameMeasurement could not be parsed") 23 | break forLoop 24 | } else if tok.current() == endFrameToken || tok.current() == beginIfDataToken { 25 | //there can be multiple identifiers 26 | //The end of the identifier listing is end the of the containing FRAME structure or the beginning of a IfData Structure 27 | fm.identifierSet = true 28 | log.Info().Msg("frameMeasurement identifier successfully parsed") 29 | //go back one token so the parseFrame Method is able to detect them 30 | tok.previous() 31 | break forLoop 32 | } else if isKeyword(tok.current()) { 33 | err = errors.New("unexpected token " + tok.current()) 34 | log.Err(err).Msg("frameMeasurement could not be parsed") 35 | break forLoop 36 | } else if !fm.identifierSet { 37 | fm.identifier = append(fm.identifier, tok.current()) 38 | } 39 | } 40 | return fm, err 41 | } 42 | -------------------------------------------------------------------------------- /a2l/symbol_link.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type symbolLink struct { 11 | symbolName string 12 | symbolNameSet bool 13 | offset int32 14 | offsetSet bool 15 | } 16 | 17 | func parseSymbolLink(tok *tokenGenerator) (symbolLink, error) { 18 | sl := symbolLink{} 19 | var err error 20 | forLoop: 21 | for { 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("symbolLink could not be parsed") 26 | break forLoop 27 | } else if isKeyword(tok.current()) { 28 | err = errors.New("unexpected token " + tok.current()) 29 | log.Err(err).Msg("symbolLink could not be parsed") 30 | break forLoop 31 | } else if !sl.symbolNameSet { 32 | sl.symbolName = tok.current() 33 | sl.symbolNameSet = true 34 | log.Info().Msg("symbolLink symbolName successfully parsed") 35 | } else if !sl.offsetSet { 36 | var buf int64 37 | buf, err = strconv.ParseInt(tok.current(), 10, 32) 38 | if err != nil { 39 | log.Err(err).Msg("symbolLink offset could not be parsed") 40 | break forLoop 41 | } 42 | sl.offset = int32(buf) 43 | sl.offsetSet = true 44 | log.Info().Msg("symbolLink offset successfully parsed") 45 | break forLoop 46 | } 47 | 48 | } 49 | return sl, err 50 | } 51 | -------------------------------------------------------------------------------- /a2l/virtual_characteristic.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type VirtualCharacteristic struct { 10 | formula string 11 | formulaSet bool 12 | characteristic []string 13 | characteristicSet bool 14 | } 15 | 16 | func parseVirtualCharacteristic(tok *tokenGenerator) (VirtualCharacteristic, error) { 17 | vc := VirtualCharacteristic{} 18 | var err error 19 | forLoop: 20 | for { 21 | tok.next() 22 | if tok.current() == emptyToken { 23 | err = errors.New("unexpected end of file") 24 | log.Err(err).Msg("virtualCharacteristic could not be parsed") 25 | break forLoop 26 | } else if tok.current() == endVirtualCharacteristicToken { 27 | vc.characteristicSet = true 28 | log.Info().Msg("virtualCharacteristic characteristic successfully parsed") 29 | break forLoop 30 | } else if isKeyword(tok.current()) { 31 | err = errors.New("unexpected token " + tok.current()) 32 | log.Err(err).Msg("virtualCharacteristic could not be parsed") 33 | break forLoop 34 | } else if !vc.formulaSet { 35 | vc.formula = tok.current() 36 | vc.formulaSet = true 37 | log.Info().Msg("virtualCharacteristic formula successfully parsed") 38 | } else if !vc.characteristicSet { 39 | vc.characteristic = append(vc.characteristic, tok.current()) 40 | } 41 | } 42 | return vc, err 43 | } 44 | -------------------------------------------------------------------------------- /a2l/dependent_characteristic.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type DependentCharacteristic struct { 10 | formula string 11 | formulaSet bool 12 | characteristic []string 13 | characteristicSet bool 14 | } 15 | 16 | func parseDependentCharacteristic(tok *tokenGenerator) (DependentCharacteristic, error) { 17 | dc := DependentCharacteristic{} 18 | var err error 19 | forLoop: 20 | for { 21 | tok.next() 22 | if tok.current() == emptyToken { 23 | err = errors.New("unexpected end of file") 24 | log.Err(err).Msg("dependentCharacteristic could not be parsed") 25 | break forLoop 26 | } else if tok.current() == endDependentCharacteristicToken { 27 | dc.characteristicSet = true 28 | log.Info().Msg("dependentCharacteristic characteristic successfully parsed") 29 | break forLoop 30 | } else if isKeyword(tok.current()) { 31 | err = errors.New("unexpected token " + tok.current()) 32 | log.Err(err).Msg("dependentCharacteristic could not be parsed") 33 | break forLoop 34 | } else if !dc.formulaSet { 35 | dc.formula = tok.current() 36 | dc.formulaSet = true 37 | log.Info().Msg("dependentCharacteristic formula successfully parsed") 38 | } else if !dc.characteristicSet { 39 | dc.characteristic = append(dc.characteristic, tok.current()) 40 | } 41 | 42 | } 43 | return dc, err 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && arm64 && gc 6 | // +build linux 7 | // +build arm64 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // Just jump to package syscall's implementation for all these functions. 13 | // The runtime may know about them. 14 | 15 | TEXT ·Syscall(SB),NOSPLIT,$0-56 16 | B syscall·Syscall(SB) 17 | 18 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 19 | B syscall·Syscall6(SB) 20 | 21 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 22 | BL runtime·entersyscall(SB) 23 | MOVD a1+8(FP), R0 24 | MOVD a2+16(FP), R1 25 | MOVD a3+24(FP), R2 26 | MOVD $0, R3 27 | MOVD $0, R4 28 | MOVD $0, R5 29 | MOVD trap+0(FP), R8 // syscall entry 30 | SVC 31 | MOVD R0, r1+32(FP) // r1 32 | MOVD R1, r2+40(FP) // r2 33 | BL runtime·exitsyscall(SB) 34 | RET 35 | 36 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 37 | B syscall·RawSyscall(SB) 38 | 39 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 40 | B syscall·RawSyscall6(SB) 41 | 42 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 43 | MOVD a1+8(FP), R0 44 | MOVD a2+16(FP), R1 45 | MOVD a3+24(FP), R2 46 | MOVD $0, R3 47 | MOVD $0, R4 48 | MOVD $0, R5 49 | MOVD trap+0(FP), R8 // syscall entry 50 | SVC 51 | MOVD R0, r1+32(FP) 52 | MOVD R1, r2+40(FP) 53 | RET 54 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && go1.12 6 | // +build darwin,go1.12 7 | 8 | package unix 9 | 10 | import _ "unsafe" 11 | 12 | // Implemented in the runtime package (runtime/sys_darwin.go) 13 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 16 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only 17 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 18 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 19 | func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 20 | 21 | //go:linkname syscall_syscall syscall.syscall 22 | //go:linkname syscall_syscall6 syscall.syscall6 23 | //go:linkname syscall_syscall6X syscall.syscall6X 24 | //go:linkname syscall_syscall9 syscall.syscall9 25 | //go:linkname syscall_rawSyscall syscall.rawSyscall 26 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 27 | //go:linkname syscall_syscallPtr syscall.syscallPtr 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for arm, Linux 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 24 | BL runtime·entersyscall(SB) 25 | MOVW trap+0(FP), R7 26 | MOVW a1+4(FP), R0 27 | MOVW a2+8(FP), R1 28 | MOVW a3+12(FP), R2 29 | MOVW $0, R3 30 | MOVW $0, R4 31 | MOVW $0, R5 32 | SWI $0 33 | MOVW R0, r1+16(FP) 34 | MOVW $0, R0 35 | MOVW R0, r2+20(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 40 | B syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 43 | B syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 46 | MOVW trap+0(FP), R7 // syscall entry 47 | MOVW a1+4(FP), R0 48 | MOVW a2+8(FP), R1 49 | MOVW a3+12(FP), R2 50 | SWI $0 51 | MOVW R0, r1+16(FP) 52 | MOVW $0, R0 53 | MOVW R0, r2+20(FP) 54 | RET 55 | 56 | TEXT ·seek(SB),NOSPLIT,$0-28 57 | B syscall·seek(SB) 58 | -------------------------------------------------------------------------------- /a2l/annotation_label_test.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/rs/zerolog" 7 | ) 8 | 9 | //create unit tests for the following functions: parseAnnotationLabel 10 | // - valid annotationLabel 11 | // - empty annotationLabel 12 | // - unexpected token 13 | 14 | func TestParseAnnotationLabel_Valid(t *testing.T) { 15 | configureLogger() 16 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 17 | // valid annotationLabel 18 | tokenList = []string{emptyToken, "TEST"} 19 | tok := newTokenGenerator() 20 | _, err := parseAnnotationLabel(&tok) 21 | if err != nil { 22 | t.Fatalf("failed parsing with error: %s.", err) 23 | } 24 | } 25 | 26 | func TestParseAnnotationLabel_Empty(t *testing.T) { 27 | configureLogger() 28 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 29 | // empty annotationLabel 30 | tokenList = []string{emptyToken, emptyToken} 31 | tok := newTokenGenerator() 32 | _, err := parseAnnotationLabel(&tok) 33 | if err == nil { 34 | t.Fatalf("failed test with undetected error: %s.", err) 35 | } 36 | } 37 | 38 | func TestParseAnnotationLabel_UnexpectedKeyword(t *testing.T) { 39 | configureLogger() 40 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 41 | // invalid annotationLabel 42 | tokenList = []string{emptyToken, beginA2mlToken} 43 | tok := newTokenGenerator() 44 | _, err := parseAnnotationLabel(&tok) 45 | if err == nil { 46 | t.Fatalf("failed test with undetected error: %s.", err) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /a2l/annotation_origin_test.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/rs/zerolog" 7 | ) 8 | 9 | //create unit tests for the following functions: parseAnnotationOrigin 10 | // - valid annotationOrigin 11 | // - empty annotationOrigin 12 | // - unexpected token 13 | 14 | func TestParseAnnotationOrigin_Valid(t *testing.T) { 15 | configureLogger() 16 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 17 | // valid annotationOrigin 18 | tokenList = []string{emptyToken, "TEST"} 19 | tok := newTokenGenerator() 20 | _, err := parseAnnotationOrigin(&tok) 21 | if err != nil { 22 | t.Fatalf("failed parsing with error: %s.", err) 23 | } 24 | } 25 | 26 | func TestParseAnnotationOrigin_Empty(t *testing.T) { 27 | configureLogger() 28 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 29 | // empty annotationOrigin 30 | tokenList = []string{emptyToken, emptyToken} 31 | tok := newTokenGenerator() 32 | _, err := parseAnnotationOrigin(&tok) 33 | if err == nil { 34 | t.Fatalf("failed test with undetected error: %s.", err) 35 | } 36 | } 37 | 38 | func TestParseAnnotationOrigin_UnexpectedKeyword(t *testing.T) { 39 | configureLogger() 40 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 41 | // invalid annotationOrigin 42 | tokenList = []string{emptyToken, beginAxisDescrToken} 43 | tok := newTokenGenerator() 44 | _, err := parseAnnotationOrigin(&tok) 45 | if err == nil { 46 | t.Fatalf("failed test with undetected error: %s.", err) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && s390x && gc 6 | // +build linux 7 | // +build s390x 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for s390x, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-56 20 | BR syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 23 | BR syscall·Syscall6(SB) 24 | 25 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 26 | BL runtime·entersyscall(SB) 27 | MOVD a1+8(FP), R2 28 | MOVD a2+16(FP), R3 29 | MOVD a3+24(FP), R4 30 | MOVD $0, R5 31 | MOVD $0, R6 32 | MOVD $0, R7 33 | MOVD trap+0(FP), R1 // syscall entry 34 | SYSCALL 35 | MOVD R2, r1+32(FP) 36 | MOVD R3, r2+40(FP) 37 | BL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 41 | BR syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 44 | BR syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 47 | MOVD a1+8(FP), R2 48 | MOVD a2+16(FP), R3 49 | MOVD a3+24(FP), R4 50 | MOVD $0, R5 51 | MOVD $0, R6 52 | MOVD $0, R7 53 | MOVD trap+0(FP), R1 // syscall entry 54 | SYSCALL 55 | MOVD R2, r1+32(FP) 56 | MOVD R3, r2+40(FP) 57 | RET 58 | -------------------------------------------------------------------------------- /a2l/alignment_byte.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // alignmentByte is necessary because in complex objects (maps and axis) the alignment of a value may not coincide with the bitwidth of a value. 11 | // This keyword is used to define the alignment in the case of bytes. 12 | type alignmentByte struct { 13 | //AlignmentBorder describes the border at which the value is aligned to, i.e. 14 | //its memory address must be dividable by the value AlignmentBorder. 15 | AlignmentBorder uint16 16 | AlignmentBorderSet bool 17 | } 18 | 19 | func parseAlignmentByte(tok *tokenGenerator) (alignmentByte, error) { 20 | ab := alignmentByte{} 21 | var err error 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("alignmentByte could not be parsed") 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("alignmentByte could not be parsed") 29 | } else if !ab.AlignmentBorderSet { 30 | var buf uint64 31 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 32 | if err != nil { 33 | log.Err(err).Msg("alignmentByte alignmentBorder could not be parsed") 34 | } 35 | ab.AlignmentBorder = uint16(buf) 36 | ab.AlignmentBorderSet = true 37 | log.Info().Msg("alignmentByte alignmentBorder successfully parsed") 38 | } 39 | return ab, err 40 | } 41 | -------------------------------------------------------------------------------- /a2l/alignment_long.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // alignmentLong is necessary because in complex objects (maps and axis) the alignment of a value may not coincide with the bitwidth of a value. 11 | // This keyword is used to define the alignment in the case of longs. 12 | type alignmentLong struct { 13 | //AlignmentBorder describes the border at which the value is aligned to, i.e. 14 | //its memory address must be dividable by the value AlignmentBorder. 15 | AlignmentBorder uint16 16 | AlignmentBorderSet bool 17 | } 18 | 19 | func parseAlignmentLong(tok *tokenGenerator) (alignmentLong, error) { 20 | al := alignmentLong{} 21 | var err error 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("alignmentLong could not be parsed") 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("alignmentLong could not be parsed") 29 | } else if !al.AlignmentBorderSet { 30 | var buf uint64 31 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 32 | if err != nil { 33 | log.Err(err).Msg("alignmentLong alignmentBorder could not be parsed") 34 | } 35 | al.AlignmentBorder = uint16(buf) 36 | al.AlignmentBorderSet = true 37 | log.Info().Msg("alignmentLong alignmentBorder successfully parsed") 38 | } 39 | return al, err 40 | } 41 | -------------------------------------------------------------------------------- /a2l/alignment_word.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // alignmentWord is necessary because in complex objects (maps and axis) the alignment of a value may not coincide with the bitwidth of a value. 11 | // This keyword is used to define the alignment in the case of words. 12 | type alignmentWord struct { 13 | //AlignmentBorder describes the border at which the value is aligned to, i.e. 14 | //its memory address must be dividable by the value AlignmentBorder. 15 | AlignmentBorder uint16 16 | AlignmentBorderSet bool 17 | } 18 | 19 | func parseAlignmentWord(tok *tokenGenerator) (alignmentWord, error) { 20 | aw := alignmentWord{} 21 | var err error 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("alignmentWord could not be parsed") 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("alignmentWord could not be parsed") 29 | } else if !aw.AlignmentBorderSet { 30 | var buf uint64 31 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 32 | if err != nil { 33 | log.Err(err).Msg("alignmentWord alignmentBorder could not be parsed") 34 | } 35 | aw.AlignmentBorder = uint16(buf) 36 | aw.AlignmentBorderSet = true 37 | log.Info().Msg("alignmentWord alignmentBorder successfully parsed") 38 | } 39 | return aw, err 40 | } 41 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 2 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 3 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= 4 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 5 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= 6 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 7 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 8 | github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= 9 | github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= 10 | github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= 11 | github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= 12 | github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= 13 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 14 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 15 | golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= 16 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 17 | -------------------------------------------------------------------------------- /a2l/coeffs_linear.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | type CoeffsLinear struct { 11 | A float64 12 | ASet bool 13 | B float64 14 | BSet bool 15 | } 16 | 17 | func parseCoeffsLinear(tok *tokenGenerator) (CoeffsLinear, error) { 18 | cl := CoeffsLinear{} 19 | var err error 20 | forLoop: 21 | for { 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("coeffsLinear could not be parsed") 26 | break forLoop 27 | } else if isKeyword(tok.current()) { 28 | err = errors.New("unexpected token " + tok.current()) 29 | log.Err(err).Msg("coeffsLinear could not be parsed") 30 | break forLoop 31 | } else if !cl.ASet { 32 | var buf float64 33 | buf, err = strconv.ParseFloat(tok.current(), 64) 34 | if err != nil { 35 | log.Err(err).Msg("coeffsLinear a could not be parsed") 36 | break forLoop 37 | } 38 | cl.A = buf 39 | cl.ASet = true 40 | log.Info().Msg("coeffsLinear a successfully parsed") 41 | } else if !cl.BSet { 42 | var buf float64 43 | buf, err = strconv.ParseFloat(tok.current(), 64) 44 | if err != nil { 45 | log.Err(err).Msg("coeffsLinear b could not be parsed") 46 | break forLoop 47 | } 48 | cl.B = buf 49 | cl.BSet = true 50 | log.Info().Msg("coeffsLinear b successfully parsed") 51 | break forLoop 52 | } 53 | } 54 | return cl, err 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. 2 | 3 | //go:build linux && (arm || arm64) 4 | // +build linux 5 | // +build arm arm64 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // PtraceRegsArm is the registers used by arm binaries. 12 | type PtraceRegsArm struct { 13 | Uregs [18]uint32 14 | } 15 | 16 | // PtraceGetRegsArm fetches the registers used by arm binaries. 17 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 18 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 19 | } 20 | 21 | // PtraceSetRegsArm sets the registers used by arm binaries. 22 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 23 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 24 | } 25 | 26 | // PtraceRegsArm64 is the registers used by arm64 binaries. 27 | type PtraceRegsArm64 struct { 28 | Regs [31]uint64 29 | Sp uint64 30 | Pc uint64 31 | Pstate uint64 32 | } 33 | 34 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 35 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 36 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 37 | } 38 | 39 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 40 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 41 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (mips || mipsle) && gc 6 | // +build linux 7 | // +build mips mipsle 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for mips, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-28 20 | JMP syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 23 | JMP syscall·Syscall6(SB) 24 | 25 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 26 | JMP syscall·Syscall9(SB) 27 | 28 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 29 | JAL runtime·entersyscall(SB) 30 | MOVW a1+4(FP), R4 31 | MOVW a2+8(FP), R5 32 | MOVW a3+12(FP), R6 33 | MOVW R0, R7 34 | MOVW trap+0(FP), R2 // syscall entry 35 | SYSCALL 36 | MOVW R2, r1+16(FP) // r1 37 | MOVW R3, r2+20(FP) // r2 38 | JAL runtime·exitsyscall(SB) 39 | RET 40 | 41 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 42 | JMP syscall·RawSyscall(SB) 43 | 44 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 45 | JMP syscall·RawSyscall6(SB) 46 | 47 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 48 | MOVW a1+4(FP), R4 49 | MOVW a2+8(FP), R5 50 | MOVW a3+12(FP), R6 51 | MOVW trap+0(FP), R2 // syscall entry 52 | SYSCALL 53 | MOVW R2, r1+16(FP) 54 | MOVW R3, r2+20(FP) 55 | RET 56 | -------------------------------------------------------------------------------- /a2l/alignment_int64.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | "strconv" 6 | 7 | "github.com/rs/zerolog/log" 8 | ) 9 | 10 | // alignmentInt64 is necessary because in complex objects (maps and axis) the alignment of a value may not coincide with the bitwidth of a value. 11 | // This keyword is used to define the alignment in the case of 64bit integers. 12 | type alignmentInt64 struct { 13 | //AlignmentBorder describes the border at which the value is aligned to, i.e. 14 | //its memory address must be dividable by the value AlignmentBorder. 15 | AlignmentBorder uint16 16 | AlignmentBorderSet bool 17 | } 18 | 19 | func parseAlignmentInt64(tok *tokenGenerator) (alignmentInt64, error) { 20 | ai64 := alignmentInt64{} 21 | var err error 22 | tok.next() 23 | if tok.current() == emptyToken { 24 | err = errors.New("unexpected end of file") 25 | log.Err(err).Msg("alignmentInt64 could not be parsed") 26 | } else if isKeyword(tok.current()) { 27 | err = errors.New("unexpected token " + tok.current()) 28 | log.Err(err).Msg("alignmentInt64 could not be parsed") 29 | } else if !ai64.AlignmentBorderSet { 30 | var buf uint64 31 | buf, err = strconv.ParseUint(tok.current(), 10, 16) 32 | if err != nil { 33 | log.Err(err).Msg("alignmentInt64 alignmentBorder could not be parsed") 34 | } 35 | ai64.AlignmentBorder = uint16(buf) 36 | ai64.AlignmentBorderSet = true 37 | log.Info().Msg("alignmentInt64 alignmentBorder successfully parsed") 38 | } 39 | return ai64, err 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_loong64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && loong64 && gc 6 | // +build linux 7 | // +build loong64 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | JAL runtime·entersyscall(SB) 24 | MOVV a1+8(FP), R4 25 | MOVV a2+16(FP), R5 26 | MOVV a3+24(FP), R6 27 | MOVV R0, R7 28 | MOVV R0, R8 29 | MOVV R0, R9 30 | MOVV trap+0(FP), R11 // syscall entry 31 | SYSCALL 32 | MOVV R4, r1+32(FP) 33 | MOVV R0, r2+40(FP) // r2 is not used. Always set to 0 34 | JAL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVV a1+8(FP), R4 45 | MOVV a2+16(FP), R5 46 | MOVV a3+24(FP), R6 47 | MOVV R0, R7 48 | MOVV R0, R8 49 | MOVV R0, R9 50 | MOVV trap+0(FP), R11 // syscall entry 51 | SYSCALL 52 | MOVV R4, r1+32(FP) 53 | MOVV R0, r2+40(FP) // r2 is not used. Always set to 0 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for AMD64, Linux 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 24 | CALL runtime·entersyscall(SB) 25 | MOVQ a1+8(FP), DI 26 | MOVQ a2+16(FP), SI 27 | MOVQ a3+24(FP), DX 28 | MOVQ $0, R10 29 | MOVQ $0, R8 30 | MOVQ $0, R9 31 | MOVQ trap+0(FP), AX // syscall entry 32 | SYSCALL 33 | MOVQ AX, r1+32(FP) 34 | MOVQ DX, r2+40(FP) 35 | CALL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 39 | JMP syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 42 | JMP syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 45 | MOVQ a1+8(FP), DI 46 | MOVQ a2+16(FP), SI 47 | MOVQ a3+24(FP), DX 48 | MOVQ $0, R10 49 | MOVQ $0, R8 50 | MOVQ $0, R9 51 | MOVQ trap+0(FP), AX // syscall entry 52 | SYSCALL 53 | MOVQ AX, r1+32(FP) 54 | MOVQ DX, r2+40(FP) 55 | RET 56 | 57 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 58 | JMP syscall·gettimeofday(SB) 59 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (mips64 || mips64le) && gc 6 | // +build linux 7 | // +build mips64 mips64le 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for mips64, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-56 20 | JMP syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 23 | JMP syscall·Syscall6(SB) 24 | 25 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 26 | JAL runtime·entersyscall(SB) 27 | MOVV a1+8(FP), R4 28 | MOVV a2+16(FP), R5 29 | MOVV a3+24(FP), R6 30 | MOVV R0, R7 31 | MOVV R0, R8 32 | MOVV R0, R9 33 | MOVV trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVV R2, r1+32(FP) 36 | MOVV R3, r2+40(FP) 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 47 | MOVV a1+8(FP), R4 48 | MOVV a2+16(FP), R5 49 | MOVV a3+24(FP), R6 50 | MOVV R0, R7 51 | MOVV R0, R8 52 | MOVV R0, R9 53 | MOVV trap+0(FP), R2 // syscall entry 54 | SYSCALL 55 | MOVV R2, r1+32(FP) 56 | MOVV R3, r2+40(FP) 57 | RET 58 | -------------------------------------------------------------------------------- /a2l/ecu_calibration_offset.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | /* 10 | ECU_CALIBRATION_OFFSET is used to describe a fixed address offset when accessing 11 | characteristics in the control unit due to 12 | -near pointers in calibration objects. Some record layouts include near pointers 13 | inside a calibration objects from which the calibration system has to compute the 14 | absolute values by adding the ECU_CALIBRATION_OFFSET (CDAMOS) 15 | -variant coding. Some ECU projects include multiple data sets for different engine or 16 | vehicle projects served by one common ECU. By using the 17 | ECU_CALIBRATION_OFFSET, a selection for project base address can be made 18 | */ 19 | type ecuCalibrationOffset struct { 20 | offset string 21 | offsetSet bool 22 | } 23 | 24 | func parseEcuCalibrationOffset(tok *tokenGenerator) (ecuCalibrationOffset, error) { 25 | eco := ecuCalibrationOffset{} 26 | var err error 27 | tok.next() 28 | if tok.current() == emptyToken { 29 | err = errors.New("unexpected end of file") 30 | log.Err(err).Msg("ecuCalibrationOffset could not be parsed") 31 | } else if isKeyword(tok.current()) { 32 | err = errors.New("unexpected token " + tok.current()) 33 | log.Err(err).Msg("ecuCalibrationOffset could not be parsed") 34 | } else if !eco.offsetSet { 35 | eco.offset = tok.current() 36 | eco.offsetSet = true 37 | log.Info().Msg("ecuCalibrationOffset offset successfully parsed") 38 | } 39 | return eco, err 40 | } 41 | -------------------------------------------------------------------------------- /a2l/annotation_text_test.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/rs/zerolog" 7 | ) 8 | 9 | //create unit tests for the following functions: parseAnnotationText 10 | // - valid annotationText 11 | // - empty annotationText 12 | // - unexpected token 13 | 14 | func TestParseAnnotationText_Valid(t *testing.T) { 15 | configureLogger() 16 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 17 | // valid annotationText 18 | tokenList = []string{emptyToken, "TEST", endAnnotationTextToken} 19 | tok := newTokenGenerator() 20 | _, err := parseAnnotationText(&tok) 21 | if err != nil { 22 | t.Fatalf("failed parsing with error: %s.", err) 23 | } 24 | } 25 | 26 | func TestParseAnnotationText_Empty(t *testing.T) { 27 | configureLogger() 28 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 29 | // empty annotationText 30 | tokenList = []string{emptyToken, emptyToken, endAnnotationTextToken} 31 | tok := newTokenGenerator() 32 | _, err := parseAnnotationText(&tok) 33 | if err == nil { 34 | t.Fatalf("failed test with undetected error: %s.", err) 35 | } 36 | } 37 | 38 | func TestParseAnnotationText_UnexpectedKeyword(t *testing.T) { 39 | configureLogger() 40 | zerolog.SetGlobalLevel(zerolog.ErrorLevel) 41 | // invalid annotationText 42 | tokenList = []string{emptyToken, beginAxisDescrToken, endAnnotationTextToken} 43 | tok := newTokenGenerator() 44 | _, err := parseAnnotationText(&tok) 45 | if err == nil { 46 | t.Fatalf("failed test with undetected error: %s.", err) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/ctx.go: -------------------------------------------------------------------------------- 1 | package zerolog 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | var disabledLogger *Logger 8 | 9 | func init() { 10 | SetGlobalLevel(TraceLevel) 11 | l := Nop() 12 | disabledLogger = &l 13 | } 14 | 15 | type ctxKey struct{} 16 | 17 | // WithContext returns a copy of ctx with l associated. If an instance of Logger 18 | // is already in the context, the context is not updated. 19 | // 20 | // For instance, to add a field to an existing logger in the context, use this 21 | // notation: 22 | // 23 | // ctx := r.Context() 24 | // l := zerolog.Ctx(ctx) 25 | // l.UpdateContext(func(c Context) Context { 26 | // return c.Str("bar", "baz") 27 | // }) 28 | func (l Logger) WithContext(ctx context.Context) context.Context { 29 | if lp, ok := ctx.Value(ctxKey{}).(*Logger); ok { 30 | if lp == &l { 31 | // Do not store same logger. 32 | return ctx 33 | } 34 | } else if l.level == Disabled { 35 | // Do not store disabled logger. 36 | return ctx 37 | } 38 | return context.WithValue(ctx, ctxKey{}, &l) 39 | } 40 | 41 | // Ctx returns the Logger associated with the ctx. If no logger 42 | // is associated, DefaultContextLogger is returned, unless DefaultContextLogger 43 | // is nil, in which case a disabled logger is returned. 44 | func Ctx(ctx context.Context) *Logger { 45 | if l, ok := ctx.Value(ctxKey{}).(*Logger); ok { 46 | return l 47 | } else if l = DefaultContextLogger; l != nil { 48 | return l 49 | } 50 | return disabledLogger 51 | } 52 | -------------------------------------------------------------------------------- /a2l/calibration_handle.go: -------------------------------------------------------------------------------- 1 | package a2l 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/rs/zerolog/log" 7 | ) 8 | 9 | type calibrationHandle struct { 10 | handle []string 11 | handleSet bool 12 | calibrationHandleText calibrationHandleText 13 | } 14 | 15 | func parseCalibrationHandle(tok *tokenGenerator) (calibrationHandle, error) { 16 | ch := calibrationHandle{} 17 | var err error 18 | forLoop: 19 | for { 20 | switch tok.next() { 21 | case calibrationHandleTextToken: 22 | ch.calibrationHandleText, err = parseCalibrationHandleText(tok) 23 | if err != nil { 24 | log.Err(err).Msg("calibrationHandle calibrationHandleText could not be parsed") 25 | break forLoop 26 | } 27 | log.Info().Msg("calibrationHandle calibrationHandleText successfully parsed") 28 | default: 29 | if tok.current() == emptyToken { 30 | err = errors.New("unexpected end of file") 31 | log.Err(err).Msg("calibrationHandle could not be parsed") 32 | break forLoop 33 | } else if tok.current() == endCalibrationHandleToken { 34 | ch.handleSet = true 35 | break forLoop 36 | } else if isKeyword(tok.current()) { 37 | err = errors.New("unexpected token " + tok.current()) 38 | log.Err(err).Msg("calibrationHandle could not be parsed") 39 | break forLoop 40 | } else if !ch.handleSet { 41 | ch.handle = append(ch.handle, tok.current()) 42 | log.Info().Msg("calibrationHandle handle successfully parsed") 43 | } 44 | } 45 | } 46 | return ch, err 47 | } 48 | --------------------------------------------------------------------------------