// Code generated by cmd/cgo; DO NOT EDIT.

//line /tmp/cgolife2254497014/src/cgolife/life.go:1:1
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cgolife

// #include "life.h"
import _ "unsafe"

import "unsafe"

func Run(gen, x, y int, a []int32) {
	n := make([]int32, x*y)
	for i := 0; i < gen; i++ {
		( /*line :15:3*/_Cfunc_Step /*line :15:8*/)( /*line :15:10*/_Ctype_int /*line :15:15*/(x),  /*line :15:20*/_Ctype_int /*line :15:25*/(y), (* /*line :15:32*/_Ctype_int /*line :15:37*/)(unsafe.Pointer(&a[0])), (* /*line :15:65*/_Ctype_int /*line :15:70*/)(unsafe.Pointer(&n[0])))
		copy(a, n)
	}
}

// Keep the channels visible from Go.
var chans [4]chan bool

// Double return value is just for testing.
//
//export GoStart
func GoStart(i, xdim, ydim, xstart, xend, ystart, yend  /*line :26:56*/_Ctype_int /*line :26:61*/, a * /*line :26:66*/_Ctype_int /*line :26:71*/, n * /*line :26:76*/_Ctype_int /*line :26:81*/) (int, int) {
	c := make(chan bool, int(( /*line :27:27*/*_Cvar_MYCONST /*line :27:35*/)))
	go func() {
		( /*line :29:3*/_Cfunc_DoStep /*line :29:10*/)(xdim, ydim, xstart, xend, ystart, yend, a, n)
		c <- true
	}()
	chans[i] = c
	return int(i), int(i + 100)
}

//export GoWait
func GoWait(i  /*line :37:15*/_Ctype_int /*line :37:20*/) {
	<-chans[i]
	chans[i] = nil
}
