September 95 - MPW Tips and Tricks: Customizing Source Control With SourceServer
MPW Tips and Tricks: Customizing Source Control
With SourceServer
Tim Maroney
When two engineers on a team edit the same source file at the same time, the resulting
chaos can be terrible to behold. Source control was invented to mitigate the problem.
Most Macintosh programmers are familiar with the MPW Shell's Check In and Check
Out dialogs, and with its Projector commands. The next frontier of custom source
control involves SourceServer, a nearly faceless application that implements most of
the Projector commands. MPW scripts are easy to write, but they're no match for the
power, speed, and friendliness of compiled software. SourceServer exports Projector
commands as Apple events, allowing source control from compiled software without
launching the MPW Shell in all its pomp and splendor.
Popular third-party development environments often send Apple events to
SourceServer for integrated source control. You can also use SourceServer to
customize Projector beyond what you might have thought possible. For instance, you
can drag source control, kicking and screaming, into the modern world of user
experience with drop-on applications. In this column, I'll show you how to check a file
in or out with a simple drag and drop, and how to use SourceServer for other things as
well. The sample code is provided on this issue's CD; SourceServer is distributed, with
documentation, on the MPW Pro and E.T.O. CDs (available from Apple Developer
Catalog) and with third-party development systems.
APPLE EVENTS FOR SOURCESERVER
Apple events have many faces, but they're primarily a way of communicating between
different applications.
Each Apple event encapsulates a message as a command with any number of input
parameters; the receiver of the message may return any number of result parameters
to the sender. The most basic unit of data is the Apple event descriptor, which consists
of a type code and a data handle. Apple events are built out of descriptors and are
themselves special kinds of complex descriptors.
For an excellent introduction to Apple events, see "Scripting the
Finder From Your Application" by Greg Anderson in develop Issue 20.*
SourceServer's commands are represented as descriptor lists. Its Apple events are
exact duplicates of the MPW Shell's Projector commands, but to avoid the overhead of a
full command parser, both the command name and each argument are descriptors in
the descriptor list. This saves you the trouble of putting quotes and escapes into