summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-03-08 13:26:35 +0100
committerErich Eckner <git@eckner.net>2016-03-15 13:01:16 +0100
commit0af58141bb3580e944780b8e89f3974b06c5e232 (patch)
treec2f37646beacd2e193a7f4900552bfe36bc53fd3
parent4968f44f277c1428e9bf18201b605550c5d86c84 (diff)
downloadunits-0af58141bb3580e944780b8e89f3974b06c5e232.tar.xz
Warnung in systemunit.pas entfernt
-rw-r--r--matheunit.pas17
-rw-r--r--systemunit.pas1
2 files changed, 17 insertions, 1 deletions
diff --git a/matheunit.pas b/matheunit.pas
index 61c1eea..7b00e52 100644
--- a/matheunit.pas
+++ b/matheunit.pas
@@ -468,6 +468,21 @@ begin
floattostr(exprtofloat(st,copy(s,pos('(',s)+1,i-pos('(',s)-1),kvs,cbgv))+
copy(s,i+1,length(s)-i);
end;
+
+ if assigned(cbgv) then
+ while pos('[',s)>0 do begin
+ i:=pos('[',s)-1; // i wird Index des letzten Zeichens vor "Werte[bla].blubb" o. ä.
+ while (i>0) and not (s[i] in ['+','-','*','/','^']) do
+ dec(i);
+ j:=pos(']',s)+1; // j wird Index des ersten Zeichens nach "Werte[bla].blubb" o. ä.
+ while (j<=length(s)) and not (s[j] in ['+','-','*','/','^']) do
+ inc(j);
+
+ s:=copy(s,1,i)+ // vorher
+ floattostr(cbgv(copy(s,i+1,j-i-1)))+ // zwischen
+ copy(s,j,length(s)-j+1); // nachher
+ end;
+
if (binOpPos('+',s)>0) or (binOpPos('-',s)>0) then begin
result:=0;
inv:=false;
@@ -507,7 +522,7 @@ begin
for i:=1 to length(s) do
cbv:=cbv or not (s[i] in ['-','0'..'9','.',',','e','E']);
if not cbv then result:=strtofloat(s)
- else if not kvs.extract(s,result) then begin
+ else if not (assigned(kvs) and kvs.extract(s,result)) then begin
if st then result:=1
else if assigned(cbgv) then result:=cbgv(s)
else begin
diff --git a/systemunit.pas b/systemunit.pas
index 6b858b2..763c8db 100644
--- a/systemunit.pas
+++ b/systemunit.pas
@@ -156,6 +156,7 @@ begin
args[0]:='-f';
args[1]:='-n';
args[2]:=s;
+ result:='';
if not runCommand('readlink',args,result) then
raise exception.create('Fehler beim Ausführen von ''readlink -f -n '+s+'''!');
end;