Commit ce5c2581 authored by Antoine Martin's avatar Antoine Martin Committed by Antoine Martin

boilerplate: new G2PEntry handling successors

The former G2PEntry, which was in fact an entry point to the main
function, is now renamed G2PMain.

G2PEntry now handles goroutines, and adds their successors to the
main function's successor.
parent 41a7c071
Pipeline #13159 passed with stage
in 37 seconds
......@@ -20,6 +20,17 @@ type Goroutine struct {
Func GoroutineFunc // duplicated function to launch
}
func G2PEntry(src G2PStateType) []G2PStateType {
res := make([]G2PStateType, 0)
for _, g := range G2PGoroutines {
if src[g.Status] != 0 { // is goroutine active ?
res = append(res, g.Func(src)[0]) // FIXME
}
}
return append(res, G2PMain(src)[0]) // FIXME
}
//export get_state_variable_count
func get_state_variable_count() C.int {
return C.int(G2PStateSize)
......
......@@ -184,7 +184,7 @@ func compileTo(path string, src []byte, file *os.File, goroutines []*goroutine.G
// entrypoint to get a successor from a state vector
decl.Function(
"G2PEntry",
"G2PMain",
[]*ast.Field{ // parameters
&ast.Field{
Names: []*ast.Ident{meta.State()},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment