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 | |
parent | 1d177b0eb1bcbea486318d5a68dc5f7c1b0e39df (diff) | |
download | units-2798b395bc067293d3a7d338a792224da17854e3.tar.xz |
homogenisiere Grosz-Klein-Schreibung
-rw-r--r-- | fftw.pas | 44 | ||||
-rw-r--r-- | fftw_l.pas | 40 | ||||
-rw-r--r-- | fftw_s.pas | 40 | ||||
-rw-r--r-- | fileunit.pas | 38 | ||||
-rw-r--r-- | gitupdateunit.pas | 6 | ||||
-rw-r--r-- | gmpextras.pas | 2 | ||||
-rw-r--r-- | irdecoderunit.pas | 56 | ||||
-rw-r--r-- | lesethreadunit.pas | 10 | ||||
-rw-r--r-- | lowlevelunit.pas | 203 | ||||
-rw-r--r-- | matheunit.pas | 118 | ||||
-rw-r--r-- | popunit.pas | 72 | ||||
-rw-r--r-- | protokollunit.pas | 32 | ||||
-rw-r--r-- | pseudohadamard.pas | 2 | ||||
-rw-r--r-- | refreshexecutableunit.pas | 24 | ||||
-rw-r--r-- | systemunit.pas | 48 |
15 files changed, 368 insertions, 367 deletions
@@ -41,7 +41,7 @@ type complex_double=record fftw_iodim=record n,ins,ous: integer; end; - Pfftw_iodim=^fftw_iodim; + pFft_iodim=^fftw_iodim; fftw_plan_double=type pointer; @@ -81,48 +81,48 @@ function fftw_plan_dft(rank:cardinal;n:Pcardinal;i,o:Pcomplex_double; external fftwlib name 'fftw_plan_dft'; {Real to complex transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Pdouble;o:Pcomplex_double; +function fftw_plan_dft_1d(n:cardinal;i:pDouble;o:Pcomplex_double; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_r2c_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Pdouble;o:Pcomplex_double; +function fftw_plan_dft_2d(nx,ny:cardinal;i:pDouble;o:Pcomplex_double; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_r2c_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pdouble;o:Pcomplex_double; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:pDouble;o:Pcomplex_double; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_r2c_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pdouble;o:Pcomplex_double; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:pDouble;o:Pcomplex_double; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_r2c'; function fftw_plan_many_dft_r2c(rank:cardinal;n:Pcardinal;howmany:cardinal; - i:Pdouble;inembed:Pcardinal;istride:cardinal; + i:pDouble;inembed:Pcardinal;istride:cardinal; idist:cardinal;o:Pcomplex_double;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_many_dft_r2c'; function fftw_plan_many_dft_c2r(rank:cardinal;n:Pcardinal;howmany:cardinal; i:Pcomplex_double;inembed:Pcardinal;istride:cardinal; - idist:cardinal;o:Pdouble;onembed:Pcardinal; + idist:cardinal;o:pDouble;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_many_dft_c2r'; {Complex to real transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_double;o:Pdouble; +function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_double;o:pDouble; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_c2r_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_double;o:Pdouble; +function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_double;o:pDouble; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_c2r_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_double;o:Pdouble; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_double;o:pDouble; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_c2r_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_double;o:Pdouble; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_double;o:pDouble; flags:fftw_flagset):fftw_plan_double; external fftwlib name 'fftw_plan_dft_c2r'; {Real to real transformations.} -function fftw_plan_guru_r2r(rank:cardinal;dims:Pfftw_iodim;howmany_rank:cardinal; +function fftw_plan_guru_r2r(rank:cardinal;dims:pFft_iodim;howmany_rank:cardinal; howmany_dims:pFftw_iodim;i,o:pDouble; kind:Pfftw_r2r_kind;flags:fftw_flagset): fftw_plan_double; external fftwlib name 'fftw_plan_guru_r2r'; @@ -140,7 +140,7 @@ function fftw_import_wisdom_from_filename(filename: pChar): cardinal; external fftwlib name 'fftw_import_wisdom_from_filename'; {$calling register} {Back to normal!} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); procedure fftw_freemem(p:pointer);inline; {*****************************************************************************} @@ -162,22 +162,22 @@ procedure fftw_freemem(p:pointer);inline; {$DEFINE align:=16} {$ENDIF} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); {$IFDEF align} var originalptr:pointer; begin { We allocate additional "align-1" bytes to be able to align. - And we allocate additional "SizeOf(Pointer)" to always have space to store + And we allocate additional "sizeOf(pointer)" to always have space to store the value of the original pointer. } - getmem(originalptr,size + align-1 + SizeOf(Pointer)); - ptruint(p):=(ptruint(originalptr) + SizeOf(Pointer)); - ptruint(p):=(ptruint(p)+align-1) and not (align-1); - PPointer(ptruint(p) - SizeOf(Pointer))^:=originalptr; + getMem(originalptr,size + align-1 + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(originalptr) + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(p)+align-1) and not (align-1); + pPointer(ptrUInt(p) - sizeOf(pointer))^:=originalptr; {$ELSE} begin - getmem(p,size); + getMem(p,size); {$ENDIF} end; @@ -185,9 +185,9 @@ procedure fftw_freemem(p:pointer);inline; begin {$IFDEF align} - freemem(PPointer(ptruint(p) - SizeOf(Pointer))^); + freeMem(pPointer(ptrUInt(p) - sizeOf(pointer))^); {$ELSE} - freemem(p); + freeMem(p); {$ENDIF} end; @@ -69,43 +69,43 @@ function fftw_plan_dft(rank:cardinal;n:Pcardinal;i,o:Pcomplex_extended; external fftwlib name 'fftwl_plan_dft'; {Real to complex transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Pextended;o:Pcomplex_extended; +function fftw_plan_dft_1d(n:cardinal;i:pExtended;o:Pcomplex_extended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_r2c_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Pextended;o:Pcomplex_extended; +function fftw_plan_dft_2d(nx,ny:cardinal;i:pExtended;o:Pcomplex_extended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_r2c_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pextended;o:Pcomplex_extended; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:pExtended;o:Pcomplex_extended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_r2c_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pextended;o:Pcomplex_extended; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:pExtended;o:Pcomplex_extended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_r2c'; function fftw_plan_many_dft_r2c(rank:cardinal;n:Pcardinal;howmany:cardinal; - i:Pextended;inembed:Pcardinal;istride:cardinal; + i:pExtended;inembed:Pcardinal;istride:cardinal; idist:cardinal;o:Pcomplex_extended;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_many_dft_r2c'; function fftw_plan_many_dft_c2r(rank:cardinal;n:Pcardinal;howmany:cardinal; i:Pcomplex_extended;inembed:Pcardinal;istride:cardinal; - idist:cardinal;o:Pextended;onembed:Pcardinal; + idist:cardinal;o:pExtended;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_many_dft_c2r'; {Complex to real transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_extended;o:Pextended; +function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_extended;o:pExtended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_c2r_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_extended;o:Pextended; +function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_extended;o:pExtended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_c2r_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_extended;o:Pextended; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_extended;o:pExtended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_c2r_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_extended;o:Pextended; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_extended;o:pExtended; flags:fftw_flagset):fftw_plan_extended; external fftwlib name 'fftwl_plan_dft_c2r'; @@ -116,7 +116,7 @@ procedure fftw_execute(plan:fftw_plan_extended); external fftwlib name 'fftwl_execute'; {$calling register} {Back to normal!} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); procedure fftw_freemem(p:pointer);inline; {*****************************************************************************} @@ -138,22 +138,22 @@ procedure fftw_freemem(p:pointer);inline; {$DEFINE align:=16} {$ENDIF} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); {$IFDEF align} var originalptr:pointer; begin { We allocate additional "align-1" bytes to be able to align. - And we allocate additional "SizeOf(Pointer)" to always have space to store + And we allocate additional "sizeOf(pointer)" to always have space to store the value of the original pointer. } - getmem(originalptr,size + align-1 + SizeOf(Pointer)); - ptruint(p):=(ptruint(originalptr) + SizeOf(Pointer)); - ptruint(p):=(ptruint(p)+align-1) and not (align-1); - PPointer(ptruint(p) - SizeOf(Pointer))^:=originalptr; + freeMem(originalptr,size + align-1 + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(originalptr) + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(p)+align-1) and not (align-1); + pPointer(ptrUInt(p) - sizeOf(pointer))^:=originalptr; {$ELSE} begin - getmem(p,size); + freeMem(p,size); {$ENDIF} end; @@ -161,9 +161,9 @@ procedure fftw_freemem(p:pointer);inline; begin {$IFDEF align} - freemem(PPointer(ptruint(p) - SizeOf(Pointer))^); + freeMem(pPointer(ptrUInt(p) - sizeOf(pointer))^); {$ELSE} - freemem(p); + freeMem(p); {$ENDIF} end; @@ -69,43 +69,43 @@ function fftw_plan_dft(rank:cardinal;n:Pcardinal;i,o:Pcomplex_single; external fftwlib name 'fftwf_plan_dft'; {Real to complex transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Psingle;o:Pcomplex_single; +function fftw_plan_dft_1d(n:cardinal;i:pSingle;o:Pcomplex_single; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_r2c_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Psingle;o:Pcomplex_single; +function fftw_plan_dft_2d(nx,ny:cardinal;i:pSingle;o:Pcomplex_single; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_r2c_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Psingle;o:Pcomplex_single; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:pSingle;o:Pcomplex_single; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_r2c_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Psingle;o:Pcomplex_single; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:pSingle;o:Pcomplex_single; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_r2c'; function fftw_plan_many_dft_r2c(rank:cardinal;n:Pcardinal;howmany:cardinal; - i:Psingle;inembed:Pcardinal;istride:cardinal; + i:pSingle;inembed:Pcardinal;istride:cardinal; idist:cardinal;o:Pcomplex_single;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_many_dft_r2c'; function fftw_plan_many_dft_c2r(rank:cardinal;n:Pcardinal;howmany:cardinal; i:Pcomplex_single;inembed:Pcardinal;istride:cardinal; - idist:cardinal;o:Psingle;onembed:Pcardinal; + idist:cardinal;o:pSingle;onembed:Pcardinal; ostride:cardinal;odist:cardinal; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_many_dft_c2r'; {Complex to real transformations.} -function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_single;o:Psingle; +function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_single;o:pSingle; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_c2r_1d'; -function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_single;o:Psingle; +function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_single;o:pSingle; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_c2r_2d'; -function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_single;o:Psingle; +function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_single;o:pSingle; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_c2r_3d'; -function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_single;o:Psingle; +function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_single;o:pSingle; flags:fftw_flagset):fftw_plan_single; external fftwlib name 'fftwf_plan_dft_c2r'; @@ -116,7 +116,7 @@ procedure fftw_execute(plan:fftw_plan_single); external fftwlib name 'fftwf_execute'; {$calling register} {Back to normal!} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); procedure fftw_freemem(p:pointer);inline; {*****************************************************************************} @@ -138,22 +138,22 @@ procedure fftw_freemem(p:pointer);inline; {$DEFINE align:=16} {$ENDIF} -procedure fftw_getmem(var p:pointer;size:sizeint); +procedure fftw_getmem(var p:pointer;size:sizeInt); {$IFDEF align} var originalptr:pointer; begin { We allocate additional "align-1" bytes to be able to align. - And we allocate additional "SizeOf(Pointer)" to always have space to store + And we allocate additional "sizeOf(pointer)" to always have space to store the value of the original pointer. } - getmem(originalptr,size + align-1 + SizeOf(Pointer)); - ptruint(p):=(ptruint(originalptr) + SizeOf(Pointer)); - ptruint(p):=(ptruint(p)+align-1) and not (align-1); - PPointer(ptruint(p) - SizeOf(Pointer))^:=originalptr; + getMem(originalptr,size + align-1 + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(originalptr) + sizeOf(pointer)); + ptrUInt(p):=(ptrUInt(p)+align-1) and not (align-1); + pPointer(ptrUInt(p) - sizeOf(pointer))^:=originalptr; {$ELSE} begin - getmem(p,size); + getMem(p,size); {$ENDIF} end; @@ -161,9 +161,9 @@ procedure fftw_freemem(p:pointer);inline; begin {$IFDEF align} - freemem(PPointer(ptruint(p) - SizeOf(Pointer))^); + freeMem(pPointer(ptrUInt(p) - sizeOf(pointer))^); {$ELSE} - freemem(p); + freeMem(p); {$ENDIF} end; diff --git a/fileunit.pas b/fileunit.pas index 259e4ff..f949c62 100644 --- a/fileunit.pas +++ b/fileunit.pas @@ -51,14 +51,14 @@ var f: file; n: string; begin - if fileexists(name) then + if fileExists(name) then n:=mkTemp(name+'.XXXXXX') else n:=name; - assignfile(f,n); + assignFile(f,n); rewrite(f,1); - blockwrite(f,pt^,len); - closefile(f); + blockWrite(f,pt^,len); + closeFile(f); if name<>n then begin deleteFile(name); rename(f,name); @@ -95,30 +95,30 @@ var it: tInputThread; datNam: string; begin - if fileexists(name) then + if fileExists(name) then datNam:=mkTemp(name+'.XXXXXX') else datNam:=name; pr.options:=pr.options + [poUsePipes]; pr.execute; - setlength(buf,minBufLen); - fillchar(buf[0],length(buf)*sizeof(buf[0]),$0); + setLength(buf,minBufLen); + fillchar(buf[0],length(buf)*sizeOf(buf[0]),$0); it:=tInputThread.create(pr,pt,len); - assignfile(f,datNam); + assignFile(f,datNam); rewrite(f,1); while pr.running or (not it.fertig) or (pr.output.numBytesAvailable>0) do begin rb:=min(length(buf),pr.output.numBytesAvailable); if rb>0 then begin rb:=pr.output.read(buf[0],rb); - blockwrite(f,buf[0],rb); + blockWrite(f,buf[0],rb); end else sleep(1); // nix zu Schreiben, nix zu Lesen, also warten wir end; pr.free; it.free; - closefile(f); + closeFile(f); if name<>datNam then begin deleteFile(name); rename(f,name); @@ -141,9 +141,9 @@ var begin assign(f,name); reset(f,1); - len:=filesize(f); - getmem(pt,len); - blockread(f,pt^,len); + len:=fileSize(f); + getMem(pt,len); + blockRead(f,pt^,len); close(f); end; @@ -175,7 +175,7 @@ var pLen,rb,br: longint; begin pLen:=minBufLen; - getmem(pTmp,pLen); + getMem(pTmp,pLen); br:=0; pr.options:=pr.options + [poUsePipes]; pr.execute; @@ -186,9 +186,9 @@ begin pt:=pTmp; len:=pLen; pLen:=br+rb+minBufLen; - getmem(pTmp,pLen); + getMem(pTmp,pLen); move(pt^,pTmp^,len); - freemem(pt); + freeMem(pt); end; rb:=pr.output.read((pTmp+br)^,rb); br:=br+rb; @@ -196,9 +196,9 @@ begin else sleep(1); end; len:=br; - getmem(pt,len); + getMem(pt,len); move(pTmp^,pt^,len); - freemem(pTmp); + freeMem(pTmp); pr.free; end; @@ -233,7 +233,7 @@ begin else wb:=wb+cwb; end; - proc.CloseInput; + proc.closeInput; fertig:=true; end; diff --git a/gitupdateunit.pas b/gitupdateunit.pas index 69346db..842ba77 100644 --- a/gitupdateunit.pas +++ b/gitupdateunit.pas @@ -21,13 +21,13 @@ var initialization updated:=false; - setlength(gitDirs,2); + setLength(gitDirs,2); gitDirs[0]:=extractFilePath(paramstr(0)); gitDirs[1]:=extractFilePath(leftStr(gitDirs[0],length(gitDirs[0])-1))+'units/'; output:=''; for i:=0 to length(gitDirs)-1 do begin - setlength(args,2); + setLength(args,2); args[0]:='pull'; args[1]:='--all'; if not runCommandInDir(gitDirs[i],'git',args,output) then continue; @@ -38,6 +38,6 @@ initialization end; if updated then refreshExecutable(gitDirs); - setlength(args,0); + setLength(args,0); end. diff --git a/gmpextras.pas b/gmpextras.pas index 4565682..ebb7d17 100644 --- a/gmpextras.pas +++ b/gmpextras.pas @@ -29,7 +29,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 mpfMyRoot(rad: mpf_t; wzlExp: int64): extended; diff --git a/irdecoderunit.pas b/irdecoderunit.pas index fa00f69..4063085 100644 --- a/irdecoderunit.pas +++ b/irdecoderunit.pas @@ -27,7 +27,7 @@ type letzterBefehl, zustand: longword; _watte,_debug: boolean; - debugDatei: textfile; + debugDatei: textFile; procedure init; procedure tastenDruckAnhaengen(lw: longword); procedure befehlAusfuehren(cmd,params: string); @@ -78,10 +78,10 @@ var begin inherited create; if (length(zeichenTabelle)=0) or (length(befehlsTabelle)=0) then begin - setlength(zeichenTabelle,0); + setLength(zeichenTabelle,0); for i:=0 to length(befehlsTabelle)-1 do befehlsTabelle[i].free; - setlength(befehlsTabelle,0); + setLength(befehlsTabelle,0); befehleKonfLesen(konfigName); end; @@ -90,14 +90,14 @@ begin if _debug then begin tmpDir:=trim(mkTemp('-d /tmp/fernbedienung.XXXXXX')); - assignFile(debugDatei,tmpdir+'/debug'); + assignFile(debugDatei,tmpDir+'/debug'); rewrite(debugDatei); - closefile(debugDatei); - ttySLeser:=tLeseProzess.create(inputName,tmpdir+'/kopie',1) + closeFile(debugDatei); + ttySLeser:=tLeseProzess.create(inputName,tmpDir+'/kopie',1) end else ttySLeser:=tLeseProzess.create(inputName,1); - fillchar(eingabePuffer,sizeof(eingabePuffer),#0); + fillchar(eingabePuffer,sizeOf(eingabePuffer),#0); init; end; @@ -115,7 +115,7 @@ begin letzterEmpf:=false; ersterEmpf:=false; zustand:=0; - setlength(eingabePuffer,0); + setLength(eingabePuffer,0); eingabeLaenge:=0; end; @@ -125,7 +125,7 @@ var begin if _debug then begin append(debugDatei); - writeln(debugDatei,inttohex(lw,4)); + writeln(debugDatei,intToHex(lw,4)); closeFile(debugDatei); end; @@ -134,7 +134,7 @@ begin if _debug then begin append(debugDatei); - writeln(debugDatei,'-> '+inttohex(lw,4),' ',byte(empf),' ',byte(letzterEmpf),' ',inttohex(letztesZeichen[empf],4),' ',byte(ersterEmpf)); + writeln(debugDatei,'-> '+intToHex(lw,4),' ',byte(empf),' ',byte(letzterEmpf),' ',intToHex(letztesZeichen[empf],4),' ',byte(ersterEmpf)); closeFile(debugDatei); end; @@ -143,7 +143,7 @@ begin if empf=ersterEmpf then begin if eingabeLaenge>=length(eingabePuffer) then - setlength(eingabePuffer,eingabeLaenge+1024); + setLength(eingabePuffer,eingabeLaenge+1024); eingabePuffer[eingabeLaenge]:=(findeZeichen(lw and not $08) shl 1) or byte((lw and $08) <> 0); if ((not eingabePuffer[eingabeLaenge]) and (not 1)) <> 0 then inc(eingabeLaenge); @@ -201,7 +201,7 @@ begin raise exception.create('Sanity-Check nicht bestanden: mi<>ma nach Bisektion!'); result:=mi; if zeichenTabelle[result]<>lw then begin - writeln(stderr,'Kann Tastencode '''+inttohex(lw,4)+''' nicht finden, ignoriere Taste!'); + writeln(stderr,'Kann Tastencode '''+intToHex(lw,4)+''' nicht finden, ignoriere Taste!'); result:=not 0; end; end; @@ -230,7 +230,7 @@ begin raise exception.create('Sanity-Check nicht bestanden: mi<>ma nach Bisektion!'); result:=mi; if (befehlsTabelle[result].nummer<>lw) or (befehlsTabelle[result].altZustand>zustand) then - raise exception.create('Kann Befehl Nummer '''+inttohex(lw,4)+''' im Zustand '+inttostr(zustand)+' nicht finden!'); + raise exception.create('Kann Befehl Nummer '''+intToHex(lw,4)+''' im Zustand '+intToStr(zustand)+' nicht finden!'); end; procedure tIRDecoder.befehlVlltEntprellen(num: longint); @@ -368,11 +368,11 @@ end; constructor tBefehl.create; begin inherited create; - fillchar(cmd,sizeof(cmd),#0); + fillchar(cmd,sizeOf(cmd),#0); cmd:=''; - fillchar(params,sizeof(params),#0); + fillchar(params,sizeOf(params),#0); params:=''; - fillchar(neutralParams,sizeof(neutralParams),#0); + fillchar(neutralParams,sizeOf(neutralParams),#0); neutralParams:=''; end; @@ -397,19 +397,19 @@ begin if not konfigDatei.unfoldMacros then raise exception.create('Fehler beim Entfalten der Makros in '''+konfigName+'''!'); while konfigDatei.readln(zeile) do begin // Iteration über die Zeichen - setlength(zeichenTabelle,length(zeichenTabelle)+1); + setLength(zeichenTabelle,length(zeichenTabelle)+1); if copy(zeile,length(zeile),1)<>':' then raise exception.create('Die erste Zeile einer Befehlsdefinition muss mit einem : enden, '''+zeile+''' tut das nicht!'); delete(zeile,length(zeile),1); taste:=trim(zeile); - zeichenTabelle[length(zeichenTabelle)-1]:=strtoint(taste); + zeichenTabelle[length(zeichenTabelle)-1]:=strToInt(taste); cStat:=0; repeat // Iteration über die Befehle pro Zeichen if not konfigDatei.readln(zeile) then raise exception.create('Unerwartetes Dateiende in '''+konfigName+''' (Taste '+taste+')!'); if zeile='Ende' then break; if startetMit('Befehl:',zeile) then begin - setlength(befehlsTabelle,length(befehlsTabelle)+1); + setLength(befehlsTabelle,length(befehlsTabelle)+1); befehlsTabelle[length(befehlsTabelle)-1]:=tBefehl.create; befehlsTabelle[length(befehlsTabelle)-1].nummer:=length(zeichenTabelle)-1; befehlsTabelle[length(befehlsTabelle)-1].neutralParams:=''; @@ -428,11 +428,11 @@ begin continue; end; if startetMit('altZustand:',zeile) then begin - befehlsTabelle[length(befehlsTabelle)-1].altZustand:=strtoint(zeile); + befehlsTabelle[length(befehlsTabelle)-1].altZustand:=strToInt(zeile); continue; end; if startetMit('neuZustand:',zeile) then begin - befehlsTabelle[length(befehlsTabelle)-1].neuZustand:=strtoint(zeile); + befehlsTabelle[length(befehlsTabelle)-1].neuZustand:=strToInt(zeile); continue; end; if startetMit('einzelKlick:',zeile) then begin @@ -546,7 +546,7 @@ begin inc(li); dec(re); end; - fillchar(tmp,sizeof(tBefehl),#0); + fillchar(tmp,sizeOf(tBefehl),#0); if li<>re+1 then raise exception.create('Sanity-Check nicht bestanden: li<>re+1 kann beim Quicksort nicht sein!'); if re=bis then @@ -609,14 +609,14 @@ end; var i: longint; initialization - fillchar(befehlsTabelle,sizeof(befehlsTabelle),#0); - setlength(befehlsTabelle,0); - fillchar(zeichenTabelle,sizeof(zeichenTabelle),#0); - setlength(zeichenTabelle,0); + fillchar(befehlsTabelle,sizeOf(befehlsTabelle),#0); + setLength(befehlsTabelle,0); + fillchar(zeichenTabelle,sizeOf(zeichenTabelle),#0); + setLength(zeichenTabelle,0); finalization for i:=0 to length(befehlsTabelle)-1 do befehlsTabelle[i].free; - setlength(befehlsTabelle,0); - setlength(zeichenTabelle,0); + setLength(befehlsTabelle,0); + setLength(zeichenTabelle,0); end. diff --git a/lesethreadunit.pas b/lesethreadunit.pas index 1f78201..1d7f4d8 100644 --- a/lesethreadunit.pas +++ b/lesethreadunit.pas @@ -73,24 +73,24 @@ procedure tLeseProzess.fuelleVorrat; var s: string; len,i: longint; - f: textfile; + f: textFile; const maxLen = 1024*1024; begin while (_anzahl<sollVorrat) and (prozess.output.numBytesAvailable>0) do begin - setlength(s,min(maxLen,prozess.output.numBytesAvailable)); + setLength(s,min(maxLen,prozess.output.numBytesAvailable)); len:=prozess.output.read(s[1],length(s)); for i:=1 to len do _anzahl:=_anzahl+byte(s[i]=#10); puffer:=puffer+copy(s,1,len); if _kopie<>'' then begin - assignfile(f,_kopie); - if not fileexists(_kopie) then + assignFile(f,_kopie); + if not fileExists(_kopie) then rewrite(f) else append(f); write(f,copy(s,1,len)); - closefile(f); + closeFile(f); end; end; end; diff --git a/lowlevelunit.pas b/lowlevelunit.pas index a9fdb1e..1198fdd 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -8,7 +8,7 @@ uses math, Classes, SysUtils, RegExpr, process, FPimage, Graphics; type - generic tArray<T> = array of T; + generic tArray<t> = array of t; tInt64Array = specialize tArray<int64>; tLongintArray = specialize tArray<longint>; pTLongintArray = ^tLongintArray; @@ -34,10 +34,11 @@ type rgbGreen: byte; rgbRed : byte; end; - tRgbArray = specialize tArray<tRGB>; + tRGBArray = specialize tArray<tRGB>; tKodierung = (kUnbekannt,k32BitSignedInteger); tWarnstufe = (wsStreng,wsLasch); tGenauigkeit = (gSingle,gDouble,gExtended); + tKantenFilterTyp = (kfTiefpass,kfHochpass); operator = (x1,x2: t2x2Extended): boolean; operator = (x1,x2: tInt64Point): boolean; @@ -56,7 +57,7 @@ function myIntToStr(i,dg: longint; fill: string): string; overload; function max(g1,g2: tGenauigkeit): tGenauigkeit; inline; overload; function wertGroesze(g: tGenauigkeit): longint; -function floattostrtrunc(f: extended; dig: longint; laessig: boolean): string; +function floatToStrTrunc(f: extended; dig: longint; laessig: boolean): string; function binOpPos(op: char; s: string): integer; function fktPos(fkt,s: string): integer; procedure gibAus(s: string; ausgaben: byte); @@ -73,16 +74,16 @@ function rgb(r,g,b: byte): tRGB; inline; function strToTRGB(s: string; out rgb: tRGB): boolean; procedure myDebugLnThreadLog(s: string); procedure cleanupLogs; -procedure cleanupLog(tid: PtrUInt); +procedure cleanupLog(tid: ptrUInt); procedure raiseAndDumpExceptionCallStack(msg: string); -procedure dumpExceptionCallStack(E: Exception); +procedure dumpExceptionCallStack(e: exception); function startetMit(start: string; var s: string): boolean; function endetMit(ende: string; var s: string): boolean; function trimAll(s: string): string; -function erstesArgument(var s: string; Trenner: string = ' '; trimmen: boolean = true): string; inline; +function erstesArgument(var s: string; trenner: string = ' '; trimmen: boolean = true): string; inline; function umbrechen(s,trenner: string; klammernBeachten: boolean = false; zeilenanfang: string = ''): string; inline; function unEscape(s: string): string; -function mydatetimetostr(t: tDateTime): string; +function myDateTimeToStr(t: tDateTime): string; function t2x2ExtendedToStr(p: t2x2Extended): string; function t2x2LongintToStr(p: t2x2Longint): string; function tExtPointToStr(p: tExtPoint): string; @@ -104,7 +105,7 @@ function mirrorBits(lw: longword): longword; overload; function mirrorBits(w: word): word; overload; function mirrorBits(b: byte): byte; overload; -function zusammenfassen(s1,s2: string): string; +function zusammenFassen(s1,s2: string): string; function intervallAusrollen(s: string): string; function myUtf8Encode(s: string): string; function permutation(len: longint): tLongintArray; overload; @@ -180,31 +181,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; @@ -228,7 +229,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 @@ -256,7 +257,7 @@ end; function myFloatToStr(x: extended): string; begin - result:=myFloatToStr(x,'E'); + result:=myFloatToStr(x,'e'); end; function myFloatToStr(x: extended; ex: string): string; @@ -288,7 +289,7 @@ begin result:=result+char(ord('0')+floor(x)); end; if e<>0 then - result:=result+ex+inttostr(e); + result:=result+ex+intToStr(e); end; function myStrToFloat(s: string): extended; @@ -296,13 +297,13 @@ var i,e: longint; neg: boolean; begin - if pos('E',s)>0 then begin - e:=strtoint(rightStr(s,length(s)-pos('E',s))); - delete(s,pos('E',s),length(s)); + if pos('e',s)>0 then begin + 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)='-'; @@ -327,7 +328,7 @@ end; function myIntToStr(i,dg: longint; fill: string): string; begin - result:=inttostr(i); + result:=intToStr(i); while length(result)<dg do result:=fill+result; end; @@ -341,9 +342,9 @@ end; function wertGroesze(g: tGenauigkeit): longint; begin case g of - gSingle: result:=sizeof(single); - gDouble: result:=sizeof(double); - gExtended: result:=sizeof(extended); + gSingle: result:=sizeOf(single); + gDouble: result:=sizeOf(double); + gExtended: result:=sizeOf(extended); else fehler('Unbekannter Genauigkeitstyp!'); end; @@ -351,9 +352,9 @@ end; // allgemeine Funktionen ******************************************************* -function floattostrtrunc(f: extended; dig: longint; laessig: boolean): string; +function floatToStrTrunc(f: extended; dig: longint; laessig: boolean): string; begin - result:=inttostr(round(f*power(10,dig))); + result:=intToStr(round(f*power(10,dig))); result:=copy(result,1,length(result)-dig)+'.'+copy(result,length(result)-dig+1,dig); if laessig then while result[length(result)]='0' do @@ -362,30 +363,30 @@ begin delete(result,length(result),1); end; -function ZeitDarstellen(t: extended): string; +function zeitDarstellen(t: extended): string; var schreibe: boolean; begin result:='('; schreibe:=t>=1; if schreibe then begin - result:=result+inttostr(floor(t))+' Tage '; + result:=result+intToStr(floor(t))+' Tage '; t:=t-floor(t); end; t:=t*24; schreibe:=schreibe or (t>=1); if schreibe then begin - result:=inttostr(floor(t))+':'; + result:=intToStr(floor(t))+':'; t:=t-floor(t); end; t:=t*60; schreibe:=schreibe or (t>=1); if schreibe then begin - result:=inttostr(floor(t))+':'; + result:=intToStr(floor(t))+':'; t:=t-floor(t); end; t:=t*60; - result:=result+inttostr(round(t))+' s)'; + result:=result+intToStr(round(t))+' s)'; end; function binOpPos(op: char; s: string): integer; @@ -393,7 +394,7 @@ begin result:=0; repeat result:=result+max(1,pos(op,copy(s,result+1,length(s)-result))); - until ((result>1) and not (s[result-1] in ['+','-','*','/','(','E','e','^'])) or (result>length(s)) or (s[result]<>op); + until ((result>1) and not (s[result-1] in ['+','-','*','/','(','e','E','^'])) or (result>length(s)) or (s[result]<>op); if (result>length(s)) or (s[result]<>op) then result:=0; end; @@ -534,45 +535,45 @@ end; procedure myDebugLnThreadLog(s: string); var - f: textfile; - id: PtrUInt; + f: textFile; + id: ptrUInt; begin id:=getThreadID; - assignfile(f,'Log'+inttostr(id)); + assignFile(f,'Log'+intToStr(id)); try - if fileexists('Log'+inttostr(id)) then append(f) + if fileExists('Log'+intToStr(id)) then append(f) else rewrite(f); except exit; end; - writeln(f,inttostr(id)+': '+s); - closefile(f); + writeln(f,intToStr(id)+': '+s); + closeFile(f); end; procedure cleanupLogs; var - sr: tSearchRec; + sR: tSearchRec; err: longint; begin - err:=findfirst('Log*',$3f,sr); + err:=findFirst('Log*',$3f,sR); while err=0 do begin - deletefile(sr.name); - err:=findnext(sr); + deleteFile(sR.name); + err:=findnext(sR); end; - findclose(sr); + findclose(sR); end; -procedure cleanupLog(tid: PtrUInt); +procedure cleanupLog(tid: ptrUInt); var s: string; - Zeit: extended; + zeit: extended; begin - s:='Log'+inttostr(tid); - Zeit:=now+1/24/60/60; - while (not fileexists(s)) and (Zeit>now) do + s:='Log'+intToStr(tid); + zeit:=now+1/24/60/60; + while (not fileExists(s)) and (zeit>now) do sleep(100); - if fileexists(s) then - deletefile(s) + if fileExists(s) then + deleteFile(s) else fehler('Datei '''+s+''' kann nicht gelöscht werden, da sie nicht existiert!'); end; @@ -588,21 +589,21 @@ end; procedure dumpExceptionCallStack(e: exception); var - I: integer; - Frames: pPointer; - Report: string; -begin - Report := 'Program exception! ' + LineEnding + - 'Stacktrace:' + LineEnding + LineEnding; - if E <> nil then begin - Report := Report + 'Exception class: ' + E.ClassName + LineEnding + - 'Message: ' + E.Message + LineEnding; + i: integer; + frames: pPointer; + report: string; +begin + report := 'Program exception! ' + lineEnding + + 'Stacktrace:' + lineEnding + lineEnding; + if e <> nil then begin + report := report + 'Exception class: ' + e.className + lineEnding + + 'Message: ' + e.message + lineEnding; end; - Report := Report + BackTraceStrFunc(ExceptAddr); - Frames := ExceptFrames; - for I := 0 to ExceptFrameCount - 1 do - Report := Report + LineEnding + BackTraceStrFunc(Frames[I]); - gibAus(Report,3); + report := report + backTraceStrFunc(exceptAddr); + frames := exceptFrames; + for i := 0 to exceptFrameCount - 1 do + report := report + lineEnding + backTraceStrFunc(frames[i]); + gibAus(report,3); end; function startetMit(start: string; var s: string): boolean; @@ -626,10 +627,10 @@ begin delete(result,pos(' ',result),1); end; -function erstesArgument(var s: string; Trenner: string; trimmen: boolean): string; +function erstesArgument(var s: string; trenner: string; trimmen: boolean): string; begin - result:=copy(s,1,pos(Trenner,s+Trenner)-1); - delete(s,1,length(result)+length(Trenner)); + result:=copy(s,1,pos(trenner,s+trenner)-1); + delete(s,1,length(result)+length(trenner)); if not trimmen then exit; s:=trim(s); result:=trim(result); @@ -682,7 +683,7 @@ begin fehler(''''+s+''' endet auf einen aktiven Deaktivierer!'); end; -function mydatetimetostr(t: tDateTime): string; +function myDateTimeToStr(t: tDateTime): string; begin result:=formatDateTime('YYYY.MM.DD_hh.mm.ss',t); end; @@ -697,8 +698,8 @@ end; function t2x2LongintToStr(p: t2x2Longint): string; begin result:= - inttostr(p['x','x'])+' .. '+inttostr(p['x','y'])+' x '+ - inttostr(p['y','x'])+' .. '+inttostr(p['y','y']); + intToStr(p['x','x'])+' .. '+intToStr(p['x','y'])+' x '+ + intToStr(p['y','x'])+' .. '+intToStr(p['y','y']); end; function tExtPointToStr(p: tExtPoint): string; @@ -708,7 +709,7 @@ end; function tIntPointToStr(p: tIntPoint): string; begin - result:=inttostr(p['x'])+';'+inttostr(p['y']); + result:=intToStr(p['x'])+';'+intToStr(p['y']); end; procedure fehler(s: string); @@ -751,7 +752,7 @@ var begin result:=''; for i:=cnt-1 downto 0 do - result:=result+inttohex((pByte(p)+i)^,2); + result:=result+intToHex((pByte(p)+i)^,2); end; function base64ToBin(var s: string): boolean; @@ -800,7 +801,7 @@ end; function base64Encode(i: longword): string; begin - result:=base64Encode(i,(8*sizeof(i)+7) div 6); + result:=base64Encode(i,(8*sizeOf(i)+7) div 6); end; function base64Encode(i,siz: longword): string; @@ -848,13 +849,13 @@ begin (byte(odd(b)) shl 7); end; -function zusammenfassen(s1,s2: string): string; +function zusammenFassen(s1,s2: string): string; var i: longint; begin if istGanzZahl(s1) and istGanzZahl(s2) then begin - i:=strtoint(s1)+strtoint(s2); - result:=inttostr(i); + i:=strToInt(s1)+strToInt(s2); + result:=intToStr(i); if (startetMit('+',s1) or startetMit('+',s2)) and (i>=0) then result:='+'+result; end @@ -866,10 +867,10 @@ function intervallAusrollen(s: string): string; var i: longint; begin - i:=strtoint(erstesArgument(s,'..')); + i:=strToInt(erstesArgument(s,'..')); result:=''; - while i<=strtoint(s) do begin - result:=result+' '+myinttostr(i,length(s),'0'); + while i<=strToInt(s) do begin + result:=result+' '+myIntToStr(i,length(s),'0'); inc(i); end; result:=trim(result); @@ -897,12 +898,12 @@ const begin rest:=len; ilen:=len; - setlength(basen,0); + setLength(basen,0); repeat for i:=maxBasis downto 2 do while ((rest mod i) = 0) and (rest>maxBasis) do begin - setlength(basen,length(basen)+1); + setLength(basen,length(basen)+1); basen[length(basen)-1]:=i; rest:=rest div i; end; @@ -930,7 +931,7 @@ begin result[i]:=result[i+off]; inc(i); end; - setlength(result,len); + setLength(result,len); end; end; @@ -942,14 +943,14 @@ var aWerte: boolean; begin for aWerte:=false to true do - setlength(werte[aWerte],len); + setLength(werte[aWerte],len); aWerte:=false; for block:=0 to (len div rest)-1 do // Initialisierung der $\prod_i basis[i]$ Blöcke zu je $rest$ permutierten Zahlen llPermutation(rest,block*rest,werte[aWerte]); - setlength(mergePerm,maxBasis); + setLength(mergePerm,maxBasis); for i:=0 to length(basen)-1 do begin for block:=0 to (len div (rest*basen[i]))-1 do begin @@ -965,14 +966,14 @@ begin rest:=rest*basen[i]; end; - setlength(mergePerm,0); + setLength(mergePerm,0); - setlength(result,length(werte[aWerte])); + setLength(result,length(werte[aWerte])); if length(result)>0 then - move(werte[aWerte][0],result[0],length(result)*sizeof(result[0])); + move(werte[aWerte][0],result[0],length(result)*sizeOf(result[0])); for aWerte:=false to true do - setlength(werte[aWerte],0); + setLength(werte[aWerte],0); end; procedure llPermutation(len,offset: longint; var ar: tLongintArray); @@ -992,7 +993,7 @@ begin end; for i:=0 to len-1 do if ar[i+offset]=-1 then - fehler('permutation: '+inttostr(i)+' wurde nicht verteilt!'); + fehler('permutation: '+intToStr(i)+' wurde nicht verteilt!'); end; procedure fuegeSortiertHinzu(x: extended; var xa: tExtendedArray); @@ -1011,8 +1012,8 @@ begin exit; end; if mi<>ma+1 then - fehler('Bisektion fehlgeschlagen! ('+inttostr(mi)+' = mi <> ma+1 = '+inttostr(ma+1)+')'); - setlength(xa,length(xa)+1); + fehler('Bisektion fehlgeschlagen! ('+intToStr(mi)+' = mi <> ma+1 = '+intToStr(ma+1)+')'); + setLength(xa,length(xa)+1); for i:=length(xa)-1 downto mi+1 do xa[i]:=xa[i-1]; xa[mi]:=x; @@ -1028,26 +1029,26 @@ begin s:=''; while (pos(#10,s)=0) and (rLen+fPos<fSize) do begin rLen:=min(rLen+1024,fSize-fPos); - setlength(s,rLen); - blockread(f,s[1],rLen); + setLength(s,rLen); + blockRead(f,s[1],rLen); seek(f,fPos); end; if pos(#10,s)<>0 then begin rLen:=pos(#10,s); - setlength(s,rLen-1); + setLength(s,rLen-1); end; seek(f,fPos+rLen); end; procedure readAnAndorString(var f: file; out s: string; const len: int64; checkEOL: boolean); begin - setlength(s,len+2*byte(checkEOL)); + setLength(s,len+2*byte(checkEOL)); if length(s)>0 then - blockread(f,s[1],length(s)); + blockRead(f,s[1],length(s)); if checkEOL then begin if rightStr(s,2)<>' '#10 then raise exception.create('readAnAndorString: EOL check failed: '''+s+'''!'); - setlength(s,length(s)-2); + setLength(s,length(s)-2); end; end; @@ -1059,9 +1060,9 @@ end; procedure splitStrToInt(s: string; out ia: tLongintArray); begin - setlength(ia,0); + setLength(ia,0); while s<>'' do begin - setlength(ia,length(ia)+1); + setLength(ia,length(ia)+1); ia[length(ia)-1]:=strToInt(erstesArgument(s,' ',false)); end; end; 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); diff --git a/popunit.pas b/popunit.pas index 97ed878..bd7f419 100644 --- a/popunit.pas +++ b/popunit.pas @@ -94,10 +94,10 @@ function readString(p: tProcess): string; var len: longint; begin - setlength(result,p.output.numBytesAvailable); + setLength(result,p.output.numBytesAvailable); if length(result)>0 then begin len:=p.output.read(result[1],length(result)); - setlength(result,len); + setLength(result,len); end else sleep(10); @@ -160,9 +160,9 @@ begin id:=-1; groesze:=-1; _marke:=mvKeine; - fillchar(gueltigerAdressat,sizeof(gueltigerAdressat),#0); + fillchar(gueltigerAdressat,sizeOf(gueltigerAdressat),#0); gueltigerAdressat:=''; - fillchar(sdbName,sizeof(sdbName),#0); + fillchar(sdbName,sizeOf(sdbName),#0); sdbName:=''; end; @@ -176,7 +176,7 @@ end; procedure tNachricht.pruefeMarke; var pr: tProcess; - f: textfile; + f: textFile; begin if grepFirst('^[Xx]-[Hh]ash[Cc]ash:\s')='' then begin _marke:=mvKeine; @@ -219,15 +219,15 @@ begin end; pr.free; - assignfile(f,'/tmp/email-log'); - if fileexists('/tmp/email-log') then + assignFile(f,'/tmp/email-log'); + if fileExists('/tmp/email-log') then _app(f) else rewrite(f); - writeln(f,datetimetostr(now)); + writeln(f,dateTimeToStr(now)); writeln(f,grepFirst('^[Xx]-[Hh]ash[Cc]ash:\s')); writeln(f,_marke); - closefile(f); + closeFile(f); end; function tNachricht.rMarke: tMarkenValiditaet; @@ -264,9 +264,9 @@ begin _user:=''; _pass:=''; _host:=''; - setlength(_nachrichten,0); - fillchar(_lIds,sizeof(_lIds),#0); - setlength(_lIds,0); + setLength(_nachrichten,0); + fillchar(_lIds,sizeOf(_lIds),#0); + setLength(_lIds,0); suspended:=false; end; @@ -279,8 +279,8 @@ begin sleep(10); for i:=0 to length(_nachrichten)-1 do _nachrichten[i].free; - setlength(_nachrichten,0); - setlength(_lIds,0); + setLength(_nachrichten,0); + setLength(_lIds,0); inherited destroy; end; @@ -298,7 +298,7 @@ begin if neu then begin for i:=0 to length(_besitzer._nachrichten)-1 do _besitzer._nachrichten[i].free; - setlength(_besitzer._nachrichten,length(_nachrichten)); + setLength(_besitzer._nachrichten,length(_nachrichten)); for i:=0 to length(_besitzer._nachrichten)-1 do begin _besitzer._nachrichten[i]:=tNachricht.create; _besitzer._nachrichten[i].kopiereVon(_nachrichten[i]); @@ -321,10 +321,10 @@ begin _pass:=_besitzer.pass; _host:=_besitzer.host; _port:=_besitzer.port; - setlength(_lIds,length(_besitzer._lIds)); + setLength(_lIds,length(_besitzer._lIds)); if length(_lIds)>0 then - move(_besitzer._lIds[0],_lIds[0],sizeof(_lIds[0])*length(_lIds)); - setlength(_besitzer._lIds,0); + move(_besitzer._lIds[0],_lIds[0],sizeOf(_lIds[0])*length(_lIds)); + setLength(_besitzer._lIds,0); end; procedure tPopThread.auszenWeltKontakt(var pr: tProcess); @@ -351,7 +351,7 @@ begin _nachrichten[j].free; for k:=j+1 to length(_nachrichten)-1 do _nachrichten[k-1]:=_nachrichten[k]; - setlength(_nachrichten,length(_nachrichten)-1); + setLength(_nachrichten,length(_nachrichten)-1); break; end else if j=0 then begin @@ -362,7 +362,7 @@ begin end; end; - setlength(_lIds,0); + setLength(_lIds,0); esGibtArbeit:=false; end; @@ -379,13 +379,13 @@ begin pr:=nil; for i:=0 to length(_nachrichten)-1 do _nachrichten[i].free; - setlength(_nachrichten,0); + setLength(_nachrichten,0); while not beenden do begin auszenWeltKontakt(pr); if (_user<>'') and (_host<>'') and (_pass<>'') and (_port<>0) then begin if assigned(pr) then begin if befehlAusfuehren(pr,'QUIT',_besitzer.timeout)=baeOk then - pr.WaitOnExit; + pr.waitOnExit; pr.free; pr:=nil; @@ -398,13 +398,13 @@ begin if _sshUser<>'' then begin pr.executable:='ssh'; pr.parameters.add(_sshUser+'@'+_host); - pr.parameters.add('openssl s_client -connect 127.0.0.1:'+inttostr(_port)+' -quiet'); + pr.parameters.add('openssl s_client -connect 127.0.0.1:'+intToStr(_port)+' -quiet'); end else begin pr.executable:='openssl'; pr.parameters.add('s_client'); pr.parameters.add('-connect'); - pr.parameters.add(_host+':'+inttostr(_port)); + pr.parameters.add(_host+':'+intToStr(_port)); pr.parameters.add('-quiet'); end; pr.options:=[poUsePipes]; @@ -459,7 +459,7 @@ begin continue; end; if len>=length(_nachrichten) then begin - setlength(_nachrichten,len+extraLen); + setLength(_nachrichten,len+extraLen); for i:=len to length(_nachrichten)-1 do _nachrichten[i]:=nil; end; @@ -472,7 +472,7 @@ begin end; for i:=len to length(_nachrichten)-1 do _nachrichten[i].free; - setlength(_nachrichten,len); + setLength(_nachrichten,len); if beenden then break; @@ -544,10 +544,10 @@ begin gueltigerAdressat:=''; port:=0; timeout:=10; - setlength(_nachrichten,0); + setLength(_nachrichten,0); neueNachrichten:=nil; - fillchar(_lIds,sizeof(_lIds),#0); - setlength(_lIds,0); + fillchar(_lIds,sizeOf(_lIds),#0); + setLength(_lIds,0); _thread:=tPopThread.create(self); end; @@ -558,9 +558,9 @@ begin _thread.free; for i:=0 to length(_nachrichten)-1 do _nachrichten[i].free; - setlength(_nachrichten,0); - setlength(_lIds,0); - if fileexists(_sdbName) then + setLength(_nachrichten,0); + setLength(_lIds,0); + if fileExists(_sdbName) then deleteFile(_sdbName); inherited destroy; end; @@ -608,12 +608,12 @@ procedure tPopClient.loesche(n: longint); var i: longint; begin - setlength(_lIds,length(_lIds)+1); + setLength(_lIds,length(_lIds)+1); _lIds[length(_lIds)-1]:=_nachrichten[n].id; _nachrichten[n].free; for i:=n+1 to length(_nachrichten)-1 do _nachrichten[i-1]:=_nachrichten[i]; - setlength(_nachrichten,length(_nachrichten)-1); + setLength(_nachrichten,length(_nachrichten)-1); _thread.esGibtArbeit:=true; if assigned(neueNachrichten) then neueNachrichten(self); @@ -623,12 +623,12 @@ procedure tPopClient.loeschen; var i: longint; begin - setlength(_lIds,length(_lIds)+length(_nachrichten)); + setLength(_lIds,length(_lIds)+length(_nachrichten)); for i:=0 to length(_nachrichten)-1 do begin _lIds[length(_lIds)-1-i]:=_nachrichten[i].id; _nachrichten[i].free; end; - setlength(_nachrichten,0); + setLength(_nachrichten,0); _thread.esGibtArbeit:=true; if assigned(neueNachrichten) then neueNachrichten(self); diff --git a/protokollunit.pas b/protokollunit.pas index cb8961d..f03f4bc 100644 --- a/protokollunit.pas +++ b/protokollunit.pas @@ -8,8 +8,8 @@ uses Classes, SysUtils; type - tProtokolldatei = record - datei: textfile; + tProtokollDatei = record + datei: textFile; einrueckung: longint; end; @@ -17,12 +17,12 @@ type tProtokollant = class(TObject) private - sDat: ^tProtokolldatei; + sDat: ^tProtokollDatei; bes: string; kinder: array of tProtokollant; elter: tProtokollant; public - constructor create(dateiname: string); overload; + constructor create(dateiName: string); overload; constructor create(elter_: tProtokollant; besitzer: string); overload; destructor destroy; override; procedure destroyall; @@ -36,17 +36,17 @@ implementation { tProtokollant } -constructor tProtokollant.create(dateiname: string); +constructor tProtokollant.create(dateiName: string); begin inherited create; - getmem(sDat,sizeof(tProtokolldatei)); + getMem(sDat,sizeOf(tProtokollDatei)); sDat^.einrueckung:=10; - assignfile(sDat^.datei,dateiname); - if fileexists(dateiname) then - deleteFile(dateiname); + assignFile(sDat^.datei,dateiName); + if fileExists(dateiName) then + deleteFile(dateiName); rewrite(sDat^.datei); bes:=''; - setlength(kinder,0); + setLength(kinder,0); elter:=nil; end; @@ -54,10 +54,10 @@ constructor tProtokollant.create(elter_: tProtokollant; besitzer: string); begin inherited create; sDat:=elter_.sDat; - setlength(elter_.kinder,length(elter_.kinder)+1); + setLength(elter_.kinder,length(elter_.kinder)+1); elter_.kinder[length(elter_.kinder)-1]:=self; elter:=elter_; - setlength(kinder,0); + setLength(kinder,0); bes:=elter.bes+'.'+besitzer; if pos('.',bes)=1 then delete(bes,1,1); if length(bes)+4 > sDat^.einrueckung then @@ -82,18 +82,18 @@ begin elter.kinder[i-1]:=elter.kinder[i]; inc(i); end; - setlength(elter.kinder,length(elter.kinder)-1); + setLength(elter.kinder,length(elter.kinder)-1); end else begin - closefile(sDat^.datei); - freemem(sDat,sizeof(tProtokolldatei)); + closeFile(sDat^.datei); + freeMem(sDat,sizeOf(tProtokollDatei)); end; inherited destroy; end; procedure tProtokollant.destroyall; begin - if Assigned(elter) then elter.destroyall + if assigned(elter) then elter.destroyall else destroy; end; diff --git a/pseudohadamard.pas b/pseudohadamard.pas index b00e7aa..e845d55 100644 --- a/pseudohadamard.pas +++ b/pseudohadamard.pas @@ -17,7 +17,7 @@ var buff: mpz_t; begin if length(daten)<>round(power(2,round(ln(length(daten))/ln(2)))) then - raise Exception.create('Die Länge der Daten für eine Pseudohadamardtransformation muss eine Zweierpotenz sein (und nicht '+inttostr(length(daten))+')!'); + raise exception.create('Die Länge der Daten für eine Pseudohadamardtransformation muss eine Zweierpotenz sein (und nicht '+intToStr(length(daten))+')!'); mpz_init(buff); pseudoHadamardTransformation(daten,length(daten),0,modul,buff,invers); mpz_clear(buff); diff --git a/refreshexecutableunit.pas b/refreshexecutableunit.pas index 272c108..0858e08 100644 --- a/refreshexecutableunit.pas +++ b/refreshexecutableunit.pas @@ -22,13 +22,13 @@ var tmpDir,output,summeEins: string; args: tStringArray; i: longint; - f: textfile; + f: textFile; begin output:=''; fileMode:=fmOpenWrite; - assignfile(f,dirs[1]+'refreshexecutableunit_sums.inc'); + assignFile(f,dirs[1]+'refreshexecutableunit_sums.inc'); rewrite(f); writeln(f,'const'); writeln(f,' sha512sums: array[0..1] of string = ('); @@ -40,11 +40,11 @@ begin writeln(f,','); end; writeln(f,' );'); - closefile(f); + closeFile(f); - tmpDir:=mkTemp('-d /tmp/fpc.'+extractfilename(paramstr(0))+'.XXXXXX'); + tmpDir:=mkTemp('-d /tmp/fpc.'+extractFileName(paramstr(0))+'.XXXXXX'); mkdir(tmpDir+'/lib'); - setlength(args,18+length(dirs)); + setLength(args,18+length(dirs)); args[0]:='-MObjFPC'; args[1]:='-Scghi'; args[2]:='-Cg'; @@ -62,7 +62,7 @@ begin args[14]:='-Fl/opt/gnome/lib'; args[15]:='-FU'+tmpDir+'/lib'; args[16]:=dirs[0]+extractFileName(paramstr(0)); - if fileexists(args[16]+'.lpr') then + if fileExists(args[16]+'.lpr') then args[16]:=args[16]+'.lpr' else args[16]:=args[16]+'.pas'; @@ -71,15 +71,15 @@ begin args[18+i]:='-Fu'+dirs[i]; if runCommandInDir(dirs[0],'fpc',args,output) then begin - setlength(args,2); + setLength(args,2); args[0]:=tmpDir+'/output'; args[1]:=paramstr(0); if runCommand('sha512sum',args,output) then begin summeEins:=erstesArgument(output,#10); if erstesArgument(summeEins)<>erstesArgument(output) then begin - deletefile(paramstr(0)); + deleteFile(paramstr(0)); if runCommand('mv',args,output) then begin - setlength(args,2); + setLength(args,2); args[0]:='-rf'; args[1]:=tmpDir; if runCommand('rm',args,output) then begin @@ -91,12 +91,12 @@ begin end; end; if (tmpDir<>'') and directoryexists(tmpDir) then begin - setlength(args,2); + setLength(args,2); args[0]:='-rf'; args[1]:=tmpDir; runCommand('rm',args,output); end; - setlength(args,0); + setLength(args,0); end; function sourceSha512Sum(dir: string): string; @@ -104,7 +104,7 @@ var args: tStringArray; begin result:=''; - setlength(args,3); + setLength(args,3); args[0]:='describe'; args[1]:='--always'; args[2]:='--abbrev=0'; diff --git a/systemunit.pas b/systemunit.pas index 1d28924..cb09456 100644 --- a/systemunit.pas +++ b/systemunit.pas @@ -29,27 +29,27 @@ var _cpuLastUsed,_cpuLastIdle: int64; function cpuUtilization: extended; var - procstat: textfile; + procstat: textFile; s: string; used,idle: int64; i: integer; begin result:=0; s:=''; - assignfile(procstat,'/proc/stat'); + assignFile(procstat,'/proc/stat'); reset(procstat); while not eof(procstat) do begin readln(procstat,s); if startetMit('cpu ',s) then break; s:=''; end; - closefile(procstat); + closeFile(procstat); if s='' then exit; used:=0; idle:=0; for i:=0 to 3 do begin used:=used+idle; - idle:=strtoint(erstesArgument(s)); + idle:=strToInt(erstesArgument(s)); end; result:=(used-_cpuLastUsed)/max(1,used-_cpuLastUsed + idle-_cpuLastIdle); _cpuLastUsed:=used; @@ -58,12 +58,12 @@ end; function numCpus: int64; var - procstat: textfile; + procstat: textFile; s: string; begin result:=0; s:=''; - assignfile(procstat,'/proc/stat'); + assignFile(procstat,'/proc/stat'); reset(procstat); while not eof(procstat) do begin readln(procstat,s); @@ -71,7 +71,7 @@ begin startetMit('cpu',s) then inc(result); end; - closefile(procstat); + closeFile(procstat); end; function momentanFreieCpus: int64; @@ -84,17 +84,17 @@ var f: textFile; s: string; begin - s:='/proc/'+inttostr(getProcessId)+'/smaps'; + s:='/proc/'+intToStr(getProcessId)+'/smaps'; result:=0; - if not fileexists(s) then exit; - assignfile(f,s); + if not fileExists(s) then exit; + assignFile(f,s); reset(f); while not eof(f) do begin readln(f,s); if startetMit('Rss:',s) and (endetMit('kB',s) or endetMit('KB',s)) then - result:=result+strtoint(s); + result:=result+strToInt(s); end; - closefile(f); + closeFile(f); end; function minCache: int64; @@ -104,17 +104,17 @@ var begin s:='/proc/cpuinfo'; result:=0; - if not fileexists(s) then exit; - assignfile(f,s); + if not fileExists(s) then exit; + assignFile(f,s); reset(f); while not eof(f) do begin readln(f,s); if startetMit('cache',s) and startetMit('size',s) and startetMit(':',s) and (endetMit('KB',s) or endetMit('kB',s)) then begin - if result=0 then result:=strtoint(s) - else result:=min(result,strtoint(s)); + if result=0 then result:=strToInt(s) + else result:=min(result,strToInt(s)); end; end; - closefile(f); + closeFile(f); end; function shellSubst(s: string): string; @@ -189,7 +189,7 @@ begin if (ebene=0) and (copy(s,j,2)='..') then begin if iStart<>low(longint) then fehler('''..'' darf nicht mehrmals hintereinander auftauchen - in '''+sa[i]+''' ist das aber der Fall!'); - iStart:=strtoint(trim(leftStr(s,j-1))); + iStart:=strToInt(trim(leftStr(s,j-1))); delete(s,1,j+1); j:=1; continue; @@ -204,10 +204,10 @@ begin continue; end else begin // eine Zähliteration - iStopp:=strtoint(trim(leftStr(s,j-1))); + iStopp:=strToInt(trim(leftStr(s,j-1))); delete(s,1,j); for j:=iStart to iStopp do - sa.insert(i+insOff+j-iStart,start+inttostr(j)+ende); + sa.insert(i+insOff+j-iStart,start+intToStr(j)+ende); inc(insOff,iStopp-iStart+1); iStart:=low(longint); j:=1; @@ -226,9 +226,9 @@ function mkTemp(s: string): string; var args: array of string; begin - setlength(args,0); + setLength(args,0); while s<>'' do begin - setlength(args,length(args)+1); + setLength(args,length(args)+1); args[length(args)-1]:=erstesArgument(s); end; result:=''; @@ -241,7 +241,7 @@ function myReadLink(s: string): string; var args: array of string; begin - setlength(args,3); + setLength(args,3); args[0]:='-f'; args[1]:='-n'; args[2]:=s; @@ -255,7 +255,7 @@ function pwd: string; var args: array of string; begin - setlength(args,0); + setLength(args,0); result:=''; if not runCommand('pwd',args,result) then raise exception.create('Fehler beim Ausführen von ''pwd''!'); |