Module("stratego/xtc/posix/Proc",[Strategies([RDefNoArgs("read-from",Rule(NoAnnoList(Op("FILE",[Var("name")])),Var("t"),AM(BA(Seq(CallNoArgs(SVar("file-exists")),CallNoArgs(SVar("ReadFromFile"))),Var("name")),Var("t"))))]),Strategies([SDef("xtc-command",[DefaultVarDec("tool")],Seq(Where(Seq(CallNoArgs(SVar("tool")),AM(CallNoArgs(SVar("xtc-find-warning")),Var("loc")))),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Debug",[])),App(CallNoArgs(SVar("concat-strings")),NoAnnoList(List([NoAnnoList(Str("\"Invoking tool \"")),RootApp(CallNoArgs(SVar("tool"))),NoAnnoList(Str("\" at location \"")),Var("loc"),NoAnnoList(Str("\" with arguments: \""))]))),RootApp(Id)]),Where(BA(CallNoArgs(SVar("call")),NoAnnoList(Tuple([Var("loc"),RootApp(Id)]))))))),SDef("xtc-transform",[DefaultVarDec("tool")],Call(SVar("xtc-transform"),[CallNoArgs(SVar("tool")),Build(NoAnnoList(List([])))])),SDef("xtc-transform",[DefaultVarDec("tool"),DefaultVarDec("args")],GuardedLChoice(Choice(Call(SVar("FILE"),[Id]),CallNoArgs(SVar("stdin"))),Call(SVar("xtc-transform-file"),[CallNoArgs(SVar("tool")),CallNoArgs(SVar("args"))]),Call(SVar("xtc-transform-term"),[CallNoArgs(SVar("tool")),CallNoArgs(SVar("args"))])))]),Strategies([SDefNoArgs("xtc-transform-file",Match(NoAnnoList(Tuple([Var("tool"),Var("args"),Var("file")])))),SDef("xtc-transform-file",[DefaultVarDec("tool")],Call(SVar("xtc-transform-file"),[CallNoArgs(SVar("tool")),Build(NoAnnoList(List([])))])),RDef("xtc-transform-file",[DefaultVarDec("tool"),DefaultVarDec("args")],Rule(NoAnnoList(Op("FILE",[Var("f")])),NoAnnoList(Op("FILE",[Var("g")])),Seq(AM(BA(CallNoArgs(SVar("xtc-new-file")),Var("f")),Var("g")),BA(Seq(CallNoArgs(SVar("conc")),Call(SVar("xtc-command"),[CallNoArgs(SVar("tool"))])),NoAnnoList(Tuple([RootApp(CallNoArgs(SVar("args"))),NoAnnoList(List([NoAnnoList(Str("\"-i\"")),Var("f"),NoAnnoList(Str("\"-o\"")),Var("g")]))])))))),RDef("xtc-transform-file",[DefaultVarDec("tool"),DefaultVarDec("args")],Rule(Var("stdin"),NoAnnoList(Op("FILE",[Var("g")])),Seq(AM(CallNoArgs(SVar("xtc-new-file")),Var("g")),BA(Seq(CallNoArgs(SVar("conc")),Call(SVar("xtc-command"),[CallNoArgs(SVar("tool"))])),NoAnnoList(Tuple([RootApp(CallNoArgs(SVar("args"))),NoAnnoList(List([NoAnnoList(Str("\"-o\"")),Var("g")]))])))))),SDef("xtc-transform-term",[DefaultVarDec("tool"),DefaultVarDec("args")],Seq(CallNoArgs(SVar("write-to")),Seq(Call(SVar("xtc-transform-file"),[CallNoArgs(SVar("tool")),CallNoArgs(SVar("args"))]),CallNoArgs(SVar("read-from"))))),SDef("xtc-io-transform",[DefaultVarDec("s")],Seq(CallNoArgs(SVar("read-from")),Seq(CallNoArgs(SVar("s")),CallNoArgs(SVar("write-to"))))),SDef("xtc-io-transform-text",[DefaultVarDec("s")],Seq(CallNoArgs(SVar("read-from")),Seq(CallNoArgs(SVar("s")),CallNoArgs(SVar("print-to"))))),SDef("xtc-generate",[DefaultVarDec("tool")],Call(SVar("xtc-generate"),[CallNoArgs(SVar("tool")),Build(NoAnnoList(List([])))])),RDef("xtc-generate",[DefaultVarDec("tool"),DefaultVarDec("args")],Rule(Wld,NoAnnoList(Op("FILE",[Var("g")])),Seq(AM(BA(CallNoArgs(SVar("xtc-new-file")),NoAnnoList(Tuple([]))),Var("g")),BA(Seq(CallNoArgs(SVar("conc")),Call(SVar("xtc-command"),[CallNoArgs(SVar("tool"))])),NoAnnoList(Tuple([RootApp(CallNoArgs(SVar("args"))),NoAnnoList(List([NoAnnoList(Str("\"-o\"")),Var("g")]))]))))))]),Strategies([SDef("File-as-fd",[DefaultVarDec("s")],Seq(AM(CallNoArgs(SVar("xtc-open-fd")),Var("fd")),Call(SVar("finally"),[CallNoArgs(SVar("s")),Where(Call(SVar("try"),[BA(CallNoArgs(SVar("xtc-close-fd")),Var("fd"))]))]))),SDefNoArgs("xtc-open-fd",Choice(LRule(RuleNoCond(NoAnnoList(Op("FILE",[Var("s")])),App(CallNoArgs(SVar("open")),Var("s")))),Choice(LRule(RuleNoCond(NoAnnoList(Op("stdin",[])),App(CallNoArgs(SVar("STDIN_FILENO")),NoAnnoList(Tuple([]))))),Choice(LRule(RuleNoCond(NoAnnoList(Op("stdout",[])),App(CallNoArgs(SVar("STDOUT_FILENO")),NoAnnoList(Tuple([]))))),LRule(RuleNoCond(NoAnnoList(Op("stderr",[])),App(CallNoArgs(SVar("STDERR_FILENO")),NoAnnoList(Tuple([]))))))))),SDefNoArgs("xtc-close-fd",Call(SVar("finally"),[LChoice(Choice(Where(BA(CallNoArgs(SVar("eq")),NoAnnoList(Tuple([RootApp(Id),App(CallNoArgs(SVar("STDIN_FILENO")),NoAnnoList(Tuple([])))])))),Choice(Where(BA(CallNoArgs(SVar("eq")),NoAnnoList(Tuple([RootApp(Id),App(CallNoArgs(SVar("STDOUT_FILENO")),NoAnnoList(Tuple([])))])))),Where(BA(CallNoArgs(SVar("eq")),NoAnnoList(Tuple([RootApp(Id),App(CallNoArgs(SVar("STDERR_FILENO")),NoAnnoList(Tuple([])))])))))),CallNoArgs(SVar("close"))),Build(NoAnnoList(Tuple([])))])),SDefNoArgs("xtc-new-file-name",Seq(Call(SVar("obsolete"),[Build(NoAnnoList(Str("\"xtc-new-file-name; use xtc-new-file\"")))]),Seq(AM(CallNoArgs(SVar("new-file")),Var("f")),Seq(Where(BA(Call(SVar("assert"),[Build(Var("TempFiles"))]),NoAnnoList(Tuple([Var("f"),NoAnnoList(Tuple([]))])))),Build(NoAnnoList(Op("FILE",[Var("f")])))))))])])
