diff options
Diffstat (limited to 'ROM.lpr')
-rw-r--r-- | ROM.lpr | 138 |
1 files changed, 52 insertions, 86 deletions
@@ -10,7 +10,7 @@ uses {$ENDIF}{$ENDIF} Classes { you can add units after this }, - SysUtils,ROMunit, matheunit, Math, systemunit, lowlevelunit; + SysUtils,ROMunit, matheunit, Math, systemunit, lowlevelunit, mystringlistunit; var inPulsO,inPuls,refPulsO,refPuls,surTraj,cRefPuls, @@ -18,16 +18,17 @@ var smooth,betaSmooth,veloSmooth: longint; tmax,wmax,absShift,betaBound,veloBound,fftBreite: extended; force,fourier,mitAmplMod: boolean; - f: textfile; - s,t,u,lpicIn,rohIn,rohRef,outIn, + f,bekannteBefehle: tMyStringList; + s,lpicIn,rohIn,rohRef,outIn, outRef,outRefC,outSur,outVel: string; -//const Verwendung='Verwendung: ROM ($Einfallspuls_Datei $Ausfallspuls_Datei)/(- $trace-Datei-Prefix) $output_inPuls $output_refPuls $output_Trajektorie $output_cRefPuls '+ -// '[-s/--smooth $n] [-f/--force] [-t/--tmax $t] [-w/--wmax $w] [-F/--FFT] [-d/--dt $dt]'; -const Verwendung='Verwendung: ROM $Parameterdatei'; +const + Verwendung='Verwendung: ROM $Parameterdatei'; begin - if (paramcount<>1) or not fileexists(paramstr(1)) then Fehler(Verwendung); + if (paramcount<>1) or + not fileexists(paramstr(1)) then + Fehler(Verwendung); force:=false; smooth:=1; @@ -51,88 +52,59 @@ begin outSur:=''; outVel:=''; - assignfile(f,paramstr(1)); - reset(f); - while not eof(f) do begin - readln(f,s); - s:=shellSubst(s); - if pos('#',s)>0 then - delete(s,pos('#',s),length(s)); - s:=trim(s); - if s='' then continue; - if pos('?',s)=1 then begin - delete(s,1,1); - t:=trim(leftStr(s,pos('=',s)-1)); - delete(s,1,pos('=',s)); - u:=trim(leftStr(s,pos(':',s)-1)); - delete(s,1,pos(':',s)); - s:=trim(s); - if t<>u then - continue; - end; - - if s='mit Gewalt' then begin + f:=tMyStringList.create; + f.loadFromFile(paramstr(1)); + f.unfoldMacros; + bekannteBefehle:=tMyStringList.create; + while f.readln(s) do begin + bekannteBefehle.clear; + if istDasBefehl('mit Gewalt',s,bekannteBefehle,false) then begin force:=true; continue; end; - if s='ohne Gewalt' then begin + if istDasBefehl('ohne Gewalt',s,bekannteBefehle,false) then begin force:=false; continue; end; - if s='mit Amplitudenmodulation' then begin + if istDasBefehl('mit Amplitudenmodulation',s,bekannteBefehle,false) then begin mitAmplMod:=true; continue; end; - if (s='ohne Amplitudenmodulation') or - (s='nur Phasenmodulation') then begin + if istDasBefehl('ohne Amplitudenmodulation',s,bekannteBefehle,false) or + istDasBefehl('nur Phasenmodulation',s,bekannteBefehle,false) then begin mitAmplMod:=false; continue; end; - if pos('Glätte:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('Glätte:',s,bekannteBefehle,true) then begin smooth:=strtoint(s); continue; end; - if pos('Trajektoriengeschwindigkeitsglätte:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('Trajektoriengeschwindigkeitsglätte:',s,bekannteBefehle,true) then begin veloSmooth:=strtoint(s); continue; end; - if pos('Trajektorien-Maximalgeschwindigkeit:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('Trajektorien-Maximalgeschwindigkeit:',s,bekannteBefehle,true) then begin veloBound:=strtofloat(s); continue; end; - if pos('Betaglätte:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('Betaglätte:',s,bekannteBefehle,true) then begin betaSmooth:=strtoint(s); continue; end; - if pos('AM-Maximalgeschwindigkeit:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('AM-Maximalgeschwindigkeit:',s,bekannteBefehle,true) then begin betaBound:=strtofloat(s); continue; end; - if pos('tmax:',s)=1 then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('tmax:',s,bekannteBefehle,true) then begin tmax:=strtofloat(s); continue; end; - if (pos('wmax:',s)=1) or (pos('ωmax:',s)=1) then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('wmax:',s,bekannteBefehle,true) or + istDasBefehl('ωmax:',s,bekannteBefehle,true) then begin wmax:=strtofloat(s); continue; end; - if (pos('Absolutverschiebung:',s)=1) then begin - delete(s,1,pos(':',s)); - s:=trim(s); + if istDasBefehl('Absolutverschiebung:',s,bekannteBefehle,true) then begin if s='auto' then begin absShift:=-1e9; continue; @@ -148,58 +120,51 @@ begin fourier:=true; continue; end; - if pos('FFT-Breite:',s)=1 then begin - delete(s,1,pos(':',s)); - fftBreite:=strToFloat(trim(s)); + if istDasBefehl('FFT-Breite:',s,bekannteBefehle,true) then begin + fftBreite:=strToFloat(s); continue; end; if s='ohne FFT' then begin fourier:=false; continue; end; - if pos('lpic-Quelle:',s)=1 then begin - delete(s,1,pos(':',s)); - lpicIn:=trim(s); + if istDasBefehl('lpic-Quelle:',s,bekannteBefehle,true) then begin + lpicIn:=s; continue; end; - if pos('in-Quelle:',s)=1 then begin - delete(s,1,pos(':',s)); - rohIn:=trim(s); + if istDasBefehl('in-Quelle:',s,bekannteBefehle,true) then begin + rohIn:=s; continue; end; - if pos('reflex-Quelle:',s)=1 then begin - delete(s,1,pos(':',s)); - rohRef:=trim(s); + if istDasBefehl('reflex-Quelle:',s,bekannteBefehle,true) then begin + rohRef:=s; continue; end; - if pos('in-Ziel:',s)=1 then begin - delete(s,1,pos(':',s)); - outIn:=trim(s); + if istDasBefehl('in-Ziel:',s,bekannteBefehle,true) then begin + outIn:=s; continue; end; - if pos('reflex-Ziel:',s)=1 then begin - delete(s,1,pos(':',s)); - outRef:=trim(s); + if istDasBefehl('reflex-Ziel:',s,bekannteBefehle,true) then begin + outRef:=s; continue; end; - if pos('reflex-Approx-Ziel:',s)=1 then begin - delete(s,1,pos(':',s)); - outRefC:=trim(s); + if istDasBefehl('reflex-Approx-Ziel:',s,bekannteBefehle,true) then begin + outRefC:=s; continue; end; - if pos('trajektorie-Ziel:',s)=1 then begin - delete(s,1,pos(':',s)); - outSur:=trim(s); + if istDasBefehl('trajektorie-Ziel:',s,bekannteBefehle,true) then begin + outSur:=s; continue; end; - if pos('geschwindigkeit-Ziel:',s)=1 then begin - delete(s,1,pos(':',s)); - outVel:=trim(s); + if istDasBefehl('geschwindigkeit-Ziel:',s,bekannteBefehle,true) then begin + outVel:=s; continue; end; - Fehler('Unbekannter Parameter '''+s+''' in Inputdatei '''+paramstr(1)+'''!'); + bekannteBefehle.sort; + Fehler('Unbekannter Parameter '''+s+''' in Inputdatei '''+paramstr(1)+'''!'#10'Ich kenne nur:'#10+bekannteBefehle.text); end; - closefile(f); + bekannteBefehle.free; + f.free; if (absShift<-1.5e9) and (lpicIn='') then Fehler('Ich brauche zur Bestimmung der Gesamtverschiebung die Inputdatei vom LPIC!'); @@ -350,6 +315,7 @@ begin else writeOutput(outVel,surVel); end; - if outRefC<>'' then writeOutput(outRefC,cRefPuls); + if outRefC<>'' then + writeOutput(outRefC,cRefPuls); end. |