mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:29:25 +02:00
+ save ansi dump as text is filename suffix is '.txt'
This commit is contained in:
parent
a931861ce1
commit
066d198d33
@ -21,7 +21,8 @@ uses
|
||||
objects,
|
||||
video;
|
||||
|
||||
function ExportBufferToAnsiFile(var Buffer : TVideoBuf;xmin,xmax,ymin,ymax,linesize : sw_integer;var f : text) : boolean;
|
||||
function ExportBufferToAnsiFile(var Buffer : TVideoBuf;xmin,xmax,ymin,ymax,linesize : sw_integer;
|
||||
SaveAsText : boolean;var f : text) : boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -43,7 +44,8 @@ const ColorTab : array[0..7] of byte =
|
||||
(Black,Red,Green,Brown,Blue,Magenta,Cyan,LightGray);
|
||||
|
||||
{$i-}
|
||||
function ExportBufferToAnsiFile(var Buffer : TVideoBuf;xmin,xmax,ymin,ymax,linesize : sw_integer;var f : text) : boolean;
|
||||
function ExportBufferToAnsiFile(var Buffer : TVideoBuf;xmin,xmax,ymin,ymax,linesize : sw_integer;
|
||||
SaveAsText : boolean;var f : text) : boolean;
|
||||
var
|
||||
CurColor : byte;
|
||||
CurForColor, CurBackColor : byte;
|
||||
@ -91,13 +93,14 @@ var
|
||||
textAttr : byte;
|
||||
i, j : sw_integer;
|
||||
begin
|
||||
CurColor:=0;
|
||||
for i:=ymin to ymax do
|
||||
begin
|
||||
for j:=xmin to xmax do
|
||||
begin
|
||||
ch:=chr(Buffer[i*linesize+j] and $ff);
|
||||
textattr:=Buffer[i*linesize+j] shr 8;
|
||||
if textattr<>CurColor then
|
||||
if (textattr<>CurColor) and not SaveAsText then
|
||||
ChangeColor(textattr);
|
||||
Write(f,ch);
|
||||
end;
|
||||
@ -109,7 +112,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2001-08-04 11:30:23 peter
|
||||
Revision 1.2 2001-11-15 13:30:14 pierre
|
||||
+ save ansi dump as text is filename suffix is '.txt'
|
||||
|
||||
Revision 1.1 2001/08/04 11:30:23 peter
|
||||
* ide works now with both compiler versions
|
||||
|
||||
Revision 1.1.2.1 2000/11/21 17:43:24 pierre
|
||||
|
@ -19,7 +19,9 @@ var
|
||||
f : text;
|
||||
Buf : PVideoBuf;
|
||||
re : word;
|
||||
p : longint;
|
||||
UL,LR : TPoint;
|
||||
SaveAsText : boolean;
|
||||
Name, DefExt : string;
|
||||
|
||||
function GetPoint(var P :TPoint) : boolean;
|
||||
@ -72,8 +74,10 @@ begin
|
||||
begin
|
||||
Assign(f,Name);
|
||||
Rewrite(f);
|
||||
p:=system.pos('.',Name);
|
||||
SaveAsText:=Copy(Name,p+1,High(Name))='txt';
|
||||
ExportBufferToAnsiFile(Buf^,UL.X,LR.X,UL.Y,LR.Y,
|
||||
Size.X,f);
|
||||
Size.X,SaveAsText,f);
|
||||
Close(f);
|
||||
end;
|
||||
PopStatus;
|
||||
@ -81,7 +85,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2001-10-12 14:20:11 pierre
|
||||
Revision 1.3 2001-11-15 13:30:14 pierre
|
||||
+ save ansi dump as text is filename suffix is '.txt'
|
||||
|
||||
Revision 1.2 2001/10/12 14:20:11 pierre
|
||||
* use correct video buffer size
|
||||
|
||||
Revision 1.1 2001/08/04 11:30:23 peter
|
||||
|
Loading…
Reference in New Issue
Block a user