Running Oz

This page is organized as follows:

  1. Running Oz on Departmental Linux Machines
  2. Running Oz on Your Home Machine
  3. Advanced Topics

Running Oz on Departmental Linux Machines

The departmental Linux machines are the recommended platforms for course work, but the Mozart/Oz system should run the same everywhere, so the choice is up to you.

We recommend using the Mozart/Oz system in this class, since it corresponds closely to the van Roy and Haridi book, Concepts, Techniques, and Models of Computer Programming .

Starting Mozart

On the department linux machines (popeye, etc.) the Mozart/Oz system is found in /usr/lib/mozart/bin, which should be in your PATH by default. (Thus you shouldn't have to do anything special to set this up.)

To start the Mozart/Oz system, simply issue the command oz at the shell's prompt.

Exiting Mozart/Oz

Mozart runs under Emacs, so to quit, use the File menu, or type C-x C-c.

Return to top

Running Oz on Your Home Machine

The Mozart/Oz system works on a home machine in the same way as on the department Linux machines.

Getting Mozart/Oz for your Home Machine

The Oz interpreter used for this course is available on many platforms, including Unix, Macintosh, and Windows. You can download it from mozart-oz.org.

Return to top

Advanced Topics

For some problems in the book, you will the Mozart initialization file, which should be saved as .ozrc in your home directory.

See the Mozart/Oz web site for more about the interface. See also the course resources page for links to more Oz resources.

Windows Keystrokes in Emacs

If you like to use the standard Windows keystrokes for cut, paste, and copy, put the following in your emacs customization file, ~/.emacs.el. (The lines that start with a semicolon are comments, and can be omitted.)

;;; Make emacs more like standard windows applications in terms of
;;; mouse selections (this is similar to pc-select).
;;; One advantage is this is that it makes Dragon Dictate work with Emacs.
(require 'cua)

;;; Make the behavior of emacs on C-c, C-v, and C-x to be
;;; just like that of be as in standard window apps, so you can use
;;; these keys to copy, paste, and select when there is a selection
;;; active, then uncomment the following.
(CUA-mode t)

;;; Make C-c leave the region active, which is what happens under Windows.
(setq CUA-mode-keep-region-after-copy t)

Alternatively, you can use Gary Leavens's .emacs.el file which includes the above lines and several other things. It should be saved into .emacs.el in your home directory. (You have to set HOME in the envrionment; this is automatic in Unix, but needs to be done by hand in Windows.) Emacs also has a easy customization mechanism through the "Options" menu.

Running Oz from Within Emacs

To run Oz from within emacs, you can use the following lines in your ~/.emacs.el file.

;;; Oz program mode with Mozart/Oz.
;;; You have to arrange for the Oz-related emacs lisp (.el) files
;;; to be in emacs's load-path, for its bin directory to be in the PATH,
;;; and for the OZHOME environment variable to be set properly.
(add-to-list 'auto-mode-alist '("\\.oz\\'" . oz-mode))
(add-to-list 'auto-mode-alist '("\\.ozg\\'" . oz-gump-mode))
(autoload 'run-oz "oz" "" t)
(autoload 'oz-mode "oz" "" t)
(autoload 'oz-gump-mode "oz" "" t)
(autoload 'oz-new-buffer "oz" "" t)

You can get the above code from Gary Leavens's mode-customizations.el file. The above code makes some assumptions; in particular it assumes that the emacs-lisp files for Mozart/Oz are in the emacs load-path. You can add directories to this load-path by putting the following code near the beginning of you ~/.emacs.el file.

(setq load-path
 (cons "~/emacs"
	 (append load-path
		(list (if (eq system-type 'windows-nt)
			"c:/cygwin/usr/unsup/emacs"
		        "/usr/local/emacs")))))

The above adds my home directory's subdirectory emacs to the load path and also either c:/cygwin/usr/unsup/emacs or /usr/local/emacs depending on the kind of system. I copied the files from the Mozart/Oz install in to one of these directories.

See the Mozart/Oz documentation for more bullet-proof emacs customization code that only relies on OZHOME being set properly.

Making Emacs find your Customization File

On Linux machines, it seems that there is no problem getting the oz command to use your ~/.emacs.el file; you just have to have it in your home directory. On Windows machines, if the emacs started by the oz command is not finding your ~/.emacs.el file, it is because it doesn't know where your home directory is. To do this, you have to set your environment variable HOME to the right directory. (If you use cygwin, you can also make a shortcut in a shell script.)

For Vi Users

If you are a vi user, you may want to use viper-mode in emacs to get the vi keystrokes and still use the Mozart Oz Programming Interface. To do this, put the following in your .emacs.el file:

(viper-mode)

Michael D. Ekstrand has made configuration files and scripts that use Vim instead of Emacs. You can get them at http://www.elehack.net/projects/vim-oz.

Return to top

Last modified Tuesday, October 3, 2006.

This web page is for the Fall 2006 offering of Com S 541 at Iowa State University. The details of this course are subject to change as experience dictates. You will be informed of any changes. Please direct any comments or questions to Gary T. Leavens.