# B Mozart System Development Support

The commands and user options described in this section are probably only interesting for people developing or extending parts of Mozart and thus compiling their own system components. They provide for testing parts of the system locally before installing and for running them under the GNU Debugger gdb.

For completeness and as a reference for the developers themselves, they are described here nevertheless.

## B.1 Viewing Emulator Bytecode

The bytecode produced by the compiler can be displayed conveniently in an Emacs buffer. See Section 4.3 for a description of the feedable regions.

`oz-to-emulatorcode-buffer` [command]
`oz-to-emulatorcode-region` `START``` `END` [command]
`oz-to-emulatorcode-line` `COUNT` [command]
`oz-to-emulatorcode-paragraph` `COUNT` [command]

  The corresponding text region is prefixed by

  >     \localSwitches
  >     \switch -core +codegen +outputcode -feedtoemulator

  and fed to the Oz Compiler. If compilation succeeds, the resulting source file will be displayed in the Oz Temporary buffer.

`ozm-mode` [command]

  This is the major mode for displaying (especially fontifying) bytecode. Loading a file with extension `.ozm` automatically puts a buffer into Oz-Machine mode. You can tell a buffer is in Oz-Machine mode by the string `Oz-Machine` in its mode line.

## B.2 Testing Locally

One part of the support is concerned with testing system functors locally.

`oz-build-dir` (default: `~/mozart`) [user option]

  Path to the build directory, i. e., the directory in which `configure` was invoked. You should set this before the OPI is loaded into Emacs for the following user options to be initialized correctly.

`oz-emulator` (default: see below) [user option]

  File name of the Oz Emulator binary. This is used when running the Emulator under `gdb`, and by the `oz-other` command.

  The default value of this variable is taken from the environment variable `OZEMULATOR` if it is set, else it is set to

  > oz-build-dir`/platform/emulator/emulator.exe`

`oz-functor-path` (default: see below) [user option]

  Search path for the Oz system functors. This is used by the `oz-other` command. By default, this specifies rules to look for functors in the `oz-build-dir/share/lib` and `oz-build-dir/share/tools` directories. This is useful for first testing changes before installing the modified functors globally.

  The default value of this variable is taken from the environment variable `OZ_LOAD` if it is set, else it is set to

  > `prefix=x-oz\\://system/=`oz-build-dir`/share/lib/:
  > prefix=x-oz\\://system/=`oz-build-dir`/share/tools/:
  > prefix=x-oz\\://boot/=`oz-build-dir`/platform/emulator/:
  > cache=~/.oz/cache:cache=`oz-home`/cache`

  where oz-home stands for the value of the environment variable `OZHOME`.

`oz-root-functor` (default: `"x-oz://system/OPI.ozf"`) [user option]

  Name of the root functor to load on startup.

`oz-set-other` `SET-FUNCTOR-PATH` (C-. m) [command]

  If `SET-FUNCTOR-PATH` is `nil`, call `oz-set-emulator`, else call `oz-set-functor-path`.

`oz-set-emulator` (C-. m) [command]

  Interactively set the value of the variable `oz-emulator`. Also, if the environment variable `OZEMULATOR` is set, replace its value by this one.

`oz-set-functor-path` (C-u C-. m) [command]

  Interactively set the value of the variable `oz-functor-path`. Also, if the environment variable `OZ_LOAD` is set, replace its value by this one.

`oz-other` `SET-FUNCTOR-PATH` (C-. o) [command]

  If `SET-FUNCTOR-PATH` is `nil`, call `oz-other-emulator`, else call `oz-other-functor-path`.

`oz-other-emulator` (C-. o) [command]

  Toggle between global and local Oz Emulator. The local emulator is given by the user option `oz-emulator`; see `oz-set-emulator`.

`oz-other-functor-path` (C-u C-. o) [command]

  Toggle between global and local Oz functor search path. The local functors are given by the user option `oz-functor-path`; see `oz-set-functor-path`.

## B.3 Running under gdb

The last command is for starting the Mozart Emulator under gdb.

`oz-gdb` (C-. d) [command]

  Toggle debugging of the Oz Emulator with gdb. This sets some additional environment variables since the `oz` script has to be bypassed, and starts `gud-mode` with the emulator binary specified by the user option `oz-emulator`.

`oz-gdb-autostart` (default: `t`) [user option]

  If non-`nil`, start emulator immediately when in gdb mode. Else you have the possibility to first set breakpoints and only run the emulator when you issue the `run` command to gdb.