Skip to content

Commit ff08671

Browse files
committed
exported more fields and fixed parsing of byteOrderEnum
1 parent 7b0aeb4 commit ff08671

File tree

8 files changed

+155
-154
lines changed

8 files changed

+155
-154
lines changed

a2l/enums.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const (
146146
msbLast byteOrderEnum = msbLastToken
147147
msbFirst byteOrderEnum = msbFirstToken
148148
msbFirstMswLast byteOrderEnum = msbFirstMswLastToken
149-
msbLastMswFirst byteOrderEnum = msbFirstMswLastToken
149+
msbLastMswFirst byteOrderEnum = msbLastMswFirstToken
150150
)
151151

152152
func parseByteOrderEnum(tok *tokenGenerator) (byteOrderEnum, error) {
@@ -161,6 +161,10 @@ func parseByteOrderEnum(tok *tokenGenerator) (byteOrderEnum, error) {
161161
b = msbLast
162162
case msbFirstToken:
163163
b = msbFirst
164+
case msbFirstMswLastToken:
165+
b = msbFirstMswLast
166+
case msbLastMswFirstToken:
167+
b = msbLastMswFirst
164168
default:
165169
err = errors.New("incorrect value " + tok.current() + " for enum byteorder")
166170
}

a2l/module.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/rs/zerolog/log"
99
)
1010

11-
type module struct {
11+
type Module struct {
1212
Name string
1313
nameSet bool
1414
longIdentifier string
@@ -42,9 +42,9 @@ type module struct {
4242
variantCoding variantCoding
4343
}
4444

45-
func parseModule(tok *tokenGenerator) (module, error) {
45+
func parseModule(tok *tokenGenerator) (Module, error) {
4646
//Bulk init of an average number of objects contained in a modern a2l-file.
47-
myModule := module{}
47+
myModule := Module{}
4848
myModule.AxisPts = make(map[string]axisPts, 1000)
4949
myModule.blobs = make(map[string]blob, 5)
5050
myModule.Characteristics = make(map[string]Characteristic, 10000)
@@ -222,7 +222,7 @@ forLoop:
222222
log.Err(err).Msg("module recordLayout could not be parsed")
223223
break forLoop
224224
}
225-
myModule.RecordLayouts[bufRecordLayout.name] = bufRecordLayout
225+
myModule.RecordLayouts[bufRecordLayout.Name] = bufRecordLayout
226226
log.Info().Msg("module recordLayout successfully parsed")
227227
case beginTransformerToken:
228228
bufTransformer, err = parseTransformer(tok)
@@ -324,10 +324,10 @@ forLoop:
324324
// it computes the start and the end of the module struct
325325
// and splits it up among numProc number of goroutines
326326
// which each execute a separate moduleMainLoop
327-
func parseModuleMultithreaded(tok *tokenGenerator) (module, error) {
327+
func parseModuleMultithreaded(tok *tokenGenerator) (Module, error) {
328328
//Bulk init of an average number of objects contained in a modern a2l-file.
329329
log.Info().Msg("creating maps for module subtypes")
330-
myModule := module{}
330+
myModule := Module{}
331331
myModule.AxisPts = make(map[string]axisPts, 1000)
332332
myModule.blobs = make(map[string]blob, 5)
333333
myModule.Characteristics = make(map[string]Characteristic, 10000)
@@ -452,7 +452,7 @@ forLoop:
452452
// collectChannelsMultithreaded uses anonymous function to collect the data sent by the goroutines running the moduleMainLoop.
453453
// usually the Select Collector is to be prefered as it is mostly faster and always easier on memory
454454
// as the additional goroutines spun up in collectChannelsMultithreaded seem to block the GC a lot
455-
func collectChannelsMultithreaded(myModule *module, cA2ml chan a2ml, cAxisPts chan axisPts, cBlob chan blob, cCharacteristic chan Characteristic,
455+
func collectChannelsMultithreaded(myModule *Module, cA2ml chan a2ml, cAxisPts chan axisPts, cBlob chan blob, cCharacteristic chan Characteristic,
456456
cCompuMethod chan compuMethod, cCompuTab chan compuTab, cCompuVtab chan compuVTab,
457457
cCompuVtabRange chan compuVTabRange, cFrame chan frame, cFunction chan function,
458458
cGroup chan group, cIfData chan IfData, cMeasurement chan measurement,
@@ -580,7 +580,7 @@ func collectChannelsMultithreaded(myModule *module, cA2ml chan a2ml, cAxisPts ch
580580
go func(wg *sync.WaitGroup) {
581581
defer wg.Done()
582582
for elem := range cRecordLayout {
583-
myModule.RecordLayouts[elem.name] = elem
583+
myModule.RecordLayouts[elem.Name] = elem
584584
}
585585
log.Info().Msg("collected recordLayouts")
586586
}(wgCollectors)

a2l/project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Project struct {
1212
longIdentifier string
1313
longIdentifierSet bool
1414
header header
15-
Modules []module
15+
Modules []Module
1616
}
1717

1818
func parseProject(tok *tokenGenerator) (Project, error) {
@@ -29,7 +29,7 @@ forLoop:
2929
}
3030
log.Info().Msg("project header successfully parsed")
3131
case beginModuleToken:
32-
var buf module
32+
var buf Module
3333
//decision whether to parse the module multithreaded or not
3434
if useMultithreading {
3535
buf, err = parseModuleMultithreaded(tok)

0 commit comments

Comments
 (0)