diff options
author | Erich Eckner <git@eckner.net> | 2017-07-18 09:26:29 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-20 12:11:16 +0200 |
commit | 2798b395bc067293d3a7d338a792224da17854e3 (patch) | |
tree | 2f2edf0b5944a0e01b77029516b3236695cd92be /matheunit.pas | |
parent | 1d177b0eb1bcbea486318d5a68dc5f7c1b0e39df (diff) | |
download | units-2798b395bc067293d3a7d338a792224da17854e3.tar.xz |
homogenisiere Grosz-Klein-Schreibung
Diffstat (limited to 'matheunit.pas')
-rw-r--r-- | matheunit.pas | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/matheunit.pas b/matheunit.pas index f34f2b3..80c4be7 100644 --- a/matheunit.pas +++ b/matheunit.pas @@ -45,8 +45,8 @@ function istGanzZahl(s: string): boolean; procedure copyArray(i: tExtPointArray; out o: tExtPointArray); overload; procedure copyArray(i: tLongintArray; out o: tLongintArray); overload; procedure copyArray(i: tExtendedArray; out o: tExtendedArray); overload; -function nullfunktion(x: extended): extended; -function exprtofloat(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): extended; +function nullFunktion(x: extended): extended; +function exprToFloat(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): extended; function exprToBool(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): boolean; function formelnAuswerten(s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): string; function knownValue(nam: string; val: extended): tKnownValue; @@ -58,13 +58,13 @@ implementation constructor tKnownValues.create; begin inherited create; - fillchar(kvs,sizeof(kvs),#0); + fillchar(kvs,sizeOf(kvs),#0); add('π',pi); end; destructor tKnownValues.destroy; begin - setlength(kvs,0); + setLength(kvs,0); inherited destroy; end; @@ -92,7 +92,7 @@ begin i:=finde(nam); if i<0 then begin i:=length(kvs); - setlength(kvs,length(kvs)+1); + setLength(kvs,length(kvs)+1); kvs[i].name:=nam; end; kvs[i].value:=val; @@ -110,7 +110,7 @@ begin kvs[i].value:=kvs[i+1].value; inc(i); end; - setlength(kvs,length(kvs)-1); + setLength(kvs,length(kvs)-1); end; end; @@ -169,7 +169,7 @@ begin else if ex=1 then result:=copy(result,1,off)+','+copy(result,off+1,length(result)-off) else - result:=copy(result,1,off)+','+copy(result,off+1,length(result)-off)+' * 10^'+inttostr(ex-1); + result:=copy(result,1,off)+','+copy(result,off+1,length(result)-off)+' * 10^'+intToStr(ex-1); end; function signSqr(x: extended): extended; @@ -190,31 +190,31 @@ var tim: int64; begin tim:=floor(t*24*60*60); - result:=inttostr(tim mod 10)+'s'; + result:=intToStr(tim mod 10)+'s'; tim:=tim div 10; if tim=0 then exit; - result:=inttostr(tim mod 6)+result; + result:=intToStr(tim mod 6)+result; tim:=tim div 6; if tim=0 then exit; - result:=inttostr(tim mod 10)+'min '+result; + result:=intToStr(tim mod 10)+'min '+result; tim:=tim div 10; if tim=0 then exit; - result:=inttostr(tim mod 6)+result; + result:=intToStr(tim mod 6)+result; tim:=tim div 6; if tim=0 then exit; - result:=inttostr(tim mod 24)+'h '+result; + result:=intToStr(tim mod 24)+'h '+result; tim:=tim div 24; if tim=0 then exit; result:=' '+result; if (tim mod 7)<>1 then result:='e'+result; - result:=inttostr(tim mod 7)+'Tag'+result; + result:=intToStr(tim mod 7)+'Tag'+result; tim:=tim div 7; if tim=0 then exit; result:=' '+result; if tim<>1 then result:='n'+result; - result:=inttostr(tim)+'Woche'+result; + result:=intToStr(tim)+'Woche'+result; end; function cmpStr(s1,s2: string): longint; @@ -238,7 +238,7 @@ var i: longint; w,nw: word; begin - setlength(result,max(length(s1),length(s2))); + setLength(result,max(length(s1),length(s2))); w:=0; for i:=length(result) downto 1 do begin // result:= "s1+s2"; if i<=length(s1) then @@ -293,7 +293,7 @@ begin result:=result+char(ord('0')+floor(x)); end; if e<>0 then - result:=result+'E'+inttostr(e); + result:=result+'E'+intToStr(e); end; function myStrToFloat(s: string): extended; @@ -302,12 +302,12 @@ var neg: boolean; begin if pos('E',s)>0 then begin - e:=strtoint(rightStr(s,length(s)-pos('E',s))); + e:=strToInt(rightStr(s,length(s)-pos('E',s))); delete(s,pos('E',s),length(s)); end else e:=0; if pos('.',s)=0 then begin - result:=strtoint(s)*power(10,e); + result:=strToInt(s)*power(10,e); exit; end; neg:=leftStr(s,1)='-'; @@ -332,7 +332,7 @@ begin neg:=x<0; if neg then x:=-x; - result:=inttostr(x); + result:=intToStr(x); while length(result)+byte(neg)<stellen do result:='0'+result; if neg then @@ -361,7 +361,7 @@ var j: longint; c: char; begin - setlength(o,length(i)); + setLength(o,length(i)); for j:=0 to length(o)-1 do for c:='x' to 'y' do o[j,c]:=i[j,c]; @@ -371,7 +371,7 @@ procedure copyArray(i: tLongintArray; out o: tLongintArray); var j: longint; begin - setlength(o,length(i)); + setLength(o,length(i)); for j:=0 to length(o)-1 do o[j]:=i[j]; end; @@ -380,17 +380,17 @@ procedure copyArray(i: tExtendedArray; out o: tExtendedArray); var j: longint; begin - setlength(o,length(i)); + setLength(o,length(i)); for j:=0 to length(o)-1 do o[j]:=i[j]; end; -function Nullfunktion(x: extended): extended; +function nullFunktion(x: extended): extended; begin result:=0*x; end; -function exprtofloat(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): extended; +function exprToFloat(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): extended; var i,j,k,l,m: longint; inv,neg,cbv: boolean; @@ -402,8 +402,8 @@ begin s:=trimAll(s); for i:=0 to length(fkt1)-1 do - while fktpos(fkt1[i],s)>0 do begin - j:=fktpos(fkt1[i],s)+length(fkt1[i]); + while fktPos(fkt1[i],s)>0 do begin + j:=fktPos(fkt1[i],s)+length(fkt1[i]); while (j<=length(s)) and (s[j]<>'(') do inc(j); m:=j+1; // erstes Zeichen innerhalb der Klammern @@ -415,8 +415,8 @@ begin ')': dec(k); end; end; - k:=fktpos(fkt1[i],s); // erstes Zeichen des Funktionsnamens - val1:=exprtofloat(st,copy(s,m,j-m),kvs,cbgv); + k:=fktPos(fkt1[i],s); // erstes Zeichen des Funktionsnamens + val1:=exprToFloat(st,copy(s,m,j-m),kvs,cbgv); case i of 0: val1:=exp(val1); 1: val1:=sin(val1); @@ -433,8 +433,8 @@ begin end; for i:=0 to length(fkt2)-1 do - while fktpos(fkt2[i],s)>0 do begin - j:=fktpos(fkt2[i],s)+length(fkt2[i]); + while fktPos(fkt2[i],s)>0 do begin + j:=fktPos(fkt2[i],s)+length(fkt2[i]); while (j<=length(s)) and (s[j]<>'(') do inc(j); m:=j+1; // erstes Zeichen innerhalb der Klammern @@ -449,9 +449,9 @@ begin ')': dec(k); end; end; - k:=fktpos(fkt1[i],s); // erstes Zeichen des Funktionsnamens - val1:=exprtofloat(st,copy(s,m,l-m),kvs,cbgv); - val2:=exprtofloat(st,copy(s,l+1,j-l-1),kvs,cbgv); + k:=fktPos(fkt1[i],s); // erstes Zeichen des Funktionsnamens + val1:=exprToFloat(st,copy(s,m,l-m),kvs,cbgv); + val2:=exprToFloat(st,copy(s,l+1,j-l-1),kvs,cbgv); case i of 0: val1:=min(val1,val2); 1: val1:=max(val1,val2); @@ -470,7 +470,7 @@ begin end; end; s:=copy(s,1,pos('(',s)-1)+ - floattostr(exprtofloat(st,copy(s,pos('(',s)+1,i-pos('(',s)-1),kvs,cbgv))+ + floattostr(exprToFloat(st,copy(s,pos('(',s)+1,i-pos('(',s)-1),kvs,cbgv))+ copy(s,i+1,length(s)-i); end; @@ -495,8 +495,8 @@ begin i:=min(binOpPos('+',s),binOpPos('-',s)); if i=0 then i:=max(binOpPos('+',s),binOpPos('-',s)); if i=0 then i:=length(s)+1; - if inv then result:=result-exprtofloat(st,copy(s,1,i-1),kvs,cbgv) - else result:=result+exprtofloat(st,copy(s,1,i-1),kvs,cbgv); + if inv then result:=result-exprToFloat(st,copy(s,1,i-1),kvs,cbgv) + else result:=result+exprToFloat(st,copy(s,1,i-1),kvs,cbgv); inv:=s[i-byte(i>length(s))]='-'; delete(s,1,i); until s=''; @@ -509,8 +509,8 @@ begin i:=min(binOpPos('*',s),binOpPos('/',s)); if i=0 then i:=max(binOpPos('*',s),binOpPos('/',s)); if i=0 then i:=length(s)+1; - if inv then result:=result/exprtofloat(st,copy(s,1,i-1),kvs,cbgv) - else result:=result*exprtofloat(st,copy(s,1,i-1),kvs,cbgv); + if inv then result:=result/exprToFloat(st,copy(s,1,i-1),kvs,cbgv) + else result:=result*exprToFloat(st,copy(s,1,i-1),kvs,cbgv); inv:=s[i-byte(i>length(s))]='/'; delete(s,1,i); until s=''; @@ -518,8 +518,8 @@ begin end; if binOpPos('^',s)>0 then begin i:=binOpPos('^',s); - result:=power(exprtofloat(st,copy(s,1,i-1),kvs,cbgv), - exprtofloat(st,copy(s,i+1,length(s)-i),kvs,cbgv)); + result:=power(exprToFloat(st,copy(s,1,i-1),kvs,cbgv), + exprToFloat(st,copy(s,i+1,length(s)-i),kvs,cbgv)); exit end; neg:=startetMit('-',s); @@ -564,22 +564,22 @@ begin if pos(binOps[i],s)>0 then begin t:=erstesArgument(s,binOps[i]); case binOps[i] of - '≤','<=': result:=exprtofloat(st,t,kvs,cbgv)<=exprtofloat(st,s,kvs,cbgv); - '≥','>=': result:=exprtofloat(st,t,kvs,cbgv)>=exprtofloat(st,s,kvs,cbgv); + '≤','<=': result:=exprToFloat(st,t,kvs,cbgv)<=exprToFloat(st,s,kvs,cbgv); + '≥','>=': result:=exprToFloat(st,t,kvs,cbgv)>=exprToFloat(st,s,kvs,cbgv); '=': try - result:=exprtofloat(st,t,kvs,cbgv)=exprtofloat(st,s,kvs,cbgv); + result:=exprToFloat(st,t,kvs,cbgv)=exprToFloat(st,s,kvs,cbgv); except result:=t=s; end; '≠','<>': try - result:=exprtofloat(st,t,kvs,cbgv)<>exprtofloat(st,s,kvs,cbgv); + result:=exprToFloat(st,t,kvs,cbgv)<>exprToFloat(st,s,kvs,cbgv); except result:=t<>s; end; - '<': result:=exprtofloat(st,t,kvs,cbgv)<exprtofloat(st,s,kvs,cbgv); - '>': result:=exprtofloat(st,t,kvs,cbgv)>exprtofloat(st,s,kvs,cbgv); + '<': result:=exprToFloat(st,t,kvs,cbgv)<exprToFloat(st,s,kvs,cbgv); + '>': result:=exprToFloat(st,t,kvs,cbgv)>exprToFloat(st,s,kvs,cbgv); ' in ','∈': begin result:=false; while (s<>'') and not result do @@ -619,11 +619,11 @@ const begin i:=1; - setlength(operatoren,0); + setLength(operatoren,0); while i<=length(s) do begin for j:=0 to length(logOpsNamen)-1 do if copy(s,i,length(logOpsNamen[j]))=logOpsNamen[j] then begin - setlength(operatoren,length(operatoren)+1); + setLength(operatoren,length(operatoren)+1); operatoren[length(operatoren)-1,'x']:=j; operatoren[length(operatoren)-1,'y']:=i; i:=i+length(logOpsNamen[j]); @@ -632,8 +632,8 @@ begin inc(i); end; - setlength(ausdruecke,length(operatoren)+1); - setlength(klammernZahl,length(operatoren)+1); + setLength(ausdruecke,length(operatoren)+1); + setLength(klammernZahl,length(operatoren)+1); for i:=0 to length(ausdruecke)-1 do begin if i=0 then @@ -665,7 +665,7 @@ begin inc(ausdruecke[i,'x']); end; if (ausdruecke[i,'y']<ausdruecke[i,'x']) and ((i=length(operatoren)) or (operatoren[i,'x']<>0)) then // das linke Argument von "not" darf leer sein - fehler('Klammerfehler in '''+s+''' ('+inttostr(ausdruecke[i,'y'])+'<'+inttostr(ausdruecke[i,'x'])+')!'); + fehler('Klammerfehler in '''+s+''' ('+intToStr(ausdruecke[i,'y'])+'<'+intToStr(ausdruecke[i,'x'])+')!'); end; anz:=0; @@ -677,13 +677,13 @@ begin if anz<>0 then fehler('Klammern in '''+s+''' sind nicht ausgeglichen!'); - setlength(werte,length(ausdruecke)); + setLength(werte,length(ausdruecke)); for i:=0 to length(werte)-1 do if (i=length(werte)-1) or (operatoren[i,'x']<>0) then // kein linkes Argument von "not" werte[i]:=simpleExprToBool(st,copy(s,ausdruecke[i,'x'],ausdruecke[i,'y']-ausdruecke[i,'x']+1),kvs,cbgv) else werte[i]:=false; - setlength(ausdruecke,0); + setLength(ausdruecke,0); i:=length(werte)-2; while i>=0 do if ((klammernZahl[i]>0) or (i=0)) and (klammernZahl[i+1]<=0) then begin @@ -696,9 +696,9 @@ begin werte[j-1]:=werte[j]; klammernZahl[j-1]:=klammernZahl[j]; end; - setlength(operatoren,length(operatoren)-1); - setlength(werte,length(werte)-1); - setlength(klammernZahl,length(klammernZahl)-1); + setLength(operatoren,length(operatoren)-1); + setLength(werte,length(werte)-1); + setLength(klammernZahl,length(klammernZahl)-1); if i>length(werte)-2 then dec(i); end @@ -738,7 +738,7 @@ begin mitte:=i; t:=trim(copy(s,start,mitte-start)); try - wert:=exprtofloat(false,t,kvs,cbgv); + wert:=exprToFloat(false,t,kvs,cbgv); except ok:=false; inc(i); @@ -749,8 +749,8 @@ begin if pos('.',t)=0 then t:=t+'.0'; try - vk:=strtoint(erstesArgument(t,'.')); - nk:=strtoint(t); + vk:=strToInt(erstesArgument(t,'.')); + nk:=strToInt(t); except ok:=false; inc(i); |