func VegasParamsGet(s *GslMonteVegasState, params *GslMonteVegasParams) { var iterations C.int var stage C.int var mode C.int var verbose C.int var file *C.FILE C.get_vegas_params((*C.gsl_monte_vegas_state)(unsafe.Pointer(s.Ptr())), (*C.double)(¶ms.Alpha), &iterations, &stage, &mode, &verbose, &file) params.Iterations = int(iterations) params.Stage = int(stage) params.Mode = GslMonteVegasMode(int(mode)) params.Verbose = int(verbose) params.Ostream = os.NewFile(uintptr(C.fileno(file)), "") }
func setStream(f *os.File, cstream **C.FILE, mode string, def int) error { fd := def if f != nil { fd = int(f.Fd()) } cfd := def if *cstream != nil { cfd = int(C.fileno(*cstream)) } if fd == cfd { // TODO Validate return nil } cname := C.CString(f.Name()) cmode := C.CString(mode) cf, err := C.fopen(cname, cmode) // TODO How to close? C.free(unsafe.Pointer(cname)) C.free(unsafe.Pointer(cmode)) if err != nil { return err } *cstream = cf return nil }
EXTA = 19200 EXTB = 38400 ) const ( TCIFLUSH = 1 TCOFLUSH = 2 TCIOFLUSH = 3 TCOOFF = 1 TCOON = 2 TCIOFF = 3 TCION = 4 ) var ( Stdin = int(C.fileno(C.stdin)) Stdout = int(C.fileno(C.stdout)) Stderr = int(C.fileno(C.stderr)) ) type Flag uint type CC byte type Speed uint type Termios struct { IFlag Flag // input flags OFlag Flag // output flags CFlag Flag // control flags LFlag Flag // local flags CC [NCCS]CC // control chars ISpeed Speed // input speed