Skip to content

Commit 26069d8

Browse files
authored
#119 Variables encoded based on index instead of comma-separated string (#120)
1 parent ee166ee commit 26069d8

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

cse/cse.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -744,23 +744,24 @@ func setSignalSubscriptions(status *structs.SimulationStatus, cmd []string) (boo
744744
var success = true
745745
if len(cmd) > 1 {
746746
status.Module = cmd[1]
747-
for i, signal := range cmd {
748-
if i > 1 {
749-
parts := strings.Split(signal, ",")
750-
valRef, err := strconv.Atoi(parts[3])
751-
if err != nil {
752-
message = strCat("Could not parse value reference from: ", signal, ", ", err.Error())
753-
log.Println(message)
754-
success = false
755-
} else {
756-
variables = append(variables,
757-
structs.Variable{
758-
Name: parts[0],
759-
Causality: parts[1],
760-
Type: parts[2],
761-
ValueReference: valRef,
762-
})
763-
}
747+
for j := 2; j < (len(cmd) - 3); j += 4 {
748+
name := cmd[j]
749+
caus := cmd[j+1]
750+
typ := cmd[j+2]
751+
vr := cmd[j+3]
752+
valRef, err := strconv.Atoi(vr)
753+
if err != nil {
754+
message = strCat("Could not parse value reference from: ", vr, ", ", err.Error())
755+
log.Println(message)
756+
success = false
757+
} else {
758+
variables = append(variables,
759+
structs.Variable{
760+
Name: name,
761+
Causality: caus,
762+
Type: typ,
763+
ValueReference: valRef,
764+
})
764765
}
765766
}
766767
} else {

0 commit comments

Comments
 (0)