diff options
author | Erich Eckner <git@eckner.net> | 2018-05-24 12:16:13 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-24 12:16:13 +0200 |
commit | 5d70f388b7d3dbe2f6bb3a5fda13ffaf448d14de (patch) | |
tree | ab487d78f0363493636c12469e67ba907c82268d | |
parent | 07cacf5918f0b9489a0b066285847e8be84a77e9 (diff) | |
download | epost-5d70f388b7d3dbe2f6bb3a5fda13ffaf448d14de.tar.xz |
"lies Wert" neu
-rw-r--r-- | epost.lpr | 7 | ||||
-rw-r--r-- | epost.lps | 134 | ||||
-rw-r--r-- | epostunit.pas | 47 |
3 files changed, 120 insertions, 68 deletions
@@ -656,6 +656,13 @@ begin aufraeumen; halt(1); end; + if istDasBefehl('lies Wert',s,bekannteBefehle,true) then begin + if not liesWert(syntaxTest,s) then begin + aufraeumen; + halt(1); + end; + continue; + end; if istDasBefehl('Dateiende',s,bekannteBefehle,false) then break; bekannteBefehle.sort; @@ -7,8 +7,8 @@ <Unit0> <Filename Value="epost.lpr"/> <IsPartOfProject Value="True"/> - <TopLine Value="618"/> - <CursorPos Y="659"/> + <TopLine Value="643"/> + <CursorPos X="24" Y="662"/> <UsageCount Value="202"/> <Loaded Value="True"/> </Unit0> @@ -23,8 +23,8 @@ <Filename Value="epostunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="1"/> - <TopLine Value="5422"/> - <CursorPos X="14" Y="5439"/> + <TopLine Value="8775"/> + <CursorPos X="31" Y="8771"/> <UsageCount Value="201"/> <Loaded Value="True"/> </Unit2> @@ -32,8 +32,8 @@ <Filename Value="werteunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="9"/> - <TopLine Value="2257"/> - <CursorPos X="78" Y="2285"/> + <TopLine Value="884"/> + <CursorPos X="39" Y="902"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit3> @@ -41,8 +41,8 @@ <Filename Value="typenunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="12"/> - <TopLine Value="2346"/> - <CursorPos X="40" Y="2352"/> + <TopLine Value="2328"/> + <CursorPos X="42" Y="2350"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit4> @@ -78,8 +78,8 @@ <IsVisibleTab Value="True"/> <EditorIndex Value="10"/> <TopLine Value="172"/> - <CursorPos X="21" Y="183"/> - <UsageCount Value="173"/> + <CursorPos X="43" Y="184"/> + <UsageCount Value="175"/> <Loaded Value="True"/> </Unit8> <Unit9> @@ -91,9 +91,9 @@ <Unit10> <Filename Value="../units/mystringlistunit.pas"/> <EditorIndex Value="8"/> - <TopLine Value="515"/> - <CursorPos X="21" Y="543"/> - <UsageCount Value="85"/> + <TopLine Value="713"/> + <CursorPos X="22" Y="735"/> + <UsageCount Value="86"/> <Loaded Value="True"/> </Unit10> <Unit11> @@ -117,7 +117,7 @@ <EditorIndex Value="2"/> <TopLine Value="190"/> <CursorPos X="22" Y="195"/> - <UsageCount Value="99"/> + <UsageCount Value="100"/> <Loaded Value="True"/> </Unit13> <Unit14> @@ -188,126 +188,124 @@ <EditorIndex Value="6"/> <TopLine Value="87"/> <CursorPos X="3" Y="18"/> - <UsageCount Value="34"/> + <UsageCount Value="35"/> <Loaded Value="True"/> </Unit23> </Units> <JumpHistory Count="29" HistoryIndex="28"> <Position1> - <Filename Value="werteunit.pas"/> - <Caret Line="426" Column="190" TopLine="398"/> + <Filename Value="epostunit.pas"/> + <Caret Line="80" Column="31" TopLine="62"/> </Position1> <Position2> - <Filename Value="werteunit.pas"/> - <Caret Line="452" Column="187" TopLine="424"/> + <Filename Value="epostunit.pas"/> + <Caret Line="7733" Column="23" TopLine="7714"/> </Position2> <Position3> - <Filename Value="werteunit.pas"/> - <Caret Line="471" Column="187" TopLine="443"/> + <Filename Value="epostunit.pas"/> + <Caret Line="8029" TopLine="7999"/> </Position3> <Position4> - <Filename Value="werteunit.pas"/> - <Caret Line="477" Column="175" TopLine="449"/> + <Filename Value="epost.lpr"/> + <Caret Line="662" Column="59" TopLine="633"/> </Position4> <Position5> - <Filename Value="werteunit.pas"/> - <Caret Line="489" Column="92" TopLine="461"/> + <Filename Value="../units/mystringlistunit.pas"/> + <Caret Line="54" Column="22" TopLine="36"/> </Position5> <Position6> - <Filename Value="werteunit.pas"/> - <Caret Line="491" Column="128" TopLine="463"/> + <Filename Value="epost.lpr"/> + <Caret Line="662" Column="59" TopLine="633"/> </Position6> <Position7> - <Filename Value="werteunit.pas"/> - <Caret Line="494" Column="63" TopLine="466"/> + <Filename Value="epostunit.pas"/> + <Caret Line="8028" Column="24" TopLine="8009"/> </Position7> <Position8> - <Filename Value="werteunit.pas"/> - <Caret Line="532" Column="73" TopLine="504"/> + <Filename Value="epostunit.pas"/> + <Caret Line="490" Column="28" TopLine="472"/> </Position8> <Position9> - <Filename Value="werteunit.pas"/> - <Caret Line="552" Column="73" TopLine="524"/> + <Filename Value="epostunit.pas"/> + <Caret Line="9442" Column="10" TopLine="9428"/> </Position9> <Position10> - <Filename Value="werteunit.pas"/> - <Caret Line="572" Column="73" TopLine="544"/> + <Filename Value="epostunit.pas"/> </Position10> <Position11> - <Filename Value="werteunit.pas"/> - <Caret Line="582" Column="62" TopLine="554"/> + <Filename Value="epostunit.pas"/> + <Caret Line="492" TopLine="461"/> </Position11> <Position12> - <Filename Value="werteunit.pas"/> - <Caret Line="590" Column="65" TopLine="562"/> + <Filename Value="epostunit.pas"/> + <Caret Line="9461" Column="30" TopLine="9459"/> </Position12> <Position13> - <Filename Value="werteunit.pas"/> - <Caret Line="637" Column="79" TopLine="609"/> + <Filename Value="epostunit.pas"/> </Position13> <Position14> - <Filename Value="werteunit.pas"/> - <Caret Line="679" Column="90" TopLine="651"/> + <Filename Value="epostunit.pas"/> + <Caret Line="181" Column="41" TopLine="153"/> </Position14> <Position15> - <Filename Value="werteunit.pas"/> - <Caret Line="687" Column="59" TopLine="659"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5437" Column="32" TopLine="5416"/> </Position15> <Position16> - <Filename Value="werteunit.pas"/> - <Caret Line="1366" Column="14" TopLine="1338"/> + <Filename Value="typenunit.pas"/> + <Caret Line="434" Column="20" TopLine="417"/> </Position16> <Position17> - <Filename Value="werteunit.pas"/> - <Caret Line="1399" Column="49" TopLine="1371"/> + <Filename Value="typenunit.pas"/> + <Caret Line="2330" Column="21" TopLine="2328"/> </Position17> <Position18> - <Filename Value="werteunit.pas"/> - <Caret Line="1464" Column="32" TopLine="1436"/> + <Filename Value="typenunit.pas"/> + <Caret Line="2332" Column="30" TopLine="2325"/> </Position18> <Position19> - <Filename Value="werteunit.pas"/> - <Caret Line="1485" Column="101" TopLine="1457"/> + <Filename Value="typenunit.pas"/> + <Caret Line="2339" Column="30" TopLine="2325"/> </Position19> <Position20> - <Filename Value="werteunit.pas"/> - <Caret Line="1517" Column="45" TopLine="1489"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5444" Column="40" TopLine="5416"/> </Position20> <Position21> - <Filename Value="werteunit.pas"/> - <Caret Line="1541" Column="104" TopLine="1513"/> + <Filename Value="epostunit.pas"/> + <Caret Line="471" Column="30" TopLine="453"/> </Position21> <Position22> - <Filename Value="werteunit.pas"/> - <Caret Line="1543" Column="14" TopLine="1515"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5404" Column="78" TopLine="5375"/> </Position22> <Position23> - <Filename Value="werteunit.pas"/> - <Caret Line="1550" Column="91" TopLine="1522"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5444" Column="66" TopLine="5416"/> </Position23> <Position24> - <Filename Value="werteunit.pas"/> - <Caret Line="1552" Column="18" TopLine="1524"/> + <Filename Value="epostunit.pas"/> + <Caret Line="8771" Column="31" TopLine="8775"/> </Position24> <Position25> <Filename Value="werteunit.pas"/> - <Caret Line="1562" Column="83" TopLine="1534"/> + <Caret Line="57" Column="34" TopLine="41"/> </Position25> <Position26> <Filename Value="werteunit.pas"/> - <Caret Line="1621" Column="13" TopLine="1593"/> + <Caret Line="58" Column="34" TopLine="41"/> </Position26> <Position27> <Filename Value="werteunit.pas"/> - <Caret Line="1888" Column="6" TopLine="1860"/> + <Caret Line="59" Column="34" TopLine="41"/> </Position27> <Position28> <Filename Value="werteunit.pas"/> - <Caret Line="2225" Column="99" TopLine="2197"/> + <Caret Line="898" Column="39" TopLine="870"/> </Position28> <Position29> <Filename Value="werteunit.pas"/> - <Caret Line="2245" Column="131" TopLine="2217"/> + <Caret Line="900" Column="39" TopLine="884"/> </Position29> </JumpHistory> </ProjectSession> diff --git a/epostunit.pas b/epostunit.pas index 0acf74f..46377dc 100644 --- a/epostunit.pas +++ b/epostunit.pas @@ -488,6 +488,7 @@ procedure warteAufExterneBefehle; procedure beendeExterneBefehleWennFertig; function ermittleAnstieg(sT: boolean; s: string): boolean; function ermittleMittelwert(sT: boolean; s: string): boolean; +function liesWert(sT: boolean; s: string): boolean; var allePaletten: tPalettenArray; @@ -9433,6 +9434,52 @@ begin result:=true; end; +function liesWert(sT: boolean; s: string): boolean; +var + i: longint; + name,datei: string; + wert: extended; + sl: tMyStringList; +begin + result:=false; + name:=erstesArgument(s); + if not startetMit('aus ',s) then begin + gibAus('Syntaxfehler, erwarte: ''lies Wert $name aus $datei $spalte $identifikation''.',3); + exit; + end; + datei:=erstesArgument(s); + if not fileExists(datei) then begin + gibAus('Datei '''+datei+''' existiert nicht um Wert zu lesen!',3); + exit; + end; + try + i:=strToInt(erstesArgument(s)); + except + gibAus('Syntaxfehler, erwarte: ''lies Wert $name aus $datei $spalte $identifikation''.',3); + exit; + end; + if sT then begin + // Wir brauchen einen sinnvollen Wert zum Syntaxtest, aber dann müssen wir + // ihn später nicht noch einmal einlesen. + sl:=tMyStringList.create; + sl.loadFromFile(datei); + sl.grep('^'+escapeStringToRegex(s+',',rtFpc)); + if sl.count<>1 then begin + gibAus('Datei '''+datei+''' beinhaltet Zeile mit Identifikation '''+s+''' nicht genau ein Mal, sondern '+intToStr(sl.count)+' Mal.',3); + exit; + end; + s:=sl[0]; + while i>0 do begin + erstesArgument(s,','); + dec(i); + end; + wert:=strToFloat(erstesArgument(s,',')); + globaleWerte.add(name,wert); + sl.free; + end; + result:=true; +end; + var i: longint; |