* some speed improvements for string operations

This commit is contained in:
pierre 2001-08-12 00:04:50 +00:00
parent 5f581298f0
commit e7cff5c48c
4 changed files with 52 additions and 24 deletions

View File

@ -185,7 +185,7 @@ begin
C:='';
for I:=1 to length(S) do
begin
C:=C+'#$'+IntToHex(ord(S[I]),2);
Insert('#$'+IntToHex(ord(S[I]),2),C,Length(C)+1);
end;
PaletteToStr:=C;
end;
@ -622,7 +622,10 @@ end;
end.
{
$Log$
Revision 1.2 2001-08-05 02:01:48 peter
Revision 1.3 2001-08-12 00:04:50 pierre
* some speed improvements for string operations
Revision 1.2 2001/08/05 02:01:48 peter
* FVISION define to compile with fvision units
Revision 1.1 2001/08/04 11:30:23 peter

View File

@ -259,8 +259,10 @@ begin
W:=GetLineStartOfs(Line);
for X:=0 to GetWidth-1 do
begin
Text:=Text+chr(VBuffer^[W+X*2]);
Attr:=Attr+chr(VBuffer^[W+X*2+1]);
{Text:=Text+chr(VBuffer^[W+X*2]);
Attr:=Attr+chr(VBuffer^[W+X*2+1]);}
System.Insert(chr(VBuffer^[W+X*2]),Text,Length(Text)+1);
System.Insert(chr(VBuffer^[W+X*2+1]),Attr,Length(Attr)+1);
end;
end;
end;
@ -832,7 +834,10 @@ end;
end.
{
$Log$
Revision 1.1 2001-08-04 11:30:24 peter
Revision 1.2 2001-08-12 00:04:50 pierre
* some speed improvements for string operations
Revision 1.1 2001/08/04 11:30:24 peter
* ide works now with both compiler versions
Revision 1.1.2.10 2001/06/14 09:15:16 pierre

View File

@ -90,8 +90,8 @@ type
procedure FillScreen(B: byte); virtual;
procedure ClrEol; virtual;
procedure GotoXY(X,Y: integer); virtual;
procedure Write(S: string); virtual;
procedure WriteLn(S: string); virtual;
procedure Write(Const S: string); virtual;
procedure WriteLn(Const S: string); virtual;
procedure WriteChar(C: char); virtual;
procedure DelLine(LineCount: integer); virtual;
procedure InsLine(LineCount: integer); virtual;
@ -183,8 +183,8 @@ type
function LoadFile(const FileName: string): boolean;
procedure Draw; virtual;
destructor Done; virtual;
procedure Write(S: string); virtual;
procedure WriteLn(S: string); virtual;
procedure Write(Const S: string); virtual;
procedure WriteLn(Const S: string); virtual;
procedure Lock; virtual;
procedure UnLock; virtual;
procedure ChangeBounds(var Bounds: TRect); virtual;
@ -217,8 +217,8 @@ type
function LoadFile(const FileName: string): boolean;
procedure Draw; virtual;
destructor Done; virtual;
procedure Write(S: string); virtual;
procedure WriteLn(S: string); virtual;
procedure Write(Const S: string); virtual;
procedure WriteLn(Const S: string); virtual;
procedure Lock; virtual;
procedure UnLock; virtual;
procedure ChangeBounds(var Bounds: TRect); virtual;
@ -294,7 +294,7 @@ begin
Abstract;
end;
procedure TConsoleObject.Write(S: string); {assembler;
procedure TConsoleObject.Write(Const S: string); {assembler;
asm
push ds
lds si, S
@ -321,9 +321,9 @@ begin
for I:=1 to Len do ProcessChar(S[I]);
end;
procedure TConsoleObject.WriteLn(S: string);
procedure TConsoleObject.WriteLn(Const S: string);
begin
Write(S+#10);
Write(S);Write(#10);
end;
procedure TConsoleObject.DelLine(LineCount: integer);
@ -542,7 +542,12 @@ begin
'M' : if ANSIParam='' then DelLine(1)
else DelLine(GetANSIParam);
'm' : while ANSIParam<>'' do SetAttr(GetANSIParam);
else begin ANSIParam:=ANSIParam+C; ANSIDone:=false; end;
else
begin
{ANSIParam:=ANSIParam+C;}
System.Insert(C,AnsiParam,Length(AnsiParam)+1);
ANSIDone:=false;
end;
end;
if ANSIDone then
begin
@ -794,13 +799,13 @@ begin
end;
end;
procedure TANSIView.Write(S: string);
procedure TANSIView.Write(Const S: string);
begin
Console^.Write(S);
DrawView;
end;
procedure TANSIView.WriteLn(S: string);
procedure TANSIView.WriteLn(Const S: string);
begin
Console^.WriteLn(S);
DrawView;
@ -999,13 +1004,13 @@ begin
end;
end;
procedure TANSIBackground.Write(S: string);
procedure TANSIBackground.Write(Const S: string);
begin
Console^.Write(S);
DrawView;
end;
procedure TANSIBackground.WriteLn(S: string);
procedure TANSIBackground.WriteLn(Const S: string);
begin
Console^.WriteLn(S);
DrawView;
@ -1047,7 +1052,10 @@ end;
END.
{
$Log$
Revision 1.1 2001-08-04 11:30:25 peter
Revision 1.2 2001-08-12 00:04:50 pierre
* some speed improvements for string operations
Revision 1.1 2001/08/04 11:30:25 peter
* ide works now with both compiler versions
Revision 1.1.2.5 2001/03/06 22:39:31 pierre

View File

@ -395,8 +395,16 @@ begin
end;
function Trim(const S: string): string;
var
i,j : longint;
begin
Trim:=RTrim(LTrim(S));
i:=1;
while (i<length(s)) and (s[i]=' ') do
inc(i);
j:=length(s);
while (j>0) and (s[j]=' ') do
dec(j);
Trim:=Copy(S,i,j-i+1);
end;
function IntToStr(L: longint): string;
@ -464,10 +472,11 @@ begin
S:='';
R:=L; if R<0 then begin R:=R+2147483647+2147483647+2; end;
repeat
S:=HexNums[ModF(R,16)+1]+S;
Insert(HexNums[ModF(R,16)+1],S,1);
R:=DivF(R,16);
until R=0;
while length(S)<MinLen do S:='0'+S;
while length(S)<MinLen do
Insert('0',S,1);
IntToHex:=S;
end;
@ -1220,7 +1229,10 @@ BEGIN
END.
{
$Log$
Revision 1.2 2001-08-05 02:01:49 peter
Revision 1.3 2001-08-12 00:04:50 pierre
* some speed improvements for string operations
Revision 1.2 2001/08/05 02:01:49 peter
* FVISION define to compile with fvision units
Revision 1.1 2001/08/04 11:30:26 peter