Module("system/posix/file-abstractions",[Imports([Import("system/posix/file")]),Strategies([SDefNoArgs("abspath",GuardedLChoice(CallNoArgs(SVar("is-abspath")),Id,BA(CallNoArgs(SVar("concat-strings")),NoAnnoList(List([App(CallNoArgs(SVar("getcwd")),NoAnnoList(Tuple([]))),NoAnnoList(Str("\"/\"")),RootApp(Id)]))))),SDefNoArgs("file-newer",Seq(TupleCong(CallNoArgs(SVar("modification-time")),[CallNoArgs(SVar("modification-time"))]),CallNoArgs(SVar("gt"))))]),Overlays([OverlayNoArgs("Read",NoAnnoList(Op("R_OK",[]))),OverlayNoArgs("Write",NoAnnoList(Op("W_OK",[]))),OverlayNoArgs("Execute",NoAnnoList(Op("X_OK",[]))),OverlayNoArgs("Existence",NoAnnoList(Op("F_OK",[])))]),Strategies([SDefNoArgs("file-exists",BA(CallNoArgs(SVar("access")),NoAnnoList(Tuple([RootApp(Id),NoAnnoList(List([NoAnnoList(Op("F_OK",[]))]))])))),SDefNoArgs("can-read-file",BA(CallNoArgs(SVar("access")),NoAnnoList(Tuple([RootApp(Id),NoAnnoList(List([NoAnnoList(Op("R_OK",[]))]))])))),SDefNoArgs("is-readable",CallNoArgs(SVar("can-read-file"))),SDefNoArgs("can-write-file",BA(CallNoArgs(SVar("access")),NoAnnoList(Tuple([RootApp(Id),NoAnnoList(List([NoAnnoList(Op("W_OK",[]))]))])))),SDefNoArgs("is-writable",CallNoArgs(SVar("can-write-file"))),SDefNoArgs("can-execute-file",BA(CallNoArgs(SVar("access")),NoAnnoList(Tuple([RootApp(Id),NoAnnoList(List([NoAnnoList(Op("X_OK",[]))]))])))),SDefNoArgs("is-executable",CallNoArgs(SVar("can-execute-file"))),SDefNoArgs("can-create-file",Where(Seq(CallNoArgs(SVar("dirname")),CallNoArgs(SVar("can-write-file")))))]),Strategies([SDefT("find-in-path",[DefaultVarDec("strict")],[DefaultVarDec("path")],Seq(Match(Var("file")),LChoice(CallNoArgs(SVar("file-exists")),LChoice(BA(Call(SVar("fetch-elem"),[BA(Seq(CallNoArgs(SVar("concat-strings")),CallNoArgs(SVar("file-exists"))),NoAnnoList(List([RootApp(Id),NoAnnoList(Str("\"/\"")),Var("file")])))]),Var("path")),CondChoice(CallNoArgs(SVar("strict")),BA(CallNoArgs(SVar("fatal-error")),NoAnnoList(List([NoAnnoList(Str("\"no such file: \"")),Var("file")]))),Fail))))),SDefT("find-in-path",[],[DefaultVarDec("path")],CallT(SVar("find-in-path"),[Id],[Var("path")])),SDefNoArgs("find-in-path",Seq(Match(NoAnnoList(Tuple([Var("file"),Var("path")]))),BA(CallT(SVar("find-in-path"),[Fail],[Var("path")]),Var("file")))),SDef("find-in-path",[DefaultVarDec("mkpath")],CallT(SVar("find-in-path"),[],[RootApp(CallNoArgs(SVar("mkpath")))])),SDefT("find-file",[],[DefaultVarDec("ext"),DefaultVarDec("path")],Seq(CallT(SVar("guarantee-extension"),[],[Var("ext")]),CallT(SVar("find-in-path"),[Fail],[Var("path")]))),SDefT("find-file",[],[DefaultVarDec("ext")],Seq(Match(NoAnnoList(Tuple([Var("file"),Var("path")]))),BA(CallT(SVar("find-file"),[],[Var("ext"),Var("path")]),Var("file")))),SDef("find-file",[DefaultVarDec("ext")],CallT(SVar("find-file"),[],[RootApp(CallNoArgs(SVar("ext")))])),SDef("find-file",[DefaultVarDec("mkpath"),DefaultVarDec("ext")],Seq(CallT(SVar("guarantee-extension"),[],[RootApp(CallNoArgs(SVar("ext")))]),CallT(SVar("find-in-path"),[],[RootApp(CallNoArgs(SVar("mkpath")))])))]),Strategies([SDefNoArgs("new-file",Seq(Call(SVar("obsolete"),[Build(NoAnnoList(Str("\"new-file; use new-temp-file or XTC temporary files\"")))]),Rec("x",Seq(BA(CallNoArgs(SVar("conc-strings")),NoAnnoList(Tuple([App(CallNoArgs(SVar("new")),NoAnnoList(Tuple([]))),NoAnnoList(Str("\".tmp\""))]))),Call(SVar("try"),[Seq(CallNoArgs(SVar("file-exists")),CallNoArgs(SVar("x")))])))))])])
