1flpFlag(neg(debug)).
    4viewIf(Item) :-
    5 	(   flpFlag(debug) -> 
    6	    view(Item) ;
    7	    true).
    8
    9:- ensure_loaded('util').   10
   11:- dynamic verber/5.   12
   13:- ensure_loaded('args').   14
   15fixvars(P,_,[],P):-!.
   16fixvars(P,N,[V|VARS],PO):-
   17	atom_string(Name,V),clip_qm(Name,NB),Var = '$VAR'(NB),
   18	subst(P,'$VAR'(N),Var,PM0),
   19	subst(PM0,'$VAR'(Name),Var,PM),
   20				%  (get_varname_list(Vs)->true;Vs=[]),
   21				%   append(Vs,[Name=Var],NVs),
   22				%   nput_variable_names( NVs),
   23	N2 is N + 1, fixvars(PM,N2,VARS,PO).
   24
   25:- ensure_loaded('parseDomainPDDL2.2').   26:- ensure_loaded('parseProblemPDDL2.2').   27:- ensure_loaded('parseDomainVerb').   28:- ensure_loaded('parseProblemVerb').   29:- ensure_loaded('parseSolutionLPGTD').
   38parseCapsule(Arguments) :-
   39	argt(Arguments,[templateDir(Dir),capsule(Capsule),parsed(Parsed),extension(Extension)]),
   40	atomic_list_concat([Dir,Capsule],'',Prefix),
   41	atomic_list_concat([Prefix,'.d.',Extension],'',DomainFile),	
   42	atomic_list_concat([Prefix,'.p.',Extension],'',ProblemFile),	
   43	currentPlanner(Planner),
   44	atomic_list_concat(['worlds/',Capsule,'.p.',Extension,'.',Planner,'.sol'],'',SolutionFile),
   46	
   47	
   48	atomic_list_concat([Prefix,'.metadata.pl'],'',VerbFile),
   49
   50	(   (	Extension = 'pddl') ->
   51	    (	parseDomainPDDL(DomainFile,Domain),
   52		viewIf([domain,Domain]),
   53
   54		parseProblemPDDL(ProblemFile,Problem),
   55		viewIf([problem,Problem])
   56	    ) ;
   57	    (	(   Extension = 'verb') ->
   58		(   parseDomainVerb(DomainFile,Domain),
   59		    viewIf([domain,Domain]),
   60
   61		    parseProblemVerb(ProblemFile,Problem),
   62		    viewIf([problem,Problem])
   63		) ;
   64		true)),
   65	view([hi]),
   66	(   exists_file(SolutionFile) ->
   67	    (
   68	     view([ho]),
   69	     parseSolution(SolutionFile,TmpSolution),
   70	     view([ho1]),
   71	     correctCases(TmpSolution,Solution),
   72	     view([ho2]),
   73	     viewIf([solution,Solution]),
   74	     view([ho3])
   75	    ) ; TmpSolution = []),
   76	(   exists_file(VerbFile) ->
   77	    (
   78	     view([he]),
   79	     retractall(verber(_,_,_,_,_)),
   80	     consult(VerbFile),
   81	     findall(verber(A,B,C,D,E),verber(A,B,C,D,E),Verb)) ;
   82	    Verb = []),
   83	view([ha]),
   84	viewIf([verb,Verb]),
   85	!,
   86	Parsed = [domainFile(DomainFile),domain(Domain),problemFile(ProblemFile),problem(Problem),solutionFile(SolutionFile),solution(Solution),verbFile(VerbFile),verb(Verb)],
   87	Arguments = [templateDir(Dir),capsule(Capsule),parsed(Parsed),extension(Extension)]