-- convert linux/unix 2 dos

-- Top-Down beschrijving . Voor een (normale) Bottum-Up versie zie l2d.exp

-- doe dit als je default voor JTP wilt gaan gebruiken
-- with define JTP

global sequence cmd
-- deze moeten global zijn omdat ze gebruikt worden in TD12d.e
include TDl2d.e -- de uit te voeren actie's

integer inlength

-- main prog

ifdef JTP -- conditioneel vertalen voor Judo Toernooi Programma
-- als je geen 'with define' gebruikt kan het ook via de opdracht regel
-- peu TDl2d bestand_in bestand_uit -DJTP 
cmd="norm.vrd"
   convert2file(1,0)
cmd="poule.vrd"
   convert2file(1,0)

elsedef --  conditioneel anders

cmd=command_line()   -- command line bestaat als eerste uit het uittevoeren programma naam
                     -- gevolgd door het opgegeven aantal parameters
inlength=length(cmd) -- geef het aantal elementen van cmd
if match("peu",cmd[1])
then -- interpreter dus peu TDl2d parameter_1 -> cmd[1]=peu cmd[2]=parameter_1 
 if inlength < 3 
 then -- no file given give help
 puts(1,"Use : peu l2d fileinout or peu l2d filein fileout\n")
 elsif inlength < 4
 then -- input is output file
 convert2file(3,0)
 else -- input differend output file
 convert2file(3,1)
 end if
else -- compiled (bind) dus TDl2d parameter_1 -> cmd[1]=TDl2d cmd[2]=parameter_1
 if inlength < 2 
 then -- no file given give help
 puts(1,"Use : l2d fileinout or l2d filein fileout\n")
 elsif inlength < 3
 then -- input is output file
 convert2file(2,0)
 else -- input differend output file
 convert2file(2,1)
 end if
end if                         

enddef -- einde conditie
  
abort(0)