// AddFile compiles rules from a file. Rules are added to the // specified namespace. func (c *Compiler) AddFile(file *os.File, namespace string) (err error) { fd := C.dup(C.int(file.Fd())) fh, err := C.fdopen(fd, C.CString("r")) if err != nil { return err } defer C.fclose(fh) var ns *C.char if namespace != "" { ns = C.CString(namespace) defer C.free(unsafe.Pointer(ns)) } filename := C.CString(file.Name()) defer C.free(unsafe.Pointer(filename)) id := callbackData.Put(c) defer callbackData.Delete(id) C.yr_compiler_set_callback(c.cptr, C.YR_COMPILER_CALLBACK_FUNC(C.compilerCallback), unsafe.Pointer(id)) numErrors := int(C.yr_compiler_add_file(c.cptr, fh, ns, filename)) if numErrors > 0 { var buf [1024]C.char msg := C.GoString(C.yr_compiler_get_error_message( c.cptr, (*C.char)(unsafe.Pointer(&buf[0])), 1024)) err = errors.New(msg) } return }
func BlockComplexFloatFprintf(stream *os.File, b *GslBlockComplexFloat, format string) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _string_2 := C.CString(format) _result := int32(C.gsl_block_complex_float_fprintf(_file_0, (*C.gsl_block_complex_float)(unsafe.Pointer(b.Ptr())), _string_2)) C.fclose(_file_0) C.free(unsafe.Pointer(_string_2)) return _result }
func VegasParamsSet(s *GslMonteVegasState, params *GslMonteVegasParams) { C.set_vegas_params((*C.gsl_monte_vegas_state)(unsafe.Pointer(s.Ptr())), C.double(params.Alpha), C.int(params.Iterations), C.int(params.Stage), C.int(params.Mode), C.int(params.Verbose), C.fdopen(C.dup(C.int(params.Ostream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr())))) }
func Fprintf(stream *os.File, c *GslCombination, format string) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _string_2 := C.CString(format) _result := int32(C.gsl_combination_fprintf(_file_0, (*C.gsl_combination)(unsafe.Pointer(c.Ptr())), _string_2)) C.fclose(_file_0) C.free(unsafe.Pointer(_string_2)) return _result }
func Histogram2dFprintf(stream *os.File, h *GslHistogram2d, rangeFormat string, binFormat string) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _string_2 := C.CString(rangeFormat) _string_3 := C.CString(binFormat) _result := int32(C.gsl_histogram2d_fprintf(_file_0, (*C.gsl_histogram2d)(unsafe.Pointer(h.Ptr())), _string_2, _string_3)) C.fclose(_file_0) C.free(unsafe.Pointer(_string_2)) C.free(unsafe.Pointer(_string_3)) return _result }
func BlockFloatFread(stream *os.File, b *GslBlockFloat) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_block_float_fread(_file_0, (*C.gsl_block_float)(unsafe.Pointer(b.Ptr())))) C.fclose(_file_0) return _result }
func BlockComplexFscanf(stream *os.File, b *GslBlockComplex) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_block_complex_fscanf(_file_0, (*C.gsl_block_complex)(unsafe.Pointer(b.Ptr())))) C.fclose(_file_0) return _result }
func BlockUcharFwrite(stream *os.File, b *GslBlockUchar) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_block_uchar_fwrite(_file_0, (*C.gsl_block_uchar)(unsafe.Pointer(b.Ptr())))) C.fclose(_file_0) return _result }
func Fread(stream *os.File, r *GslRng) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_rng_fread(_file_0, (*C.gsl_rng)(unsafe.Pointer(r.Ptr())))) C.fclose(_file_0) return _result }
func Fscanf(stream *os.File, c *GslCombination) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_combination_fscanf(_file_0, (*C.gsl_combination)(unsafe.Pointer(c.Ptr())))) C.fclose(_file_0) return _result }
func Histogram2dFscanf(stream *os.File, h *GslHistogram2d) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_histogram2d_fscanf(_file_0, (*C.gsl_histogram2d)(unsafe.Pointer(h.Ptr())))) C.fclose(_file_0) return _result }
func Fread(stream *os.File, p *GslPermutation) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_permutation_fread(_file_0, (*C.gsl_permutation)(unsafe.Pointer(p.Ptr())))) C.fclose(_file_0) return _result }
func Fwrite(stream *os.File, c *GslMultiset) int32 { _file_0 := C.fdopen(C.dup(C.int(stream.Fd())), (*C.char)(unsafe.Pointer(gogsl.APPEND_ONLY.Ptr()))) _result := int32(C.gsl_multiset_fwrite(_file_0, (*C.gsl_multiset)(unsafe.Pointer(c.Ptr())))) C.fclose(_file_0) return _result }