home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / edit / ed2.doc < prev    next >
Encoding:
Text File  |  1988-05-03  |  46.1 KB  |  1,585 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.                              ALED - Ada Line Editor
  22.  
  23.                    A Line-Oriented File Editor written in Ada
  24.  
  25.  
  26.                                  by Richard Conn
  27.                                 Texas Instruments
  28.                           Advanced Computer Systems Lab
  29.                               Ada Technology Branch
  30.  
  31.                                 10 December 1984
  32.  
  33.  
  34.                                    Version 2.0
  35.                                  21 January 1985
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                 C O N T E N T S 
  71.  
  72.           1. INTRODUCTION...............................................1
  73.  
  74.           2. USING ALED.................................................2
  75.              2.1. PRELIMINARIES.........................................4
  76.                   2.1.1. LINE RANGES....................................4
  77.                   2.1.2. LINE REFERENCES................................5
  78.                   2.1.3. STRINGS and LINES..............................5
  79.                   2.1.4. INPUT LINE EDITOR..............................6
  80.                   2.1.5. ABORTING COMMANDS..............................6
  81.              2.2. COMMANDS..............................................6
  82.  
  83.           3. SYNOPSIS and COMMENTS......................................9
  84.  
  85.  
  86.         
  87.         APPENDICES
  88.  
  89.           A. SAMPLE SESSION............................................10
  90.  
  91.              Index.....................................................20
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                 ALED - A Line-Oriented File Editor Written in Ada
  134.  
  135.  
  136.  
  137.  
  138.                              ALED - Ada Line Editor
  139.  
  140.                    A Line-Oriented File Editor written in Ada
  141.  
  142.  
  143.                                  by Richard Conn
  144.                                 Texas Instruments
  145.                           Advanced Computer Systems Lab
  146.                               Ada Technology Branch
  147.  
  148.                                 10 December 1984
  149.  
  150.                                    Version 2.0
  151.                                  21 January 1985
  152.  
  153.  
  154.         1. I N T R O D U C T I O N 
  155.  
  156.              ALED  is a relatively simple line-oriented file editor which 
  157.         is  written  in the Ada (trademark,  United States Department  of 
  158.         Defense)  programming language.   It was written to  satisfy  the 
  159.         following needs:
  160.  
  161.                   (1)  to help the author learn the Ada language  by 
  162.             writing  a useful program whose scope (at a few thousand 
  163.             lines) is reasonable
  164.  
  165.                   (2)  to  help  others  wanting  to  learn  Ada  by 
  166.             providing a "living example" of an editor written in Ada
  167.  
  168.                   (3)  to make a transportable  editor,  written  in 
  169.             Ada, available for use on a variety of machines; efforts 
  170.             were  made  to  isolate any system dependencies  to  the 
  171.             package  SYSDEP,  so  the code should  be  transportable 
  172.             between all machines that have a validated Ada  compiler 
  173.             and  have the routines GET and PUT in the package SYSDEP 
  174.             implemented
  175.  
  176.  
  177.              This document is divided into two parts:  (1) an overview on 
  178.         the operation of the editor from the user's perspective and (2) a 
  179.         synopsis  of  what was learned during its design and comments  on 
  180.         the design in general.
  181.  
  182.              Version  1.0  of  ALED which has been released  to  the  Ada 
  183.         Repository  is  the Engineering Development Model (EDM) of  ALED.  
  184.         An Advanced Development Model,  which was completed some time ago 
  185.         and  will never be released,  was written to learn the basics  of 
  186.         the  problem  and  to prove that the  problem  could  be  solved.  
  187.         Version 2.x is the production model of ALED. 
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                                       Page 1
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                 ALED - A Line-Oriented File Editor Written in Ada
  200.  
  201.  
  202.  
  203.         2. U S I N G   A L E D 
  204.  
  205.              ALED  was designed and implemented on a Data General MV10000 
  206.         under  the ROLM Ada Development Environment.   It is  invoked  on 
  207.         this system by typing
  208.  
  209.                                     X EDITOR
  210.  
  211.         where  EDITOR.PR is the name of the file containing the object of 
  212.         ALED after compilation and linking.   This invocation results  in 
  213.         the following banner being displayed:
  214.  
  215.                ALED - Ada Line Editor by Richard Conn, Version 2.0
  216.                File Name? 
  217.  
  218.         The  user is expected to enter the name of the file to be  edited 
  219.         at  this time.   A file name must be specified,  and one will  be 
  220.         created  if the file does not exist.   If the indicated text file 
  221.         exists,  its  contents  will be read into  a  doubly-linked  list 
  222.         created  by ALED and made ready for editing.   Input line editing 
  223.         (see the following section on the Input Line Editor) is  allowed, 
  224.         so the user can correct any errors he makes while typing the file 
  225.         name.
  226.  
  227.              After the indicated file is read in or created, ALED prompts 
  228.         the user with
  229.  
  230.                   n>
  231.  
  232.         where  "n"  is 0 if there are no lines in the file (the  file  is 
  233.         empty) or 1 if there are lines in the file.   The number in front 
  234.         of  the ">" character is the number of the current line.   As the 
  235.         user  moves through the file,  this number will be  updated  each 
  236.         time the prompt appears.
  237.  
  238.              Once   this  prompt  appears,   ALED  uses  single-character 
  239.         commands  with command completion and prompting to  interface  to 
  240.         the  user.   In  response  to  any one  of  the  single-character 
  241.         commands  recognized by ALED,  the ALED editor will complete  the 
  242.         text  of  the  command,  prompt the  user  for  input  parameters 
  243.         (allowing him to abort by providing no input in most cases),  and 
  244.         then perform the function of the command.  ALED is interactive in 
  245.         nature, and the learning curve for ALED is quite short.  Built-in 
  246.         summary  documentation  is  provided  by means of  the  H  (Help) 
  247.         Summary  command;  to illustrate,  when the letter "h"  is  typed 
  248.         (case  is  not  significant on letter commands) and  the  summary 
  249.         option is selected, the following display is presented:
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                                       Page 2
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                 ALED - A Line-Oriented File Editor Written in Ada
  266.  
  267.  
  268.  
  269.  
  270.         --- Movement Commands ---  ----- Enter Lines -----
  271.          + Advance N Lines          A Append after <line> 
  272.          - Back Up N Lines          I Insert before <line>
  273.          F Find <string> in <range>                       
  274.          J Jump to <line>          ----- Print Lines -----
  275.          N Find Next <string>       . Print Current Line  
  276.         ----- Delete Command -----  < Print Next Line     
  277.          D Delete lines in <range>  > Print Next Line     
  278.                                     L List over <range>   
  279.         ---- Help and Exits ----                          
  280.          H This Help Text          ---- Substitution ---- 
  281.          Q Quit without Updating    S String Substitute   
  282.          X Exit and Update              over <range>      
  283.  
  284.         ---- File Get/Put ----     -- Miscellaneous --    
  285.          G Get <file> after <line>  ? Print Statistics    
  286.          P Put <file> over <range>                        
  287.  
  288.         <Range>:  %   %,%
  289.         First or Second Entries --
  290.            #-Number, .-Current, C-Current, F-First, L-Last
  291.         Singular Entries --
  292.            A-All, P-Page
  293.  
  294.  
  295.                   -- Figure 1: ALED Help Command and Display --
  296.  
  297.              To reiterate, the above display was generated as follows:
  298.  
  299.                   1) the prompt "0>" was printed by ALED
  300.                   2) the user typed the letter "h" followed by the
  301.                        letter "s" to select the summary
  302.                   3) the command summary was printed by ALED
  303.                        command
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                                       Page 3
  326.  
  327.  
  328.  
  329.  
  330.  
  331.                 ALED - A Line-Oriented File Editor Written in Ada
  332.  
  333.  
  334.  
  335.         2.1. PRELIMINARIES
  336.  
  337.         2.1.1. LINE RANGES
  338.              Several of the ALED commands, such as List and Find, perform 
  339.         their operations over a range of lines.  They prompt the user for 
  340.         this  line  range with the herald "<range>".   Examples  of  this 
  341.         prompt are:
  342.  
  343.                   1) list lines in <range>
  344.                   2) find <string>
  345.                       over <range>
  346.                   3) substitute for old <string>
  347.                       new <string>
  348.                       over <range>
  349.  
  350.              Whenever the range prompt ("<range>") is presented, the user 
  351.         may enter any of the following responses:
  352.  
  353.                   Response       Meaning
  354.                   --------       -------
  355.                   A or a         All Lines
  356.                   P or p         Current Page (next 20 lines)
  357.                   . or C or c    Current Line
  358.                   F or f         First Line
  359.                   L or l         Last Line
  360.  
  361.                   #,#            A pair of line numbers, like "5,8",
  362.                                   or relative line references, like
  363.                                   "-5,+10" for 5 lines before the
  364.                                   current line to 10 lines after the
  365.                                   current line, or any combination,
  366.                                   like "5,+10" for line 5 to 10 lines
  367.                                   after the current line; the only
  368.                                   restriction is that the first number
  369.                                   must evaluate to be less than the
  370.                                   second number
  371.  
  372.                   s,s            A mixture of the symbols for Current
  373.                                   Line, First Line, Last Line, and
  374.                                   a line number or relative line
  375.                                   reference, like ".,L" for current
  376.                                   line to the last line, "1,." for line
  377.                                   1 to the current line, "F,." for first
  378.                                   line to the current line, "-5,." for
  379.                                   five lines before the current line to
  380.                                   the current line, etc.
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                                                       Page 4
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                 ALED - A Line-Oriented File Editor Written in Ada
  398.  
  399.  
  400.  
  401.              Examples:
  402.  
  403.                   list lines in <range> A       <-- all lines
  404.                   list lines in <range> .,L     <-- current to last
  405.                   list lines in <range> 1,5     <-- lines 1 to 5
  406.                   list lines in <range> -5,+6   <-- 5 lines before the
  407.                                                      current line to 6
  408.                                                      lines after the
  409.                                                      current line
  410.                   list lines in <range> P       <-- next 20 lines
  411.                   list lines in <range> F,L     <-- same as All lines
  412.  
  413.  
  414.         2.1.2. LINE REFERENCES
  415.              Some  commands operate only on a specific line,  such as the 
  416.         Append and Insert commands.   The user is to indicate a  specific 
  417.         line, as opposed to a range of lines, in response to the "<line>" 
  418.         herald printed by these commands; for example:
  419.  
  420.                   append after <line>
  421.                   insert before <line>
  422.  
  423.              Any  of the forms indicated above may be used to define this 
  424.         line reference,  and the indicated line becomes the first line of 
  425.         the range.   For instance,  if "A" (all lines) is the response to 
  426.         the  herald,  then line 1 is the indicated line since  all  lines 
  427.         references  line  1  to the last line.   It is usually  safer  to 
  428.         reference only one line in response to the "<line>" herald (like, 
  429.         "5" or ".") rather than to use a range specification.
  430.  
  431.  
  432.         2.1.3. STRINGS and LINES
  433.              Some  commands accept a string or a line as input,  such  as 
  434.         the  Substitute and Insert commands.   In both  cases,  the  text 
  435.         which  is input by the user is simply a group of characters.   No 
  436.         quotes or other delimiters are necessary.   A blank line is input 
  437.         by simply striking the RETURN key or entering any number of space 
  438.         characters followed by the RETURN key.
  439.  
  440.              When  inputting  a group of lines via the Append  or  Insert 
  441.         commands, the lines are prompted for with the herald:
  442.  
  443.                   n:
  444.  
  445.         where  "n" is the number of the line that is about to  be  input.  
  446.         The  user may enter characters as he desires in response to  this 
  447.         prompt;  blank lines may be entered by simply striking the RETURN 
  448.         key.   To  terminate  input,  the user enters a single dot  (".") 
  449.         followed by RETURN.   See the sample session below and experiment 
  450.         with the editor itself for clarification.
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                                       Page 5
  458.  
  459.  
  460.  
  461.  
  462.  
  463.                 ALED - A Line-Oriented File Editor Written in Ada
  464.  
  465.  
  466.  
  467.         2.1.4. INPUT LINE EDITOR
  468.              The  user has the ability to edit his string or line  inputs 
  469.         as he enters each character.  This is done by striking any one of 
  470.         the  three input line editor command characters.   The  following 
  471.         table  summarizes these characters,  giving their default  values 
  472.         and the functions they perform.
  473.  
  474.         Default
  475.          Value    Function
  476.         -------   --------
  477.          <DEL>    Delete previous character
  478.           ^U      Delete all previous characters and restart input
  479.           ^R      Retype the line or string entered so far
  480.  
  481.              These  default values may be changed to some other values by 
  482.         editing the source code and changing three constants.
  483.  
  484.         2.1.5. ABORTING COMMANDS
  485.              If the user strikes a command by accident, most commands may 
  486.         be aborted by simply doing the following:
  487.  
  488.                   1)  not specifying a range of lines (enter a RETURN  in 
  489.         response to the <range> herald)
  490.                   2) not specifying a line (enter a RETURN in response to 
  491.         the <line> herald)
  492.                   3)  not  specifying  a file name for the  Get  and  Put 
  493.         commands (enter a RETURN)
  494.  
  495.  
  496.  
  497.  
  498.         2.2. COMMANDS
  499.              The  following presents the various commands of  ALED.   The 
  500.         sample session illustrates their use.
  501.  
  502.              COMMAND:  .
  503.              FUNCTION: Print the current line
  504.              The "." command prints the current line.
  505.  
  506.              COMMAND:  <
  507.              FUNCTION: Back up to the last line and print it
  508.              The "<" command backs up to the last line and prints it.
  509.  
  510.              COMMAND:  >
  511.              FUNCTION: Advance to the next line and print it
  512.              The ">" command advances to the next line and prints it.
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                                                       Page 6
  524.  
  525.  
  526.  
  527.  
  528.  
  529.                 ALED - A Line-Oriented File Editor Written in Ada
  530.  
  531.  
  532.              COMMAND:  +
  533.              FUNCTION: Advance n lines from the current line
  534.              The  "+" command moves the user an indicated number of lines 
  535.         forward from his current position.
  536.  
  537.              COMMAND:  -
  538.              FUNCTION: Back up n lines from the current line
  539.              The "-" command moves the user an indicated number of  lines 
  540.         backward from his current position.
  541.  
  542.              COMMAND:  ?
  543.              FUNCTION: Print statistics
  544.              The "?" command prints the name of the file being edited and 
  545.         the number of lines in the edit buffer.
  546.  
  547.              COMMAND:  A
  548.              FUNCTION: Append lines
  549.              The  A  command allows the user to enter a  group  of  lines 
  550.         after the indicated line.  Lines are entered until the user types 
  551.         a line containing a single dot (".") in the first column followed 
  552.         by  a  RETURN.   The Insert command is like  the  Append  command 
  553.         except  that  it inserts lines BEFORE the indicated  line,  where 
  554.         Append appends lines AFTER the indicated line.
  555.  
  556.              COMMAND:  D
  557.              FUNCTION: Delete lines
  558.              The  D command deletes all lines over the indicated range of 
  559.         lines.  There is no recovery from this command.
  560.  
  561.              COMMAND:  F
  562.              FUNCTION: Find the first occurance of a string
  563.              The  F  command searches for the indicated string  over  the 
  564.         indicated  range  of lines.   The first line in the  range  which 
  565.         contains the string is positioned to and the line is printed.
  566.  
  567.              COMMAND:  G
  568.              FUNCTION: Get a File
  569.              The  G  command  loads the indicated file  into  the  editor 
  570.         buffer  after the indicated line.   This command can be  used  to 
  571.         read  in  a  file  to be included in the edit  buffer  for  paste 
  572.         operations,  where  the  Put  command is  the  complementary  cut 
  573.         operation.
  574.  
  575.              COMMAND:  H
  576.              FUNCTION: Print Help Information
  577.              The  H command prints a summary of the ALED  commands,  just 
  578.         the  names of the ALED commands,  or a summary of  numeric  input 
  579.         options to the user.
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                                       Page 7
  590.  
  591.  
  592.  
  593.  
  594.  
  595.                 ALED - A Line-Oriented File Editor Written in Ada
  596.  
  597.  
  598.  
  599.              COMMAND:  I
  600.              FUNCTION: Insert lines
  601.              The  I  command allows the user to enter a  group  of  lines 
  602.         before  the  indicated line.   Lines are entered until  the  user 
  603.         types  a  line containing a single dot (".") in the first  column 
  604.         followed  by  a RETURN.   The Append command is like  the  Insert 
  605.         command  except that it appends lines AFTER the  indicated  line, 
  606.         where Insert inserts lines BEFORE the indicated line.
  607.  
  608.              COMMAND:  J
  609.              FUNCTION: Jump to the indicated line
  610.              The J command positions the user at the indicated line.  The 
  611.         line is not printed.
  612.  
  613.              COMMAND:  L
  614.              FUNCTION: List lines over a range
  615.              The  L  command lists all lines over the indicated range  of 
  616.         lines.
  617.  
  618.              COMMAND:  N
  619.              FUNCTION: Find Next occurance of indicated string
  620.              The  N command searches for the indicated string starting at 
  621.         the next line in the file and proceeding to the end of the  file.  
  622.         If  the  user  inputs a blank line (a simple  RETURN),  the  last 
  623.         string referenced by an F or N command is searched for again.
  624.  
  625.              COMMAND:  P
  626.              FUNCTION: Put a range of lines into a file
  627.              The  P command writes a group of lines from the edit  buffer 
  628.         out  to  a  file on disk.   This may be used  to  create  desired 
  629.         external files or it may be used to cut a section out of the edit 
  630.         buffer and paste it in (via the Get command) elsewhere.
  631.  
  632.              COMMAND:  Q
  633.              FUNCTION: Quit editor and do not update file
  634.              The  Q  command allows the user to exit the  editor  without 
  635.         changing the original file on the disk.
  636.  
  637.              COMMAND:  S
  638.              FUNCTION: Substitute strings
  639.              The  S command substitutes one string for another  over  the 
  640.         indicated range of lines.   All occurrances of the old string are 
  641.         replaced by the new string over this range.
  642.  
  643.              COMMAND:  X
  644.              FUNCTION: Exit the editor and update the file
  645.              The  X command exits the editor and updates the file on  the 
  646.         disk.
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.                                                       Page 8
  656.  
  657.  
  658.  
  659.  
  660.  
  661.                 ALED - A Line-Oriented File Editor Written in Ada
  662.  
  663.  
  664.  
  665.         3. S Y N O P S I S   a n d   C O M M E N T S 
  666.  
  667.              In  summary,  the  following  items were learned  from  this 
  668.         experience:
  669.  
  670.                   1. Ada is feasible; the editor ran with reasonable 
  671.                        speed
  672.  
  673.                   2. The Ada code was fairly efficient; EDITOR used
  674.                        only TEXT_IO for support, and, after a 58K
  675.                        initial overhead, the growth of code was
  676.                        approximately 9 words/line of code
  677.  
  678.                   3. Standardization under TEXT_IO needs some work;
  679.                        some simple, fundamental items, such as an
  680.                        input line editor available under GET_LINE,
  681.                        are missing (this is why I had to write my
  682.                        own input line editor) and GET does not return
  683.                        or pass every possible character (the DEL
  684.                        character does not pass thru the GET routine
  685.                        in my TEXT_IO package, for instance); do all
  686.                        GET routines allow single-character input?
  687.  
  688.                   4. Generics are useful and work well; software
  689.                        components libraries will be quite beneficial
  690.                        in reducing programming overhead once they
  691.                        have been developed
  692.  
  693.                   5. Exceptions are very, very useful; note their
  694.                        use throughout the code and how they are
  695.                        fundamental to the design (note the BEGIN/END
  696.                        in the main loop)
  697.  
  698.                   6. Ada code can be written to be quite readable
  699.                        and maintainable; I feel that I have successfully
  700.                        done this with ALED (assuming that knowledge
  701.                        of the generic package in LIST.ADA is known)
  702.  
  703.                   7. In version 2.0 of ALED, the System Dependencies
  704.                        were effectively isolated in the package SYSDEP.
  705.                        SYSDEP provided only two required routines,
  706.                        GET (which input the next character without
  707.                        interpretation of any kind) and PUT (which output
  708.                        a character without interpretation).  This made
  709.                        a much more friendly user interface possible.
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.                                                       Page 9
  722.  
  723.  
  724.  
  725.  
  726.  
  727.                 ALED - A Line-Oriented File Editor Written in Ada
  728.  
  729.  
  730.  
  731.         A. S A M P L E   S E S S I O N 
  732.              The  following  is  a sample session which  illustrates  the 
  733.         operation of ALED.  Comments are placed out to the side, prefixed 
  734.         by "<--".
  735.  
  736.  
  737.         ALED - Ada Line Editor by Richard Conn, Version  1.0
  738.         File Name? t.txt         <-- File name is selected
  739.         New File                 <-- File does not already exist
  740.             0 Lines in File
  741.          Type H for Help
  742.             0> append after <line> .       <-- Append Lines into buffer
  743.         Enter Lines (.<RETURN> to Stop)
  744.             1: This is a test and demonstration of ALED
  745.             2: This is a very short test, but all commands
  746.             3:  should be exercised by it
  747.             4: Note that all commands are single characters;
  748.             5:  the editor fills in the prompt with each
  749.             6:  single character input at the command prompt "n>"
  750.             7: A single dot in a line terminates input
  751.             8: .                           <-- Input is complete
  752.  
  753.             7> list lines in <range> all   <-- List all lines
  754.             1: This is a test and demonstration of ALED
  755.             2: This is a very short test, but all commands
  756.             3:  should be exercised by it
  757.             4: Note that all commands are single characters;
  758.             5:  the editor fills in the prompt with each
  759.             6:  single character input at the command prompt "n>"
  760.             7: A single dot in a line terminates input
  761.  
  762.             7> list lines in <range> 1,4   <-- List range of lines
  763.             1: This is a test and demonstration of ALED
  764.             2: This is a very short test, but all commands
  765.             3:  should be exercised by it
  766.             4: Note that all commands are single characters;
  767.  
  768.             4> list lines in <range> -1,+2 <-- List range of lines
  769.             3:  should be exercised by it
  770.             4: Note that all commands are single characters;
  771.             5:  the editor fills in the prompt with each
  772.             6:  single character input at the command prompt "n>"
  773.  
  774.             6> list lines in <range> 1     <-- List first line
  775.             1: This is a test and demonstration of ALED
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.                                                       Page 10
  788.  
  789.  
  790.  
  791.  
  792.  
  793.                 ALED - A Line-Oriented File Editor Written in Ada
  794.  
  795.  
  796.             1> list lines in <range> p     <-- List current page
  797.             1: This is a test and demonstration of ALED
  798.             2: This is a very short test, but all commands
  799.             3:  should be exercised by it
  800.             4: Note that all commands are single characters;
  801.             5:  the editor fills in the prompt with each
  802.             6:  single character input at the command prompt "n>"
  803.             7: A single dot in a line terminates input
  804.  
  805.             7> list lines in <range> a     <-- List all lines
  806.             1: This is a test and demonstration of ALED
  807.             2: This is a very short test, but all commands
  808.             3:  should be exercised by it
  809.             4: Note that all commands are single characters;
  810.             5:  the editor fills in the prompt with each
  811.             6:  single character input at the command prompt "n>"
  812.             7: A single dot in a line terminates input
  813.  
  814.             7> Error                   <-- Invalid Commands
  815.             7> Error
  816.  
  817.             7> - back up N lines <line count> 3 <-- Backup 3 lines
  818.             4> .                                <-- Print current line
  819.             4: Note that all commands are single characters;
  820.             4> + advance N lines <line count> 1 <-- Advance 1 line
  821.             5> .                                <-- Print current line
  822.             5:  the editor fills in the prompt with each
  823.  
  824.             5> substitute for old <string> test <-- substitute
  825.                 new <string> xx
  826.                 over <range> a
  827.             1: This is a xx and demonstration of ALED     <-- affected
  828.             2: This is a very short xx, but all commands  <--  lines
  829.  
  830.             7> substitute for old <string> xx   <-- change back
  831.                 new <string> test
  832.                 over <range> 2
  833.             2: This is a very short test, but all commands
  834.  
  835.             3> find <string> xx                 <-- look for "xx"
  836.                 over <range> a
  837.             1: This is a xx and demonstration of ALED
  838.  
  839.             1> substitute for old <string> xx   <-- change it
  840.                 new <string> test
  841.                 over <range> .
  842.             1: This is a test and demonstration of ALED
  843.  
  844.             2> find <string> test               <-- look for first
  845.                 over <range> a
  846.             1: This is a test and demonstration of ALED
  847.  
  848.             1> next Occurrance of <string>      <-- look for next
  849.             2: This is a very short test, but all commands
  850.  
  851.  
  852.  
  853.                                                       Page 11
  854.  
  855.  
  856.  
  857.  
  858.  
  859.                 ALED - A Line-Oriented File Editor Written in Ada
  860.  
  861.  
  862.  
  863.             2> list lines in <range> L          <-- look at last line
  864.             7: A single dot in a line terminates input
  865.  
  866.             7> append after <line> L            <-- append lines
  867.         Enter Lines (.<RETURN> to Stop)
  868.             8: This is yet another test
  869.             9: These lines are being appended to the
  870.            10:  end of the file.
  871.            11: I am inserting several instances of
  872.            12:  the word test
  873.            13:  so that there will be something to search for
  874.            14:  in further tests of the Next Occurrance command
  875.            15: .                                <-- end input
  876.  
  877.            14> find <string> test               <-- search for "test"
  878.                 over <range> a
  879.             1: This is a test and demonstration of ALED
  880.  
  881.             1> next Occurrance of <string>      <-- search again
  882.             2: This is a very short test, but all commands
  883.  
  884.             2> next Occurrance of <string>      <-- and again
  885.             8: This is yet another test
  886.  
  887.             8> next Occurrance of <string>      <-- and again
  888.            12:  the word test
  889.  
  890.            12> next Occurrance of <string>      <-- and again
  891.            14:  in further tests of the Next Occurrance command
  892.  
  893.            14> next Occurrance of <string>      <-- and again
  894.            14:  in further tests of the Next Occurrance command
  895.  
  896.            14> substitute for old <string> test <-- change string
  897.                 new <string> xxxxxxx
  898.                 over <range> a
  899.             1: This is a xxxxxxx and demonstration of ALED
  900.             2: This is a very short xxxxxxx, but all commands
  901.             8: This is yet another xxxxxxx
  902.            12:  the word xxxxxxx
  903.            14:  in further xxxxxxxs of the Next Occurrance command
  904.  
  905.            14> substitute for old <string> xxxxxxx   <-- change back
  906.                 new <string> test
  907.                 over <range> a
  908.             1: This is a test and demonstration of ALED
  909.             2: This is a very short test, but all commands
  910.             8: This is yet another test
  911.            12:  the word test
  912.            14:  in further tests of the Next Occurrance command
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.                                                       Page 12
  920.  
  921.  
  922.  
  923.  
  924.  
  925.                 ALED - A Line-Oriented File Editor Written in Ada
  926.  
  927.  
  928.  
  929.            14> substitute for old <string> test
  930.                 new <string> "test"
  931.                 over <range> 12
  932.            12:  the word "test"
  933.  
  934.            13> jump to <line> 1       <-- Jump command
  935.  
  936.             1> jump to <line> L       <-- Jump to last line
  937.  
  938.            14> jump to <line> 1       <-- Jump to first line
  939.  
  940.             1> list lines in <range> p
  941.             1: This is a test and demonstration of ALED
  942.             2: This is a very short test, but all commands
  943.             3:  should be exercised by it
  944.             4: Note that all commands are single characters;
  945.             5:  the editor fills in the prompt with each
  946.             6:  single character input at the command prompt "n>"
  947.             7: A single dot in a line terminates input
  948.             8: This is yet another test
  949.             9: These lines are being appended to the
  950.            10:  end of the file.
  951.            11: I am inserting several instances of
  952.            12:  the word "test"
  953.            13:  so that there will be something to search for
  954.            14:  in further tests of the Next Occurrance command
  955.  
  956.            14> put <file> q.txt       <-- Write lines out
  957.                 over <range> 11,L     <-- Limit range
  958.            14> get <file> q.txt       <-- Read back in after line 1
  959.                 after <line> 1
  960.             1> list lines in <range> a     <-- look at results
  961.             1: This is a test and demonstration of ALED
  962.             2: I am inserting several instances of
  963.             3:  the word "test"
  964.             4:  so that there will be something to search for
  965.             5:  in further tests of the Next Occurrance command
  966.             6: This is a very short test, but all commands
  967.             7:  should be exercised by it
  968.             8: Note that all commands are single characters;
  969.             9:  the editor fills in the prompt with each
  970.            10:  single character input at the command prompt "n>"
  971.            11: A single dot in a line terminates input
  972.            12: This is yet another test
  973.            13: These lines are being appended to the
  974.            14:  end of the file.
  975.            15: I am inserting several instances of
  976.            16:  the word "test"
  977.            17:  so that there will be something to search for
  978.            18:  in further tests of the Next Occurrance command
  979.  
  980.            18> get <file> q.txt       <-- read lines back in
  981.                 after <line> 7
  982.  
  983.  
  984.  
  985.                                                       Page 13
  986.  
  987.  
  988.  
  989.  
  990.  
  991.                 ALED - A Line-Oriented File Editor Written in Ada
  992.  
  993.  
  994.  
  995.             7> list lines in <range> p     <-- list page of lines
  996.             7:  should be exercised by it
  997.             8: I am inserting several instances of
  998.             9:  the word "test"
  999.            10:  so that there will be something to search for
  1000.            11:  in further tests of the Next Occurrance command
  1001.            12: Note that all commands are single characters;
  1002.            13:  the editor fills in the prompt with each
  1003.            14:  single character input at the command prompt "n>"
  1004.            15: A single dot in a line terminates input
  1005.            16: This is yet another test
  1006.            17: These lines are being appended to the
  1007.            18:  end of the file.
  1008.            19: I am inserting several instances of
  1009.            20:  the word "test"
  1010.            21:  so that there will be something to search for
  1011.            22:  in further tests of the Next Occurrance command
  1012.  
  1013.            22> insert before <line> 16     <-- insert line
  1014.         Enter Lines (.<RETURN> to Stop)
  1015.            16: testtesttesttest
  1016.            17: .                           <-- end input
  1017.  
  1018.            17> <                           <-- backup
  1019.            16: testtesttesttest
  1020.  
  1021.            16> <
  1022.            15: A single dot in a line terminates input
  1023.  
  1024.            15> >
  1025.            16: testtesttesttest
  1026.  
  1027.            16> >
  1028.            17: This is yet another test
  1029.  
  1030.            17> <
  1031.            16: testtesttesttest
  1032.  
  1033.            16> .
  1034.            16: testtesttesttest
  1035.  
  1036.            16> substitute for old <string> test      <-- substitute
  1037.                 new <string> xxxx
  1038.                 over <range> .
  1039.            16: xxxxtesttesttest       <-- observe progress of
  1040.            16: xxxxxxxxtesttest       <-- substitute command
  1041.            16: xxxxxxxxxxxxtest
  1042.            16: xxxxxxxxxxxxxxxx
  1043.  
  1044.            17> <
  1045.            16: xxxxxxxxxxxxxxxx
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.                                                       Page 14
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.                 ALED - A Line-Oriented File Editor Written in Ada
  1058.  
  1059.  
  1060.  
  1061.            16> substitute for old <string> xxxx      <-- and again
  1062.                 new <string> test
  1063.                 over <range> .
  1064.            16: testxxxxxxxxxxxx
  1065.            16: testtestxxxxxxxx
  1066.            16: testtesttestxxxx
  1067.            16: testtesttesttest
  1068.  
  1069.            17> jump to <line> 1
  1070.  
  1071.             1> ?                      <-- statistics
  1072.                Edit File Name: t.txt
  1073.                   23 Lines in File
  1074.             1> jump to <line> L       <-- verify line count
  1075.  
  1076.            23> jump to <line> 1
  1077.  
  1078.             1> list lines in <range> .
  1079.             1: This is a test and demonstration of ALED
  1080.  
  1081.             1> .
  1082.             1: This is a test and demonstration of ALED
  1083.  
  1084.             1> list lines in <range> p
  1085.             1: This is a test and demonstration of ALED
  1086.             2: I am inserting several instances of
  1087.             3:  the word "test"
  1088.             4:  so that there will be something to search for
  1089.             5:  in further tests of the Next Occurrance command
  1090.             6: This is a very short test, but all commands
  1091.             7:  should be exercised by it
  1092.             8: I am inserting several instances of
  1093.             9:  the word "test"
  1094.            10:  so that there will be something to search for
  1095.            11:  in further tests of the Next Occurrance command
  1096.            12: Note that all commands are single characters;
  1097.            13:  the editor fills in the prompt with each
  1098.            14:  single character input at the command prompt "n>"
  1099.            15: A single dot in a line terminates input
  1100.            16: testtesttesttest
  1101.            17: This is yet another test
  1102.            18: These lines are being appended to the
  1103.            19:  end of the file.
  1104.            20: I am inserting several instances of
  1105.            21:  the word "test"
  1106.  
  1107.            21> delete lines in <range> 8,11          <-- delete lines
  1108.  
  1109.             8> jump to <line> 1
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                                       Page 15
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.                 ALED - A Line-Oriented File Editor Written in Ada
  1124.  
  1125.  
  1126.  
  1127.             1> list lines in <range> p
  1128.             1: This is a test and demonstration of ALED
  1129.             2: I am inserting several instances of
  1130.             3:  the word "test"
  1131.             4:  so that there will be something to search for
  1132.             5:  in further tests of the Next Occurrance command
  1133.             6: This is a very short test, but all commands
  1134.             7:  should be exercised by it
  1135.             8: Note that all commands are single characters;
  1136.             9:  the editor fills in the prompt with each
  1137.            10:  single character input at the command prompt "n>"
  1138.            11: A single dot in a line terminates input
  1139.            12: testtesttesttest
  1140.            13: This is yet another test
  1141.            14: These lines are being appended to the
  1142.            15:  end of the file.
  1143.            16: I am inserting several instances of
  1144.            17:  the word "test"
  1145.            18:  so that there will be something to search for
  1146.            19:  in further tests of the Next Occurrance command
  1147.  
  1148.            19> delete lines in <range> 2,5      <-- delete more lines
  1149.  
  1150.             2> list lines in <range> a
  1151.             1: This is a test and demonstration of ALED
  1152.             2: This is a very short test, but all commands
  1153.             3:  should be exercised by it
  1154.             4: Note that all commands are single characters;
  1155.             5:  the editor fills in the prompt with each
  1156.             6:  single character input at the command prompt "n>"
  1157.             7: A single dot in a line terminates input
  1158.             8: testtesttesttest
  1159.             9: This is yet another test
  1160.            10: These lines are being appended to the
  1161.            11:  end of the file.
  1162.            12: I am inserting several instances of
  1163.            13:  the word "test"
  1164.            14:  so that there will be something to search for
  1165.            15:  in further tests of the Next Occurrance command
  1166.  
  1167.            15> Exit and update file (Y/N)? n
  1168.  
  1169.            15> quit without File Update (Y/N)? n
  1170.  
  1171.            15> Exit and update file (Y/N)? y
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                                                       Page 16
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.                 ALED - A Line-Oriented File Editor Written in Ada
  1190.  
  1191.  
  1192.  
  1193.         -) type t.txt                                <-- final file
  1194.         This is a test and demonstration of ALED
  1195.         This is a very short test, but all commands
  1196.          should be exercised by it
  1197.         Note that all commands are single characters;
  1198.          the editor fills in the prompt with each
  1199.          single character input at the command prompt "n>"
  1200.         A single dot in a line terminates input
  1201.         testtesttesttest
  1202.         This is yet another test
  1203.         These lines are being appended to the
  1204.          end of the file.
  1205.         I am inserting several instances of
  1206.          the word "test"
  1207.          so that there will be something to search for
  1208.          in further tests of the Next Occurrance command
  1209.  
  1210.         -) type q.txt                                <-- Q.TXT file
  1211.         I am inserting several instances of
  1212.          the word "test"
  1213.          so that there will be something to search for
  1214.          in further tests of the Next Occurrance command
  1215.  
  1216.         -) delete q.txt
  1217.  
  1218.         -) x editor
  1219.         ALED - Ada Line Editor by Richard Conn, Version  1.0
  1220.         File Name? t.txt                             <-- reedit file
  1221.            15 Lines in File
  1222.          Type H for Help
  1223.             1> list lines in <range> a
  1224.             1: This is a test and demonstration of ALED
  1225.             2: This is a very short test, but all commands
  1226.             3:  should be exercised by it
  1227.             4: Note that all commands are single characters;
  1228.             5:  the editor fills in the prompt with each
  1229.             6:  single character input at the command prompt "n>"
  1230.             7: A single dot in a line terminates input
  1231.             8: testtesttesttest
  1232.             9: This is yet another test
  1233.            10: These lines are being appended to the
  1234.            11:  end of the file.
  1235.            12: I am inserting several instances of
  1236.            13:  the word "test"
  1237.            14:  so that there will be something to search for
  1238.            15:  in further tests of the Next Occurrance command
  1239.  
  1240.            15> delete lines in <range> 8
  1241.  
  1242.             8> quit without File Update (Y/N)? y     <-- demo QUIT
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.                                                       Page 17
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.                 ALED - A Line-Oriented File Editor Written in Ada
  1256.  
  1257.  
  1258.  
  1259.  
  1260.         -) x editor
  1261.         ALED - Ada Line Editor by Richard Conn, Version  1.0
  1262.         File Name? t.txt                        <-- reedit file
  1263.            15 Lines in File
  1264.          Type H for Help
  1265.             1> list lines in <range> a
  1266.             1: This is a test and demonstration of ALED
  1267.             2: This is a very short test, but all commands
  1268.             3:  should be exercised by it
  1269.             4: Note that all commands are single characters;
  1270.             5:  the editor fills in the prompt with each
  1271.             6:  single character input at the command prompt "n>"
  1272.             7: A single dot in a line terminates input
  1273.             8: testtesttesttest
  1274.             9: This is yet another test
  1275.            10: These lines are being appended to the
  1276.            11:  end of the file.
  1277.            12: I am inserting several instances of
  1278.            13:  the word "test"
  1279.            14:  so that there will be something to search for
  1280.            15:  in further tests of the Next Occurrance command
  1281.  
  1282.            15> delete lines in <range> 8        <-- remove line from file
  1283.  
  1284.             8> Exit and update file (Y/N)? y    <-- demo EXIT
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.                                                       Page 18
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.                 ALED - A Line-Oriented File Editor Written in Ada
  1322.  
  1323.  
  1324.  
  1325.         -) type t.txt                           <-- show result
  1326.         This is a test and demonstration of ALED
  1327.         This is a very short test, but all commands
  1328.          should be exercised by it
  1329.         Note that all commands are single characters;
  1330.          the editor fills in the prompt with each
  1331.          single character input at the command prompt "n>"
  1332.         A single dot in a line terminates input
  1333.         This is yet another test
  1334.         These lines are being appended to the
  1335.          end of the file.
  1336.         I am inserting several instances of
  1337.          the word "test"
  1338.          so that there will be something to search for
  1339.          in further tests of the Next Occurrance command
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                                                       Page 19
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                 ALED - A Line-Oriented File Editor Written in Ada
  1388.  
  1389.  
  1390.  
  1391.          I n d e x 
  1392.  
  1393.  
  1394.         +
  1395.         + Command, 7
  1396.  
  1397.         -
  1398.         - Command, 7
  1399.  
  1400.         <
  1401.         < Command, 6
  1402.  
  1403.         >
  1404.         > Command, 6
  1405.  
  1406.         ?
  1407.         ? Command, 7
  1408.  
  1409.         A
  1410.         A Command, 7
  1411.         Aborting Commands, 6
  1412.         Ada, 1
  1413.         Advance Line, 6
  1414.         Advance N Lines, 7
  1415.         Advanced Development Model, 1
  1416.         ALED
  1417.           Aborting Commands, 6
  1418.           ADM, 1
  1419.           Advanced Development Model, 1
  1420.           EDM, 1
  1421.           Engineering Development Model, 1
  1422.           Help Command, 3
  1423.           Input Line Editor, 6
  1424.           Line Input, 5
  1425.           Line Ranges, 4
  1426.           Line References, 5
  1427.           Prompt, 2
  1428.           Purpose, 1
  1429.           String Input, 5
  1430.         Append Lines, 7
  1431.  
  1432.         B
  1433.         Back Up Line, 6
  1434.         Back Up N Lines, 7
  1435.  
  1436.         C
  1437.         Command
  1438.           +, 7
  1439.           -, 7
  1440.           ., 6
  1441.           <, 6
  1442.           >, 6
  1443.           ?, 7
  1444.           A, 7
  1445.  
  1446.  
  1447.                                                       Page 20
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.                 ALED - A Line-Oriented File Editor Written in Ada
  1454.  
  1455.  
  1456.           D, 7
  1457.           F, 7
  1458.           G, 7
  1459.           H, 7
  1460.           I, 8
  1461.           J, 8
  1462.           L, 8
  1463.           N, 8
  1464.           P, 8
  1465.           Q, 8
  1466.           S, 8
  1467.           X, 8
  1468.         COMMANDS, 6
  1469.  
  1470.         D
  1471.         D Command, 7
  1472.         Delete Lines, 7
  1473.         Dot Command, 6
  1474.  
  1475.         E
  1476.         Engineering Development Model, 1
  1477.         Exit, 8
  1478.  
  1479.         F
  1480.         F Command, 7
  1481.         File
  1482.           Get, 7
  1483.           Put, 8
  1484.         Find Next String, 8
  1485.         Find String, 7
  1486.  
  1487.         G
  1488.         G Command, 7
  1489.         Get File, 7
  1490.  
  1491.         H
  1492.         H Command, 7
  1493.         Help, 3, 7
  1494.  
  1495.         I
  1496.         I Command, 8
  1497.         Input Line Editor, 6
  1498.         Insert Lines, 8
  1499.         INTRODUCTION, 1
  1500.  
  1501.         J
  1502.         J Command, 8
  1503.         Jump to Line, 8
  1504.  
  1505.         L
  1506.         L Command, 8
  1507.         Line Range Specification, 4
  1508.         Line Reference Specification, 5
  1509.         List Lines, 8
  1510.  
  1511.  
  1512.  
  1513.                                                       Page 21
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.                 ALED - A Line-Oriented File Editor Written in Ada
  1520.  
  1521.  
  1522.         N
  1523.         N Command, 8
  1524.         Next String, 8
  1525.  
  1526.         P
  1527.         P Command, 8
  1528.         PRELIMINARIES, 4
  1529.         Print Current Line, 6
  1530.         Print Statistics, 7
  1531.         Put File, 8
  1532.  
  1533.         Q
  1534.         Q Command, 8
  1535.         Quit, 8
  1536.  
  1537.         S
  1538.         S Command, 8
  1539.         SAMPLE SESSION, 10
  1540.         Substitute Strings, 8
  1541.         SYNOPSIS and COMMENTS, 9
  1542.  
  1543.         U
  1544.         USING ALED, 2
  1545.  
  1546.         X
  1547.         X Command, 8
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                                                       Page 22
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.