3 Installation guide for Power Macintosh

3.1 The Mjølner System on Macintosh

This page describes how to install and get started using the Mjølner System on Macintosh.

3.1.1 MPW

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.

3.2 Requirements

3.3 Installation

3.3.1 Unpack

This distribution is stored as a self-extracting archive. To install the Mjølner System, double-click the self-extracting archive.

3.3.1.1 Configuring the Files

After the beta5.0 folder is installed you need to move the file UserStartupbeta in the beta5.0 folder to the MPW folder (the folder containing the MPW Shell).
The purpose of UserStartupbeta is to set up the environment used by The Mjølner System.
When starting MPW the first time after you moved UserStartupbeta to the MPW folder, you will be asked to select the beta folder (beta5.0). The position of the beta folder will be remembered afterwards using the file BetaStartupHome 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.

During the first startup UserStartupbeta also creates the file BetaStartupMenu.
In BetaStartupMenu the ß menu is defined as described below. You can modify this file to suit your specific needs.
In case it is deleted a new standard BetaStartupMenu is created during the next startup of the MPW.

3.4 Macintosh Specific Issues

3.4.1 Using MPW - Macintosh Programmers Workshop

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:

  1. The text cursor is placed somewhere in the command line and the Enter key [4] is pressed. The entire line will then be executed as one command.
  2. Some text may be selected and the Enter key is pressed. The selected text will then be executed as one command.

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.

3.4.1.1 The ß Menu

The BETA environment defines a ß menu containing items which makes it easy to use the BETA compiler.

The items are:

Compile {Active}
Compile the front most window
Recompile
Compile the previously compiled file again
Compile File...
Prompts the user for a file, and compiles the selected file
Execute
Execute the last compiled file
Open Fragment
Tries to open the selection. The selection is treated as a BETA file name, e.g. ~beta/guienv/guienv
Directory {Active}
Changes directory to the location of the file shown in the front most window
-Application
Compile the BETA program as an application (default)
-Tool
Compile the BETA program as an MPW Tool

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.

3.4.1.1.1 Application and Tool

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.

3.4.1.2 Free Download of MPW

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.

3.4.1.3 CodeWarrior MPW

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/
3.4.1.3.1 Additional Configuration for CodeWarrior MPW

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 BetaStartupSmith located in the MPW folder.

An alternative method is to rename the MWLinkPPC tool to PPCLink.

3.4.2 Getting started on Macintosh

The following steps are usually performed when working with BETA programs under MPW:

  1. MPW is started by double clicking the MPW Shell icon or on a BETA source file (.bet). This opens MPW with the worksheet document in a window.
  2. We now edit the BETA program text. This may be initiated in two different ways:
    1. We open an existing BETA file by selecting the Open... entry in the File menu. Or
    2. We create a new file for the BETA program by selecting the New... entry in the File menu. The file name must end with .bet.
  3. Now edit the file using the ordinary Macintosh editing facilities in the window containing the program.
  4. Save the changed BETA program using the Save entry in the File menu.
  5. Select Compile {Active} in the ß menu.
  6. Messages will now be written in the {MPW}:compilerOutput window. These messages informs about the progress of the compilation, and eventually about syntactic and semantic errors.
  7. The program may now be executed by selecting Execute in the ß menu.
  8. Close MPW using the 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.

3.4.3 Memory Requirements

3.4.3.1 Memory Requirements to MPW Shell

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:

MPW Shell Info: Memory: Preferred Size: 15000K

More memory allocated to MPW makes the compiler and especially the linker run faster.

3.4.3.2 BETA Application Memory Requirements

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.

3.4.4 Errors and Configuration

3.4.4.1 Memory Allocation Errors

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.

3.4.4.2 Virus detectors

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.

3.4.4.3 Problems with Memory

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.

3.4.4.4 Directories in Fragments

Notice! 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'

Notice! Please also note, that ~beta/ is used instead of {betalib}.

3.4.5 Accessing the Macintosh Toolbox from BETA

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.

3.4.5.1 BETA extensions to the Toolbox

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.

3.4.6 Adding Resources to Applications built with the BETA Compiler

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.

3.5 Additional Information for Macintosh

3.5.1 Limitations for Macintosh

See the BETA FAQ: https://beta.cs.au.dk/doc/faq/beta-language-faq.html#SectionV


[3] Please see your Macintosh manuals for how to use your Macintosh
[4] The Enter key is located in the lower right corner of the numeric keypad. Pressing the Return key will just insert a carriage return


Installation Guide and Platform Specific Issues
© 1999-2004 Mjølner Informatics
[Modified: Tuesday September 4th 2001 at 9:34]