[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] controlling C compilers from MacPerl?




I have recently downloaded the most recent version of MacPerl, and it looks 
(from looking at what's new, and reading recent contributions on this list)
that there is a lot more support for controlling other applications (e.g.
C compilers) by means of AppleEvents. I have the following requirements:

I need to implement an automatic rebuild system for a project consisting 
of about 1500 C files. This should be capable of receiving a set of source
files from a remote system and doing full or incremental builds overnight, 
and running a large set of acceptance tests on each build (yes, we have a 
pretty good Power Mac here!).

I have an existing system written in Perl, which has been used on Unix for 
years, and has recently successfully ported to NT and is working happily there.
If at all possible, I would like to take this code and convert it to MacPerl, 
given that this will take less time than (e.g.) figuring out whether
MPW shellscript and/or Applescript can do what we want, learning how to use 
them, and rewriting all the Perl code.

There are a few things I'm not sure of in this translation process. The major
one is that we don't have system() in MacPerl, so we have to interact with 
other applications in a different way. I have CodeWarrior 9 as my C compiler, 
and I have discovered it supports a suite of AppleEvents which look as though 
they might do the trick. We would want to:

* set compiler options, possibly differently for different C files, if we
need to deoptimise, for example to get round a bug.

* do various stages of preprocessing on a file, using in-house tools, written
in C and ported to Mac.

* compile individual files, and capture all error output such that this is
writable to a log file, maintained by the Perl rebuild system.

* link and test a final image, and report on the results.

So to my questions:

(1) Does using MacPerl sound a sensible approach to the problem, or would
it be better to use MPW shellscript or Applescript (e.g. for reasons of speed)?
Have I overlooked anything which might be obvious to someone more familiar with
the Mac programming environment? 

(2) I am new to Macintosh programming, though I have done plenty with MacPerl
(though I would add, *not* with Perl5 features such as modules). There seems
to be very little documentation on the AppleEvents support in the MacPerl
libraries, apart from a warning that you can seriously trash your machine if 
you don't know what you're doing. I am directed towards Inside Macintosh, which 
I have read bits of. Could anyone recommend a good book/website which would 
form an introduction to all this, so as to make more sense of IM?

thanks for any feedback,

David Herbert.
EDS Unigraphics Cambridge UK.