Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50530/pform.hlp
There are 4 other files named pform.hlp in the archive. Click here to see a list.
PFORM is  a  pretty-printing program  for  PASCAL source  files,  useful  to
reformat programs (indentation,  upper-lower case)  and to  find omitted  or
excessive BEGINS and ENDS.

Comments, gripes and bugs to CSD.BEIGEL@SU-SCORE.  If this address fails,
then try RJB@SU-AI, BEIGEL@MIT-MC, or R.RBEIGEL@SU-LOTS (when it gets onto
the arpa-net).

Topics:
		INPUT AND OUTPUT
		HOW TO USE IT
		SWITCHES
		TASMANIA
INPUT AND OUTPUT
INPUT:
-----
through the file OLDSOURCE, a PASCAL source program file.

OUTPUT:
------
through the file NEWSOURCE:
	a copy of your input file, prettyprinted.
	(proper indentation according to the statement nesting,
	newline on standard places in the program, management of upper
	and lower case according to the list of reserved words, etc.)

By default, PFORM will change all  reserved words to upper case;  capitalize
procedure names and function  names; leave comments and  strings as is;  and
put everything else in lower case.   There are switches available to  change
these conditions.
HOW TO USE IT
You type:
	@PFORM

Example:

	@pform
	Oldsource? myprog/comm:u/denny
	Newsource?

The switches  are  parsed  with  the  COMND jsys,  so  you  may  use  unique
abbreviations, press the escape key  for recognition, or type question  mark
for help. This one asks for comments to appear in upper case and to have the
program formatted according to Denny Brown's style.  The default extionsions
for oldsource  are 'PGO'  and  'PAS'.  The  default  name for  newsource  is
myprog.new.

As a test, I am  allowing you to simply type  "pform myprog", in which  case
you will not  be prompted  for either oldsource  (which will  be myprog)  or
newsource (which will be myprog.new).

The program parameters all have default values, but they can be modified  if
desired, by the use of switches.  See the subtopic SWITCHES.
SWITCHES
					Brackets indicate optional.
   					<n> stands for an integer number.
   					<L> stands for a letter.

The switches  may be  specified inside  the pascal  program much  as  pascal
compiler options can be specified inside pascal programs (try "goto  pascal"
or "help pascal" for details).  thus, in the previous example, one may  omit
/comm:u/denny if one  includes the  comment (*&Mu,D+*) at  the beginning  of
one's program.  Most  switches may  be specified (and  respecified) in  this
fashion at any place in the program.


   Switch	   Meaning					Default.

	FILES.
/VERSION:<N>	Behave as if conditionally compiling %<N>
		comments.				       -1
(*&Vn*)
		To end conditional compilation, specify (*&V-1*).

	PAGE AND LINE FORMAT
/INDENT:<n>	Indentation between levels.		       4
(*&In*)
     		Note:  Changing the indentation between levels
		will also affect the indentation of BEGIN-END
		blocks, e.g., (*&I6*) is the same as (*&I6,G-3*).
		See /BEGIN:, below.

/SAVE-COMMENT	If set, then preserves the indentation
		for comment lines.  If not set, then
		comments are indented like statements.	       off
(*&Cn/C-*)
		C- will cause comments to be indented like
		statements.

	STATEMENT FORMAT
/BEGIN:[-]<n>	if the [-] is not there, the contents of a
		  begin..end block is indented n spaces further.
		if it is there, the block will not be indented,
		  but the begin and end statements will be
		  exdented n spaces.			       0
		(or -indentation/2, as specified by /indent)
(*&Gn*)

/FORCE	forces newline in standard places. (before and
		 after begin, end, then, else, repeat, etc.)   off
(*&F+/F-*)
     
/ELSEIF	prevents newline between ELSE and IF (provided
		 they are already on the same line.)	       off
(*&E+/E-*)

/SUPER		forces newline after every semicolon	       off
(*&S+/S-*)

/PRESERVE	preserves your own indentation		       off
(*&P+/P-*)

/DENNY	(after Denny Brown) causes END statements to be
		 exdented one tab (4(3) spaces or as specified
		 by the indent option)	even if the /BEGIN option
		 is specified.	It also prevents the /FORCE
		 option from causing newline after DO, ELSE, or
		 THEN.	Also puts reserved words into lower case,
		 unless you specify otherwise.  See subtopic
		 Tasmania for an example.	       	       off
(*&D+/D-*)

	UPPER AND LOWER CASE
		       note: the possible values for <l> are:
			       uppercase
			       lowercase
			       capitalize
			       samecase
     
/RESERVED-CASE:<l>	case used for reserved words.	       u
(*&Rl*)
/PROCEDURE-CASE:<l>	case for procedure names	       c
(*&Xl*)
/NONRESERVED-CASE:<l>	case for other non-reserved words.     l
(*&Nl*)
/COMMENT-CASE:<l>	case for comments.		       s
(*&Ml*)
/STRING-CASE:<l>	case for strings.		       s
(*&Zl*)
/CASE:<l>	resets all the defaults to <l>.                off
(*&Al*)
TASMANIA

This subtopic deals with a format  developed at the University of  Tasmania,
available by specifying /DENNY or /TAS.   Its properties are best seen  from
an example.  Whereas the default format would give you the following:

PROGRAM Foo;
VAR i: integer;
BEGIN
FOR i := 1 TO 10 DO
    BEGiN
    IF i < 5 THEN
        BEGIN
	Write(i);
	Write(i*i); (* i squared *)
        END
    ELSE
        BEGIN
	Write(i*i);
	Write(i);
        END;
    END;
END.

/TAS will give you this:

program Foo;
var i: integer;
begin
for i := 1 to 10 do begin
    if i < 5 then begin
	Write(i);
	Write(i*i); (* i squared *)
    end else begin
	Write(i*i);
	Write(i);
    end;
end;
end.