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