mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-01 06:03:16 +02:00
+ Made output linesize variable
This commit is contained in:
parent
6a6ff18554
commit
b83d255d85
@ -22,7 +22,7 @@ Uses PtoPu,Objects,getopts;
|
||||
Var
|
||||
Infilename,OutFileName,ConfigFile : String;
|
||||
BeVerbose : Boolean;
|
||||
TheIndent,TheBufSize : Integer;
|
||||
TheIndent,TheBufSize,TheLineSize : Integer;
|
||||
|
||||
Function StrToInt(Const S : String) : Integer;
|
||||
|
||||
@ -37,10 +37,11 @@ Procedure Usage;
|
||||
|
||||
begin
|
||||
Writeln ('ptop : Usage : ');
|
||||
Writeln ('ptop [-v] [-i indent] [-b bufsize ][-c optsfile] infile outfile');
|
||||
Writeln ('ptop [-v] [-i indent] [-b bufsize ][-c optsfile][-l linesize] infile outfile');
|
||||
Writeln (' converts infile to outfile.');
|
||||
Writeln (' -c : read options from optsfile');
|
||||
Writeln (' -i : Set number of indent spaces.');
|
||||
Writeln (' -l : Set maximum output linesize.');
|
||||
Writeln (' -b : Use buffers of size bufsize');
|
||||
Writeln (' -v : be verbose');
|
||||
writeln ('ptop -g ofile');
|
||||
@ -71,6 +72,7 @@ begin
|
||||
ConfigFile:='';
|
||||
TheIndent:=2;
|
||||
TheBufSize:=255;
|
||||
TheLineSize:=MaxLineSize;
|
||||
BeVerbose:=False;
|
||||
Repeat
|
||||
c:=getopt('i:c:g:b:hv');
|
||||
@ -84,6 +86,10 @@ begin
|
||||
If TheBufSize=0 then TheBufSize:=255;
|
||||
end;
|
||||
'c' : ConfigFile:=OptArg;
|
||||
'l' : begin
|
||||
TheLineSize:=StrToInt(OptArg);
|
||||
If TheLineSIze=0 Then TheLineSize:=MaxLineSize;
|
||||
end;
|
||||
'g' : begin
|
||||
ConfigFIle:=OptArg;
|
||||
GenOpts;
|
||||
@ -125,6 +131,7 @@ begin
|
||||
CfgS:=Nil;
|
||||
PPrinter.Create;
|
||||
PPrinter.Indent:=TheIndent;
|
||||
PPrinter.LineSize:=TheLineSize;
|
||||
PPrinter.Ins:=Ins;
|
||||
PPrinter.outS:=OutS;
|
||||
PPrinter.cfgS:=CfgS;
|
||||
@ -149,7 +156,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1999-05-12 16:11:39 peter
|
||||
Revision 1.2 1999-07-08 21:17:10 michael
|
||||
+ Made output linesize variable
|
||||
|
||||
Revision 1.1 1999/05/12 16:11:39 peter
|
||||
* moved
|
||||
|
||||
Revision 1.3 1999/03/25 16:52:29 michael
|
||||
|
@ -173,6 +173,7 @@ Type
|
||||
Procedure RShift(currmsym: keysymbol);
|
||||
Function ReadConfigFile: Boolean;
|
||||
Public
|
||||
LineSize : longint;
|
||||
Indent : Integer; { How many characters to indent ? }
|
||||
InS,
|
||||
OutS,
|
||||
@ -848,7 +849,7 @@ Procedure TprettyPrinter.LShift;
|
||||
Procedure TPrettyPrinter.InsertSpace(VAR symbol: symbolinfo);
|
||||
{ Insert space if room on line }
|
||||
BEGIN
|
||||
IF currlinepos < MAXLINESIZE THEN BEGIN
|
||||
IF currlinepos < LineSize THEN BEGIN
|
||||
WriteString(OutS, Blank);
|
||||
Inc(currlinepos);
|
||||
IF (symbol^.crsbefore = 0) AND (symbol^.spacesbefore > 0)
|
||||
@ -1168,6 +1169,7 @@ end;
|
||||
Constructor TPrettyPrinter.Create;
|
||||
|
||||
Begin
|
||||
LineSize:=MaxLineSize;
|
||||
CreateOptions (Option);
|
||||
SetTerminators(Option);
|
||||
DiagS:=Nil;
|
||||
@ -1188,7 +1190,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1999-05-31 10:08:36 michael
|
||||
Revision 1.3 1999-07-08 21:17:11 michael
|
||||
+ Made output linesize variable
|
||||
|
||||
Revision 1.2 1999/05/31 10:08:36 michael
|
||||
* Fix by Marco van de Voort to enable #13#10
|
||||
|
||||
Revision 1.1 1999/05/12 16:11:39 peter
|
||||
|
Loading…
Reference in New Issue
Block a user