コード例 #1
0
ファイル: interpreter.go プロジェクト: thought-machine/please
func loadSubincludePackage() {
	pkg := core.NewPackage(subincludePackage)
	// Set up a builtin package for remote subincludes.
	cPackageName := C.CString(pkg.Name)
	C.ParseCode(nil, cPackageName, sizep(pkg))
	C.free(unsafe.Pointer(cPackageName))
	core.State.Graph.AddPackage(pkg)
}
コード例 #2
0
ファイル: interpreter.go プロジェクト: thought-machine/please
func loadBuiltinRules(path string) {
	data := loadAsset(path)
	defer C.free(unsafe.Pointer(data))
	cPackageName := C.CString(path)
	defer C.free(unsafe.Pointer(cPackageName))
	if result := C.GoString(C.ParseCode(data, cPackageName, 0)); result != "" {
		// This obviously shouldn't happen, because we control all the builtin rules.
		// It's here for developing rules in Please in case one makes a mistake :)
		log.Fatalf("Failed to interpret builtin build rules from %s: %s", path, result)
	}
}