Ada in Action
(with Practical Programming Examples)
by Do-While Jones
Second Edition
1995
Also
available in other formats.
SHORT CONTENTS
FULL CONTENTS
Copyright
Statement
Dedications
Hypertext
Conversion
Chapter 1
INTRODUCTION
Chapter 2
NUMERIC CONSIDERATIONS
2.2 STANDARD_INTEGERS package
2.3 Non-existent STANDARD_FLOATS package
- 2.3.1 Type float Default Accuracy
2.4 DIM_INT_32 package
- 2.4.1 Type Checking
- 2.4.2 Derived Types
- 2.4.3 Private Types
2.5 Generic INTEGER_UNITS package
- 2.5.1 Generic Parameters
- 2.5.2 Type Conversions
- 2.5.3 Dimensioned Arithmetic
- 2.5.4 Removing Dimensional Units
- 2.5.5 Generic Bodies
- 2.5.6 Instantiation
2.6 Generic FLOAT_UNITS package
- 2.6.1 Division, Remainder, and Modulo Operators
- 2.6.2 First and Last Functions
2.7 DIM_FLOAT package
2.8 Non-existent NUMERIC_UNITS package
2.9 Non-existent FIXED_UNITS package
- 2.9.1 Problems with Fixed_Point
- 2.9.2 Custom Fixed-Point Types
- 2.9.3 FIXED_UNITS exercise
- 2.9.4 Fixed_point Computers
2.10 TRIG package
- 2.10.1 Type Naming Convention
- 2.10.2 Overloaded Function Names
- 2.10.3 Portability
- 2.10.4 Reciprocal Functions
- 2.10.5 Special cases
- 2.10.6 Which Way is Up?
2.11 COORDINATES package
- 2.11.1 Comments
- 2.11.2 Other Improvements in COORDINATES
- 2.11.3 USE Clauses
Chapter 3
IO UTILITIES
- 3.1 ASCII_UTILITIES package
- 3.1.1 IMAGE Attribute
- 3.1.2 Qualified Expressions
- 3.1.3 VALUE Attribute
- 3.1.4 Short Circuit Control Forms
- 3.1.5 Character Conversions
- 3.1.6 Ada Strings
- 3.2 MONEY_UTILITIES package
- 3.3 TEXT_IO package
- 3.3.1 What's Wrong With TEXT_IO
- 3.4 VIRTUAL_TERMINAL package
- 3.4.1 Guaranteed Functionality
- 3.4.2 Information Hiding
- 3.4.2.1 Alsys VIRTUAL_TERMINAL body
- 3.4.2.2 Meridian VIRTUAL_TERMINAL body
- 3.4.3 Visual Attributes
- 3.4.4 VIRTUAL_TERMINAL Uses
- 3.5 SCROLL_TERMINAL package
- 3.5.1 Reusability and Consistency
- 3.5.2 Layering
- 3.5.3 SCROLL_TERMINAL Features
- 3.5.4 Compatibility
- 3.5.5 Hiding Details in the Package Body
- 3.5.6 Coupling
- 3.5.7 Module Partitioning
- 3.5.8 Limited Name Space
- 3.5.9 The Top is at the Bottom
- 3.6 FORM_TERMINAL package
- 3.6.1 When to use the FORM_TERMINAL
- 3.6.2 Consistency
- 3.6.3 Abstract Objects
- 3.6.4 Exception Handling
- 3.6.5 Keep Shared Variables Hidden
- 3.6.6 Reuse by Copy
- 3.6.7 Global Variables
- 3.6.8 A Package Can be an Abstract Object
- 3.6.9 Discriminated Records
- 3.6.10 Reading Discriminated Records from a File
- 3.6.11 Discriminants May Not Save Space
- 3.6.12 Use Read as a Pattern for Write
- 3.6.13 ASCII Data Files
- 3.6.14 Storing Boolean Values in a File
- 3.6.15 One Compilation Unit Per File
- 3.6.16 Encapsulating Details in One File
- 3.6.17 Formatted IO
- 3.6.18 The Danger of Improvement
- 3.6.19 Creating a New FORM
- 3.6.20 Character Substitution
- 3.6.21 Long Strings
- 3.6.22 in out Mode
- 3.6.23 Editing an Existing FORM
- 3.6.24 null Exception Handlers
- 3.7 Porting the IO Interfaces to VAX/VMS
- 3.7.1 VMS package
- 3.7.2 Raising Exceptions
- 3.7.3 CONTROL-C Powder Keg
- 3.7.4 Operating System Limitations
- 3.7.5 INPUT Task
- 3.7.6 OUTPUT Package
- 3.7.7 Enforcing Order
- 3.7.8 Hardware Limitations
- 3.7.9 DEC VIRTUAL_TERMINAL
- 3.8 VIRTUAL_PRINTER package
- 3.8.1 What's Its Name?
- 3.8.2 Printer Quirks
- 3.9 SCROLL_PRINTER package
Chapter 4
PROGRAMMING ISN'T SOFTWARE ENGINEERING
- 4.1 The Show Tool
- 4.1.1 Named Loops
- 4.1.2 Command Tail
- 4.1.3 Compiling Library Procedures
- 4.1.4 Unconstrained Strings
- 4.1.5 Using Library Procedures
- 4.1.6 Porting Show to Other Systems
- 4.1.6.1 Compiling Procedure Specifications
- 4.1.6.2 Porting Show to VAX/VMS
- 4.1.7 Library Procedure Summary
- 4.1.8 Common Command Names
- 4.2 The More Tool
- 4.2.1 Multiple Loop Exits
- 4.3 The Write Tool
- 4.3.1 Error Recovery and Help
- 4.4 The Line Tool
- 4.4.1 Multiple Arguments
- 4.4.2 Error Tolerance
- 4.4.3 Presuming Too Much
- 4.5 The Search Tool
- 4.5.1 I've Seen That Before
- 4.5.2 Keep Selling the Same Software
- 4.6 Draw_Poker, Version 2
- 4.6.1 Software Engineering
- 4.6.2 Military Standards
- 4.6.3 Goals and Requirements
- 4.6.4 Case Study
- 4.6.5 Sales Brochure
- 4.6.6 User's Manual
- 4.6.7 Checking the Requirements
- 4.6.8 Planning For Reuse
- 4.6.9 Abstract Data Types
- 4.6.10 Private Types
- 4.6.11 Keep IO Routines Separate
- 4.6.12 A limit to Reuse
- 4.6.13 Efficiency vs Verifiability
- 4.6.14 Hidden Dependencies
- 4.6.15 Building from the Bottom
- 4.6.16 Top-Down Design
- 4.6.17 Renaming Declarations
- 4.6.18 Prototyping
- 4.6.19 Validation and Verification
- 4.6.20 Integration
- 4.6.21 Maintenance Manual
- 4.6.22 Other Software Engineering Concepts
- 4.6.22.1 Configuration Management
- 4.6.22.2 Error Reporting
- 4.6.22.3 Cost and Schedule
- 4.7 Conclusion
Chapter 5
TESTING SOFTWARE COMPONENTS AND PROGRAMS
Chapter 6
CONCLUSION
Chapter 7
Epilog
- 7.2 New Naming Conventions
- 7.1 Standard Size STANDARD_INTEGERS
- 7.3 Software Documentation
- 7.4 Separate Non-abstract Data Types from Subprograms
- 7.5 ASCII_UTILITIES is too Broad
- 7.6 Finalization
- 7.7 Ada 95
- 7.8 Estimating Completion
- 7.9 Predictions
- 7.10 Final Thoughts
Figures
1.
POOR_COORDINATES package specification
2.
Distinct types
3.
SLIGHTLY_BETTER_COORDINATES package specification
4.
Shared types
5.
Dimensional units example
6.
Range checking example
7.
Dimensional division
8.
Precise division
9.
Simple output
10.
Better output
11.
NUMERIC_UNITS example
12.
Polar Coordinates
13.
Directions
14.
COORDINATES package specification
15.
POOR_COORDINATES body
16.
COORDINATES body
17.
The IMAGE attribute is awkward to use.
18.
The Image function is easy to use.
19.
ASCII_UTILITIES demo
20.
Sales_Tax
21.
Usual_Dilemma
22.
Usual_Solution
23.
Form_Dilemma
24.
FORTRAN_Mentality_Solution
25.
Form_Solution
26.
Objects need a constraint
27.
Constrained objects can't change constraints
28.
You can't change the constraint alone
29.
ADDRESS.DAT
30.
Erroneous FORTRAN SPLIT subroutine
31.
Erroneous Split procedure
32.
Correct Split procedure
33.
VIRTUAL_PRINTER body for COM2 port
34.
First version of Show
35.
The first Get_Command_Line procedure
36.
Improved version of Show
37.
Original Get_Command_Line body for Meridian
38.
Get_Command_Line body for Gould APLEX
39.
Write without help and error recovery
40.
Portions of Meridian COS.DAT
41.
Accuracy of Meridian TRIG.Cos function
42.
Coordinates_Test program
43.
Get_Command_Line stub 1
44.
Get_Command_Line stub 2
45.
Lookup driver
46.
Lookup stub
Listings
disk1/dir.txt <------ SUPER IMPORTANT INFO !!!!!
disk1/read.me <------ IMPORTANT INFO !!!!!
1. disk1/sis.ada STANDARD_INTEGERS
2. disk1/giu.ada INTEGER_UNITS
3. disk1/di32.ada DIM_INT_32
4. disk1/gfu.ada FLOAT_UNITS
5. disk1/dfu.ada DIM_FLOAT Version 1.0
6. disk2/meridian/dfu.ada
DIM_FLOAT Version 1.1
7. disk1/ts.ada TRIG specification
8. disk2/dec/tbdec.ada TRIG body for DEC Ada
9. disk2/meridian/tbmibm.ada
TRIG body for Meridian Ada
10. disk2/alsys/tbaibm.ada
TRIG body for Alsys Ada
11. disk1/aus.ada ASCII_UTILITIES specification
12. disk1/aub.ada ASCII_UTILITIES body
13. disk1/aubfxi.ada ASCII_UTILITIES.Fixed_Image
14. disk1/aubfli.ada ASCII_UTILITIES.Float_Image
15. disk1/aubii.ada ASCII_UTILITIES.Image
16. disk1/aubv.ada ASCII_UTILITIES.Value
17. disk1/ms.ada MONEY_UTILITIES specification
18. disk1/mb.ada MONEY_UTILITIES body
19. disk1/vts.ada VIRTUAL_TERMINAL specification
20. disk2/alsys/vtbaibm.ada
VIRTUAL_TERMINAL body for Alsys
21. disk2/meridian/vtbmibm.ada
VIRTUAL_TERMINAL body for Meridian
22. disk1/sts.ada SCROLL_TERMINAL specification
23. disk1/stb.ada SCROLL_TERMINAL body
24. disk1/stbgr.ada SCROLL_TERMINAL.Get_Response
25. disk1/fts.ada FORM_TERMINAL specification
26. disk1/ftb.ada FORM_TERMINAL body
27. disk1/ftbgf.ada FORM_TERMINAL.Get_Form
28. disk1/ftbrw.ada FORM_TERMINAL.Read & FORM_TERMINAL.Write
29. disk1/ftbd.ada FORM_TERMINAL.Display
30. disk1/ftbu.ada FORM_TERMINAL.Update
31. disk1/ftbc.ada FORM_TERMINAL.Create
32. disk1/ftbci.ada FORM_TERMINAL.Create.Instructions
33. disk1/ftbcgf.ada FORM_TERMINAL.Create.Get_Field
34. disk1/ftbcgfp.ada FORM_TERMINAL.Create.Get_Field.Protect_Field
35. disk1/ftbe.ada FORM_TERMINAL.Edit
36. disk1/ftbie.ada FORM_TERMINAL.Edit.Instructions
37. disk1/ftbef.ada FORM_TERMINAL.Edit.Edit_Fields
38. disk1/ftbefg.ada FORM_TERMINAL.Edit.Edit_Fields.Get_Changes
39. disk1/ftbecf.ada FORM_TERMINAL.Edit.Change_Field
40. disk1/ftbeif.ada FORM_TERMINAL.Edit.Insert_Field
41. disk1/ftbedf.ada FORM_TERMINAL.Edit.Delete_Field
42. disk1/ftbemf.ada FORM_TERMINAL.Edit.Move_Field
43. disk1/ftber.ada FORM_TERMINAL.Error_Recovery
44. disk1/mf.ada Make_Form program
45. disk1/ef.ada Edit_Form program
46. disk1/xftbc.ada Create stub
47. disk1/xftbe.ada Edit stub
48. disk2/dec/vmss.ada VMS specification
49. disk2/dec/vmsb.ada VMS body
50. disk2/dec/vmsbi.ada VMS.INPUT task body
51. disk2/dec/vmsbo.ada VMS.OUTPUT package body
52. disk2/dec/vtsdec.ada
VIRTUAL_TERMINAL specification for DEC
53. disk2/dec/vtbdec.ada
VIRTUAL_TERMINAL body for DEC Ada
54. disk1/vps.ada VIRTUAL_PRINTER specification
55. disk1/vpblpt1.ada VIRTUAL_PRINTER body for LPT1 port
56. disk1/sps.ada SCROLL_PRINTER specification
57. disk1/spb.ada SCROLL_PRINTER body
58. disk2/alsys/gclbaibm.ada
Get_Command_Line body for Alsys
59. disk1/gcls.ada Get_Command_Line specification
60. disk2/dec/gclbdec.ada
Get_Command_Line body for DEC
61. disk1/more.ada The More program
62. disk1/write.ada Write program
63. disk1/line.ada Line program
64. disk1/le.ada Line.Extract subunit
65. disk2/meridian/gclbmibm.ada
Get_Command_Line body for Meridian
66. disk1/pcs.ada PLAYING_CARDS specification
67. disk1/pcb.ada PLAYING_CARDS body
68. disk1/dp2.ada Draw_Poker program, Version 2
69. disk1/dp2g.ada Draw_Poker.get
70. disk1/dp2vo.ada Draw_Poker.Value_Of
71. disk1/dp2p.ada Draw_Poker.put
72. disk1/dp2df.ada Draw_Poker.Discard_From
73. disk1/dp2po.ada Draw_Poker.Payout
74. disk1/costest.ada Cos_Test program
75. disk1/cosdif.ada Cos_Dif program
76. disk1/rns.ada RANDOM_NUMBERS specification
77. disk1/rnb.ada RANDOM_NUMBERS body