Skip to content

Commit 78074d3

Browse files
committed
BugFix in ModPar
initialized SystemConstants HashMap
1 parent b2ab906 commit 78074d3

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

a2l/mod_par.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type modPar struct {
2929

3030
func parseModPar(tok *tokenGenerator) (modPar, error) {
3131
mp := modPar{}
32+
mp.SystemConstants = make(map[string]systemConstant, 2000)
3233
var err error
3334
forLoop:
3435
for {

a2l/module.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ forLoop:
320320
return myModule, err
321321
}
322322

323-
//parseModuleMultithreaded is the parallel parsing version of parseModule.
324-
//it computes the start and the end of the module struct
325-
//and splits it up among numProc number of goroutines
326-
//which each execute a separate moduleMainLoop
323+
// parseModuleMultithreaded is the parallel parsing version of parseModule.
324+
// it computes the start and the end of the module struct
325+
// and splits it up among numProc number of goroutines
326+
// which each execute a separate moduleMainLoop
327327
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")
@@ -449,9 +449,9 @@ forLoop:
449449
return myModule, err
450450
}
451451

452-
//collectChannelsMultithreaded uses anonymous function to collect the data sent by the goroutines running the moduleMainLoop.
453-
//usually the Select Collector is to be prefered as it is mostly faster and always easier on memory
454-
//as the additional goroutines spun up in collectChannelsMultithreaded seem to block the GC a lot
452+
// collectChannelsMultithreaded uses anonymous function to collect the data sent by the goroutines running the moduleMainLoop.
453+
// usually the Select Collector is to be prefered as it is mostly faster and always easier on memory
454+
// as the additional goroutines spun up in collectChannelsMultithreaded seem to block the GC a lot
455455
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,
@@ -659,10 +659,10 @@ func collectChannelsMultithreaded(myModule *module, cA2ml chan a2ml, cAxisPts ch
659659
log.Info().Msg("all collectors finished")
660660
}
661661

662-
//closeChannelsAfterParsing closes all channels when the parser routines have finished
663-
//and wgParser.Wait() is over.
664-
//channels have to be closed in order for the collector to recognize when it is done
665-
//because no more data can be sent and all channels are empty
662+
// closeChannelsAfterParsing closes all channels when the parser routines have finished
663+
// and wgParser.Wait() is over.
664+
// channels have to be closed in order for the collector to recognize when it is done
665+
// because no more data can be sent and all channels are empty
666666
func closeChannelsAfterParsing(wg *sync.WaitGroup, cA2ml chan a2ml, cAxisPts chan axisPts, cBlob chan blob, cCharacteristic chan Characteristic,
667667
cCompuMethod chan compuMethod, cCompuTab chan compuTab, cCompuVtab chan compuVTab,
668668
cCompuVtabRange chan compuVTabRange, cFrame chan frame, cFunction chan function,
@@ -704,7 +704,7 @@ func closeChannelsAfterParsing(wg *sync.WaitGroup, cA2ml chan a2ml, cAxisPts cha
704704
log.Info().Msg("parsers finished, closed all channels")
705705
}
706706

707-
//parseModuleMainLoop is used by the parseModuleMultithreaded function to run the module parser in individual goroutines
707+
// parseModuleMainLoop is used by the parseModuleMultithreaded function to run the module parser in individual goroutines
708708
func parseModuleMainLoop(wg *sync.WaitGroup, minIndex int, maxIndex int,
709709
cA2ml chan a2ml, cAxisPts chan axisPts, cBlob chan blob, cCharacteristic chan Characteristic,
710710
cCompuMethod chan compuMethod, cCompuTab chan compuTab, cCompuVtab chan compuVTab,

0 commit comments

Comments
 (0)