Module("stratego/xtc/Repository",[Signature([Sorts([SortNoArgs("XtcKey")]),Constructors([OpDecl("Tool",FunType([ConstType(SortNoArgs("String"))],ConstType(SortNoArgs("XtcKey")))),OpDecl("Repository",ConstType(SortNoArgs("XtcKey"))),OpDecl("Import",ConstType(SortNoArgs("XtcKey"))),OpDecl("Imported",FunType([ConstType(SortNoArgs("String"))],ConstType(SortNoArgs("XtcKey")))),OpDecl("XTC",ConstType(SortNoArgs("Table")))])]),Strategies([SDefNoArgs("xtc-location",LChoice(BA(CallNoArgs(SVar("get-config")),NoAnnoList(Str("\"-r\""))),LChoice(BA(CallNoArgs(SVar("getenv")),NoAnnoList(Str("\"XTC_REPOSITORY\""))),CallNoArgs(SVar("GetInternalDefaultXtcRepository"))))),ExtSDef("GetInternalDefaultXtcRepository",[],[]),SDefNoArgs("xtc-read",Seq(Match(Var("rep")),Seq(Not(BA(CallNoArgs(SVar("table-get")),NoAnnoList(Tuple([Var("XTC"),NoAnnoList(Op("Imported",[Var("rep")]))])))),Seq(Where(BA(CallNoArgs(SVar("table-put")),NoAnnoList(Tuple([Var("XTC"),Var("Repository"),NoAnnoList(List([Var("rep")]))])))),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),App(CallNoArgs(SVar("conc-strings")),NoAnnoList(Tuple([NoAnnoList(Str("\"Reading repository \"")),Var("rep")])))]),Seq(CallNoArgs(SVar("read-repository-file")),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),App(CallNoArgs(SVar("conc-strings")),NoAnnoList(Tuple([NoAnnoList(Str("\"Read repository \"")),Var("rep")])))]),Seq(BA(Call(SVar("table-putlist"),[CallNoArgs(SVar("table-append"))]),NoAnnoList(Tuple([Var("XTC"),RootApp(Id)]))),Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Repository stored in table\""))]),Seq(BA(CallNoArgs(SVar("table-put")),NoAnnoList(Tuple([Var("XTC"),NoAnnoList(Op("Imported",[Var("rep")])),NoAnnoList(List([]))]))),CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Registered repository as imported\""))]))))))))))),SDefNoArgs("xtc-import",Where(Call(SVar("repeat"),[Seq(BA(CallNoArgs(SVar("table-get")),NoAnnoList(Tuple([Var("XTC"),Var("Import")]))),Seq(Call(SVar("filter"),[CallNoArgs(SVar("xtc-read"))]),Not(ListCongNoTail([]))))]))),SDefNoArgs("xtc-load",Seq(CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Loading repository\""))]),Seq(Where(LChoice(BA(CallNoArgs(SVar("table-get")),NoAnnoList(Tuple([Var("XTC"),Var("Repository")]))),Seq(CallNoArgs(SVar("xtc-location")),Seq(CallNoArgs(SVar("xtc-read")),CallNoArgs(SVar("xtc-import")))))),CallT(SVar("log"),[],[NoAnnoList(Op("Vomit",[])),NoAnnoList(Str("\"Loaded repository \""))]))))])])
