home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / capp.zip / CAPP.DOC next >
Text File  |  1991-04-25  |  10KB  |  207 lines

  1.                                                            CAPP 1.0   page 1
  2.  
  3.         'C' and PASCAL Print and Check  version 1.0  January 1988
  4.  
  5.                                  CAPP (tm)
  6.  
  7.                            SOONER SOFTWARE INC.
  8.                            c/o  Richard Tooley
  9.                            1313 Buckingham Pl.
  10.                            Richardson, Texas 75081
  11.  
  12.                            phone (214) 690-5287
  13.  
  14. CAPP is a user supported program distributed  through  various  shareware 
  15. outlets.  A fee of  $7.95 is required for its continued use. Please send 
  16. this amount to Richard Tooley at the above address.
  17.  
  18. CAPP (tm) Copyright (c) 1988 by Richard Tooley,  Sooner Software (tm).
  19. All rights reserved.
  20.  
  21.  
  22.                            Introduction to CAPP 
  23.  
  24. CAPP  is  an  easy to use utility program which executes on an IBM or IBM 
  25. compatible PC using DOS 2.x or 3.x.  This program aids the 'C' and PASCAL 
  26. programmer in finding common and frustrating errors.  CAPP will produce a 
  27. pretty output for  "C"  and  PASCAL  source  programs.  Visual  aids  are 
  28. included  to  inhance  reading  and  error  checking.  Source  lines  are 
  29. optionally numbered.  Begin and End block language indicators are  marked 
  30. and  block  contents  are  outlined.  They  are also checked for balance.  
  31. Comments are marked and  checked.  Nested  comments  can  be  allowed  or 
  32. flagged  as  an  error as specified.  Simple syntax and probable semantic 
  33. errors are optionally flagged.  
  34.  
  35.                                                            CAPP 1.0   page 2
  36.                           Output and Error Files
  37.  
  38.  
  39. CAPP produces an "out file" and an  "error  file".  The  The  "out  file" 
  40. contains  a  pretty print of the 'C' or PASCAL program.  It also contains 
  41. visual aids  for  blocks,  comments  and  possible  errors.  Nine  simple 
  42. semantic  error  checks  are  made.  Some  are just intended to bring the 
  43. programmers attention to a situation that may not  be  what  is  desired.  
  44. Block structures are outlined and numbered.  Continuing comment lines are 
  45. marked with a (") for easy identification.  CAPP reserves columns at  the 
  46. begining  of  each 80 column output line for this purpose,  see figure 1.  
  47. After these fields the source statement field appears.  If the  statement 
  48. field  will  not  fit  in  the  remaining columns,  it is split on a word 
  49. boundary and carried into the  next  line.  In  this  case  a  split-line 
  50. symbol (+) will appear in column 2.  The first block indicator appears in 
  51. column 3.  All nested blocks appear in the next column to  the  right  of 
  52. their  closest  outter  block.  Therefore,  the maximum columns needed by 
  53. CAPP depends upon the level of nested blocks.  CAPP tries to preserve the 
  54. original appearance of  the  source.  Leading  and  embedded  spaces  are 
  55. preserved.  CAPP  indents only 1 space for each nested block,  see figure 
  56. 1.  If optional line numbers  are  selected,  the  first  6  columns  are 
  57. reserved.  
  58.  
  59. The error file contains the line number of  source  lines which  have  an 
  60. error or a probable error.  
  61.  
  62. Refering to figure 1, the comment line (") and error (?) indicator appear 
  63. in column 1,  or in column 7 if source line numbers  are  selected.  This 
  64. indicator  singals  that the comment in the previous line extends to each 
  65. contiguous following line which has the indicator.  Next, in column 2, is 
  66. the split line indicator (+) which indicates  that  the  previous  source 
  67. line  had  to  be  split  and  this line contains the split portion.  The 
  68. indicator for block 1 appears in column 3 or 9 with line numbers.  In the 
  69. remaining columns the nested block indicators appear and then the  source 
  70. statement.  If optional source line  numbers  are  specified,  they  will 
  71. occupy  the  first 6 columns of the output line as "nnnn) ".  That is,  4 
  72. digits, a right parenthesis,  and a space.  Therefore,  6 should be added 
  73. to  the  column numbers in figure 1 as is done in the second numeric line 
  74. of figure 1.  The first numeric  line  are  column  numbers  without  the 
  75. source line count.  
  76.  
  77.  
  78.          1        2      3       4       5     6     7
  79. 1        7        8      9      10      11    12    13. . . source satatment
  80. |        |        |      |       |       |     |     |      
  81. nnnn)  comment "  |   block 1    |     nest 3  |     |      
  82. |      or error ? |            nest 2          |   nest 5 . . . 
  83. |                 |                            |
  84. line number   split-line +                   nest 4 
  85.  
  86.  
  87.              Figure 1, Reserved output columns used by CAPP.
  88.  
  89.                                                            CAPP 1.0   page 3
  90.  
  91.  
  92.                            Source Error Checks
  93.  
  94. CAPP checks for or aids in finding the following mistakes:
  95.  
  96. 1:  No terminating double quote on string. 
  97. 2:  Too many characters or no terminating quote on an ascii character.
  98. 3:  Nested comments.
  99. 4:  End comment marker with no begin marker.
  100. 5:  Unbalanced block markers, too many end blocks.
  101. 6:  Unbalanced parenthesis in clause.
  102. 7:  No statement after IF clause.
  103. 8:  No statement after while/for clause.
  104. 9:  For clause semicoln count not equal to 3.
  105.  
  106. 10: Unbalanced begin and end block indicators.  
  107.     Visual  block  marking aids are used in the output so that blocks can 
  108.     be clearly seen.  Blocks are  sequentially  numbered.  These  numbers 
  109.     are  incremented when a begin block is encountered and decremented on 
  110.     a block end.  All blocks and  are  outlined  and  nested  blocks  are 
  111.     indented to permit their outlining also.  
  112.  
  113. 11: Unclosed comments. 
  114.     All comments which extend over one line  are  marked  with  a  double 
  115.     quote  (") in cloumn 2.  This allows comment lines to be easily seen.  
  116.     Therefore,  unclosed comments can be detected by a double quote  mark 
  117.     preceding a line that was not supposed to be part of a comment.  
  118.  
  119. Items  1-9  will  be indicated in the output file with a "?" in column 1.  
  120. Item 10 check is made by balancing start and end block indicators defined 
  121. in the 'C' or PASCAL language.  Item 11 can be detected by inspecting the 
  122. output  file  for  the continuing comment line indicator (") appearing on 
  123. source lines that were not intended to be commented..  
  124.  
  125. Item 7 indicates that the flagged "if" clause in 'C' has a null statement 
  126. as illustrated below.
  127.                        if(a == b) ;
  128. This is done to bring the users attention to a probable error.
  129.  
  130.                                                            CAPP 1.0   page 4
  131.  
  132.  
  133.                               Executing CAPP
  134.  
  135. Figure 2 represents a template for  the  CAPP  execution  line.  Required 
  136. parameters  are  enclosed  in angle brackets <>.  Optional parameters are 
  137. enclosed in curly brackets.  CAPP requires only 1 input parameter for its 
  138. execution.  The remaining 6 parameters are  optional.  The  brackets  are 
  139. not to be entered.  Press the enter key after the CAPP execution line  is 
  140. typed  into  DOS.  Again,  brackets  are  not to be entered.  When ever a 
  141. parameter is included all preceding parameters must be included. In other 
  142. words, parameters are positionally defined.  
  143.  
  144.   CAPP  <in> {out} {y|n} {y|n} {y|n} {c|p} {ln}              
  145.                                                              
  146.   Parameters are:  1     <in>  : input file                  
  147.                    2    {out}  : output file, default <in>.out
  148.                    3   {y | n} : yes/no, comment nesting     
  149.                                  Default = yes.              
  150.                    4   {y | n} : y - check for a non null statement 
  151.                                  following "while and for" clauses.    
  152.                                  Default = n. 
  153.                    5   {y | n} : n - no line numbers wanted.
  154.                                : y - line numbers wanted (default).
  155.                    6   {c | p} : c - 'C' source language (default).
  156.                                  p - PASCAL source.
  157.                    7   {ln}    | starting line number, default = 1.
  158.  
  159.  
  160.                      Figure 2, CAPP Input Parameters
  161.  
  162.  
  163.  
  164.  
  165.  
  166. The error output file name is not specified by the user.  It is named for 
  167. the user by CAPP as described:   <input file name less extension>.ERR.  
  168.  
  169. The user can optionally enter the output file name  in parameter 2 or let 
  170. CAPP name it as:   <input file name less extension>.OUT 
  171.  
  172. Example (1) Assume that the DOS command to execute CAPP is given as:
  173.             CAPP SOONER.C 
  174.             The output file would then be named SOONER.OUT.
  175.             The error  file would then be named SOONER.ERR.
  176.  
  177.                                                            CAPP 1.0   page 5
  178.  
  179.  
  180.                         Executing CAPP (continued)
  181.  
  182.  
  183. A  y  or  Y  in  optional parameter 3 says that nested comments are to be 
  184. allowed and will suppress nested comments being flagged as  errors.  This 
  185. is the default condition.  An n or N says that nested comments are not to 
  186. be allowed.  They are then flagged as errors.  
  187.  
  188. A y or Y for optional parameter 4 will cause all for and while clauses to 
  189. be flagged if a NULL statement follows the  clause.  That  is,  
  190. "for(i=0; i<ou; i++);"   would be flagged in 'C'.  
  191.  
  192. A y or Y for optional parameter 5 will produce source line numbers.  An n 
  193. or  N  will  suppress  them.   Line  numbers  are  produced  by  default.  
  194. Therefore,  the yes answer is only needed when a greater parameter number 
  195. is present.  
  196.  
  197. A c or C for optional parameter 6 says that the source code is 'C' 
  198. language. This is the default. A p or P says it is PASCAL.
  199.  
  200. Parameter number 7 is used to give a starting line number for source line 
  201. numbering when it is different than 1;  1 is the default.
  202.  
  203.  
  204.  
  205. CAPP (tm) Copyright (c) 1988 by Richard Tooley,  Sooner Software (tm).
  206. All rights reserved.
  207.