Home Tutorial Win32 API Reference Projects

Stony Brook Modula-2Stony Brook Modula-2 archive

Stony Brook Software

Stony Brook has a development package for you that combines a powerful, project based, integrated development system 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.

Debugger

  • 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.

Compiler

  • 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.

Linker

  • 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 andmodify 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 withStony Brook Modula-2.

SYSTEM modules

SYSTEM
EXCEPTIONS
M2EXCEPTION
M2OOEXCEPTION
TERMINATION
COROUTINES
GARBAGECOLLECTION

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

Storage

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

CharClass

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

LowReal

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

LowLong

This module provides a very low-level interface to the exact implementation detailsof 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 implementationdoes have a module with the same name as one of the ISO Standard modules then thatmodule must conform to the ISO definition of that module with no extensions, alterationsor deletions. In general, all ISO Modula-2 implementations will provide these modules.

Strings

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

RealMath

This module provides various mathematical functions for type REAL.

LongMath

This module provides various mathematical functions for type LONGREAL.

ComplexMath

This module provides various mathematical functions for type COMPLEX.

LongComplexMath

This module provides various mathematical functions for type LONGCOMPLEX.

SysClock

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

ConvTypes

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

WholeStr

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

RealStr

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

LongStr

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

WholeConv

Low level conversion procedures for INTEGER and CARDINAL.

RealConv

Low level conversion procedures for REAL.

LongConv

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.

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

ASCII

This module provides mnemonics for ASCII control codes.

Environment

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

RunProg

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

Conversions

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

RConversions

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

ElapsedTime

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

RandomNumbers

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

RealRandomNumbers

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

Terminal

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 modeterminal.

FileFunc

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

TextFileFunc

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.

FormatString

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 CARDINALand ARRAY OF CHAR.

MemUtils

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

ExStorage

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

ExStrings

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

TimeFunc

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

GenCRC

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

SortLib

This module provides functions for sorting data.

BitVectors

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

SetExStorageDebugMode

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

ExtUtils

This module is only available for 32-bit DOS extended applications. It providesprocedures for accessing real mode memory addresses from 32-bit protected mode. Itisolates a program from differences between the FlashTek and PharLap DOS extendersshould you want to run under both. The FlashTek extender is the one included StonyBrook Modula-2.

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

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

CryptEncode

Implements various block encoding algorithms used with encryption.

CryptKey

Implements various key generation functions used with password based encrpytion.

VLI

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

Money

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.

Threads

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

PipedExec

This module provides procedures to allow you to execute a program asynchronouswith 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 processoutput/input.

MemShare

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

FileMap

This module provides procedures to manipulate memory-mapped files.

Pipes

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

ConfigSettings

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

Socket

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

SMTP

This module provides an interface to the SMTP email protocol.

Timers

This module provides an encapsulation for creating timers not associated witha 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

WIN32, WINUSER, WINGDI, COMMCTRL, COMMDLG, RichEdit, HTMLHELP, WINSOCK2, SQL,Ole2, OleDlg, WINCON, WINERROR, WINNETWK, WINNLS, WINPERF, WINREG, WINSPOOL, WINSVC,WINVER, WINX, MMSYSTEM, MMREG, MSACM, LZEXPAND, MCIAVI, RPC, TOOLHELP32, SHELLAPI,SHLOBJ, Gdiplus, GdiplusFlat

OpenGL

OpenGL, GLAUX, GLU

SplitterControl

This module provides a control to split a window into to separate panes which cancontain independent child windows. The proportion of the split can be controlled by theuser by dragging the splitter bar.

Registry

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

StringCache

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

NamedPipes

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.

UNIX

Portable core Unix APIs

PTHREADS

POSIX threads interface, and additional threading related APIs.

UnixSock

An interface to the various Unix sockets APIs

POSIX_REALTIME

POSIX realtime APIs.

DLFCN

Dynamic shared object loading and unloading API.

GTK+ 1.2.x Interface GUI toolkit APIs

GTK, GDK, GDK_TYPES, GDK_RGB, GDK_PIXBUF

GLADE

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

Pricing

Win32 native system supporting development for 32-bit Windows, 32-bit DOS extended,16-bit Windows, 16-bit DOS code generation. Pricing is $495.00 USD.

Linux native supporting development for 32-bit Linux on IA-32 processors. Pricingis $495.00 USD. Cross development for Linux, from Windows, can be done if you alsoown a license for the Win32 native system.

Solaris/SunOS native (Solaris 8 on SPARC) supporting development for 32-bit Solaris/SunOSon SPARC processors. For pricing information, contact us via email. Cross developmentfor Solaris, from Windows, can be done if you also own a license for the Win32 nativesystem.

Shipping and handling additional. $5 within the USA, $10 International.
Email delivery at no change.
California residents include sales tax.


© Norman Black, Stony Brook Software. Reproduced with permission.