How to write Pascal programs with Carbon
and CodeWarrior Pro 4 Academic



What is Coin RAEL

The program "Coin 1.0.0" is a simple game that I have developed with:

  • CodeWarrior Pro 4 Academic Pascal
  • ResEdit 2.1.3
  • THINK Reference 2.0.1
  • Universal Interfaces 3.4
  • CarbonLib 1.2

The application has been tested under:

  • MacOS 9.0.4 (on a PowerMac G4 400 MHz with 320 MB of RAM)
  • MacOS 9.1.0 (on a iMac Bondi Blue rev. B 233 MHz with 160 MB of RAM)
  • MacOS X 10.0.4 (on a iMac Bondi Blue rev. B 233 MHz with 160 MB of RAM)

To write the game I have used, as starting point, the sample "BasicRAEL" written in C language (part of the Carbon SDK 1.4.0 downloaded from Apple site).

For first thing I have translated the source code from C to Pascal and then I have added the source code for the game. I have compiled the project with the iMac, but I have tried even with the PowerMac G4 and work well.

I have used the routine "RunApplicationEventLoop" to handle the events of the application to test the new Carbon Events APIs.

I hope that this simple sample can help others Pascal programmers to continue to write software for MacOS X with this wonderful language.

Matteo Varisco


Installing CodeWarrior Pro 4 Academic

On my iMac Bondi blue (160 MB of RAM, hard disk of 4 GB divided in two partitions) I have installed MacOS 9.1 (italian language) on the first partition and MacOS X 10.0.4 (italian language) on the second partition of the hard disk.

Then I have installed CodeWarrior Pro 4 Academic (full MacOS). After this I have installated this updated for CodeWarrior Pro 4:

  • CodeWarrior Pro 4.1 IDE 3.3 Patch
  • MacOS PPC Linker 2.2.2 Update
  • CodeWarrior Pro 4.1 Mac Compiler MSL Patch

On the same partition of the MacOS 9.1 I have installed also the CodeWarrior Pro 6 Academic and work well togheter without problems.


Installing Universal Interfaces Package 3.4 and Carbon

After the installation of all patches for CodeWarrior Pro 4 I have installed the Universal Interfaces Package 3.4 downloaded from the Apple site following the instructions written by Apple for replacing all C, Pascal and Res files interface.

I have deleted the folder "MW Universal Interfaces" from the path:
CodeWarrior Pro 4:Metrowerks CodeWarrior:MacOS support:Interfaces:

I have also build the precompiled headers of the file:
CodeWarrior Pro 4:Metrowerks CodeWarrior:MacOS Support:MacHeaders:MacHeaders.mcp

To do this you need to add the path of the folder "Metrowerks Standard Library" to the preference panel of the file MacHeaders.mcp, otherwise the compiler return a lot of errors of "file not found".

To build the file "MacOS_PPU.mcp" in the folder:
CodeWarrior Pro 4:Metrowerks CodeWarrior:MacOS support:Interfaces:Precompiled Interfaces:

I have removed the path to the folder "MW Universal Interfaces" from the preferences panel of the project and I have commented the lines "InputSproket.p" and all lines of "QuickDraw 3D" in the file "MacOS.ppu".

I have made my simple game using the version 1.2 of CarbonLib installed with the MacOS 9.1 and the original version of CarbonLib installed with Universal Interfaces Package 3.4 of Apple.

As last developments resources I have installed also ResEdit 2.1.3 and THINK Reference 2.0.1 (old tools, but goods :-)


To build the Coin RAEL sample

To build the Coin RAEL sample I have commented the following lines:

in the file ApplicationServices.p

// {$IFC UNDEFINED __ATSUNICODE__}
// {$I ATSUnicode.p}
// {$ENDC}
            
// {$IFC UNDEFINED __FONTSYNC__}
// {$I FontSync.p}
// {$ENDC}

in the file Carbon.p

// {$IFC UNDEFINED __MACTEXTEDITOR__}
// {$I MacTextEditor.p}
// {$ENDC}
            
// {$IFC UNDEFINED __TRANSLATIONEXTENSIONS__}
// {$I TranslationExtensions.p}
// {$ENDC}
// {$IFC UNDEFINED __TRANSLATION__}
// {$I Translation.p}
// {$ENDC}
            
// {$IFC UNDEFINED __INTERNETCONFIG__}
// {$I InternetConfig.p}
// {$ENDC}


http://web.tiscalinet.it/matteovarisco/