Skip to content

Commit

Permalink
scg.c: Fixed missing include for random call c code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sr committed Nov 5, 2024
1 parent df3b732 commit aef4cd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,16 @@ class StatebasedCCodeSerializeHRExtensions extends SCChartsSerializeHRExtensions
}

override dispatch CharSequence serialize(RandomCall randomCall) {
if (!modifications.containsEntry(INCLUDES, "<stdlib.h>")) {
modifications.put(INCLUDES, "<stdlib.h>")
}
return "((float) rand() / RAND_MAX)"
}

override dispatch CharSequence serializeHR(RandomCall randomCall) {
if (!modifications.containsEntry(INCLUDES, "<stdlib.h>")) {
modifications.put(INCLUDES, "<stdlib.h>")
}
return "((float) rand() / RAND_MAX)"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,16 @@ class CCodeSerializeHRExtensions extends CodeGeneratorSerializeHRExtensions {
}

override dispatch CharSequence serialize(RandomCall randomCall) {
if (!modifications.containsEntry(INCLUDES, "<stdlib.h>")) {
modifications.put(INCLUDES, "<stdlib.h>")
}
return "((float) rand() / RAND_MAX)"
}

override dispatch CharSequence serializeHR(RandomCall randomCall) {
if (!modifications.containsEntry(INCLUDES, "<stdlib.h>")) {
modifications.put(INCLUDES, "<stdlib.h>")
}
return "((float) rand() / RAND_MAX)"
}

Expand Down

0 comments on commit aef4cd4

Please sign in to comment.