Exemple #1
0
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
}
Exemple #2
0
func (w *window) openFile(f func(filename string)) {
	C.openFile(w.id, unsafe.Pointer(&f))
}