The Modula-3 Standard Library

The Modula-3 standard library libm3 offers a large number of interfaces and runs on several platforms (AIX386, ALPHA_OSF, AOSF, AP3000, ARM, DS3100, FreeBSD, HP300, HPPA, IBMR2, IBMRT, IRIX5, LINUX, NEXT, OKI, SEQUENT, SOLsun, SPARC, SUN3, SUN386, UMAX, VAX, WIN32). Most of these platforms are variants of Unix with nevertheless some small differences in their system calls. Some of them however differ more significantly; NEXT is based on the Mach operating system and Win32 is available on Windows NT and Windows95 from Microsoft. This way, Modula-3 programs may be compiled and run unmodified on a large number of platforms.

Standard libraries differ in their scope and extent, and in the underlying organization and philosophy brought by its architects. The Modula-3 library is rather extensive but follows the same guidelines as the Modula-3 language design, in particular striving for simplicity. For example, a small number of simple and general data structures are available: sequence, list and table. These offer all the functionality found in the dozen or so data structures often available in other libraries such as: stacks, queues, dequeues, priority queues, extensible vectors, sets, bags, dictionaries, lists, hash tables, balanced trees...

The standard interfaces section of the library supports TEXT elements, Threads, Integers, Reals and conversions between TEXT and Integers/Reals. The data structures section implements sequences (which subsume stacks, queues and extensible vectors), Atoms (an efficient representation for unique TEXT objects), Lists, Symbolic expressions (LISP like textual representations of lists useful for interacting with users), and Tables (which subsume sets, bags, dictionaries, hash tables and balanced trees). This section also implements Bundles, a convenient facility for incorporating files needed at run time (e.g. data files or user interface descriptions) into the executable file.

A section on input/output provides extensive facilities to open files or other devices. All the reading procedures operate on Readers and the writing procedures on Writers. A lot of flexibility is gained by the possibility of connecting Readers or Writers to files, other devices or even to TEXT objects.

The Operating System section handles the access to the system date and time, the files, the pipes and terminals, the file systems, the process creation facilities, the command line parameters and the environment variables.

The runtime section offers control over the garbage collector (weak references for finalization purposes, tuning parameters for performance), run time type information and heap usage statistics.

All the above mentioned interfaces are documented in the corresponding .i3 files as well as in the technical report Some Useful Modula-3 Interfaces. A number of additional interfaces are also available but are not discussed in the report being either too specialized, not platform independent or subject to change. Their documentation must be found directly in the .i3 files.


Copyright 1995 Michel Dagenais, dagenais@vlsi.polymtl.ca, Wed Mar 8 14:41:03 EST 1995