CodeWarrior 8.3 and Panther
Jean-Claude Jesior, Programmer



CodeWarrior 8.3 and Panther
by Jean-Claude
Updated: Aug 4, 2005

This article is a digest of different contributions made on the MacPascal mailing list.

Contents


ORIGINAL PROBLEM

I'm using CodeWarrior 8.3 in Mac OS 10.3.2. Since yesterday, I get a spinning wheel when I want to quit ANY carbon project and the only way I can get out is a 'Force Quit'. This does not happen when CodeWarrior opens in Classic. It used to happen sometime ago, but then it stopped. I do not know what I may have changed in my settings. This is apparently a problem bound to CodeWarrior because it occurs with all 5 projects available on the Merlin's Tower of the Pascal Central site.

RESOLUTION:
I probably had some damaged CodeWarrior files. This pushed me to re-install CodeWarrior.
After that, however, I encountered a lot of installation problems which I do not remember having met on the first install (my Mac is now running on Mac OS 10.3.2). I solved these problems with the help of MW Ron on comp.sys.mac.programmer.codewarrior.

I am listing here the exact steps that I followed to install CodeWarrior 8.0 and to upgrade it to 8.3. This is followed by the installation of the Pascal patch and some necessary steps to build a Pascal project. This post is a digest of the contributions of MW Ron, Vik Rubenfeld, David Bainbridge, Joe von Tunen, Adriaan von Os and Gale Paeper. Many thanks to them all.


INSTALLING CODEWARRIOR 8.3 ON PANTHER 10.3.2

(mostly contributed by MW Ron)

"...the SDK changed so the headers and libraries don't fit... here is the solution."

- MW Ron


1. START FROM SCRATCH

If you had CodeWarrior already installed:


2. INSTALL XCODE TOOLS

Install Xcode Tools using the 'Xcode Tools' CD that came with Panther.
Once you've selected the disk on which the installation should take place, click on the 'Customize' button, and in 'Cross-Development' select 'Mac OS X 10.2 SDK' (not 10.3). Perform the upgrade.
This install modifies the 'Developer' folder and creates a 'MacOSX10.2.8.sdk' folder.


3.MODIFY LIMITS.H

Modify Apple's 'limits.h' found in /Developer/SDKs/MacOSX10.2.8SDK/usr/include/ppc/limits.h

Change :

#ifndef _PPC_LIMITS_H_
#define _PPC_LIMITS_H_
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
#define CLK_TCK 100 /* ticks per second */


to

#ifndef _PPC_LIMITS_H_
#define _PPC_LIMITS_H_
#define CLK_TCK 100 /* ticks per second */
#if !_MSL_USING_MW_C_HEADERS
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */


And, at the end of the file, add :

#endif /* _MSL_USING_MW_C_HEADERS */


before

#endif /* _PPC_LIMITS_H_ */


4. INSTALL CW 8


5. INSTALL CW UPDATES


6. RESET IDE

Reset the IDE global Preferences' Source Trees for 'OS X Volume' back to /.

7. COMPLETE INSTALLATION

Finish installing CodeWarrior 8.0 using the Reference CD.

You are done with the CodeWarrior 8.3 installation.


INSTALLING THE PASCAL PATCH

(mostly contributed by Vik Rubenfeld)

1. SET FILE CACHE TO ZERO

Open CodeWarrior and the Edit > Preferences... menu.
Select 'Build Settings', and set the 'Include File Cache' to zero.


2. INSTALL PASCAL PATCH

Download the Pascal patch (0.7 MB) :
ftp://ftp.metrowerks.com/pub/updates/ARCHIVES/CWMacOS7/Pro_7.0_Pascal_Patch.sit
Install it.


3. REPLACE SETLIB.C LIBRARY

(contributed by Joe van Tunen)

Joe van Tunen found some anomalies in the Pascal MSL file 'SetLib.c'. The following link offers a corrected version of 'SetLib.c' :
http://pascal-central.com/source-code/setlib.hqx


4. REBUILD PASCAL MSL LIBRARIES

Open the project 'MSL_Pascal.PPC.Mtarg.mcp' located in 'Metrowerks CodeWarrior 8.0/Metrowerks Codewarrior/MSL/MSL_Pascal/MSL_MacOS/PPC/Project'.

Click on the Targets tab in the Project window. Remove the targets 'Rt PPC TOOL (opt.)' and 'Rt PPC TOOL (dbg.)' (To remove them, select them and then click Clear on the Edit menu.) Those two targets were used with MPW, which CW 8 no longer references.

Now click on the Files tab in the Project window. In the IO group, find the file 'API_Support.c' and open it.

Find the line:

#include <time.h>


and change it to:

#include <time_api.h>


Now select 'Build All' from the Targets pop-up in the Project window, and build the project.


5. UPDATE PASCAL INTERFACES

Download the PInterface 3.4.2 :
ftp://ftp.apple.com/developer/Development_Kits/UniversalInterfaces3.4.2.img.bin
Find the current CodeWarrior Pascal interfaces 3.4.1 located in 'Metrowerks CodeWarrior 8.0/Metrowerks Codewarrior/MacOS Support/Universal' and replace the Universal folder by the one found in the 3.4.2 interfaces.


6. MODIFY MACAPPLICATION.P

(contributed by David Bainbridge)

Now edit the file MacApplication.p.

Add before the {$PUSH} directive :

{$IFC UNDEFINED __Menus__}
{$I Menus.p}
{$ENDC}


7. MODIFY TRANSLATIONEXTENSIONS.P

(contributed by Gale Paeper correcting a previous contribution of David Bainbridge)

Now edit the file TranslationExtensions.p.

A better fix is to just rearrange the code in TranslationExtensions.p so the last compileable line of code isn't a function/procedure type declaration ending with a semicolon. One way of doing this is to move the constant declarations occcuring just before the function/procedure type declarations at the end of the file to just after the block of function/procedure type declarations.

Move the block :

{******************************************************************************************

Component Manager component selectors for translation extension routines

******************************************************************************************}

CONST

kTranslateGetFileTranslationList = 0;
kTranslateIdentifyFile = 1;
kTranslateTranslateFile = 2;
kTranslateGetTranslatedFilename = 3;
kTranslateGetScrapTranslationList = 10;
kTranslateIdentifyScrap = 11;
kTranslateTranslateScrap = 12;
kTranslateGetScrapTranslationListConsideringData = 13;


just before the {$ALIGN RESET} directive.

You are done with the Pascal patch installation.


BUILDING A PASCAL PROJECT


Previously, this article suggested setting Struct Alignment to 68K and adding {$ALIGN POWERPC} before "interface" in each of your project units. However, thanks to Adriaan von Os and Gale Paeper, there is an easier and better way to build a Pascal project.

At the end of the UPICarbon.prefix file add:
{$ALIGN POWERPC}

This is equivalent of changing the project Settings/PPC Processor/Struct Alignment to 68K and adding before 'interface' in each of your project units {$ALIGN POWERPC}. However, modifying the UPICarbon.prefix file instead has the additional advantage of suppressing the CW 8 project preferences related floating point bug.

FINAL COMMENTS:


TROUBLESHOOTING

(contributed by Vik Rubenfeld)

IF YOUR PROJECT COMPILES BUT THE DEBUGGER WON'T LAUNCH
or
CW GIVES YOU AN "UNABLE TO OPEN PROJECT" MESSAGE
or
IF YOUR PROJECT COMPILES WITH ERROR MESSAGES IT DIDN'T HAVE IN CW 7

It probably means some or all of your source files are nested too deeply within folders and sub-folders. This is a known bug in GDB, the CW Debugger. It is especially likely in OS X since your documents are likely already several folders deep in a user/documents folder. Move the folders containing your source files as close as possible to the root level of the volume; for example, put them at the top level of your user/documents folder.

IF YOUR PROJECT COMPILES BUT THE DEBUGGER WON'T RUN, GIVING YOU AN MESSAGE
SAYING IT DOESN'T HAVE ACCESS TO A REQUIRED FILE

It means CW doesn't have read/write permission to the folder your built application is in. Quit CW. In the Finder, select the folder your built application is in. Select File Menu->Get Info. Reset the permission on the folder. (If you wish to remove all access restrictions, give all users read/write permission and unlock the folder by clicking on the lock icon). Then open CW and proceed.


OTHER RELATED DOCUMENTS

Installing Pascal with Codewarrior 8

Sioux under Codewarrior 8



Copyright © 2004-2005, Jean-Claude Jesior