Dawkins' Watchmaker Source Second Edition

Documentation (fpdoc)

Goals

The goal of the Second Edition is to produce a fair copy of the original Think Pascal 4.0 sources for Blind Watchmaker which satisfy these conditions:

  1. Compilable with Free Pascal, against System 7.1 Pascal interfaces patched with reference to Inside Macintosh (1985 edition);
  2. Continued compatibility with Think Pascal 4.0 under Classic Mac OS 9.0.4 emulation using SheepShaver
  3. Documented using FPCDocs, the automatic documentation generator for Free Pascal
  4. Line-for-line synchonization between classic source and 2nd edition (no lines added or deleted.)

Roadmap for the Second Edition

2.0: ("Syntax") Full source cross-compiler compatibility between Think Pascal 4.0 and Free Pascal 2.4.0

2.1: ("Semantics") Eliminate compiler warnings in Free Pascal (unused variables, unused units, etc.)

2.2: ("UPI") Convert to using revised Macintosh Universal Pascal Interface, in preparation for compilation with Ingemar's Think Pascal 4.5a1, found

2.3: Compile with CodeWarrior 7.1 using new UPI.

Porting back to Think Pascall Think Pascal 4.0 only likes source files which it created itself. These have file type attribute TEXT and creator resource PJMM. FileTyper 5.3.1 is used to create an "AutoTyper" which will change these attributes when source files are dropped onto it.

Changes to Dawkins' original source for the Second Edition

Unit file names have been synchronized with unit names according to these rules:

Random Numbers in Think Pascal

From Inside Macintosh, page I-194:

FUNCTION Random: INTEGER;
This function returns a pseudo-random integer, uniformly distributed in the range -32767 through 32767. The value the sequence starts from depends on the global variable randSeed, which InitGraf initializes to 1. To start the sequence over again from where it began, reset randSeed to 1. To start a new sequence each time, you must reset randSeed to a random number.

From Free Pascal Random reference:

Random returns a random number larger or equal to 0 and strictly less than L. If the argument L is omitted, a Real number between 0 and 1 is returned (0 included, 1 excluded).

Macintosh System 7.1 PInterfaces

Pascal "otherwise" keyword changed to synonym "else".

Missing ThinkPascal 4.0 interfaces

It's necessary to provide dummy units for these units not present in the Think Pascal 4.0 interfaces.