home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PasMat
- Version 1.0
-
- A Language Formatter for Turbo Pascal
-
-
- Cyrus Patel - SYSOP
- The Master Silicone RCP/M
- (312) 386-9271 (data)
- (312) 383-8985 (voice)
- 138 Le Moyne Pkwy
- Oak Park, Illinois 60302
-
- Copyright (c) 1986 Cyrus Patel
- All rights reserved.
-
-
- PasMat and the associated support files (including this
- documentation file) are Copyright (c) 1985 by Cyrus Patel.
- Non-commercial, public distribution and use of this program
- is permitted. All commercial rights are reserved.
- Distribution of PasMat should include this documentation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Program Distribution
-
- PasMat was not written to be free software. However, after
- examination of the advertising costs involved with marketing
- a successful program, I have decided not to be forced into
- charging $100+ for it. Many hours have been put into the
- development of this program and any contribution would be
- appreciated. This will help offset the costs of development
- and encourage the me to continue to update this program and
- write new ones.
-
-
-
- Disclaimer
-
- PasMat is currently distributed as User Supported Software.
- As long as the program is not modified in any way, and
- copied as a complete package (both the .COM and .DOC files),
- and no fee is charged (other than a maximum $10
- distribution fee), the author encourages users to copy and
- distribute this program.
-
- In no event will the author of this program be liable for
- any loss or damage arising from the use or misuse of this
- program, even if the author has been advised of the
- possibility of such damages. Please report bugs directly to
- the author, and he will release an update as soon as
- possible.
-
-
-
- Introduction to PasMat
-
- PasMat (PM) generates a standard format for Pascal code. PM
- will accept standard Pascal and the language extensions in
- Turbo Pascal. PM accepts full programs, procedures, or
- groups of statements. A syntactically incorrect program
- will cause PM to abort and to cease formatting the output
- file.
-
- PM's default formatting requires no control from you. The
- best way to find out how the formatting works is to try it
- and see. In addition, PM's formatting directives give you
- considerable control over the output format when you wish.
-
- PM's rules allow you to achieve almost any effect needed in
- the display of comments.
-
-
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users manual Page 2
-
-
-
-
-
-
-
-
- 1.0 COMMENTS
-
- PM's rules allow you to achieve almost any effect needed in
- the display of comments.
-
- 1. A comment standing alone on a line will be
- d left-justified to the current indentation level, so that
- it will be aligned with the statements before and after
- it. If it is too long to fit with this alignment, it
- will be right-justified.
-
- 2. A comment that begins a line and continue to another
- line will be passed to the output unaltered, indentation
- unchanged. This type of comment is assumed to contain
- text formatted by the author, so it is not formatted.
-
- 3. If a comment covered by one of the above rules will not
- fit within the defined output line length, the output
- line will be extended as necessary to accommodate the
- comment. Once formatting is complete, a message to the
- display will give the number of times the width was
- exceeded and the output line number of the first
- occurrence.
-
- 4. A comment embedded within a line will be formatted with
- the rest of the code on that line. Breaks between words
- within a comment may be changed to achieve proper
- formatting, so nothing that has a fixed format should be
- used in such a comment. If a comment cannot be properly
- spaced so that the line will fit within the output
- length, that line will be extended as necessary. If no
- code follows a comment in the input line, then no code
- will be placed after the comment in the output line.
-
-
-
- 2.0 STATEMENT BUNCHING
-
- The normal formatting rule for a CASE statement places the
- selected statements on a separate line from the case labels.
- The B directive (see below) tells the formatter to place
- these statements on the same line as the case labels if the
- statements will fit.
-
- Similarly, the rules for IF-THEN-ELSE, FOR, WHILE, and WITH
- place the controlled statements on separate lines. The B
- directive tells the formatter to place the controlled
- statement on the same line as the statement header if the
- statement will fit.
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users manual Page 3
-
-
-
-
-
-
-
-
- 3.0 TABLES
-
- Many Pascal programs contain lists of initialization
- statements or constant declarations that are logically a
- single action or declaration. You may want these to be fit
- into as few lines as possible. The S directive (see below)
- allow this. If this is used, logical tab stops are set up
- on the line, and successive statements or constant
- declarations are aligned to these tab stops instead of
- beginning on new lines.
-
- At least one blank is always placed between statements or
- constant declarations, so if tab stops are set up at every
- character location, statements will be packed on a line.
-
- Structured statements, which normally format on more than
- one line, are not effected by this directive.
-
-
-
- 4.0 USING PM
-
- You invoke PM with the following command:
-
- A>PM input-file
-
- input-file
- The Turbo Pascal source file to be formatted. The
- default file type is ".PAS". If the formatting was
- successful, the input file is renamed to "name.PMT" and
- the output file receives the same file name as the
- input file.
-
-
-
- 5.0 FORMATTING DIRECTIVES
-
- Formatting directives are specified by a special format of
- the Pascal comment structure and are placed within square
- brackets.
-
- {[directives] text}
-
- Formatting directives are of two breeds: switches that turn
- on with the plus sign (+) and off with the minus sign
- (-)(e.g., R+ and U-); or numeric directives of the form
- T=5. Multiple directives separated by commas (e.g., R+,U-).
- Blanks are not allowed within a directive. Case is ignored:
- R+ is the same as r+ in a directive.
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users manual Page 4
-
-
-
-
-
-
-
-
- The PM formatting directives are:
-
- 1. A (Default A-) Adjusts each identifier so that the first
- instance of the identifier determines the appearance of
- all subsequence instances of the identifier. This
- facility standardizes the use of upper-case and
- lower-case characters and the break character (_) in
- program text.
-
- 2. B (Default B-) Specifies that the statements following a
- THEN, ELSE, FOR, WITH or WHILE will be put on the same
- line if they will fit. The statement following a CASE
- label will be put on the same line if it fits. The
- result is a shorter output, which may be easier to read
- but which also may be harder to correct.
-
- 3. C (Default C-) Convert leading blanks to tabs on output.
-
- 4. F (Default F+) Turns formatting on and off. This
- directive goes into effect immediately after the comment
- in which it is placed and save carefully hand-formatted
- portions of a program.
-
- 5. O (Numeric directive, default O=78) Specifies the width
- of the output line. The maximum value allowed is 127
- character. If a particular token will not fit in the
- width specified, the line will be lengthened
- accordingly, and a message at the end of the formatting
- will give the number of times the width was exceeded and
- the output line number of the first occurrence.
-
- 6. P (Default P-) Sets "portability mode" formatting, which
- removes break characters (_) from identifiers. The
- first letter of each identifier, and the first letter
- following each break character will be made upper case,
- while the remaining characters will be in lower case.
- This directiver overrides the U directive. The R
- directive sets the case of reserved words.
-
- Warning: Turbo Pascal considers the break character
- significant: User_DoesThis is a different identifier
- than UserDoes_This. Take care when using this directive
- that you do not make two different identifiers the same.
-
- 7. R (no default) R+ specifies that all reserved words are
- converted to upper case; R- specifies that they will be
- converted to lower case. If this directive is not
- specified, the reserved words will be a literal copy of
- the input.
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users manual Page 5
-
-
-
-
-
-
-
-
- 8. S (Numeric directive, default S=1) Specifies the number
- of statements per line. The space from the current
- indention level to the end of the line is divided into
- even pieces, and successive statements are put on the
- boundaries of successive pieces. A statement may take
- more than one piece, in which case the next statement
- again goes on the boundary of the next piece. This is
- similar to the tabbing of a typewriter.
-
- 9. T (Numeric directive, default T=2) Specifies the amount
- to "tab" for each indentation level. Statements that
- continue on successive lines will be additionally
- indented by half the value of T.
-
- 10. U (no default) U+ specifies that identifiers are
- converted to upper case; U- specifies that they will be
- converted to lower case. If this directive is not
- specified, the identifiers will be a literal copy of the
- input. The P directive override this directive.
-
-
-
- 6.0 LIMITATIONS AND ERRORS
-
- PM is limited in the following ways:
-
- 1. The maximum input line length is 127 characters.
-
- 2. The maximum output length is 127 characters.
-
- 3. Only syntactically correct statements are formatted. A
- syntax error in the code will cause the formatting to
- abort. An error message will give the input line number
- on which the error is detected. The error checking is
- not perfect, and successful formatting is no guarantee
- that the program will compile.
-
- 4. The number of indentation levels handled by PM is
- limited; PM will abort if this number is exceeded -- a
- rare circumstance.
-
- 5. If a comment will drequire more than the maximum output
- length (127) to meet the rules given, processing will be
- aborted. This situation should be even rarer than
- identation-level problems.
-
- 6. When PM aborts, it deletes the output file. The input
- file is not altered.
-
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users manual Page 6
-
-
-
-
-
-
- file is not altered.
-
-
-
-
-
-
-
-
-
- PasMat version 1.0 Users