home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / style / styledoc.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  17.7 KB  |  897 lines

  1. ::::::::::
  2. style_doc.dis
  3. ::::::::::
  4. -- Copy from the VAX directory : USER1:[powers.nosc.doc]maintman.mem
  5. maintman.doc
  6. ::::::::::
  7. maintman.doc
  8. ::::::::::
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                                  STYLE CHECKER
  16.  
  17.  
  18.  
  19.                This document  describes  a  general  overview  of  the
  20.  
  21.           structure of the Ada Style Checker's package structure.  The
  22.  
  23.           description includes information that will be  of  value  in
  24.  
  25.           understanding  the  interaction  of  the  software  and  the
  26.  
  27.           interfaces necessary for the software to function  properly.
  28.  
  29.           This  document  should  also serve as a guide for any future
  30.  
  31.           maintenance that may become necessary or desired.
  32.  
  33.  
  34.  
  35.                The following list  is  a  list  of  the  source  files
  36.  
  37.           required  to  build  the  Style Checker.  They are listed in
  38.  
  39.           compilation order
  40.  
  41.  
  42.  
  43.           1.  DYN.ADA - DYN (dynamic  string)  package  (specification
  44.  
  45.               and body)
  46.  
  47.  
  48.  
  49.           2.  FILE_SPEC.ADA - FILE_HANDLING package specification
  50.  
  51.  
  52.  
  53.           3.  TOKENIZER_SPEC.ADA - TOKENIZER package specification
  54.  
  55.  
  56.  
  57.           4.  STYLE_PARAM_SPEC.ADA    -    STYLE_PARAMETERS    package
  58.  
  59.               specification
  60.  
  61.  
  62.  
  63.           5.  REPORT_GEN_SPEC.ADA    -    REPORT_GENERATOR     package
  64.  
  65.               specification
  66.  
  67.  
  68.  
  69.           6.  STACK_PACKAGE.ADA - STACK_PACKAGE package (specification
  70.  
  71.               and body)
  72.  
  73.  
  74.  
  75.           7.  TOKEN_DEFINITION.ADA    -    TOKEN_DEFINITION    package
  76.  
  77.               (specification and body)
  78.  
  79.  
  80.  
  81.           8.  MANAGER.ADA - MANAGER package (specification and body)
  82.  
  83.  
  84.  
  85.           9.  HELP_FILE_SPEC.ADA - HELP package specification
  86.  
  87.  
  88.  
  89.          10.  COMMAND_LINE.ADA    -    COMMAND_LINE_HANDLER    package
  90.  
  91.               (specification and body)
  92.  
  93.  
  94.  
  95.          11.  HELP_FILE_SPEC.ADA - HELP package specification
  96.  
  97.  
  98.  
  99.          12.  HELP_FILE_BODY.ADA - HELP package body
  100.  
  101.  
  102.  
  103.          13.  HELP_INFO_SPEC.ADA - HELP_INFO package specification
  104.  
  105.  
  106.  
  107.          14.  HELP_INFO_BODY.ADA - HELP_INFO package body
  108.  
  109.  
  110.  
  111.          15.  HELP_DIS_ALL.ADA - a separate procedure in HELP_UTILITY
  112.  
  113.  
  114.  
  115.          16.  HELP_EXIT.ADA - a separate procedure in HELP_UTILITY
  116.  
  117.  
  118.  
  119.          17.  HELP_FIND.ADA - a separate procedure in HELP_UTILITY
  120.  
  121.                                                                 Page 2
  122.  
  123.  
  124.  
  125.  
  126.  
  127.          18.  HELP_GET.ADA - a separate procedure in HELP_UTILITY
  128.  
  129.  
  130.  
  131.          19.  HELP_INIT.ADA - a separate procedure in HELP_UTILITY
  132.  
  133.  
  134.  
  135.          20.  HELP_ME.ADA - a separate procedure in HELP_UTILITY
  136.  
  137.  
  138.  
  139.          21.  HELP_MENU.ADA - a separate procedure in HELP_UTILITY
  140.  
  141.  
  142.  
  143.          22.  HELP_PROMPT.ADA - a separate procedure in HELP_UTILITY
  144.  
  145.  
  146.  
  147.          23.  HELP_RESET.ADA - a separate procedure in HELP_UTILITY
  148.  
  149.  
  150.  
  151.          24.  HELP_TEXT.ADA - a separate procedure in HELP_UTILITY
  152.  
  153.  
  154.  
  155.          25.  FILE_BODY.ADA - FILE_HANDLING package body
  156.  
  157.  
  158.  
  159.          26.  TOKENIZER_BODY.ADA - TOKENIZER package body
  160.  
  161.  
  162.  
  163.          27.  INSERT.ADA - A separate procedure in the TOKENIZER
  164.  
  165.  
  166.  
  167.          28.  IS_A_RESERVED_WORD.ADA - A  separate  procedure  in  the
  168.  
  169.               TOKENIZER
  170.  
  171.  
  172.  
  173.          29.  RESERVED_WORD.ADA  -  A  separate   procedure   in   the
  174.  
  175.               TOKENIZER
  176.  
  177.  
  178.  
  179.          30.  NEXT_CHARACTER.ADA  -  A  separate  procedure   in   the
  180.  
  181.               TOKENIZER
  182.  
  183.  
  184.  
  185.          31.  NEXT_IDENTIFIER.ADA  -  A  separate  procedure  in   the
  186.  
  187.               TOKENIZER
  188.  
  189.  
  190.  
  191.          32.  BUILD_TOKENS.ADA - A separate procedure in the TOKENIZER
  192.  
  193.  
  194.  
  195.          33.  LINE_CONTAINING.ADA  -  A  separate  procedure  in   the
  196.  
  197.               TOKENIZER
  198.  
  199.  
  200.  
  201.          34.  TREE_ROOT.ADA - A separate procedure in the TOKENIZER
  202.  
  203.  
  204.  
  205.          35.  STYLE_PARAM_BODY.ADA - STYLE_PARAMETERS package body
  206.  
  207.  
  208.  
  209.          36.  REPORT_GEN_BODY.ADA - REPORT_GENERATOR package body
  210.  
  211.  
  212.  
  213.          37.  STYLE_CHECKER.ADA - main procedure (STYLE_CHECKER)
  214.  
  215.  
  216.  
  217.          38.  BEGIN_OF_LINE_INDENT.ADA - A separate procedure  in  the
  218.  
  219.               STYLE_CHECKER
  220.  
  221.  
  222.  
  223.          39.  CHECK_STATEMENTS.ADA  -  A  separate  procedure  in  the
  224.  
  225.               STYLE_CHECKER
  226.  
  227.  
  228.  
  229.          40.  CHECK_END_OF_BLOCKS.ADA - A separate  procedure  in  the
  230.  
  231.               STYLE_CHECKER
  232.  
  233.                                                                 Page 3
  234.  
  235.  
  236.  
  237.  
  238.  
  239.          41.  CHECK_THE_STYLE.ADA  -  A  separate  procedure  in   the
  240.  
  241.               STYLE_CHECKER
  242.  
  243.  
  244.  
  245.          42.  CHECK_FOR_ATTRIBUTE.ADA - A separate  procedure  in  the
  246.  
  247.               STYLE_CHECKER
  248.  
  249.  
  250.  
  251.          43.  CHECK_OBJECT_NAMES.ADA - A  separate  procedure  in  the
  252.  
  253.               STYLE_CHECKER
  254.  
  255.  
  256.  
  257.          44.  CHECK_UNIVERSAL.ADA  -  A  separate  procedure  in   the
  258.  
  259.               STYLE_CHECKER
  260.  
  261.  
  262.  
  263.          45.  COMMENT_TOKEN.ADA  -  A  separate   procedure   in   the
  264.  
  265.               STYLE_CHECKER
  266.  
  267.  
  268.  
  269.          46.  CURRENT_TOKEN.ADA  -  A  separate   procedure   in   the
  270.  
  271.               STYLE_CHECKER
  272.  
  273.  
  274.  
  275.          47.  ENTERING_BLOCK.ADA  -  A  separate  procedure   in   the
  276.  
  277.               STYLE_CHECKER
  278.  
  279.  
  280.  
  281.          48.  ENTERING_SUB_BLOCK.ADA - A  separate  procedure  in  the
  282.  
  283.               STYLE_CHECKER
  284.  
  285.  
  286.  
  287.          49.  EXITING_BLOCK.ADA  -  A  separate   procedure   in   the
  288.  
  289.               STYLE_CHECKER
  290.  
  291.  
  292.  
  293.          50.  GET_NEXT_TOKEN.ADA  -  A  separate  procedure   in   the
  294.  
  295.               STYLE_CHECKER
  296.  
  297.  
  298.  
  299.          51.  IS_STATEMENT.ADA  -  A   separate   procedure   in   the
  300.  
  301.               STYLE_CHECKER
  302.  
  303.  
  304.  
  305.          52.  LITERAL.ADA - A separate procedure in the STYLE_CHECKER
  306.  
  307.  
  308.  
  309.          53.  NEW_LINE_TOKEN.ADA  -  A  separate  procedure   in   the
  310.  
  311.               STYLE_CHECKER
  312.  
  313.  
  314.  
  315.          54.  NON_TRIVIAL_TOKEN.ADA -  A  separate  procedure  in  the
  316.  
  317.               STYLE_CHECKER
  318.  
  319.  
  320.  
  321.          55.  OBJECT_NAME.ADA  -   A   separate   procedure   in   the
  322.  
  323.               STYLE_CHECKER
  324.  
  325.  
  326.  
  327.          56.  RESERVE_WORD.ADA  -  A   separate   procedure   in   the
  328.  
  329.               STYLE_CHECKER
  330.  
  331.  
  332.  
  333.          57.  SEARCH_BACKWARD.ADA  -  A  separate  procedure  in   the
  334.  
  335.               STYLE_CHECKER
  336.  
  337.  
  338.  
  339.          58.  SEARCH_BACK_ONE_OF.ADA - A  separate  procedure  in  the
  340.  
  341.               STYLE_CHECKER
  342.  
  343.                                                                 Page 4
  344.  
  345.  
  346.  
  347.  
  348.  
  349.          59.  SEARCH_FORWARD.ADA  -  A  separate  procedure   in   the
  350.  
  351.               STYLE_CHECKER
  352.  
  353.  
  354.  
  355.          60.  SEARCH_FORE_ONE_OF.ADA - A  separate  procedure  in  the
  356.  
  357.               STYLE_CHECKER
  358.  
  359.  
  360.  
  361.          61.  TYPE_DECLARATION.ADA  -  A  separate  procedure  in  the
  362.  
  363.               STYLE_CHECKER
  364.  
  365.  
  366.  
  367.                                                                 Page 5
  368.  
  369.  
  370.  
  371.  
  372.  
  373.                                   THE PACKAGES
  374.  
  375.  
  376.  
  377.                In  the  next  section   each   package   is   outlined
  378.  
  379.           separately.  The packages are listed in compilation order.
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.                                   Package DYN
  388.  
  389.  
  390.  
  391.                This package is contained in the file DYN.ADA.  It is a
  392.  
  393.           dynamic  string  package,  modeled  after the dynamic string
  394.  
  395.           package described by Sylvan  Rubin  of  Ford  Aerospace  and
  396.  
  397.           Communications  Corporation in the Nov/Dec 1984 issue of the
  398.  
  399.           Journal of Pascal, Ada and Modula-2.  It is  primarily  used
  400.  
  401.           by  the  TOKENIZER package, but is used a little by most all
  402.  
  403.           of the packages in the STYLE_CHECKER.   A  possible  problem
  404.  
  405.           with   this   package   is   that   on   a  system  with  no
  406.  
  407.           UNCHECKED_DEALLOCATION and no automatic "garbage collection"
  408.  
  409.           of  access  objects  problems  with  heap size may arise.  A
  410.  
  411.           proposed  solution  is  to   change   the   dynamic   string
  412.  
  413.           representation.   Since  it  is  a  private type this should
  414.  
  415.           cause few problems with the rest of the system.
  416.  
  417.                                                                 Page 6
  418.  
  419.  
  420.  
  421.  
  422.  
  423.                              Package FILE_HANDLING
  424.  
  425.  
  426.  
  427.                This package is contained in the files
  428.  
  429.  
  430.  
  431.           1.  FILE_SPEC.ADA
  432.  
  433.  
  434.  
  435.           2.  FILE_BODY.ADA
  436.  
  437.  
  438.  
  439.           The   FILE_HANDLING    package    controls    the    initial
  440.  
  441.           identification and opening of the input and output files.
  442.  
  443.                                                                 Page 7
  444.  
  445.  
  446.  
  447.  
  448.  
  449.                                Package TOKENIZER
  450.  
  451.  
  452.  
  453.                The TOKENIZER package is  contained  in  the  following
  454.  
  455.           files:
  456.  
  457.  
  458.  
  459.           1.  TOKENIZER_SPEC.ADA
  460.  
  461.  
  462.  
  463.           2.  TOKENIZER_BODY.ADA
  464.  
  465.  
  466.  
  467.           3.  INSERT.ADA
  468.  
  469.  
  470.  
  471.           4.  IS_A_RESERVED_WORD.ADA
  472.  
  473.  
  474.  
  475.           5.  RESERVED_WORD.ADA
  476.  
  477.  
  478.  
  479.           6.  NEXT_CHARACTER.ADA
  480.  
  481.  
  482.  
  483.           7.  NEXT_IDENTIFIER.ADA
  484.  
  485.  
  486.  
  487.           8.  BUILD_TOKENS.ADA
  488.  
  489.  
  490.  
  491.           9.  LINE_CONTAINING.ADA
  492.  
  493.  
  494.  
  495.          10.  TREE_ROOT.ADA
  496.  
  497.  
  498.  
  499.  
  500.  
  501.           The TOKENIZER package  processes  the  Ada  input  file  and
  502.  
  503.           produces  tokens  to be processed by the subsequent packages
  504.  
  505.           of the Style Checker.  It also serves as  the  interface  to
  506.  
  507.           the  stream  of tokens.  All the calls to TEXT_IO GET's from
  508.  
  509.           the  input  files  are  localized  to   the   NEXT_CHARACTER
  510.  
  511.           function.
  512.  
  513.  
  514.  
  515.                This package  has  a  procedure  BUILD_TOKENS  that  is
  516.  
  517.           called first, and then the functions FIRST_TOKEN, NEXT_TOKEN
  518.  
  519.           and PREVIOUS_TOKEN  are  used  to  move  through  the  token
  520.  
  521.           stream.   Since  the TOKEN type is a private type changes in
  522.  
  523.           the internal  representation  of  TOKENs  should  cause  few
  524.  
  525.           problems with the other packages.
  526.  
  527.                                                                 Page 8
  528.  
  529.  
  530.  
  531.  
  532.  
  533.                            Package  STYLE_PARAMETERS
  534.  
  535.  
  536.  
  537.                The STYLE_PARAMETERS package is contained in the  files
  538.  
  539.           :
  540.  
  541.  
  542.  
  543.           1.  STYLE_PARAM_SPEC.ADA
  544.  
  545.  
  546.  
  547.           2.  STYLE_PARAM_BODY.ADA
  548.  
  549.  
  550.  
  551.  
  552.  
  553.                This package  contains  the  functions  and  procedures
  554.  
  555.           called  to get the parameters that drive the style checking.
  556.  
  557.           In   order   to    alter    the    parameters    the    file
  558.  
  559.           STYLE_PARAM_BODY.ADA  must  be  edited,  and  the  procedure
  560.  
  561.           SET_STYLE_PARAMETERS  must  be  altered   to   reflect   the
  562.  
  563.           appropriate  parameter(s).   For more information concerning
  564.  
  565.           the individual parameters and their meaning see  the  source
  566.  
  567.           code documentation and the on-line help facility.
  568.  
  569.                                                                 Page 9
  570.  
  571.  
  572.  
  573.  
  574.  
  575.                            Package   REPORT_GENERATOR
  576.  
  577.  
  578.  
  579.                This package is contained in the files:
  580.  
  581.  
  582.  
  583.           1.  REPORT_GEN_SPEC.ADA
  584.  
  585.  
  586.  
  587.           2.  REPORT_GEN_BODY.ADA
  588.  
  589.  
  590.  
  591.  
  592.  
  593.                This package contains the procedures that generate both
  594.  
  595.           the flaws report file and the style report file.  If any new
  596.  
  597.           style checks are to be added to the STYLE_CHECKER needed  to
  598.  
  599.           be  added to several places in the REPORT_GENERATOR package.
  600.  
  601.           They must be added to the record  that  contains  the  count
  602.  
  603.           information for all the flaws.  They need to be added to the
  604.  
  605.           enumeration type that lists  the  flaws.   This  enumeration
  606.  
  607.           type  is  a  parameter  to the PUT_FLAW procedure.  Then the
  608.  
  609.           code to add them to the style report must be  added  to  the
  610.  
  611.           GENERATE_REPORT procedure.
  612.  
  613.                                                                Page 10
  614.  
  615.  
  616.  
  617.  
  618.  
  619.                              Package STACK_PACKAGE
  620.  
  621.  
  622.  
  623.                This package is contained in the file:
  624.  
  625.  
  626.  
  627.           1.  STACK_PACKAGE.ADA
  628.  
  629.  
  630.  
  631.  
  632.  
  633.           This package is a generic stack package.
  634.  
  635.                                                                Page 11
  636.  
  637.  
  638.  
  639.  
  640.  
  641.                      Packages TOKEN_DEFINITION and MANAGER
  642.  
  643.  
  644.  
  645.                These packages are contained in the files:
  646.  
  647.  
  648.  
  649.           1.  TOKEN_DEFINITION.ADA
  650.  
  651.  
  652.  
  653.           2.  MANAGER.ADA
  654.  
  655.  
  656.  
  657.  
  658.  
  659.                These   two   pacakges   are   inhereted    from    the
  660.  
  661.           SPELLING_CHECKER  tool.  They currently are stubbed out.  If
  662.  
  663.           it was desired to have the  STYLE_CHECKER  check  that  each
  664.  
  665.           variable  name  was a word these two packages could be moved
  666.  
  667.           from the SPELLING_CHECKER (and  any  further  packages  they
  668.  
  669.           needed)  and  code  could  be  added  in  the  STYLE_CHECKER
  670.  
  671.           procedure CHECK_OBJECT_NAMES.  Currently the code  to  check
  672.  
  673.           if  a variable is a word is included, but nothing is done if
  674.  
  675.           the result is false.
  676.  
  677.                                                                Page 12
  678.  
  679.  
  680.  
  681.  
  682.  
  683.                Packages HELP, HELP_INFO_SUPPORT and HELP_UTILITY
  684.  
  685.  
  686.  
  687.                  These packages are contained in the files:
  688.  
  689.  
  690.  
  691.           1.  HELP_FILE_SPEC.ADA
  692.  
  693.  
  694.  
  695.           2.  HELP_FILE_BODY.ADA
  696.  
  697.  
  698.  
  699.           3.  HELP_INFO_SPEC.ADA
  700.  
  701.  
  702.  
  703.           4.  HELP_INFO_BODY.ADA
  704.  
  705.  
  706.  
  707.           5.  HELP_SPEC.ADA
  708.  
  709.  
  710.  
  711.           6.  HELP_BODY.ADA
  712.  
  713.  
  714.  
  715.           7.  HELP_DIS_ALL.ADA
  716.  
  717.  
  718.  
  719.           8.  HELP_EXIT.ADA
  720.  
  721.  
  722.  
  723.           9.  HELP_FIND.ADA
  724.  
  725.  
  726.  
  727.          10.  HELP_GET.ADA
  728.  
  729.  
  730.  
  731.          11.  HELP_INIT.ADA
  732.  
  733.  
  734.  
  735.          12.  HELP_ME.ADA
  736.  
  737.  
  738.  
  739.          13.  HELP_MENU.ADA
  740.  
  741.  
  742.  
  743.          14.  HELP_PROMPT.ADA
  744.  
  745.  
  746.  
  747.          15.  HELP_RESET.ADA
  748.  
  749.  
  750.  
  751.          16.  HELP_TEXT.ADA
  752.  
  753.  
  754.  
  755.          17.  STYLE_HELP.INI (Not a compiled unit, a text file)
  756.  
  757.  
  758.  
  759.  
  760.  
  761.                These  packages  are  the  help  utility.    The   file
  762.  
  763.           STYLE_HELP.INI   contains   the  source  used  by  the  help
  764.  
  765.           facility.  Any change of  the  name  of  the  STYLE_HELP.INI
  766.  
  767.           filename   will  require  a  change  of  the  initialization
  768.  
  769.           filename constant in the FILE_HANDLING package.
  770.  
  771.  
  772.  
  773.                The text file  used  by  the  HELP_UTILITY  Package  is
  774.  
  775.           required to have a particular format.  If the file is not in
  776.  
  777.           this format, an exception will  be  raised.   The  following
  778.  
  779.           explains the required format.
  780.  
  781.  
  782.  
  783.                COMMENTS:  Comments may be embeded in  the  text  file.
  784.  
  785.           All  comments are ignored when the file is read into memory.
  786.  
  787.           A text line is considered a comment if the first and  second
  788.  
  789.           characters of the line are minus signs ( -- ).
  790.  
  791.                                                                Page 13
  792.  
  793.  
  794.  
  795.  
  796.  
  797.                TOPICS:  The first non-comment  text  line  MUST  begin
  798.  
  799.           with  the  digit  1 in column one.  This number is the topic
  800.  
  801.           level.  In other words, text (as defined  below)  cannot  be
  802.  
  803.           found  in the text file before a topic is found to which the
  804.  
  805.           text can be associated.  Topics are those subjects for which
  806.  
  807.           information is being provided.  A topic name may contain any
  808.  
  809.           printable character except blanks.  Embedded blanks are  NOT
  810.  
  811.           allowed  in  a  topic  name.  This will not be flagged as an
  812.  
  813.           error but the name will be truncated  at  the  first  blank.
  814.  
  815.           All  letters  in  the  name  must  be  capitals.   It is not
  816.  
  817.           required to have a space separating the topic level from the
  818.  
  819.           topic  name.   Any  line  beginning  with  a  digit  will be
  820.  
  821.           considered a topic line.
  822.  
  823.  
  824.  
  825.                SUBTOPICS:  A topic may have subtopics.  Subtopics  are
  826.  
  827.           denoted  by  having  a  level  exactly  one greater than the
  828.  
  829.           associated topic level.  Subtopics follow the same rules  as
  830.  
  831.           topics  in all other aspects.  There is no constraint (other
  832.  
  833.           than a lack of memory) on the number of subtopic levels.
  834.  
  835.  
  836.  
  837.                TEXT:   All  text  lines   not   beginning   with   two
  838.  
  839.           consecutive minus signs or a digit will be considered text.
  840.  
  841.  
  842.  
  843.                The text file is saved exactly  as  the  user  sees  it
  844.  
  845.           (including blank lines) with the follow exceptions:
  846.  
  847.  
  848.  
  849.            -  topic and subtopic names have  leading  blanks  stripped
  850.  
  851.               off
  852.  
  853.  
  854.  
  855.            -  if the topic or subtopic name is longer  than  one  half
  856.  
  857.               the  screen  size,  it  may  be truncated when a menu of
  858.  
  859.               information is output
  860.  
  861.  
  862.  
  863.            -  if the text line is longer than  the  screen  size,  the
  864.  
  865.               text line is truncated before output
  866.  
  867.  
  868.  
  869.            -  the text file lines are assumed to be eighty  characters
  870.  
  871.               maximum.
  872.  
  873.  
  874.  
  875.                                                                Page 14
  876.  
  877.  
  878.  
  879.  
  880.  
  881.                           Package COMMAND_LINE_HANDLER
  882.  
  883.  
  884.  
  885.                This package is contained in the file COMMAND_LINE.ADA.
  886.  
  887.           This  package  contains routines which return words from the
  888.  
  889.           command line.  It expects an external file to  created  that
  890.  
  891.           contains  each  word  that follows the inkoking command, one
  892.  
  893.           word per line.  These lines are interpreted  as  file  names
  894.  
  895.           and opened by a procedure in this package.
  896.  
  897.