This page describes how to install and get started using the Mjølner System on Macintosh.
The current version of the BETA compiler on the Macintosh is available as part of the mjolner tool ([MIA 99-39], [MIA 99-40], [MIA 99-34]) and as an MPW tool. MPW stands for Macintosh Programmers Workshop, which is the official programming environment for the Macintosh, developed by Apple, Inc. The BETA compiler runs as an MPW tool, that is, it is a command, that can be invoked from the MPW Shell (command interpreter).
MPW 3.4 or later is needed to use BETA. In addition to the MPW
Shell, the compiler uses the MPW PPCLink
and
Rez
tools to build the programs.
This distribution is stored as a self-extracting archive. To install the Mjølner System, double-click the self-extracting archive.
After the beta5.0
folder is installed you need to move the file
UserStartup
in the beta
beta5.0
folder to the MPW folder (the folder containing the MPW
Shell).
The purpose of
UserStartup
is to set up the environment used by The Mjølner System. beta
When starting MPW the first time after you moved
UserStartup
to the MPW folder, you will be asked to select the beta folder (beta
beta5.0
).
The position of the beta folder will be remembered afterwards using
the file
BetaStartup
in the MPW folder. If this file is deleted or you move or rename the
beta folder you will be prompted for the beta folder again.
Home
During the first startup
UserStartup
also creates the file
beta
BetaStartup
.
Menu
In
BetaStartup
the Menu
ß
menu is defined as described below. You can modify
this file to suit your specific needs.
In case it is deleted a new standard
BetaStartup
is created during the next startup of the MPW.Menu
This section briefly describes how to use MPW for compiling and running BETA applications.
As mentioned above, MPW is a program development environment for the Macintosh computers with tools for editing, compilation and execution of e.g. BETA programs. MPW is a command driven interface to the Macintosh operative system (analogous to the UNIX shell).
MPW is centered around the concept of a worksheet, where the commands are entered and thereafter executed. A worksheet saves its contents from session to session and can therefore be used to contain the most often used commands such that they can be easily executed in later sessions. The commands in the worksheet can be edited using the usual Macintosh editing facilities [3].
Commands can be executed from the worksheet in two different ways:
When starting MPW after installation, an environment is set up to
make it easy to use the BETA system. The BETA compiler can be executed
either using the script beta or by using the special
ß
menu.
Notice that you only need to activate the BETA compiler on the program fragment that constitutes the application. If the program fragment uses other fragments (libraries), these are automatically included by the compiler and linker. If some fragments have been changed since the last compilation, these fragments will automatically be recompiled.
ß
Menu The BETA environment defines a
ß
menu containing items which makes it easy to use the BETA
compiler.
The items are:
~beta/guienv/guienv
In most cases, the ß
menu defines
the necessary interface to the BETA compiler. However, the advanced
user may prefer to use the beta script instead, please see [MIA 90-02] for legal
options etc.
When selecting Compile {Active}
the
beta script is invoked with the active window as argument. The script
first executes the BETA compiler and then executes the job file
generated by the compiler. The job file links the compiled
application. Output during compilation is directed to a separate MPW
window.
The options -Application
and -Tool
specify whether the generated application
should be a Macintosh stand-alone application or an MPW
tool.
The default is that the application is linked
as a Macintosh stand-alone application. If a BETA program uses the
input/output streams keyboard
and screen
in
betaenv
and is executed as a stand-alone Macintosh
application, a simple console window is opened. The input/output
stream is redirected to this window. The console also defines the
standard File and Edit menus. The Cut, Copy, and Paste items in the
Edit menu are available.
The execution can be stopped by selecting Quit in the console File menu.
Notice, that if the program is using GuiEnv, it must be compiled as a stand-alone application. The input/output is in this case redirected to a special GuiEnv window.
October 1997, Apple Computer, inc decided to make MPW freely available for downloading. It can be downloaded from
ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM_Images/MPW-GM.img.bin
The above MacBinary Disk Copy archive contains the two folders
Please notice, that new versions may be available when you read this.
As an alternative to Apple's MPW, an MPW package is included in the MetroWerks CodeWarrior package. Information about MetroWerks can be found at
http://www.metrowerks.com
Information about MetroWerks CodeWarrior can be found at
http://www.metrowerks.com/desktop/mac_os/
Using the CodeWarrior version requires additional
configuration. The name of the CodeWarrior link tool is
MWLinkPPC
, whereas the name of
the linker in the MPW from Apple is PPCLink
. The BETA
compiler must be instructed to use the MWLinkPPC
tool
instead. This is done by inserting the following line in a MPW
UserStartup file:
set -e betaopts -s 70
A MPW UserStartup is a file with a name like
BetaStartup
located in the MPW folder. Smith
An alternative method is to rename the MWLinkPPC
tool to PPCLink
.
The following steps are usually performed when working with BETA programs under MPW:
.bet
). This opens MPW with the worksheet
document in a window.
Open...
entry in the
File
menu. Or
New...
entry in the
File
menu. The file name must end with .bet
.
Save
entry in the
File
menu.
Compile {Active}
in the
ß
menu.
{MPW}:compilerOutput
window. These messages
informs about the progress of the compilation, and eventually about
syntactic and semantic errors.
Execute
in the ß
menu.
Quit
entry in the
File
menu
Steps 3, 4, 5 and 7 may be repeated over and over, while making changes to the same program.
To ensure proper workings of MPW and the BETA compiler, you should ensure, that enough memory is allocated for MPW.
In order to run the
BETA compiler at least 15 MB of memory must be allocated to the MPW
Shell. The amount of memory can be set by selecting the MPW Shell icon
and using the
Show Info
command in the Finder as illustrated in the
figure below:
More memory allocated to MPW makes the compiler and especially the linker run faster.
You may also have to increase the memory requirements of a
compiled BETA application (1.5 MB for a BETA application). This is
done likewise by selecting the BETA application, and then use the
Show Info
command in the Finder.
When compiling programs or running BETA applications, memory is allocated when needed. During compilation memory is allocated in the MPW heap and during execution of BETA applications memory is allocated in the application heap. In case the execution runs out of memory, one of the following messages can appear:
You will then have to increase the memory heap as described above.
Some virus detectors (e.g. Vaccine and Gatekeeper) do not allow MPW to operate correctly. Gatekeeper complains during compilation of a BETA program. Vaccine does not complain but causes MPW to run erroneously, typically to hang. Therefore Vaccine and Gatekeeper must be configured to accept MPW.
In case the system is unable to launch an application from MPW, the problem might be lack of memory. A solution could be to exit MPW and activate the application from the Finder by double-clicking on the application icon.
Please notice, that directories in
ORIGIN
,
INCLUDE
etc. in fragments must be specified using the
UNIX directory syntax. That is, the Macintosh
file:
{betalib}guienv:guienv.bet
must e.g. in an ORIGIN
property of a fragment be
specified as:
ORIGIN '~beta/guienv/guienv'
Please also note, that
~beta/
is used instead of {betalib}
.
Programming the Macintosh is done through the Toolbox. The Toolbox includes a large number of routines and they are all documented in Inside Macintosh. There exists a BETA interface to most of these routines such that they can be used in a BETA program.
The fragment maclib
in file
{betalib}maclib:maclib
contains this toolbox
interface.
Object oriented extensions to the interface to the Macintosh Toolbox have been built in order to make it possible to program the Macintosh in 'the BETA way.' Using purely Toolbox interface routines from BETA forces you to program in a Pascal-like fashion.
The fragments in the folder {betalib}guienv:
contain
an environment (GuiEnv) where windows, text
editors, dialogs, menus, etc. have been lifted to 'real' BETA patterns
with an object oriented interface.
The GuiEnv environment is documented in [MIA 95-30]
The folder {betalib}demo:maclib:
contains demo
programs using the Toolbox interface and the folder
{betalib}demo:guienv:
contains demo
programs using the object oriented extensions.
You may use macintosh resource files in your application. You do
this by specifying a RESOURCE
property, e.g.
ORIGIN '~beta/basiclib/betaenv'; RESOURCE ppcmac 'foo.r; -- program: descriptor -- (# do ... #)
The BETA compiler will automatically compile all the resources in
foo.r
into the application. The extension
'.r
' tells the system that the resource file is a textual
description that must be compiled using the MPW
Rez
tool. If the extension is '.rsrc
'
the system knows that the resource is a
compiled resource file, and it will include the compiled resources
without calling the Rez
tool.
You may need to use the lowlevel Toolbox interface to utilize these resource in the current version of the libraries.
See the BETA FAQ:
https://beta.cs.au.dk/doc/faq/beta-language-faq.html#SectionV
Installation Guide and Platform Specific Issues | © 1999-2004 Mjølner Informatics |
[Modified: Tuesday September 4th 2001 at 9:34]
|