% Copyright (C) 1989, Digital Equipment Corporation % All rights reserved. % See the file COPYRIGHT for a full description. % % Last modified on Sat Jul 21 01:13:48 1990 by muller % modified on Fri Nov 3 16:28:36 1989 by kalsow \newenvironment{interfaces}{\begin{center}\begin{tabular}{p{1in}p{5in}}}{ \end{tabular}\end{center}} \chapter{The libraries} %====================== \label{libs} \srcmodula includes a set of libraries, described in this chapter. It is intended that the interfaces within the library be complete and self documenting. The library {\tt foo} is in the file {\tt libs/foo/libm3foo.a}, and the interfaces that are implemented by this library are in the directory {\tt libs/foo}, where {\tt libs} is the directory in which the auxiliary \modula software has been installed (usually {\tt /usr/local/lib/m3}). Normally, the {\tt m3} driver knows about the location of the interfaces and archives. You just need to pass the {\tt -lm3foo} option to {\tt m3} to link with the library {\tt foo}. Also, the driver automatically links with the {\tt core} library as well as with the appropriate Unix library. See the {\tt m3} manual page for the full details. The key to making \modula successful requires designing, building and sharing libraries. You can send us useful modules or programs and we will include them in the next release as contributed software. You can also announce the availability of your work on the \srcmodula mailing list (see the previous chapter about this mailing list). Your system may have additional libraries; see chapter~\ref{local}. \section{The core library} %------------------------- The {\tt core} library contains some basic interfaces and modules. This library is always included when linking \modula programs, and the interfaces are accessible using the default path. Conversion of representation: \begin{interfaces} {\tt Convert} & Basic binary/ASCII conversion of numbers \\ {\tt Fmt} & Formatting to \verb|Text.T| \\ {\tt Scan} & Parsing from \verb|Text.T| \\ \end{interfaces} Input/output is achieved using readers and writers: \begin{interfaces} {\tt Rd} & Basic operations on readers \\ {\tt UnsafeRd} & Faster version for non-concurrent access \\ {\tt RdClass} & To implement new classes of readers \\ {\tt Wr} & Basic operations on writers \\ {\tt UnsafeWr} & Faster version for non-concurrent access \\ {\tt WrClass} & To implement new classes of writers \\ {\tt TextRd} & Readers that are connected to \verb|Text.T|s \\ {\tt TextWr} & Writers that are connected to \verb|Text.T|s \\ {\tt Stdio} & Readers and writers for standard files \\ {\tt FileStream} & Readers and writers connected to named files \\ {\tt UFileRdWr} & Readers and writers connected to file descriptors \end{interfaces} Fingerprints are built using polynomial arithmetic: \begin{interfaces} {\tt FPrint} & Compute the fingerprint of a \verb|Text.T| \\ {\tt PolyBasis} & support for {\tt FPrint} \\ {\tt Poly} & support for {\tt FPrint} \end{interfaces} The core library is poor on data structures: \begin{interfaces} {\tt List} & Lists of \verb|REFANY|s \\ {\tt IntTable} & Tables of \verb|INTEGER|s \end{interfaces} There is a set of interfaces that give access to the ANSI-C libraries. This collection is under construction. \begin{interfaces} {\tt M3toC} & support for \modula/C communication \\ {\tt Ctypes} & C-like names for types \\ {\tt Cstdarg} & obsolete \\ {\tt Cstdlib} & \verb|stdlib.h| \\ {\tt Cstring} & \verb|string.h| \end{interfaces} Finally, various interfaces, including the mandatory ones. \begin{interfaces} {\tt Main} & Main program interface \\ {\tt Text} & Character strings \\ {\tt TextF} & Reveals to our friends what a \verb|Text.T| is \\ {\tt Thread} & Control of concurrency \\ {\tt ThreadF} & Additional control for our friends \\ {\tt Time} & Time manipulation \\ {\tt Filename} & File names manipulation \\ {\tt Word} & Bits manipulation \end{interfaces} \section{The Unix libraries} %--------------------------- A set of interfaces giving access to the Unix system is under construction. Of course, these interfaces are not the same for all the supported architectures; there is actually one library for each version of Unix. However, these libraries contain the same interfaces that define (whenever possible) the same names. Thus, it should not be more difficult to port Modula-3 programs that use these interfaces than it is to port C programs. In general, an interface regroups the definitions given by a system include file and the related functions. Eventually, all of sections 2 and 3 should be available. The libraries are: \begin{center} \begin{tabular}{lp{4in}} {\tt ultrix-3.1} & Ultrix 3.1, seems to work for Ultrix 4.0, SunOS 4.0 and DomainOS 10.2\\ {\tt ibm-4.3} & IBM 4.3 (aka AOS 4.3)\\ {\tt aix-ps2-1.2} & AIX/PS2 1.2\\ {\tt aix-3.1} & AIX 3.1\\ \end{tabular} \end{center} Here are the interfaces implemented by these libraries: \begin{interfaces} {\tt Utypes} & Declarations of types name (\verb|sys/types.h|) \\ {\tt Uerror} & Declarations of error codes (\verb|errno.h|) \\ {\tt Uipc} & Inter-process communication (\verb|sys/ipc.h|) \\ {\tt Umsg} & Inter-process messages (\verb|sys/msg.h|) \\ {\tt Unetdb} & Network database manipulation (\verb|netdb.h|) \\ {\tt Uprocess} & Process ids\\ {\tt Uresource} & Resources utilization (\verb|sys/resource.h|) \\ {\tt Usem} & Semaphores (\verb|sys/sem.h|) \\ {\tt Ushm} & Shared memory (\verb|sys/shm.h|) \\ {\tt Usignal} & Signals (\verb|signal.h|) \\ {\tt Utime} & Time manipulation (\verb|sys/time.h|) \\ {\tt Uugid} & User and group ids\\ {\tt Uutmp} & Login names (\verb|utmp.h|) \\ {\tt Unix} & Other functions (not yet organized in separate interfaces) \end{interfaces} \section{The Posix library} %-------------------------- The library {\tt posix} contains umimplemented interfaces that constitute a proposal for a \modula binding of Posix. See the {\tt README} file for more details. \section{The input/output library} %-------------------------------- The library \verb|io| provides Additional mechanisms for input/output. \begin{interfaces} {\tt AutoFlushWr} & buffered writers that flush automatically \end{interfaces} \section{The data structures library} %------------------------------------ The library \verb|data| provides Additional data structures There is a set of interfaces to provide standard access to and operations on basic types: {\tt Char} {\tt Boolean}, {\tt Cardinal}, {\tt Integer}, {\tt Real}, {\tt LongReal}, {\tt Address}, {\tt Refany}, {\tt Root}, and {\tt Cast}. A first cut a richer data structures: \begin{interfaces} {\tt STable} & Sorted tables, implemented by 2-3-4 trees \\ {\tt SIntTable} & {\tt STable} applied to {\tt INTEGER} \\ {\tt STextTable} & {\tt STable} applied to \verb|Text.T| \end{interfaces} \section{Math} %------------- The library \verb|math| provides mathematically oriented types and functions. \begin{interfaces} {\tt Math} & sin, cos and friends \\ {\tt Point} & 2-D integral points \\ {\tt Interval} & Open integral intervals\\ {\tt Axis} & horizontal/vertical \\ {\tt Rect} & 2-D integral rectangles\\ {\tt Transform} & 2-D transformations \\ {\tt Stat} & statistics \end{interfaces} \section{Miscellaneous} %---------------------- \verb|misc| contains the things that don't fit elsewhere. \begin{interfaces} {\tt Random} & Random numbers\\ {\tt RandomPerm} \\ {\tt RandomReal} \\ {\tt UID} & Generate unique identifiers \\ {\tt ParseParams} & Parsing of UNIX-style command lines \\ {\tt ParseShell} & Lower level support \\ {\tt Formatter} & Formatting of text, for example for pretty-printers \\ \end{interfaces} \section{The X11R4 libraries} %---------------------------- There are three libraries that provide a complete interface to the X11R4 system. The library {\tt X11} implements the {\tt X} interface and provides Xlib-level functionalities. The library {\tt Xt} implements the interfaces {\tt Xt}, {\tt XtC}, {\tt XtE}, {\tt XtN}, {\tt XtR}, {\tt Xrm}, {\tt Xmu} and {\tt Xct} that provide access to the X Toolkit Intrinsics. The library {\tt Xaw} implements the Xaw interface that provides access to the Athena Widget set.