diff options
author | Erich Eckner <git@eckner.net> | 2015-07-29 09:45:41 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-07-29 09:45:41 +0200 |
commit | 066f01c3498feff5b0d518a307ed6d78fef443e8 (patch) | |
tree | 8d3534930ab95a114c03ef242e3c1e008b996723 | |
parent | c3a01b065a030a78471ee68e087055af3a49af69 (diff) | |
download | units-066f01c3498feff5b0d518a307ed6d78fef443e8.tar.xz |
Funktion dump eingefuegt,
Protokollant wird nun mit Namen statt Typbezeichner initialisiert
-rw-r--r-- | matheunit.pas | 11 | ||||
-rw-r--r-- | mystringlistunit.pas | 25 |
2 files changed, 30 insertions, 6 deletions
diff --git a/matheunit.pas b/matheunit.pas index cf7eda8..9823391 100644 --- a/matheunit.pas +++ b/matheunit.pas @@ -5,7 +5,7 @@ unit matheunit; interface uses - Classes, SysUtils, Gmp, Math, lowlevelunit; + Classes, SysUtils, Gmp, Math, lowlevelunit, protokollunit; type tCallBackGetValue = function(name: string): extended of object; @@ -25,6 +25,7 @@ type procedure add(nam: string; val: extended); overload; function rem(nam: string): boolean; function extract(nam: string; out val: extended): boolean; inline; + procedure dump(prot: tProtokollant; prefix: string); end; function plus(a,b: tExtPoint): tExtPoint; @@ -117,6 +118,14 @@ begin val:=kvs[i].value; end; +procedure tKnownValues.dump(prot: tProtokollant; prefix: string); +var + i: longint; +begin + for i:=0 to length(kvs)-1 do + prot.schreibe(prefix+kvs[i].name+' = '+floattostr(kvs[i].value)); +end; + // allgemeine Funktionen ******************************************************* function plus(a,b: tExtPoint): tExtPoint; diff --git a/mystringlistunit.pas b/mystringlistunit.pas index 47bc37c..a8ef5ae 100644 --- a/mystringlistunit.pas +++ b/mystringlistunit.pas @@ -24,7 +24,7 @@ type line: longint; prot: tProtokollant; public - constructor create(protokollant: tProtokollant); + constructor create(protokollant: tProtokollant; name: string); procedure loadFromFile(const s: ansiString); override; procedure loadFromGz(const s: ansiString); procedure saveToGz(const s: ansiString); @@ -35,6 +35,7 @@ type function stillNeed(bez: string): boolean; function unfoldMacros: boolean; procedure subst(regex,ersatz: string); + procedure dump(pro: tProtokollant; prefix: string); end; procedure _del(var s: string; p,c: longint); inline; // identisch zu delete(s,p,c) -- lediglich um delete innerhalb von tMyStringlist verfügbar zu haben @@ -77,10 +78,13 @@ end; // tMyStringlist *************************************************************** -constructor tMyStringlist.create(protokollant: tProtokollant); +constructor tMyStringlist.create(protokollant: tProtokollant; name: string); begin inherited create; - prot:=tProtokollant.create(protokollant,'tMyStringlist'); + if assigned(protokollant) then + prot:=tProtokollant.create(protokollant,name) + else + prot:=nil; line:=0; end; @@ -91,7 +95,10 @@ begin for i:=0 to count-1 do self[i]:=trim(self[i]); line:=0; - writeln(inttostr(count)+' Zeilen eingelesen'); + if assigned(prot) then + prot.schreibe(inttostr(count)+' Zeilen eingelesen') + else + writeln(inttostr(count)+' Zeilen eingelesen'); end; procedure tMyStringlist.loadFromGz(const s: ansiString); @@ -273,7 +280,7 @@ begin t:=erstesArgument(s,':'); if (length(t)=0) or (t[1]<>'$') then exit; - SchleifenInhalt:=tMyStringlist.create(nil); // Schleifenkörper merken + SchleifenInhalt:=tMyStringlist.create(nil,''); // Schleifenkörper merken Ebene:=0; while (i<Count) and ((Ebene<>0) or (self[i]<>'!Schleifenende')) do begin SchleifenInhalt.Add(self[i]); @@ -417,6 +424,14 @@ begin re.free; end; +procedure tMyStringlist.dump(pro: tProtokollant; prefix: string); +var + i: longint; +begin + for i:=0 to count-1 do + pro.schreibe(prefix+self[i]); +end; + // allgemeine Funktionen ******************************************************* procedure _del(var s: string; p,c: longint); |