home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_PAS
/
SNAPPD21.ZIP
/
SNAP-P.DOC
< prev
next >
Wrap
Text File
|
1994-01-04
|
22KB
|
716 lines
@
SNAP-P (TM)
StaNdArd Printer for Pascal
COPYRIGHT (C) 1992, 1993 JAMES L. ALLISON ALL RIGHTS RESERVED
James L. Allison
Neptune Systems
1703 Neptune Lane
Houston, TX 77062
(713) 488-5722 Voice
(713) 486-0375 FAX
CompuServe (71565,303)
┌─────────┐
┌─────┴───┐ │ (R)
──│ │o │──────────────────
│ ┌─────┴╨──┐ │ Association of
│ │ │─┘ Shareware
└───│ o │ Professionals
──────│ ║ │────────────────────
└────╨────┘ MEMBER
About This Document
This file (SNAP-P.DOC) is meant to be read on screen and contains
graphic characters that are difficult to print. If you want a hard
copy of this document and have trouble printing it, print SNAP-P.PRN,
which contains no graphics. SNAP-P.PRN can be generated by the Make
Printable Copy menu option described later.
Why Use SNAP-P
Rapid evaluation, cost savings and debugging ease are the main reasons
for using a standard printer. If you are working with a group of
programmers, a standard source code format makes reading, managing,
integrating and maintaining your product far less expensive and more
reliable. Everyone can read everyone else's code. Turnover becomes
less of a headache. If you import code from outside ( another
department, a technical journal or a BBS ) the ability to snap that
code into your own format is critical for evaluation. If you are
working alone a standard printer gets all of your source into a format
that you will be able to read months after you forgot why you wrote it
in the first place. If you are in school a standard printer will give
your reports the professional look that instructors respect.
The biggest advantage is that structural errors in a program appear
instantly in a listing that has uniform indentation and
capitalization. It is far easier to write error-free code when you
can see what you are doing. The best debugger is a standard printer.
About SNAP-P
For safety, SNAP-P will not change the original source file unless
told to. Even then, a backup copy will be made first. The newly
structured source text will be placed in a file with the same name as
the original and the default extension '.SNP'. The Resulting
formatted code is shown beside the original on your screen for easy
comparison. If you like the results and you have not told SNAP-P to
change the source, you can replace the original '.PAS' file with the
new file yourself.
SNAP-P reformats a Pascal program by adjusting margins and internal
spacing, and using standard capitalization for all keywords and
identifiers. You may specify capitalization by either rules or by
table lookup. If you choose "rules" (rather than "table") the
standard capitalization is used. You can specify which standards and
use different rules for keywords and identifiers. If you choose table
lookup an optional dictionary of standard capitalization is maintained
by SNAP-P. String literals and comments are never changed.
Page 2
Installation
Copy the SNAP-P.EXE and SNAP-P.DOC files to the same directory on
your hard disk. If you want to execute from anywhere in the
system you need to make sure it is in the PATH.
If you want to use SNAP-P as a tool in a Borland(R) product, do
the following:
1 Start the Borland product
2 Under the Options|Tools menu select New
3 On the resulting form enter:
Title : ~S~NAP-P
Program Path : Enter the full path name of SNAP-P.EXE
Command Line : $EDNAME $SAVE ALL
Hot Keys : Pick an available Hot Key (optional).
4 Click OK
Removal
If you decide that you don't want to keep SNAP-P on your system,
delete SNAP-P.* from the directory where you placed SNAP-P.EXE.
If you have changed your PATH or modified any tools menus these
will also need to be returned to their original state.
Page 3
Using SNAP-P
The command line syntax is:
SNAP-P [[path]filename.ext]
Example: SNAP-P myprog.pas
SNAP-P is a Turbo Vision(R) application, so if you are familiar
with the Borland interface you should have no problems.
If you use a mouse the interface is standard with pull down
menus, check boxes, radio buttons and text entry boxes.
If you prefer a keyboard, press F10 to highlight the menu bar and
use the arrow and tab keys to move around. Use the space bar to
toggle check boxes. You may also use Alt-?, where ? is the
highlighted letter on the menu bar. The status bar at the bottom
of the screen gives some helpful keystrokes to get you started.
This manual is available from within SNAP-P by pressing F1.
The number in the lower right corner of the screen is the
available memory. Keep an eye on this, especially when working
with large files.
1. Install SNAP-P and start it as described above.
2. Open a file using the Open option on the File pull-down
menu. (You may need to use the Change dir... option to
locate the desired file.)
3. Set capitalization rules. The rules stay in effect for each
file you reformat until explicitly changed.
4. Set options to use. The options stay in effect for each
file you reformat until explicitly changed.
5. Re-format the code.
You may repeat these steps as needed to achieve the desired
results.
Page 4
Explanation of Menu Options
The menu bar has four pull-down items. These are:
File Window Control About
Under File:
Open: Open a file (directory menu provided)
Change Dir: Change working directory (directory tree
traversal)
Exit: Exit SNAP-P
Under Window:
Tile: Tile open windows
Cascade: Cascade open windows
Next: Make next window active
Zoom: Zoom in or out on active window
Under Control:
Punctuation: Set space before and after punctuation
Capitalization Rules:
Set capitalization rules.
Options: Set options
SNAP-P Source: Re-format source in active window
Replace Original File
Replace original file with new text.
A backup copy will be made of the original.
Under About:
Registration: Create a registration form.
Product Support:
Where to get support.
Ombudsman: ASP contact for help
Copyright: Copyright notice
View Manual: Display this manual in a window
Make Printable Copy:
Create a file with this manual in an all
text format (no graphics characters)
Page 5
The Punctuation dialog box is used to control spacing around
certain punctuation marks. The default settings are shown.
╔═[■]══════════ Punctuation ═══════════════╗
║ Insert Space (if needed) ║
║ Before After Before After ║
║ [X] = [X] [X] + [X] ║
║ [X] < [X] [X] - [X] ║
║ [X] > [X] [X] / [X] ║
║ [X] <> [X] [X] * [X] ║
║ [X] <= [X] ║
║ [X] >= [X] [ ] ( [ ] ║
║ [ ] ) [ ] ║
║ [X] := [X] [ ] (. [ ] ║
║ [ ] ; [X] [ ] .) [ ] ║
║ [ ] : [ ] [ ] [ [ ] ║
║ [ ] , [X] [ ] ] [ ] ║
║ [X] .. [X] ║
║ Ok ▄ Cancel ▄ ║
║ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ║
╚══════════════════════════════════════════╝
For example, the above selection causes a space to be inserted
after a semicolon if there isn't one there already. Spaces will
only be inserted if necessary, and spaces will never be deleted.
Page 6
There are two blocks under Capitalization Rules, one for reserved
words and one for identifiers. Each of these blocks contains
four radio buttons, or mutually exclusive choices. The default
settings are shown. These are:
╔═[■]═════════ Cap Rules ══════════════╗
║ ║
║ Reserved Word Identifier ║
║ ( ) Upper ( ) Upper ║
║ () Lower ( ) Lower ║
║ ( ) Cap () Cap ║
║ ( ) Ignore ( ) Ignore ║
║ ║
║ [X] Treat directives as reserved ║
║ ║
║ Ok ▄ Cancel ▄ ║
║ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ║
╚══════════════════════════════════════╝
Upper All upper case (example: MY_VARIABLE).
Lower All lower case (example: my_variable).
Cap First letter and all letters following
an underscore are upper case, others
in lower case (example: My_Variable).
Ignore Do not change.
Directives (virtual, forward, etc.) are not reserved words, but many
programmers treat them as such. Check the box if you want to treat
directives as reserved words. If you do not check the box they will
be treated as identifiers.
Page 7
The default settings for the choices under Options are:
╔═[■]══════════ Options ═══════════════╗
║ ║
║ Adjust Capitals ║
║ [X] Spacing ( ) Table ║
║ [X] Capitals () Rules ║
║ ║
║ Save File Extension .SNP ║
║ Backup Extension .SBU ║
║ ║
║ Indent Spaces 3 ║
║ ║
║ [X] Break Line Length 72 ║
║ ║
║ Filler * ║
║ ║
║ Ok ▄ Cancel ▄ ║
║ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ║
╚══════════════════════════════════════╝
Adjust: Select whether to adjust spacing
and capitalization
Capitals: Select whether capitalization is
performed using a dictionary or
using the rules specified in the
Capitalization Rules dialog.
(Rules are easier to use, but the
table gives you more control.)
Save File Extension: Used to form the name of the
output file.
Backup Extension Used to form the name of the
source backup file. This is used
only in the "Replace Original File"
operation.
Indent Spaces: The number of spaces to indent for
each level of block nesting.
Break Line: The break line is a highly visible
comment that separates procedures
and functions. Turn this off if
you don't like the looks.
Length Total length of break line.
Filler Fill character used to form
break line.
Page 8
About the Dictionary
You may want to use table lookup instead of rules for
capitalization. For most applications the rules will suffice,
but there are cases where you need more control. For example,
'ReadLn', 'cmCancel', 'FileName' and so on follow no particular
rules, but you want a standard appearance. This is what the
dictionary is for. Each word in the source file is capitalized
according to the dictionary. When a new word is found, you will
be prompted for the capitalization. You cannot change the
spelling, only the looks of the word. If you enter just a
return, the name will be used as is. The dictionary is kept as a
text file named SNAP-P.CAP, so you can edit it whenever you like.
The words must be kept in alphabetical order. The order in the
dictionary is not case sensitive. If you need to change the
looks of a word in the dictionary use any editor to do so, but do
not change its location. Do not use a word processor that might
introduce extra characters into the file. Use a simple text editor
instead.
Protecting Blocks
There are times when you want to protect a block of code from any
reorganization. This is especially true for tabular layout. A block
can be protected from spacing adjustment by placing {-s} alone on one
line. Spacing adjustment is turned back on by placing {+s} alone on a
line. Similarly, {-c} and {+c} control capitalization. Echo mode
turns SNAP-P off entirely. A {+e} starts echo mode. From that point
on the text is simply copied to the output. It is not even scanned,
except to look for a line containing only {-e}, which turns echo mode
off. Since echo mode turns off all parsing, echo mode must respect the
Pascal block structure. If, for example echo mode includes a "begin"
but not the matching "end" the indent structure will be incorrect.
All of these must appear by themselves on a line. These are not case
sensitive.
Page 9
Definition of Shareware
Shareware distribution gives users a chance to try software before
buying it. If you try a Shareware program and continue using it, you
are expected to register.
Copyright laws apply to both Shareware and commercial software, and
the copyright holder retains all rights, with a few specific
exceptions as stated below. Shareware authors are accomplished
programmers, just like commercial authors, and the programs are of
comparable quality. (In both cases, there are good programs and bad
ones!) The main difference is in the method of distribution. The
author specifically grants the right to copy and distribute the
software, either to all and sundry or to a specific group. For
example, some authors require written permission before a commercial
disk vendor may copy their Shareware.
Shareware is a distribution method, not a type of software. You should
find software that suits your needs and pocketbook, whether it's
commercial or Shareware. The Shareware system makes fitting your needs
easier, because you can try before you buy. And because the overhead
is low, prices are low also. Shareware has the ultimate money-back
guarantee -- if you don't use the product, you don't pay for it.
Disclaimer - Agreement
Users of SNAP-P must accept this disclaimer of warranty: "SNAP-P is
supplied as is. The author disclaims all warranties, expressed or
implied, including, without limitation, the warranties of
merchantability and of fitness for any purpose. The author assumes no
liability for damages, direct or consequential, which may result
from the use of SNAP-P."
SNAP-P is a "shareware program" and is provided at no charge to the
user for evaluation. Feel free to share it with your friends, but
please do not give it away altered or as part of another system. The
essence of "user-supported" software is to provide personal computer
users with quality software without high prices, and yet to provide
incentive for programmers to continue to develop new products. If you
find this program useful and find that you are using SNAP-P and
continue to use SNAP-P after a reasonable trial period, you must make
a registration payment of $27.00 to Neptune Systems. The $27.00
registration fee will license one copy for use on any one computer at
any one time. You must treat this software just like a book. An
example is that this software may be used by any number of people and
may be freely moved from one computer location to another, so long as
there is no possibility of it being used at one location while it's
being used at another. Just as a book cannot be read by two different
persons at the same time.
Commercial users of SNAP-P must register and pay for their copies of
SNAP-P within 30 days of first use or their license is withdrawn.
Site-License arrangements may be made by contacting Neptune Systems.
Page 10
Anyone distributing SNAP-P for any kind of remuneration must first
contact Neptune Systems at the address above for authorization. This
authorization will be automatically granted to distributors recognized
by the (ASP) as adhering to its guidelines for shareware distributors,
and such distributors may begin offering SNAP-P immediately (However
Neptune Systems must still be advised so that the distributor can be
kept up-to-date with the latest version of SNAP-P.)
You are encouraged to pass a copy of SNAP-P along to your friends for
evaluation. Please encourage them to register their copy if they find
that they can use it. All registered users will receive a copy of the
latest version of the SNAP-P system without the registration reminder
at the beginning and end. They will also receive a utility that
provides a visual map of available hard disk space on their system and
a 'LostFile' program with better pattern matching facility than the
DOS wildcard scheme. They will also receive free technical support via
U.S. mail, CompuServe electronic mail or telephone for a period of six
months after registration.
Ombudsman
This program is produced by a member of the Association of
Shareware Professionals (ASP). ASP wants to make sure that the
shareware principle works for you. If you are unable to resolve a
shareware-related problem with an ASP member by contacting the
member directly, ASP may be able to help. The ASP Ombudsman can
help you resolve a dispute or problem with an ASP member, but
does not provide technical support for members' products. Please
write to the ASP Ombudsman at 545 Grover Road, Muskegon, MI
49442-9427 USA, FAX 616-788-2765 or send a CompuServe message via
CompuServe Mail to ASP Ombudsman 70007,3536.
Page 11
(End)
@