summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-03-15 15:08:47 +0100
committerErich Eckner <git@eckner.net>2016-03-15 15:08:47 +0100
commitb0f205894c62f0353aff4a7137cbd9da47bec656 (patch)
tree7f734a8fc9d573b68275914a2a47f3e6cfb1f2cf
parentd8634fbd7524396461e8418e033a66605a712300 (diff)
downloadunits-b0f205894c62f0353aff4a7137cbd9da47bec656.tar.xz
unfoldMacro in mystringlistunit.pas verwendet jetzt exprToBool aus matheunit.pas
-rw-r--r--mystringlistunit.pas73
1 files changed, 11 insertions, 62 deletions
diff --git a/mystringlistunit.pas b/mystringlistunit.pas
index 3f49b0b..973f2cc 100644
--- a/mystringlistunit.pas
+++ b/mystringlistunit.pas
@@ -249,13 +249,10 @@ end;
function tMyStringlist.unfoldMacros(kvs: tKnownValues; cbgv: tCallBackGetValue): boolean;
var
- i,j,k,l,Ebene: longint;
- s,t,u,v: string;
- SchleifenInhalt: tMyStringlist;
- istWahr,gefunden,wasGefunden: boolean;
-const
- binops: array[0..12] of string =
- ('<=','>=','<>','≤','≥','=','≠','<','>','in','∈','notIn','∉');
+ i,j,k,l,Ebene: longint;
+ s,t,u,v: string;
+ SchleifenInhalt: tMyStringlist;
+ wasGefunden: boolean;
begin
result:=false;
@@ -420,61 +417,13 @@ begin
s:=self[i];
if startetMit('?',s) then begin
wasGefunden:=true;
- t:=erstesArgument(s,':');
- gefunden:=false;
- for j:=0 to length(binops)-1 do
- if pos(binops[j],t)>0 then begin
- gefunden:=true;
- u:=trim(copy(t,1,pos(binops[j],t)-1));
- _del(t,1,pos(binops[j],t)+length(binops[j])-1);
- t:=trim(t);
- case binops[j] of
- '≤','<=': istWahr:=strtofloat(u)<=strtofloat(t);
- '≥','>=': istWahr:=strtofloat(u)>=strtofloat(t);
- '=':
- try
- istWahr:=strtofloat(u)=strtofloat(t);
- except
- istWahr:=u=t;
- end;
- '≠','<>':
- try
- istWahr:=strtofloat(u)<>strtofloat(t);
- except
- istWahr:=u<>t;
- end;
- '<': istWahr:=strtofloat(u)<strtofloat(t);
- '>': istWahr:=strtofloat(u)>strtofloat(t);
- 'in','∈': begin
- istWahr:=false;
- t:=t+' ';
- while (t<>'') and not istWahr do
- istWahr:=erstesArgument(t)=u;
- end;
- 'notIn','∉': begin
- istWahr:=true;
- t:=t+' ';
- while (t<>'') and istWahr do
- istWahr:=erstesArgument(t)<>u;
- end;
- else begin
- gibAus('Operator '''+binops[j]+''' ist nicht implementiert!',3);
- exit;
- end;
- end{of case};
- if not istWahr then
- delete(i);
- break;
- end;
- if not gefunden then begin
- gibAus('Ich kann keinen gültigen Operator in Bedingung '''+t+''' finden!',3);
- exit;
- end;
- if not istWahr then
- continue;
- self[i]:=s;
- end;
- inc(i);
+ if exprToBool(false,erstesArgument(s,':'),kvs,cbgv) then
+ self[i]:=s
+ else
+ delete(i);
+ end
+ else
+ inc(i);
end;
until not wasGefunden;