VAX Pascal Formatter V3.0-3 Distribution is with the kind permission of Oregon Software who wrote the original version of the program on which this version is based. This software may be copied and distributed provided that this notice is included and no charge is made other than reasonable media costs. The source is provided on an 'as is' basis, and no warranty is either given or implied. No responsibility is accepted for any damage done to programs or data or any other consequential loss caused either directly or indirectly as a result of using this software. Version There is a /VERSION qualifier which may be used instead of all the parameters and qualifiers listed below. It causes PASMAT to identify itself. Command Line Parameters and Qualifiers There is one parameter: the input file spec. This may be a list and/or contain wildcards. This parameter is required. Use the qualifier /OUTPUT=filespec to specify the output file. The default will be a file of the same name and type as the input file, in the current default directory. This qualifier may be specified on the input file (in which case it is effective only for that input file, not others in the list), or on the verb (where it is effective for all other input files). Wildcards are not allowed on the output filespec. You may use the qualifier /OPTIONS="[options]" to control the format (for the syntax see below). The placement of this qualifier is identical to that for the /OUTPUT qualifier. Using /OPTIONS overrides the qualifiers below. The rest of the qualifiers affect all the input files, no matter where they are placed. /SHOW_STATISTICS - displays a line after each file and after all files showing PASMAT performance statistics. /DEBUG - primarily intended for debugging PASMAT itself, this enables certain messages during processing, and prevents deletion of the output file on detection of a syntax error. The output file has the type .PASMAT_TEMPORARY. /ADJUST_SPELLING - all identifiers are spelt as they first appear (ie in the same case). This overrides /LITERAL. Default = FALSE. /BEGIN_INDENT - BEGIN/END are indented to match the enclosed block, as opposed to the block being indented inside the BEGIN/END. Default = TRUE. /BUNCH_STATEMENT - the statement following a THEN, FOR, WITH, WHILE, or CASE label is placed on the same line if there is room. Default = TRUE. /CAPITALIZE_IDENTIFIER - identifiers have their first character capitalized and the rest in lowercase. Default = FALSE. /COMMENT_INDENT - comments on separate lines are indented to match the rest of the block they are in, as opposed to being pushed to the left margin. Default = TRUE. /CONVERT_TO_TABS - leading spaces are converted to tabs where possible. Default = TRUE. /FORMAT - formatting is done. Default = TRUE. /LITERAL - the case of identifiers and reserved words is not changed. This overrides /RESERVED_UPPER, /UPPER_IDENTIFIER, and /CAPITALIZE_IDENTIFIER. Default = FALSE. /NEW_LINES - inserts new lines as required by formatting. Default = TRUE. /PARAMETER_ALIGN_NAMES - aligns parameter names in a procedure declaration, instead of aligning the parameter declaration. This means that VAR and value parameters are aligned differently. Default = TRUE. /RESERVED_UPPER - reserved words are uppercase. Default = TRUE. /STANDARD - converts alternate symbols to standard form (eg (* becomes {). As of V3.0 %b, %o, and %x are converted to the standard syntax 2#, 8#, 16#. Default = TRUE. /STATEMENTS_PER_LINE=number - puts up to the given number of statements on each line if they fit. Default = 1. /TABSPACES=number - uses the given number of spaces for each indentation. Default = 4. /UPPER_IDENTIFIER - identifiers are uppercase. Default = lowercase. /VARIABLE_BUNCH - in declaration, list identifiers on a single line if they fit. The alternative is to list one per line. Default = TRUE. /WIDTH=number - sets the output width. Default = 80, Max = 132. Options syntax The options syntax is a string enclosed in square brackets, either on the command line or embedded in a comment. If options are embedded in comments in the program, they may not be overridden on the command line, which defeats the object of a formatter. Each option is specified by a letter, followed by either + to turn the option on, - to turn it off, or =number to change the value. The letters correspond to the qualifiers as follows: f : Formatting o : Width s : Statements per line t : Tab spaces Usage The performance is not much better than VAX Pascal with /NOOPTIMIZE set, and the product is not integrated with VAXset, so it is not recommended for detecting syntax errors. If you prefer your files formatted differently, you can set up a symbol to invoke PASMAT with your favourite qualifiers by putting: $ MYPASMAT :== 'PASMAT'/DEBUG/SHOW or whatever into your LOGIN.COM. However you should always put files back into the standard format by running PASMAT without qualifiers before replacing them in CMS libraries. Failure to do this will result in a serious overhead when using CMS, as it keeps a list of changed lines for each version. Examples $ PASMAT sys$share:starlet This will format the file in the default way. The output file will be in the current directory. $ PASMAT file1/OUT=.pasmat,file2 This will format file1 (output file1.pasmat), then file2 (output file2.pas). Any errors on file1 will not affect file2. $ PASMAT/OUT=.pasmat file1,file2 As above, except both output files will have a file type .pasmat. $ PASMAT a*,b* All files with type .pas beginning with a or b will be formatted. PASMAT will continue with the next file in the event of an error. Known Problems and Restrictions Fixes for V3.0-3 Use of DATE and TIME functions no longer incorrectly flagged (minor) Old %b/o/x numbers were broken - now fixed. Fixes for V3.0-2 Correctly formats V4 structured constants. Accepts D & Q exponents. A number of other minor adjustments. The formatter will not detect all syntax errors in a Pascal program. In particular, it cannot tell a constant (compile-time) expression from one which must be calculated at run-time. It is also fairly relaxed about missing semicolons. If anyone has a Pascal source file which the formatter wrongly rejects, please let me know. I would also be pleased to know of any invalid syntax which it accepts. If the formatter crashes, or if formatting is affected in any way by preceding files, please give me full details. The formatter should accept all the files which the VAX Pascal compiler does. Known exceptions are as follows: No VAX Pascal V4 reserved words, keywords, or predeclared identifiers are allowed to be redeclared by the formatter, although this is allowed by VAX Pascal. This restriction is likely to remain. VAX Pascal defines many keywords in extension to the standard, and allows all of them to be used as identifiers. This is however considered bad practice. Exceptions are : TRUNCATE (a VAX Pascal I/O function) READONLY, LIST, FORTRAN (which VAX Pascal OPEN accepts as arguments) Symbolic label names with a comment before the colon will not be correctly formatted. Put the colon immediately after the label, or better still, don't use a label. The new standard representation for binary, octal and hexadecimal is not compatible with earlier versions - use /NOSTANDARD if you wish to retain backward compatibility in your source code. The formatter prints a warning message about uses of the non-standard DATE and TIME procedures - this message is for information only and may be ignored. I am fairly unhappy about performance - it seems to have nosedived. I've got a few ideas why, but since VAX PCA is broken just now I'm waiting for the (imminent) next version before I put in too much effort. I would be pleased to hear of any bugs, solutions, or suggested enhancements at the address below. Chris Sharman, CCA Stationery, Eastway, Fulwood, Preston, Lancs, ENGLAND Changes from the original PASMAT The original was written by Oregon Software, and is NOT public domain as far as I know (although it comes free with the Oregon compiler I believe). This version takes lists of wildcarded files, and lots of qualifiers, and looks like a normal VMS utility. It also spells 'known' identifiers the same as reserved words - so that if reserved words are uppercase, and identifiers are lowercase, WRITELN etc is in uppercase. There are obviously many changes to accommodate VAX Pascal syntax. Dollars are valid and significant characters in identifier names. The original PASMAT just ignored underscores, and removed them in portability mode. Portability mode (p) no longer exists. The ELSE kluge (k) has also been removed. Defaults have been changed - the default is now: PASMAT /NOADJUST_SPELLING /BEGIN_INDENT /BUNCH_STATEMENT - /NOCAPITALIZE_IDENTIFIER /COMMENT_INDENT /CONVERT_TO_TABS /FORMAT - /NOLITERAL /NEW_LINES /PARAMETER_ALIGN_NAMES /RESERVED_UPPER - /STANDARD /STATEMENTS_PER_LINE=1 /TABSPACES=4 /NOUPPER_IDENTIFIER - /VARIABLE_BUNCHING /WIDTH=80