Pjolramming
所属分类:Web服务器
开发工具:C++ Builder
文件大小:61KB
下载次数:0
上传日期:2019-04-06 21:18:32
上 传 者:
zonadpe
说明: The Craft of Object-Oriented Programming
文件列表:
examples.txt (8163, 2017-04-11)
ibuild.bat (9211, 2017-04-11)
ch17\calculator.adb (1237, 2017-04-11)
ch03\eg09\calculator.adb (1264, 2017-04-11)
ch03\eg10\calculator.adb (1347, 2017-04-11)
ch03\eg11\calculator.adb (1900, 2017-04-11)
ch03\eg12\calculator.adb (2094, 2017-04-11)
ch13\eg01\calculator.adb (2913, 2017-04-11)
ch13\eg02\calculator.adb (4698, 2017-04-11)
ch13\eg03\calculator.adb (4698, 2017-04-11)
ch13\eg04\calculator.adb (4698, 2017-04-11)
ch13\eg05\calculator.adb (4698, 2017-04-11)
ch09\eg01\date_test.adb (1363, 2017-04-11)
ch09\eg02\date_test.adb (1401, 2017-04-11)
ch09\eg05\date_test.adb (1522, 2017-04-11)
ch09\eg04\date_test.adb (2024, 2017-04-11)
ch09\eg03\date_test.adb (2051, 2017-04-11)
ch04\eg06\dates.adb (1802, 2017-04-11)
ch04\eg07\dates.adb (1843, 2017-04-11)
ch04\eg08\dates.adb (1983, 2017-04-11)
ch04\eg05\day_of.adb (1005, 2017-04-11)
ch12\eg03\diary-diary_view.adb (3897, 2017-04-11)
ch10\diary-diary_view.adb (5191, 2017-04-11)
ch11\eg01\diary-diary_view.adb (5191, 2017-04-11)
ch12\eg01\diary-diary_view.adb (5191, 2017-04-11)
ch14\eg03\diary-diary_view.adb (5480, 2017-04-11)
ch14\eg01\diary-diary_view.adb (5498, 2017-04-11)
ch15\eg01\diary.adb (1245, 2017-04-11)
ch15\eg02\diary.adb (1245, 2017-04-11)
ch16\eg01\diary.adb (1245, 2017-04-11)
ch08\eg01\diary.adb (1664, 2017-04-11)
ch08\eg03\diary.adb (1712, 2017-04-11)
ch08\eg04\diary.adb (1746, 2017-04-11)
ch08\eg05\diary.adb (1746, 2017-04-11)
ch08\eg06\diary.adb (1746, 2017-04-11)
ch08\eg07\diary.adb (1746, 2017-04-11)
ch08\eg08\diary.adb (1746, 2017-04-11)
ch08\eg02\diary.adb (1806, 2017-04-11)
ch10\diary.adb (1906, 2017-04-11)
... ...
ADA 95: THE CRAFT OF OBJECT-ORIENTED PROGRAMMING -- EXAMPLES
------------------------------------------------------------
This archive contains the example programs from "Ada 95: The Craft of
Object-Oriented Programming" by John English (Prentice Hall 1997).
This book is now out of print, so I've converted it to HTML format
and released it online (see http://www.it.bton.ac.uk/staff/je/adacraft/).
Errata from the printed copy of the book and minor errors from earlier
versions of these examples have been corrected. The examples have been
tested using GNAT 3.13p on Linux and Windows platforms.
1. Building the examples.
-------------------------
The examples from each chapter are in separate subdirectories (ch02
through ch19, corresponding to chapters 2 through 19). Most chapters
contain multiple examples, and these are in separate subdirectories
called "egXX" where XX is the example number. There is also a "packages"
subdirectory containing the final version of each of the major packages
developed in the book. See the file "examples.txt" for a description of
the examples supplied.
Since many of the files are used in more than one example, the distribution
for Unix systems (adacraft.tar.gz) uses symbolic links to avoid unnecessary
duplication of files. Take care if you want to modify any of the files, as
you might end up modifying the master copy in the process! The distribution
for Windows (adacraft.zip) doesn't use symbolic links, so many of the files
are duplicated. The distribution is a bit bigger, but it also means that you
don't need to worry about modifying a master copy of a file.
You can compile all the examples by running "sh build.sh" on Unix systems,
or "build.bat" on Windows systems. This assumes that you have the GNAT
compiler installed on your system.
3. GNAT bugs and workarounds.
-----------------------------
There are some known problems outstanding due to bugs in GNAT:
Extension aggregates:
Affects: ch14/eg03, ch15/eg01, ch15/eg02, ch16/eg01
Status: GNAT 3.01 - 3.05
Symptom: The common appointment part of derived appointments gets
lost (and dates usually appear as 1-JAN-1970 as a result).
Interestingly enough, extension aggregates used to work
properly in GNAT 2.07... :-(
Solution: Upgrade to GNAT 3.07 or later where the problem has been fixed,
or copy the files in the ch14/ch15/ch16 subdirectories of the
"fixes" directory to the corresponding chapter subdirectories.
These do everything the long way round, avoiding the use of
extension aggregates.
The 'Class'Input attribute:
Affects: ch15/eg01, ch15/eg02, ch16/eg01
Status: GNAT 3.01
Symptom: GNAT 3.01 incorrectly reports an error when 'Class'Input or
'Class'Output are used with for an abstract class. To get
around this, the abstract parent type can be derived from a
concrete type which can then be used to call 'Class'Input or
'Class'Output. Unfortunately this won't help; loading a diary
will fail, usually with a Data_Error. This is because the
'Class'Input routine skips some of the data as it reads the
file (but 'Class'Output works fine!).
Solution: Upgrade to GNAT 3.03 or later, where the problem has been fixed.
Exception handling:
Affects: ch18
Status: GNAT 3.01 (only under SunOS)
Symptom: Cells containing formulas which reference empty cells will
crash with a protection fault. An Undefined_Cell_Error is
being raised but never gets to its handler.
Solution: Upgrade to GNAT 3.03 or later where the problem has been fixed,
or use GNAT 3.01 under any other operating system.
Tasking not supported under MS-DOS:
Affects: ch19 (all)
Status: GNAT 3.01 - 3.03 (MS-DOS)
Symptom: All examples from chapter 19 fail to link with the MS-DOS
port of the compiler.
Solution: Use a different operating system, or upgrade to GNAT 3.04 or
later.
Tasks with discriminants:
Affects: ch19/eg02, ch19/eg06
Status: GNAT 3.01
Symptom: Discriminant values are not passed correctly to tasks, so
the task test program in example 2 will be executed a random
(usually large!) number of times.
Solution: Upgrade to GNAT 3.03 or later, where the problem has been fixed.
Tasks as components in a type extension:
Affects: ch19/eg06
Status: GNAT 3.01 - 3.08
Symptom: If a task is used as a component when deriving from a tagged
type, the compiler will crash with an assertion error if you
try to create an object of the derived type using "new".
Solution: Copy the files in the ch19 subdirectory of the "fixes" directory
to the corresponding chapter subdirectory. This uses a pointer
to a task as the record component rather than using a task; the
constructor function is modified to create the task using "new"
and assign the resulting pointer to the record component. Note
that under GNAT 3.01 the program will then compile but it will
crash when you try to run it because the task discriminant (a
pointer to the spreadsheet) will have been passed to the task
incorrectly, as described above.
Get_Immediate broken:
Affects: ch19/eg06
Status: GNAT 3.01 - 3.08 (SunOS, Solaris, Win95/NT)
Symptom: Get_Immediate ignores keyboard input (except ^C) under SunOS
and Solaris; under Windows 95/NT it behaves like Get (i.e.
it blocks until the Enter key has been pressed). It works
fine under other operating systems.
Solution: Use a different operating system, or upgrade to GNAT 3.05 or
later in the case of SunOS/Solaris.
The compiler bugs have been reported to the GNAT development team, so hopefully
they will be fixed in a future release. Any other bugs are entirely my fault;
please email me at the address below if you discover any, or if you have any
other comments or suggestions to make. Note that I have deliberately left
some examples incomplete (e.g. the lack of Data_Error handling in the diary
package's Load procedure) so that readers still have some work to do; these
omissions are features, not bugs (:-). The documentation in the examples is
also minimal; it's all in the book (implication: buy the book!). And most
importantly of all, have fun learning Ada 95!
-- John English (je@brighton.ac.uk).
近期下载者:
相关文件:
收藏者: