DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦69f3d7857⟧ TextFile

    Length: 3597 (0xe0d)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦0c65dbd93⟧ 
            └─⟦this⟧ 

TextFile

       --------------------------------------------------------  
          How to build a small spreadsheet in 10 easy lessons 
       --------------------------------------------------------  

You must read the specification of Spreadsheet_Generic, and you
can also look at the Expense_Report procedure for an illustration of the
process.

A road map:

  Spreadsheet_Generic : Gen_Pack   Main specification
  Spreadsheet_Generic : Pack_Body
    .Buffer           : Pack_Body   Buffer for keyboard entry of text
    .Engine           : Proc_Body   Main loop and state machine
      .File           : Pack_Body     Load and Save files
      .Info           : Pack_Body     Shows help information in 2ndary window
    .Keyboard         : Pack_Body   Read keypresses and translate to logical key
    .Screen           : Pack_Body   Shows main window
    .Tool_Set         : Pack_Body   String formatting, error handling
      .Evaluator      : Func_Body     Arithmetic expression evaluation

The steps :

1. Define the grid, with 2 discrete types:

       eg. Line is range 1980 .. 1990
           Column is ( Year, Value, Increase )


2. Define a name for your application (in Ada identifier format)

       eg. "Expense_Report", "Sales_Forecast"


3. Instantiate the Spreadsheet_Generic
 
       eg. package Grid is new ...

    At this point you have:
        primitives to access the cells of the grid
        a generic engine
        default values for the generic engine
        a set of useful tools


4. Define what should appear on the header and leftmost column, as well
   as the width of each cell. (The default are to put labels derived
   from the Line and Column types, and have all celles the same width).
   

5. Define the application dependent computing

      Basically you have to iterate over the cells that are computed
      and evaluate their value, then poke the value image into the
      cells. In most cases an application would keep a typed copy
      of the grid or cells from the grid. the grid just keeps track of
      the string values.
 

6. Define the interactive behaviour of the engine

        Moving_Cursor_Also_Commits : in Boolean := True;
        Committing_Also_Computes : in Boolean := False;
        Computing_Also_Reformats : in Boolean := False;

    is fine for interactive use with a slow connection, or when
    computing is long. Otherwise use
        Committing_Also_Computes : in Boolean := True;


7. Define what should happen on:
       Hitting the "selection" key
       Hitting the "edit" key
       Hitting the "load" key
       Hitting the "Save" key
     or leave them to the default values.
     See end of spec for a definition of logical keys.


8. Write the application specific "help" function
     which should specify what happens for the user defined logical keys


9. Instantiate the Engine of your application


10. Call the engine.

---------
Further customization:

a. All dependencies to Window_IO are encapsulated in:
         Spreadsheet_Generic.Screen    for screen display
     and Spreadsheet_Generic.Keyboard  for interception of keyboard
                                         input and translation to a
                                         logical key

b. To port on another machine:
      dependency on IO (in Tool_Set) should be replaced by Text_IO
      sub-package File has dependencies on Library and Time_Utilities

---------
Warnings:

  there are 2 invisible exceptions in sub-package body Keyboard:

    Key_Not_Found_In_Visible_Key_Names : exception;
    Terminal_Not_Supported : exception;

PBK  :-