From CodeWarrior to Xcode


Image SXM was originally compiled in 1993 using THINK Pascal and since about 1995 I have been using the CodeWarrior compiler to create each new version.

CodeWarrior has seen me through Apple's hardware transition from using Motorola 68000 processors to the PowerPC range, and also the software transition from Mac OS 7/8/9 to Mac OS X. If Image SXM was to survive the next hardware transition, from Motorola to Intel processors, I had to change from CodeWarrior to Apple's development system, Xcode.

Rosetta

Image SXM ran on Intel-based Macs because Rosetta, part of the Mac OS, translates Motorola code into Intel code. The catch is that Rosetta is no longer supported in versions of the Mac OS from 10.7 (Lion) onwards.

The CodeWarrior compiler does not compile Mac applications into Intel code. Apple's compiler Xcode does not (officially) support Pascal, but since the release of Snow Leopard I was working on compiling Image SXM with Xcode and the GNU Pascal compiler. Now that I have compiled an Intel version of Image SXM, the Motorola version is redundant except for those who want legacy software to run on older (Motorola) Macs.

GNU Pascal

CodeWarrior Pascal and GNU Pascal are 99% compatible, but it's that 1% that caused all the problems. Image SXM comprises about 2500 procedures and 1000 functions, spread across 150 source files. CW Pascal doesn't really care in which file any particular procedure is defined, but GNU Pascal does -- procedures cannot call other procedures that have not yet been compiled. This involved a lot of reorganisation and moving many procedures and functions between source files so that everything compiles in the right order. It took me a long time to figure out all the interdependencies of the 3500 procedures/functions and so map out what the internal structure of Image SXM needed to be to accommodate GNU Pascal.

Changing from CodeWarrior to Xcode and GNU Pascal

Rewriting the source code so that it compiles with both CodeWarrior (CW) to generate Motorola code and with Xcode and the GNU Pascal compiler (GPC) to generate Intel code has involved a number of changes. I was keen to keep the code compatible with both compilers as I did not want to maintain two sets of source code during the transition from Motorola to Intel.

The letters used to identify the different versions of the application are:

C = CodeWarrior version - the original Carbon application (v192)
M = Motorola version created by Xcode and GPC
X = Intel version created by Xcode and GPC

The principal changes to the source code have been:


Bugs that I know about ( fixed, pending):

File icons now display correctly:



and files with these file types can be dragged onto the Image SXM icon as usual.
File binding (making Image SXM the default application for one or more files of a given type) also works better now.


P.S. I have managed to get the compilation time down from 15 hours (!) to 20 minutes. That's still a lot slower than CodeWarrior, but at least it's more sensible
.

P.P.S. The Intel application runs a bit faster on an Intel Mac than the Motorola application (translated by Rosetta). The speed increase is sometimes rather modest, implying that Rosetta is very efficient.


This is going to need...

Beta testers, preferably lots of them. These are the people who ensure that Image SXM is reasonably bug-free:

William Barvosa-Carter

Hughes Research Laboratories, Malibu, USA

Barry Bickmore

Brigham Young University, Provo, USA

George Boyan

University of Muenchen, Germany

Robert Geisler

Karlsruhe Institute of Technology, Germany

Renée Heilbronner

University of Basel, Switzerland

Richard Legeckis

National Oceanic and Atmospheric Administration, USA

Daniel Manocchio

Kaercher, Winnenden, Germany

Christoph Meier

University of Ulm, Germany

Ernst Niggli

University of Bern, Switzerland

Enique Núñez

Quantimetrix Corporation

Colin Shaw

Montana State University, USA

Dale Stokes

Scripps Institution of Oceanography, UCSD, USA

Anders Thorsen

Institute of Marine Research, Bergen, Norway

Daniel Westhaver Roffer's Ocean Fishing Forecasting Service, Florida, USA
Jeremy Young University College London, UK

and I would be glad to hear from any other users who would like to act as beta testers for future versions.


Steve Barrett    April 2012

S.D.Barrett@liv.ac.uk


Back to top