Terra Datentechnik Home Home · Modula-2

Stony Brook Modula-2 Development System

Stony Brook Software's Modula-2 compiler and development system are a programmer's wish list come true. Stony Brook Modula-2 Version 4 is a development package for you that combines a powerful, project based, integrated development environment with a professional optimizing compiler.

Supported Target operating systems

  • 32-bit Windows
  • 32-bit Linux on IA-32 processors.
  • 32-bit Solaris/SunOS on SPARC processors.
  • 32-bit DOS extended, Royalty free, with virtual memory support.
  • 16-bit Windows
  • 16-bit DOS

Development System Tools

  • Development Environment
  • Compiler
  • Debugger
  • Linker
  • Object Librarian (“Archive” in Unix terminology)
  • Execution Profiler (Win32 only)
  • Resource Editor (Win32 and Win16 only)
  • IDL Compiler for COM/DCOM development. Generates Modula-2 source from IDL object description.
  • 32-bit DOS Extender
  • Full run time library (RTL) sources
  • Online documentation. On Windows, help files are used.All other systems use HTML files.
  • Context sensitive help in the environment and debugger user interfaces.

Development Environment

The Stony Brook Integrated Development Environment is the ideal way to manage the development of your applications.  

  • The environment is project based.You can instantly see all of the files in your project and know their current state of compilation.You can quickly navigate to a file for editing.In short, the environment is not just an editor that allows you to compile, but a true development management system.
  • Opening and editing a source file is as simple as typing the name of the module and pressing enter. The environment matches and selects a module as you type so you only need type a minimum of character to match your desired module.
  • Compiling, linking, running and debugging your programs are as easy as a single keystroke. The “make” is completely automatic and transparent.
  • The environment supports multi-processor machines (SMP) and can compile more than one file simultaneously.
  • Projects are not just for programs.A project can be a collection of code to be used by several of your applications.Just build the appropriate files in one project and let your other projects use it. If you need access to the common code, it is just a double click away.
  • The environment is extremely flexible.Not only can the environment use the editor, debugger, linker, librarian and resource editor provided by Stony Brook, but the environment also allows you to use your own favorite tools.
  • Editing of multiple files and viewing your project is a snap with its multiple document interface.
  • Over 50 compiler options that can be set either on a global or per source file basis.The environment saves options both globally and on a per module basis so that modules that need special settings do not make building your application difficult.The environment is also smart enough to remember the options that the module was last compiled with so that only those modules that are affected by an option change are recompiled.
  • The environment allows you to specify where object files are placed so that multiple projects can refer to the same sources and be built with different options, even for different platforms.
  • The environment's user interface allows users to work in a familiar graphical environment.
  • Context sensitive popup menus allow quick access to common actions.
  • The scripting language allows you to write automated scripts to do common tasks such as setting options or complete complex builds in a familiar language that reads like Modula-2. The environment can even automatically generate a build script for you once you have all of your options set.
  • Syntax errors?Not a problem.Stony Brook's environment knows when errors occur and automatically opens the source file at the line and column where the first error occurred to let you fix them fast. You can easily walk through multiple compilation errors in the editor.
  • Visual cues let you know instantly which modules need compilation and which have special options set.
  • User assignable hot keys to quickly open and edit specific source modules.
  • Module and project dependency reports.
  • A source file archive history tracking tool. With this you can see the specific changes made to source files over time and even undo those changes.
  • Multiple file search and replace capability.
  • Can show you a list of modules altered after a given date and time.
  • Can show a list of all modules that import a given module.
  • Binary (Hex) file editor.

Source Code Editor

  • Multiple level undo allows you to quickly get rid of all those typos quickly and easily.
  • Syntax highlighting of source code. Colors and font attributes are user adjustable.
  • Autosave keeps your valuable work from being lost.
  • Position markers help you quickly navigate through your files.
  • Character matching helps you quickly find your way around in complex expression or just quickly find out where a comment begins or ends.
  • Language structure matching helps you navigate around large IF, CASE, FOR, WHILE and REPEAT statements.
  • Our procedure view mode helps you quickly browse the procedures in a module. Once you've found what you're looking for, the stroke of a key edits the procedure's code.
  • Indenting a single line or a block of lines is a piece of cake with the editor's indentation commands.
  • Auto correct allows you to specify a dictionary of frequently misspelled words and their correct spellings so the editor can fix your misspellings as you type. This feature can also be used to give brief names, which the editor will expand to up to the text that you specify. A default expansion dictionary is supplied.
    For example: c?;expands to CARDINAL;
  • Linking editor windows together provides an easy way to compare source files. Scrolling through one file automatically scrolls the linked window.
  • Easy single keystroke navigation and viewing of compilation errors.


  • The Stony Brook Debugger gives you the power you need to hunt down those nasty bugs. Debuggers are provided for all supported platforms. The debugger is a powerful and easy to use tool that provides the following features.
  • Unlimited breakpoints. Breakpoints can be disabled and enabled.
  • Breakpoints that stop after a number of passes for quickly finding a bug when you know the iteration where the bug occurs.
  • Breakpoints that stop only when a logical expression is satisfied so you don't have to decide if this is the situation that you want to debug on every execution of a line of code.
  • Memory written breakpoints to uncover where that crucial alteration (clobber) of a variable is happening somewhere in the application.
  • Execute to a specific location.
  • Point and click data viewing makes inspecting and modifying the value of an expression simple.
  • Context sensitive popup menus to perform common tasks like setting breakpoints and viewing data.
  • A watch window to track specific data as you debug your code.
  • A data window showing all variables local to the currently executing procedure.
  • A procedure call trace window showing you the call history. From this list, you can view the variables of any procedure in the call trace.
  • The various data display windows have the ability to walk lists and expand/contract structures types (record and arrays).
  • A processor registers window, which shows the previous and current values of the registers and highlights the values that have changed.
  • Supports automatic attachment to a Win32 program when a system exception occurs.
  • The debugger saves your breakpoints and data window configurations so that they can be used in your next debug session of the same program.

*Due to operating system limitations 16-bit Windows programs cannot be debugged under Windows 9x. 16-bit Windows programs can be debugged under Windows NT/2000/XP since it does not contain these limitations.

*The DOS debuggers do not support all of the above listed features.


  • Highly flexible calling conventions that allow you to call, or be called by, just about any compiler/interface in existence.
  • Generate a library from a single source file, which allows smart linking of unused code with any linker.
  • We generate our object code to industry standard object formats making linking with other languages simple.
  • Powerful optimizations shrink your executables while allowing them to run faster.
  • Unlike many other compilers, we generate multiple error messages when you have multiple errors and we provide you with the column as well as the line of the error.
  • Our compilers run at speeds of approximately 10,000 lines per second, typical implementation source file, with full optimization, on a 600Mhz Pentium III machine.

Code Generation Optimization

  • Loop top testing makes loops faster by eliminating jumps.
  • Common sub-expression elimination removes duplicate evaluation of equivalent expressions.
  • Loop invariant motion moves the evaluation of expressions that don't change during loop execution outside of the loop.
  • The optimizer will “rewrite” your loops to use a different index making your loop smaller and faster.
  • Our constant/copy propagation tracks variable and constant equivalencies so that unnecessary assignments can be eliminated.
  • Unreachable code is eliminated from your program.
  • Stores to a variable, which is no longer used, are thrown away.
  • Jump chaining retargets a jump to a jump to the final destination.
  • Live variable analysis determines where a variables value is valid to allow efficient use of registers.
  • Our powerful peephole (assembly) optimizer replaces instruction sequences with faster, smaller sequences of code.It also helps by replacing memory references with register equivalents when possible. Unlike most peephole optimizers, ours performs data flow analysis to optimize code across instruction flow and it can reallocate registers.
  • The compiler contains optimizations to merge identical instruction streams at the beginning and end of parallel branches.
  • Data flow analysis allows register information to be preserved through program flows making other optimizations more effective.
  • Register and local variable lifetimes provide allow the peephole optimizer to reuse registers.
  • Induction variable analysis looks for variables that increase or decrease linearly during a loop execution.Multiplication of an induction variable by an expression that is invariant over the loop's execution is replaced by the much faster addition or subtraction instruction.
  • The compiler will use arithmetic identities to simplify expressions.
  • Our flexible scheme for passing parameters in registers on IA-32 processors when possible helps avoid unnecessary memory references.This option can even be enabled to work across modules.
  • The compiler can track procedure register usage across compilation unit boundaries.
  • The compiler allows you to specify whether code size or execution speed is more important to you.The compiler will then use an appropriate strategy to make decisions regarding the benefits of performing a particular optimization.
  • The compiler will evaluate constant expressions, IF and CASE statements, at compile time.


  • The linker is fast and versatile.
  • Links Win32, Linux, Solaris, Win16, 32-bit DOS extended and DOS applications. Supports all of the accepted industry standards, such as, Microsoft COFF, ELF, OMF, DWARF and Microsoft CodeView debug information.
  • Capable of linking multiple resource files for Win32 and Win16 programs.

Resource Editor

The Stony Brook Resource Editor provides you with a graphical way to create and modify your Win32 and Win16 resources.

  • Edits accelerators, bitmaps, cursors, dialogs (including extended), icons, menus (including extended), string tables and version resources graphically.
  • Allows the use of symbolic names in for resource identifiers in Modula-2, Pascal, Ada95 and C.
  • Supports the new Windows 9x/NT/2000 Common Controls.
  • Reads and writes RES files directly so that there is no need for a resource compiler.
  • Allows you to convert Win32 resources to Win16 resources, and back.
  • Allows you to generate reports on your resources in HTML format for documentation purposes.

Modula-2 Language

Stony Brook Modula-2 follows the ISO standard specification for the language. Look at some of the interesting features the ISO standard introduced.

  • An exception handling system is now part of the language with all the safety that it brings to your code.
  • Support for the complex number type.
  • Constants composed of record and array types.
  • Multidimensional open array parameters are now allowed.
  • For loop index variables have become read only to prevent difficult to find bugs.
  • Do you find module initialization code useful?Modula-2 now supports module termination code as well.
  • Object oriented programming with the new CLASS type.
  • Generic modules with type parameters.

Check out some of our extensions to the language

Runtime Library Overview

The library of modules provided with Stony Brook Modula-2 is extensive. The library includes ISO Standard modules, modules unique to Stony Brook Modula-2, and modules that are used internally by the compiler runtime system. Many of the ISO modules are implemented with calls to the Stony Brook specific modules. Full source code for all modules is provided, including low-level compiler internal support procedures. The focus of the library are modules that are portable in nature from one operating system to another, and modules that are generally useful to all applications. Some modules are not available for all supported platforms. Unless otherwise specified all modules are available for all supported platforms.

All modules are documented via their DEFINITION MODULE source files included with Stony Brook Modula-2.

SYSTEM modules


The following modules will exist in all ISO Modula-2 implementations.


This module provides procedures for dynamic memory allocation and deallocation by calling the procedures directly or indirectly with the NEW and DISPOSE standard procedures. The ExStorage module is a more capable module.


This module provides procedures to classify the value of a character type to a functional group. For example, to determine if a character is a numeric character.


This module provides a very low-level interface to the exact implementation details of the REAL type.


This module provides a very low-level interface to the exact implementation details of the LONGREAL type.

The following modules are part of the ISO Standard library, however an implementation does not have to provide these modules. If an implementation does have a module with the same name as one of the ISO Standard modules then that module must conform to the ISO definition of that module with no extensions, alterations or deletions. In general, all ISO Modula-2 implementations will provide these modules.


This module provides procedures to manipulate ARRAY OF CHAR types, which are normally, called Strings.


This module provides various mathematical functions for type REAL.


This module provides various mathematical functions for type LONGREAL.


This module provides various mathematical functions for type COMPLEX.


This module provides various mathematical functions for type LONGCOMPLEX.


This module provides procedure to access the system real time clock.


This module defines types used by the ISO string conversion modules.


Procedures to convert INTEGER and CARDINAL types to strings and visa versa.


Procedures to convert the REAL type to strings and visa versa.


Procedures to convert the LONGREAL type to strings and visa versa.


Low level conversion procedures for INTEGER and CARDINAL.


Low level conversion procedures for REAL.


Low level conversion procedures for LONGREAL.

The ISO Modula-2 I/O library modules

IOResult, TextIO, WholeIO, RealIO, LongIO, RawIO
IOChan, IOConsts, StdChans
StreamFile, SeqFile, RndFile, TermFile, ProgramArgs
IOLink, ChanConsts
STextIO, SWholeIO, SRealIO, SLongIO, SRawIO, SIOResult

All of the following modules are specific to Stony Brook Modula-2.

Full source code is supplied for all runtime library modules. Therefore, portability should not be an issue.


This module provides mnemonics for ASCII control codes.


This module provides procedures to access environment strings and the command line string.


This module provides procedures to execute programs and command interpreter commands.


This module provides numeric conversions for INTEGER, CARDINAL, LONGINT and LONGCARD types.


This module provides numeric conversions for the REAL and LONGREAL types.


This module provides procedures for calculating an elapsed time between two procedure calls and executing timed delays.


This module provides procedures for generating fast pseudo random number sequences of type CARDINAL.


This module provides procedures for generating fast pseudo random number sequences to type REAL.


This module provides procedures for reading and writing to a simple terminal device. On graphical operating systems, a text mode window is used to simulate a text mode terminal.


This module provides extensive flexibility and capability for dealing with disk storage devices and pipes.


The module provides procedures for reading and writing human readable formatted text files.

LWholeIO, SLWholeIO, LWholeStr

Similar to the functions found in WholeIO, SWholeIO, WholeStr except these modules apply to type LONGINT and LONGCARD.

ComplexIO, LongComplexIO, SComplexIO, SLongComplexIO

These modules provide text input and output of COMPLEX and LONGCOMPLEX types. The modules follow, and integrate with, the format of the ISO standard I/O library.


This module provides a procedure that will generate a formatted string from a format template string and a variable number of format item parameters such as CARDINAL and ARRAY OF CHAR.


This module provides procedures for filling, scanning and moving memory regions.


This is a 100% compatible superset of the ISO Standard Storage module. The ISO Storage module is implemented with calls to this module. This module provides extensive flexibility and capability in dealing with dynamic memory allocation.


This module provides case insensitive versions of the ISO Standard Strings module procedures, plus some other useful procedures.


This module extends the ISO Standard SysClock module by providing functions for comparing DateTime values, and conversions to/from DateTime and the DOS file date time format, and to/from DateTime and the C/Unix runtime library date time format.


This module provides functions for generating a CCITT 32-bit CRC.


This module provides functions for sorting data.


This module provides functions for manipulating bit vectors. Bit vectors are very similar to SET types, however these can be of an arbitrary size allocated at runtime.


This module provides a simple method of setting the default heap in ExStorage to debug mode. This module is useful when you have module initialization code that allocates memory. To use this module you simply import it as the first module imported in your main program.


This module is only available for 32-bit DOS extended applications.  It provides procedures for accessing real mode memory addresses from 32-bit protected mode. It isolates a program from differences between the FlashTek and PharLap DOS extenders should you want to run under both. The FlashTek extender is the one included Stony Brook Modula-2.

MD5, SHA1, SHA256, SHA384, SHA512, AreSee4, DES, AES, Blowfish, RSA, CryptEncode

These are used in cryptography and the names of the modules should tell you what they do.


This module implements an integer type with an unlimited numeric range.
VLI = Very large integer.


This module implements an integer fixed point type suitable for monetary computations.

The following modules are available on 32-bit Windows and Unix target systems.


This module provides procedures that support creating and controlling threads, inter-thread and inter-process synchronization objects.


This module provides procedures to allow you to execute a program asynchronous with your process, and to redirect its standard input and output to a FileFunc File. This can then be used with the FileFunc read/write procedures to read/write the process output/input.


This module provides procedures to allocate inter-process shared memory.


This module provides procedures to manipulate memory-mapped files.


This module provides procedures for controlling pipes used for inter-thread communication. Byte and message pipes are supported.


This module provides procedures to read and write configuration information in a portable manner. Both per machine (global) and per user (local) settings are supported.


This module provides a portable interface to the "sockets" API.


This module provides an encapsulation for creating timers not associated with a GUI window.

GUI user interface modules.

We use these modules for developing the environment and debugger user interfaces. They are currently implemented for Win32 and GTK+ (Unix) environments

  • WinShell - this is the base Windowing API encapsulation.
  • DlgShell - this module provides an interface for dialog boxes. It has capabilities for modal, modeless and tabbed dialogs.
  • BasicDialogs - common dialogs, ready to go.
  • TextWindows - this module is built on top of WinShell and provides a very high level interface for windows that will display simple text.

The following modules are only available on 32-bit Windows target systems.

Win32 API interface





This module provides procedures to greatly simplify using the Win32 registry.


This module provides a procedure to read and cache in memory strings that are obtained from a string table resource.


This module provides procedures for controlling pipes for inter-process and inter-computer (LAN) communication. Byte and message pipes are supported.

The following modules are only available on “Unix” target systems.


Portable core Unix APIs


POSIX threads interface, and additional threading related APIs.


An interface to the various Unix sockets APIs


POSIX realtime APIs.


Dynamic shared object loading and unloading API.

GTK+ 1.2.x Interface GUI toolkit APIs



This module provides an interface to the libGlade library. It reads the Glade GUI builder generated files and creates individual GUI elements at runtime. Glade uses the GTK toolkit.

Logitech Modula-2 V4 Compatible DOS and Win16 Libraries

The fact, that the Stony Brook system comes with different libraries, made quick adaptation of existing Logitech Modula-2 V4 applications difficult. With the availability of LM2V4 compatible libraries from TERRA Datentechnik these times are gone and the port of existing DOS and Windows 16-bit Logitech Modula-2 V4 applications to Stony Brook Modula-2 V3 has become a snap. These libraries are a most valuable add-on that greatly simplifies migration from Logitech to Stony Brook Modula-2.

The Logitech V4 compatible library implementations basically include all but a few Logitech library modules. Not included are module "Break", the exception handling modules, and some further modules of the run-time support, which are unlikely to be called directly from application programs.

The Logitech compatible DOS library supports two implementations of the Modula-2 standard procedure IOTRANSFER (to be imported from the standard module COROUTINES): One according to the ISO standard, and another one that follows the old Wirth/Logitech definition. In addition, the library also provides the other interrupt handling related procedures of module COROUTINES according to the ISO standard (ATTACH, DETACH, etc.), as well as the run time procedures that implement module protection ("priorities").

This library was developped for Stony Brook Modula-2 Version 3 and has not yet been adapted and tested under Version 4. We expect process to be fairly simple and straightforward.


Logitech Modula-2 V3 Compatible Library for Building Win32 Console Applications

A Logitech Modula-2 version 3.40 compatible library for building Windows 32-bit Console Applications is also available from TERRA. This library allows for easy porting of non-graphical (character-output oriented) Logitech Modula-2 V3.40 DOS programs into the 32-bit Windows environment.

Console Applications are native 32-bit Windows programs that have a main program module like DOS applications. They neither need a message handling main loop, nor to install call-back routines, nor to explicitly initialze and open any windows. Instead, they use a "console" or "Terminal" window, which looks about like a Windows DOS box.

This library was developped for Stony Brook Modula-2 Version 3 and has not yet been adapted and tested under Version 4. However a quick test showed that only 8 Modules are affected and only smaller changes will be needed.



The Stony Brook Modula-2 Development System Media Package includes the Modula-2 Environment, Compiler, Debugger, Linker, Librarian, Resource Editor, 32-bit Extender, Run Time Library Sources, and documentation.

The Logitech Modula-2 V4 Compatible DOS and Win16 Libraries, and the Logitech Modula-2 V3 Compatible Library for Win32 Console Applications from TERRA Datentechnik come as add-ons to Stony Brook Modula-2 and are available separately.

Von Mensch zu Mensch
Home · Modula-2

 Copyright © TERRA Datentechnik 1996-2006
Alle Rechte vorbehalten.TERRA Datentechnik übernimmt keine Haftung für die Vollständigkeit, Richtigkeit und Aktualität der Angaben!
Rechtliche Hinweise  ·  Firmenprofil
Contact us   Last Updated: 12-November-2002 Webmaster