home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / online / help.src < prev   
Encoding:
Text File  |  1988-05-03  |  61.9 KB  |  2,261 lines

  1. ::::::::::
  2. help.dis
  3. ::::::::::
  4. --
  5. -- Source programs (in compilation order) for the HELP
  6. --  Online Documentation System
  7. --
  8. -- After compiling, the modules to link are HELP, HELP_ANALYZE,
  9. --   and HELP_BUILD.
  10. --
  11. -- The documentation refers to program names, like PHELP.
  12. --  These names are symbols which represent the "RUN XXX"
  13. --  commands under VMS which actually execute the tools.
  14. --  For instance, the PHELP symbol is defined as:
  15. --        PHELP :== "RUN HELP"
  16. --  A directory reference is usually placed before the HELP
  17. --  in "RUN HELP" so that PHELP can be executed from anywhere
  18. --  on the system.
  19. --
  20. help_sysdep.ada
  21. help.ada
  22. help_analyze.ada
  23. help_build.ada
  24. --
  25. -- Documentation file (user-oriented)
  26. --
  27. help.doc
  28. help.rno
  29. ::::::::::
  30. help_sysdep.ada
  31. ::::::::::
  32.  
  33. --|MODULE: HELP_SYSDEP
  34. --|AUTHOR: CONN
  35. --|LOCATION: PDL-TOOLS
  36. --|SEE_ALSO: HELP
  37. --|SEE_ALSO: HELP_ANALYZE
  38. --|SEE_ALSO: HELP_BUILD
  39. --|IEEE_PDL: SUPPORT_MODULE
  40. --|DESIGN_STATUS         : DONE
  41. --|IMPLEMENTATION_STATUS : DONE
  42. --|DOCUMENTATION_STATUS  : DONE
  43. --|DATE_RELEASED         : 9 Sep 85
  44. --|DATE_LAST_MODIFIED    : 2 Mar 86
  45. --|ABSTRACT:
  46. --|     HELP_SYSDEP is a Systems-Dependency package for the HELP
  47. --| system of programs.  It contains terminal-specific information
  48. --| (such as the number of lines on a screen and number of columns).
  49. --| Other information is also provided, including a CLEAR_SCREEN
  50. --| routine.  If more than one terminal is to be used and/or a
  51. --| clear screen or different clear screen sequences are used or
  52. --| not available, simply make the body of this routine a "null;";
  53. --| if only one terminal is used or several terminal types with the
  54. --| same clear screen sequence, set up the CLEAR_SCREEN routine to
  55. --| issue this sequence.  
  56. -- 
  57. with DIRECT_IO; 
  58. package HELP_SYSDEP is 
  59.  
  60. -- 
  61. -- HELP_FILE_NAME is the default name of the help file
  62. -- It may be a fully-qualified file name (which includes directory reference)
  63. -- so that the program will find it from any directory in which the program
  64. -- resides.
  65. --
  66. -- This string should be no longer than MAX_HELP_LENGTH characters.
  67. -- 
  68.   MAX_HELP_LENGTH : constant NATURAL := 200;
  69.       -- maximum number of characters in FILE_NAME string
  70.       -- returned by HELP_FILE procedure
  71.   HELP_FILE_NAME : constant STRING := "DBA4:[CONTR13.EXE]SIMTEL20.HLP";
  72.  
  73.   -- 
  74.   -- SCREEN_WIDTH and SCREEN_LENGTH are terminal attributes
  75.   -- 
  76.   SCREEN_WIDTH   : constant NATURAL := 75; 
  77.   SCREEN_LENGTH  : constant NATURAL := 23; 
  78.  
  79.   -- 
  80.   -- Description of a screen
  81.   -- 
  82.   subtype SCREEN_TEXT is STRING(1 .. SCREEN_WIDTH); 
  83.   type SCREEN_LINE is 
  84.     record
  85.       LINE : SCREEN_TEXT; 
  86.       LAST : NATURAL; 
  87.     end record; 
  88.   type SCREEN_LINE_ARRAY is array(1 .. SCREEN_LENGTH) of SCREEN_LINE; 
  89.   type SCREEN is 
  90.     record
  91.       LINES : SCREEN_LINE_ARRAY; 
  92.       LAST  : NATURAL; 
  93.     end record; 
  94.  
  95. --
  96. -- This procedure returns the name of the help file to be used.
  97. -- It may return the HELP_FILE_NAME defined above as a minimum
  98. -- or it may be more exotic, perhaps scanning the user's command
  99. -- path for any one of a number of help files and returning the
  100. -- first help file found.  This is the help file which will be
  101. -- processed by the programs as the default help file.
  102. --
  103.     procedure HELP_FILE (FILE_NAME : out STRING;
  104.                      LAST : out NATURAL);
  105.  
  106.     -- 
  107.     -- System-Dependent (Terminal-Dependent) Clear Screen routine
  108.     -- If not implemented, should contain a body of "null;"
  109.     -- 
  110.   procedure CLEAR_SCREEN; 
  111.  
  112.   -- 
  113.   -- Random-Access File I/O for HELP programs
  114.   -- 
  115.   package SDIRECT is 
  116.     new DIRECT_IO(ELEMENT_TYPE => SCREEN); 
  117.  
  118. end HELP_SYSDEP; 
  119.  
  120. with TEXT_IO; 
  121. package body HELP_SYSDEP is 
  122.  
  123.   procedure CLEAR_SCREEN is 
  124.   begin
  125.     TEXT_IO.PUT(ASCII.SUB);  -- ^Z
  126.     -- TEXT_IO.PUT(ASCII.ESC);  -- for VT100 
  127.     -- TEXT_IO.PUT_LINE("[2J"); 
  128.     -- TEXT_IO.PUT(ASCII.ESC); 
  129.     -- TEXT_IO.PUT("[1;1H"); 
  130.   end CLEAR_SCREEN; 
  131.  
  132.   procedure HELP_FILE (FILE_NAME : out STRING;
  133.                        LAST      : out NATURAL) is
  134.   begin
  135.     FILE_NAME(FILE_NAME'FIRST .. FILE_NAME'FIRST +
  136.       HELP_FILE_NAME'LENGTH - 1) := HELP_FILE_NAME;
  137.     LAST := HELP_FILE_NAME'LENGTH;
  138.   end HELP_FILE;
  139.  
  140. end HELP_SYSDEP; 
  141. ::::::::::
  142. help.ada
  143. ::::::::::
  144.  
  145.  
  146. --|MODULE : HELP
  147. --|AUTHOR : CONN
  148. --|LOCATION : PDL-TOOLS
  149. --|SEE_ALSO : HELP_ANALYZE
  150. --|SEE_ALSO : HELP_BUILD
  151. --|REQUIRES : HELP_SYSDEP
  152. --|IEEE_PDL : DESIGN_INFORMATION_RETRIEVAL
  153. --|IEEE_PDL : INTERACTIVE_DOCUMENTATION_REVIEW_SYSTEM
  154. --|DESIGN_STATUS         : DONE
  155. --|IMPLEMENTATION_STATUS : DONE
  156. --|DOCUMENTATION_STATUS  : DONE
  157. --|DATE_RELEASED         :  9 Sep 85
  158. --|DATE_LAST_MODIFIED    : 2 Mar 86
  159. --|ABSTRACT:
  160. --|     HELP is an online documentation system.  It reads data
  161. --| from a direct-access file generated by HELP_BUILD and builds
  162. --| a tree which may be as wide as desired and up to ten levels
  163. --| deep.  This tree contains sets of screen displays on various
  164. --| topics.  After building this tree, HELP displays a menu of
  165. --| the topics at the highest level, and the user can select a
  166. --| desired topic by typing enough characters to uniquely identify
  167. --| it.
  168. --|     Once a desired topic is selected, HELP displays the screens
  169. --| associated with this topic, allowing the user to move to the
  170. --| next screen, last screen, up to the menu he came from, and
  171. --| (if lower levels of information exist) display a menu of the
  172. --| topics at the next lower level.  From this new menu, the process
  173. --| is repeated (topics are selected, scanned, and lower levels of
  174. --| menus may be accessed.
  175. --|    The current topic may be printed out to a text file by
  176. --| selecting the P)rint option which reviewing a topic.
  177. --|
  178. with TEXT_IO; 
  179. with HELP_SYSDEP; use HELP_SYSDEP; 
  180. procedure HELP is 
  181.  
  182.   VERSION : constant STRING(1 .. 3) := "1.3"; 
  183.  
  184.   package NAT_IO is 
  185.     new TEXT_IO.INTEGER_IO(NATURAL); 
  186.  
  187.     -- 
  188.     -- Key, global variables and constants
  189.     -- 
  190.   SOURCE_FILE     : SDIRECT.FILE_TYPE; 
  191.   CURRENT_SCREEN  : SCREEN; 
  192.   NEW_LINE        : SCREEN_LINE; 
  193.   TOPIC_LIMIT     : constant NATURAL := 60;  -- max number of topics on scr
  194.   TOPIC_SIZE      : constant NATURAL := 20;  -- max number of chars/topic
  195.   TOPICS_PER_LINE : constant NATURAL := SCREEN_WIDTH/(TOPIC_SIZE + 2); 
  196.   DEF_HELP_FILE   : STRING(1..MAX_HELP_LENGTH);
  197.   DEF_HELP_LAST   : NATURAL;
  198.  
  199.   -- 
  200.   -- Exceptions
  201.   -- 
  202.   STOP            : exception; 
  203.   ABORT_HELP      : exception; 
  204.  
  205.   -- 
  206.   -- These are the commands recognized by GET_COMMAND
  207.   -- 
  208.   type COMMAND_VERB is (EXIT_PROGRAM, UP_LEVEL, NEXT_SCREEN, LAST_SCREEN, 
  209.     REFRESH_SCREEN, DISPLAY_MENU, PRINT_TOPIC, UNKNOWN); 
  210.  
  211.   -- 
  212.   -- Each node of the tree is structured as follows:
  213.   -- 
  214.   type TOPIC; 
  215.   type TOPIC_ACCESS is access TOPIC; 
  216.   type TOPIC is 
  217.     record
  218.       TOPIC_HEADER : SCREEN_LINE; 
  219.       NEXT_TOPIC   : TOPIC_ACCESS; 
  220.       LAST_TOPIC   : TOPIC_ACCESS; 
  221.       NEXT_LEVEL   : TOPIC_ACCESS; 
  222.       LAST_LEVEL   : TOPIC_ACCESS; 
  223.       INDEX_START  : SDIRECT.POSITIVE_COUNT; 
  224.       INDEX_STOP   : SDIRECT.POSITIVE_COUNT; 
  225.     end record; 
  226.  
  227.     -- 
  228.     -- Pointers used in conjunction with the tree
  229.     --      FIRST_TOPIC points to the first node of the tree
  230.     -- 
  231.   FIRST_TOPIC   : TOPIC_ACCESS; 
  232.   CURRENT_TOPIC : TOPIC_ACCESS; 
  233.  
  234.   -- 
  235.   -- Provided for Forward Reference Purposes
  236.   -- 
  237.   procedure PROCESS_MENU(LEVEL    : in NATURAL; 
  238.                          MENU_PTR : in TOPIC_ACCESS); 
  239.  
  240.   -- 
  241.   -- Error Routine
  242.   -- 
  243.   procedure ERROR(STR : in STRING) is 
  244.     INLINE : SCREEN_LINE; 
  245.   begin
  246.     TEXT_IO.NEW_LINE; 
  247.     TEXT_IO.PUT("**** ERROR ****  "); 
  248.     TEXT_IO.PUT(STR); 
  249.     TEXT_IO.PUT("    Strike Any Key "); 
  250.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  251.     TEXT_IO.NEW_LINE; 
  252.   end ERROR; 
  253.  
  254.   -- 
  255.   -- TO_UPPER capitalizes the passed character
  256.   -- 
  257.   function TO_UPPER(CH : in CHARACTER) return CHARACTER is 
  258.   begin
  259.     if (CH >= 'a') and (CH <= 'z') then 
  260.       return CHARACTER'VAL(CHARACTER'POS('A') + CHARACTER'POS(CH) - CHARACTER'
  261.         POS('a')); 
  262.     else 
  263.       return CH; 
  264.     end if; 
  265.   end TO_UPPER; 
  266.  
  267.   -- 
  268.   -- CAPSTR capitalizes the passed string
  269.   -- 
  270.   procedure CAPSTR(STR : in out STRING) is 
  271.   begin
  272.     for I in STR'FIRST .. STR'LAST loop
  273.       STR(I) := TO_UPPER(STR(I)); 
  274.     end loop; 
  275.   end CAPSTR; 
  276.  
  277.   -- 
  278.   -- IS_DIGIT determines if the passed character is in the range '0'..'9'
  279.   -- 
  280.   function IS_DIGIT(CH : in CHARACTER) return BOOLEAN is 
  281.   begin
  282.     if (CH >= '0') and (CH <= '9') then 
  283.       return TRUE; 
  284.     else 
  285.       return FALSE; 
  286.     end if; 
  287.   end IS_DIGIT; 
  288.  
  289.   -- 
  290.   -- VERB_CHECK determines if the passed string matches one of the verbs
  291.   -- and returns the COMMAND_VERB which indicates the nature of the match
  292.   -- 
  293.   function VERB_CHECK(STR : in STRING) return COMMAND_VERB is 
  294.   begin
  295.     if STR'LENGTH = 1 then 
  296.       case STR(1) is 
  297.         when 'E' | 'X' => 
  298.           return EXIT_PROGRAM; 
  299.         when 'P' => 
  300.           return PRINT_TOPIC; 
  301.         when 'N' => 
  302.           return NEXT_SCREEN; 
  303.         when 'L' => 
  304.           return LAST_SCREEN; 
  305.         when 'U' => 
  306.           return UP_LEVEL; 
  307.         when 'M' => 
  308.           return DISPLAY_MENU; 
  309.         when '?' => 
  310.           return REFRESH_SCREEN; 
  311.         when others => 
  312.           return UNKNOWN; 
  313.       end case; 
  314.     end if; 
  315.     if STR'LENGTH = 2 then 
  316.       if STR(STR'FIRST .. STR'LAST) = "UP" then 
  317.         return UP_LEVEL; 
  318.       else 
  319.         return UNKNOWN; 
  320.       end if; 
  321.     end if; 
  322.     if STR'LENGTH = 4 then 
  323.       if STR(STR'FIRST .. STR'LAST) = "EXIT" then 
  324.         return EXIT_PROGRAM; 
  325.       end if; 
  326.       if STR(STR'FIRST .. STR'LAST) = "NEXT" then 
  327.         return NEXT_SCREEN; 
  328.       end if; 
  329.       if STR(STR'FIRST .. STR'LAST) = "LAST" then 
  330.         return LAST_SCREEN; 
  331.       end if; 
  332.       if STR(STR'FIRST .. STR'LAST) = "MENU" then 
  333.         return DISPLAY_MENU; 
  334.       end if; 
  335.     end if; 
  336.     if STR'LENGTH = 5 then 
  337.       if STR(STR'FIRST .. STR'LAST) = "PRINT" then 
  338.         return PRINT_TOPIC; 
  339.       end if; 
  340.     end if; 
  341.     return UNKNOWN; 
  342.   end VERB_CHECK; 
  343.  
  344.   -- 
  345.   -- GET_COMMAND inputs a command from the user
  346.   --      The command is returned as a COMMAND_VERB and a SCREEN_LINE
  347.   --      (text)
  348.   -- 
  349.   procedure GET_COMMAND(COMMAND : out COMMAND_VERB; 
  350.                         CSTR    : out SCREEN_LINE) is 
  351.     INLINE : SCREEN_LINE; 
  352.   begin
  353.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  354.     if INLINE.LAST > 0 then 
  355.       CAPSTR(INLINE.LINE(1 .. INLINE.LAST)); 
  356.     end if; 
  357.     CSTR := INLINE; 
  358.     if INLINE.LAST = 0 then 
  359.       COMMAND := NEXT_SCREEN; 
  360.     else 
  361.       COMMAND := VERB_CHECK(INLINE.LINE(1 .. INLINE.LAST)); 
  362.     end if; 
  363.   end GET_COMMAND; 
  364.  
  365.   -- 
  366.   -- Print Current Topic
  367.   --     The indicated topic is printed onto the indicated file
  368.   -- 
  369.   procedure PRINT_CURRENT_TOPIC(FILE_NAME : in STRING; 
  370.                                 CT        : in TOPIC_ACCESS) is 
  371.     FD         : TEXT_IO.FILE_TYPE; 
  372.     SAVE_INDEX : SDIRECT.POSITIVE_COUNT; 
  373.   begin
  374.     TEXT_IO.NEW_LINE; 
  375.     TEXT_IO.PUT_LINE("  Printing into file " & FILE_NAME); 
  376.     SAVE_INDEX := SDIRECT.INDEX(SOURCE_FILE); 
  377.     TEXT_IO.CREATE(FD, TEXT_IO.OUT_FILE, FILE_NAME); 
  378.     for INDEX in CT.INDEX_START .. CT.INDEX_STOP loop
  379.       SDIRECT.SET_INDEX(SOURCE_FILE, INDEX); 
  380.       SDIRECT.READ(SOURCE_FILE, CURRENT_SCREEN); 
  381.       if CURRENT_SCREEN.LAST > 0 then 
  382.         for I in 1 .. CURRENT_SCREEN.LAST loop
  383.           TEXT_IO.PUT_LINE(FD, CURRENT_SCREEN.LINES(I).LINE(1 .. CURRENT_SCREEN.
  384.             LINES(I).LAST)); 
  385.         end loop; 
  386.       end if; 
  387.     end loop; 
  388.     TEXT_IO.CLOSE(FD); 
  389.     SDIRECT.SET_INDEX(SOURCE_FILE, SAVE_INDEX); 
  390.     SDIRECT.READ(SOURCE_FILE, CURRENT_SCREEN); 
  391.   end PRINT_CURRENT_TOPIC; 
  392.  
  393.   -- 
  394.   -- Display Current Screen
  395.   --      The global CURRENT_SCREEN contains the screen to display
  396.   -- 
  397.   procedure DISPLAY_CURRENT_SCREEN is 
  398.   begin
  399.     CLEAR_SCREEN; 
  400.     if CURRENT_SCREEN.LAST > 0 then 
  401.       for I in 1 .. CURRENT_SCREEN.LAST loop
  402.         TEXT_IO.PUT_LINE(CURRENT_SCREEN.LINES(I).LINE(1 .. CURRENT_SCREEN.LINES(
  403.           I).LAST)); 
  404.       end loop; 
  405.     end if; 
  406.     if CURRENT_SCREEN.LAST < SCREEN_LENGTH then 
  407.       for I in CURRENT_SCREEN.LAST + 1 .. SCREEN_LENGTH loop
  408.         TEXT_IO.NEW_LINE; 
  409.       end loop; 
  410.     end if; 
  411.   end DISPLAY_CURRENT_SCREEN; 
  412.  
  413.   -- 
  414.   -- Display Screens of Current Topic (CT)
  415.   -- 
  416.   procedure DISPLAY_CURRENT_TOPIC(LEVEL : in NATURAL; 
  417.                                   CT    : in TOPIC_ACCESS) is 
  418.     INDEX          : SDIRECT.POSITIVE_COUNT; 
  419.     COMMAND        : COMMAND_VERB; 
  420.     CSTR           : SCREEN_LINE; 
  421.     FILE_NAME_LINE : SCREEN_LINE; 
  422.     -- 
  423.     -- Display Prompt for DISPLAY_CURRENT_TOPIC
  424.     -- 
  425.     procedure PROMPT is 
  426.     begin
  427.       TEXT_IO.PUT("Level "); 
  428.       NAT_IO.PUT(LEVEL, 2); 
  429.       TEXT_IO.PUT(" Topic: "); 
  430.       TEXT_IO.PUT(CT.TOPIC_HEADER.LINE(1 .. CT.TOPIC_HEADER.LAST)); 
  431.       TEXT_IO.PUT(" (Print, Exit, Up"); 
  432.       if SDIRECT.POSITIVE_COUNT'POS(INDEX) /= SDIRECT.POSITIVE_COUNT'POS(CT.
  433.         INDEX_STOP) then 
  434.         TEXT_IO.PUT(", Next"); 
  435.       end if; 
  436.       if SDIRECT.POSITIVE_COUNT'POS(INDEX) /= SDIRECT.POSITIVE_COUNT'POS(CT.
  437.         INDEX_START) then 
  438.         TEXT_IO.PUT(", Last"); 
  439.       end if; 
  440.       if CT.NEXT_LEVEL /= null then 
  441.         TEXT_IO.PUT(", Menu"); 
  442.       end if; 
  443.       TEXT_IO.PUT(")  "); 
  444.     end PROMPT; 
  445.     -- 
  446.     -- Body of DISPLAY_CURRENT_TOPIC
  447.     -- 
  448.   begin
  449.     INDEX := CT.INDEX_START; 
  450.     loop
  451.  
  452.       -- 
  453.       -- Position to screen, read screen, and display screen
  454.       -- 
  455.       SDIRECT.SET_INDEX(SOURCE_FILE, INDEX); 
  456.       SDIRECT.READ(SOURCE_FILE, CURRENT_SCREEN); 
  457.       DISPLAY_CURRENT_SCREEN; 
  458.  
  459.       -- 
  460.       -- Prompt, get command, and process command
  461.       -- 
  462.       PROMPT; 
  463.       GET_COMMAND(COMMAND, CSTR); 
  464.       case COMMAND is 
  465.         when PRINT_TOPIC => 
  466.           TEXT_IO.NEW_LINE; 
  467.           TEXT_IO.PUT("  Name of File to Print into? "); 
  468.           TEXT_IO.GET_LINE(FILE_NAME_LINE.LINE, FILE_NAME_LINE.LAST); 
  469.           if FILE_NAME_LINE.LAST > 0 then 
  470.             PRINT_CURRENT_TOPIC(FILE_NAME_LINE.LINE(1 .. FILE_NAME_LINE.LAST), 
  471.               CT); 
  472.           end if; 
  473.         when EXIT_PROGRAM => 
  474.           raise ABORT_HELP; 
  475.         when UP_LEVEL => 
  476.           exit; 
  477.         when NEXT_SCREEN => 
  478.           if SDIRECT.POSITIVE_COUNT'POS(INDEX) = SDIRECT.POSITIVE_COUNT'POS(CT.
  479.             INDEX_STOP) then 
  480.             ERROR("At Last Screen"); 
  481.           else 
  482.             INDEX := SDIRECT.POSITIVE_COUNT'SUCC(INDEX); 
  483.           end if; 
  484.         when LAST_SCREEN => 
  485.           if SDIRECT.POSITIVE_COUNT'POS(INDEX) = SDIRECT.POSITIVE_COUNT'POS(CT.
  486.             INDEX_START) then 
  487.             ERROR("At First Screen"); 
  488.           else 
  489.             INDEX := SDIRECT.POSITIVE_COUNT'PRED(INDEX); 
  490.           end if; 
  491.         when REFRESH_SCREEN => 
  492.           null; 
  493.         when DISPLAY_MENU => 
  494.           if CT.NEXT_LEVEL = null then 
  495.             ERROR("No Menu Available"); 
  496.           else 
  497.             PROCESS_MENU(LEVEL + 1, CT.NEXT_LEVEL); 
  498.           end if; 
  499.         when others => 
  500.           ERROR("Unknown command -- " & CSTR.LINE(1 .. CSTR.LAST) & " --"); 
  501.       end case; 
  502.     end loop; 
  503.   end DISPLAY_CURRENT_TOPIC; 
  504.  
  505.   -- 
  506.   -- PROCESS_MENU processes a menu of the topics pointed to by the
  507.   -- passed pointer
  508.   -- 
  509.   procedure PROCESS_MENU(LEVEL    : in NATURAL; 
  510.                          MENU_PTR : in TOPIC_ACCESS) is 
  511.     FIRST_MENU   : BOOLEAN; 
  512.     TOPIC        : TOPIC_ACCESS; 
  513.     NEXT_MENU    : TOPIC_ACCESS; 
  514.     CURRENT_MENU : TOPIC_ACCESS; 
  515.     COMMAND      : COMMAND_VERB; 
  516.     CSTR         : SCREEN_LINE; 
  517.     -- 
  518.     -- Function FIND_HELP searches through the current menu (beginning at
  519.     -- MENU_PTR) for the passed string
  520.     -- 
  521.     function FIND_HELP(STR : in SCREEN_LINE) return TOPIC_ACCESS is 
  522.       ROVER : TOPIC_ACCESS; 
  523.       -- 
  524.       -- Compare strings (str vs topic header)
  525.       -- 
  526.       function COMPARE(STR1 : in STRING; 
  527.                        STR2 : in STRING) return BOOLEAN is 
  528.       begin
  529.         if STR1'LENGTH + 2 > STR2'LENGTH then 
  530.           return FALSE; 
  531.         else 
  532.           for I in 1 .. STR1'LENGTH loop
  533.             if TO_UPPER(STR1(I)) /= TO_UPPER(STR2(I + 2)) then 
  534.               return FALSE; 
  535.             end if; 
  536.           end loop; 
  537.           return TRUE; 
  538.         end if; 
  539.       end COMPARE; 
  540.       -- 
  541.       -- Body of FIND_HELP
  542.       --      This routine moves thru all topics at the level of the topic
  543.       --      pointed to by MENU_PTR until end of list or match of STR to
  544.       -- TOPIC_HEADER
  545.       -- 
  546.     begin
  547.       ROVER := MENU_PTR; 
  548.       while ROVER /= null loop
  549.         exit when COMPARE(STR.LINE(1 .. STR.LAST), ROVER.TOPIC_HEADER.LINE(1 .. 
  550.           ROVER.TOPIC_HEADER.LAST)); 
  551.         ROVER := ROVER.NEXT_TOPIC; 
  552.       end loop; 
  553.       return ROVER; 
  554.     end FIND_HELP; 
  555.  
  556.     -- 
  557.     -- PROMPT prints the menu prompt
  558.     -- 
  559.     procedure PROMPT is 
  560.     begin
  561.       TEXT_IO.PUT("Level "); 
  562.       NAT_IO.PUT(LEVEL, 2); 
  563.       TEXT_IO.PUT(" Menu: "); 
  564.       TEXT_IO.PUT("(Exit"); 
  565.       if MENU_PTR.LAST_LEVEL /= null then 
  566.         TEXT_IO.PUT(", Up"); 
  567.       end if; 
  568.       if NEXT_MENU /= null then 
  569.         TEXT_IO.PUT(", Next Menu Screen"); 
  570.       end if; 
  571.       if not FIRST_MENU then 
  572.         TEXT_IO.PUT(", Last Menu Screen"); 
  573.       end if; 
  574.       TEXT_IO.PUT(", Selection)  "); 
  575.     end PROMPT; 
  576.     -- 
  577.     -- Display current menu
  578.     -- 
  579.     procedure DISPLAY_MENU is 
  580.       ROVER       : TOPIC_ACCESS; 
  581.       TOPIC_COUNT : NATURAL; 
  582.       LINE_COUNT  : NATURAL; 
  583.       -- 
  584.       -- PRINT_TOPIC prints the topic pointed to by ROVER
  585.       -- 
  586.       procedure PRINT_TOPIC is 
  587.         CHAR_LIMIT : NATURAL; 
  588.       begin
  589.         if ROVER.TOPIC_HEADER.LAST > TOPIC_SIZE + 2 then 
  590.           CHAR_LIMIT := TOPIC_SIZE; 
  591.         else 
  592.           if ROVER.TOPIC_HEADER.LAST > 2 then 
  593.             CHAR_LIMIT := ROVER.TOPIC_HEADER.LAST - 2; 
  594.           else 
  595.             CHAR_LIMIT := 0; 
  596.           end if; 
  597.         end if; 
  598.         if CHAR_LIMIT > 0 then 
  599.           TEXT_IO.PUT(ROVER.TOPIC_HEADER.LINE(3 .. CHAR_LIMIT + 2)); 
  600.         end if; 
  601.         if CHAR_LIMIT < TOPIC_SIZE then 
  602.           for I in CHAR_LIMIT + 1 .. TOPIC_SIZE loop
  603.             TEXT_IO.PUT(' '); 
  604.           end loop; 
  605.         end if; 
  606.         TEXT_IO.PUT("  "); 
  607.       end PRINT_TOPIC; 
  608.       -- 
  609. -- Mainline of DISPLAY_MENU moves thru all topics of CURRENT_MENU, displaying
  610.       -- at most TOPIC_LIMIT of them at a time on one or more screens
  611.       -- 
  612.     begin
  613.       ROVER := CURRENT_MENU; 
  614.       TOPIC_COUNT := 0; 
  615.       LINE_COUNT := 0; 
  616.       CLEAR_SCREEN; 
  617.       for I in 1 .. TOPIC_LIMIT loop
  618.         exit when ROVER = null; 
  619.         PRINT_TOPIC; 
  620.         TOPIC_COUNT := TOPIC_COUNT + 1; 
  621.         if TOPIC_COUNT = TOPICS_PER_LINE then 
  622.           TOPIC_COUNT := 0; 
  623.           LINE_COUNT := LINE_COUNT + 1; 
  624.           TEXT_IO.NEW_LINE; 
  625.         end if; 
  626.         ROVER := ROVER.NEXT_TOPIC; 
  627.       end loop; 
  628.       NEXT_MENU := ROVER; 
  629.       if LINE_COUNT < SCREEN_LENGTH then 
  630.         for I in LINE_COUNT + 1 .. SCREEN_LENGTH loop
  631.           TEXT_IO.NEW_LINE; 
  632.         end loop; 
  633.       end if; 
  634.     end DISPLAY_MENU; 
  635.     -- 
  636.     -- Mainline of PROCESS_MENU
  637.     -- Display menu screens, allow movement between screens, allow selection of
  638.     -- menu topics
  639.     -- 
  640.   begin
  641.     FIRST_MENU := TRUE; 
  642.     CURRENT_MENU := MENU_PTR; 
  643.     NEXT_MENU := null; 
  644.     loop
  645.       DISPLAY_MENU; 
  646.       PROMPT; 
  647.       GET_COMMAND(COMMAND, CSTR); 
  648.       case COMMAND is 
  649.         when EXIT_PROGRAM => 
  650.           raise ABORT_HELP; 
  651.         when UP_LEVEL => 
  652.           if LEVEL /= 0 then 
  653.             exit; 
  654.           else 
  655.             ERROR("At Top Level Menu - No Upper Level"); 
  656.           end if; 
  657.         when NEXT_SCREEN => 
  658.           if NEXT_MENU = null then 
  659.             ERROR("No More Menu Screens"); 
  660.           else 
  661.             CURRENT_MENU := NEXT_MENU; 
  662.           end if; 
  663.         when LAST_SCREEN => 
  664.           if CURRENT_MENU = MENU_PTR then 
  665.             ERROR("At First Menu Screen"); 
  666.           else 
  667.             for I in 1 .. TOPIC_LIMIT loop
  668.               CURRENT_MENU := CURRENT_MENU.LAST_TOPIC; 
  669.             end loop; 
  670.           end if; 
  671.         when REFRESH_SCREEN => 
  672.           null; 
  673.         when others => 
  674.           TOPIC := FIND_HELP(CSTR); 
  675.           if TOPIC = null then 
  676.             ERROR("Topic " & CSTR.LINE(1 .. CSTR.LAST) & " Not Found"); 
  677.           else 
  678.             DISPLAY_CURRENT_TOPIC(LEVEL, TOPIC); 
  679.           end if; 
  680.       end case; 
  681.     end loop; 
  682.   end PROCESS_MENU; 
  683.  
  684.   -- 
  685.   -- INIT initializes the 4-link list of the HELP file
  686.   -- 
  687.   procedure INIT is 
  688.     INLINE : SCREEN_LINE; 
  689.     -- 
  690.     -- INIT_NEXT_LEVEL sets up the linked list for the next tree level
  691.     -- 
  692.     procedure INIT_NEXT_LEVEL(LEVEL      : in CHARACTER; 
  693.                               LAST_LEVEL : in TOPIC_ACCESS) is 
  694.       NEW_TOPIC       : TOPIC_ACCESS; 
  695.       CURRENT_TOPIC   : TOPIC_ACCESS; 
  696.       FIRST_NEW_TOPIC : BOOLEAN; 
  697.       -- 
  698.       -- Back up to previous screen in source
  699.       -- 
  700.       procedure BACKUP_FILE is 
  701.       begin
  702.         SDIRECT.SET_INDEX(SOURCE_FILE, SDIRECT.POSITIVE_COUNT'PRED(SDIRECT.INDEX
  703.           (SOURCE_FILE))); 
  704.       end BACKUP_FILE; 
  705.       -- 
  706.       -- Return index of current screen
  707.       -- 
  708.       function CURRENT_SCREEN_INDEX return SDIRECT.POSITIVE_COUNT is 
  709.       begin
  710.         return SDIRECT.INDEX(SOURCE_FILE); 
  711.       end CURRENT_SCREEN_INDEX; 
  712.       -- 
  713.       -- Return index of previous screen
  714.       -- 
  715.       function PREVIOUS_SCREEN_INDEX return SDIRECT.POSITIVE_COUNT is 
  716.       begin
  717.         return SDIRECT.POSITIVE_COUNT'PRED(CURRENT_SCREEN_INDEX); 
  718.       end PREVIOUS_SCREEN_INDEX; 
  719.       -- 
  720.       -- Determine if CURRENT_TOPIC.INDEX_STOP has been set
  721.       -- 
  722.       function CURRENT_INDEX_STOP_NOT_SET return BOOLEAN is 
  723.       begin
  724.         if SDIRECT.POSITIVE_COUNT'POS(CURRENT_TOPIC.INDEX_STOP) = 1 then 
  725.           return TRUE; 
  726.         else 
  727.           return FALSE; 
  728.         end if; 
  729.       end CURRENT_INDEX_STOP_NOT_SET; 
  730.       -- 
  731.       -- Move thru the data file, building topic list
  732.       -- 
  733.     begin
  734.       FIRST_NEW_TOPIC := TRUE; 
  735.       CURRENT_TOPIC := null; 
  736.       while not SDIRECT.END_OF_FILE(SOURCE_FILE) loop
  737.  
  738.         -- 
  739.         -- Read next screen
  740.         -- 
  741.         SDIRECT.READ(SOURCE_FILE, CURRENT_SCREEN); 
  742.         NEW_LINE := CURRENT_SCREEN.LINES(1); 
  743.  
  744.         -- 
  745. -- Do following processing if the screen is a new topic (begins with "N text")
  746.         -- 
  747.         if NEW_LINE.LAST > 1 then 
  748.           if IS_DIGIT(NEW_LINE.LINE(1)) and (NEW_LINE.LINE(2) = ' ') then 
  749.  
  750.             -- 
  751.             -- The screen is a new topic, so process
  752.             -- 
  753.             if LEVEL > NEW_LINE.LINE(1) then 
  754.  
  755.               -- 
  756. -- If lower level than previous topic, exit and return to called to continue
  757.               -- at lower level
  758.               -- 
  759.               BACKUP_FILE; 
  760.               if CURRENT_TOPIC /= null then 
  761.                 if CURRENT_INDEX_STOP_NOT_SET then 
  762.                   CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  763.                 end if; 
  764.               end if; 
  765.               exit; 
  766.             end if; 
  767.             if LEVEL < NEW_LINE.LINE(1) then 
  768.  
  769.               -- 
  770. -- If at higher level than previous topic, make recursive call for new
  771.               -- processing at this higher level
  772.               -- 
  773.               BACKUP_FILE; 
  774.               if CURRENT_TOPIC /= null then 
  775.                 if CURRENT_INDEX_STOP_NOT_SET then 
  776.                   CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  777.                 end if; 
  778.               end if; 
  779.               INIT_NEXT_LEVEL(NEW_LINE.LINE(1), CURRENT_TOPIC); 
  780.             else 
  781.               NEW_TOPIC := new TOPIC; 
  782.               if FIRST_NEW_TOPIC then 
  783.                 if LAST_LEVEL /= null then 
  784.                   LAST_LEVEL.NEXT_LEVEL := NEW_TOPIC; 
  785.                 end if; 
  786.                 FIRST_NEW_TOPIC := FALSE; 
  787.               end if; 
  788.               NEW_TOPIC.TOPIC_HEADER := NEW_LINE; 
  789.               NEW_TOPIC.NEXT_TOPIC := null; 
  790.               NEW_TOPIC.LAST_TOPIC := CURRENT_TOPIC; 
  791.               NEW_TOPIC.NEXT_LEVEL := null; 
  792.               NEW_TOPIC.LAST_LEVEL := LAST_LEVEL; 
  793.               NEW_TOPIC.INDEX_START := PREVIOUS_SCREEN_INDEX; 
  794.               NEW_TOPIC.INDEX_STOP := 1; 
  795.               if CURRENT_TOPIC /= null then 
  796.                 if CURRENT_INDEX_STOP_NOT_SET then 
  797.                   CURRENT_TOPIC.INDEX_STOP := SDIRECT.POSITIVE_COUNT'PRED(
  798.                     NEW_TOPIC.INDEX_START); 
  799.                 end if; 
  800.                 CURRENT_TOPIC.NEXT_TOPIC := NEW_TOPIC; 
  801.               end if; 
  802.               CURRENT_TOPIC := NEW_TOPIC; 
  803.               if FIRST_TOPIC = null then 
  804.                 FIRST_TOPIC := CURRENT_TOPIC; 
  805.               end if; 
  806.             end if; 
  807.           end if; 
  808.         end if; 
  809.       end loop; 
  810.       if CURRENT_INDEX_STOP_NOT_SET then 
  811.         CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  812.       end if; 
  813.     end INIT_NEXT_LEVEL; 
  814.     -- 
  815.     -- INIT mainline follows
  816.     -- 
  817.   begin
  818.     TEXT_IO.PUT("Help File (RETURN for Default)> "); 
  819.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  820.     begin
  821.       if INLINE.LAST = 0 then 
  822.         HELP_FILE (DEF_HELP_FILE, DEF_HELP_LAST);
  823.         SDIRECT.OPEN(SOURCE_FILE, SDIRECT.IN_FILE, 
  824.           DEF_HELP_FILE(1..DEF_HELP_LAST));
  825.       else 
  826.         SDIRECT.OPEN(SOURCE_FILE, SDIRECT.IN_FILE, INLINE.LINE(1 .. INLINE.LAST)
  827.           ); 
  828.       end if; 
  829.     exception
  830.       when others => 
  831.         TEXT_IO.PUT_LINE("Help File not Found"); 
  832.         raise STOP; 
  833.     end; 
  834.     FIRST_TOPIC := null; 
  835.     CURRENT_TOPIC := null; 
  836.     INIT_NEXT_LEVEL('1', null); 
  837.     SDIRECT.RESET(SOURCE_FILE); 
  838.   end INIT; 
  839.  
  840.   -- 
  841.   -- Deinitialize system for exit
  842.   -- 
  843.   procedure DEINIT is 
  844.   begin
  845.     SDIRECT.CLOSE(SOURCE_FILE); 
  846.   end DEINIT; 
  847.  
  848. -- 
  849. -- HELP mainline follows
  850. -- 
  851. begin
  852.   TEXT_IO.PUT_LINE("HELP, Version " & VERSION); 
  853.   INIT; 
  854.   if FIRST_TOPIC /= null then 
  855.     PROCESS_MENU(0, FIRST_TOPIC); 
  856.   else 
  857.     ERROR("Help File is Empty"); 
  858.   end if; 
  859.   DEINIT; 
  860. exception
  861.   when ABORT_HELP => 
  862.     DEINIT; 
  863.   when others => 
  864.     TEXT_IO.PUT_LINE("Unexpected Fatal Error"); 
  865. end HELP; 
  866. ::::::::::
  867. help_analyze.ada
  868. ::::::::::
  869.  
  870. --|MODULE: HELP_ANALYZE
  871. --|AUTHOR: CONN
  872. --|LOCATION: PDL-TOOLS
  873. --|SEE_ALSO : HELP
  874. --|SEE_ALSO : HELP_BUILD
  875. --|REQUIRES : HELP_SYSDEP
  876. --|IEEE_PDL : SUPPORT_MODULE
  877. --|DESIGN_STATUS         : DONE
  878. --|IMPLEMENTATION_STATUS : DONE
  879. --|DOCUMENTATION_STATUS  : DONE
  880. --|DATE_RELEASED         : 9 Sep 85
  881. --|DATE_LAST_MODIFIED    : 2 Mar 86
  882. --|ABSTRACT :
  883. --|     HELP_ANALYZE performs an analysis of a direct-access
  884. --| file created by HELP_BUILD.  It indicates each of the topics
  885. --| contained in the file, and, by indentation, shows their
  886. --| hierarchical relationship.  HELP_ANALYZE also displays, using
  887. --| the symbols "Start =" and "Stop =", the beginning and ending
  888. --| record numbers of each topic.
  889. --|
  890. with TEXT_IO; 
  891. with HELP_SYSDEP; use HELP_SYSDEP; 
  892. procedure HELP_ANALYZE is 
  893.  
  894.   package NAT_IO is 
  895.     new TEXT_IO.INTEGER_IO(NATURAL); 
  896.   package C_IO is 
  897.     new TEXT_IO.INTEGER_IO(SDIRECT.COUNT); 
  898.  
  899.     -- 
  900.     -- Important constants and global variables
  901.     -- 
  902.   VERSION        : constant STRING(1 .. 3) := "1.1"; 
  903.   SOURCE_FILE    : SDIRECT.FILE_TYPE; 
  904.   CURRENT_SCREEN : SCREEN; 
  905.   NEW_LINE       : SCREEN_LINE; 
  906.   TOPIC_LIMIT    : constant NATURAL := 60;  -- max number of topics on scr
  907.   TOPIC_SIZE     : constant NATURAL := 20;  -- max number of chars/topic
  908.   DEF_HELP_FILE  : STRING(1..MAX_HELP_LENGTH);
  909.   DEF_HELP_LAST  : NATURAL;
  910.  
  911.   -- 
  912.   -- Exceptions
  913.   -- 
  914.   STOP           : exception; 
  915.  
  916.   -- 
  917.   -- Nodes of the tree to be build in performing the analysis
  918.   -- 
  919.   type TOPIC; 
  920.   type TOPIC_ACCESS is access TOPIC; 
  921.   type TOPIC is 
  922.     record
  923.       TOPIC_HEADER : SCREEN_LINE; 
  924.       NEXT_TOPIC   : TOPIC_ACCESS; 
  925.       LAST_TOPIC   : TOPIC_ACCESS; 
  926.       NEXT_LEVEL   : TOPIC_ACCESS; 
  927.       LAST_LEVEL   : TOPIC_ACCESS; 
  928.       INDEX_START  : SDIRECT.POSITIVE_COUNT; 
  929.       INDEX_STOP   : SDIRECT.POSITIVE_COUNT; 
  930.     end record; 
  931.  
  932.     -- 
  933.     -- These variables define the tree
  934.     --      FIRST_TOPIC points to the first node
  935.     -- 
  936.   FIRST_TOPIC   : TOPIC_ACCESS; 
  937.   CURRENT_TOPIC : TOPIC_ACCESS; 
  938.  
  939.   -- 
  940.   -- IS_DIGIT determines if the indicated character is a digit
  941.   -- 
  942.   function IS_DIGIT(CH : in CHARACTER) return BOOLEAN is 
  943.   begin
  944.     if (CH >= '0') and (CH <= '9') then 
  945.       return TRUE; 
  946.     else 
  947.       return FALSE; 
  948.     end if; 
  949.   end IS_DIGIT; 
  950.  
  951.   -- 
  952.   -- Initialize and build the tree
  953.   -- 
  954.   procedure INIT is 
  955.     INLINE : SCREEN_LINE; 
  956.     -- 
  957.     -- Build tree at next level
  958.     -- 
  959.     procedure INIT_NEXT_LEVEL(LEVEL      : in CHARACTER; 
  960.                               LAST_LEVEL : in TOPIC_ACCESS) is 
  961.       NEW_TOPIC       : TOPIC_ACCESS; 
  962.       CURRENT_TOPIC   : TOPIC_ACCESS; 
  963.       FIRST_NEW_TOPIC : BOOLEAN; 
  964.       -- 
  965.       -- Back up to previous screen in source
  966.       -- 
  967.       procedure BACKUP_FILE is 
  968.       begin
  969.         SDIRECT.SET_INDEX(SOURCE_FILE, SDIRECT.POSITIVE_COUNT'PRED(SDIRECT.INDEX
  970.           (SOURCE_FILE))); 
  971.       end BACKUP_FILE; 
  972.       -- 
  973.       -- Return index of current screen
  974.       -- 
  975.       function CURRENT_SCREEN_INDEX return SDIRECT.POSITIVE_COUNT is 
  976.       begin
  977.         return SDIRECT.INDEX(SOURCE_FILE); 
  978.       end CURRENT_SCREEN_INDEX; 
  979.       -- 
  980.       -- Return index of previous screen
  981.       -- 
  982.       function PREVIOUS_SCREEN_INDEX return SDIRECT.POSITIVE_COUNT is 
  983.       begin
  984.         return SDIRECT.POSITIVE_COUNT'PRED(CURRENT_SCREEN_INDEX); 
  985.       end PREVIOUS_SCREEN_INDEX; 
  986.       -- 
  987.       -- Determine if CURRENT_TOPIC.INDEX_STOP has been set
  988.       -- 
  989.       function CURRENT_INDEX_STOP_NOT_SET return BOOLEAN is 
  990.       begin
  991.         if SDIRECT.POSITIVE_COUNT'POS(CURRENT_TOPIC.INDEX_STOP) = 1 then 
  992.           return TRUE; 
  993.         else 
  994.           return FALSE; 
  995.         end if; 
  996.       end CURRENT_INDEX_STOP_NOT_SET; 
  997.       -- 
  998.       -- Read each screen of the data file and build tree
  999.       -- 
  1000.     begin
  1001.       FIRST_NEW_TOPIC := TRUE; 
  1002.       CURRENT_TOPIC := null; 
  1003.       while not SDIRECT.END_OF_FILE(SOURCE_FILE) loop
  1004.  
  1005.         -- 
  1006.         -- Read next screen and determine if it is a new topic
  1007.         -- 
  1008.         SDIRECT.READ(SOURCE_FILE, CURRENT_SCREEN); 
  1009.         NEW_LINE := CURRENT_SCREEN.LINES(1); 
  1010.         if NEW_LINE.LAST > 1 then 
  1011.           if IS_DIGIT(NEW_LINE.LINE(1)) and (NEW_LINE.LINE(2) = ' ') then 
  1012.  
  1013.             -- 
  1014.             -- Screen is a new topic
  1015.             -- 
  1016.             if LEVEL > NEW_LINE.LINE(1) then 
  1017.  
  1018.               -- 
  1019.               -- New topic is at a lower level, so back up and return to caller
  1020.               -- (who is at lower level)
  1021.               -- 
  1022.               BACKUP_FILE; 
  1023.               if CURRENT_TOPIC /= null then 
  1024.                 if CURRENT_INDEX_STOP_NOT_SET then 
  1025.                   CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  1026.                 end if; 
  1027.               end if; 
  1028.               exit; 
  1029.             end if; 
  1030.             if LEVEL < NEW_LINE.LINE(1) then 
  1031.  
  1032.               -- 
  1033. -- New topic is at higher level, so recursively call INIT_NEXT_LEVEL
  1034.               -- and build tree at this new level
  1035.               -- 
  1036.               BACKUP_FILE; 
  1037.               if CURRENT_TOPIC /= null then 
  1038.                 if CURRENT_INDEX_STOP_NOT_SET then 
  1039.                   CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  1040.                 end if; 
  1041.               end if; 
  1042.               INIT_NEXT_LEVEL(NEW_LINE.LINE(1), CURRENT_TOPIC); 
  1043.             else 
  1044.               NEW_TOPIC := new TOPIC; 
  1045.               if FIRST_NEW_TOPIC then 
  1046.                 if LAST_LEVEL /= null then 
  1047.                   LAST_LEVEL.NEXT_LEVEL := NEW_TOPIC; 
  1048.                 end if; 
  1049.                 FIRST_NEW_TOPIC := FALSE; 
  1050.               end if; 
  1051.               NEW_TOPIC.TOPIC_HEADER := NEW_LINE; 
  1052.               NEW_TOPIC.NEXT_TOPIC := null; 
  1053.               NEW_TOPIC.LAST_TOPIC := CURRENT_TOPIC; 
  1054.               NEW_TOPIC.NEXT_LEVEL := null; 
  1055.               NEW_TOPIC.LAST_LEVEL := LAST_LEVEL; 
  1056.               NEW_TOPIC.INDEX_START := PREVIOUS_SCREEN_INDEX; 
  1057.               NEW_TOPIC.INDEX_STOP := 1; 
  1058.               if CURRENT_TOPIC /= null then 
  1059.                 if CURRENT_INDEX_STOP_NOT_SET then 
  1060.                   CURRENT_TOPIC.INDEX_STOP := SDIRECT.POSITIVE_COUNT'PRED(
  1061.                     NEW_TOPIC.INDEX_START); 
  1062.                 end if; 
  1063.                 CURRENT_TOPIC.NEXT_TOPIC := NEW_TOPIC; 
  1064.               end if; 
  1065.               CURRENT_TOPIC := NEW_TOPIC; 
  1066.               if FIRST_TOPIC = null then 
  1067.                 FIRST_TOPIC := CURRENT_TOPIC; 
  1068.               end if; 
  1069.             end if; 
  1070.           end if; 
  1071.         end if; 
  1072.       end loop; 
  1073.       if CURRENT_INDEX_STOP_NOT_SET then 
  1074.         CURRENT_TOPIC.INDEX_STOP := PREVIOUS_SCREEN_INDEX; 
  1075.       end if; 
  1076.     end INIT_NEXT_LEVEL; 
  1077.     -- 
  1078.     -- INIT mainline follows
  1079.     -- 
  1080.   begin
  1081.     TEXT_IO.PUT("Help File (RETURN for Default)> "); 
  1082.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  1083.     begin
  1084.       if INLINE.LAST = 0 then 
  1085.         HELP_FILE (DEF_HELP_FILE, DEF_HELP_LAST);
  1086.         SDIRECT.OPEN(SOURCE_FILE, SDIRECT.IN_FILE, 
  1087.           DEF_HELP_FILE(1..DEF_HELP_LAST));
  1088.       else 
  1089.         SDIRECT.OPEN(SOURCE_FILE, SDIRECT.IN_FILE, INLINE.LINE(1 .. INLINE.LAST)
  1090.           ); 
  1091.       end if; 
  1092.     exception
  1093.       when others => 
  1094.         TEXT_IO.PUT_LINE("Help File not Found"); 
  1095.         raise STOP; 
  1096.     end; 
  1097.     FIRST_TOPIC := null; 
  1098.     CURRENT_TOPIC := null; 
  1099.     INIT_NEXT_LEVEL('1', null); 
  1100.     SDIRECT.RESET(SOURCE_FILE); 
  1101.   end INIT; 
  1102.  
  1103.   -- 
  1104.   -- Deinitialize system for exit
  1105.   -- 
  1106.   procedure DEINIT is 
  1107.   begin
  1108.     SDIRECT.CLOSE(SOURCE_FILE); 
  1109.   end DEINIT; 
  1110.  
  1111.   -- 
  1112.   -- Generate report at indicated level
  1113.   -- 
  1114.   procedure TEST_HELP(FIRST_TOPIC : in TOPIC_ACCESS; 
  1115.                       INDENT      : in NATURAL) is 
  1116.     TOPIC : TOPIC_ACCESS; 
  1117.   begin
  1118.     TOPIC := FIRST_TOPIC; 
  1119.     while TOPIC /= null loop
  1120.       if INDENT > 0 then 
  1121.         for I in 1 .. INDENT loop
  1122.           TEXT_IO.PUT(' '); 
  1123.         end loop; 
  1124.       end if; 
  1125.       TEXT_IO.PUT(TOPIC.TOPIC_HEADER.LINE(1 .. TOPIC.TOPIC_HEADER.LAST)); 
  1126.       TEXT_IO.PUT(": Start = "); 
  1127.       C_IO.PUT(TOPIC.INDEX_START, 3); 
  1128.       TEXT_IO.PUT("   Stop = "); 
  1129.       C_IO.PUT(TOPIC.INDEX_STOP, 3); 
  1130.       TEXT_IO.NEW_LINE; 
  1131.       if TOPIC.NEXT_LEVEL /= null then 
  1132.         TEST_HELP(TOPIC.NEXT_LEVEL, INDENT + 3); 
  1133.       end if; 
  1134.       TOPIC := TOPIC.NEXT_TOPIC; 
  1135.     end loop; 
  1136.   end TEST_HELP; 
  1137.  
  1138. -- 
  1139. -- HELP_analyze mainline follows
  1140. -- 
  1141. begin
  1142.   TEXT_IO.PUT_LINE("HELP Analyzer, Version " & VERSION); 
  1143.   INIT; 
  1144.   TEST_HELP(FIRST_TOPIC, 0); 
  1145.   DEINIT; 
  1146. end HELP_ANALYZE; 
  1147. ::::::::::
  1148. help_build.ada
  1149. ::::::::::
  1150.  
  1151. --|MODULE : HELP_BUILD
  1152. --|AUTHOR : CONN
  1153. --|LOCATION : PDL-TOOLS
  1154. --|SEE_ALSO : HELP
  1155. --|SEE_ALSO : HELP_ANALYZE
  1156. --|REQUIRES : HELP_SYSDEP
  1157. --|IEEE_PDL : SUPPORT_MODULE
  1158. --|DESIGN_STATUS         : DONE
  1159. --|IMPLEMENTATION_STATUS : DONE
  1160. --|DOCUMENTATION_STATUS  : DONE
  1161. --|DATE_RELEASED         : 9 Sep 85
  1162. --|DATE_LAST_MODIFIED    : 2 Mar 86
  1163. --|ABSTRACT :
  1164. --|     HELP_BUILD is used to create a direct-access file that
  1165. --| can be processed by HELP and HELP_ANALYZE.  HELP_BUILD accepts
  1166. --| as input a conventional text file and generates a direct-access
  1167. --| file in which each record is a screen display (size is specified
  1168. --| by HELP_SYSDEP values).  Screens are defined as follows:
  1169. --|
  1170. --|             1. when the number of text lines specified by
  1171. --| HELP_SYSDEP.SCREEN_LENGTH is exceeded, the current screen is
  1172. --| completed and a new screen is started
  1173. --|             2. when a screen-break command is encountered, the
  1174. --| current screen is completed and a new screen is started; the
  1175. --| screen-break command is a line containing only a period in column
  1176. --| one
  1177. --|             3. when a new topic is encountered, the current
  1178. --| screen is completed and a new screen is started; a topic is a
  1179. --| line with a digit in column 1, a space in column 2, and text
  1180. --| following
  1181. --|
  1182. --|     Topic levels and subordinate relationships are indicated by
  1183. --| the leading digits on a topic line.
  1184. --|     The following illustrates a simple help file text:
  1185. --|
  1186. --|     0 MAIN_TOPIC_1
  1187. --|             Text
  1188. --|     1 SUB_TOPIC_1
  1189. --|     1 SUB_TOPIC_2
  1190. --|     1 SUB_SUB_TOPIC_1
  1191. --|             Text, page 1
  1192. --|     .
  1193. --|             Text, page 2 (previous line caused screen-break)
  1194. --|     2 SUB_SUB_TOPIC_2
  1195. --|     2 SUB_SUB_TOPIC_3
  1196. --|     1 SUB_TOPIC_3
  1197. --|     0 MAIN_TOPIC_2
  1198. --|
  1199. --|     Topic level numbering does not have to be in sequence.
  1200. --| The numbers associated with subordinate topics need only
  1201. --| be greater than their parents.  For instance:
  1202. --|
  1203. --|     1 MAIN_TOPIC
  1204. --|     5 SUB_TOPIC
  1205. --|
  1206. --| is valid.
  1207. --|
  1208. with TEXT_IO; 
  1209. with HELP_SYSDEP; use HELP_SYSDEP; 
  1210. procedure HELP_BUILD is 
  1211.  
  1212.   package NAT_IO is 
  1213.     new TEXT_IO.INTEGER_IO(NATURAL); 
  1214.  
  1215.     -- 
  1216.     -- Constants, global variables, and special data
  1217.     -- 
  1218.   VERSION          : constant STRING(1 .. 3) := "1.1"; 
  1219.   SOURCE_FILE      : TEXT_IO.FILE_TYPE; 
  1220.   DESTINATION_FILE : SDIRECT.FILE_TYPE; 
  1221.   CURRENT_SCREEN   : SCREEN; 
  1222.   NEW_LINE         : SCREEN_LINE; 
  1223.   SCREEN_COUNT     : NATURAL; 
  1224.   HEADER_COUNT     : NATURAL; 
  1225.   DEF_HELP_FILE    : STRING (1..MAX_HELP_LENGTH);
  1226.   DEF_HELP_LAST    : NATURAL;
  1227.  
  1228.   -- 
  1229.   -- Exceptions
  1230.   -- 
  1231.   STOP             : exception; 
  1232.  
  1233.   -- 
  1234.   -- Identify source and destination files, init counters
  1235.   -- 
  1236.   procedure INIT is 
  1237.     INLINE : SCREEN_LINE; 
  1238.   begin
  1239.     TEXT_IO.PUT("Source Text File                       > "); 
  1240.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  1241.     if INLINE.LAST = 0 then 
  1242.       raise STOP; 
  1243.     end if; 
  1244.     begin
  1245.       TEXT_IO.OPEN(SOURCE_FILE, TEXT_IO.IN_FILE, INLINE.LINE(1 .. INLINE.LAST))
  1246.         ; 
  1247.     exception
  1248.       when others => 
  1249.         TEXT_IO.PUT_LINE(" Source file not found"); 
  1250.         raise STOP; 
  1251.     end; 
  1252.     TEXT_IO.PUT("Help File to Build (RETURN for Default)> "); 
  1253.     TEXT_IO.GET_LINE(INLINE.LINE, INLINE.LAST); 
  1254.     begin
  1255.       if INLINE.LAST = 0 then 
  1256.         HELP_FILE (DEF_HELP_FILE, DEF_HELP_LAST);
  1257.         SDIRECT.CREATE(DESTINATION_FILE, SDIRECT.OUT_FILE, 
  1258.           DEF_HELP_FILE(1..DEF_HELP_LAST));
  1259.       else 
  1260.         SDIRECT.CREATE(DESTINATION_FILE, SDIRECT.OUT_FILE, INLINE.LINE(1 .. 
  1261.           INLINE.LAST)); 
  1262.       end if; 
  1263.     exception
  1264.       when others => 
  1265.         TEXT_IO.PUT_LINE(" Cannot create destination file"); 
  1266.         raise STOP; 
  1267.     end; 
  1268.     SCREEN_COUNT := 0; 
  1269.     HEADER_COUNT := 0; 
  1270.   end INIT; 
  1271.  
  1272.   -- 
  1273.   -- Deinit cleanup
  1274.   -- 
  1275.   procedure DEINIT is 
  1276.   begin
  1277.     TEXT_IO.CLOSE(SOURCE_FILE); 
  1278.     SDIRECT.CLOSE(DESTINATION_FILE); 
  1279.   end DEINIT; 
  1280.  
  1281.   -- 
  1282.   -- Establish new screen
  1283.   -- 
  1284.   procedure NEW_SCREEN is 
  1285.   begin
  1286.     CURRENT_SCREEN.LAST := 0; 
  1287.   end NEW_SCREEN; 
  1288.  
  1289.   -- 
  1290.   -- Write current screen to output data file
  1291.   -- 
  1292.   procedure DUMP_SCREEN is 
  1293.   begin
  1294.     if CURRENT_SCREEN.LAST > 0 then 
  1295.       SDIRECT.WRITE(DESTINATION_FILE, CURRENT_SCREEN); 
  1296.       SCREEN_COUNT := SCREEN_COUNT + 1; 
  1297.     end if; 
  1298.     NEW_SCREEN; 
  1299.   end DUMP_SCREEN; 
  1300.  
  1301.   -- 
  1302.   -- Determine if text line begins with a number which identifies it as
  1303.   -- a topic
  1304.   -- 
  1305.   function LEADING_NUMBER(LINE : in STRING) return BOOLEAN is 
  1306.  
  1307.     function IS_DIGIT(CH : in CHARACTER) return BOOLEAN is 
  1308.     begin
  1309.       if (CH >= '0') and (CH <= '9') then 
  1310.         return TRUE; 
  1311.       else 
  1312.         return FALSE; 
  1313.       end if; 
  1314.     end IS_DIGIT; 
  1315.  
  1316.   begin
  1317.     if LINE'LENGTH = 0 then 
  1318.       return FALSE; 
  1319.     end if; 
  1320.  
  1321.     if not IS_DIGIT(LINE(LINE'FIRST)) then 
  1322.       return FALSE; 
  1323.     end if; 
  1324.  
  1325.     for I in LINE'FIRST .. LINE'LAST loop
  1326.       if LINE(I) = ' ' then 
  1327.         return TRUE; 
  1328.       end if; 
  1329.       if not IS_DIGIT(LINE(I)) then 
  1330.         return FALSE; 
  1331.       end if; 
  1332.     end loop; 
  1333.     return FALSE; 
  1334.   end LEADING_NUMBER; 
  1335.  
  1336.   -- 
  1337.   -- Mainline
  1338.   -- 
  1339. begin
  1340.   TEXT_IO.PUT_LINE("HELP File Builder, Version " & VERSION); 
  1341.   INIT; 
  1342.   NEW_SCREEN; 
  1343.  
  1344.   -- 
  1345.   -- Loop thru source file
  1346.   -- 
  1347.   while not TEXT_IO.END_OF_FILE(SOURCE_FILE) loop
  1348.  
  1349.     -- 
  1350.     -- Get new line
  1351.     -- 
  1352.     TEXT_IO.GET_LINE(SOURCE_FILE, NEW_LINE.LINE, NEW_LINE.LAST); 
  1353.  
  1354.     -- 
  1355.     -- If new topic, dump current screen and begin new header/screen
  1356.     -- 
  1357.     if LEADING_NUMBER(NEW_LINE.LINE(1 .. NEW_LINE.LAST)) then 
  1358.       DUMP_SCREEN; 
  1359.       HEADER_COUNT := HEADER_COUNT + 1; 
  1360.     end if; 
  1361.  
  1362.     -- 
  1363.     -- If page break command (line containing only a dot), dump current screen
  1364.     -- 
  1365.     if (NEW_LINE.LAST = 1) and (NEW_LINE.LINE(1) = '.') then 
  1366.       DUMP_SCREEN; 
  1367.     else 
  1368.  
  1369.       -- 
  1370.       -- If not page break, add line to current screen and dump current screen
  1371.       -- if screen fills
  1372.       -- 
  1373.       CURRENT_SCREEN.LAST := CURRENT_SCREEN.LAST + 1; 
  1374.       CURRENT_SCREEN.LINES(CURRENT_SCREEN.LAST) := NEW_LINE; 
  1375.       if CURRENT_SCREEN.LAST = SCREEN_LENGTH then 
  1376.         DUMP_SCREEN; 
  1377.       end if; 
  1378.     end if; 
  1379.   end loop; 
  1380.  
  1381.   -- 
  1382.   -- Dump last screen and print report
  1383.   -- 
  1384.   DUMP_SCREEN; 
  1385.   TEXT_IO.PUT("Number of Screens Written: "); 
  1386.   NAT_IO.PUT(SCREEN_COUNT, 5); 
  1387.   TEXT_IO.NEW_LINE; 
  1388.   TEXT_IO.PUT("Number of Headers Written: "); 
  1389.   NAT_IO.PUT(HEADER_COUNT, 5); 
  1390.   TEXT_IO.NEW_LINE; 
  1391.   DEINIT; 
  1392. end HELP_BUILD; 
  1393. ::::::::::
  1394. help.doc
  1395. ::::::::::
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.              User Manual for Online Documentation System
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.               by Richard Conn, TI Ada Technology Branch
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432. 1  HELP
  1433.  
  1434.  
  1435.  
  1436.      HELP is an online documentation system.  It  reads  data  from  a
  1437.  
  1438. direct-access file generated by HELP_BUILD and builds a tree which may
  1439.  
  1440. be as wide as desired and up to ten levels deep.  This  tree  contains
  1441.  
  1442. sets  of screen displays on various topics.  After building this tree,
  1443.  
  1444. HELP displays a menu of the topics at the highest level, and the  user
  1445.  
  1446. can  select  a  desired  topic by typing enough characters to uniquely
  1447.  
  1448. identify it.
  1449.  
  1450.  
  1451.  
  1452.      Once a desired topic  is  selected,  HELP  displays  the  screens
  1453.  
  1454. associated  with  this  topic,  allowing  the user to move to the next
  1455.  
  1456. screen, last screen, up to the menu he came from, and (if lower levels
  1457.  
  1458. of  information  exist) display a menu of the topics at the next lower
  1459.  
  1460. level.  From this new  menu,  the  process  is  repeated  (topics  are
  1461.  
  1462. selected, scanned, and lower levels of menus may be accessed.
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470. 1.1  EXECUTION OF TOOL
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476. VMS Command Required to Invoke Tool: PHELP
  1477.  
  1478. Input Files Required:
  1479.  
  1480.         Direct access help file
  1481.  
  1482. Output Files Generated: None
  1483.  
  1484. Notes:  PHELP is an interactive tool.
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494. 1.2  PROMPTS
  1495.  
  1496.  
  1497.  
  1498.      Two prompts are presented to the user during the execution of the
  1499.  
  1500. HELP  tool.   One  prompt  appears  when the user is viewing a menu of
  1501.  
  1502. topics he can select and the other appears when the  user  is  viewing
  1503.  
  1504. screens associated with a topic.
  1505.  
  1506.                                                                 Page 2
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.      The full prompt which can appear when a menu of topics  is  being
  1513.  
  1514. displayed is:
  1515.  
  1516.  
  1517.  
  1518. Level  N Menu: (Exit, Up, Next Menu Screen, Last Menu Screen,
  1519.  
  1520.         Selection)
  1521.  
  1522.  
  1523.  
  1524.      The various parts of this prompt have the following meanings:
  1525.  
  1526.  
  1527.  
  1528.      1.  Level N - Indicates the level in the tree you are  at.   This
  1529.  
  1530.          part of the prompt always appears.
  1531.  
  1532.  
  1533.  
  1534.      2.  Menu:  - Indicates that you are viewing a menu as opposed  to
  1535.  
  1536.          screens of a topic.  This part of the prompt always appears.
  1537.  
  1538.  
  1539.  
  1540.      3.  Exit - Indicates that the  Exit  command  (X)  is  available.
  1541.  
  1542.          This part of the prompt always appears.
  1543.  
  1544.  
  1545.  
  1546.      4.  Up - Indicates that the Up command (U or  UP)  is  available.
  1547.  
  1548.          If you are at the top level, this part of the prompt does not
  1549.  
  1550.          appear.  If you are below the top level, it does.
  1551.  
  1552.  
  1553.  
  1554.      5.  Next Menu Screen - Indicates that more  menu  screens  follow
  1555.  
  1556.          the  one  you are viewing and the Next command (N or NEXT) is
  1557.  
  1558.          available.  This prompt optionally appears.
  1559.  
  1560.  
  1561.  
  1562.      6.  Last Menu Screen - Indicates that one or  more  menu  screens
  1563.  
  1564.          preceed  the  one  you are viewing and the Last command (L or
  1565.  
  1566.          LAST) is available.  This prompt optionally appears.
  1567.  
  1568.  
  1569.  
  1570.      7.  Selection - Indicates that you may select a topic from any of
  1571.  
  1572.          the  screens  associated  with this menu.  The topic does not
  1573.  
  1574.          have to appear on the menu screen you are currently  viewing.
  1575.  
  1576.          This prompt always appears.
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.      The full prompt which can appear while viewing screens associated
  1583.  
  1584. with a particular topic is:
  1585.  
  1586.  
  1587.  
  1588. Level  N Topic: XXX (Print, Exit, Up, Next, Last, Menu)
  1589.  
  1590.  
  1591.  
  1592.      Various parts of this prompt are optional, and  the  meanings  of
  1593.  
  1594. the sections of this prompt are:
  1595.  
  1596.  
  1597.  
  1598.      1.  Level N - Indicates the current level.   This  prompt  always
  1599.  
  1600.          appears.
  1601.  
  1602.  
  1603.  
  1604.      2.  Topic:  XXX -  Indicates  the  name  of  the  topic  you  are
  1605.  
  1606.          viewing.  This prompt always appears.
  1607.  
  1608.  
  1609.  
  1610.      3.  Print - Indicates that the user may print the  current  topic
  1611.  
  1612.          (all  screens)  to  a  file.  The user is prompted for a file
  1613.  
  1614.          name in response to the P or  PRINT  command.   If  the  user
  1615.  
  1616.          changes  his  mind, striking the RETURN key aborts the print.
  1617.  
  1618.          Typing in a file name prints into  the  file.   The  user  is
  1619.  
  1620.          returned to the current screen after the print is performed.
  1621.  
  1622.                                                                 Page 3
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.      4.  Exit - Indicates that the  Exit  command  (X)  is  available.
  1629.  
  1630.          This prompt always appears.
  1631.  
  1632.  
  1633.  
  1634.      5.  Up - Indicates that the Up command (U or  UP)  is  available.
  1635.  
  1636.          This  command raises you to the next higher level (which is a
  1637.  
  1638.          menu).  This prompt always appears.
  1639.  
  1640.  
  1641.  
  1642.      6.  Next - Indicates that more screens on this topic follow.  The
  1643.  
  1644.          Next  command  (N  or  NEXT) displays the next screen to you.
  1645.  
  1646.          This prompt appears only if more  screens  follow.   Striking
  1647.  
  1648.          only the RETURN key has the same effect as the NEXT command.
  1649.  
  1650.  
  1651.  
  1652.      7.  Last - Indicates that one or more screens proceed the  screen
  1653.  
  1654.          you  are viewing on this topic.  The Last command (L or LAST)
  1655.  
  1656.          displays the previous screen to  you.   This  prompt  appears
  1657.  
  1658.          only if you are not at the first screen of a topic.
  1659.  
  1660.  
  1661.  
  1662.      8.  Menu - Indicates that a menu of subtopics under  the  current
  1663.  
  1664.          topic  is  available.   The  Menu  command  (M  or MENU) will
  1665.  
  1666.          display this menu to you.  This prompt appears only if one or
  1667.  
  1668.          more subtopics exist under the current topic.
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.      At any time, the ?  character (followed by a RETURN)  will  cause
  1675.  
  1676. the current screen to be refreshed.
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684. 1.3  ERROR MESSAGES
  1685.  
  1686.  
  1687.  
  1688.      Error messages generated by the HELP tool are  displayed  at  the
  1689.  
  1690. bottom of the screen with the following syntax:
  1691.  
  1692.  
  1693.  
  1694.         **** ERROR **** XXX Strike Any Key
  1695.  
  1696.  
  1697.  
  1698.      The possible error messages are:
  1699.  
  1700.  
  1701.  
  1702.      1.  At First Menu Screen.  The Last Screen command  (L  or  LAST)
  1703.  
  1704.          was  issued  when the user was already at the first screen of
  1705.  
  1706.          the menu display.
  1707.  
  1708.  
  1709.  
  1710.      2.  At First Screen.  The Last Screen command  (L  or  LAST)  was
  1711.  
  1712.          issued  when  the user was already at the first screen of the
  1713.  
  1714.          current topic.
  1715.  
  1716.  
  1717.  
  1718.      3.  At Last Screen.  The Next Screen  command  (N  or  NEXT)  was
  1719.  
  1720.          issued  when  the  user was already at the last screen of the
  1721.  
  1722.          current topic.
  1723.  
  1724.  
  1725.  
  1726.      4.  At Top Level Menu - No Upper Level.  The Up Level command  (U
  1727.  
  1728.          or  UP)  was issued when the user was at the highest level in
  1729.  
  1730.          the HELP tree.
  1731.  
  1732.                                                                 Page 4
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.      5.  Help File is Empty.  The HELP tool was  told  to  process  an
  1739.  
  1740.          empty file.
  1741.  
  1742.  
  1743.  
  1744.      6.  No Menu Available.  The Display Menu command (M or MENU)  was
  1745.  
  1746.          issued when no menu was available under the current topic.
  1747.  
  1748.  
  1749.  
  1750.      7.  No More Menu Screens.  The Next Screen command  (N  or  NEXT)
  1751.  
  1752.          was  issued  during  a  menu  display  when  the current menu
  1753.  
  1754.          display is the last display of this menu.
  1755.  
  1756.  
  1757.  
  1758.      8.  Topic XXX Not Found.  The user's menu selection is not in the
  1759.  
  1760.          list  of  topics  available  at  the  current  menu.  This is
  1761.  
  1762.          probably caused by the user misspelling the desired topic.
  1763.  
  1764.  
  1765.  
  1766.      9.  Unexpected Fatal Error.  An error which was not expected  was
  1767.  
  1768.          encountered in the HELP file processing.
  1769.  
  1770.  
  1771.  
  1772.     10.  Unknown Command -- XXX --.  The indicated  command  (XXX)  is
  1773.  
  1774.          invalid.  This command is not one of the HELP commands.
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784. 2  HELP_ANALYZE
  1785.  
  1786.  
  1787.  
  1788.      HELP_ANALYZE performs an analysis of a direct-access file created
  1789.  
  1790. by HELP_BUILD.  It indicates each of the topics contained in the file,
  1791.  
  1792. and,  by   indentation,   shows   their   hierarchical   relationship.
  1793.  
  1794. HELP_ANALYZE  also displays, using the symbols "Start =" and "Stop =",
  1795.  
  1796. the beginning and ending record numbers of each topic.
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804. 2.1  EXECUTION OF TOOL
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810. VMS Command Required to Invoke Tool: PHELP_ANALYZE
  1811.  
  1812. Input Files Required:
  1813.  
  1814.         Direct access help file
  1815.  
  1816. Output Files Generated: None
  1817.  
  1818. Notes:  PHELP_ANALYZE sends its report to the console.
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828. 2.2  ERROR MESSAGES
  1829.  
  1830.  
  1831.  
  1832.      "Help File Not Found" is the  only  error  message  generated  by
  1833.  
  1834. HELP_ANALYZE.
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842. 3  HELP_BUILD
  1843.  
  1844.  
  1845.  
  1846.      HELP_BUILD is used to create a direct-access  file  that  can  be
  1847.  
  1848.                                                                 Page 5
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854. processed  by  HELP  and  HELP_ANALYZE.  HELP_BUILD accepts as input a
  1855.  
  1856. conventional text file and generates a  direct-access  file  in  which
  1857.  
  1858. each record is a screen display.  Screens are defined as follows:
  1859.  
  1860.  
  1861.  
  1862.       *  When the number of text lines specified at installation  time
  1863.  
  1864.          is exceeded, the current screen is completed and a new screen
  1865.  
  1866.          is started.
  1867.  
  1868.  
  1869.  
  1870.       *  When a  screen-break  command  is  encountered,  the  current
  1871.  
  1872.          screen  is  completed  and  a  new  screen  is  started.  The
  1873.  
  1874.          screen-break command is a line containing only  a  period  in
  1875.  
  1876.          column one.
  1877.  
  1878.  
  1879.  
  1880.       *  When a new  topic  is  encountered,  the  current  screen  is
  1881.  
  1882.          completed  and  a  new  screen is started.  A topic is a line
  1883.  
  1884.          with a digit in column 1, a  space  in  column  2,  and  text
  1885.  
  1886.          following.
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896. 3.1  EXECUTION OF TOOL
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902. VMS Command Required to Invoke Tool: PHELP_BUILD
  1903.  
  1904. Input Files Required:
  1905.  
  1906.         Text file in proper format
  1907.  
  1908. Output Files Generated:
  1909.  
  1910.         Direct access help data file
  1911.  
  1912. Notes:
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922. 3.2  HELP FILE STRUCTURE
  1923.  
  1924.  
  1925.  
  1926.      Topic levels and subordinate relationships are indicated  by  the
  1927.  
  1928. leading  digits  on  a topic line.  The following illustrates a simple
  1929.  
  1930. help file text:
  1931.  
  1932.  
  1933.  
  1934.         0 MAIN_TOPIC_1
  1935.  
  1936.                 Text
  1937.  
  1938.         1 SUB_TOPIC_1
  1939.  
  1940.         1 SUB_TOPIC_2
  1941.  
  1942.         1 SUB_SUB_TOPIC_1
  1943.  
  1944.                 Text, page 1
  1945.  
  1946.         .
  1947.  
  1948.                 Text, page 2 (previous line caused screen-break)
  1949.  
  1950.         2 SUB_SUB_TOPIC_2
  1951.  
  1952.         2 SUB_SUB_TOPIC_3
  1953.  
  1954.         1 SUB_TOPIC_3
  1955.  
  1956.         0 MAIN_TOPIC_2
  1957.  
  1958.                                                                 Page 6
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.      Topic level numbering does not  have  to  be  in  sequence.   The
  1965.  
  1966. numbers  associated  with subordinate topics need only be greater than
  1967.  
  1968. their parents.  For instance:
  1969.  
  1970.  
  1971.  
  1972.         1 MAIN_TOPIC
  1973.  
  1974.         5 SUB_TOPIC
  1975.  
  1976. and
  1977.  
  1978.         1 MAIN_TOPIC
  1979.  
  1980.         2 SUB_TOPIC
  1981.  
  1982.  
  1983.  
  1984. are valid and equivalent forms.
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992. 3.3  ERROR MESSAGES
  1993.  
  1994.  
  1995.  
  1996.      The following error messages may be displayed to the  console  by
  1997.  
  1998. HELP_BUILD:
  1999.  
  2000.  
  2001.  
  2002.      1.  Cannot Create Destination File.  The output  file  cannot  be
  2003.  
  2004.          created  for  some  reason.  Lack of disk space or an invalid
  2005.  
  2006.          file name are two possible reasons.
  2007.  
  2008.  
  2009.  
  2010.      2.  Source File Not Found.  The file specified  by  the  user  as
  2011.  
  2012.          source for HELP_BUILD does not exist.
  2013.  
  2014.  
  2015. ::::::::::
  2016. help.rno
  2017. ::::::::::
  2018. .ap
  2019. .figure 4
  2020. .center; User Manual for Online Documentation System
  2021. .figure 2
  2022. .center; by Richard Conn, TI Ada Technology Branch
  2023. .figure 4
  2024. .HEADER LEVEL 1 HELP
  2025.     HELP is an online documentation system.  It reads data
  2026. from a direct-access file generated by HELP__BUILD and builds
  2027. a tree which may be as wide as desired and up to ten levels
  2028. deep.  This tree contains sets of screen displays on various
  2029. topics.  After building this tree, HELP displays a menu of
  2030. the topics at the highest level, and the user can select a
  2031. desired topic by typing enough characters to uniquely identify
  2032. it.
  2033.     Once a desired topic is selected, HELP displays the screens
  2034. associated with this topic, allowing the user to move to the
  2035. next screen, last screen, up to the menu he came from, and
  2036. (if lower levels of information exist) display a menu of the
  2037. topics at the next lower level.  From this new menu, the process
  2038. is repeated (topics are selected, scanned, and lower levels of
  2039. menus may be accessed.
  2040. .HEADER LEVEL 2 EXECUTION OF TOOL
  2041. .literal
  2042.  
  2043. VMS Command Required to Invoke Tool: PHELP
  2044. Input Files Required:
  2045.     Direct access help file
  2046. Output Files Generated: None
  2047. Notes:  PHELP is an interactive tool.
  2048.  
  2049. .end literal
  2050. .HEADER LEVEL 2 PROMPTS
  2051.     Two prompts are presented to the user during the execution of
  2052. the HELP tool.  One prompt appears when the user is viewing a menu of
  2053. topics he can select and the other appears when the user is viewing
  2054. screens associated with a topic.
  2055.     The full prompt which can appear when a menu of topics is being
  2056. displayed is:
  2057. .literal
  2058.  
  2059. Level  N Menu: (Exit, Up, Next Menu Screen, Last Menu Screen,
  2060.     Selection)
  2061. .end literal
  2062.     The various parts of this prompt have the following meanings:
  2063. .no autoparagraph
  2064. .list
  2065. .LIST ELEMENT; Level N - Indicates the level in the tree you are at.
  2066. This part of the prompt always appears.
  2067. .LIST ELEMENT; Menu: - Indicates that you are viewing a menu as opposed to
  2068. screens of a topic.  This part of the prompt always appears.
  2069. .LIST ELEMENT; Exit - Indicates that the Exit command (X) is available.
  2070. This part of the prompt always appears.
  2071. .LIST ELEMENT; Up - Indicates that the Up command (U or UP) is available.
  2072. If you are at the top level, this part of the prompt does not appear.  If
  2073. you are below the top level, it does.
  2074. .LIST ELEMENT; Next Menu Screen - Indicates that more menu screens follow
  2075. the one you are viewing and the Next command (N or NEXT) is available.
  2076. This prompt optionally appears.
  2077. .LIST ELEMENT; Last Menu Screen - Indicates that one or more menu screens
  2078. preceed the one you are viewing and the Last command (L or LAST) is
  2079. available.  This prompt optionally appears.
  2080. .LIST ELEMENT; Selection - Indicates that you may select a topic from
  2081. any of the screens associated with this menu.  The topic does not have
  2082. to appear on the menu screen you are currently viewing.  This prompt always
  2083. appears.
  2084. .end list
  2085. .ap
  2086.     The full prompt which can appear while viewing screens associated
  2087. with a particular topic is:
  2088. .literal
  2089.  
  2090. Level  N Topic: XXX (Print, Exit, Up, Next, Last, Menu)
  2091. .end literal
  2092.     Various parts of this prompt are optional, and the meanings of
  2093. the sections of this prompt are:
  2094. .no autoparagraph
  2095. .list
  2096. .LIST ELEMENT; Level N - Indicates the current level.
  2097. This prompt always appears.
  2098. .LIST ELEMENT; Topic: XXX - Indicates the name of the topic you are viewing.
  2099. This prompt always appears.
  2100. .LIST ELEMENT; Print - Indicates that the user may print the current topic
  2101. (all screens) to a file.  The user is prompted for a file name in response
  2102. to the P or PRINT command.  If the user changes his mind, striking the
  2103. RETURN key aborts the print.  Typing in a file name prints into the file.
  2104. The user is returned to the current screen after the print is performed.
  2105. .LIST ELEMENT; Exit - Indicates that the Exit command (X) is available.
  2106. This prompt always appears.
  2107. .LIST ELEMENT; Up - Indicates that the Up command (U or UP) is available.
  2108. This command raises you to the next higher level (which is a menu).  This
  2109. prompt always appears.
  2110. .LIST ELEMENT; Next - Indicates that more screens on this topic follow.
  2111. The Next command (N or NEXT) displays the next screen to you.  This prompt
  2112. appears only if more screens follow.
  2113. Striking only the RETURN key has the same effect as the NEXT command.
  2114. .LIST ELEMENT; Last - Indicates that one or more screens proceed the
  2115. screen you are viewing on this topic.  The Last command (L or LAST) displays
  2116. the previous screen to you.  This prompt appears only if you are not at the
  2117. first screen of a topic.
  2118. .LIST ELEMENT; Menu - Indicates that a menu of subtopics under the current
  2119. topic is available.  The Menu command (M or MENU) will display this menu to
  2120. you.  This prompt appears only if one or more subtopics exist under the
  2121. current topic.
  2122. .end list
  2123. .ap
  2124.     At any time, the ? character (followed by a RETURN) will
  2125. cause the current screen to be refreshed.
  2126. .HEADER LEVEL 2 ERROR MESSAGES
  2127.     Error messages generated by the HELP tool are displayed at
  2128. the bottom of the screen with the following syntax:
  2129. .literal
  2130.  
  2131.     **** ERROR **** XXX Strike Any Key
  2132. .end literal
  2133.     The possible error messages are:
  2134. .no autoparagraph
  2135. .list
  2136. .LIST ELEMENT; At First Menu Screen.  The Last Screen command (L or LAST)
  2137. was issued when the user was already at the first screen of the menu display.
  2138. .LIST ELEMENT; At First Screen.  The Last Screen command (L or LAST)
  2139. was issued when the user was already at the first screen of the
  2140. current topic.
  2141. .LIST ELEMENT; At Last Screen.  The Next Screen command (N or NEXT)
  2142. was issued when the user was already at the last screen of the
  2143. current topic.
  2144. .LIST ELEMENT; At Top Level Menu - No Upper Level.  The Up Level command
  2145. (U or UP) was issued when the user was at the highest level in the HELP
  2146. tree.
  2147. .LIST ELEMENT; Help File is Empty.  The HELP tool was told to process an
  2148. empty file.
  2149. .LIST ELEMENT; No Menu Available.  The Display Menu command (M or MENU)
  2150. was issued when no menu was available under the current topic.
  2151. .LIST ELEMENT; No More Menu Screens.  The Next Screen command (N or NEXT)
  2152. was issued during a menu display when the current menu display is the
  2153. last display of this menu.
  2154. .LIST ELEMENT; Topic XXX Not Found.  The user's menu selection is not in
  2155. the list of topics available at the current menu.  This is probably
  2156. caused by the user misspelling the desired topic.
  2157. .LIST ELEMENT; Unexpected Fatal Error.  An error which was not expected
  2158. was encountered in the HELP file processing.
  2159. .LIST ELEMENT; Unknown Command -- XXX --.  The indicated command (XXX)
  2160. is invalid.  This command is not one of the HELP commands.
  2161. .end list
  2162. .ap
  2163.  
  2164. .HEADER LEVEL 1 HELP__ANALYZE
  2165.     HELP__ANALYZE performs an analysis of a direct-access
  2166. file created by HELP__BUILD.  It indicates each of the topics
  2167. contained in the file, and, by indentation, shows their
  2168. hierarchical relationship.  HELP__ANALYZE also displays, using
  2169. the symbols "Start =" and "Stop =", the beginning and ending
  2170. record numbers of each topic.
  2171. .HEADER LEVEL 2 EXECUTION OF TOOL
  2172. .literal
  2173.  
  2174. VMS Command Required to Invoke Tool: PHELP_ANALYZE
  2175. Input Files Required:
  2176.     Direct access help file
  2177. Output Files Generated: None
  2178. Notes:  PHELP_ANALYZE sends its report to the console.
  2179.  
  2180. .end literal
  2181. .HEADER LEVEL 2 ERROR MESSAGES
  2182.     "Help File Not Found" is the only error message generated
  2183. by HELP__ANALYZE.
  2184.  
  2185. .HEADER LEVEL 1 HELP__BUILD
  2186.     HELP__BUILD is used to create a direct-access file that
  2187. can be processed by HELP and HELP__ANALYZE.  HELP__BUILD accepts
  2188. as input a conventional text file and generates a direct-access
  2189. file in which each record is a screen display.
  2190. Screens are defined as follows:
  2191. .no autoparagraph
  2192. .list "*"
  2193. .LIST ELEMENT; When the number of text lines specified at installation
  2194. time is exceeded, the current screen is
  2195. completed and a new screen is started.
  2196. .LIST ELEMENT; When a screen-break command is encountered, the
  2197. current screen is completed and a new screen is started.  The
  2198. screen-break command is a line containing only a period in column
  2199. one.
  2200. .LIST ELEMENT; When a new topic is encountered, the current
  2201. screen is completed and a new screen is started.  A topic is a
  2202. line with a digit in column 1, a space in column 2, and text
  2203. following.
  2204. .end list
  2205. .ap
  2206. .HEADER LEVEL 2 EXECUTION OF TOOL
  2207. .literal
  2208.  
  2209. VMS Command Required to Invoke Tool: PHELP_BUILD
  2210. Input Files Required:
  2211.     Text file in proper format
  2212. Output Files Generated:
  2213.     Direct access help data file
  2214. Notes:
  2215.  
  2216. .end literal
  2217. .HEADER LEVEL 2 HELP FILE STRUCTURE
  2218.     Topic levels and subordinate relationships are indicated by
  2219. the leading digits on a topic line.
  2220. The following illustrates a simple help file text:
  2221. .literal
  2222.  
  2223.     0 MAIN_TOPIC_1
  2224.         Text
  2225.     1 SUB_TOPIC_1
  2226.     1 SUB_TOPIC_2
  2227.     1 SUB_SUB_TOPIC_1
  2228.         Text, page 1
  2229.     .
  2230.         Text, page 2 (previous line caused screen-break)
  2231.     2 SUB_SUB_TOPIC_2
  2232.     2 SUB_SUB_TOPIC_3
  2233.     1 SUB_TOPIC_3
  2234.     0 MAIN_TOPIC_2
  2235. .end literal
  2236.     Topic level numbering does not have to be in sequence.
  2237. The numbers associated with subordinate topics need only
  2238. be greater than their parents.  For instance:
  2239. .literal
  2240.  
  2241.     1 MAIN_TOPIC
  2242.     5 SUB_TOPIC
  2243. and
  2244.     1 MAIN_TOPIC
  2245.     2 SUB_TOPIC
  2246.  
  2247. .end literal
  2248. are valid and equivalent forms.
  2249. .HEADER LEVEL 2 ERROR MESSAGES
  2250.     The following error messages may be displayed to the console
  2251. by HELP__BUILD:
  2252. .no autoparagraph
  2253. .list
  2254. .LIST ELEMENT; Cannot Create Destination File.  The output file cannot
  2255. be created for some reason.  Lack of disk space or an invalid file
  2256. name are two possible reasons.
  2257. .LIST ELEMENT; Source File Not Found.  The file specified by the
  2258. user as source for HELP__BUILD does not exist.
  2259. .end list
  2260. .ap
  2261.