Module("stratego/xtc/Register",[Imports([Import("stratego/xtc/Repository")]),Strategies([SDefNoArgs("xtc-find-warning",CallNoArgs(SVar("xtc-find"))),SDefNoArgs("xtc-find",LChoice(Seq(Match(Var("tool")),Seq(CallNoArgs(SVar("xtc-load")),Seq(LChoice(CallNoArgs(SVar("xtc-find-version-loc")),CallNoArgs(SVar("xtc-find-loc"))),CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(List([NoAnnoList(Str("\"Found \"")),Var("tool"),NoAnnoList(Str("\" at \"")),RootApp(Id)]))])))),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Error",[])),NoAnnoList(List([NoAnnoList(Str("\"No XTC registration for \"")),RootApp(Id),NoAnnoList(Str("\" found\""))]))]),Fail))),SDefNoArgs("xtc-find-silent",Seq(CallNoArgs(SVar("xtc-load")),LChoice(CallNoArgs(SVar("xtc-find-version-loc")),CallNoArgs(SVar("xtc-find-loc"))))),RDefNoArgs("xtc-find-version-loc",Rule(NoAnnoList(Tuple([Var("tool"),Var("version")])),Var("loc"),Seq(BA(CallNoArgs(SVar("table-get")),NoAnnoList(Tuple([Var("XTC"),NoAnnoList(Op("Tool",[Var("tool")]))]))),Call(SVar("fetch"),[Match(NoAnnoList(Tuple([Var("version"),Var("loc")])))])))),RDefNoArgs("xtc-find-loc",Rule(Var("tool"),Var("loc"),AM(BA(CallNoArgs(SVar("table-get")),NoAnnoList(Tuple([Var("XTC"),NoAnnoList(Op("Tool",[Var("tool")]))]))),NoAnnoList(ListTail([NoAnnoList(Tuple([Var("version"),Var("loc")]))],Wld))))),SDefNoArgs("xtc-find-path",Seq(CallNoArgs(SVar("xtc-find")),CallNoArgs(SVar("dirname")))),SDefNoArgs("xtc-register",Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"-t\""))),Var("tools")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Debug",[])),NoAnnoList(ListTail([NoAnnoList(Str("\"Tools : \""))],App(CallT(SVar("separate-by"),[],[NoAnnoList(Str("\", \""))]),Var("tools"))))]),Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"-V\""))),Var("version")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Debug",[])),NoAnnoList(List([NoAnnoList(Str("\"Version : \"")),Var("version")]))]),Seq(CondChoice(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"--path\""))),Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"--path\""))),Var("path")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Debug",[])),NoAnnoList(List([NoAnnoList(Str("\"Path : \"")),Var("path")]))]),CallT(SVar("xtc-register-path"),[],[Var("tools"),Var("version"),Var("path")]))),Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"-l\""))),Var("loc")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Debug",[])),NoAnnoList(List([NoAnnoList(Str("\"Location : \"")),Var("loc")]))]),CallT(SVar("xtc-register"),[],[Var("tools"),Var("version"),Var("loc")])))),Build(Var("tools"))))))))]),Strategies([SDefT("xtc-register",[],[DefaultVarDec("tools"),DefaultVarDec("version"),DefaultVarDec("loc")],Where(Seq(Build(Var("tools")),Seq(LChoice(CallNoArgs(SVar("is-list")),Build(NoAnnoList(List([RootApp(Id)])))),Call(SVar("map"),[Scope(["tool"],Seq(Match(Var("tool")),CallT(SVar("xtc-register-path"),[],[Var("tool"),Var("version"),App(CallNoArgs(SVar("conc-strings")),NoAnnoList(Tuple([Var("loc"),NoAnnoList(Str("\"/\"")),Var("tool")])))])))]))))),SDefT("xtc-register-path",[],[DefaultVarDec("tools"),DefaultVarDec("version"),DefaultVarDec("path")],Where(Seq(BA(CallNoArgs(SVar("is-list")),Var("tools")),Seq(Build(Var("tools")),Call(SVar("map"),[Scope(["tool"],Seq(Match(Var("tool")),CallT(SVar("xtc-register-path"),[],[Var("tool"),Var("version"),Var("path")])))]))))),SDefT("xtc-register-path",[],[DefaultVarDec("tool"),DefaultVarDec("version"),DefaultVarDec("path")],Where(Seq(BA(Not(CallNoArgs(SVar("is-list"))),Var("tool")),Seq(CallNoArgs(SVar("xtc-load")),Seq(Assign(Var("tbl"),RootApp(CallT(SVar("lookup-table"),[],[NoAnnoList(Op("XTC",[]))]))),Seq(CondChoice(Assign(Var("val"),App(CallT(SVar("hashtable-get"),[],[NoAnnoList(Op("Tool",[Var("tool")]))]),Var("tbl"))),Seq(Build(Var("val")),Seq(Call(SVar("remove-all"),[Match(NoAnnoList(Tuple([Wld,Var("path")])))]),CondChoice(Call(SVar("fetch"),[Match(NoAnnoList(Tuple([Var("version"),Wld])))]),Call(SVar("fetch"),[SRule(RuleNoCond(NoAnnoList(Tuple([Var("version"),Wld])),NoAnnoList(Tuple([Var("version"),Var("path")]))))]),Build(NoAnnoList(ListTail([NoAnnoList(Tuple([Var("version"),Var("path")]))],RootApp(Id))))))),Build(NoAnnoList(List([NoAnnoList(Tuple([Var("version"),Var("path")]))])))),Seq(Match(Var("newval")),BA(CallT(SVar("hashtable-put"),[],[NoAnnoList(Op("Tool",[Var("tool")])),Var("newval")]),Var("tbl")))))))))]),Strategies([SDefNoArgs("register-import",Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"import\""))),Var("imports")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Registering imports\"")),RootApp(Id)]),Seq(AM(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"import\""))),Var("reps")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Importing\"")),RootApp(Id)]),BA(CallNoArgs(SVar("table-union")),NoAnnoList(Tuple([Var("XTC"),Var("Import"),Var("reps")]))))))))])])
