home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
capp.zip
/
CAPP.DOC
next >
Wrap
Text File
|
1991-04-25
|
10KB
|
207 lines
CAPP 1.0 page 1
'C' and PASCAL Print and Check version 1.0 January 1988
CAPP (tm)
SOONER SOFTWARE INC.
c/o Richard Tooley
1313 Buckingham Pl.
Richardson, Texas 75081
phone (214) 690-5287
CAPP is a user supported program distributed through various shareware
outlets. A fee of $7.95 is required for its continued use. Please send
this amount to Richard Tooley at the above address.
CAPP (tm) Copyright (c) 1988 by Richard Tooley, Sooner Software (tm).
All rights reserved.
Introduction to CAPP
CAPP is an easy to use utility program which executes on an IBM or IBM
compatible PC using DOS 2.x or 3.x. This program aids the 'C' and PASCAL
programmer in finding common and frustrating errors. CAPP will produce a
pretty output for "C" and PASCAL source programs. Visual aids are
included to inhance reading and error checking. Source lines are
optionally numbered. Begin and End block language indicators are marked
and block contents are outlined. They are also checked for balance.
Comments are marked and checked. Nested comments can be allowed or
flagged as an error as specified. Simple syntax and probable semantic
errors are optionally flagged.
CAPP 1.0 page 2
Output and Error Files
CAPP produces an "out file" and an "error file". The The "out file"
contains a pretty print of the 'C' or PASCAL program. It also contains
visual aids for blocks, comments and possible errors. Nine simple
semantic error checks are made. Some are just intended to bring the
programmers attention to a situation that may not be what is desired.
Block structures are outlined and numbered. Continuing comment lines are
marked with a (") for easy identification. CAPP reserves columns at the
begining of each 80 column output line for this purpose, see figure 1.
After these fields the source statement field appears. If the statement
field will not fit in the remaining columns, it is split on a word
boundary and carried into the next line. In this case a split-line
symbol (+) will appear in column 2. The first block indicator appears in
column 3. All nested blocks appear in the next column to the right of
their closest outter block. Therefore, the maximum columns needed by
CAPP depends upon the level of nested blocks. CAPP tries to preserve the
original appearance of the source. Leading and embedded spaces are
preserved. CAPP indents only 1 space for each nested block, see figure
1. If optional line numbers are selected, the first 6 columns are
reserved.
The error file contains the line number of source lines which have an
error or a probable error.
Refering to figure 1, the comment line (") and error (?) indicator appear
in column 1, or in column 7 if source line numbers are selected. This
indicator singals that the comment in the previous line extends to each
contiguous following line which has the indicator. Next, in column 2, is
the split line indicator (+) which indicates that the previous source
line had to be split and this line contains the split portion. The
indicator for block 1 appears in column 3 or 9 with line numbers. In the
remaining columns the nested block indicators appear and then the source
statement. If optional source line numbers are specified, they will
occupy the first 6 columns of the output line as "nnnn) ". That is, 4
digits, a right parenthesis, and a space. Therefore, 6 should be added
to the column numbers in figure 1 as is done in the second numeric line
of figure 1. The first numeric line are column numbers without the
source line count.
1 2 3 4 5 6 7
1 7 8 9 10 11 12 13. . . source satatment
| | | | | | | |
nnnn) comment " | block 1 | nest 3 | |
| or error ? | nest 2 | nest 5 . . .
| | |
line number split-line + nest 4
Figure 1, Reserved output columns used by CAPP.
CAPP 1.0 page 3
Source Error Checks
CAPP checks for or aids in finding the following mistakes:
1: No terminating double quote on string.
2: Too many characters or no terminating quote on an ascii character.
3: Nested comments.
4: End comment marker with no begin marker.
5: Unbalanced block markers, too many end blocks.
6: Unbalanced parenthesis in clause.
7: No statement after IF clause.
8: No statement after while/for clause.
9: For clause semicoln count not equal to 3.
10: Unbalanced begin and end block indicators.
Visual block marking aids are used in the output so that blocks can
be clearly seen. Blocks are sequentially numbered. These numbers
are incremented when a begin block is encountered and decremented on
a block end. All blocks and are outlined and nested blocks are
indented to permit their outlining also.
11: Unclosed comments.
All comments which extend over one line are marked with a double
quote (") in cloumn 2. This allows comment lines to be easily seen.
Therefore, unclosed comments can be detected by a double quote mark
preceding a line that was not supposed to be part of a comment.
Items 1-9 will be indicated in the output file with a "?" in column 1.
Item 10 check is made by balancing start and end block indicators defined
in the 'C' or PASCAL language. Item 11 can be detected by inspecting the
output file for the continuing comment line indicator (") appearing on
source lines that were not intended to be commented..
Item 7 indicates that the flagged "if" clause in 'C' has a null statement
as illustrated below.
if(a == b) ;
This is done to bring the users attention to a probable error.
CAPP 1.0 page 4
Executing CAPP
Figure 2 represents a template for the CAPP execution line. Required
parameters are enclosed in angle brackets <>. Optional parameters are
enclosed in curly brackets. CAPP requires only 1 input parameter for its
execution. The remaining 6 parameters are optional. The brackets are
not to be entered. Press the enter key after the CAPP execution line is
typed into DOS. Again, brackets are not to be entered. When ever a
parameter is included all preceding parameters must be included. In other
words, parameters are positionally defined.
CAPP <in> {out} {y|n} {y|n} {y|n} {c|p} {ln}
Parameters are: 1 <in> : input file
2 {out} : output file, default <in>.out
3 {y | n} : yes/no, comment nesting
Default = yes.
4 {y | n} : y - check for a non null statement
following "while and for" clauses.
Default = n.
5 {y | n} : n - no line numbers wanted.
: y - line numbers wanted (default).
6 {c | p} : c - 'C' source language (default).
p - PASCAL source.
7 {ln} | starting line number, default = 1.
Figure 2, CAPP Input Parameters
The error output file name is not specified by the user. It is named for
the user by CAPP as described: <input file name less extension>.ERR.
The user can optionally enter the output file name in parameter 2 or let
CAPP name it as: <input file name less extension>.OUT
Example (1) Assume that the DOS command to execute CAPP is given as:
CAPP SOONER.C
The output file would then be named SOONER.OUT.
The error file would then be named SOONER.ERR.
CAPP 1.0 page 5
Executing CAPP (continued)
A y or Y in optional parameter 3 says that nested comments are to be
allowed and will suppress nested comments being flagged as errors. This
is the default condition. An n or N says that nested comments are not to
be allowed. They are then flagged as errors.
A y or Y for optional parameter 4 will cause all for and while clauses to
be flagged if a NULL statement follows the clause. That is,
"for(i=0; i<ou; i++);" would be flagged in 'C'.
A y or Y for optional parameter 5 will produce source line numbers. An n
or N will suppress them. Line numbers are produced by default.
Therefore, the yes answer is only needed when a greater parameter number
is present.
A c or C for optional parameter 6 says that the source code is 'C'
language. This is the default. A p or P says it is PASCAL.
Parameter number 7 is used to give a starting line number for source line
numbering when it is different than 1; 1 is the default.
CAPP (tm) Copyright (c) 1988 by Richard Tooley, Sooner Software (tm).
All rights reserved.