Standard M3 Libraries

January 15, 1996


Motivation

Every programming language has its library of basic data structures and algorithms and Modula-3 is no exception. We have noticed that these libraries emphasize correctness and safety at the expense of speed.

Overview

The libm3 library contains basic data structures such as lists, tables, sequences and atoms as well as procedures to implement formatted I/O and random number generation.

For SPIN, we have made standalone versions of these libararies which contain the standard library services that we need while omitting some that we don't need. These libraries are statically linked with the kernel and some of the standard library interfaces, such as Thread, are now implemented by SPIN kernel code.

The contents of libm3_sa

This list contains the subdirectories of the libm3_sa directory.
atom
"An Atom.T is a unique representative for a set of equal texts." In other words, the two TEXT's "alpha" and "alpha" may not be equal REF's, but the result of calling Atom.FromText() will be the same REF for both of them. This is useful if you have to test strings for equality many times. You just have to convert them to Atom.T's once and then compare the Atom.T's.

fmtlex
Fmt and Lex are interfaces for INTEGER's, Float's and BOOLEAN's into TEXT's and vice versa.

list
A generic list interface. AtomList's are instantiated.

random
A random number generator.

rw
Readers and writers are stream abstractions for getting and putting groups of characters.

sequence
A generic interface for an extensible sequence.

sort
This generic interface defines a procedure which will sort arrays of Elem.T's using QuickSort.

sortedtable
A sorted table is a table with its keys in sorted order.

table
A table is a mapping of keys to values. AtomAtomTbl's and TextRefTbl's are instantiated.

types
Some interfaces which permit CHAR, BOOLEAN, INTEGER and REFANY to be used as formal imports for generic interfaces. For example, Boolean.T is BOOLEAN and Char.Equal is just "=".


garrett@cs.washington.edu