Esempio n. 1
0
func CompileFile(name string) (*Code, error) {
	fn := C.CString(name)
	defer C.free(unsafe.Pointer(fn))
	ret := C.compileFile(fn)
	if ret == nil {
		return nil, exception()
	}
	return newCode(ret), nil
}
Esempio n. 2
0
File: code.go Progetto: MogeiWang/py
func CompileFile(name string, start StartToken) (*Code, error) {
	fn := C.CString(name)
	defer C.free(unsafe.Pointer(fn))

	file, err := C.openFile(fn)
	if file == nil {
		return nil, err
	}
	defer C.fclose(file)

	ret := C.compileFile(file, fn, C.int(start))
	if ret == nil {
		return nil, exception()
	}
	return newCode(ret), nil
}