public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v4 1/19] modula2 front end: changes outside gcc/m2, libgm2 and gcc/testsuite.
@ 2022-12-10  0:48 Gaius Mulley
  2022-12-11 10:42 ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Gaius Mulley @ 2022-12-10  0:48 UTC (permalink / raw)
  To: gcc-patches


While writing the ChangeLog entries git gcc-verify spotted an oversight
with v3 of this patch set.  I had forgotten to post gm2.texi and also a
tiny patchlet in gcc/configure.ac (to detect Python).  HAVE_PYTHON is
used within gcc/m2/Make-lang.in to avoid generating the library section
included by gm2.texi should Python not be available.

ok to commit?  I've included gm2-lang.cc and lang.opt for reference.

regards,
Gaius




diff -ruw gcc-git-master/gcc/configure.ac gcc-git-devel-modula2/gcc/configure.ac
--- gcc-git-master/gcc/configure.ac	2022-12-07 20:16:24.571677189 +0000
+++ gcc-git-devel-modula2/gcc/configure.ac	2022-12-07 19:46:20.036302786 +0000
@@ -1263,6 +1263,10 @@
 # Bison?
 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])

+# Python3?
+AM_PATH_PYTHON(,, [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+
 # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
 # check for build == host before using them.

@@ -7651,4 +7655,3 @@
 ],
 [subdirs='$subdirs'])
 AC_OUTPUT
-
diff -ruw /dev/null gcc-git-devel-modula2/gcc/doc/gm2.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/doc/gm2.texi	2022-12-10 00:04:30.263603238 +0000
@@ -0,0 +1,2944 @@
+\input texinfo
+@c -*-texinfo-*-
+@c Copyright (C) 2001-2022 Free Software Foundation, Inc.
+@c This is part of the GM2 manual.
+
+@c User level documentation for GNU Modula-2
+@c
+@c header
+
+@setfilename gm2.info
+@settitle The GNU Modula-2 Compiler
+
+@set version-python  3.5
+
+@include gcc-common.texi
+
+@c Copyright years for this manual.
+@set copyrights-gm2 1999-2022
+
+@copying
+@c man begin COPYRIGHT
+Copyright @copyright{} @value{copyrights-gm2} Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+A copy of the license is included in the
+@c man end
+section entitled ``GNU Free Documentation License''.
+@ignore
+@c man begin COPYRIGHT
+man page gfdl(7).
+@c man end
+@end ignore
+@end copying
+
+@ifinfo
+@format
+@dircategory Software development
+@direntry
+* gm2: (gm2).               A GCC-based compiler for the Modula-2 language
+@end direntry
+@end format
+
+@insertcopying
+@end ifinfo
+
+@titlepage
+@title The GNU Modula-2 Compiler
+@versionsubtitle
+@author Gaius Mulley
+
+@page
+@vskip 0pt plus 1filll
+Published by the Free Software Foundation @*
+51 Franklin Street, Fifth Floor@*
+Boston, MA 02110-1301, USA@*
+@sp 1
+@insertcopying
+@end titlepage
+@contents
+@page
+
+@c `Top' Node and Master Menu
+
+@node Top, Overview, (dir), (dir)
+@top Introduction
+
+@menu
+* Overview::         What is GNU Modula-2.
+* Using::            Using GNU Modula-2.
+* Licence::          Licence of GNU Modula-2
+* Copying::          GNU Public Licence V3.
+* Contributing::     Contributing to GNU Modula-2
+* Internals::        GNU Modula-2 internals.
+* EBNF::             EBNF of GNU Modula-2
+* Libraries::        PIM and ISO library definitions.
+* Indices::          Document and function indices.
+@end menu
+
+@node Overview, Using, Top, Top
+@chapter Overview of GNU Modula-2
+
+@menu
+* What is GNU Modula-2::  Brief description of GNU Modula-2.
+* Why use GNU Modula-2::  Advantages of GNU Modula-2.
+* News::                  Latest news about GNU Modula-2.
+* Development::           How to get source code using git.
+* Obtaining::             Where to get the source code using git.
+* Features::              GNU Modula-2 Features
+@end menu
+
+@node What is GNU Modula-2, Why use GNU Modula-2, , Using
+@section What is GNU Modula-2
+
+GNU Modula-2 is a @uref{http://gcc.gnu.org/frontends.html, front end}
+for the GNU Compiler Collection (@uref{http://gcc.gnu.org/, GCC}).
+The GNU Modula-2 compiler is compliant with the PIM2, PIM3, PIM4 and
+ISO dialects.  Also implemented are a complete set of free ISO
+libraries and PIM libraries.
+
+@footnote{The four Modula-2 dialects supported are defined in the following
+references:
+
+PIM2: 'Programming in Modula-2', 2nd Edition, Springer Verlag, 1982,
+1983 by Niklaus Wirth (PIM2).
+
+PIM3: 'Programming in Modula-2', 3rd Corrected Edition, Springer Verlag,
+1985 (PIM3).
+
+PIM4: 'Programming in Modula-2', 4th Edition, Springer Verlag, 1988
+(@uref{http://freepages.modula2.org/report4/modula-2.html, PIM4}).
+
+ISO: the ISO Modula-2 language as defined in 'ISO/IEC Information
+technology - programming languages - part 1: Modula-2 Language,
+ISO/IEC 10514-1 (1996)'
+}
+
+@node Why use GNU Modula-2, Release map, What is GNU Modula-2, Using
+@section Why use GNU Modula-2
+
+There are a number of advantages of using GNU Modula-2 rather than
+translate an existing project into another language.
+
+The first advantage is of maintainability of the original sources
+and the ability to debug the original project source code using a
+combination of gm2 and gdb.
+
+The second advantage is that gcc runs on many processors and
+platforms.  gm2 builds and runs on powerpc64le, amd64, i386, aarch64
+to name but a few processors.
+
+The compiler provides semantic analysis and runtime checking (full ISO
+Modula-2 checking is implemented) and there is a plugin which can,
+under certain conditions, detect runtime errors at compile time.
+
+gm2 can produce swig interface headers to allow access from Python and
+other scripting languages.  The compiler supports PIM2, PIM3, PIM4 and
+ISO dialects of Modula-2, work is underway to implement M2R10.  Many
+of the GCC builtins are available and access to assembly programming
+is achieved using the same syntax as that used by GCC.
+
+@node Release map, News, Why use GNU Modula-2, Using
+@section Release map
+
+GNU Modula-2 is now part of GCC and therefore will adopt the GCC
+release schedule with a git branches matching the various GCC release
+numbers.  It is intended that GNU Modula-2 implement more of the GCC
+builtins (vararg access) and GCC features.
+
+There is an intention to implement the M2R10 dialect of Modula-2 and
+any of the language changes.  If you wish to see something different
+please email @email{gm2@@nongnu.org} with your ideas.
+
+@node News, Features, Release map, Using
+@section News
+
+@table @code
+
+@item gm2 release numbers
+are now superceded by gcc branch numbers as gm2
+is tracking the gcc release model.
+
+@item accuracy of error messages
+has been improved and offending subexpressions are now highlighted.
+
+@item new type checker
+has been implemented which will check
+all data types, including recursive procedure parameter types.
+
+@item libraries
+the gm2 driver program has been enhanced to allow third party
+libraries to be installed alongside gm2 libraries.  For example if the
+user specifies library @code{foo} using @code{-flibs=foo} the driver
+will check the standard GCC install directory for a subdirectory
+@code{foo}.
+
+@item libpth
+has been removed from gm2 and the coroutines are now implemented using
+the gcc portable threading library.
+
+@item libulm
+the Ulm libraries have been removed from the gm2 tree as they were not
+GPL3.
+
+@item Talk given at The GNU Tools Cauldron 2018
+here is a talk on GNU Modula-2 given at
+@url{https://gcc.gnu.org/wiki/cauldron2018,The GNU Tools Cauldron},
+Manchester on 8th September 2018.
+The title is, ``GNU Modula-2 update, catching semantic errors post
+code optimisation and improved debugging''
+[@url{https://splendidisolation.ddns.net/Papers/paper23/talk.pdf,slides}
+and @url{https://www.youtube.com/watch?v=6jf6weRuHjk,video}].
+
+@item gm2 1.8.2
+was released on Aug 30th 2018.  gm2-1.8.2 grafts onto gcc-8.2.0
+and contains integer overflow detection for addition, subtraction,
+negation and multiplication.  It also detects and traps when
+a floating point nan occurs.  This is the first release with the
+new semantic checking plugin which checks whether any exception
+will occur post optimization (see -fsoft-check-all).  The compiler
+also works well with the automake tools.
+
+@item gm2 1.2.0
+was released on May 11th 2017.  gm2-1.2.0 grafts onto gcc-5.2.0 and
+supports much better line number accuracy in debugging output.
+Source to code relationship can be further improved by the new option
+-fm2-g.  -fm2-whole-program also provides whole program optimization.
+@item Talk given at The GNU Tools Cauldron 2016
+here is a talk on GNU Modula-2 given at
+@url{https://gcc.gnu.org/wiki/cauldron2016,The GNU Tools Cauldron},
+Hebden Bridge on 9th September 2016.
+The title is, ``GNU Modula-2 status, whole
+program optimisation and language interoperability''
+[@url{https://splendidisolation.ddns.net/Papers/paper22/talk.pdf,slides}
+and @url{https://www.youtube.com/watch?v=8GMyxwHdr1E,video}].
+@item gm2 1.1.6
+was released on February 22nd 2016.  gm2-1.1.6 grafts onto gcc-4.7.4.
+@item gm2 1.1.5
+was released on September 3 2015, passes all regression tests and has
+many bug fixes applied.  Arrays and Records can be assigned to and from
+WORD, LOC, BYTE providing sizes permit.  Also a small number of fixes
+to the library module MemStream.mod.  Fixed a number of bugs shown by
+valgrind.
+@item gm2 1.1.3
+was released on April 15 2015.  gm2-1.1.3 passes all regression
+tests on Debian Wheezy (x86_64) and (i686).  Also passes all regression tests
+under Debian Jessie (x86_64).  It also builds on armv7l Ubuntu Trusty Tahr.
+@item gm2 1.1.1
+was released on January 26 2015.  gm2-1.1.1 passes all regression
+tests on Debian Wheezy (x86_64) and (i686).  Also passes all regression tests
+under Debian Jessie (x86_64).
+@item gm2 1.1.0
+was released on January 02 2015.  gm2-1.1.0 passes all regression
+tests on Debian Wheezy (x86_64) and (i686).
+@item gm2 1.0.9
+Beta was released on September 23 2014, all regressions passed on
+x86_64 Debian Wheezy.
+@item gm2 1.0.4
+was released on September 30 2011.  This is a bug fix release.
+@item gm2 1.0
+was released on December 11 2010.
+@end table
+
+@node Development, Obtaining, News, Using
+@section How to get source code using git
+
+GNU Modula-2 is in the process of migrating into the
+@url{https://gcc.gnu.org/git.html, GCC git tree}.  The development
+branch is available via git:
+
+@example
+$ git clone git://gcc.gnu.org/git/gcc.git gcc-git-devel-modula2
+$ cd gcc-git-devel-modula2
+$ git checkout devel/modula-2
+$ cd ..
+@end example
+
+@node Obtaining, Features, Development, Using
+
+GNU Modula-2 is in the process of migrating into the
+@url{https://gcc.gnu.org/git.html, GCC git tree}.
+@xref{Development, , ,gm2} section in this GM2 documentation for git
+details and @xref{Downloading the source, , ,gcc} in the GCC
+documentation.
+
+@node Features, Documentation, News, Using
+@section GNU Modula-2 Features
+
+@itemize @bullet
+
+@item
+the compiler currently complies with Programming in Modula-2 Edition
+2, 3, 4 and ISO Modula-2.  Users can switch on specific language
+features by using: @samp{-fpim}, @samp{-fpim2}, @samp{-fpim3},
+@samp{-fpim4} or @samp{-fiso}.
+
+@item
+the option @samp{-fswig} will automatically create a swig interface
+file which corresponds to the definition module of the file being
+compiled.
+
+@item
+exception handling is compatible with C++ and swig.  Modula-2 code can
+be used with C or C++ code.
+
+@item
+Python can call GNU Modula-2 modules via swig.
+
+@item
+shared libraries can be built.
+
+@item
+fixed sized types are now available from @samp{SYSTEM}.
+
+@item
+support for dynamic @code{ARRAY}s has been added into @samp{gdb}.
+
+@item
+variables can be declared at addresses.
+
+@item
+much better dwarf-2 debugging support and when used with
+@samp{gdb} the programmer can display @code{RECORD}s,
+@code{ARRAY}s, @code{SET}s, subranges and constant char literals
+in Modula-2 syntax.
+
+@item
+supports sets of any ordinal size (memory permitting).
+
+@item
+easy interface to C, and varargs can be passed to C routines.
+
+@item
+many Logitech libraries have been implemented and can be accessed via:
+@samp{-flibs=m2log,m2pim,m2iso}.
+
+@item
+coroutines have been implemented in the PIM style and these are
+accessible from SYSTEM. A number of supporting libraries (executive
+and file descriptor mapping to interrupt vector libraries are
+available through the @samp{-flibs=m2iso,m2pim} switch).
+
+@item
+can be built as a cross compiler (for embedded microprocessors
+such as the AVR and the ARM).
+
+@end itemize
+
+@node Documentation, Regression tests, Features, Using
+@section Documentation
+
+The GNU Modula-2 documentation is available on line
+@url{https://www.nongnu.org/gm2/homepage.html,at the gm2 homepage}
+or in the pdf, info, html file format.
+
+@node Regression tests, Limitations, Documentation, Using
+@section Regression tests for gm2 in the repository
+
+The regression testsuite can be run from the gcc build directory:
+
+@example
+$ cd build-gcc
+$ make check -j 24
+@end example
+
+which runs the complete testsuite for all compilers using 24 parallel
+invocations of the compiler.  Individual language testsuites can be
+run by specifying the language, for example the Modula-2 testsuite can
+be run using:
+
+@example
+$ cd build-gcc
+$ make check-m2 -j 24
+@end example
+
+Finally the results of the testsuite can be emailed to the
+@url{https://gcc.gnu.org/lists.html, gcc-testresults} list using the
+script:
+
+@example
+$ @file{gccsrcdir/contrib/test_summary}
+@end example
+
+@node Limitations, Objectives, Regression tests, Using
+@section Limitations
+
+Logitech compatibility library is incomplete.  The principle modules
+for this platform exist however for a comprehensive list of completed
+modules please check the documentation
+@url{gm2.html}.
+
+@node Objectives, FAQ, , Using
+@section Objectives
+
+@itemize @bullet
+
+@item
+The intention of GNU Modula-2 is to provide a production Modula-2
+front end to GCC.
+
+@item
+It should support all Niklaus Wirth PIM Dialects [234] and also ISO
+Modula-2 including a reimplementation of all the ISO modules.
+
+@item
+There should be an easy interface to C.
+
+@item
+Exploit the features of GCC.
+
+@item
+Listen to the requests of the users.
+@end itemize
+
+@node FAQ, Community, Objectives, Using
+@section FAQ
+
+@subsection Why use the C++ exception mechanism in GCC, rather than a bespoke Modula-2 mechanism?
+
+The C++ mechanism is tried and tested, it also provides GNU Modula-2
+with the ability to link with C++ modules and via swig it can raise
+Python exceptions.
+
+@node Community, Other languages, FAQ, Using
+@section Community
+
+You can subscribe to the GNU Modula-2 mailing by sending an
+email to:
+@email{gm2-subscribe@@nongnu.org}
+or by
+@url{http://lists.nongnu.org/mailman/listinfo/gm2}.
+The mailing list contents can be viewed
+@url{http://lists.gnu.org/archive/html/gm2}.
+
+@node Other languages, , Community, Using
+@section Other languages for GCC
+
+These exist and can be found on the frontends web page on the
+@uref{http://gcc.gnu.org/frontends.html, gcc web site}.
+
+@node Using, , Community, Top
+@chapter Using GNU Modula-2
+
+@menu
+* Example usage::         Example compile and link.
+* Compiler options::      GNU Modula-2 compiler options.
+* Linking::               Linking options in more detail.
+* Elementary data types:: Data types supported by GNU Modula-2.
+* Standard procedures::   Permanently accessible base procedures.
+* Dialect::               GNU Modula-2 supported dialects.
+* Exceptions::            Exception implementation
+* Semantic checking::     How to detect runtime problems at compile time.
+* Extensions::            GNU Modula-2 language extensions.
+* Type compatibility::    Data type compatibility.
+* Unbounded by reference::Explanation of a language optimization.
+* Building a shared library:: How to build a shared library.
+* Interface for Python::  How to produce swig interface files.
+* Producing a Python module::  How to produce a Python module.
+* Interface to C::        Interfacing GNU Modula-2 to C.
+* Assembly language::     Interface to assembly language.
+* Alignment::             Data type alignment.
+* Packed::                Packing data types.
+* Built-ins::             Accessing GNU Modula-2 Built-ins.
+* The PIM system module:: SYSTEM data types and procedures.
+* The ISO system module:: SYSTEM data types, procedures and run time.
+* Other languages::       Other languages for GCC.
+* What is GNU Modula-2::  Brief description of GNU Modula-2.
+* Why use GNU Modula-2::  Advantages of GNU Modula-2.
+@ifnothtml
+@c omit these nodes if generating gm2 webpage as these are hand written.
+* Release map:: Release map.
+* News:: News.
+* Development:: Development.
+* Obtaining:: How to Obtain GNU Modula-2.
+* Features:: Features of the implementation.
+* Documentation:: Placeholder for how to access the documentation online.
+* Regression tests:: How to run the testsuite.
+* Limitations:: Current limitations.
+* Objectives:: Objectives of the implementation.
+* FAQ:: Frequently asked questions.
+* Community:: How to join the community.
+@end ifnothtml
+@end menu
+
+This document contains the user and design issues relevant to the
+Modula-2 front end to gcc.
+
+@node Example usage, Compiler options, Using, Using
+@section Example compile and link
+
+@ignore
+@c man begin SYNOPSIS gm2
+gm2 [@option{-c}|@option{-S}] [@option{-g}] [@option{-pg}]
+    [@option{-O}@var{level}] [@option{-W}@var{warn}@dots{}]
+    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
+    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
+    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
+
+Only the most useful options are listed here; see below for the
+remainder.
+@c man end
+@c man begin SEEALSO
+gpl(7), gfdl(7), fsf-funding(7), gcc(1)
+and the Info entries for @file{gm2} and @file{gcc}.
+@c man end
+@end ignore
+
+@c man begin DESCRIPTION gm2
+
+The @command{gm2} command is the GNU compiler for the Modula-2 language and
+supports many of the same options as @command{gcc}.  @xref{Option Summary, ,
+Option Summary, gcc, Using the GNU Compiler Collection (GCC)}.
+This manual only documents the options specific to @command{gm2}.
+
+@c man end
+
+This section describes how to compile and link a simple hello world
+program.  It provides a few examples of using the different options
+mentioned in @pxref{Compiler options, , ,gm2}.  Assuming that you have
+a file called @file{hello.mod} in your current directory which
+contains:
+
+@example
+MODULE hello ;
+
+FROM StrIO IMPORT WriteString, WriteLn ;
+
+BEGIN
+   WriteString('hello world') ; WriteLn
+END hello.
+@end example
+
+You can compile and link it by: @samp{gm2 -g hello.mod}.
+The result will be an @samp{a.out} file created in your directory.
+
+You can split this command into two steps if you prefer.  The compile
+step can be achieved by: @samp{gm2 -g -c -fscaffold-main hello.mod}
+and the link via: @samp{gm2 -g hello.o}.
+
+@footnote{To see all the compile actions taken by @samp{gm2} users can also
+add the @samp{-v} flag at the command line, for example:
+
+@samp{gm2 -v -g -I. hello.mod}
+
+This displays the subprocesses initiated by @samp{gm2} which can be useful
+when trouble shooting.}
+
+@node Compiler options, Elementary data types, Example usage, Using
+@section Compiler options
+
+This section describes the compiler options specific to GNU Modula-2
+for generic flags details @xref{Invoking GCC, , ,gcc}.
+
+@c man begin OPTIONS
+
+For any given input file, the file name suffix determines what kind of
+compilation is done.  The following kinds of input file names are supported:
+
+@table @gcctabopt
+@item @var{file}.mod
+Modula-2 implementation or program source files.  See the
+@samp{-fmod=} option if you wish to compile a project which uses a
+different source file extension.
+@item @var{file}.def
+Modula-2 definition module source files.  Definition modules are not
+compiled separately, in GNU Modula-2 definition modules are parsed as
+required when program or implementation modules are compiled.  See the
+@samp{-fdef=} option if you wish to compile a project which uses a
+different source file extension.
+@end table
+
+You can specify more than one input file on the @command{gm2} command line,
+
+@table @code
+
+@item -g
+create debugging information so that debuggers such as @file{gdb}
+can inspect and control executables.
+
+@item -I
+used to specify the search path for definition and implementation
+modules.  An example is:  @code{gm2 -g -c -I.:../../libs foo.mod}.
+If this option is not specified then the default path is added
+which consists of the current directory followed by the appropriate
+language dialect library directories.
+
+@c ordered list of options from here.
+
+@item -fauto-init
+turns on auto initialization of pointers to NIL.  Whenever a block is
+created all pointers declarated within this scope will have their
+addresses assigned to NIL.
+
+@item -fbounds
+turns on runtime subrange, array index and indirection via @code{NIL}
+pointer checking.
+
+@item -fcase
+turns on compile time checking to check whether a @code{CASE}
+statement requires an @code{ELSE} clause when on was not specified.
+
+@item -fcpp
+preprocess the source with @samp{cpp -lang-asm -traditional-cpp}
+For further details about these options @xref{Invocation, , ,cpp}.
+If @samp{-fcpp} is supplied then all definition modules and
+implementation modules which are parsed will be preprocessed by
+@samp{cpp}.
+
+@c fcpp-end
+@c Modula-2
+@c passed to the preprocessor if -fcpp is used (internal switch)
+
+@c fcpp-begin
+@c Modula-2
+@c passed to the preprocessor if -fcpp is used (internal switch)
+
+@item -fdebug-builtins
+call a real function, rather than the builtin equivalent.  This can
+be useful for debugging parameter values to a builtin function as
+it allows users to single step code into a real function.
+
+@c fd
+@c Modula-2
+@c turn on internal debugging of the compiler (internal switch)
+
+@c fdebug-trace-quad
+@c Modula-2
+@c turn on quadruple tracing (internal switch)
+
+@c fdebug-trace-api
+@c Modula-2
+@c turn on the Modula-2 api tracing (internal switch)
+
+@c fdebug-function-line-numbers
+@c Modula-2
+@c turn on the Modula-2 function line number generation (internal switch)
+
+@item -fdef=
+recognise the specified suffix as a definition module filename.
+The default implmentation and module filename suffix is @file{.def}.
+If this option is used GNU Modula-2 will still fall back to this
+default if a requested definition module is not found.
+
+@item -fdump-system-exports
+display all inbuilt system items.
+This is an internal command line option.
+
+@item -fexceptions
+turn on exception handling code.  By default this option is on.
+Exception handling can be disabled by @samp{-fno-exceptions}
+and no references are made to the runtime exception libraries.
+
+@item -fextended-opaque
+allows opaque types to be implemented as any type. This is a GNU
+Modula-2 extension and it requires that the implementation module
+defining the opaque type is available so that it can be resolved when
+compiling the module which imports the opaque type.
+
+@item -ffloatvalue
+turns on runtime checking to check whether a floating point number is
+about to exceed range.
+
+@item -fgen-module-list=@file{filename}
+attempt to find all modules when linking and generate a module list.
+If the @file{filename} is @samp{-} then the contents are not written
+and only used to force the linking of all module ctors.
+This option cannot be used if @samp{-fuse-list=} is enabled.
+
+@item -findex
+generate code to check whether array index values are out of bounds.
+Array index checking can be disabled via @samp{-fno-index}.
+
+@item -fiso
+turn on ISO standard features. Currently this enables the ISO
+@code{SYSTEM} module and alters the default library search path so
+that the ISO libraries are searched before the PIM libraries.  It also
+effects the behaviour of @code{DIV} and @code{MOD} operators.
+@xref{Dialect, , ,gm2}.
+
+@item -flibs=
+modifies the default library search path.  The libraries supplied are:
+m2pim, m2iso, m2min, m2log and m2cor.  These map onto the
+Programming in Modula-2 base libraries, ISO standard libraries, minimal
+library support, Logitech compatible library and Programming in
+Modula-2 with coroutines.
+Multiple libraries can be specified and are comma separated with precidence
+going to the first in the list.  It is not necessary to use -flibs=m2pim or
+-flibs=m2iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or
+-fiso.  Unless you are using -flibs=m2min you should include m2pim as
+the they provide the base modules which all other dialects utilize.
+The option @samp{-fno-libs=-} disables the @samp{gm2} driver from
+modifying the search and library paths.
+
+@c flocation=
+@c Modula-2 Joined
+@c set all location values to a specific value (internal switch)
+
+@item -fm2-g
+improve the debugging experience for new programmers at the expense
+of generating @code{nop} instructions if necessary to ensure single
+stepping precision over all code related keywords.  An example
+of this is in termination of a list of nested @code{IF} statements
+where multiple @code{END} keywords are mapped onto a sequence of
+@code{nop} instructions.
+
+@item -fm2-lower-case
+render keywords in error messages using lower case.
+
+@item -fm2-plugin
+insert plugin to identify runtime errors at compiletime (default on).
+
+@item -fm2-statistics
+generates quadruple information: number of quadruples generated,
+number of quadruples remaining after optimisation and number of source
+lines compiled.
+
+@item -fm2-strict-type
+experimental flag to turn on the new strict type checker.
+
+@item -fm2-whole-program
+compile all implementation modules and program module at once.  Notice
+that you need to take care if you are compiling different dialect
+modules (particularly with the negative operands to modulus).  But
+this option, when coupled together with @code{-O3}, can deliver huge
+performance improvements.
+
+@item -fmod=
+recognise the specified suffix as implementation and module filenames.
+The default implmentation and module filename suffix is @file{.mod}.
+If this option is used GNU Modula-2 will still fall back to this
+default if it needs to read an implmentation module and the specified
+suffixed filename does not exist.
+
+@item -fnil
+generate code to detect accessing data through a @code{NIL} value
+pointer.  Dereferencing checking through a @code{NIL} pointer can be
+disabled by @samp{-fno-nil}.
+
+@item -fpim
+turn on PIM standard features. Currently this enables the PIM
+@code{SYSTEM} module and determines which identifiers are pervasive
+(declared in the base module). If no other @samp{-fpim[234]} switch is
+used then division and modulus operators behave as defined in PIM4.
+@xref{Dialect, , ,gm2}.
+
+@item -fpim2
+turn on PIM-2 standard features. Currently this removes @code{SIZE}
+from being a pervasive identifier (declared in the base module).  It
+places @code{SIZE} in the @code{SYSTEM} module.  It also effects the
+behaviour of @code{DIV} and @code{MOD} operators.
+@xref{Dialect, , ,gm2}.
+
+@item -fpim3
+turn on PIM-3 standard features. Currently this only effects the
+behaviour of @code{DIV} and @code{MOD} operators.
+@xref{Dialect, , ,gm2}.
+
+@item -fpim4
+turn on PIM-4 standard features. Currently this only effects the
+behaviour of @code{DIV} and @code{MOD} operators.
+@xref{Dialect, , ,gm2}.
+
+@item -fpositive-mod-floor-div
+forces the @code{DIV} and @code{MOD} operators to behave as defined by PIM4.
+All modulus results are positive and the results from the division are
+rounded to the floor.
+@xref{Dialect, , ,gm2}.
+
+@item -fpthread
+link against the pthread library.  By default this option is on.  It
+can be disabled by @samp{-fno-pthread}.  GNU Modula-2 uses the GCC
+pthread libraries to implement coroutines (see the SYSTEM
+implementation module).
+
+@c -fq
+@c -Modula-2
+@c -internal compiler debugging information, dump the list of quadruples
+
+@item -frange
+generate code to check the assignment range, return value range
+set range and constructor range.  Range checking can be disabled
+via @samp{-fno-range}.
+
+@item -freturn
+generate code to check that functions always exit with a @code{RETURN}
+and do not fall out at the end.  Return checking can be disabled
+via @samp{-fno-return}.
+
+@item -fruntime-modules=
+specify, using a comma separated list, the runtime modules and their
+order.  These modules will initialized first before any other modules
+in the application dependency.  By default the runtime modules list is
+set to @code{Storage,SYSTEM,M2RTS,RTExceptions,IOLink}.  Note that
+these modules will only be linked into your executable if they are
+required.  So adding a long list of dependant modules will not effect
+the size of the executable it merely states the initialization order
+should they be required.
+
+@item -fscaffold-dynamic
+the option ensures that @samp{gm2} will generate a dynamic scaffold
+infastructure when compiling implementation and program modules.
+By default this option is on.  Use @samp{-fno-scaffold-dynamic}
+to turn it off or select @samp{-fno-scaffold-static}.
+
+@item -fscaffold-c
+generate a C source scaffold for the current module being compiled.
+
+@item -fscaffold-c++
+generate a C++ source scaffold for the current module being compiled.
+
+@item -fscaffold-main
+force the generation of the @samp{main} function.  This is not
+necessary if the @samp{-c} is omitted.
+
+@item -fscaffold-static
+the option ensures that @samp{gm2} will generate a static scaffold
+within the program module.  The static scaffold consists of sequences
+of calls to all dependent module initialization and finalialization
+procedures.  The static scaffold is useful for debugging and single
+stepping the initialization blocks of implementation modules.
+
+@item -fshared
+generate a shared library from the module.
+
+@item -fsoft-check-all
+turns on all runtime checks.  This is the same as invoking
+GNU Modula-2 using the command options
+@code{-fnil} @code{-frange} @code{-findex}
+@code{-fwholevalue}
+@code{-fwholediv} @code{-fcase} @code{-freturn}.
+
+@item -fsources
+displays the path to the source of each module.  This option
+can be used at compile time to check the correct definition module
+is being used.
+
+@item -fswig
+generate a swig interface file.
+
+@item -funbounded-by-reference
+enable optimization of unbounded parameters by attempting to pass non
+@code{VAR} unbounded parameters by reference.  This optimization
+avoids the implicit copy inside the callee procedure. GNU Modula-2
+will only allow unbounded parameters to be passed by reference if,
+inside the callee procedure, they are not written to, no address is
+calculated on the array and it is not passed as a @code{VAR}
+parameter.  Note that it is possible to write code to break this
+optimization, therefore this option should be used carefully.
+For example it would be possible to take the address of an array, pass
+the address and the array to a procedure, read from the array in
+the procedure and write to the location using the address parameter.
+
+Due to the dangerous nature of this option it is not enabled
+when the @samp{-O} option is specified.
+
+@item -fuse-list=@file{filename}
+if @samp{-fscaffold-static} is enabled then use the file
+@file{filename} for the initialization order of modules.  Whereas if
+@samp{-fscaffold-dynamic} is enabled then use this file to force
+linking of all module ctors.
+This option cannot be used if @samp{-fgen-module-list=} is enabled.
+
+@item -fwholediv
+generate code to detect whole number division by zero or modulus by
+zero.
+
+@item -fwholevalue
+generate code to detect whole number overflow and underflow.
+
+@c the following warning options are complete but need to be
+@c regression tested against all other front ends
+@c to ensure the options do not conflict.
+
+@c @item -Wall
+@c turn on all Modula-2 warnings.
+
+@c @item -Wpedantic
+@c forces the compiler to reject nested @code{WITH} statements
+@c referencing the same record type.  Does not allow multiple imports of
+@c the same item from a module.  It also checks that: procedure variables
+@c are written to before being read; variables are not only written to
+@c but read from; variables are declared and used.  If the compiler
+@c encounters a variable being read before written it will terminate with
+@c a message.  It will check that @code{FOR} loop indices are not used
+@c outside the end of this loop without being reset.
+
+@c @item -Wpedantic-cast
+@c warns if the ISO system function is used and if the size of
+@c the variable is different from that of the type.  This is legal
+@c in ISO Modula-2, however it can be dangerous.  Some users may prefer
+@c to use @code{VAL} instead in these situations and use @code{CAST}
+@c exclusively for changes in type on objects which have the same size.
+
+@c @item -Wpedantic-param-names
+@c procedure parameter names are checked in the definition module
+@c against their implementation module counterpart.  This is not
+@c necessary in ISO or PIM versions of Modula-2.
+
+@c @item -Wstyle
+@c checks for poor programming style.  This option is aimed at new users of
+@c Modula-2 in that it checks for situations which might cause confusion
+@c and thus mistakes.  It checks whether variables of the same name are
+@c declared in different scopes and whether variables look like keywords.
+@c Experienced users might find this option too aggressive.
+
+@c @item -Wunused-variable
+@c warns if a variable has been declared and it not used.
+
+@c @item -Wunused-parameter
+@c warns if a parameter has been declared and it not used.
+
+@c @item -Wverbose-unbounded
+@c inform the user which non @code{VAR} unbounded parameters will be
+@c passed by reference.  This only produces output if the option
+@c @samp{-funbounded-by-reference} is also supplied on the command line.
+
+@end table
+
+@c man end
+
+@node Elementary data types, Standard procedures, Compiler options, Using
+@section Elementary data types
+
+This section describes the elementary data types supported by GNU
+Modula-2. It also describes the relationship between these data types
+and the equivalent C data types.
+
+The following data types are supported: @code{INTEGER},
+@code{LONGINT}, @code{SHORTINT}, @code{CARDINAL}, @code{LONGCARD},
+@code{SHORTCARD}, @code{BOOLEAN}, @code{REAL}, @code{LONGREAL},
+@code{SHORTREAL}, @code{COMPLEX}, @code{LONGCOMPLEX},
+@code{SHORTCOMPLEX} and @code{CHAR}.
+
+An equivalence table is given below:
+
+@example
+GNU Modula-2              GNU C
+======================================
+INTEGER                   int
+LONGINT                   long long int
+SHORTINT                  short int
+CARDINAL                  unsigned int
+LONGCARD                  long long unsigned int
+SHORTCARD                 short unsigned int
+BOOLEAN                   int
+REAL                      double
+LONGREAL                  long double
+SHORTREAL                 float
+CHAR                      char
+SHORTCOMPLEX              complex float
+COMPLEX                   complex double
+LONGCOMPLEX               complex long double
+@end example
+
+Note that GNU Modula-2 also supports fixed sized data types which are
+exported from the @code{SYSTEM} module.
+@xref{The PIM system module, , ,gm2}.
+@xref{The ISO system module, , ,gm2}.
+
+@node Standard procedures, Dialect, Elementary data types, Using
+@section Permanently accessible base procedures.
+
+This section describes the procedures and functions which are
+always visible.
+
+@subsection Standard procedures and functions common to PIM and ISO
+
+The following procedures are implemented and conform with Programming
+in Modula-2 and ISO Modula-2: @code{NEW}, @code{DISPOSE}, @code{INC},
+@code{DEC}, @code{INCL}, @code{EXCL} and @code{HALT}.  The standard
+functions are: @code{ABS}, @code{CAP}, @code{CHR}, @code{FLOAT},
+@code{HIGH}, @code{LFLOAT}, @code{LTRUNC}, @code{MIN}, @code{MAX},
+@code{ODD}, @code{SFLOAT}, @code{STRUNC} @code{TRUNC} and
+@code{VAL}. All these functions and procedures (except @code{HALT},
+@code{NEW}, @code{DISPOSE} and, under non constant conditions,
+@code{LENGTH}) generate in-line code for efficiency.
+
+@example
+
+(*
+   ABS - returns the positive value of i.
+*)
+
+@findex ABS
+PROCEDURE ABS (i: <any signed type>) : <any signed type> ;
+
+@end example
+
+@example
+
+(*
+   CAP - returns the capital of character ch providing
+         ch lies within the range 'a'..'z'. Otherwise ch
+         is returned unaltered.
+*)
+
+@findex CAP
+PROCEDURE CAP (ch: CHAR) : CHAR ;
+
+@end example
+
+@example
+
+(*
+   CHR - converts a value of a <whole number type> into a CHAR.
+         CHR(x) is shorthand for VAL(CHAR, x).
+*)
+
+@findex CHR
+PROCEDURE CHR (x: <whole number type>) : CHAR ;
+
+@end example
+
+@example
+
+(*
+   DISPOSE - the procedure DISPOSE is replaced by:
+             DEALLOCATE(p, TSIZE(p^)) ;
+             The user is expected to import the procedure DEALLOCATE
+             (normally found in the module, Storage.)
+
+             In:  a variable p: of any pointer type which has been
+                  initialized by a call to NEW.
+             Out: the area of memory
+                  holding p^ is returned to the system.
+                  Note that the underlying procedure DEALLOCATE
+                  procedure in module Storage will assign p to NIL.
+*)
+
+@findex DISPOSE
+PROCEDURE DISPOSE (VAR p:<any pointer type>) ;
+@end example
+
+@example
+
+(*
+   DEC - can either take one or two parameters.  If supplied
+         with one parameter then on the completion of the call to
+         DEC, v will have its predecessor value.  If two
+         parameters are supplied then the value v will have its
+         n'th predecessor.  For these reasons the value of n
+         must be >=0.
+*)
+
+@findex DEC
+PROCEDURE DEC (VAR v: <any base type>; [n: <any base type> = 1]) ;
+@end example
+
+@example
+
+(*
+   EXCL - excludes bit element e from a set type s.
+*)
+
+@findex EXCL
+PROCEDURE EXCL (VAR s: <any set type>; e: <element of set type s>) ;
+@end example
+
+@example
+
+(*
+   FLOAT - will return a REAL number whose value is the same as o.
+*)
+
+@findex FLOAT
+PROCEDURE FLOAT (o: <any whole number type>) : REAL ;
+@end example
+
+@example
+
+(*
+   FLOATS - will return a SHORTREAL number whose value is the same as o.
+*)
+
+@findex FLOATS
+PROCEDURE FLOATS (o: <any whole number type>) : REAL ;
+@end example
+
+@example
+
+(*
+   FLOATL - will return a LONGREAL number whose value is the same as o.
+*)
+
+@findex FLOATL
+PROCEDURE FLOATL (o: <any whole number type>) : REAL ;
+@end example
+
+@example
+
+(*
+   HALT - will call the HALT procedure inside the module M2RTS.
+          Users can replace M2RTS.
+*)
+
+@findex HALT
+PROCEDURE HALT ;
+@end example
+
+@example
+
+(*
+   HIGH - returns the last accessible index of an parameter declared as
+          ARRAY OF CHAR. Thus
+
+          PROCEDURE foo (a: ARRAY OF CHAR) ;
+          VAR
+             c: CARDINAL ;
+          BEGIN
+             c := HIGH(a)
+          END foo ;
+
+          BEGIN
+             foo('hello')
+          END
+
+          will cause the local variable c to contain the value 4
+*)
+
+@findex HIGH
+PROCEDURE HIGH (a: ARRAY OF CHAR) : CARDINAL ;
+@end example
+
+@example
+
+(*
+   INC - can either take one or two parameters.  If supplied
+         with one parameter then on the completion of the call to
+         INC, v will have its successor value.  If two
+         parameters are supplied then the value v will have its
+         n'th successor.  For these reasons the value of n
+         must be >=0.
+*)
+
+@findex INC
+PROCEDURE INC (VAR v: <any base type>; [n: <any base type> = 1]) ;
+@end example
+
+@example
+
+(*
+   INCL - includes bit element e to a set type s.
+*)
+
+@findex INCL
+PROCEDURE INCL (VAR s: <any set type>; e: <element of set type s>) ;
+@end example
+
+@example
+
+(*
+   LFLOAT - will return a LONGREAL number whose value is the same as o.
+*)
+
+@findex LFLOAT
+PROCEDURE LFLOAT (o: <any whole number type>) : LONGREAL ;
+@end example
+
+@example
+
+(*
+   LTRUNC - will return a LONG<type> number whose value is the
+            same as o.  PIM2, PIM3 and ISO Modula-2 will return
+            a LONGCARD whereas PIM4 returns LONGINT.
+*)
+
+@findex LTRUNC
+PROCEDURE LTRUNC (o: <any floating point type>) : LONG<type> ;
+@end example
+
+@example
+
+(*
+   MIN - returns the lowest legal value of an ordinal type.
+*)
+
+@findex MIN
+PROCEDURE MIN (t: <ordinal type>) : <ordinal type> ;
+
+@end example
+
+@example
+
+(*
+   MAX - returns the largest legal value of an ordinal type.
+*)
+
+@findex MAX
+PROCEDURE MAX (t: <ordinal type>) : <ordinal type> ;
+
+@end example
+
+@example
+
+(*
+   NEW - the procedure NEW is replaced by:
+         ALLOCATE(p, TSIZE(p^)) ;
+         The user is expected to import the procedure ALLOCATE
+         (normally found in the module, Storage.)
+
+         In:  a variable p: of any pointer type.
+         Out: variable p is set to some allocated memory
+              which is large enough to hold all the contents of p^.
+*)
+
+@findex NEW
+PROCEDURE NEW (VAR p:<any pointer type>) ;
+@end example
+
+@example
+
+(*
+   ODD - returns TRUE if the value is not divisible by 2.
+*)
+
+@findex ODD
+PROCEDURE ODD (x: <whole number type>) : BOOLEAN ;
+
+@end example
+
+@example
+
+(*
+   SFLOAT - will return a SHORTREAL number whose value is the same
+            as o.
+*)
+
+@findex SFLOAT
+PROCEDURE SFLOAT (o: <any whole number type>) : SHORTREAL ;
+@end example
+
+@example
+
+(*
+   STRUNC - will return a SHORT<type> number whose value is the same
+            as o.  PIM2, PIM3 and ISO Modula-2 will return a
+            SHORTCARD whereas PIM4 returns SHORTINT.
+*)
+
+@findex STRUNC
+PROCEDURE STRUNC (o: <any floating point type>) : SHORT<type> ;
+@end example
+
+@example
+
+(*
+   TRUNC - will return a <type> number whose value is the same as o.
+           PIM2, PIM3 and ISO Modula-2 will return a CARDINAL
+           whereas PIM4 returns INTEGER.
+*)
+
+@findex TRUNC
+PROCEDURE TRUNC (o: <any floating point type>) : <type> ;
+@end example
+
+@example
+
+(*
+   TRUNCS - will return a <type> number whose value is the same
+            as o.  PIM2, PIM3 and ISO Modula-2 will return a
+            SHORTCARD whereas PIM4 returns SHORTINT.
+*)
+
+@findex TRUNCS
+PROCEDURE TRUNCS (o: <any floating point type>) : <type> ;
+@end example
+
+@example
+
+(*
+   TRUNCL - will return a <type> number whose value is the same
+            as o.  PIM2, PIM3 and ISO Modula-2 will return a
+            LONGCARD whereas PIM4 returns LONGINT.
+*)
+
+@findex TRUNCL
+PROCEDURE TRUNCL (o: <any floating point type>) : <type> ;
+@end example
+
+@example
+
+(*
+   VAL - converts data i of <any simple data type 2> to
+         <any simple data type 1> and returns this value.
+         No range checking is performed during this conversion.
+*)
+
+@findex VAL
+PROCEDURE VAL (<any simple data type 1>,
+               i: <any simple data type 2>) : <any simple data type 1> ;
+
+@end example
+
+@subsection ISO specific standard procedures and functions
+
+The standard function @code{LENGTH} is specific to ISO Modula-2 and
+is defined as:
+
+@example
+
+(*
+   IM - returns the imaginary component of a complex type.
+        The return value will the same type as the imaginary field
+        within the complex type.
+*)
+
+@findex IM
+PROCEDURE IM (c: <any complex type>) : <floating point type> ;
+@end example
+
+@example
+
+(*
+   INT - returns an INTEGER value which has the same value as v.
+         This function is equivalent to: VAL(INTEGER, v).
+*)
+
+@findex INT
+PROCEDURE INT (v: <any ordinal type>) : INTEGER ;
+@end example
+
+@example
+
+(*
+   LENGTH - returns the length of string a.
+*)
+
+@findex LENGTH
+PROCEDURE LENGTH (a: ARRAY OF CHAR) : CARDINAL ;
+@end example
+
+This function is evaluated at compile time, providing that string
+@code{a} is a constant. If @code{a} cannot be evaluated then a call is
+made to @code{M2RTS.Length}.
+
+@example
+
+(*
+   ODD - returns a BOOLEAN indicating whether the whole number
+         value, v, is odd.
+*)
+
+@findex ODD
+PROCEDURE ODD (v: <any whole number type>) : BOOLEAN ;
+@end example
+
+@example
+
+(*
+   RE - returns the real component of a complex type.
+        The return value will the same type as the real field
+        within the complex type.
+*)
+
+@findex RE
+PROCEDURE RE (c: <any complex type>) : <floating point type> ;
+@end example
+
+@node Dialect, Exceptions, Standard procedures, Using
+@section GNU Modula-2 supported dialects
+
+This section describes the dialects understood by GNU Modula-2.
+It also describes the differences between the dialects and
+any command line switches which determine dialect behaviour.
+
+The GNU Modula-2 compiler is compliant with four dialects of Modula-2.
+The language as defined in 'Programming in Modula-2' 2nd Edition,
+Springer Verlag, 1982, 1983 by Niklaus Wirth (PIM2), 'Programming in
+Modula-2', 3rd Corrected Edition, Springer Verlag, 1985 (PIM3) and
+'Programming in Modula-2', 4th Edition, Springer Verlag, 1988 (PIM4)
+@uref{http://freepages.modula2.org/report4/modula-2.html} and the ISO
+Modula-2 language as defined in ISO/IEC Information technology -
+programming languages - part 1: Modula-2 Language, ISO/IEC 10514-1
+(1996) (ISO).
+
+The command line switches @samp{-fpim2}, @samp{-fpim3}, @samp{-fpim4}
+and @samp{-fiso} can be used to force mutually exclusive
+features.  However by default the compiler will not aggressively fail
+if a non mutually exclusive feature is used from another dialect.  For
+example it is possible to specify @samp{-fpim2} and still utilise
+@samp{DEFINITION} @samp{MODULES} which have no export list.
+
+Some dialect differences will force a compile time error, for example
+in PIM2 the user must @code{IMPORT} @code{SIZE} from the module
+@code{SYSTEM}, whereas in PIM3 and PIM4 @code{SIZE} is a pervasive
+function.  Thus compiling PIM4 source code with the @samp{-fpim2}
+switch will cause a compile time error.  This can be fixed quickly
+with an additional @code{IMPORT} or alternatively by compiling with
+the @samp{-fpim4} switch.
+
+However there are some very important differences between the dialects
+which are mutually exclusive and therefore it is vital that users
+choose the dialects with care when these language features are used.
+
+@subsection Integer division, remainder and modulus
+
+The most dangerous set of mutually exclusive features found in the
+four dialects supported by GNU Modula-2 are the @code{INTEGER}
+division, remainder and modulus arithmetic operators.  It is important
+to note that the same source code can be compiled to give different
+runtime results depending upon these switches!  The reference manual
+for the various dialects of Modula-2 are quite clear about this
+behaviour and sadly there are three distinct definitions.
+
+The table below illustrates the problem when a negative operand is
+used.
+
+@example
+                  Pim2/3          Pim4                ISO
+               -----------    -----------    ----------------------
+lval    rval   DIV     MOD    DIV     MOD    DIV    MOD    /    REM
+ 31      10      3       1      3       1      3      1     3     1
+-31      10     -3      -1     -4       9     -4      9    -3    -1
+ 31     -10     -3       1     -3       1     Exception    -3     1
+-31     -10      3      -1      4       9     Exception     3    -1
+@end example
+
+See also P24 of PIM2, P27 of PIM3, P29 of PIM4 and P201 of the ISO
+Standard.  At present all dialect division, remainder and modulus are
+implemented as above, apart from the exception calling in the ISO
+dialect. Instead of exception handling the results are the same as the
+PIM4 dialect. This is a temporary implementation situation.
+
+@node Exceptions, Semantic checking, Dialect, Using
+@section Exception implementation
+
+This section describes how exceptions are implemented in GNU Modula-2
+and how command line switches affect their behaviour.  The option
+@samp{-fsoft-check-all} enables all software checking of nil
+dereferences, division by zero etc.  Additional code is produced to
+check these conditions and exception handlers are invoked if the
+conditions prevail.
+
+Without @samp{-fsoft-check-all} these exceptions will be caught by
+hardware (assuming the hardware support exists) and a signal handler
+is invoked.  The signal handler will in turn @code{THROW} an exception
+which will be caught by the appropriate Modula-2 handler.  However the
+action of throwing an exception from within a signal handler is
+implementation defined (according to the C++ documentation).  For
+example on the x86_64 architecture this works whereas on the i686
+architecture it does not.  Therefore to ensure portability it is
+recommended to use @samp{-fsoft-check-all}.
+
+@footnote{@samp{-fsoft-check-all} can be effectively combined with
+@samp{-O2} to semantically analyse source code for possible runtime
+errors at compile time.}
+
+@node Semantic checking, Extensions, Exceptions, Using
+@section How to detect runtime problems at compile time
+
+Consider the following program:
+
+@example
+MODULE assignvalue ;  (*!m2iso+gm2*)
+
+PROCEDURE bad () : INTEGER ;
+VAR
+   i: INTEGER ;
+BEGIN
+   i := -1 ;
+   RETURN i
+END bad ;
+
+VAR
+   foo: CARDINAL ;
+BEGIN
+   (* the m2rte plugin will detect this as an error, post
+      optimization.  *)
+   foo := bad ()
+END assignvalue.
+@end example
+
+here we see that the programmer has overlooked that the return value
+from @samp{bad} will cause an overflow to @samp{foo}.  If we compile
+the code with the following options:
+
+@example
+$ gm2 -g -fsoft-check-all -O2 -c assignvalue.mod
+assignvalue.mod:16:0:inevitable that this error will occur at runtime,
+assignment will result in an overflow
+@end example
+
+The gm2 semantic plugin is automatically run and will generate a
+warning message for every exception call which is known as reachable.
+It is highly advised to run the optimizer (@samp{-O2} or @samp{-O3})
+with @samp{-fsoft-check-all} so that the compiler is able to run the
+optimizer and perform variable and flow analysis before the semantic
+plugin is invoked.
+
+@node Extensions, Type compatibility, Semantic checking, Using
+@section GNU Modula-2 language extensions
+
+This section introduces the GNU Modula-2 language extensions.
+The GNU Modula-2 compiler allows abstract data types to be any type,
+not just restricted to a pointer type providing the
+@samp{-fextended-opaque} option is supplied
+@xref{Compiler options, , ,gm2}.
+
+Declarations can be made in any order, whether they are
+types, constants, procedures, nested modules or variables.
+@c (@xref{Passes, , ,}.)
+
+GNU Modula-2 also allows programmers to interface to @code{C} and
+assembly language.
+
+GNU Modula-2 provides support for the special tokens @code{__LINE__},
+@code{__FILE__}, @code{__FUNCTION__} and @code{__DATE__}.  Support for
+these tokens will occur even if the @samp{-fcpp} option is not
+supplied. A table of these identifiers and their data type and values
+is given below:
+
+@example
+Scope       GNU Modula-2 token      Data type and example value
+
+anywhere    __LINE__                Constant Literal compatible
+                                    with CARDINAL, INTEGER and WORD.
+                                    Example 1234
+
+anywhere    __FILE__                Constant string compatible
+                                    with parameter ARRAY OF CHAR or
+                                    an ARRAY whose SIZE is >= string
+                                    length. Example
+                                    "hello.mod"
+
+procedure   __FUNCTION__            Constant string compatible
+                                    with parameter ARRAY OF CHAR or
+                                    an ARRAY whose SIZE is >= string
+                                    length. Example
+                                    "calc"
+
+module      __FUNCTION__            Example
+                                    "module hello initialization"
+
+anywhere    __DATE__                Constant string compatible
+                                    with parameter ARRAY OF CHAR or
+                                    an ARRAY whose SIZE is >= string
+                                    length. Example
+                                    "Thu Apr 29 10:07:16 BST 2004"
+
+anywhere   __COLUMN__               Gives a contant literal number
+                                    determining the left hand column
+                                    where the first _ appears in
+                                    __COLUMN__.  The left most column
+                                    is 1.
+
+@end example
+
+The preprocessor @samp{cpp} can be invoked via the @samp{-fcpp}
+command line option. This in turn invokes @samp{cpp} with the
+following arguments @samp{-traditional -lang-asm}.  These options
+preserve comments and all quotations.  @samp{gm2} treats a @samp{#}
+character in the first column as a preprocessor directive.
+
+For example here is a module which calls @code{FatalError}
+via the macro @code{ERROR}.
+
+@example
+MODULE cpp ;
+
+FROM SYSTEM IMPORT ADR, SIZE ;
+FROM libc IMPORT exit, printf, malloc ;
+
+PROCEDURE FatalError (a, file: ARRAY OF CHAR;
+                         line: CARDINAL;
+                         func: ARRAY OF CHAR) ;
+BEGIN
+   printf("%s:%d:fatal error, %s, in %s\n",
+           ADR(file), line, ADR(a), ADR(func)) ;
+   exit(1)
+END FatalError ;
+
+#define ERROR(X)  FatalError(X, __FILE__, __LINE__, __FUNCTION__)
+
+VAR
+   pc: POINTER TO CARDINAL;
+BEGIN
+   pc := malloc(SIZE(CARDINAL)) ;
+   IF pc=NIL
+   THEN
+      ERROR('out of memory')
+   END
+END cpp.
+@end example
+
+Another use for the C preprocessor in Modula-2 might be to turn on
+debugging code.  For example the library module
+@file{FormatStrings.mod} uses procedures from @file{DynamicStrings.mod}
+and to track down memory leaks it was useful to track the source file
+and line where each string was created.  Here is a section of
+@file{FormatStrings.mod} which shows how the debugging code was
+enabled and disabled by adding @code{-fcpp} to the command line.
+
+@example
+FROM DynamicStrings IMPORT String, InitString, InitStringChar, Mark,
+                           ConCat, Slice, Index, char,
+                           Assign, Length, Mult, Dup, ConCatChar,
+                           PushAllocation, PopAllocationExemption,
+                           InitStringDB, InitStringCharStarDB,
+                           InitStringCharDB, MultDB, DupDB, SliceDB ;
+
+(*
+#define InitString(X) InitStringDB(X, __FILE__, __LINE__)
+#define InitStringCharStar(X) InitStringCharStarDB(X, __FILE__, \
+                                                   __LINE__)
+#define InitStringChar(X) InitStringCharDB(X, __FILE__, __LINE__)
+#define Mult(X,Y) MultDB(X, Y, __FILE__, __LINE__)
+#define Dup(X) DupDB(X, __FILE__, __LINE__)
+#define Slice(X,Y,Z) SliceDB(X, Y, Z, __FILE__, __LINE__)
+*)
+
+PROCEDURE doDSdbEnter ;
+BEGIN
+   PushAllocation
+END doDSdbEnter ;
+
+PROCEDURE doDSdbExit (s: String) ;
+BEGIN
+   s := PopAllocationExemption(TRUE, s)
+END doDSdbExit ;
+
+PROCEDURE DSdbEnter ;
+BEGIN
+END DSdbEnter ;
+
+PROCEDURE DSdbExit (s: String) ;
+BEGIN
+END DSdbExit ;
+
+(*
+#define DBsbEnter doDBsbEnter
+#define DBsbExit  doDBsbExit
+*)
+
+PROCEDURE Sprintf1 (s: String; w: ARRAY OF BYTE) : String ;
+BEGIN
+   DSdbEnter ;
+   s := FormatString(HandleEscape(s), w) ;
+   DSdbExit(s) ;
+   RETURN( s )
+END Sprintf1 ;
+@end example
+
+It is worth noting that the overhead of this code once @code{-fcpp} is
+not present and -O2 is used will be zero since the local empty
+procedures @code{DSdbEnter} and @code{DSdbExit} will be thrown away by
+the optimization passes of the GCC backend.
+
+@subsection Optional procedure parameter
+
+GNU Modula-2 allows the last parameter to a procedure or function
+parameter to be optional. For example in the ISO library
+@file{COROUTINES.def} the procedure @code{NEWCOROUTINE} is defined as
+having an optional fifth argument (@code{initProtection}) which, if
+absent, is automatically replaced by @code{NIL}.
+
+@example
+@findex NEWCOROUTINE
+PROCEDURE NEWCOROUTINE (procBody: PROC; workspace: SYSTEM.ADDRESS;
+                        size: CARDINAL; VAR cr: COROUTINE;
+                        [initProtection: PROTECTION = NIL]);
+
+  (* Creates a new coroutine whose body is given by procBody,
+     and returns the identity of the coroutine in cr.
+     workspace is a pointer to the work space allocated to
+     the coroutine; size specifies the size of this workspace
+     in terms of SYSTEM.LOC.
+
+     The optional fifth argument may contain a single parameter
+     which specifies the initial protection level of the coroutine.
+  *)
+@end example
+
+The implementation module @file{COROUTINES.mod} implements this
+procedure using the following syntax:
+
+@example
+PROCEDURE NEWCOROUTINE (procBody: PROC; workspace: SYSTEM.ADDRESS;
+                        size: CARDINAL; VAR cr: COROUTINE;
+                        [initProtection: PROTECTION]);
+BEGIN
+
+END NEWCOROUTINE ;
+@end example
+
+Note that it is illegal for this declaration to contain an initialiser
+value for @code{initProtection}. However it is necessary to surround
+this parameter with the brackets @code{[} and @code{]}. This serves to
+remind the programmer that the last parameter was declared as optional
+in the definition module.
+
+Local procedures can be declared to have an optional final parameter
+in which case the initializer is mandatory in the implementation or
+program module.
+
+GNU Modula-2 also provides additional fixed sized data types which
+are all exported from the @code{SYSTEM} module.
+@xref{The PIM system module, , ,gm2}.
+@xref{The ISO system module, , ,gm2}.
+
+@node Type compatibility, Unbounded by reference, Extensions, Using
+@section Type compatibility
+
+This section discuss the issues surrounding assignment, expression
+and parameter compatibility, their effect of the additional
+fixed sized datatypes and also their effect of runtime checking.
+The data types supported by the compiler are:
+
+@example
+GNU Modula-2              scope      switches
+=============================================
+INTEGER                   pervasive
+LONGINT                   pervasive
+SHORTINT                  pervasive
+CARDINAL                  pervasive
+LONGCARD                  pervasive
+SHORTCARD                 pervasive
+BOOLEAN                   pervasive
+BITSET                    pervasive
+REAL                      pervasive
+LONGREAL                  pervasive
+SHORTREAL                 pervasive
+CHAR                      pervasive
+SHORTCOMPLEX              pervasive
+COMPLEX                   pervasive
+LONGCOMPLEX               pervasive
+
+LOC                       SYSTEM     -fiso
+BYTE                      SYSTEM
+WORD                      SYSTEM
+ADDRESS                   SYSTEM
+
+The following extensions are supported for
+most architectures (please check SYSTEM.def).
+=============================================
+INTEGER8                  SYSTEM
+INTEGER16                 SYSTEM
+INTEGER32                 SYSTEM
+INTEGER64                 SYSTEM
+CARDINAL8                 SYSTEM
+CARDINAL16                SYSTEM
+CARDINAL32                SYSTEM
+CARDINAL64                SYSTEM
+BITSET8                   SYSTEM
+BITSET16                  SYSTEM
+BITSET32                  SYSTEM
+WORD16                    SYSTEM
+WORD32                    SYSTEM
+WORD64                    SYSTEM
+REAL32                    SYSTEM
+REAL64                    SYSTEM
+REAL96                    SYSTEM
+REAL128                   SYSTEM
+COMPLEX32                 SYSTEM
+COMPLEX64                 SYSTEM
+COMPLEX96                 SYSTEM
+COMPLEX128                SYSTEM
+@end example
+
+The Modula-2 language categorises compatibility between entities of
+possibly differing types into three subcomponents: expressions,
+assignments, and parameters.  Parameter compatibility is further
+divided into two sections for pass by reference and pass by value
+compatibility.
+
+For more detail on the Modula-2 type compatibility see the Modula-2
+ISO standard BS ISO/IEC 10514-1:1996 page 121-125.  For detail on the
+PIM type compatibility see Programming in Modula-2 Edition 4 page 29,
+(Elementary Data Types).
+
+@subsection Expression compatibility
+
+Modula-2 restricts the types of expressions to the same type.
+Expression compatibility is a symmetric relation.
+
+For example two sub expressions of @code{INTEGER} and @code{CARDINAL}
+are not expression compatible
+(@uref{http://freepages.modula2.org/report4/modula-2.html} and ISO
+Modula-2).
+
+In GNU Modula-2 this rule is also extended across all fixed sized data
+types (imported from SYSTEM).
+
+@subsection Assignment compatibility
+
+This section discusses the assignment issues surrounding assignment
+compatibility of elementary types (@code{INTEGER}, @code{CARDINAL},
+@code{REAL} and @code{CHAR} for example).  The information here is
+found in more detail in the Modula-2 ISO standard BS ISO/IEC
+10514-1:1996 page 122.
+
+Assignment compatibility exists between the same sized elementary
+types.
+
+Same type family of different sizes are
+also compatible as long as the @code{MAX(}type@code{)} and
+@code{MIN(}type@code{)} is known.  So for example this includes the
+@code{INTEGER} family, @code{CARDINAL} family and the @code{REAL}
+family.
+
+The reason for this is that when the assignment is performed
+the compiler will check to see that the expression (on the right of
+the @code{:=}) lies within the range of the designator type (on the
+left hand side of the @code{:=}).  Thus these ordinal types can be
+assignment compatible.  However it does mean that @code{WORD32} is not
+compatible with @code{WORD16} as @code{WORD32} does not have a minimum
+or maximum value and therefore cannot be checked.  The compiler does
+not know which of the two bytes from @code{WORD32} should be copied
+into @code{WORD16} and which two should be ignored.  Currently the
+types @code{BITSET8}, @code{BITSET16} and @code{BITSET32} are
+assignment incompatible.  However this restriction maybe lifted when
+further runtime checking is achieved.
+
+Modula-2 does allow @code{INTEGER} to be assignment compatible with
+@code{WORD} as they are the same size.  Likewise GNU Modula-2 allows
+@code{INTEGER16} to be compatible with @code{WORD16} and the same for
+the other fixed sized types and their sized equivalent in either
+@code{WORD}n, @code{BYTE} or @code{LOC} types.  However it prohibits
+assignment between @code{WORD} and @code{WORD32} even though on many
+systems these sizes will be the same.  The reasoning behind this rule
+is that the extended fixed sized types are meant to be used by
+applications requiring fixed sized data types and it is more portable
+to forbid the bluring of the boundaries between fixed sized and
+machine dependant sized types.
+
+Intemediate code runtime checking is always generated by the front
+end.  However this intemediate code is only translated into actual
+code if the appropriate command line switches are specified.  This
+allows the compiler to perform limited range checking at compile time.
+In the future it will allow the extensive GCC optimisations to
+propagate constant values through to the range checks which if they
+are found to exceed the type range will result in a compile time
+error message.
+
+@subsection Parameter compatibility
+
+Parameter compatibility is divided into two areas, pass by value and
+pass by reference (@code{VAR}).  In the case of pass by value the
+rules are exactly the same as assignment.  However in the second case,
+pass by reference, the actual parameter and formal parameter must be
+the same size and family.  Furthermore @code{INTEGER} and
+@code{CARDINAL}s are not treated as compatible in the pass by
+reference case.
+
+The types @code{BYTE}, @code{LOC}, @code{WORD} and @code{WORD}n
+derivitives are assignment and parameter compatible with any data type
+of the same size.
+
+@node Unbounded by reference, Building a shared library, Type compatibility, Using
+@section Unbounded by reference
+
+This section documents a GNU Modula-2 compiler switch which implements
+a language optimisation surrounding the implementation of unbounded
+arrays.  In GNU Modula-2 the unbounded array is implemented by
+utilising an internal structure @code{struct @{dataType *address,
+unsigned int high@}}.  So given the Modula-2 procedure declaration:
+
+@example
+PROCEDURE foo (VAR a: ARRAY OF dataType) ;
+BEGIN
+   IF a[2]= (* etc *)
+END foo ;
+@end example
+
+it is translated into GCC @code{tree}s, which can be represented
+in their C form thus:
+
+@example
+void foo (struct @{dataType *address, unsigned int high@} a)
+@{
+   if (a.address[2] == /* etc */
+@}
+@end example
+
+Whereas if the procedure @code{foo} was declared as:
+
+@example
+PROCEDURE foo (a: ARRAY OF dataType) ;
+BEGIN
+   IF a[2]= (* etc *)
+END foo ;
+@end example
+
+then it is implemented by being translated into the following
+GCC @code{tree}s, which can be represented in their C form thus:
+
+@example
+void foo (struct @{dataType *address, unsigned int high@} a)
+@{
+   dataType *copyContents = (dataType *)alloca (a.high+1);
+   memcpy(copyContents, a.address, a.high+1);
+   a.address = copyContents;
+
+   if (a.address[2] == /* etc */
+@}
+@end example
+
+This implementation works, but it makes a copy of each non VAR
+unbounded array when a procedure is entered.  If the unbounded array
+is not changed during procedure @code{foo} then this implementation
+will be very inefficient.  In effect Modula-2 lacks the @code{REF}
+keyword of Ada.  Consequently the programmer maybe tempted to
+sacrifice semantic clarity for greater efficiency by declaring the
+parameter using the @code{VAR} keyword in place of @code{REF}.
+
+The @code{-funbounded-by-reference} switch instructs the compiler to
+check and see if the programmer is modifying the content of any
+unbounded array.  If it is modified then a copy will be made upon
+entry into the procedure.  Conversely if the content is only read and
+never modified then this non @code{VAR} unbounded array is a candidate
+for being passed by reference.  It is only a candidate as it is still
+possible that passing this parameter by reference could alter the
+meaning of the source code.  For example consider the following case:
+
+@example
+PROCEDURE StrConCat (VAR a: ARRAY OF CHAR; b, c: ARRAY OF CHAR) ;
+BEGIN
+   (* code which performs string a := b + c *)
+END StrConCat ;
+
+PROCEDURE foo ;
+VAR
+   a: ARRAY [0..3] OF CHAR ;
+BEGIN
+   a := 'q' ;
+   StrConCat(a, a, a)
+END foo ;
+@end example
+
+In the code above we see that the same parameter, @code{a}, is being
+passed three times to @code{StrConCat}.  Clearly even though parameters
+@code{b} and @code{c} are never modified it would be incorrect to
+implement them as pass by reference.  Therefore the compiler checks to
+see if any non @code{VAR} parameter is type compatible with any
+@code{VAR} parameter and if so it generates runtime procedure entry
+checks to determine whether the contents of parameters @code{b} or
+@code{c} matches the contents of @code{a}.  If a match is detected
+then a copy is made and the @code{address} in the unbounded
+@code{struct}ure is modified.
+
+The compiler will check the address range of each candidate against
+the address range of any @code{VAR} parameter, providing they are type
+compatible.  For example consider:
+
+@example
+PROCEDURE foo (a: ARRAY OF BYTE; VAR f: REAL) ;
+BEGIN
+   f := 3.14 ;
+   IF a[0]=BYTE(0)
+   THEN
+      (* etc *)
+   END
+END foo ;
+
+PROCEDURE bar ;
+BEGIN
+   r := 2.0 ;
+   foo(r, r)
+END bar ;
+@end example
+
+Here we see that although parameter, @code{a}, is a candidate for the
+passing by reference, it would be incorrect to use this
+transformation.  Thus the compiler detects that parameters, @code{a}
+and @code{f} are type compatible and will produce runtime checking
+code to test whether the address range of their respective contents
+intersect.
+
+@node Linking, Building a shared library, Unbounded by reference, Using
+
+This section describes the linking related options.  There are three
+linking strategies available which are dynamic scaffold, static
+scaffold and user defined.  The dynamic scaffold is enabled by default
+and each module will register itself to the runtime @samp{M2RTS} via
+a constructor.  The static scaffold mechanism will invoke each modules
+@samp{_init} and @samp{_finish} function in turn via a sequence of
+calls from within @samp{main}.  Lastly the user defined strategy
+can be implemented by turning off the dynamic and static options via
+@samp{-fno-scaffold-dynamic} and @samp{-fno-scaffold-static}.
+
+In the simple test below:
+
+@example
+$ gm2 hello.mod
+@end example
+
+the driver will add the options @samp{-fscaffold-dynamic} and
+@samp{-fgen-module-list=-} which generate a list of application
+modules and also creates the @samp{main} function with calls to
+@samp{M2RTS}.  It can be useful to add the option @samp{-fsources}
+which displays the source files as they are parsed and summarizes
+whether the source file is required for compilation or linking.
+
+If you wish to split the above command line into a compile and link
+then you could use these steps:
+
+@example
+$ gm2 -c -fscaffold-main hello.mod
+$ gm2 hello.o
+@end example
+
+The @samp{-fscaffold-main} informs the compiler to generate the
+@samp{main} function and scaffold.  You can enable the environment
+variable @samp{GCC_M2LINK_RTFLAG} to trace the construction and
+destruction of the application.  The values for
+@samp{GCC_M2LINK_RTFLAG} are shown in the table below:
+
+@example
+value   | meaning
+=================
+all     | turn on all flags below
+module  | trace modules as they register themselves
+pre     | generate module list prior to dependency resolution
+dep     | trace module dependency resolution
+post    | generate module list after dependency resolution
+force   | generate a module list after dependency and forced
+        | ordering is complete
+@end example
+
+The values can be combined using a comma separated list.
+
+One of the advantages of the dynamic scaffold is that the driver
+behaves in a similar way to the other front end drivers.
+For example consider a small project consisting of 4 definition
+implementation modules (@samp{a.def}, @samp{a.mod}, @samp{b.def},
+@samp{b.mod}, @samp{c.def}, @samp{c.mod}, @samp{d.def}, @samp{d.mod})
+and a program module @samp{program.mod}.
+
+To link this project we could:
+
+@example
+$ gm2 -g -c a.mod
+$ gm2 -g -c b.mod
+$ gm2 -g -c c.mod
+$ gm2 -g -c d.mod
+$ gm2 -g program.mod a.o b.o c.o d.o
+@end example
+
+The module initialization sequence is defined by the ISO standard to
+follow the import graph traversal.  The initialization order is the
+order in which the corresponding separate modules finish the
+processing of their import lists.
+
+However, if required, you can override this using
+@samp{-fruntime-modules=a,b,c,d} for example which forces the
+initialization sequence to @samp{a}, @samp{b}, @samp{c} and @samp{d}.
+
+@node Building a shared library, Interface for Python, Unbounded by reference, Using
+@section Building a shared library
+
+This section describes building a tiny shared library implemented in
+Modula-2 and built with @file{libtool}.  Suppose a project consists of
+two definition modules and two implementation modules and a program
+module @file{a.def}, @file{a.mod}, @file{b.def}, @file{b.mod} and
+@file{c.mod}.  The first step is to compile the modules using position
+independent code.  This can be achieved by the following three
+commands:
+
+@example
+libtool --tag=CC --mode=compile gm2 -g -c a.mod -o a.lo
+libtool --tag=CC --mode=compile gm2 -g -c b.mod -o b.lo
+libtool --tag=CC --mode=compile gm2 -g -c c.mod -o c.lo
+@end example
+
+The second step is to generate the shared library initialization and
+finalization routines.  We can do this by asking gm2 to generate a
+list of dependant modules and then use this to generate the scaffold.
+We also must compile the scaffold.
+
+@example
+gm2 -c -g -fmakelist c.mod
+gm2 -c -g -fmakeinit -fshared c.mod
+libtool --tag=CC --mode=compile g++ -g -c c_m2.cpp -o c_m2.lo
+@end example
+
+The third step is to link all these @file{.lo} files.
+
+@example
+libtool --mode=link gcc -g c_m2.lo a.lo b.lo c.lo \
+        -L$(prefix)/lib64 \
+        -rpath `pwd` -lgm2 -lstdc++ -lm -o libabc.la
+@end example
+
+At this point the shared library @file{libabc.so} will have been
+created inside the directory @file{.libs}.
+
+@node Interface for Python, Producing a Python module, Building a shared library, Using
+@section How to produce swig interface files
+
+This section describes how Modula-2 implementation modules can be
+called from Python (and other scripting languages such as TCL and
+Perl).  GNU Modula-2 can be instructed to create a swig interface when
+it is compiling an implementation module.  Swig then uses the
+interface file to generate all the necessary wrapping to that the
+desired scripting language may access the implementation module.
+
+Here is an example of how you might call upon the services of the
+Modula-2 library module @code{NumberIO} from Python3.
+
+The following commands can be used to generate the Python3 module:
+
+@example
+export src=@samp{directory to the sources}
+export prefix=@samp{directory to where the compiler is installed}
+gm2 -I$@{src@} -c -g -fswig $@{src@}/../../../gm2-libs/NumberIO.mod
+gm2 -I$@{src@} -c -g -fmakelist $@{src@}/../../../gm2-libs/NumberIO.mod
+
+gm2 -I$@{src@} -c -g -fmakeinit -fshared \
+   $@{src@}/../../../gm2-libs/NumberIO.mod
+
+swig -c++ -python3 NumberIO.i
+
+libtool --mode=compile g++ -g -c -I$@{src@} NumberIO_m2.cpp \
+  -o NumberIO_m2.lo
+
+libtool --tag=CC --mode=compile gm2 -g -c \
+  -I$@{src@}../../../gm2-libs \
+  $@{src@}/../../../gm2-libs/NumberIO.mod -o NumberIO.lo
+
+libtool --tag=CC --mode=compile g++ -g -c NumberIO_wrap.cxx \
+  -I/usr/include/python3 -o NumberIO_wrap.lo
+
+libtool --mode=link gcc -g NumberIO_m2.lo NumberIO_wrap.lo \
+   -L$@{prefix@}/lib64 \
+   -rpath `pwd` -lgm2 -lstdc++ -lm -o libNumberIO.la
+
+cp .libs/libNumberIO.so _NumberIO.so
+@end example
+
+The first four commands, generate the swig interface file
+@file{NumberIO.i} and python wrap files @file{NumberIO_wrap.cxx} and
+@file{NumberIO.py}.  The next three @file{libtool} commnads compile
+the C++ and Modula-2 source code into @file{.lo} objects.  The last
+@file{libtool} command links all the @file{.lo} files into a
+@file{.la} file and includes all shared library dependencies.
+
+Now it is possible to run the following Python script
+(called @file{testnum.py}):
+
+@example
+import NumberIO
+
+print ("1234 x 2 =", NumberIO.NumberIO_StrToInt("1234")*2)
+@end example
+
+like this:
+
+@example
+$ python3 testnum.py
+1234 x 2 = 2468
+@end example
+
+@xref{Producing a Python module, , ,gm2} for another example which
+uses the @code{UNQUALIFIED} keyword to reduce the module name clutter
+from the viewport of Python3.
+
+@subsection Limitations of automatic generated of Swig files
+
+This section discusses the limitations of automatically generating
+swig files.  From the previous example we see that the module
+@code{NumberIO} had a swig interface file @file{NumberIO.i}
+automatically generated by the compiler.  If we consider three of the
+procedure definitions in @file{NumberIO.def} we can see the
+success and limitations of the automatic interface generation.
+
+@example
+PROCEDURE StrToHex (a: ARRAY OF CHAR; VAR x: CARDINAL) ;
+PROCEDURE StrToInt (a: ARRAY OF CHAR; VAR x: INTEGER) ;
+PROCEDURE ReadInt (VAR x: CARDINAL) ;
+@end example
+
+Below are the swig interface prototypes:
+
+@example
+extern void NumberIO_StrToHex (char *_m2_address_a,
+                               int _m2_high_a, unsigned int *OUTPUT);
+/*  parameters: x is known to be an OUTPUT */
+extern void NumberIO_StrToInt (char *_m2_address_a,
+                               int _m2_high_a, int *OUTPUT);
+/*  parameters: x is guessed to be an OUTPUT */
+extern void NumberIO_ReadInt (int *x);
+/*  parameters: x is unknown */
+@end example
+
+In the case of @code{StrToHex} it can be seen that the compiler
+detects that the last parameter is an output.  It explicitly tells
+swig this by using the parameter name @code{OUTPUT} and in the
+following comment it informs the user that it knows this to be an
+output parameter.  In the second procedure @code{StrToInt} it marks
+the final parameter as an output, but it tells the user that this is
+only a guess.  Finally in @code{ReadInt} it informs the user that
+it does not know whether the parameter, @code{x}, is an output, input
+or an inout parameter.
+
+The compiler decides whether to mark a parameter as either:
+@code{INPUT}, @code{OUTPUT} or @code{INOUT} if it is read before
+written or visa versa in the first basic block.  At this point
+it will write output that the parameter is known.  If it is not
+read or written in the first basic block then subsequent basic blocks
+are searched and the result is commented as a guess.  Finally if
+no read or write occurs then the parameter is commented as unknown.
+However, clearly it is possible to fool this mechanism.  Nevertheless
+automatic generation of implementation module into swig interface files
+was thought sufficiently useful despite these limitations.
+
+In conclusion it would be wise to check all parameters in any
+automatically generated swig interface file.  Furthermore you can
+force the automatic mechanism to generate correct interface files by
+reading or writing to the @code{VAR} parameter in the first basic
+block of a procedure.
+
+@node Producing a Python module, Interface to C, Interface for Python, Using
+@section How to produce a Python module
+
+This section descibes how it is possible to produce a Python module
+from Modula-2 code.  There are a number of advantages to this
+approach, it ensures your code reaches a wider audience, maybe it is
+easier to initialize your application in Python.
+
+The example application here is a pedagogical two dimensional gravity
+next event simulation.  The Python module needs to have a clear API
+which should be placed in a single definition module.  Furthermore the
+API should only use fundamental pervasive data types and strings.
+Below the API is contained in the file @file{twoDsim.def}:
+
+@example
+DEFINITION MODULE twoDsim ;
+
+EXPORT UNQUALIFIED gravity, box, poly3, poly5, poly6, mass,
+                   fix, circle, pivot, velocity, accel, fps,
+                   replayRate, simulateFor ;
+(*
+   gravity - turn on gravity at: g m^2
+*)
+
+PROCEDURE gravity (g: REAL) ;
+
+
+(*
+   box - place a box in the world at (x0,y0),(x0+i,y0+j)
+*)
+
+PROCEDURE box (x0, y0, i, j: REAL) : CARDINAL ;
+
+
+(*
+   poly3 - place a triangle in the world at:
+           (x0,y0),(x1,y1),(x2,y2)
+*)
+
+PROCEDURE poly3 (x0, y0, x1, y1, x2, y2: REAL) : CARDINAL ;
+
+
+(*
+   poly5 - place a pentagon in the world at:
+           (x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)
+*)
+
+PROCEDURE poly5 (x0, y0, x1, y1,
+                 x2, y2, x3, y3, x4, y4: REAL) : CARDINAL ;
+
+
+(*
+   poly6 - place a hexagon in the world at:
+           (x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)
+*)
+
+PROCEDURE poly6 (x0, y0, x1, y1,
+                 x2, y2, x3, y3,
+                 x4, y4, x5, y5: REAL) : CARDINAL ;
+
+
+(*
+   mass - specify the mass of an object and return the, id.
+*)
+
+PROCEDURE mass (id: CARDINAL; m: REAL) : CARDINAL ;
+
+
+(*
+   fix - fix the object to the world.
+*)
+
+PROCEDURE fix (id: CARDINAL) : CARDINAL ;
+
+
+(*
+   circle - adds a circle to the world.  Center
+            defined by: x0, y0 radius, r.
+*)
+
+PROCEDURE circle (x0, y0, r: REAL) : CARDINAL ;
+
+
+(*
+   velocity - give an object, id, a velocity, vx, vy.
+*)
+
+PROCEDURE velocity (id: CARDINAL; vx, vy: REAL) : CARDINAL ;
+
+
+(*
+   accel - give an object, id, an acceleration, ax, ay.
+*)
+
+PROCEDURE accel (id: CARDINAL; ax, ay: REAL) : CARDINAL ;
+
+
+(*
+   fps - set frames per second.
+*)
+
+PROCEDURE fps (f: REAL) ;
+
+
+(*
+   replayRate - set frames per second during replay.
+*)
+
+PROCEDURE replayRate (f: REAL) ;
+
+
+(*
+   simulateFor - render for, t, seconds.
+*)
+
+PROCEDURE simulateFor (t: REAL) ;
+
+
+END twoDsim.
+@end example
+
+The keyword @code{UNQUALIFIED} can be used to ensure that the
+compiler will provide externally accessible functions
+@code{gravity}, @code{box}, @code{poly3}, @code{poly5}, @code{poly6},
+@code{mass}, @code{fix}, @code{circle}, @code{pivot}, @code{velocity},
+@code{accel}, @code{fps}, @code{replayRate}, @code{simulateFor}
+rather than name mangled alternatives.
+Hence in our Python3 application we could write:
+
+@example
+#!/usr/bin/env python3
+
+from twoDsim import *
+
+b = box (0.0, 0.0, 1.0, 1.0)
+b = fix (b)
+c1 = circle (0.7, 0.7, 0.05)
+c1 = mass (c1, 0.01)
+c2 = circle (0.7, 0.1, 0.05)
+c2 = mass (c2, 0.01)
+c2 = fix (c2)
+gravity (-9.81)
+fps (24.0*4.0)
+replayRate (24.0)
+print ("creating frames")
+try:
+    simulateFor (1.0)
+    print ("all done")
+except:
+    print ("exception raised")
+@end example
+
+which accesses the various functions defined and implemented by the
+module @code{twoDsim}.  The Modula-2 source code is compiled via:
+
+@example
+$ gm2 -g -fiso -c -fswig twoDsim.mod
+$ gm2 -g -fiso -c -fmakelist twoDsim.mod
+$ gm2 -g -fiso -c -fmakeinit twoDsim.mod
+@end example
+
+The first command both compiles the source file creating
+@file{twoDsim.o} and produces a swig interface file @file{swig.i}.  We
+now use @code{swig} and @code{g++} to produce and compile the
+interface wrappers:
+
+@example
+$ libtool --mode=compile g++ -g -c twoDsim_m2.cpp -o twoDsim_m2.lo
+$ swig -c++ -python3 twoDsim.i
+$ libtool --mode=compile g++ -c -fPIC twoDsim_wrap.cxx \
+   -I/usr/include/python3 -o twoDsim_wrap.lo
+$ libtool --mode=compile gm2 -g -fPIC -fiso -c deviceGnuPic.mod
+$ libtool --mode=compile gm2 -g -fPIC -fiso -c roots.mod
+$ libtool --mode=compile gm2 -g -fPIC -fiso -c -fswig \
+   twoDsim.mod -o twoDsim.lo
+@end example
+
+Finally the application is linked into a shared library:
+
+@example
+$ libtool --mode=link gcc -g twoDsim_m2.lo twoDsim_wrap.lo \
+  roots.lo deviceGnuPic.lo \
+   -L$@{prefix@}/lib64 \
+   -rpath `pwd` -lgm2 -lstdc++ -lm -o libtwoDsim.la
+cp .libs/libtwoDsim.so _twoDsim.so
+@end example
+
+The library name must start with @code{_} to comply with the Python3
+module naming scheme.
+
+@node Interface to C, Assembly language, Producing a Python module, Using
+@section Interfacing GNU Modula-2 to C
+
+The GNU Modula-2 compiler tries to use the C calling convention
+wherever possible however some parameters have no C equivalent and
+thus a language specific method is used.  For example unbounded arrays
+are passed as a @code{struct @{void *address, unsigned int high@}} and
+the contents of these arrays are copied by callee functions when they
+are declared as non @code{VAR} parameters.  The @code{VAR} equivalent
+unbounded array parameters need no copy, but still use the
+@code{struct} representation.
+
+The recommended method of interfacing GNU Modula-2 to C is by telling
+the definition module that the implementation is in the C language.
+This is achieved by using the tokens @code{DEFINITION MODULE FOR "C"}.
+Here is an example @file{libprintf.def}.
+
+@example
+DEFINITION MODULE FOR "C" libprintf ;
+
+EXPORT UNQUALIFIED printf ;
+
+PROCEDURE printf (a: ARRAY OF CHAR; ...) : [ INTEGER ] ;
+
+END libprintf.
+@end example
+
+the @code{UNQUALIFIED} keyword in the definition module informs
+GNU Modula-2 not to prefix the module name to exported references
+in the object file.
+
+The @code{printf} declaration states that the first parameter
+semantically matches @code{ARRAY OF CHAR} but since the module is for
+the C language it will be mapped onto @code{char *}. The token
+@code{...} indicates a variable number of arguments (varargs) and all
+parameters passed here are mapped onto their C equivalents. Arrays and
+constant strings are passed as pointers.  Lastly @code{[ INTEGER ]}
+states that the caller can ignore the function return result if desired.
+
+The hello world program can be rewritten as:
+
+@example
+MODULE hello ;
+
+FROM libprintf IMPORT printf ;
+
+BEGIN
+   printf("hello world\n")
+END hello.
+@end example
+
+and it can be compiled by:
+
+@samp{gm2 -g -I. hello.mod -lc}
+
+In reality the @samp{-lc} is redundant as libc is always included in the
+linking process. It is shown here to emphasize that the C library or
+object file containing @code{printf} must be present.
+
+If a procedure function is declared using varargs then some parameter
+values are converted.  The table below summarises the default conversions
+and default types used.
+
+@example
+Actual Parameter       |  Default conversion  |   Type of actual
+                       |                      |   value passed
+===============================================================
+123                    |  none                |   long long int
+"hello world"          |  none                |   const char *
+a: ARRAY OF CHAR       |  ADR(a)              |   char *
+a: ARRAY [0..5] OF CHAR|  ADR(a)              |   char *
+3.14                   |  none                |   long double
+@end example
+
+If you wish to pass @code{int} values then you should explicitly
+convert the constants using one of the conversion mechanisms.
+For example:  @code{INTEGER(10)} or @code{VAL(INTEGER, 10)} or
+@code{CAST(INTEGER, 10)}.
+
+@node Assembly language, Alignment, Interface to C, Using
+@section Interface to assembly language
+
+The interface for GNU Modula-2 to assembly language is almost
+identical to GNU C.  The only alterations are that the keywords
+@code{asm} and @code{volatile} are in capitals, following the Modula-2
+convention.
+
+A simple, but highly non optimal, example is given below. Here we want
+to add the two @code{CARDINAL}s @code{foo} and @code{bar} together and
+return the result.  The target processor is assumed to be executing
+the x86_64 instruction set.
+
+@example
+PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ;
+VAR
+   myout: CARDINAL ;
+BEGIN
+   ASM VOLATILE ("movq %1,%%rax; addq %2,%%rax; movq %%rax,%0"
+      : "=rm" (myout)            (* outputs *)
+      : "rm" (foo), "rm" (bar)   (* inputs  *)
+      : "rax") ;                 (* we trash *)
+   RETURN( myout )
+END Example ;
+@end example
+
+For a full description of this interface we refer the reader to the GNU C manual.
+
+@xref{Extended Asm, ,Extensions to the C Language Family,gcc}.
+
+The same example can be written using the newer extensions of naming
+the operands rather than using numbered arguments.
+
+@example
+PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ;
+VAR
+   myout: CARDINAL ;
+BEGIN
+   ASM VOLATILE (
+    "movq %[left],%%rax; addq %[right],%%rax; movq %%rax,%[output]"
+      : [output] "=rm" (myout)                  (* outputs *)
+      : [left] "rm" (foo), [right] "rm" (bar)   (* inputs  *)
+      : "rax") ;                                (* we trash *)
+   RETURN( myout )
+END Example ;
+@end example
+
+Both examples generate exactly the same code.  It is worth noting that
+the specifier ``rm'' indicates that the operand can be either a
+register or memory.  Of course you must choose an instruction which
+can take either, but this allows the compiler to take make more
+efficient choices depending upon the optimization level given to the
+compiler.
+
+@node Alignment, Packed, Assembly language, Using
+@section Data type alignment
+
+GNU Modula-2 allows you to specify alignment for types and variables.
+The syntax for alignment is to use the ISO pragma directives @code{<*}
+@code{bytealignment (} expression @code{)} and @code{*>}.  These directives
+can be used after type and variable declarations.
+
+The ebnf of the alignment production is:
+
+@example
+Alignment := [ ByteAlignment ] =:
+ByteAlignment := '<*' AttributeExpression '*>' =:
+AlignmentExpression := "(" ConstExpression ")" =:
+@end example
+
+The @code{Alignment} ebnf statement may be used during contruction of
+types, records, record fields, arrays, pointers and variables.  Below
+is an example of aligning a type so that the variable @code{bar} is
+aligned on a 1024 address.
+
+@example
+MODULE align ;
+
+TYPE
+   foo = INTEGER <* bytealignment(1024) *> ;
+
+VAR
+   z  : INTEGER ;
+   bar: foo ;
+BEGIN
+END align.
+@end example
+
+The next example aligns a variable on a 1024 byte boundary.
+
+@example
+MODULE align2 ;
+
+VAR
+   x  : CHAR ;
+   z  : ARRAY [0..255] OF INTEGER <* bytealignment(1024) *> ;
+BEGIN
+END align2.
+@end example
+
+Here the example aligns a pointer on a 1024 byte boundary.
+
+@example
+MODULE align4 ;
+
+FROM SYSTEM IMPORT ADR ;
+FROM libc IMPORT exit ;
+
+VAR
+   x  : CHAR ;
+   z  : POINTER TO INTEGER <* bytealignment(1024) *> ;
+BEGIN
+   IF ADR(z) MOD 1024=0
+   THEN
+      exit(0)
+   ELSE
+      exit(1)
+   END
+END align4.
+@end example
+
+In example @code{align5} record field @code{y} is aligned on a 1024
+byte boundary.
+
+@example
+MODULE align5 ;
+
+FROM SYSTEM IMPORT ADR ;
+FROM libc IMPORT exit ;
+
+TYPE
+   rec = RECORD
+            x: CHAR ;
+            y: CHAR <* bytealignment(1024) *> ;
+         END ;
+VAR
+   r: rec ;
+BEGIN
+   IF ADR(r.y) MOD 1024=0
+   THEN
+      exit(0)
+   ELSE
+      exit(1)
+   END
+END align5.
+@end example
+
+In the example below module @code{align6} declares @code{foo} as an
+array of 256 @code{INTEGER}s.  The array @code{foo} is aligned on a
+1024 byte boundary.
+
+@example
+MODULE align6 ;
+
+FROM SYSTEM IMPORT ADR ;
+FROM libc IMPORT exit ;
+
+TYPE
+   foo = ARRAY [0..255] OF INTEGER <* bytealignment(1024) *> ;
+
+VAR
+   x  : CHAR ;
+   z  : foo ;
+BEGIN
+   IF ADR(z) MOD 1024=0
+   THEN
+      exit(0)
+   ELSE
+      exit(1)
+   END
+END align6.
+@end example
+
+@node Packed, Built-ins, Alignment, Using
+@section Packing data types
+
+The pragma @code{<* bytealignment(0) *>} can be used to specify that
+the fields within a @code{RECORD} are to be packed.  Currently this
+only applies to fields which are declared as subranges, ordinal types
+and enumerated types.  Here is an example of how two subranges might
+be packed into a byte.
+
+@example
+TYPE
+   bits3c =  [0..7] ;
+   bits3i = [-4..3] ;
+
+   byte = RECORD
+              <* bytealignment(0) *>
+              x: bits3c ;
+              <* bitsunused(2) *>
+              y: bits3i ;
+          END ;
+@end example
+
+Notice that the user has specified that in between fields @code{x} and
+@code{y} there are two bits unused.
+
+Now the user wishes to create a record with byte numbers zero and one
+occupied and then an @code{INTEGER32} field which is four byte
+aligned.  In this case byte numbers two and three will be unused.  The
+pragma @code{bytealignment} can be issued at the start of the record
+indicating the default alignment for the whole record and this can be
+overridden by individual fields if necessary.
+
+@example
+   rec = RECORD
+            <* bytealignment (1) *> ;
+            a, b: byte ;
+            x: INTEGER32 <* bytealignment(4) *> ;
+         END ;
+@end example
+
+In the following example the user has specified that a record has two
+fields @code{p} and @code{q} but that there are three bytes unused between
+these fields.
+
+@example
+   header = RECORD
+               <* bytealignment(1) *>
+               p: byte ;
+               <* bytesunused(3) *>
+               q: byte ;
+            END ;
+@end example
+
+The pragma @code{<* bytesunused(x) *>} can only be used if the current
+field is on a byte boundary.  There is also a @code{SYSTEM} pseudo
+procedure function @code{TBITSIZE(T)} which returns the minimum number of
+bits necessary to represent type @code{T}.
+
+Another example of packing record bit fields is given below:
+
+@example
+MODULE align21 ;
+
+FROM libc IMPORT exit ;
+
+TYPE
+   colour = (red, blue, green, purple, white, black) ;
+
+   soc = PACKEDSET OF colour ;
+
+   rec = RECORD
+            <* bytealignment(0) *>
+            x: soc ;
+            y: [-1..1] ;
+         END ;
+
+VAR
+   r: rec ;
+   v: CARDINAL ;
+BEGIN
+   v := SIZE(r) ;
+   IF SIZE(r)#1
+   THEN
+      exit(1)
+   END ;
+   r.x := soc@{blue@} ;
+   IF r.x#soc@{blue@}
+   THEN
+      exit(2)
+   END
+END align21.
+@end example
+
+Here we see that the total size of this record is one byte and consists
+of a six bit set type followed by a 2 bit integer subrange.
+
+@node Built-ins, The PIM system module, Packed, Using
+@section Accessing GNU Modula-2 Built-ins
+
+This section describes the built-in constants and functions defined in
+GNU Modula-2.  The following compiler constants can be accessed using
+the @code{__ATTRIBUTE__} @code{__BUILTIN__} keywords. These are not
+part of the Modula-2 language and they may differ depending upon the
+target architecture but they provide a method whereby common
+libraries can interface to a different underlying architecture.
+
+The built-in constants are: @code{BITS_PER_UNIT}, @code{BITS_PER_WORD},
+@code{BITS_PER_CHAR} and @code{UNITS_PER_WORD}. They are integrated into
+GNU Modula-2 by an extension to the @code{ConstFactor} rule:
+
+@example
+ConstFactor := ConstQualidentOrSet | Number | ConstString |
+               "(" ConstExpression ")" | "NOT" ConstFactor |
+               ConstAttribute =:
+
+ConstAttribute := "__ATTRIBUTE__" "__BUILTIN__" "(" "(" Ident ")" ")" =:
+@end example
+
+Here is an example taken from the ISO library @code{SYSTEM.def}:
+
+@example
+CONST
+   BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+   LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+@end example
+
+Built-in functions are transparent to the end user. All built-in
+functions are declared in @code{DEFINITION MODULE}s and are imported
+as and when required.  Built-in functions are declared in definition
+modules by using the @code{__BUILTIN__} keyword. Here is a section of
+the ISO library @code{LongMath.def} which demonstrates this feature.
+
+@example
+PROCEDURE __BUILTIN__ sqrt (x: LONGREAL): LONGREAL;
+  (* Returns the square root of x *)
+@end example
+
+This indicates that the function @code{sqrt} will be implemented using
+the gcc built-in maths library.  If gcc cannot utilise the built-in
+function (for example if the programmer requested the address of
+@code{sqrt}) then code is generated to call the alternative function
+implemented in the @code{IMPLEMENTATION} @code{MODULE}.
+
+Sometimes a function exported from the @code{DEFINITION} @code{MODULE}
+will have a different name from the built-in function within gcc. In
+such cases the mapping between the GNU Modula-2 function name and the
+gcc name is expressed using the keywords @code{__ATTRIBUTE__}
+@code{__BUILTIN__} @code{((Ident))}. For example the function
+@code{sqrt} in @code{LongMath.def} maps onto the gcc built-in function
+@code{sqrtl} and this is expressed as:
+
+@example
+PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((sqrtl)) sqrt
+                                    (x: LONGREAL) : LONGREAL;
+  (* Returns the positive square root of x *)
+@end example
+
+The following module @code{Builtins.def} enumerates the list of
+built-in functions which can be accessed in GNU Modula-2. It also
+serves to define the parameter and return value for each function:
+
+@include m2/Builtins.texi
+
+Although this module exists and will result in the generation of
+in-line code if optimization flags are passed to GNU Modula-2, users
+are advised to utilize the same functions from more generic libraries.
+The built-in mechanism will be applied to these generic
+libraries where appropriate. Note for the mathematical routines to
+be in-lined you need to specify the @samp{-ffast-math -O} options.
+
+@node The PIM system module, The ISO system module, Built-ins, Using
+@section The PIM system module
+
+@include m2/SYSTEM-pim.texi
+
+The different dialects of Modula-2 PIM-[234] and ISO Modula-2 declare
+the function @code{SIZE} in different places.  PIM-[34] and ISO
+Modula-2 declare @code{SIZE} as a pervasive function (declared in the
+base module).  PIM-2 defined @code{SIZE} in the @code{SYSTEM} module
+(as shown above).
+
+GNU Modula-2 allows users to specify the dialect of Modula-2 by using
+the @code{-fiso} and @code{-fpim2} command line switches.
+
+The data types @code{CSIZE_T} and @code{CSSIZE_T} are also exported from
+the @code{SYSTEM} module.  The type @code{CSIZE_T} is unsigned and is
+mapped onto the target C data type @code{size_t} whereas the type
+@code{CSSIZE_T} is mapped onto the signed C data type @code{ssize_t}.
+
+It is anticipated that these should only be used to provide cross
+platform definition modules for C libraries.
+
+There are also a variety of fixed sized @code{INTEGER} and
+@code{CARDINAL} types.  The variety of the fixed sized types will
+depend upon the target architecture.
+
+@node The ISO system module, , The PIM system module, Using
+@section The ISO system module
+
+@include m2/SYSTEM-iso.texi
+
+The data types @code{CSIZE_T} and @code{CSSIZE_T} are also exported from
+the @code{SYSTEM} module.  The type @code{CSIZE_T} is unsigned and is
+mapped onto the target C data type @code{size_t} whereas the type
+@code{CSSIZE_T} is mapped onto the signed C data type @code{ssize_t}.
+
+It is anticipated that these should only be used to provide cross
+platform definition modules for C libraries.
+
+There are also a variety of fixed sized @code{INTEGER} and
+@code{CARDINAL} types.  The variety of the fixed sized types will
+depend upon the target architecture.
+
+@node Licence, Copying, The ISO system module, Top
+@section Licence of GNU Modula-2
+
+GNU Modula-2 is free software, the compiler is held under the GPL v3
+@uref{http://www.gnu.org/licenses/gpl.txt},
+its libraries (pim, iso and Logitech compatible) are under the
+GPL v3 with the GCC runtime library exception clause.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.
+
+More information on how these licences work is available
+@uref{http://www.gnu.org/licenses/licenses.html} on the GNU web site.
+
+@c Copying node is inside the gpl_v3.texi
+@include gpl_v3.texi
+
+@node Contributing, Internals, Copying, Top
+@section Contributing to GNU Modula-2
+
+Please do. But also please read the GNU Emacs info under
+
+@example
+* Standards: (standards).       GNU coding standards.
+* Intellectual Property::       Keeping Free Software Free
+* Reading Non-Free Code::       Referring to Proprietary Programs
+* Contributions::               Accepting Contributions
+@end example
+
+You might consider joining the GM2 Mailing list before you start
+coding.  The mailing list may be subscribed via a web interface
+@uref{http://lists.nongnu.org/mailman/listinfo/gm2} or via email
+@email{gm2-subscribe@@nongnu.org}.
+
+Many thanks and enjoy your coding!
+
+@node Internals, EBNF, Contributing, Top
+
+This section is still being written.
+@c @include gm2-internals.texi
+
+@node EBNF, Libraries, Internals, Top
+@chapter EBNF of GNU Modula-2
+
+This chapter contains the EBNF of GNU Modula-2. This grammer currently
+supports both PIM and ISO dialects.  The rules here are automatically
+extracted from the grammer files in GNU Modula-2 and serve to document
+the syntax of the extensions described earlier and how they fit in
+with the base language.
+
+Note that the first six productions are built into the lexical analysis
+phase.
+
+@include m2/gm2-ebnf.texi
+
+@node Libraries, Indices, EBNF, Top
+@chapter PIM and ISO library definitions
+
+This chapter contains M2F, PIM and ISO libraries.
+
+@c Permission has been kindly granted by
+@c the authors of the ULM libraries to include them with GNU
+@c Modula-2.
+@c These libraries (under the GNU GPL) were written at the
+@c University of Ulm and were originally shipped with the ULM sparc
+@c Modula-2 compiler.
+
+@include m2/gm2-libs.texi
+
+@node Indices, , Libraries, Top
+@section Indices
+
+@ifhtml
+@menu
+* Contents::    Section and subsections.
+* Functions::   Function, constants, types, ebnf indices.
+@end menu
+
+@node Contents, Functions, ,
+@section Section and subsections
+@printindex cp
+
+@node Functions, , Contents,
+@section Function, constants, types, ebnf indices.
+@end ifhtml
+
+@printindex fn
+
+@summarycontents
+@contents
+@bye
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/lang.opt
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/lang.opt	2022-12-10 00:04:30.319603938 +0000
@@ -0,0 +1,352 @@
+; Options for the Modula-2 front end.
+;
+; Copyright (C) 2016-2022 Free Software Foundation, Inc.
+; Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
+;
+; This file is part of GNU Modula-2.
+;
+; GNU Modula-2 is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation; either version 3, or (at your option)
+; any later version.
+;
+; GNU Modula-2 is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+; General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GNU Modula-2; see the file COPYING.  If not,
+; see <https://www.gnu.org/licenses/>.  *)
+
+; See the GCC internals manual for a description of this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+Language
+Modula-2
+
+B
+Modula-2
+; Documented in c.opt
+
+D
+Modula-2
+; Documented in c.opt
+
+E
+Modula-2
+; Documented in c.opt (passed to the preprocessor if -fcpp is used)
+
+I
+Modula-2 Joined Separate
+; Documented in c.opt
+
+L
+Modula-2 Joined Separate
+; Not documented
+
+M
+Modula-2
+; Documented in c.opt
+
+O
+Modula-2
+; Documented in c.opt
+
+Wall
+Modula-2
+; Documented in c.opt
+
+Wpedantic
+Modula-2
+; Documented in common.opt
+
+Wpedantic-param-names
+Modula-2
+compiler checks to force definition module procedure parameter names with their implementation module counterpart
+
+Wpedantic-cast
+Modula-2
+compiler warns if a cast is being used on types of differing sizes
+
+Wverbose-unbounded
+Modula-2
+inform user which parameters will be passed by reference
+
+Wstyle
+Modula-2
+extra compile time semantic checking, typically tries to catch poor programming style
+
+Wunused-variable
+Modula-2
+; Documented in c.opt
+
+Wunused-parameter
+Modula-2
+; Documented in c.opt
+
+c
+Modula-2
+; Documented in c.opt
+
+fauto-init
+Modula-2
+automatically initializes all pointers to NIL
+
+fbounds
+Modula-2
+turns on runtime subrange, array index and indirection via NIL pointer checking
+
+fcase
+Modula-2
+turns on runtime checking to check whether a CASE statement requires an ELSE clause when on was not specified
+
+fobjc-std=objc1
+Modula-2
+; Documented in c.opt
+
+fcpp
+Modula-2
+use cpp to preprocess the module
+
+fcpp-end
+Modula-2
+passed to the preprocessor if -fcpp is used (internal switch)
+
+fcpp-begin
+Modula-2
+passed to the preprocessor if -fcpp is used (internal switch)
+
+fdebug-builtins
+Modula-2
+call a real function, rather than the builtin equivalent
+
+fd
+Modula-2
+turn on internal debugging of the compiler (internal switch)
+
+fdebug-trace-quad
+Modula-2
+turn on quadruple tracing (internal switch)
+
+fdebug-trace-api
+Modula-2
+turn on the Modula-2 api tracing (internal switch)
+
+fdebug-function-line-numbers
+Modula-2
+turn on the Modula-2 function line number generation (internal switch)
+
+fdef=
+Modula-2 Joined
+recognise the specified suffix as a definition module filename
+
+fdump-system-exports
+Modula-2
+display all inbuilt system items
+
+fexceptions
+Modula-2
+; Documented in common.opt
+
+fextended-opaque
+Modula-2
+allows opaque types to be implemented as any type (a GNU Modula-2 extension)
+
+ffloatvalue
+Modula-2
+turns on runtime checking to check whether a floating point number is about to exceed range
+
+fgen-module-list=
+Modula-2 Joined
+create a topologically sorted module list from all dependent modules used in the application
+
+findex
+Modula-2
+turns on all range checking for numerical values
+
+fiso
+Modula-2
+use ISO dialect of Modula-2
+
+flibs=
+Modula-2 Joined
+specify the library order, currently legal entries include: log, min, pim, iso or their directory name equivalent m2log, m2min, m2pim, m2iso.
+
+flocation=
+Modula-2 Joined
+set all location values to a specific value (internal switch)
+
+fm2-g
+Modula-2
+generate extra nops to improve debugging, producing an instruction for every code related keyword
+
+fm2-lower-case
+Modula-2
+generate error messages which render keywords in lower case
+
+fm2-plugin
+Modula-2
+insert plugin to identify runtime errors at compiletime (default on)
+
+fm2-statistics
+Modula-2
+display statistics about the amount of source lines compiled and symbols used
+
+fm2-strict-type
+Modula-2
+experimental flag to turn on the new strict type checker
+
+fm2-whole-program
+Modula-2
+compile all implementation modules and program module at once
+
+fmod=
+Modula-2 Joined
+recognise the specified suffix as implementation and module filenames
+
+fnil
+Modula-2
+turns on runtime checking to detect accessing data through a NIL value pointer
+
+fpim
+Modula-2
+use PIM [234] dialect of Modula-2
+
+fpim2
+Modula-2
+use PIM 2 dialect of Modula-2
+
+fpim3
+Modula-2
+use PIM 3 dialect of Modula-2
+
+fpim4
+Modula-2
+use PIM 4 dialect of Modula-2
+
+fpositive-mod-floor-div
+Modula-2
+force positive result from MOD and DIV result floor
+
+fpthread
+Modula-2
+link against the pthread library (default on)
+
+fq
+Modula-2
+internal compiler debugging information, dump the list of quadruples
+
+frange
+Modula-2
+turns on all range checking for numerical values
+
+freturn
+Modula-2
+turns on runtime checking for functions which finish without executing a RETURN statement
+
+fruntime-modules=
+Modula-2 Joined
+specify the list of runtime modules and their initialization order
+
+fscaffold-dynamic
+Modula-2
+the modules initialization order is dynamically determined by M2RTS and application dependancies
+
+fscaffold-c
+Modula-2
+generate a C source scaffold for the current module being compiled
+
+fscaffold-c++
+Modula-2
+generate a C++ source scaffold for the current module being compiled
+
+fscaffold-main
+Modula-2
+generate the main function
+
+fscaffold-static
+Modula-2
+generate static scaffold initialization and finalization for every module inside main
+
+fshared
+Modula-2
+generate a shared library from the module
+
+fsoft-check-all
+Modula-2
+turns on all software runtime checking (an abbreviation for -fnil -frange -findex -fwholediv -fcase -freturn -fwholevalue -ffloatvalue)
+
+fsources
+Modula-2
+display the location of module source files as they are compiled
+
+fswig
+Modula-2
+create a swig interface file for the module
+
+funbounded-by-reference
+Modula-2
+optimize non var unbounded parameters by passing it by reference, providing it is not written to within the callee procedure.
+
+fuse-list=
+Modula-2 Joined
+orders the initialization/finalializations for scaffold-static or force linking of modules if scaffold-dynamic
+
+fversion
+Modula-2
+; Documented in common.opt
+
+fwholediv
+Modula-2
+turns on all division and modulus by zero checking for ordinal values
+
+fwholevalue
+Modula-2
+turns on runtime checking to check whether a whole number is about to exceed range
+
+iprefix
+Modula-2
+; Documented in c.opt
+
+isystem
+Modula-2
+; Documented in c.opt
+
+idirafter
+Modula-2
+; Documented in c.opt
+
+imultilib
+Modula-2
+; Documented in c.opt
+
+lang-asm
+Modula-2
+; Documented in c.opt
+
+-save-temps
+Modula-2 Alias(save-temps)
+
+save-temps
+Modula-2
+save temporary preprocessed files
+
+save-temps=
+Modula-2 Joined
+save temporary preprocessed files
+
+traditional-cpp
+Modula-2
+; Documented in c.opt
+
+v
+Modula-2
+; Documented in c.opt
+
+x
+Modula-2 Joined
+specify the language from the compiler driver
+
+; This comment is to ensure we retain the blank line above.
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-lang.cc
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/gm2-lang.cc	2022-12-10 00:04:30.307603788 +0000
@@ -0,0 +1,892 @@
+/* gm2-lang.cc language-dependent hooks for GNU Modula-2.
+
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
+Contributed by Gaius Mulley <gaius@glam.ac.uk>.
+
+This file is part of GNU Modula-2.
+
+GNU Modula-2 is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GNU Modula-2 is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Modula-2; see the file COPYING.  If not, write to the
+Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+#include "gm2-gcc/gcc-consolidation.h"
+
+#include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name.  */
+#include "tree-pass.h"     /* FIXME: only for PROP_gimple_any.  */
+#include "toplev.h"
+#include "debug.h"
+
+#include "opts.h"
+
+#define GM2_LANG_C
+#include "gm2-lang.h"
+#include "m2block.h"
+#include "dynamicstrings.h"
+#include "m2options.h"
+#include "m2convert.h"
+#include "m2linemap.h"
+#include "init.h"
+#include "m2-tree.h"
+#include "convert.h"
+#include "rtegraph.h"
+
+static void write_globals (void);
+
+static int insideCppArgs = FALSE;
+
+#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
+
+/* start of new stuff.  */
+
+/* Language-dependent contents of a type.  */
+
+struct GTY (()) lang_type
+{
+  char dummy;
+};
+
+/* Language-dependent contents of a decl.  */
+
+struct GTY (()) lang_decl
+{
+  char dummy;
+};
+
+/* Language-dependent contents of an identifier.  This must include a
+   tree_identifier.  */
+
+struct GTY (()) lang_identifier
+{
+  struct tree_identifier common;
+};
+
+/* The resulting tree type.  */
+
+union GTY ((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+            chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), "
+                        "TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN "
+                        "(&%h.generic)) : NULL"))) lang_tree_node
+{
+  union tree_node GTY ((tag ("0"),
+                        desc ("tree_node_structure (&%h)"))) generic;
+  struct lang_identifier GTY ((tag ("1"))) identifier;
+};
+
+struct GTY (()) language_function
+{
+
+  /* While we are parsing the function, this contains information about
+  the statement-tree that we are building.  */
+  /* struct stmt_tree_s stmt_tree;  */
+  tree stmt_tree;
+};
+
+/* Language hooks.  */
+
+bool
+gm2_langhook_init (void)
+{
+  build_common_tree_nodes (false);
+  build_common_builtin_nodes ();
+
+  /* The default precision for floating point numbers.  This is used
+     for floating point constants with abstract type.  This may eventually
+     be controllable by a command line option.  */
+  mpfr_set_default_prec (256);
+
+  /* GNU Modula-2 uses exceptions.  */
+  using_eh_for_cleanups ();
+  return true;
+}
+
+/* The option mask.  */
+
+static unsigned int
+gm2_langhook_option_lang_mask (void)
+{
+  return CL_ModulaX2;
+}
+
+/* Initialize the options structure.  */
+
+static void
+gm2_langhook_init_options_struct (struct gcc_options *opts)
+{
+  /* Default to avoiding range issues for complex multiply and divide.  */
+  opts->x_flag_complex_method = 2;
+
+  /* The builtin math functions should not set errno.  */
+  opts->x_flag_errno_math = 0;
+  opts->frontend_set_flag_errno_math = true;
+
+  /* Exceptions are used.  */
+  opts->x_flag_exceptions = 1;
+  init_FrontEndInit ();
+}
+
+/* Infrastructure for a VEC of bool values.  */
+
+/* This array determines whether the filename is associated with the
+   C preprocessor.  */
+
+static vec<bool> filename_cpp;
+
+void
+gm2_langhook_init_options (unsigned int decoded_options_count,
+                           struct cl_decoded_option *decoded_options)
+{
+  unsigned int i;
+  bool in_cpp_args = false;
+
+  for (i = 1; i < decoded_options_count; i++)
+    {
+      switch (decoded_options[i].opt_index)
+        {
+        case OPT_fcpp_begin:
+          in_cpp_args = true;
+          break;
+        case OPT_fcpp_end:
+          in_cpp_args = false;
+          break;
+        case OPT_SPECIAL_input_file:
+        case OPT_SPECIAL_program_name:
+          filename_cpp.safe_push (in_cpp_args);
+        }
+    }
+  filename_cpp.safe_push (false);
+}
+
+static bool
+is_cpp_filename (unsigned int i)
+{
+  gcc_assert (i < filename_cpp.length ());
+  return filename_cpp[i];
+}
+
+/* Handle gm2 specific options.  Return 0 if we didn't do anything.  */
+
+bool
+gm2_langhook_handle_option (
+    size_t scode, const char *arg, HOST_WIDE_INT value, int kind ATTRIBUTE_UNUSED,
+    location_t loc ATTRIBUTE_UNUSED,
+    const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
+{
+  enum opt_code code = (enum opt_code)scode;
+
+  /* ignore file names.  */
+  if (code == N_OPTS)
+    return 1;
+
+  switch (code)
+    {
+    case OPT_B:
+      M2Options_SetB (arg);
+      return 1;
+    case OPT_c:
+      M2Options_Setc (value);
+      return 1;
+    case OPT_I:
+      if (insideCppArgs)
+        {
+          const struct cl_option *option = &cl_options[scode];
+          const char *opt = (const char *)option->opt_text;
+          M2Options_CppArg (opt, arg, TRUE);
+        }
+      else
+        M2Options_SetSearchPath (arg);
+      return 1;
+    case OPT_fiso:
+      M2Options_SetISO (value);
+      return 1;
+    case OPT_fpim:
+      M2Options_SetPIM (value);
+      return 1;
+    case OPT_fpim2:
+      M2Options_SetPIM2 (value);
+      return 1;
+    case OPT_fpim3:
+      M2Options_SetPIM3 (value);
+      return 1;
+    case OPT_fpim4:
+      M2Options_SetPIM4 (value);
+      return 1;
+    case OPT_fpositive_mod_floor_div:
+      M2Options_SetPositiveModFloor (value);
+      return 1;
+    case OPT_flibs_:
+      /* handled in the gm2 driver.  */
+      return 1;
+    case OPT_fgen_module_list_:
+      M2Options_SetGenModuleList (value, arg);
+      return 1;
+    case OPT_fnil:
+      M2Options_SetNilCheck (value);
+      return 1;
+    case OPT_fwholediv:
+      M2Options_SetWholeDiv (value);
+      return 1;
+    case OPT_findex:
+      M2Options_SetIndex (value);
+      return 1;
+    case OPT_frange:
+      M2Options_SetRange (value);
+      return 1;
+    case OPT_ffloatvalue:
+      M2Options_SetFloatValueCheck (value);
+      return 1;
+    case OPT_fwholevalue:
+      M2Options_SetWholeValueCheck (value);
+      return 1;
+    case OPT_freturn:
+      M2Options_SetReturnCheck (value);
+      return 1;
+    case OPT_fcase:
+      M2Options_SetCaseCheck (value);
+      return 1;
+    case OPT_fd:
+      M2Options_SetCompilerDebugging (value);
+      return 1;
+    case OPT_fdebug_trace_quad:
+      M2Options_SetDebugTraceQuad (value);
+      return 1;
+    case OPT_fdebug_trace_api:
+      M2Options_SetDebugTraceAPI (value);
+      return 1;
+    case OPT_fdebug_function_line_numbers:
+      M2Options_SetDebugFunctionLineNumbers (value);
+      return 1;
+    case OPT_fauto_init:
+      M2Options_SetAutoInit (value);
+      return 1;
+    case OPT_fsoft_check_all:
+      M2Options_SetCheckAll (value);
+      return 1;
+    case OPT_fexceptions:
+      M2Options_SetExceptions (value);
+      return 1;
+    case OPT_Wstyle:
+      M2Options_SetStyle (value);
+      return 1;
+    case OPT_Wpedantic:
+      M2Options_SetPedantic (value);
+      return 1;
+    case OPT_Wpedantic_param_names:
+      M2Options_SetPedanticParamNames (value);
+      return 1;
+    case OPT_Wpedantic_cast:
+      M2Options_SetPedanticCast (value);
+      return 1;
+    case OPT_fextended_opaque:
+      M2Options_SetExtendedOpaque (value);
+      return 1;
+    case OPT_Wverbose_unbounded:
+      M2Options_SetVerboseUnbounded (value);
+      return 1;
+    case OPT_Wunused_variable:
+      M2Options_SetUnusedVariableChecking (value);
+      return 1;
+    case OPT_Wunused_parameter:
+      M2Options_SetUnusedParameterChecking (value);
+      return 1;
+    case OPT_fm2_strict_type:
+      M2Options_SetStrictTypeChecking (value);
+      return 1;
+    case OPT_Wall:
+      M2Options_SetWall (value);
+      return 1;
+#if 0
+    /* Not yet implemented.  */
+    case OPT_fxcode:
+      M2Options_SetXCode (value);
+      return 1;
+#endif
+    case OPT_fm2_lower_case:
+      M2Options_SetLowerCaseKeywords (value);
+      return 1;
+    case OPT_fuse_list_:
+      M2Options_SetUselist (value, arg);
+      return 1;
+    case OPT_fruntime_modules_:
+      M2Options_SetRuntimeModuleOverride (arg);
+      return 1;
+    case OPT_fpthread:
+      /* Handled in the driver.  */
+      return 1;
+    case OPT_fm2_plugin:
+      /* Handled in the driver.  */
+      return 1;
+    case OPT_fscaffold_dynamic:
+      M2Options_SetScaffoldDynamic (value);
+      return 1;
+    case OPT_fscaffold_static:
+      M2Options_SetScaffoldStatic (value);
+      return 1;
+    case OPT_fscaffold_main:
+      M2Options_SetScaffoldMain (value);
+      return 1;
+    case OPT_fcpp:
+      M2Options_SetCpp (value);
+      return 1;
+    case OPT_fcpp_begin:
+      insideCppArgs = TRUE;
+      return 1;
+    case OPT_fcpp_end:
+      insideCppArgs = FALSE;
+      return 1;
+    case OPT_fq:
+      M2Options_SetQuadDebugging (value);
+      return 1;
+    case OPT_fsources:
+      M2Options_SetSources (value);
+      return 1;
+    case OPT_funbounded_by_reference:
+      M2Options_SetUnboundedByReference (value);
+      return 1;
+    case OPT_fdef_:
+      M2Options_setdefextension (arg);
+      return 1;
+    case OPT_fmod_:
+      M2Options_setmodextension (arg);
+      return 1;
+    case OPT_fdump_system_exports:
+      M2Options_SetDumpSystemExports (value);
+      return 1;
+    case OPT_fswig:
+      M2Options_SetSwig (value);
+      return 1;
+    case OPT_fshared:
+      M2Options_SetShared (value);
+      return 1;
+    case OPT_fm2_statistics:
+      M2Options_SetStatistics (value);
+      return 1;
+    case OPT_fm2_g:
+      M2Options_SetM2g (value);
+      return 1;
+    case OPT_O:
+      M2Options_SetOptimizing (value);
+      return 1;
+    case OPT_quiet:
+      M2Options_SetQuiet (value);
+      return 1;
+    case OPT_fm2_whole_program:
+      M2Options_SetWholeProgram (value);
+      return 1;
+    case OPT_flocation_:
+      if (strcmp (arg, "builtins") == 0)
+        {
+          M2Options_SetForcedLocation (BUILTINS_LOCATION);
+          return 1;
+        }
+      else if (strcmp (arg, "unknown") == 0)
+        {
+          M2Options_SetForcedLocation (UNKNOWN_LOCATION);
+          return 1;
+        }
+      else if ((arg != NULL) && (ISDIGIT (arg[0])))
+        {
+          M2Options_SetForcedLocation (atoi (arg));
+          return 1;
+        }
+      else
+        return 0;
+    case OPT_save_temps:
+      M2Options_SetSaveTemps (value);
+      return 1;
+    case OPT_save_temps_:
+      M2Options_SetSaveTempsDir (arg);
+      return 1;
+    default:
+      if (insideCppArgs)
+        {
+          const struct cl_option *option = &cl_options[scode];
+          const char *opt = (const char *)option->opt_text;
+
+          M2Options_CppArg (opt, arg, TRUE);
+          return 1;
+        }
+      return 0;
+    }
+  return 0;
+}
+
+/* Run after parsing options.  */
+
+static bool
+gm2_langhook_post_options (const char **pfilename)
+{
+  const char *filename = *pfilename;
+  flag_excess_precision = EXCESS_PRECISION_FAST;
+  M2Options_SetCC1Quiet (quiet_flag);
+  M2Options_FinaliseOptions ();
+  main_input_filename = filename;
+
+  /* Returning false means that the backend should be used.  */
+  return false;
+}
+
+/* Call the compiler for every source filename on the command line.  */
+
+static void
+gm2_parse_input_files (const char **filenames, unsigned int filename_count)
+{
+  unsigned int i;
+  gcc_assert (filename_count > 0);
+
+  for (i = 0; i < filename_count; i++)
+    if (!is_cpp_filename (i))
+      {
+	main_input_filename = filenames[i];
+	init_PerCompilationInit (filenames[i]);
+      }
+}
+
+static void
+gm2_langhook_parse_file (void)
+{
+  gm2_parse_input_files (in_fnames, num_in_fnames);
+  write_globals ();
+}
+
+static tree
+gm2_langhook_type_for_size (unsigned int bits, int unsignedp)
+{
+  return gm2_type_for_size (bits, unsignedp);
+}
+
+static tree
+gm2_langhook_type_for_mode (machine_mode mode, int unsignedp)
+{
+  tree type;
+
+  for (int i = 0; i < NUM_INT_N_ENTS; i ++)
+    if (int_n_enabled_p[i]
+	&& mode == int_n_data[i].m)
+      return (unsignedp ? int_n_trees[i].unsigned_type
+	      : int_n_trees[i].signed_type);
+
+  if (VECTOR_MODE_P (mode))
+    {
+      tree inner;
+
+      inner = gm2_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp);
+      if (inner != NULL_TREE)
+        return build_vector_type_for_mode (inner, mode);
+      return NULL_TREE;
+    }
+
+  scalar_int_mode imode;
+  if (is_int_mode (mode, &imode))
+    return gm2_langhook_type_for_size (GET_MODE_BITSIZE (imode), unsignedp);
+
+  if (mode == TYPE_MODE (float_type_node))
+    return float_type_node;
+
+  if (mode == TYPE_MODE (double_type_node))
+    return double_type_node;
+
+  if (mode == TYPE_MODE (long_double_type_node))
+    return long_double_type_node;
+
+  if (COMPLEX_MODE_P (mode))
+    {
+      if (mode == TYPE_MODE (complex_float_type_node))
+	return complex_float_type_node;
+      if (mode == TYPE_MODE (complex_double_type_node))
+	return complex_double_type_node;
+      if (mode == TYPE_MODE (complex_long_double_type_node))
+	return complex_long_double_type_node;
+    }
+
+#if HOST_BITS_PER_WIDE_INT >= 64
+  /* The middle-end and some backends rely on TImode being supported
+  for 64-bit HWI.  */
+  if (mode == TImode)
+    {
+      type = build_nonstandard_integer_type (GET_MODE_BITSIZE (TImode),
+                                             unsignedp);
+      if (type && TYPE_MODE (type) == TImode)
+        return type;
+    }
+#endif
+  return NULL_TREE;
+}
+
+/* Record a builtin function.  We just ignore builtin functions.  */
+
+static tree
+gm2_langhook_builtin_function (tree decl)
+{
+  return decl;
+}
+
+/* Return true if we are in the global binding level.  */
+
+static bool
+gm2_langhook_global_bindings_p (void)
+{
+  return current_function_decl == NULL_TREE;
+}
+
+/* Unused langhook.  */
+
+static tree
+gm2_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
+{
+  gcc_unreachable ();
+}
+
+/* This hook is used to get the current list of declarations as trees.
+   We don't support that; instead we use write_globals.  This can't
+   simply crash because it is called by -gstabs.  */
+
+static tree
+gm2_langhook_getdecls (void)
+{
+  return NULL;
+}
+
+/* m2_write_global_declarations writes out globals creating an array
+   of the declarations and calling wrapup_global_declarations.  */
+
+static void
+m2_write_global_declarations (tree globals)
+{
+  auto_vec<tree> global_decls;
+  tree decl = globals;
+  int n = 0;
+
+  while (decl != NULL)
+    {
+      global_decls.safe_push (decl);
+      decl = TREE_CHAIN (decl);
+      n++;
+    }
+  wrapup_global_declarations (global_decls.address (), n);
+}
+
+/* Write out globals.  */
+
+static void
+write_globals (void)
+{
+  tree t;
+  unsigned i;
+
+  m2block_finishGlobals ();
+
+  /* Process all file scopes in this compilation, and the
+     external_scope, through wrapup_global_declarations and
+     check_global_declarations.  */
+  FOR_EACH_VEC_ELT (*all_translation_units, i, t)
+  m2_write_global_declarations (BLOCK_VARS (DECL_INITIAL (t)));
+}
+
+
+/* Gimplify an EXPR_STMT node.  */
+
+static void
+gimplify_expr_stmt (tree *stmt_p)
+{
+  gcc_assert (EXPR_STMT_EXPR (*stmt_p) != NULL_TREE);
+  *stmt_p = EXPR_STMT_EXPR (*stmt_p);
+}
+
+/* Genericize a TRY_BLOCK.  */
+
+static void
+genericize_try_block (tree *stmt_p)
+{
+  tree body = TRY_STMTS (*stmt_p);
+  tree cleanup = TRY_HANDLERS (*stmt_p);
+
+  *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup);
+}
+
+/* Genericize a HANDLER by converting to a CATCH_EXPR.  */
+
+static void
+genericize_catch_block (tree *stmt_p)
+{
+  tree type = HANDLER_TYPE (*stmt_p);
+  tree body = HANDLER_BODY (*stmt_p);
+
+  /* FIXME should the caught type go in TREE_TYPE?  */
+  *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body);
+}
+
+/* Convert the tree representation of FNDECL from m2 frontend trees
+   to GENERIC.  */
+
+extern void pf (tree);
+
+void
+gm2_genericize (tree fndecl)
+{
+  tree t;
+  struct cgraph_node *cgn;
+
+#if 0
+  pf (fndecl);
+#endif
+  /* Fix up the types of parms passed by invisible reference.  */
+  for (t = DECL_ARGUMENTS (fndecl); t; t = DECL_CHAIN (t))
+    if (TREE_ADDRESSABLE (TREE_TYPE (t)))
+      {
+
+        /* If a function's arguments are copied to create a thunk, then
+	   DECL_BY_REFERENCE will be set -- but the type of the argument will be
+	   a pointer type, so we will never get here.  */
+        gcc_assert (!DECL_BY_REFERENCE (t));
+        gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t));
+        TREE_TYPE (t) = DECL_ARG_TYPE (t);
+        DECL_BY_REFERENCE (t) = 1;
+        TREE_ADDRESSABLE (t) = 0;
+        relayout_decl (t);
+      }
+
+  /* Dump all nested functions now.  */
+  cgn = cgraph_node::get_create (fndecl);
+  for (cgn = first_nested_function (cgn);
+       cgn != NULL; cgn = next_nested_function (cgn))
+    gm2_genericize (cgn->decl);
+}
+
+/* gm2 gimplify expression, currently just change THROW in the same
+   way as C++ */
+
+static int
+gm2_langhook_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
+                            gimple_seq *post_p ATTRIBUTE_UNUSED)
+{
+  enum tree_code code = TREE_CODE (*expr_p);
+
+  switch (code)
+    {
+    case THROW_EXPR:
+
+      /* FIXME communicate throw type to back end, probably by moving
+      THROW_EXPR into ../tree.def.  */
+      *expr_p = TREE_OPERAND (*expr_p, 0);
+      return GS_OK;
+
+    case EXPR_STMT:
+      gimplify_expr_stmt (expr_p);
+      return GS_OK;
+
+    case TRY_BLOCK:
+      genericize_try_block (expr_p);
+      return GS_OK;
+
+    case HANDLER:
+      genericize_catch_block (expr_p);
+      return GS_OK;
+
+    default:
+      return GS_UNHANDLED;
+    }
+}
+
+static GTY(()) tree gm2_eh_personality_decl;
+
+static tree
+gm2_langhook_eh_personality (void)
+{
+  if (!gm2_eh_personality_decl)
+    gm2_eh_personality_decl = build_personality_function ("gxx");
+
+  return gm2_eh_personality_decl;
+}
+
+/* Functions called directly by the generic backend.  */
+
+tree
+convert_loc (location_t location, tree type, tree expr)
+{
+  if (type == error_mark_node || expr == error_mark_node
+      || TREE_TYPE (expr) == error_mark_node)
+    return error_mark_node;
+
+  if (type == TREE_TYPE (expr))
+    return expr;
+
+  gcc_assert (TYPE_MAIN_VARIANT (type) != NULL);
+  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
+    return fold_convert (type, expr);
+
+  expr = m2convert_GenericToType (location, type, expr);
+  switch (TREE_CODE (type))
+    {
+    case VOID_TYPE:
+    case BOOLEAN_TYPE:
+      return fold_convert (type, expr);
+    case INTEGER_TYPE:
+      return fold (convert_to_integer (type, expr));
+    case POINTER_TYPE:
+      return fold (convert_to_pointer (type, expr));
+    case REAL_TYPE:
+      return fold (convert_to_real (type, expr));
+    case COMPLEX_TYPE:
+      return fold (convert_to_complex (type, expr));
+    case ENUMERAL_TYPE:
+      return fold (convert_to_integer (type, expr));
+    default:
+      error_at (location, "cannot convert expression, only base types can be converted");
+      break;
+    }
+  return error_mark_node;
+}
+
+/* Functions called directly by the generic backend.  */
+
+tree
+convert (tree type, tree expr)
+{
+  return convert_loc (m2linemap_UnknownLocation (), type, expr);
+}
+
+/* Mark EXP saying that we need to be able to take the address of it;
+   it should not be allocated in a register.  Returns true if
+   successful.  */
+
+bool
+gm2_mark_addressable (tree exp)
+{
+  tree x = exp;
+
+  while (TRUE)
+    switch (TREE_CODE (x))
+      {
+      case COMPONENT_REF:
+	if (DECL_PACKED (TREE_OPERAND (x, 1)))
+	  return false;
+	x = TREE_OPERAND (x, 0);
+	break;
+
+      case ADDR_EXPR:
+      case ARRAY_REF:
+      case REALPART_EXPR:
+      case IMAGPART_EXPR:
+        x = TREE_OPERAND (x, 0);
+        break;
+
+      case COMPOUND_LITERAL_EXPR:
+      case CONSTRUCTOR:
+      case STRING_CST:
+      case VAR_DECL:
+      case CONST_DECL:
+      case PARM_DECL:
+      case RESULT_DECL:
+      case FUNCTION_DECL:
+        TREE_ADDRESSABLE (x) = 1;
+        return true;
+      default:
+        return true;
+      }
+  /* Never reach here.  */
+  gcc_unreachable ();
+}
+
+/* Return an integer type with BITS bits of precision, that is
+   unsigned if UNSIGNEDP is nonzero, otherwise signed.  */
+
+tree
+gm2_type_for_size (unsigned int bits, int unsignedp)
+{
+  tree type;
+
+  if (unsignedp)
+    {
+      if (bits == INT_TYPE_SIZE)
+        type = unsigned_type_node;
+      else if (bits == CHAR_TYPE_SIZE)
+        type = unsigned_char_type_node;
+      else if (bits == SHORT_TYPE_SIZE)
+        type = short_unsigned_type_node;
+      else if (bits == LONG_TYPE_SIZE)
+        type = long_unsigned_type_node;
+      else if (bits == LONG_LONG_TYPE_SIZE)
+        type = long_long_unsigned_type_node;
+      else
+	type = build_nonstandard_integer_type (bits,
+					       unsignedp);
+    }
+  else
+    {
+      if (bits == INT_TYPE_SIZE)
+        type = integer_type_node;
+      else if (bits == CHAR_TYPE_SIZE)
+        type = signed_char_type_node;
+      else if (bits == SHORT_TYPE_SIZE)
+        type = short_integer_type_node;
+      else if (bits == LONG_TYPE_SIZE)
+        type = long_integer_type_node;
+      else if (bits == LONG_LONG_TYPE_SIZE)
+        type = long_long_integer_type_node;
+      else
+	type = build_nonstandard_integer_type (bits,
+					       unsignedp);
+    }
+  return type;
+}
+
+/* Allow the analyzer to understand Storage ALLOCATE/DEALLOCATE.  */
+
+bool
+gm2_langhook_new_dispose_storage_substitution (void)
+{
+  return true;
+}
+
+#undef LANG_HOOKS_NAME
+#undef LANG_HOOKS_INIT
+#undef LANG_HOOKS_INIT_OPTIONS
+#undef LANG_HOOKS_OPTION_LANG_MASK
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#undef LANG_HOOKS_HANDLE_OPTION
+#undef LANG_HOOKS_POST_OPTIONS
+#undef LANG_HOOKS_PARSE_FILE
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#undef LANG_HOOKS_BUILTIN_FUNCTION
+#undef LANG_HOOKS_GLOBAL_BINDINGS_P
+#undef LANG_HOOKS_PUSHDECL
+#undef LANG_HOOKS_GETDECLS
+#undef LANG_HOOKS_GIMPLIFY_EXPR
+#undef LANG_HOOKS_EH_PERSONALITY
+#undef LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION
+
+#define LANG_HOOKS_NAME "GNU Modula-2"
+#define LANG_HOOKS_INIT gm2_langhook_init
+#define LANG_HOOKS_INIT_OPTIONS gm2_langhook_init_options
+#define LANG_HOOKS_OPTION_LANG_MASK gm2_langhook_option_lang_mask
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT gm2_langhook_init_options_struct
+#define LANG_HOOKS_HANDLE_OPTION gm2_langhook_handle_option
+#define LANG_HOOKS_POST_OPTIONS gm2_langhook_post_options
+#define LANG_HOOKS_PARSE_FILE gm2_langhook_parse_file
+#define LANG_HOOKS_TYPE_FOR_MODE gm2_langhook_type_for_mode
+#define LANG_HOOKS_TYPE_FOR_SIZE gm2_langhook_type_for_size
+#define LANG_HOOKS_BUILTIN_FUNCTION gm2_langhook_builtin_function
+#define LANG_HOOKS_GLOBAL_BINDINGS_P gm2_langhook_global_bindings_p
+#define LANG_HOOKS_PUSHDECL gm2_langhook_pushdecl
+#define LANG_HOOKS_GETDECLS gm2_langhook_getdecls
+#define LANG_HOOKS_GIMPLIFY_EXPR gm2_langhook_gimplify_expr
+#define LANG_HOOKS_EH_PERSONALITY gm2_langhook_eh_personality
+#define LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION \
+  gm2_langhook_new_dispose_storage_substitution
+
+struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+
+#include "gt-m2-gm2-lang.h"
+#include "gtype-m2.h"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/19] modula2 front end: changes outside gcc/m2, libgm2 and gcc/testsuite.
  2022-12-10  0:48 [PATCH v4 1/19] modula2 front end: changes outside gcc/m2, libgm2 and gcc/testsuite Gaius Mulley
@ 2022-12-11 10:42 ` Richard Biener
  2022-12-12  9:05   ` Gaius Mulley
  2022-12-14  7:48   ` [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter) Gaius Mulley
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Biener @ 2022-12-11 10:42 UTC (permalink / raw)
  To: Gaius Mulley; +Cc: gcc-patches

On Sat, Dec 10, 2022 at 1:49 AM Gaius Mulley via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
> While writing the ChangeLog entries git gcc-verify spotted an oversight
> with v3 of this patch set.  I had forgotten to post gm2.texi and also a
> tiny patchlet in gcc/configure.ac (to detect Python).  HAVE_PYTHON is
> used within gcc/m2/Make-lang.in to avoid generating the library section
> included by gm2.texi should Python not be available.

The configure check doesn't verify the python version.  Does
--enable-generated-files-in-srcdir (used when building release
tarballs) generate the required section so it's packed up in the
release tarball and avoid requiring python3 when building from the
release tarball?

Note these kind of dependences should be mentioned in
install.texi - for python also listing required modules would be nice.

Thanks,
Richard.

> ok to commit?  I've included gm2-lang.cc and lang.opt for reference.

The python script would have been more informative, the generated
.texi fragment and the Make-lang.in part as well

> regards,
> Gaius
>
>
>
>
> diff -ruw gcc-git-master/gcc/configure.ac gcc-git-devel-modula2/gcc/configure.ac
> --- gcc-git-master/gcc/configure.ac     2022-12-07 20:16:24.571677189 +0000
> +++ gcc-git-devel-modula2/gcc/configure.ac      2022-12-07 19:46:20.036302786 +0000
> @@ -1263,6 +1263,10 @@
>  # Bison?
>  AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
>
> +# Python3?
> +AM_PATH_PYTHON(,, [:])
> +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
> +
>  # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
>  # check for build == host before using them.
>
> @@ -7651,4 +7655,3 @@
>  ],
>  [subdirs='$subdirs'])
>  AC_OUTPUT
> -
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/doc/gm2.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/doc/gm2.texi      2022-12-10 00:04:30.263603238 +0000
> @@ -0,0 +1,2944 @@
> +\input texinfo
> +@c -*-texinfo-*-
> +@c Copyright (C) 2001-2022 Free Software Foundation, Inc.
> +@c This is part of the GM2 manual.
> +
> +@c User level documentation for GNU Modula-2
> +@c
> +@c header
> +
> +@setfilename gm2.info
> +@settitle The GNU Modula-2 Compiler
> +
> +@set version-python  3.5
> +
> +@include gcc-common.texi
> +
> +@c Copyright years for this manual.
> +@set copyrights-gm2 1999-2022
> +
> +@copying
> +@c man begin COPYRIGHT
> +Copyright @copyright{} @value{copyrights-gm2} Free Software Foundation, Inc.
> +
> +Permission is granted to copy, distribute and/or modify this document
> +under the terms of the GNU Free Documentation License, Version 1.3 or
> +any later version published by the Free Software Foundation; with no
> +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
> +A copy of the license is included in the
> +@c man end
> +section entitled ``GNU Free Documentation License''.
> +@ignore
> +@c man begin COPYRIGHT
> +man page gfdl(7).
> +@c man end
> +@end ignore
> +@end copying
> +
> +@ifinfo
> +@format
> +@dircategory Software development
> +@direntry
> +* gm2: (gm2).               A GCC-based compiler for the Modula-2 language
> +@end direntry
> +@end format
> +
> +@insertcopying
> +@end ifinfo
> +
> +@titlepage
> +@title The GNU Modula-2 Compiler
> +@versionsubtitle
> +@author Gaius Mulley
> +
> +@page
> +@vskip 0pt plus 1filll
> +Published by the Free Software Foundation @*
> +51 Franklin Street, Fifth Floor@*
> +Boston, MA 02110-1301, USA@*
> +@sp 1
> +@insertcopying
> +@end titlepage
> +@contents
> +@page
> +
> +@c `Top' Node and Master Menu
> +
> +@node Top, Overview, (dir), (dir)
> +@top Introduction
> +
> +@menu
> +* Overview::         What is GNU Modula-2.
> +* Using::            Using GNU Modula-2.
> +* Licence::          Licence of GNU Modula-2
> +* Copying::          GNU Public Licence V3.
> +* Contributing::     Contributing to GNU Modula-2
> +* Internals::        GNU Modula-2 internals.
> +* EBNF::             EBNF of GNU Modula-2
> +* Libraries::        PIM and ISO library definitions.
> +* Indices::          Document and function indices.
> +@end menu
> +
> +@node Overview, Using, Top, Top
> +@chapter Overview of GNU Modula-2
> +
> +@menu
> +* What is GNU Modula-2::  Brief description of GNU Modula-2.
> +* Why use GNU Modula-2::  Advantages of GNU Modula-2.
> +* News::                  Latest news about GNU Modula-2.
> +* Development::           How to get source code using git.
> +* Obtaining::             Where to get the source code using git.
> +* Features::              GNU Modula-2 Features
> +@end menu
> +
> +@node What is GNU Modula-2, Why use GNU Modula-2, , Using
> +@section What is GNU Modula-2
> +
> +GNU Modula-2 is a @uref{http://gcc.gnu.org/frontends.html, front end}
> +for the GNU Compiler Collection (@uref{http://gcc.gnu.org/, GCC}).
> +The GNU Modula-2 compiler is compliant with the PIM2, PIM3, PIM4 and
> +ISO dialects.  Also implemented are a complete set of free ISO
> +libraries and PIM libraries.
> +
> +@footnote{The four Modula-2 dialects supported are defined in the following
> +references:
> +
> +PIM2: 'Programming in Modula-2', 2nd Edition, Springer Verlag, 1982,
> +1983 by Niklaus Wirth (PIM2).
> +
> +PIM3: 'Programming in Modula-2', 3rd Corrected Edition, Springer Verlag,
> +1985 (PIM3).
> +
> +PIM4: 'Programming in Modula-2', 4th Edition, Springer Verlag, 1988
> +(@uref{http://freepages.modula2.org/report4/modula-2.html, PIM4}).
> +
> +ISO: the ISO Modula-2 language as defined in 'ISO/IEC Information
> +technology - programming languages - part 1: Modula-2 Language,
> +ISO/IEC 10514-1 (1996)'
> +}
> +
> +@node Why use GNU Modula-2, Release map, What is GNU Modula-2, Using
> +@section Why use GNU Modula-2
> +
> +There are a number of advantages of using GNU Modula-2 rather than
> +translate an existing project into another language.
> +
> +The first advantage is of maintainability of the original sources
> +and the ability to debug the original project source code using a
> +combination of gm2 and gdb.
> +
> +The second advantage is that gcc runs on many processors and
> +platforms.  gm2 builds and runs on powerpc64le, amd64, i386, aarch64
> +to name but a few processors.
> +
> +The compiler provides semantic analysis and runtime checking (full ISO
> +Modula-2 checking is implemented) and there is a plugin which can,
> +under certain conditions, detect runtime errors at compile time.
> +
> +gm2 can produce swig interface headers to allow access from Python and
> +other scripting languages.  The compiler supports PIM2, PIM3, PIM4 and
> +ISO dialects of Modula-2, work is underway to implement M2R10.  Many
> +of the GCC builtins are available and access to assembly programming
> +is achieved using the same syntax as that used by GCC.
> +
> +@node Release map, News, Why use GNU Modula-2, Using
> +@section Release map
> +
> +GNU Modula-2 is now part of GCC and therefore will adopt the GCC
> +release schedule with a git branches matching the various GCC release
> +numbers.  It is intended that GNU Modula-2 implement more of the GCC
> +builtins (vararg access) and GCC features.
> +
> +There is an intention to implement the M2R10 dialect of Modula-2 and
> +any of the language changes.  If you wish to see something different
> +please email @email{gm2@@nongnu.org} with your ideas.
> +
> +@node News, Features, Release map, Using
> +@section News
> +
> +@table @code
> +
> +@item gm2 release numbers
> +are now superceded by gcc branch numbers as gm2
> +is tracking the gcc release model.
> +
> +@item accuracy of error messages
> +has been improved and offending subexpressions are now highlighted.
> +
> +@item new type checker
> +has been implemented which will check
> +all data types, including recursive procedure parameter types.
> +
> +@item libraries
> +the gm2 driver program has been enhanced to allow third party
> +libraries to be installed alongside gm2 libraries.  For example if the
> +user specifies library @code{foo} using @code{-flibs=foo} the driver
> +will check the standard GCC install directory for a subdirectory
> +@code{foo}.
> +
> +@item libpth
> +has been removed from gm2 and the coroutines are now implemented using
> +the gcc portable threading library.
> +
> +@item libulm
> +the Ulm libraries have been removed from the gm2 tree as they were not
> +GPL3.
> +
> +@item Talk given at The GNU Tools Cauldron 2018
> +here is a talk on GNU Modula-2 given at
> +@url{https://gcc.gnu.org/wiki/cauldron2018,The GNU Tools Cauldron},
> +Manchester on 8th September 2018.
> +The title is, ``GNU Modula-2 update, catching semantic errors post
> +code optimisation and improved debugging''
> +[@url{https://splendidisolation.ddns.net/Papers/paper23/talk.pdf,slides}
> +and @url{https://www.youtube.com/watch?v=6jf6weRuHjk,video}].
> +
> +@item gm2 1.8.2
> +was released on Aug 30th 2018.  gm2-1.8.2 grafts onto gcc-8.2.0
> +and contains integer overflow detection for addition, subtraction,
> +negation and multiplication.  It also detects and traps when
> +a floating point nan occurs.  This is the first release with the
> +new semantic checking plugin which checks whether any exception
> +will occur post optimization (see -fsoft-check-all).  The compiler
> +also works well with the automake tools.
> +
> +@item gm2 1.2.0
> +was released on May 11th 2017.  gm2-1.2.0 grafts onto gcc-5.2.0 and
> +supports much better line number accuracy in debugging output.
> +Source to code relationship can be further improved by the new option
> +-fm2-g.  -fm2-whole-program also provides whole program optimization.
> +@item Talk given at The GNU Tools Cauldron 2016
> +here is a talk on GNU Modula-2 given at
> +@url{https://gcc.gnu.org/wiki/cauldron2016,The GNU Tools Cauldron},
> +Hebden Bridge on 9th September 2016.
> +The title is, ``GNU Modula-2 status, whole
> +program optimisation and language interoperability''
> +[@url{https://splendidisolation.ddns.net/Papers/paper22/talk.pdf,slides}
> +and @url{https://www.youtube.com/watch?v=8GMyxwHdr1E,video}].
> +@item gm2 1.1.6
> +was released on February 22nd 2016.  gm2-1.1.6 grafts onto gcc-4.7.4.
> +@item gm2 1.1.5
> +was released on September 3 2015, passes all regression tests and has
> +many bug fixes applied.  Arrays and Records can be assigned to and from
> +WORD, LOC, BYTE providing sizes permit.  Also a small number of fixes
> +to the library module MemStream.mod.  Fixed a number of bugs shown by
> +valgrind.
> +@item gm2 1.1.3
> +was released on April 15 2015.  gm2-1.1.3 passes all regression
> +tests on Debian Wheezy (x86_64) and (i686).  Also passes all regression tests
> +under Debian Jessie (x86_64).  It also builds on armv7l Ubuntu Trusty Tahr.
> +@item gm2 1.1.1
> +was released on January 26 2015.  gm2-1.1.1 passes all regression
> +tests on Debian Wheezy (x86_64) and (i686).  Also passes all regression tests
> +under Debian Jessie (x86_64).
> +@item gm2 1.1.0
> +was released on January 02 2015.  gm2-1.1.0 passes all regression
> +tests on Debian Wheezy (x86_64) and (i686).
> +@item gm2 1.0.9
> +Beta was released on September 23 2014, all regressions passed on
> +x86_64 Debian Wheezy.
> +@item gm2 1.0.4
> +was released on September 30 2011.  This is a bug fix release.
> +@item gm2 1.0
> +was released on December 11 2010.
> +@end table
> +
> +@node Development, Obtaining, News, Using
> +@section How to get source code using git
> +
> +GNU Modula-2 is in the process of migrating into the
> +@url{https://gcc.gnu.org/git.html, GCC git tree}.  The development
> +branch is available via git:
> +
> +@example
> +$ git clone git://gcc.gnu.org/git/gcc.git gcc-git-devel-modula2
> +$ cd gcc-git-devel-modula2
> +$ git checkout devel/modula-2
> +$ cd ..
> +@end example
> +
> +@node Obtaining, Features, Development, Using
> +
> +GNU Modula-2 is in the process of migrating into the
> +@url{https://gcc.gnu.org/git.html, GCC git tree}.
> +@xref{Development, , ,gm2} section in this GM2 documentation for git
> +details and @xref{Downloading the source, , ,gcc} in the GCC
> +documentation.
> +
> +@node Features, Documentation, News, Using
> +@section GNU Modula-2 Features
> +
> +@itemize @bullet
> +
> +@item
> +the compiler currently complies with Programming in Modula-2 Edition
> +2, 3, 4 and ISO Modula-2.  Users can switch on specific language
> +features by using: @samp{-fpim}, @samp{-fpim2}, @samp{-fpim3},
> +@samp{-fpim4} or @samp{-fiso}.
> +
> +@item
> +the option @samp{-fswig} will automatically create a swig interface
> +file which corresponds to the definition module of the file being
> +compiled.
> +
> +@item
> +exception handling is compatible with C++ and swig.  Modula-2 code can
> +be used with C or C++ code.
> +
> +@item
> +Python can call GNU Modula-2 modules via swig.
> +
> +@item
> +shared libraries can be built.
> +
> +@item
> +fixed sized types are now available from @samp{SYSTEM}.
> +
> +@item
> +support for dynamic @code{ARRAY}s has been added into @samp{gdb}.
> +
> +@item
> +variables can be declared at addresses.
> +
> +@item
> +much better dwarf-2 debugging support and when used with
> +@samp{gdb} the programmer can display @code{RECORD}s,
> +@code{ARRAY}s, @code{SET}s, subranges and constant char literals
> +in Modula-2 syntax.
> +
> +@item
> +supports sets of any ordinal size (memory permitting).
> +
> +@item
> +easy interface to C, and varargs can be passed to C routines.
> +
> +@item
> +many Logitech libraries have been implemented and can be accessed via:
> +@samp{-flibs=m2log,m2pim,m2iso}.
> +
> +@item
> +coroutines have been implemented in the PIM style and these are
> +accessible from SYSTEM. A number of supporting libraries (executive
> +and file descriptor mapping to interrupt vector libraries are
> +available through the @samp{-flibs=m2iso,m2pim} switch).
> +
> +@item
> +can be built as a cross compiler (for embedded microprocessors
> +such as the AVR and the ARM).
> +
> +@end itemize
> +
> +@node Documentation, Regression tests, Features, Using
> +@section Documentation
> +
> +The GNU Modula-2 documentation is available on line
> +@url{https://www.nongnu.org/gm2/homepage.html,at the gm2 homepage}
> +or in the pdf, info, html file format.
> +
> +@node Regression tests, Limitations, Documentation, Using
> +@section Regression tests for gm2 in the repository
> +
> +The regression testsuite can be run from the gcc build directory:
> +
> +@example
> +$ cd build-gcc
> +$ make check -j 24
> +@end example
> +
> +which runs the complete testsuite for all compilers using 24 parallel
> +invocations of the compiler.  Individual language testsuites can be
> +run by specifying the language, for example the Modula-2 testsuite can
> +be run using:
> +
> +@example
> +$ cd build-gcc
> +$ make check-m2 -j 24
> +@end example
> +
> +Finally the results of the testsuite can be emailed to the
> +@url{https://gcc.gnu.org/lists.html, gcc-testresults} list using the
> +script:
> +
> +@example
> +$ @file{gccsrcdir/contrib/test_summary}
> +@end example
> +
> +@node Limitations, Objectives, Regression tests, Using
> +@section Limitations
> +
> +Logitech compatibility library is incomplete.  The principle modules
> +for this platform exist however for a comprehensive list of completed
> +modules please check the documentation
> +@url{gm2.html}.
> +
> +@node Objectives, FAQ, , Using
> +@section Objectives
> +
> +@itemize @bullet
> +
> +@item
> +The intention of GNU Modula-2 is to provide a production Modula-2
> +front end to GCC.
> +
> +@item
> +It should support all Niklaus Wirth PIM Dialects [234] and also ISO
> +Modula-2 including a reimplementation of all the ISO modules.
> +
> +@item
> +There should be an easy interface to C.
> +
> +@item
> +Exploit the features of GCC.
> +
> +@item
> +Listen to the requests of the users.
> +@end itemize
> +
> +@node FAQ, Community, Objectives, Using
> +@section FAQ
> +
> +@subsection Why use the C++ exception mechanism in GCC, rather than a bespoke Modula-2 mechanism?
> +
> +The C++ mechanism is tried and tested, it also provides GNU Modula-2
> +with the ability to link with C++ modules and via swig it can raise
> +Python exceptions.
> +
> +@node Community, Other languages, FAQ, Using
> +@section Community
> +
> +You can subscribe to the GNU Modula-2 mailing by sending an
> +email to:
> +@email{gm2-subscribe@@nongnu.org}
> +or by
> +@url{http://lists.nongnu.org/mailman/listinfo/gm2}.
> +The mailing list contents can be viewed
> +@url{http://lists.gnu.org/archive/html/gm2}.
> +
> +@node Other languages, , Community, Using
> +@section Other languages for GCC
> +
> +These exist and can be found on the frontends web page on the
> +@uref{http://gcc.gnu.org/frontends.html, gcc web site}.
> +
> +@node Using, , Community, Top
> +@chapter Using GNU Modula-2
> +
> +@menu
> +* Example usage::         Example compile and link.
> +* Compiler options::      GNU Modula-2 compiler options.
> +* Linking::               Linking options in more detail.
> +* Elementary data types:: Data types supported by GNU Modula-2.
> +* Standard procedures::   Permanently accessible base procedures.
> +* Dialect::               GNU Modula-2 supported dialects.
> +* Exceptions::            Exception implementation
> +* Semantic checking::     How to detect runtime problems at compile time.
> +* Extensions::            GNU Modula-2 language extensions.
> +* Type compatibility::    Data type compatibility.
> +* Unbounded by reference::Explanation of a language optimization.
> +* Building a shared library:: How to build a shared library.
> +* Interface for Python::  How to produce swig interface files.
> +* Producing a Python module::  How to produce a Python module.
> +* Interface to C::        Interfacing GNU Modula-2 to C.
> +* Assembly language::     Interface to assembly language.
> +* Alignment::             Data type alignment.
> +* Packed::                Packing data types.
> +* Built-ins::             Accessing GNU Modula-2 Built-ins.
> +* The PIM system module:: SYSTEM data types and procedures.
> +* The ISO system module:: SYSTEM data types, procedures and run time.
> +* Other languages::       Other languages for GCC.
> +* What is GNU Modula-2::  Brief description of GNU Modula-2.
> +* Why use GNU Modula-2::  Advantages of GNU Modula-2.
> +@ifnothtml
> +@c omit these nodes if generating gm2 webpage as these are hand written.
> +* Release map:: Release map.
> +* News:: News.
> +* Development:: Development.
> +* Obtaining:: How to Obtain GNU Modula-2.
> +* Features:: Features of the implementation.
> +* Documentation:: Placeholder for how to access the documentation online.
> +* Regression tests:: How to run the testsuite.
> +* Limitations:: Current limitations.
> +* Objectives:: Objectives of the implementation.
> +* FAQ:: Frequently asked questions.
> +* Community:: How to join the community.
> +@end ifnothtml
> +@end menu
> +
> +This document contains the user and design issues relevant to the
> +Modula-2 front end to gcc.
> +
> +@node Example usage, Compiler options, Using, Using
> +@section Example compile and link
> +
> +@ignore
> +@c man begin SYNOPSIS gm2
> +gm2 [@option{-c}|@option{-S}] [@option{-g}] [@option{-pg}]
> +    [@option{-O}@var{level}] [@option{-W}@var{warn}@dots{}]
> +    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
> +    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
> +    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
> +
> +Only the most useful options are listed here; see below for the
> +remainder.
> +@c man end
> +@c man begin SEEALSO
> +gpl(7), gfdl(7), fsf-funding(7), gcc(1)
> +and the Info entries for @file{gm2} and @file{gcc}.
> +@c man end
> +@end ignore
> +
> +@c man begin DESCRIPTION gm2
> +
> +The @command{gm2} command is the GNU compiler for the Modula-2 language and
> +supports many of the same options as @command{gcc}.  @xref{Option Summary, ,
> +Option Summary, gcc, Using the GNU Compiler Collection (GCC)}.
> +This manual only documents the options specific to @command{gm2}.
> +
> +@c man end
> +
> +This section describes how to compile and link a simple hello world
> +program.  It provides a few examples of using the different options
> +mentioned in @pxref{Compiler options, , ,gm2}.  Assuming that you have
> +a file called @file{hello.mod} in your current directory which
> +contains:
> +
> +@example
> +MODULE hello ;
> +
> +FROM StrIO IMPORT WriteString, WriteLn ;
> +
> +BEGIN
> +   WriteString('hello world') ; WriteLn
> +END hello.
> +@end example
> +
> +You can compile and link it by: @samp{gm2 -g hello.mod}.
> +The result will be an @samp{a.out} file created in your directory.
> +
> +You can split this command into two steps if you prefer.  The compile
> +step can be achieved by: @samp{gm2 -g -c -fscaffold-main hello.mod}
> +and the link via: @samp{gm2 -g hello.o}.
> +
> +@footnote{To see all the compile actions taken by @samp{gm2} users can also
> +add the @samp{-v} flag at the command line, for example:
> +
> +@samp{gm2 -v -g -I. hello.mod}
> +
> +This displays the subprocesses initiated by @samp{gm2} which can be useful
> +when trouble shooting.}
> +
> +@node Compiler options, Elementary data types, Example usage, Using
> +@section Compiler options
> +
> +This section describes the compiler options specific to GNU Modula-2
> +for generic flags details @xref{Invoking GCC, , ,gcc}.
> +
> +@c man begin OPTIONS
> +
> +For any given input file, the file name suffix determines what kind of
> +compilation is done.  The following kinds of input file names are supported:
> +
> +@table @gcctabopt
> +@item @var{file}.mod
> +Modula-2 implementation or program source files.  See the
> +@samp{-fmod=} option if you wish to compile a project which uses a
> +different source file extension.
> +@item @var{file}.def
> +Modula-2 definition module source files.  Definition modules are not
> +compiled separately, in GNU Modula-2 definition modules are parsed as
> +required when program or implementation modules are compiled.  See the
> +@samp{-fdef=} option if you wish to compile a project which uses a
> +different source file extension.
> +@end table
> +
> +You can specify more than one input file on the @command{gm2} command line,
> +
> +@table @code
> +
> +@item -g
> +create debugging information so that debuggers such as @file{gdb}
> +can inspect and control executables.
> +
> +@item -I
> +used to specify the search path for definition and implementation
> +modules.  An example is:  @code{gm2 -g -c -I.:../../libs foo.mod}.
> +If this option is not specified then the default path is added
> +which consists of the current directory followed by the appropriate
> +language dialect library directories.
> +
> +@c ordered list of options from here.
> +
> +@item -fauto-init
> +turns on auto initialization of pointers to NIL.  Whenever a block is
> +created all pointers declarated within this scope will have their
> +addresses assigned to NIL.
> +
> +@item -fbounds
> +turns on runtime subrange, array index and indirection via @code{NIL}
> +pointer checking.
> +
> +@item -fcase
> +turns on compile time checking to check whether a @code{CASE}
> +statement requires an @code{ELSE} clause when on was not specified.
> +
> +@item -fcpp
> +preprocess the source with @samp{cpp -lang-asm -traditional-cpp}
> +For further details about these options @xref{Invocation, , ,cpp}.
> +If @samp{-fcpp} is supplied then all definition modules and
> +implementation modules which are parsed will be preprocessed by
> +@samp{cpp}.
> +
> +@c fcpp-end
> +@c Modula-2
> +@c passed to the preprocessor if -fcpp is used (internal switch)
> +
> +@c fcpp-begin
> +@c Modula-2
> +@c passed to the preprocessor if -fcpp is used (internal switch)
> +
> +@item -fdebug-builtins
> +call a real function, rather than the builtin equivalent.  This can
> +be useful for debugging parameter values to a builtin function as
> +it allows users to single step code into a real function.
> +
> +@c fd
> +@c Modula-2
> +@c turn on internal debugging of the compiler (internal switch)
> +
> +@c fdebug-trace-quad
> +@c Modula-2
> +@c turn on quadruple tracing (internal switch)
> +
> +@c fdebug-trace-api
> +@c Modula-2
> +@c turn on the Modula-2 api tracing (internal switch)
> +
> +@c fdebug-function-line-numbers
> +@c Modula-2
> +@c turn on the Modula-2 function line number generation (internal switch)
> +
> +@item -fdef=
> +recognise the specified suffix as a definition module filename.
> +The default implmentation and module filename suffix is @file{.def}.
> +If this option is used GNU Modula-2 will still fall back to this
> +default if a requested definition module is not found.
> +
> +@item -fdump-system-exports
> +display all inbuilt system items.
> +This is an internal command line option.
> +
> +@item -fexceptions
> +turn on exception handling code.  By default this option is on.
> +Exception handling can be disabled by @samp{-fno-exceptions}
> +and no references are made to the runtime exception libraries.
> +
> +@item -fextended-opaque
> +allows opaque types to be implemented as any type. This is a GNU
> +Modula-2 extension and it requires that the implementation module
> +defining the opaque type is available so that it can be resolved when
> +compiling the module which imports the opaque type.
> +
> +@item -ffloatvalue
> +turns on runtime checking to check whether a floating point number is
> +about to exceed range.
> +
> +@item -fgen-module-list=@file{filename}
> +attempt to find all modules when linking and generate a module list.
> +If the @file{filename} is @samp{-} then the contents are not written
> +and only used to force the linking of all module ctors.
> +This option cannot be used if @samp{-fuse-list=} is enabled.
> +
> +@item -findex
> +generate code to check whether array index values are out of bounds.
> +Array index checking can be disabled via @samp{-fno-index}.
> +
> +@item -fiso
> +turn on ISO standard features. Currently this enables the ISO
> +@code{SYSTEM} module and alters the default library search path so
> +that the ISO libraries are searched before the PIM libraries.  It also
> +effects the behaviour of @code{DIV} and @code{MOD} operators.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -flibs=
> +modifies the default library search path.  The libraries supplied are:
> +m2pim, m2iso, m2min, m2log and m2cor.  These map onto the
> +Programming in Modula-2 base libraries, ISO standard libraries, minimal
> +library support, Logitech compatible library and Programming in
> +Modula-2 with coroutines.
> +Multiple libraries can be specified and are comma separated with precidence
> +going to the first in the list.  It is not necessary to use -flibs=m2pim or
> +-flibs=m2iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or
> +-fiso.  Unless you are using -flibs=m2min you should include m2pim as
> +the they provide the base modules which all other dialects utilize.
> +The option @samp{-fno-libs=-} disables the @samp{gm2} driver from
> +modifying the search and library paths.
> +
> +@c flocation=
> +@c Modula-2 Joined
> +@c set all location values to a specific value (internal switch)
> +
> +@item -fm2-g
> +improve the debugging experience for new programmers at the expense
> +of generating @code{nop} instructions if necessary to ensure single
> +stepping precision over all code related keywords.  An example
> +of this is in termination of a list of nested @code{IF} statements
> +where multiple @code{END} keywords are mapped onto a sequence of
> +@code{nop} instructions.
> +
> +@item -fm2-lower-case
> +render keywords in error messages using lower case.
> +
> +@item -fm2-plugin
> +insert plugin to identify runtime errors at compiletime (default on).
> +
> +@item -fm2-statistics
> +generates quadruple information: number of quadruples generated,
> +number of quadruples remaining after optimisation and number of source
> +lines compiled.
> +
> +@item -fm2-strict-type
> +experimental flag to turn on the new strict type checker.
> +
> +@item -fm2-whole-program
> +compile all implementation modules and program module at once.  Notice
> +that you need to take care if you are compiling different dialect
> +modules (particularly with the negative operands to modulus).  But
> +this option, when coupled together with @code{-O3}, can deliver huge
> +performance improvements.
> +
> +@item -fmod=
> +recognise the specified suffix as implementation and module filenames.
> +The default implmentation and module filename suffix is @file{.mod}.
> +If this option is used GNU Modula-2 will still fall back to this
> +default if it needs to read an implmentation module and the specified
> +suffixed filename does not exist.
> +
> +@item -fnil
> +generate code to detect accessing data through a @code{NIL} value
> +pointer.  Dereferencing checking through a @code{NIL} pointer can be
> +disabled by @samp{-fno-nil}.
> +
> +@item -fpim
> +turn on PIM standard features. Currently this enables the PIM
> +@code{SYSTEM} module and determines which identifiers are pervasive
> +(declared in the base module). If no other @samp{-fpim[234]} switch is
> +used then division and modulus operators behave as defined in PIM4.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -fpim2
> +turn on PIM-2 standard features. Currently this removes @code{SIZE}
> +from being a pervasive identifier (declared in the base module).  It
> +places @code{SIZE} in the @code{SYSTEM} module.  It also effects the
> +behaviour of @code{DIV} and @code{MOD} operators.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -fpim3
> +turn on PIM-3 standard features. Currently this only effects the
> +behaviour of @code{DIV} and @code{MOD} operators.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -fpim4
> +turn on PIM-4 standard features. Currently this only effects the
> +behaviour of @code{DIV} and @code{MOD} operators.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -fpositive-mod-floor-div
> +forces the @code{DIV} and @code{MOD} operators to behave as defined by PIM4.
> +All modulus results are positive and the results from the division are
> +rounded to the floor.
> +@xref{Dialect, , ,gm2}.
> +
> +@item -fpthread
> +link against the pthread library.  By default this option is on.  It
> +can be disabled by @samp{-fno-pthread}.  GNU Modula-2 uses the GCC
> +pthread libraries to implement coroutines (see the SYSTEM
> +implementation module).
> +
> +@c -fq
> +@c -Modula-2
> +@c -internal compiler debugging information, dump the list of quadruples
> +
> +@item -frange
> +generate code to check the assignment range, return value range
> +set range and constructor range.  Range checking can be disabled
> +via @samp{-fno-range}.
> +
> +@item -freturn
> +generate code to check that functions always exit with a @code{RETURN}
> +and do not fall out at the end.  Return checking can be disabled
> +via @samp{-fno-return}.
> +
> +@item -fruntime-modules=
> +specify, using a comma separated list, the runtime modules and their
> +order.  These modules will initialized first before any other modules
> +in the application dependency.  By default the runtime modules list is
> +set to @code{Storage,SYSTEM,M2RTS,RTExceptions,IOLink}.  Note that
> +these modules will only be linked into your executable if they are
> +required.  So adding a long list of dependant modules will not effect
> +the size of the executable it merely states the initialization order
> +should they be required.
> +
> +@item -fscaffold-dynamic
> +the option ensures that @samp{gm2} will generate a dynamic scaffold
> +infastructure when compiling implementation and program modules.
> +By default this option is on.  Use @samp{-fno-scaffold-dynamic}
> +to turn it off or select @samp{-fno-scaffold-static}.
> +
> +@item -fscaffold-c
> +generate a C source scaffold for the current module being compiled.
> +
> +@item -fscaffold-c++
> +generate a C++ source scaffold for the current module being compiled.
> +
> +@item -fscaffold-main
> +force the generation of the @samp{main} function.  This is not
> +necessary if the @samp{-c} is omitted.
> +
> +@item -fscaffold-static
> +the option ensures that @samp{gm2} will generate a static scaffold
> +within the program module.  The static scaffold consists of sequences
> +of calls to all dependent module initialization and finalialization
> +procedures.  The static scaffold is useful for debugging and single
> +stepping the initialization blocks of implementation modules.
> +
> +@item -fshared
> +generate a shared library from the module.
> +
> +@item -fsoft-check-all
> +turns on all runtime checks.  This is the same as invoking
> +GNU Modula-2 using the command options
> +@code{-fnil} @code{-frange} @code{-findex}
> +@code{-fwholevalue}
> +@code{-fwholediv} @code{-fcase} @code{-freturn}.
> +
> +@item -fsources
> +displays the path to the source of each module.  This option
> +can be used at compile time to check the correct definition module
> +is being used.
> +
> +@item -fswig
> +generate a swig interface file.
> +
> +@item -funbounded-by-reference
> +enable optimization of unbounded parameters by attempting to pass non
> +@code{VAR} unbounded parameters by reference.  This optimization
> +avoids the implicit copy inside the callee procedure. GNU Modula-2
> +will only allow unbounded parameters to be passed by reference if,
> +inside the callee procedure, they are not written to, no address is
> +calculated on the array and it is not passed as a @code{VAR}
> +parameter.  Note that it is possible to write code to break this
> +optimization, therefore this option should be used carefully.
> +For example it would be possible to take the address of an array, pass
> +the address and the array to a procedure, read from the array in
> +the procedure and write to the location using the address parameter.
> +
> +Due to the dangerous nature of this option it is not enabled
> +when the @samp{-O} option is specified.
> +
> +@item -fuse-list=@file{filename}
> +if @samp{-fscaffold-static} is enabled then use the file
> +@file{filename} for the initialization order of modules.  Whereas if
> +@samp{-fscaffold-dynamic} is enabled then use this file to force
> +linking of all module ctors.
> +This option cannot be used if @samp{-fgen-module-list=} is enabled.
> +
> +@item -fwholediv
> +generate code to detect whole number division by zero or modulus by
> +zero.
> +
> +@item -fwholevalue
> +generate code to detect whole number overflow and underflow.
> +
> +@c the following warning options are complete but need to be
> +@c regression tested against all other front ends
> +@c to ensure the options do not conflict.
> +
> +@c @item -Wall
> +@c turn on all Modula-2 warnings.
> +
> +@c @item -Wpedantic
> +@c forces the compiler to reject nested @code{WITH} statements
> +@c referencing the same record type.  Does not allow multiple imports of
> +@c the same item from a module.  It also checks that: procedure variables
> +@c are written to before being read; variables are not only written to
> +@c but read from; variables are declared and used.  If the compiler
> +@c encounters a variable being read before written it will terminate with
> +@c a message.  It will check that @code{FOR} loop indices are not used
> +@c outside the end of this loop without being reset.
> +
> +@c @item -Wpedantic-cast
> +@c warns if the ISO system function is used and if the size of
> +@c the variable is different from that of the type.  This is legal
> +@c in ISO Modula-2, however it can be dangerous.  Some users may prefer
> +@c to use @code{VAL} instead in these situations and use @code{CAST}
> +@c exclusively for changes in type on objects which have the same size.
> +
> +@c @item -Wpedantic-param-names
> +@c procedure parameter names are checked in the definition module
> +@c against their implementation module counterpart.  This is not
> +@c necessary in ISO or PIM versions of Modula-2.
> +
> +@c @item -Wstyle
> +@c checks for poor programming style.  This option is aimed at new users of
> +@c Modula-2 in that it checks for situations which might cause confusion
> +@c and thus mistakes.  It checks whether variables of the same name are
> +@c declared in different scopes and whether variables look like keywords.
> +@c Experienced users might find this option too aggressive.
> +
> +@c @item -Wunused-variable
> +@c warns if a variable has been declared and it not used.
> +
> +@c @item -Wunused-parameter
> +@c warns if a parameter has been declared and it not used.
> +
> +@c @item -Wverbose-unbounded
> +@c inform the user which non @code{VAR} unbounded parameters will be
> +@c passed by reference.  This only produces output if the option
> +@c @samp{-funbounded-by-reference} is also supplied on the command line.
> +
> +@end table
> +
> +@c man end
> +
> +@node Elementary data types, Standard procedures, Compiler options, Using
> +@section Elementary data types
> +
> +This section describes the elementary data types supported by GNU
> +Modula-2. It also describes the relationship between these data types
> +and the equivalent C data types.
> +
> +The following data types are supported: @code{INTEGER},
> +@code{LONGINT}, @code{SHORTINT}, @code{CARDINAL}, @code{LONGCARD},
> +@code{SHORTCARD}, @code{BOOLEAN}, @code{REAL}, @code{LONGREAL},
> +@code{SHORTREAL}, @code{COMPLEX}, @code{LONGCOMPLEX},
> +@code{SHORTCOMPLEX} and @code{CHAR}.
> +
> +An equivalence table is given below:
> +
> +@example
> +GNU Modula-2              GNU C
> +======================================
> +INTEGER                   int
> +LONGINT                   long long int
> +SHORTINT                  short int
> +CARDINAL                  unsigned int
> +LONGCARD                  long long unsigned int
> +SHORTCARD                 short unsigned int
> +BOOLEAN                   int
> +REAL                      double
> +LONGREAL                  long double
> +SHORTREAL                 float
> +CHAR                      char
> +SHORTCOMPLEX              complex float
> +COMPLEX                   complex double
> +LONGCOMPLEX               complex long double
> +@end example
> +
> +Note that GNU Modula-2 also supports fixed sized data types which are
> +exported from the @code{SYSTEM} module.
> +@xref{The PIM system module, , ,gm2}.
> +@xref{The ISO system module, , ,gm2}.
> +
> +@node Standard procedures, Dialect, Elementary data types, Using
> +@section Permanently accessible base procedures.
> +
> +This section describes the procedures and functions which are
> +always visible.
> +
> +@subsection Standard procedures and functions common to PIM and ISO
> +
> +The following procedures are implemented and conform with Programming
> +in Modula-2 and ISO Modula-2: @code{NEW}, @code{DISPOSE}, @code{INC},
> +@code{DEC}, @code{INCL}, @code{EXCL} and @code{HALT}.  The standard
> +functions are: @code{ABS}, @code{CAP}, @code{CHR}, @code{FLOAT},
> +@code{HIGH}, @code{LFLOAT}, @code{LTRUNC}, @code{MIN}, @code{MAX},
> +@code{ODD}, @code{SFLOAT}, @code{STRUNC} @code{TRUNC} and
> +@code{VAL}. All these functions and procedures (except @code{HALT},
> +@code{NEW}, @code{DISPOSE} and, under non constant conditions,
> +@code{LENGTH}) generate in-line code for efficiency.
> +
> +@example
> +
> +(*
> +   ABS - returns the positive value of i.
> +*)
> +
> +@findex ABS
> +PROCEDURE ABS (i: <any signed type>) : <any signed type> ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   CAP - returns the capital of character ch providing
> +         ch lies within the range 'a'..'z'. Otherwise ch
> +         is returned unaltered.
> +*)
> +
> +@findex CAP
> +PROCEDURE CAP (ch: CHAR) : CHAR ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   CHR - converts a value of a <whole number type> into a CHAR.
> +         CHR(x) is shorthand for VAL(CHAR, x).
> +*)
> +
> +@findex CHR
> +PROCEDURE CHR (x: <whole number type>) : CHAR ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   DISPOSE - the procedure DISPOSE is replaced by:
> +             DEALLOCATE(p, TSIZE(p^)) ;
> +             The user is expected to import the procedure DEALLOCATE
> +             (normally found in the module, Storage.)
> +
> +             In:  a variable p: of any pointer type which has been
> +                  initialized by a call to NEW.
> +             Out: the area of memory
> +                  holding p^ is returned to the system.
> +                  Note that the underlying procedure DEALLOCATE
> +                  procedure in module Storage will assign p to NIL.
> +*)
> +
> +@findex DISPOSE
> +PROCEDURE DISPOSE (VAR p:<any pointer type>) ;
> +@end example
> +
> +@example
> +
> +(*
> +   DEC - can either take one or two parameters.  If supplied
> +         with one parameter then on the completion of the call to
> +         DEC, v will have its predecessor value.  If two
> +         parameters are supplied then the value v will have its
> +         n'th predecessor.  For these reasons the value of n
> +         must be >=0.
> +*)
> +
> +@findex DEC
> +PROCEDURE DEC (VAR v: <any base type>; [n: <any base type> = 1]) ;
> +@end example
> +
> +@example
> +
> +(*
> +   EXCL - excludes bit element e from a set type s.
> +*)
> +
> +@findex EXCL
> +PROCEDURE EXCL (VAR s: <any set type>; e: <element of set type s>) ;
> +@end example
> +
> +@example
> +
> +(*
> +   FLOAT - will return a REAL number whose value is the same as o.
> +*)
> +
> +@findex FLOAT
> +PROCEDURE FLOAT (o: <any whole number type>) : REAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   FLOATS - will return a SHORTREAL number whose value is the same as o.
> +*)
> +
> +@findex FLOATS
> +PROCEDURE FLOATS (o: <any whole number type>) : REAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   FLOATL - will return a LONGREAL number whose value is the same as o.
> +*)
> +
> +@findex FLOATL
> +PROCEDURE FLOATL (o: <any whole number type>) : REAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   HALT - will call the HALT procedure inside the module M2RTS.
> +          Users can replace M2RTS.
> +*)
> +
> +@findex HALT
> +PROCEDURE HALT ;
> +@end example
> +
> +@example
> +
> +(*
> +   HIGH - returns the last accessible index of an parameter declared as
> +          ARRAY OF CHAR. Thus
> +
> +          PROCEDURE foo (a: ARRAY OF CHAR) ;
> +          VAR
> +             c: CARDINAL ;
> +          BEGIN
> +             c := HIGH(a)
> +          END foo ;
> +
> +          BEGIN
> +             foo('hello')
> +          END
> +
> +          will cause the local variable c to contain the value 4
> +*)
> +
> +@findex HIGH
> +PROCEDURE HIGH (a: ARRAY OF CHAR) : CARDINAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   INC - can either take one or two parameters.  If supplied
> +         with one parameter then on the completion of the call to
> +         INC, v will have its successor value.  If two
> +         parameters are supplied then the value v will have its
> +         n'th successor.  For these reasons the value of n
> +         must be >=0.
> +*)
> +
> +@findex INC
> +PROCEDURE INC (VAR v: <any base type>; [n: <any base type> = 1]) ;
> +@end example
> +
> +@example
> +
> +(*
> +   INCL - includes bit element e to a set type s.
> +*)
> +
> +@findex INCL
> +PROCEDURE INCL (VAR s: <any set type>; e: <element of set type s>) ;
> +@end example
> +
> +@example
> +
> +(*
> +   LFLOAT - will return a LONGREAL number whose value is the same as o.
> +*)
> +
> +@findex LFLOAT
> +PROCEDURE LFLOAT (o: <any whole number type>) : LONGREAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   LTRUNC - will return a LONG<type> number whose value is the
> +            same as o.  PIM2, PIM3 and ISO Modula-2 will return
> +            a LONGCARD whereas PIM4 returns LONGINT.
> +*)
> +
> +@findex LTRUNC
> +PROCEDURE LTRUNC (o: <any floating point type>) : LONG<type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   MIN - returns the lowest legal value of an ordinal type.
> +*)
> +
> +@findex MIN
> +PROCEDURE MIN (t: <ordinal type>) : <ordinal type> ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   MAX - returns the largest legal value of an ordinal type.
> +*)
> +
> +@findex MAX
> +PROCEDURE MAX (t: <ordinal type>) : <ordinal type> ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   NEW - the procedure NEW is replaced by:
> +         ALLOCATE(p, TSIZE(p^)) ;
> +         The user is expected to import the procedure ALLOCATE
> +         (normally found in the module, Storage.)
> +
> +         In:  a variable p: of any pointer type.
> +         Out: variable p is set to some allocated memory
> +              which is large enough to hold all the contents of p^.
> +*)
> +
> +@findex NEW
> +PROCEDURE NEW (VAR p:<any pointer type>) ;
> +@end example
> +
> +@example
> +
> +(*
> +   ODD - returns TRUE if the value is not divisible by 2.
> +*)
> +
> +@findex ODD
> +PROCEDURE ODD (x: <whole number type>) : BOOLEAN ;
> +
> +@end example
> +
> +@example
> +
> +(*
> +   SFLOAT - will return a SHORTREAL number whose value is the same
> +            as o.
> +*)
> +
> +@findex SFLOAT
> +PROCEDURE SFLOAT (o: <any whole number type>) : SHORTREAL ;
> +@end example
> +
> +@example
> +
> +(*
> +   STRUNC - will return a SHORT<type> number whose value is the same
> +            as o.  PIM2, PIM3 and ISO Modula-2 will return a
> +            SHORTCARD whereas PIM4 returns SHORTINT.
> +*)
> +
> +@findex STRUNC
> +PROCEDURE STRUNC (o: <any floating point type>) : SHORT<type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   TRUNC - will return a <type> number whose value is the same as o.
> +           PIM2, PIM3 and ISO Modula-2 will return a CARDINAL
> +           whereas PIM4 returns INTEGER.
> +*)
> +
> +@findex TRUNC
> +PROCEDURE TRUNC (o: <any floating point type>) : <type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   TRUNCS - will return a <type> number whose value is the same
> +            as o.  PIM2, PIM3 and ISO Modula-2 will return a
> +            SHORTCARD whereas PIM4 returns SHORTINT.
> +*)
> +
> +@findex TRUNCS
> +PROCEDURE TRUNCS (o: <any floating point type>) : <type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   TRUNCL - will return a <type> number whose value is the same
> +            as o.  PIM2, PIM3 and ISO Modula-2 will return a
> +            LONGCARD whereas PIM4 returns LONGINT.
> +*)
> +
> +@findex TRUNCL
> +PROCEDURE TRUNCL (o: <any floating point type>) : <type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   VAL - converts data i of <any simple data type 2> to
> +         <any simple data type 1> and returns this value.
> +         No range checking is performed during this conversion.
> +*)
> +
> +@findex VAL
> +PROCEDURE VAL (<any simple data type 1>,
> +               i: <any simple data type 2>) : <any simple data type 1> ;
> +
> +@end example
> +
> +@subsection ISO specific standard procedures and functions
> +
> +The standard function @code{LENGTH} is specific to ISO Modula-2 and
> +is defined as:
> +
> +@example
> +
> +(*
> +   IM - returns the imaginary component of a complex type.
> +        The return value will the same type as the imaginary field
> +        within the complex type.
> +*)
> +
> +@findex IM
> +PROCEDURE IM (c: <any complex type>) : <floating point type> ;
> +@end example
> +
> +@example
> +
> +(*
> +   INT - returns an INTEGER value which has the same value as v.
> +         This function is equivalent to: VAL(INTEGER, v).
> +*)
> +
> +@findex INT
> +PROCEDURE INT (v: <any ordinal type>) : INTEGER ;
> +@end example
> +
> +@example
> +
> +(*
> +   LENGTH - returns the length of string a.
> +*)
> +
> +@findex LENGTH
> +PROCEDURE LENGTH (a: ARRAY OF CHAR) : CARDINAL ;
> +@end example
> +
> +This function is evaluated at compile time, providing that string
> +@code{a} is a constant. If @code{a} cannot be evaluated then a call is
> +made to @code{M2RTS.Length}.
> +
> +@example
> +
> +(*
> +   ODD - returns a BOOLEAN indicating whether the whole number
> +         value, v, is odd.
> +*)
> +
> +@findex ODD
> +PROCEDURE ODD (v: <any whole number type>) : BOOLEAN ;
> +@end example
> +
> +@example
> +
> +(*
> +   RE - returns the real component of a complex type.
> +        The return value will the same type as the real field
> +        within the complex type.
> +*)
> +
> +@findex RE
> +PROCEDURE RE (c: <any complex type>) : <floating point type> ;
> +@end example
> +
> +@node Dialect, Exceptions, Standard procedures, Using
> +@section GNU Modula-2 supported dialects
> +
> +This section describes the dialects understood by GNU Modula-2.
> +It also describes the differences between the dialects and
> +any command line switches which determine dialect behaviour.
> +
> +The GNU Modula-2 compiler is compliant with four dialects of Modula-2.
> +The language as defined in 'Programming in Modula-2' 2nd Edition,
> +Springer Verlag, 1982, 1983 by Niklaus Wirth (PIM2), 'Programming in
> +Modula-2', 3rd Corrected Edition, Springer Verlag, 1985 (PIM3) and
> +'Programming in Modula-2', 4th Edition, Springer Verlag, 1988 (PIM4)
> +@uref{http://freepages.modula2.org/report4/modula-2.html} and the ISO
> +Modula-2 language as defined in ISO/IEC Information technology -
> +programming languages - part 1: Modula-2 Language, ISO/IEC 10514-1
> +(1996) (ISO).
> +
> +The command line switches @samp{-fpim2}, @samp{-fpim3}, @samp{-fpim4}
> +and @samp{-fiso} can be used to force mutually exclusive
> +features.  However by default the compiler will not aggressively fail
> +if a non mutually exclusive feature is used from another dialect.  For
> +example it is possible to specify @samp{-fpim2} and still utilise
> +@samp{DEFINITION} @samp{MODULES} which have no export list.
> +
> +Some dialect differences will force a compile time error, for example
> +in PIM2 the user must @code{IMPORT} @code{SIZE} from the module
> +@code{SYSTEM}, whereas in PIM3 and PIM4 @code{SIZE} is a pervasive
> +function.  Thus compiling PIM4 source code with the @samp{-fpim2}
> +switch will cause a compile time error.  This can be fixed quickly
> +with an additional @code{IMPORT} or alternatively by compiling with
> +the @samp{-fpim4} switch.
> +
> +However there are some very important differences between the dialects
> +which are mutually exclusive and therefore it is vital that users
> +choose the dialects with care when these language features are used.
> +
> +@subsection Integer division, remainder and modulus
> +
> +The most dangerous set of mutually exclusive features found in the
> +four dialects supported by GNU Modula-2 are the @code{INTEGER}
> +division, remainder and modulus arithmetic operators.  It is important
> +to note that the same source code can be compiled to give different
> +runtime results depending upon these switches!  The reference manual
> +for the various dialects of Modula-2 are quite clear about this
> +behaviour and sadly there are three distinct definitions.
> +
> +The table below illustrates the problem when a negative operand is
> +used.
> +
> +@example
> +                  Pim2/3          Pim4                ISO
> +               -----------    -----------    ----------------------
> +lval    rval   DIV     MOD    DIV     MOD    DIV    MOD    /    REM
> + 31      10      3       1      3       1      3      1     3     1
> +-31      10     -3      -1     -4       9     -4      9    -3    -1
> + 31     -10     -3       1     -3       1     Exception    -3     1
> +-31     -10      3      -1      4       9     Exception     3    -1
> +@end example
> +
> +See also P24 of PIM2, P27 of PIM3, P29 of PIM4 and P201 of the ISO
> +Standard.  At present all dialect division, remainder and modulus are
> +implemented as above, apart from the exception calling in the ISO
> +dialect. Instead of exception handling the results are the same as the
> +PIM4 dialect. This is a temporary implementation situation.
> +
> +@node Exceptions, Semantic checking, Dialect, Using
> +@section Exception implementation
> +
> +This section describes how exceptions are implemented in GNU Modula-2
> +and how command line switches affect their behaviour.  The option
> +@samp{-fsoft-check-all} enables all software checking of nil
> +dereferences, division by zero etc.  Additional code is produced to
> +check these conditions and exception handlers are invoked if the
> +conditions prevail.
> +
> +Without @samp{-fsoft-check-all} these exceptions will be caught by
> +hardware (assuming the hardware support exists) and a signal handler
> +is invoked.  The signal handler will in turn @code{THROW} an exception
> +which will be caught by the appropriate Modula-2 handler.  However the
> +action of throwing an exception from within a signal handler is
> +implementation defined (according to the C++ documentation).  For
> +example on the x86_64 architecture this works whereas on the i686
> +architecture it does not.  Therefore to ensure portability it is
> +recommended to use @samp{-fsoft-check-all}.
> +
> +@footnote{@samp{-fsoft-check-all} can be effectively combined with
> +@samp{-O2} to semantically analyse source code for possible runtime
> +errors at compile time.}
> +
> +@node Semantic checking, Extensions, Exceptions, Using
> +@section How to detect runtime problems at compile time
> +
> +Consider the following program:
> +
> +@example
> +MODULE assignvalue ;  (*!m2iso+gm2*)
> +
> +PROCEDURE bad () : INTEGER ;
> +VAR
> +   i: INTEGER ;
> +BEGIN
> +   i := -1 ;
> +   RETURN i
> +END bad ;
> +
> +VAR
> +   foo: CARDINAL ;
> +BEGIN
> +   (* the m2rte plugin will detect this as an error, post
> +      optimization.  *)
> +   foo := bad ()
> +END assignvalue.
> +@end example
> +
> +here we see that the programmer has overlooked that the return value
> +from @samp{bad} will cause an overflow to @samp{foo}.  If we compile
> +the code with the following options:
> +
> +@example
> +$ gm2 -g -fsoft-check-all -O2 -c assignvalue.mod
> +assignvalue.mod:16:0:inevitable that this error will occur at runtime,
> +assignment will result in an overflow
> +@end example
> +
> +The gm2 semantic plugin is automatically run and will generate a
> +warning message for every exception call which is known as reachable.
> +It is highly advised to run the optimizer (@samp{-O2} or @samp{-O3})
> +with @samp{-fsoft-check-all} so that the compiler is able to run the
> +optimizer and perform variable and flow analysis before the semantic
> +plugin is invoked.
> +
> +@node Extensions, Type compatibility, Semantic checking, Using
> +@section GNU Modula-2 language extensions
> +
> +This section introduces the GNU Modula-2 language extensions.
> +The GNU Modula-2 compiler allows abstract data types to be any type,
> +not just restricted to a pointer type providing the
> +@samp{-fextended-opaque} option is supplied
> +@xref{Compiler options, , ,gm2}.
> +
> +Declarations can be made in any order, whether they are
> +types, constants, procedures, nested modules or variables.
> +@c (@xref{Passes, , ,}.)
> +
> +GNU Modula-2 also allows programmers to interface to @code{C} and
> +assembly language.
> +
> +GNU Modula-2 provides support for the special tokens @code{__LINE__},
> +@code{__FILE__}, @code{__FUNCTION__} and @code{__DATE__}.  Support for
> +these tokens will occur even if the @samp{-fcpp} option is not
> +supplied. A table of these identifiers and their data type and values
> +is given below:
> +
> +@example
> +Scope       GNU Modula-2 token      Data type and example value
> +
> +anywhere    __LINE__                Constant Literal compatible
> +                                    with CARDINAL, INTEGER and WORD.
> +                                    Example 1234
> +
> +anywhere    __FILE__                Constant string compatible
> +                                    with parameter ARRAY OF CHAR or
> +                                    an ARRAY whose SIZE is >= string
> +                                    length. Example
> +                                    "hello.mod"
> +
> +procedure   __FUNCTION__            Constant string compatible
> +                                    with parameter ARRAY OF CHAR or
> +                                    an ARRAY whose SIZE is >= string
> +                                    length. Example
> +                                    "calc"
> +
> +module      __FUNCTION__            Example
> +                                    "module hello initialization"
> +
> +anywhere    __DATE__                Constant string compatible
> +                                    with parameter ARRAY OF CHAR or
> +                                    an ARRAY whose SIZE is >= string
> +                                    length. Example
> +                                    "Thu Apr 29 10:07:16 BST 2004"
> +
> +anywhere   __COLUMN__               Gives a contant literal number
> +                                    determining the left hand column
> +                                    where the first _ appears in
> +                                    __COLUMN__.  The left most column
> +                                    is 1.
> +
> +@end example
> +
> +The preprocessor @samp{cpp} can be invoked via the @samp{-fcpp}
> +command line option. This in turn invokes @samp{cpp} with the
> +following arguments @samp{-traditional -lang-asm}.  These options
> +preserve comments and all quotations.  @samp{gm2} treats a @samp{#}
> +character in the first column as a preprocessor directive.
> +
> +For example here is a module which calls @code{FatalError}
> +via the macro @code{ERROR}.
> +
> +@example
> +MODULE cpp ;
> +
> +FROM SYSTEM IMPORT ADR, SIZE ;
> +FROM libc IMPORT exit, printf, malloc ;
> +
> +PROCEDURE FatalError (a, file: ARRAY OF CHAR;
> +                         line: CARDINAL;
> +                         func: ARRAY OF CHAR) ;
> +BEGIN
> +   printf("%s:%d:fatal error, %s, in %s\n",
> +           ADR(file), line, ADR(a), ADR(func)) ;
> +   exit(1)
> +END FatalError ;
> +
> +#define ERROR(X)  FatalError(X, __FILE__, __LINE__, __FUNCTION__)
> +
> +VAR
> +   pc: POINTER TO CARDINAL;
> +BEGIN
> +   pc := malloc(SIZE(CARDINAL)) ;
> +   IF pc=NIL
> +   THEN
> +      ERROR('out of memory')
> +   END
> +END cpp.
> +@end example
> +
> +Another use for the C preprocessor in Modula-2 might be to turn on
> +debugging code.  For example the library module
> +@file{FormatStrings.mod} uses procedures from @file{DynamicStrings.mod}
> +and to track down memory leaks it was useful to track the source file
> +and line where each string was created.  Here is a section of
> +@file{FormatStrings.mod} which shows how the debugging code was
> +enabled and disabled by adding @code{-fcpp} to the command line.
> +
> +@example
> +FROM DynamicStrings IMPORT String, InitString, InitStringChar, Mark,
> +                           ConCat, Slice, Index, char,
> +                           Assign, Length, Mult, Dup, ConCatChar,
> +                           PushAllocation, PopAllocationExemption,
> +                           InitStringDB, InitStringCharStarDB,
> +                           InitStringCharDB, MultDB, DupDB, SliceDB ;
> +
> +(*
> +#define InitString(X) InitStringDB(X, __FILE__, __LINE__)
> +#define InitStringCharStar(X) InitStringCharStarDB(X, __FILE__, \
> +                                                   __LINE__)
> +#define InitStringChar(X) InitStringCharDB(X, __FILE__, __LINE__)
> +#define Mult(X,Y) MultDB(X, Y, __FILE__, __LINE__)
> +#define Dup(X) DupDB(X, __FILE__, __LINE__)
> +#define Slice(X,Y,Z) SliceDB(X, Y, Z, __FILE__, __LINE__)
> +*)
> +
> +PROCEDURE doDSdbEnter ;
> +BEGIN
> +   PushAllocation
> +END doDSdbEnter ;
> +
> +PROCEDURE doDSdbExit (s: String) ;
> +BEGIN
> +   s := PopAllocationExemption(TRUE, s)
> +END doDSdbExit ;
> +
> +PROCEDURE DSdbEnter ;
> +BEGIN
> +END DSdbEnter ;
> +
> +PROCEDURE DSdbExit (s: String) ;
> +BEGIN
> +END DSdbExit ;
> +
> +(*
> +#define DBsbEnter doDBsbEnter
> +#define DBsbExit  doDBsbExit
> +*)
> +
> +PROCEDURE Sprintf1 (s: String; w: ARRAY OF BYTE) : String ;
> +BEGIN
> +   DSdbEnter ;
> +   s := FormatString(HandleEscape(s), w) ;
> +   DSdbExit(s) ;
> +   RETURN( s )
> +END Sprintf1 ;
> +@end example
> +
> +It is worth noting that the overhead of this code once @code{-fcpp} is
> +not present and -O2 is used will be zero since the local empty
> +procedures @code{DSdbEnter} and @code{DSdbExit} will be thrown away by
> +the optimization passes of the GCC backend.
> +
> +@subsection Optional procedure parameter
> +
> +GNU Modula-2 allows the last parameter to a procedure or function
> +parameter to be optional. For example in the ISO library
> +@file{COROUTINES.def} the procedure @code{NEWCOROUTINE} is defined as
> +having an optional fifth argument (@code{initProtection}) which, if
> +absent, is automatically replaced by @code{NIL}.
> +
> +@example
> +@findex NEWCOROUTINE
> +PROCEDURE NEWCOROUTINE (procBody: PROC; workspace: SYSTEM.ADDRESS;
> +                        size: CARDINAL; VAR cr: COROUTINE;
> +                        [initProtection: PROTECTION = NIL]);
> +
> +  (* Creates a new coroutine whose body is given by procBody,
> +     and returns the identity of the coroutine in cr.
> +     workspace is a pointer to the work space allocated to
> +     the coroutine; size specifies the size of this workspace
> +     in terms of SYSTEM.LOC.
> +
> +     The optional fifth argument may contain a single parameter
> +     which specifies the initial protection level of the coroutine.
> +  *)
> +@end example
> +
> +The implementation module @file{COROUTINES.mod} implements this
> +procedure using the following syntax:
> +
> +@example
> +PROCEDURE NEWCOROUTINE (procBody: PROC; workspace: SYSTEM.ADDRESS;
> +                        size: CARDINAL; VAR cr: COROUTINE;
> +                        [initProtection: PROTECTION]);
> +BEGIN
> +
> +END NEWCOROUTINE ;
> +@end example
> +
> +Note that it is illegal for this declaration to contain an initialiser
> +value for @code{initProtection}. However it is necessary to surround
> +this parameter with the brackets @code{[} and @code{]}. This serves to
> +remind the programmer that the last parameter was declared as optional
> +in the definition module.
> +
> +Local procedures can be declared to have an optional final parameter
> +in which case the initializer is mandatory in the implementation or
> +program module.
> +
> +GNU Modula-2 also provides additional fixed sized data types which
> +are all exported from the @code{SYSTEM} module.
> +@xref{The PIM system module, , ,gm2}.
> +@xref{The ISO system module, , ,gm2}.
> +
> +@node Type compatibility, Unbounded by reference, Extensions, Using
> +@section Type compatibility
> +
> +This section discuss the issues surrounding assignment, expression
> +and parameter compatibility, their effect of the additional
> +fixed sized datatypes and also their effect of runtime checking.
> +The data types supported by the compiler are:
> +
> +@example
> +GNU Modula-2              scope      switches
> +=============================================
> +INTEGER                   pervasive
> +LONGINT                   pervasive
> +SHORTINT                  pervasive
> +CARDINAL                  pervasive
> +LONGCARD                  pervasive
> +SHORTCARD                 pervasive
> +BOOLEAN                   pervasive
> +BITSET                    pervasive
> +REAL                      pervasive
> +LONGREAL                  pervasive
> +SHORTREAL                 pervasive
> +CHAR                      pervasive
> +SHORTCOMPLEX              pervasive
> +COMPLEX                   pervasive
> +LONGCOMPLEX               pervasive
> +
> +LOC                       SYSTEM     -fiso
> +BYTE                      SYSTEM
> +WORD                      SYSTEM
> +ADDRESS                   SYSTEM
> +
> +The following extensions are supported for
> +most architectures (please check SYSTEM.def).
> +=============================================
> +INTEGER8                  SYSTEM
> +INTEGER16                 SYSTEM
> +INTEGER32                 SYSTEM
> +INTEGER64                 SYSTEM
> +CARDINAL8                 SYSTEM
> +CARDINAL16                SYSTEM
> +CARDINAL32                SYSTEM
> +CARDINAL64                SYSTEM
> +BITSET8                   SYSTEM
> +BITSET16                  SYSTEM
> +BITSET32                  SYSTEM
> +WORD16                    SYSTEM
> +WORD32                    SYSTEM
> +WORD64                    SYSTEM
> +REAL32                    SYSTEM
> +REAL64                    SYSTEM
> +REAL96                    SYSTEM
> +REAL128                   SYSTEM
> +COMPLEX32                 SYSTEM
> +COMPLEX64                 SYSTEM
> +COMPLEX96                 SYSTEM
> +COMPLEX128                SYSTEM
> +@end example
> +
> +The Modula-2 language categorises compatibility between entities of
> +possibly differing types into three subcomponents: expressions,
> +assignments, and parameters.  Parameter compatibility is further
> +divided into two sections for pass by reference and pass by value
> +compatibility.
> +
> +For more detail on the Modula-2 type compatibility see the Modula-2
> +ISO standard BS ISO/IEC 10514-1:1996 page 121-125.  For detail on the
> +PIM type compatibility see Programming in Modula-2 Edition 4 page 29,
> +(Elementary Data Types).
> +
> +@subsection Expression compatibility
> +
> +Modula-2 restricts the types of expressions to the same type.
> +Expression compatibility is a symmetric relation.
> +
> +For example two sub expressions of @code{INTEGER} and @code{CARDINAL}
> +are not expression compatible
> +(@uref{http://freepages.modula2.org/report4/modula-2.html} and ISO
> +Modula-2).
> +
> +In GNU Modula-2 this rule is also extended across all fixed sized data
> +types (imported from SYSTEM).
> +
> +@subsection Assignment compatibility
> +
> +This section discusses the assignment issues surrounding assignment
> +compatibility of elementary types (@code{INTEGER}, @code{CARDINAL},
> +@code{REAL} and @code{CHAR} for example).  The information here is
> +found in more detail in the Modula-2 ISO standard BS ISO/IEC
> +10514-1:1996 page 122.
> +
> +Assignment compatibility exists between the same sized elementary
> +types.
> +
> +Same type family of different sizes are
> +also compatible as long as the @code{MAX(}type@code{)} and
> +@code{MIN(}type@code{)} is known.  So for example this includes the
> +@code{INTEGER} family, @code{CARDINAL} family and the @code{REAL}
> +family.
> +
> +The reason for this is that when the assignment is performed
> +the compiler will check to see that the expression (on the right of
> +the @code{:=}) lies within the range of the designator type (on the
> +left hand side of the @code{:=}).  Thus these ordinal types can be
> +assignment compatible.  However it does mean that @code{WORD32} is not
> +compatible with @code{WORD16} as @code{WORD32} does not have a minimum
> +or maximum value and therefore cannot be checked.  The compiler does
> +not know which of the two bytes from @code{WORD32} should be copied
> +into @code{WORD16} and which two should be ignored.  Currently the
> +types @code{BITSET8}, @code{BITSET16} and @code{BITSET32} are
> +assignment incompatible.  However this restriction maybe lifted when
> +further runtime checking is achieved.
> +
> +Modula-2 does allow @code{INTEGER} to be assignment compatible with
> +@code{WORD} as they are the same size.  Likewise GNU Modula-2 allows
> +@code{INTEGER16} to be compatible with @code{WORD16} and the same for
> +the other fixed sized types and their sized equivalent in either
> +@code{WORD}n, @code{BYTE} or @code{LOC} types.  However it prohibits
> +assignment between @code{WORD} and @code{WORD32} even though on many
> +systems these sizes will be the same.  The reasoning behind this rule
> +is that the extended fixed sized types are meant to be used by
> +applications requiring fixed sized data types and it is more portable
> +to forbid the bluring of the boundaries between fixed sized and
> +machine dependant sized types.
> +
> +Intemediate code runtime checking is always generated by the front
> +end.  However this intemediate code is only translated into actual
> +code if the appropriate command line switches are specified.  This
> +allows the compiler to perform limited range checking at compile time.
> +In the future it will allow the extensive GCC optimisations to
> +propagate constant values through to the range checks which if they
> +are found to exceed the type range will result in a compile time
> +error message.
> +
> +@subsection Parameter compatibility
> +
> +Parameter compatibility is divided into two areas, pass by value and
> +pass by reference (@code{VAR}).  In the case of pass by value the
> +rules are exactly the same as assignment.  However in the second case,
> +pass by reference, the actual parameter and formal parameter must be
> +the same size and family.  Furthermore @code{INTEGER} and
> +@code{CARDINAL}s are not treated as compatible in the pass by
> +reference case.
> +
> +The types @code{BYTE}, @code{LOC}, @code{WORD} and @code{WORD}n
> +derivitives are assignment and parameter compatible with any data type
> +of the same size.
> +
> +@node Unbounded by reference, Building a shared library, Type compatibility, Using
> +@section Unbounded by reference
> +
> +This section documents a GNU Modula-2 compiler switch which implements
> +a language optimisation surrounding the implementation of unbounded
> +arrays.  In GNU Modula-2 the unbounded array is implemented by
> +utilising an internal structure @code{struct @{dataType *address,
> +unsigned int high@}}.  So given the Modula-2 procedure declaration:
> +
> +@example
> +PROCEDURE foo (VAR a: ARRAY OF dataType) ;
> +BEGIN
> +   IF a[2]= (* etc *)
> +END foo ;
> +@end example
> +
> +it is translated into GCC @code{tree}s, which can be represented
> +in their C form thus:
> +
> +@example
> +void foo (struct @{dataType *address, unsigned int high@} a)
> +@{
> +   if (a.address[2] == /* etc */
> +@}
> +@end example
> +
> +Whereas if the procedure @code{foo} was declared as:
> +
> +@example
> +PROCEDURE foo (a: ARRAY OF dataType) ;
> +BEGIN
> +   IF a[2]= (* etc *)
> +END foo ;
> +@end example
> +
> +then it is implemented by being translated into the following
> +GCC @code{tree}s, which can be represented in their C form thus:
> +
> +@example
> +void foo (struct @{dataType *address, unsigned int high@} a)
> +@{
> +   dataType *copyContents = (dataType *)alloca (a.high+1);
> +   memcpy(copyContents, a.address, a.high+1);
> +   a.address = copyContents;
> +
> +   if (a.address[2] == /* etc */
> +@}
> +@end example
> +
> +This implementation works, but it makes a copy of each non VAR
> +unbounded array when a procedure is entered.  If the unbounded array
> +is not changed during procedure @code{foo} then this implementation
> +will be very inefficient.  In effect Modula-2 lacks the @code{REF}
> +keyword of Ada.  Consequently the programmer maybe tempted to
> +sacrifice semantic clarity for greater efficiency by declaring the
> +parameter using the @code{VAR} keyword in place of @code{REF}.
> +
> +The @code{-funbounded-by-reference} switch instructs the compiler to
> +check and see if the programmer is modifying the content of any
> +unbounded array.  If it is modified then a copy will be made upon
> +entry into the procedure.  Conversely if the content is only read and
> +never modified then this non @code{VAR} unbounded array is a candidate
> +for being passed by reference.  It is only a candidate as it is still
> +possible that passing this parameter by reference could alter the
> +meaning of the source code.  For example consider the following case:
> +
> +@example
> +PROCEDURE StrConCat (VAR a: ARRAY OF CHAR; b, c: ARRAY OF CHAR) ;
> +BEGIN
> +   (* code which performs string a := b + c *)
> +END StrConCat ;
> +
> +PROCEDURE foo ;
> +VAR
> +   a: ARRAY [0..3] OF CHAR ;
> +BEGIN
> +   a := 'q' ;
> +   StrConCat(a, a, a)
> +END foo ;
> +@end example
> +
> +In the code above we see that the same parameter, @code{a}, is being
> +passed three times to @code{StrConCat}.  Clearly even though parameters
> +@code{b} and @code{c} are never modified it would be incorrect to
> +implement them as pass by reference.  Therefore the compiler checks to
> +see if any non @code{VAR} parameter is type compatible with any
> +@code{VAR} parameter and if so it generates runtime procedure entry
> +checks to determine whether the contents of parameters @code{b} or
> +@code{c} matches the contents of @code{a}.  If a match is detected
> +then a copy is made and the @code{address} in the unbounded
> +@code{struct}ure is modified.
> +
> +The compiler will check the address range of each candidate against
> +the address range of any @code{VAR} parameter, providing they are type
> +compatible.  For example consider:
> +
> +@example
> +PROCEDURE foo (a: ARRAY OF BYTE; VAR f: REAL) ;
> +BEGIN
> +   f := 3.14 ;
> +   IF a[0]=BYTE(0)
> +   THEN
> +      (* etc *)
> +   END
> +END foo ;
> +
> +PROCEDURE bar ;
> +BEGIN
> +   r := 2.0 ;
> +   foo(r, r)
> +END bar ;
> +@end example
> +
> +Here we see that although parameter, @code{a}, is a candidate for the
> +passing by reference, it would be incorrect to use this
> +transformation.  Thus the compiler detects that parameters, @code{a}
> +and @code{f} are type compatible and will produce runtime checking
> +code to test whether the address range of their respective contents
> +intersect.
> +
> +@node Linking, Building a shared library, Unbounded by reference, Using
> +
> +This section describes the linking related options.  There are three
> +linking strategies available which are dynamic scaffold, static
> +scaffold and user defined.  The dynamic scaffold is enabled by default
> +and each module will register itself to the runtime @samp{M2RTS} via
> +a constructor.  The static scaffold mechanism will invoke each modules
> +@samp{_init} and @samp{_finish} function in turn via a sequence of
> +calls from within @samp{main}.  Lastly the user defined strategy
> +can be implemented by turning off the dynamic and static options via
> +@samp{-fno-scaffold-dynamic} and @samp{-fno-scaffold-static}.
> +
> +In the simple test below:
> +
> +@example
> +$ gm2 hello.mod
> +@end example
> +
> +the driver will add the options @samp{-fscaffold-dynamic} and
> +@samp{-fgen-module-list=-} which generate a list of application
> +modules and also creates the @samp{main} function with calls to
> +@samp{M2RTS}.  It can be useful to add the option @samp{-fsources}
> +which displays the source files as they are parsed and summarizes
> +whether the source file is required for compilation or linking.
> +
> +If you wish to split the above command line into a compile and link
> +then you could use these steps:
> +
> +@example
> +$ gm2 -c -fscaffold-main hello.mod
> +$ gm2 hello.o
> +@end example
> +
> +The @samp{-fscaffold-main} informs the compiler to generate the
> +@samp{main} function and scaffold.  You can enable the environment
> +variable @samp{GCC_M2LINK_RTFLAG} to trace the construction and
> +destruction of the application.  The values for
> +@samp{GCC_M2LINK_RTFLAG} are shown in the table below:
> +
> +@example
> +value   | meaning
> +=================
> +all     | turn on all flags below
> +module  | trace modules as they register themselves
> +pre     | generate module list prior to dependency resolution
> +dep     | trace module dependency resolution
> +post    | generate module list after dependency resolution
> +force   | generate a module list after dependency and forced
> +        | ordering is complete
> +@end example
> +
> +The values can be combined using a comma separated list.
> +
> +One of the advantages of the dynamic scaffold is that the driver
> +behaves in a similar way to the other front end drivers.
> +For example consider a small project consisting of 4 definition
> +implementation modules (@samp{a.def}, @samp{a.mod}, @samp{b.def},
> +@samp{b.mod}, @samp{c.def}, @samp{c.mod}, @samp{d.def}, @samp{d.mod})
> +and a program module @samp{program.mod}.
> +
> +To link this project we could:
> +
> +@example
> +$ gm2 -g -c a.mod
> +$ gm2 -g -c b.mod
> +$ gm2 -g -c c.mod
> +$ gm2 -g -c d.mod
> +$ gm2 -g program.mod a.o b.o c.o d.o
> +@end example
> +
> +The module initialization sequence is defined by the ISO standard to
> +follow the import graph traversal.  The initialization order is the
> +order in which the corresponding separate modules finish the
> +processing of their import lists.
> +
> +However, if required, you can override this using
> +@samp{-fruntime-modules=a,b,c,d} for example which forces the
> +initialization sequence to @samp{a}, @samp{b}, @samp{c} and @samp{d}.
> +
> +@node Building a shared library, Interface for Python, Unbounded by reference, Using
> +@section Building a shared library
> +
> +This section describes building a tiny shared library implemented in
> +Modula-2 and built with @file{libtool}.  Suppose a project consists of
> +two definition modules and two implementation modules and a program
> +module @file{a.def}, @file{a.mod}, @file{b.def}, @file{b.mod} and
> +@file{c.mod}.  The first step is to compile the modules using position
> +independent code.  This can be achieved by the following three
> +commands:
> +
> +@example
> +libtool --tag=CC --mode=compile gm2 -g -c a.mod -o a.lo
> +libtool --tag=CC --mode=compile gm2 -g -c b.mod -o b.lo
> +libtool --tag=CC --mode=compile gm2 -g -c c.mod -o c.lo
> +@end example
> +
> +The second step is to generate the shared library initialization and
> +finalization routines.  We can do this by asking gm2 to generate a
> +list of dependant modules and then use this to generate the scaffold.
> +We also must compile the scaffold.
> +
> +@example
> +gm2 -c -g -fmakelist c.mod
> +gm2 -c -g -fmakeinit -fshared c.mod
> +libtool --tag=CC --mode=compile g++ -g -c c_m2.cpp -o c_m2.lo
> +@end example
> +
> +The third step is to link all these @file{.lo} files.
> +
> +@example
> +libtool --mode=link gcc -g c_m2.lo a.lo b.lo c.lo \
> +        -L$(prefix)/lib64 \
> +        -rpath `pwd` -lgm2 -lstdc++ -lm -o libabc.la
> +@end example
> +
> +At this point the shared library @file{libabc.so} will have been
> +created inside the directory @file{.libs}.
> +
> +@node Interface for Python, Producing a Python module, Building a shared library, Using
> +@section How to produce swig interface files
> +
> +This section describes how Modula-2 implementation modules can be
> +called from Python (and other scripting languages such as TCL and
> +Perl).  GNU Modula-2 can be instructed to create a swig interface when
> +it is compiling an implementation module.  Swig then uses the
> +interface file to generate all the necessary wrapping to that the
> +desired scripting language may access the implementation module.
> +
> +Here is an example of how you might call upon the services of the
> +Modula-2 library module @code{NumberIO} from Python3.
> +
> +The following commands can be used to generate the Python3 module:
> +
> +@example
> +export src=@samp{directory to the sources}
> +export prefix=@samp{directory to where the compiler is installed}
> +gm2 -I$@{src@} -c -g -fswig $@{src@}/../../../gm2-libs/NumberIO.mod
> +gm2 -I$@{src@} -c -g -fmakelist $@{src@}/../../../gm2-libs/NumberIO.mod
> +
> +gm2 -I$@{src@} -c -g -fmakeinit -fshared \
> +   $@{src@}/../../../gm2-libs/NumberIO.mod
> +
> +swig -c++ -python3 NumberIO.i
> +
> +libtool --mode=compile g++ -g -c -I$@{src@} NumberIO_m2.cpp \
> +  -o NumberIO_m2.lo
> +
> +libtool --tag=CC --mode=compile gm2 -g -c \
> +  -I$@{src@}../../../gm2-libs \
> +  $@{src@}/../../../gm2-libs/NumberIO.mod -o NumberIO.lo
> +
> +libtool --tag=CC --mode=compile g++ -g -c NumberIO_wrap.cxx \
> +  -I/usr/include/python3 -o NumberIO_wrap.lo
> +
> +libtool --mode=link gcc -g NumberIO_m2.lo NumberIO_wrap.lo \
> +   -L$@{prefix@}/lib64 \
> +   -rpath `pwd` -lgm2 -lstdc++ -lm -o libNumberIO.la
> +
> +cp .libs/libNumberIO.so _NumberIO.so
> +@end example
> +
> +The first four commands, generate the swig interface file
> +@file{NumberIO.i} and python wrap files @file{NumberIO_wrap.cxx} and
> +@file{NumberIO.py}.  The next three @file{libtool} commnads compile
> +the C++ and Modula-2 source code into @file{.lo} objects.  The last
> +@file{libtool} command links all the @file{.lo} files into a
> +@file{.la} file and includes all shared library dependencies.
> +
> +Now it is possible to run the following Python script
> +(called @file{testnum.py}):
> +
> +@example
> +import NumberIO
> +
> +print ("1234 x 2 =", NumberIO.NumberIO_StrToInt("1234")*2)
> +@end example
> +
> +like this:
> +
> +@example
> +$ python3 testnum.py
> +1234 x 2 = 2468
> +@end example
> +
> +@xref{Producing a Python module, , ,gm2} for another example which
> +uses the @code{UNQUALIFIED} keyword to reduce the module name clutter
> +from the viewport of Python3.
> +
> +@subsection Limitations of automatic generated of Swig files
> +
> +This section discusses the limitations of automatically generating
> +swig files.  From the previous example we see that the module
> +@code{NumberIO} had a swig interface file @file{NumberIO.i}
> +automatically generated by the compiler.  If we consider three of the
> +procedure definitions in @file{NumberIO.def} we can see the
> +success and limitations of the automatic interface generation.
> +
> +@example
> +PROCEDURE StrToHex (a: ARRAY OF CHAR; VAR x: CARDINAL) ;
> +PROCEDURE StrToInt (a: ARRAY OF CHAR; VAR x: INTEGER) ;
> +PROCEDURE ReadInt (VAR x: CARDINAL) ;
> +@end example
> +
> +Below are the swig interface prototypes:
> +
> +@example
> +extern void NumberIO_StrToHex (char *_m2_address_a,
> +                               int _m2_high_a, unsigned int *OUTPUT);
> +/*  parameters: x is known to be an OUTPUT */
> +extern void NumberIO_StrToInt (char *_m2_address_a,
> +                               int _m2_high_a, int *OUTPUT);
> +/*  parameters: x is guessed to be an OUTPUT */
> +extern void NumberIO_ReadInt (int *x);
> +/*  parameters: x is unknown */
> +@end example
> +
> +In the case of @code{StrToHex} it can be seen that the compiler
> +detects that the last parameter is an output.  It explicitly tells
> +swig this by using the parameter name @code{OUTPUT} and in the
> +following comment it informs the user that it knows this to be an
> +output parameter.  In the second procedure @code{StrToInt} it marks
> +the final parameter as an output, but it tells the user that this is
> +only a guess.  Finally in @code{ReadInt} it informs the user that
> +it does not know whether the parameter, @code{x}, is an output, input
> +or an inout parameter.
> +
> +The compiler decides whether to mark a parameter as either:
> +@code{INPUT}, @code{OUTPUT} or @code{INOUT} if it is read before
> +written or visa versa in the first basic block.  At this point
> +it will write output that the parameter is known.  If it is not
> +read or written in the first basic block then subsequent basic blocks
> +are searched and the result is commented as a guess.  Finally if
> +no read or write occurs then the parameter is commented as unknown.
> +However, clearly it is possible to fool this mechanism.  Nevertheless
> +automatic generation of implementation module into swig interface files
> +was thought sufficiently useful despite these limitations.
> +
> +In conclusion it would be wise to check all parameters in any
> +automatically generated swig interface file.  Furthermore you can
> +force the automatic mechanism to generate correct interface files by
> +reading or writing to the @code{VAR} parameter in the first basic
> +block of a procedure.
> +
> +@node Producing a Python module, Interface to C, Interface for Python, Using
> +@section How to produce a Python module
> +
> +This section descibes how it is possible to produce a Python module
> +from Modula-2 code.  There are a number of advantages to this
> +approach, it ensures your code reaches a wider audience, maybe it is
> +easier to initialize your application in Python.
> +
> +The example application here is a pedagogical two dimensional gravity
> +next event simulation.  The Python module needs to have a clear API
> +which should be placed in a single definition module.  Furthermore the
> +API should only use fundamental pervasive data types and strings.
> +Below the API is contained in the file @file{twoDsim.def}:
> +
> +@example
> +DEFINITION MODULE twoDsim ;
> +
> +EXPORT UNQUALIFIED gravity, box, poly3, poly5, poly6, mass,
> +                   fix, circle, pivot, velocity, accel, fps,
> +                   replayRate, simulateFor ;
> +(*
> +   gravity - turn on gravity at: g m^2
> +*)
> +
> +PROCEDURE gravity (g: REAL) ;
> +
> +
> +(*
> +   box - place a box in the world at (x0,y0),(x0+i,y0+j)
> +*)
> +
> +PROCEDURE box (x0, y0, i, j: REAL) : CARDINAL ;
> +
> +
> +(*
> +   poly3 - place a triangle in the world at:
> +           (x0,y0),(x1,y1),(x2,y2)
> +*)
> +
> +PROCEDURE poly3 (x0, y0, x1, y1, x2, y2: REAL) : CARDINAL ;
> +
> +
> +(*
> +   poly5 - place a pentagon in the world at:
> +           (x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)
> +*)
> +
> +PROCEDURE poly5 (x0, y0, x1, y1,
> +                 x2, y2, x3, y3, x4, y4: REAL) : CARDINAL ;
> +
> +
> +(*
> +   poly6 - place a hexagon in the world at:
> +           (x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)
> +*)
> +
> +PROCEDURE poly6 (x0, y0, x1, y1,
> +                 x2, y2, x3, y3,
> +                 x4, y4, x5, y5: REAL) : CARDINAL ;
> +
> +
> +(*
> +   mass - specify the mass of an object and return the, id.
> +*)
> +
> +PROCEDURE mass (id: CARDINAL; m: REAL) : CARDINAL ;
> +
> +
> +(*
> +   fix - fix the object to the world.
> +*)
> +
> +PROCEDURE fix (id: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   circle - adds a circle to the world.  Center
> +            defined by: x0, y0 radius, r.
> +*)
> +
> +PROCEDURE circle (x0, y0, r: REAL) : CARDINAL ;
> +
> +
> +(*
> +   velocity - give an object, id, a velocity, vx, vy.
> +*)
> +
> +PROCEDURE velocity (id: CARDINAL; vx, vy: REAL) : CARDINAL ;
> +
> +
> +(*
> +   accel - give an object, id, an acceleration, ax, ay.
> +*)
> +
> +PROCEDURE accel (id: CARDINAL; ax, ay: REAL) : CARDINAL ;
> +
> +
> +(*
> +   fps - set frames per second.
> +*)
> +
> +PROCEDURE fps (f: REAL) ;
> +
> +
> +(*
> +   replayRate - set frames per second during replay.
> +*)
> +
> +PROCEDURE replayRate (f: REAL) ;
> +
> +
> +(*
> +   simulateFor - render for, t, seconds.
> +*)
> +
> +PROCEDURE simulateFor (t: REAL) ;
> +
> +
> +END twoDsim.
> +@end example
> +
> +The keyword @code{UNQUALIFIED} can be used to ensure that the
> +compiler will provide externally accessible functions
> +@code{gravity}, @code{box}, @code{poly3}, @code{poly5}, @code{poly6},
> +@code{mass}, @code{fix}, @code{circle}, @code{pivot}, @code{velocity},
> +@code{accel}, @code{fps}, @code{replayRate}, @code{simulateFor}
> +rather than name mangled alternatives.
> +Hence in our Python3 application we could write:
> +
> +@example
> +#!/usr/bin/env python3
> +
> +from twoDsim import *
> +
> +b = box (0.0, 0.0, 1.0, 1.0)
> +b = fix (b)
> +c1 = circle (0.7, 0.7, 0.05)
> +c1 = mass (c1, 0.01)
> +c2 = circle (0.7, 0.1, 0.05)
> +c2 = mass (c2, 0.01)
> +c2 = fix (c2)
> +gravity (-9.81)
> +fps (24.0*4.0)
> +replayRate (24.0)
> +print ("creating frames")
> +try:
> +    simulateFor (1.0)
> +    print ("all done")
> +except:
> +    print ("exception raised")
> +@end example
> +
> +which accesses the various functions defined and implemented by the
> +module @code{twoDsim}.  The Modula-2 source code is compiled via:
> +
> +@example
> +$ gm2 -g -fiso -c -fswig twoDsim.mod
> +$ gm2 -g -fiso -c -fmakelist twoDsim.mod
> +$ gm2 -g -fiso -c -fmakeinit twoDsim.mod
> +@end example
> +
> +The first command both compiles the source file creating
> +@file{twoDsim.o} and produces a swig interface file @file{swig.i}.  We
> +now use @code{swig} and @code{g++} to produce and compile the
> +interface wrappers:
> +
> +@example
> +$ libtool --mode=compile g++ -g -c twoDsim_m2.cpp -o twoDsim_m2.lo
> +$ swig -c++ -python3 twoDsim.i
> +$ libtool --mode=compile g++ -c -fPIC twoDsim_wrap.cxx \
> +   -I/usr/include/python3 -o twoDsim_wrap.lo
> +$ libtool --mode=compile gm2 -g -fPIC -fiso -c deviceGnuPic.mod
> +$ libtool --mode=compile gm2 -g -fPIC -fiso -c roots.mod
> +$ libtool --mode=compile gm2 -g -fPIC -fiso -c -fswig \
> +   twoDsim.mod -o twoDsim.lo
> +@end example
> +
> +Finally the application is linked into a shared library:
> +
> +@example
> +$ libtool --mode=link gcc -g twoDsim_m2.lo twoDsim_wrap.lo \
> +  roots.lo deviceGnuPic.lo \
> +   -L$@{prefix@}/lib64 \
> +   -rpath `pwd` -lgm2 -lstdc++ -lm -o libtwoDsim.la
> +cp .libs/libtwoDsim.so _twoDsim.so
> +@end example
> +
> +The library name must start with @code{_} to comply with the Python3
> +module naming scheme.
> +
> +@node Interface to C, Assembly language, Producing a Python module, Using
> +@section Interfacing GNU Modula-2 to C
> +
> +The GNU Modula-2 compiler tries to use the C calling convention
> +wherever possible however some parameters have no C equivalent and
> +thus a language specific method is used.  For example unbounded arrays
> +are passed as a @code{struct @{void *address, unsigned int high@}} and
> +the contents of these arrays are copied by callee functions when they
> +are declared as non @code{VAR} parameters.  The @code{VAR} equivalent
> +unbounded array parameters need no copy, but still use the
> +@code{struct} representation.
> +
> +The recommended method of interfacing GNU Modula-2 to C is by telling
> +the definition module that the implementation is in the C language.
> +This is achieved by using the tokens @code{DEFINITION MODULE FOR "C"}.
> +Here is an example @file{libprintf.def}.
> +
> +@example
> +DEFINITION MODULE FOR "C" libprintf ;
> +
> +EXPORT UNQUALIFIED printf ;
> +
> +PROCEDURE printf (a: ARRAY OF CHAR; ...) : [ INTEGER ] ;
> +
> +END libprintf.
> +@end example
> +
> +the @code{UNQUALIFIED} keyword in the definition module informs
> +GNU Modula-2 not to prefix the module name to exported references
> +in the object file.
> +
> +The @code{printf} declaration states that the first parameter
> +semantically matches @code{ARRAY OF CHAR} but since the module is for
> +the C language it will be mapped onto @code{char *}. The token
> +@code{...} indicates a variable number of arguments (varargs) and all
> +parameters passed here are mapped onto their C equivalents. Arrays and
> +constant strings are passed as pointers.  Lastly @code{[ INTEGER ]}
> +states that the caller can ignore the function return result if desired.
> +
> +The hello world program can be rewritten as:
> +
> +@example
> +MODULE hello ;
> +
> +FROM libprintf IMPORT printf ;
> +
> +BEGIN
> +   printf("hello world\n")
> +END hello.
> +@end example
> +
> +and it can be compiled by:
> +
> +@samp{gm2 -g -I. hello.mod -lc}
> +
> +In reality the @samp{-lc} is redundant as libc is always included in the
> +linking process. It is shown here to emphasize that the C library or
> +object file containing @code{printf} must be present.
> +
> +If a procedure function is declared using varargs then some parameter
> +values are converted.  The table below summarises the default conversions
> +and default types used.
> +
> +@example
> +Actual Parameter       |  Default conversion  |   Type of actual
> +                       |                      |   value passed
> +===============================================================
> +123                    |  none                |   long long int
> +"hello world"          |  none                |   const char *
> +a: ARRAY OF CHAR       |  ADR(a)              |   char *
> +a: ARRAY [0..5] OF CHAR|  ADR(a)              |   char *
> +3.14                   |  none                |   long double
> +@end example
> +
> +If you wish to pass @code{int} values then you should explicitly
> +convert the constants using one of the conversion mechanisms.
> +For example:  @code{INTEGER(10)} or @code{VAL(INTEGER, 10)} or
> +@code{CAST(INTEGER, 10)}.
> +
> +@node Assembly language, Alignment, Interface to C, Using
> +@section Interface to assembly language
> +
> +The interface for GNU Modula-2 to assembly language is almost
> +identical to GNU C.  The only alterations are that the keywords
> +@code{asm} and @code{volatile} are in capitals, following the Modula-2
> +convention.
> +
> +A simple, but highly non optimal, example is given below. Here we want
> +to add the two @code{CARDINAL}s @code{foo} and @code{bar} together and
> +return the result.  The target processor is assumed to be executing
> +the x86_64 instruction set.
> +
> +@example
> +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ;
> +VAR
> +   myout: CARDINAL ;
> +BEGIN
> +   ASM VOLATILE ("movq %1,%%rax; addq %2,%%rax; movq %%rax,%0"
> +      : "=rm" (myout)            (* outputs *)
> +      : "rm" (foo), "rm" (bar)   (* inputs  *)
> +      : "rax") ;                 (* we trash *)
> +   RETURN( myout )
> +END Example ;
> +@end example
> +
> +For a full description of this interface we refer the reader to the GNU C manual.
> +
> +@xref{Extended Asm, ,Extensions to the C Language Family,gcc}.
> +
> +The same example can be written using the newer extensions of naming
> +the operands rather than using numbered arguments.
> +
> +@example
> +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ;
> +VAR
> +   myout: CARDINAL ;
> +BEGIN
> +   ASM VOLATILE (
> +    "movq %[left],%%rax; addq %[right],%%rax; movq %%rax,%[output]"
> +      : [output] "=rm" (myout)                  (* outputs *)
> +      : [left] "rm" (foo), [right] "rm" (bar)   (* inputs  *)
> +      : "rax") ;                                (* we trash *)
> +   RETURN( myout )
> +END Example ;
> +@end example
> +
> +Both examples generate exactly the same code.  It is worth noting that
> +the specifier ``rm'' indicates that the operand can be either a
> +register or memory.  Of course you must choose an instruction which
> +can take either, but this allows the compiler to take make more
> +efficient choices depending upon the optimization level given to the
> +compiler.
> +
> +@node Alignment, Packed, Assembly language, Using
> +@section Data type alignment
> +
> +GNU Modula-2 allows you to specify alignment for types and variables.
> +The syntax for alignment is to use the ISO pragma directives @code{<*}
> +@code{bytealignment (} expression @code{)} and @code{*>}.  These directives
> +can be used after type and variable declarations.
> +
> +The ebnf of the alignment production is:
> +
> +@example
> +Alignment := [ ByteAlignment ] =:
> +ByteAlignment := '<*' AttributeExpression '*>' =:
> +AlignmentExpression := "(" ConstExpression ")" =:
> +@end example
> +
> +The @code{Alignment} ebnf statement may be used during contruction of
> +types, records, record fields, arrays, pointers and variables.  Below
> +is an example of aligning a type so that the variable @code{bar} is
> +aligned on a 1024 address.
> +
> +@example
> +MODULE align ;
> +
> +TYPE
> +   foo = INTEGER <* bytealignment(1024) *> ;
> +
> +VAR
> +   z  : INTEGER ;
> +   bar: foo ;
> +BEGIN
> +END align.
> +@end example
> +
> +The next example aligns a variable on a 1024 byte boundary.
> +
> +@example
> +MODULE align2 ;
> +
> +VAR
> +   x  : CHAR ;
> +   z  : ARRAY [0..255] OF INTEGER <* bytealignment(1024) *> ;
> +BEGIN
> +END align2.
> +@end example
> +
> +Here the example aligns a pointer on a 1024 byte boundary.
> +
> +@example
> +MODULE align4 ;
> +
> +FROM SYSTEM IMPORT ADR ;
> +FROM libc IMPORT exit ;
> +
> +VAR
> +   x  : CHAR ;
> +   z  : POINTER TO INTEGER <* bytealignment(1024) *> ;
> +BEGIN
> +   IF ADR(z) MOD 1024=0
> +   THEN
> +      exit(0)
> +   ELSE
> +      exit(1)
> +   END
> +END align4.
> +@end example
> +
> +In example @code{align5} record field @code{y} is aligned on a 1024
> +byte boundary.
> +
> +@example
> +MODULE align5 ;
> +
> +FROM SYSTEM IMPORT ADR ;
> +FROM libc IMPORT exit ;
> +
> +TYPE
> +   rec = RECORD
> +            x: CHAR ;
> +            y: CHAR <* bytealignment(1024) *> ;
> +         END ;
> +VAR
> +   r: rec ;
> +BEGIN
> +   IF ADR(r.y) MOD 1024=0
> +   THEN
> +      exit(0)
> +   ELSE
> +      exit(1)
> +   END
> +END align5.
> +@end example
> +
> +In the example below module @code{align6} declares @code{foo} as an
> +array of 256 @code{INTEGER}s.  The array @code{foo} is aligned on a
> +1024 byte boundary.
> +
> +@example
> +MODULE align6 ;
> +
> +FROM SYSTEM IMPORT ADR ;
> +FROM libc IMPORT exit ;
> +
> +TYPE
> +   foo = ARRAY [0..255] OF INTEGER <* bytealignment(1024) *> ;
> +
> +VAR
> +   x  : CHAR ;
> +   z  : foo ;
> +BEGIN
> +   IF ADR(z) MOD 1024=0
> +   THEN
> +      exit(0)
> +   ELSE
> +      exit(1)
> +   END
> +END align6.
> +@end example
> +
> +@node Packed, Built-ins, Alignment, Using
> +@section Packing data types
> +
> +The pragma @code{<* bytealignment(0) *>} can be used to specify that
> +the fields within a @code{RECORD} are to be packed.  Currently this
> +only applies to fields which are declared as subranges, ordinal types
> +and enumerated types.  Here is an example of how two subranges might
> +be packed into a byte.
> +
> +@example
> +TYPE
> +   bits3c =  [0..7] ;
> +   bits3i = [-4..3] ;
> +
> +   byte = RECORD
> +              <* bytealignment(0) *>
> +              x: bits3c ;
> +              <* bitsunused(2) *>
> +              y: bits3i ;
> +          END ;
> +@end example
> +
> +Notice that the user has specified that in between fields @code{x} and
> +@code{y} there are two bits unused.
> +
> +Now the user wishes to create a record with byte numbers zero and one
> +occupied and then an @code{INTEGER32} field which is four byte
> +aligned.  In this case byte numbers two and three will be unused.  The
> +pragma @code{bytealignment} can be issued at the start of the record
> +indicating the default alignment for the whole record and this can be
> +overridden by individual fields if necessary.
> +
> +@example
> +   rec = RECORD
> +            <* bytealignment (1) *> ;
> +            a, b: byte ;
> +            x: INTEGER32 <* bytealignment(4) *> ;
> +         END ;
> +@end example
> +
> +In the following example the user has specified that a record has two
> +fields @code{p} and @code{q} but that there are three bytes unused between
> +these fields.
> +
> +@example
> +   header = RECORD
> +               <* bytealignment(1) *>
> +               p: byte ;
> +               <* bytesunused(3) *>
> +               q: byte ;
> +            END ;
> +@end example
> +
> +The pragma @code{<* bytesunused(x) *>} can only be used if the current
> +field is on a byte boundary.  There is also a @code{SYSTEM} pseudo
> +procedure function @code{TBITSIZE(T)} which returns the minimum number of
> +bits necessary to represent type @code{T}.
> +
> +Another example of packing record bit fields is given below:
> +
> +@example
> +MODULE align21 ;
> +
> +FROM libc IMPORT exit ;
> +
> +TYPE
> +   colour = (red, blue, green, purple, white, black) ;
> +
> +   soc = PACKEDSET OF colour ;
> +
> +   rec = RECORD
> +            <* bytealignment(0) *>
> +            x: soc ;
> +            y: [-1..1] ;
> +         END ;
> +
> +VAR
> +   r: rec ;
> +   v: CARDINAL ;
> +BEGIN
> +   v := SIZE(r) ;
> +   IF SIZE(r)#1
> +   THEN
> +      exit(1)
> +   END ;
> +   r.x := soc@{blue@} ;
> +   IF r.x#soc@{blue@}
> +   THEN
> +      exit(2)
> +   END
> +END align21.
> +@end example
> +
> +Here we see that the total size of this record is one byte and consists
> +of a six bit set type followed by a 2 bit integer subrange.
> +
> +@node Built-ins, The PIM system module, Packed, Using
> +@section Accessing GNU Modula-2 Built-ins
> +
> +This section describes the built-in constants and functions defined in
> +GNU Modula-2.  The following compiler constants can be accessed using
> +the @code{__ATTRIBUTE__} @code{__BUILTIN__} keywords. These are not
> +part of the Modula-2 language and they may differ depending upon the
> +target architecture but they provide a method whereby common
> +libraries can interface to a different underlying architecture.
> +
> +The built-in constants are: @code{BITS_PER_UNIT}, @code{BITS_PER_WORD},
> +@code{BITS_PER_CHAR} and @code{UNITS_PER_WORD}. They are integrated into
> +GNU Modula-2 by an extension to the @code{ConstFactor} rule:
> +
> +@example
> +ConstFactor := ConstQualidentOrSet | Number | ConstString |
> +               "(" ConstExpression ")" | "NOT" ConstFactor |
> +               ConstAttribute =:
> +
> +ConstAttribute := "__ATTRIBUTE__" "__BUILTIN__" "(" "(" Ident ")" ")" =:
> +@end example
> +
> +Here is an example taken from the ISO library @code{SYSTEM.def}:
> +
> +@example
> +CONST
> +   BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
> +   LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
> +@end example
> +
> +Built-in functions are transparent to the end user. All built-in
> +functions are declared in @code{DEFINITION MODULE}s and are imported
> +as and when required.  Built-in functions are declared in definition
> +modules by using the @code{__BUILTIN__} keyword. Here is a section of
> +the ISO library @code{LongMath.def} which demonstrates this feature.
> +
> +@example
> +PROCEDURE __BUILTIN__ sqrt (x: LONGREAL): LONGREAL;
> +  (* Returns the square root of x *)
> +@end example
> +
> +This indicates that the function @code{sqrt} will be implemented using
> +the gcc built-in maths library.  If gcc cannot utilise the built-in
> +function (for example if the programmer requested the address of
> +@code{sqrt}) then code is generated to call the alternative function
> +implemented in the @code{IMPLEMENTATION} @code{MODULE}.
> +
> +Sometimes a function exported from the @code{DEFINITION} @code{MODULE}
> +will have a different name from the built-in function within gcc. In
> +such cases the mapping between the GNU Modula-2 function name and the
> +gcc name is expressed using the keywords @code{__ATTRIBUTE__}
> +@code{__BUILTIN__} @code{((Ident))}. For example the function
> +@code{sqrt} in @code{LongMath.def} maps onto the gcc built-in function
> +@code{sqrtl} and this is expressed as:
> +
> +@example
> +PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((sqrtl)) sqrt
> +                                    (x: LONGREAL) : LONGREAL;
> +  (* Returns the positive square root of x *)
> +@end example
> +
> +The following module @code{Builtins.def} enumerates the list of
> +built-in functions which can be accessed in GNU Modula-2. It also
> +serves to define the parameter and return value for each function:
> +
> +@include m2/Builtins.texi
> +
> +Although this module exists and will result in the generation of
> +in-line code if optimization flags are passed to GNU Modula-2, users
> +are advised to utilize the same functions from more generic libraries.
> +The built-in mechanism will be applied to these generic
> +libraries where appropriate. Note for the mathematical routines to
> +be in-lined you need to specify the @samp{-ffast-math -O} options.
> +
> +@node The PIM system module, The ISO system module, Built-ins, Using
> +@section The PIM system module
> +
> +@include m2/SYSTEM-pim.texi
> +
> +The different dialects of Modula-2 PIM-[234] and ISO Modula-2 declare
> +the function @code{SIZE} in different places.  PIM-[34] and ISO
> +Modula-2 declare @code{SIZE} as a pervasive function (declared in the
> +base module).  PIM-2 defined @code{SIZE} in the @code{SYSTEM} module
> +(as shown above).
> +
> +GNU Modula-2 allows users to specify the dialect of Modula-2 by using
> +the @code{-fiso} and @code{-fpim2} command line switches.
> +
> +The data types @code{CSIZE_T} and @code{CSSIZE_T} are also exported from
> +the @code{SYSTEM} module.  The type @code{CSIZE_T} is unsigned and is
> +mapped onto the target C data type @code{size_t} whereas the type
> +@code{CSSIZE_T} is mapped onto the signed C data type @code{ssize_t}.
> +
> +It is anticipated that these should only be used to provide cross
> +platform definition modules for C libraries.
> +
> +There are also a variety of fixed sized @code{INTEGER} and
> +@code{CARDINAL} types.  The variety of the fixed sized types will
> +depend upon the target architecture.
> +
> +@node The ISO system module, , The PIM system module, Using
> +@section The ISO system module
> +
> +@include m2/SYSTEM-iso.texi
> +
> +The data types @code{CSIZE_T} and @code{CSSIZE_T} are also exported from
> +the @code{SYSTEM} module.  The type @code{CSIZE_T} is unsigned and is
> +mapped onto the target C data type @code{size_t} whereas the type
> +@code{CSSIZE_T} is mapped onto the signed C data type @code{ssize_t}.
> +
> +It is anticipated that these should only be used to provide cross
> +platform definition modules for C libraries.
> +
> +There are also a variety of fixed sized @code{INTEGER} and
> +@code{CARDINAL} types.  The variety of the fixed sized types will
> +depend upon the target architecture.
> +
> +@node Licence, Copying, The ISO system module, Top
> +@section Licence of GNU Modula-2
> +
> +GNU Modula-2 is free software, the compiler is held under the GPL v3
> +@uref{http://www.gnu.org/licenses/gpl.txt},
> +its libraries (pim, iso and Logitech compatible) are under the
> +GPL v3 with the GCC runtime library exception clause.
> +
> +Under Section 7 of GPL version 3, you are granted additional
> +permissions described in the GCC Runtime Library Exception, version
> +3.1, as published by the Free Software Foundation.
> +
> +You should have received a copy of the GNU General Public License and
> +a copy of the GCC Runtime Library Exception along with this program;
> +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> +<http://www.gnu.org/licenses/>.
> +
> +More information on how these licences work is available
> +@uref{http://www.gnu.org/licenses/licenses.html} on the GNU web site.
> +
> +@c Copying node is inside the gpl_v3.texi
> +@include gpl_v3.texi
> +
> +@node Contributing, Internals, Copying, Top
> +@section Contributing to GNU Modula-2
> +
> +Please do. But also please read the GNU Emacs info under
> +
> +@example
> +* Standards: (standards).       GNU coding standards.
> +* Intellectual Property::       Keeping Free Software Free
> +* Reading Non-Free Code::       Referring to Proprietary Programs
> +* Contributions::               Accepting Contributions
> +@end example
> +
> +You might consider joining the GM2 Mailing list before you start
> +coding.  The mailing list may be subscribed via a web interface
> +@uref{http://lists.nongnu.org/mailman/listinfo/gm2} or via email
> +@email{gm2-subscribe@@nongnu.org}.
> +
> +Many thanks and enjoy your coding!
> +
> +@node Internals, EBNF, Contributing, Top
> +
> +This section is still being written.
> +@c @include gm2-internals.texi
> +
> +@node EBNF, Libraries, Internals, Top
> +@chapter EBNF of GNU Modula-2
> +
> +This chapter contains the EBNF of GNU Modula-2. This grammer currently
> +supports both PIM and ISO dialects.  The rules here are automatically
> +extracted from the grammer files in GNU Modula-2 and serve to document
> +the syntax of the extensions described earlier and how they fit in
> +with the base language.
> +
> +Note that the first six productions are built into the lexical analysis
> +phase.
> +
> +@include m2/gm2-ebnf.texi
> +
> +@node Libraries, Indices, EBNF, Top
> +@chapter PIM and ISO library definitions
> +
> +This chapter contains M2F, PIM and ISO libraries.
> +
> +@c Permission has been kindly granted by
> +@c the authors of the ULM libraries to include them with GNU
> +@c Modula-2.
> +@c These libraries (under the GNU GPL) were written at the
> +@c University of Ulm and were originally shipped with the ULM sparc
> +@c Modula-2 compiler.
> +
> +@include m2/gm2-libs.texi
> +
> +@node Indices, , Libraries, Top
> +@section Indices
> +
> +@ifhtml
> +@menu
> +* Contents::    Section and subsections.
> +* Functions::   Function, constants, types, ebnf indices.
> +@end menu
> +
> +@node Contents, Functions, ,
> +@section Section and subsections
> +@printindex cp
> +
> +@node Functions, , Contents,
> +@section Function, constants, types, ebnf indices.
> +@end ifhtml
> +
> +@printindex fn
> +
> +@summarycontents
> +@contents
> +@bye
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/lang.opt
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/lang.opt       2022-12-10 00:04:30.319603938 +0000
> @@ -0,0 +1,352 @@
> +; Options for the Modula-2 front end.
> +;
> +; Copyright (C) 2016-2022 Free Software Foundation, Inc.
> +; Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
> +;
> +; This file is part of GNU Modula-2.
> +;
> +; GNU Modula-2 is free software; you can redistribute it and/or modify
> +; it under the terms of the GNU General Public License as published by
> +; the Free Software Foundation; either version 3, or (at your option)
> +; any later version.
> +;
> +; GNU Modula-2 is distributed in the hope that it will be useful, but
> +; WITHOUT ANY WARRANTY; without even the implied warranty of
> +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +; General Public License for more details.
> +;
> +; You should have received a copy of the GNU General Public License
> +; along with GNU Modula-2; see the file COPYING.  If not,
> +; see <https://www.gnu.org/licenses/>.  *)
> +
> +; See the GCC internals manual for a description of this file's format.
> +
> +; Please try to keep this file in ASCII collating order.
> +
> +Language
> +Modula-2
> +
> +B
> +Modula-2
> +; Documented in c.opt
> +
> +D
> +Modula-2
> +; Documented in c.opt
> +
> +E
> +Modula-2
> +; Documented in c.opt (passed to the preprocessor if -fcpp is used)
> +
> +I
> +Modula-2 Joined Separate
> +; Documented in c.opt
> +
> +L
> +Modula-2 Joined Separate
> +; Not documented
> +
> +M
> +Modula-2
> +; Documented in c.opt
> +
> +O
> +Modula-2
> +; Documented in c.opt
> +
> +Wall
> +Modula-2
> +; Documented in c.opt
> +
> +Wpedantic
> +Modula-2
> +; Documented in common.opt
> +
> +Wpedantic-param-names
> +Modula-2
> +compiler checks to force definition module procedure parameter names with their implementation module counterpart
> +
> +Wpedantic-cast
> +Modula-2
> +compiler warns if a cast is being used on types of differing sizes
> +
> +Wverbose-unbounded
> +Modula-2
> +inform user which parameters will be passed by reference
> +
> +Wstyle
> +Modula-2
> +extra compile time semantic checking, typically tries to catch poor programming style
> +
> +Wunused-variable
> +Modula-2
> +; Documented in c.opt
> +
> +Wunused-parameter
> +Modula-2
> +; Documented in c.opt
> +
> +c
> +Modula-2
> +; Documented in c.opt
> +
> +fauto-init
> +Modula-2
> +automatically initializes all pointers to NIL
> +
> +fbounds
> +Modula-2
> +turns on runtime subrange, array index and indirection via NIL pointer checking
> +
> +fcase
> +Modula-2
> +turns on runtime checking to check whether a CASE statement requires an ELSE clause when on was not specified
> +
> +fobjc-std=objc1
> +Modula-2
> +; Documented in c.opt
> +
> +fcpp
> +Modula-2
> +use cpp to preprocess the module
> +
> +fcpp-end
> +Modula-2
> +passed to the preprocessor if -fcpp is used (internal switch)
> +
> +fcpp-begin
> +Modula-2
> +passed to the preprocessor if -fcpp is used (internal switch)
> +
> +fdebug-builtins
> +Modula-2
> +call a real function, rather than the builtin equivalent
> +
> +fd
> +Modula-2
> +turn on internal debugging of the compiler (internal switch)
> +
> +fdebug-trace-quad
> +Modula-2
> +turn on quadruple tracing (internal switch)
> +
> +fdebug-trace-api
> +Modula-2
> +turn on the Modula-2 api tracing (internal switch)
> +
> +fdebug-function-line-numbers
> +Modula-2
> +turn on the Modula-2 function line number generation (internal switch)
> +
> +fdef=
> +Modula-2 Joined
> +recognise the specified suffix as a definition module filename
> +
> +fdump-system-exports
> +Modula-2
> +display all inbuilt system items
> +
> +fexceptions
> +Modula-2
> +; Documented in common.opt
> +
> +fextended-opaque
> +Modula-2
> +allows opaque types to be implemented as any type (a GNU Modula-2 extension)
> +
> +ffloatvalue
> +Modula-2
> +turns on runtime checking to check whether a floating point number is about to exceed range
> +
> +fgen-module-list=
> +Modula-2 Joined
> +create a topologically sorted module list from all dependent modules used in the application
> +
> +findex
> +Modula-2
> +turns on all range checking for numerical values
> +
> +fiso
> +Modula-2
> +use ISO dialect of Modula-2
> +
> +flibs=
> +Modula-2 Joined
> +specify the library order, currently legal entries include: log, min, pim, iso or their directory name equivalent m2log, m2min, m2pim, m2iso.
> +
> +flocation=
> +Modula-2 Joined
> +set all location values to a specific value (internal switch)
> +
> +fm2-g
> +Modula-2
> +generate extra nops to improve debugging, producing an instruction for every code related keyword
> +
> +fm2-lower-case
> +Modula-2
> +generate error messages which render keywords in lower case
> +
> +fm2-plugin
> +Modula-2
> +insert plugin to identify runtime errors at compiletime (default on)
> +
> +fm2-statistics
> +Modula-2
> +display statistics about the amount of source lines compiled and symbols used
> +
> +fm2-strict-type
> +Modula-2
> +experimental flag to turn on the new strict type checker
> +
> +fm2-whole-program
> +Modula-2
> +compile all implementation modules and program module at once
> +
> +fmod=
> +Modula-2 Joined
> +recognise the specified suffix as implementation and module filenames
> +
> +fnil
> +Modula-2
> +turns on runtime checking to detect accessing data through a NIL value pointer
> +
> +fpim
> +Modula-2
> +use PIM [234] dialect of Modula-2
> +
> +fpim2
> +Modula-2
> +use PIM 2 dialect of Modula-2
> +
> +fpim3
> +Modula-2
> +use PIM 3 dialect of Modula-2
> +
> +fpim4
> +Modula-2
> +use PIM 4 dialect of Modula-2
> +
> +fpositive-mod-floor-div
> +Modula-2
> +force positive result from MOD and DIV result floor
> +
> +fpthread
> +Modula-2
> +link against the pthread library (default on)
> +
> +fq
> +Modula-2
> +internal compiler debugging information, dump the list of quadruples
> +
> +frange
> +Modula-2
> +turns on all range checking for numerical values
> +
> +freturn
> +Modula-2
> +turns on runtime checking for functions which finish without executing a RETURN statement
> +
> +fruntime-modules=
> +Modula-2 Joined
> +specify the list of runtime modules and their initialization order
> +
> +fscaffold-dynamic
> +Modula-2
> +the modules initialization order is dynamically determined by M2RTS and application dependancies
> +
> +fscaffold-c
> +Modula-2
> +generate a C source scaffold for the current module being compiled
> +
> +fscaffold-c++
> +Modula-2
> +generate a C++ source scaffold for the current module being compiled
> +
> +fscaffold-main
> +Modula-2
> +generate the main function
> +
> +fscaffold-static
> +Modula-2
> +generate static scaffold initialization and finalization for every module inside main
> +
> +fshared
> +Modula-2
> +generate a shared library from the module
> +
> +fsoft-check-all
> +Modula-2
> +turns on all software runtime checking (an abbreviation for -fnil -frange -findex -fwholediv -fcase -freturn -fwholevalue -ffloatvalue)
> +
> +fsources
> +Modula-2
> +display the location of module source files as they are compiled
> +
> +fswig
> +Modula-2
> +create a swig interface file for the module
> +
> +funbounded-by-reference
> +Modula-2
> +optimize non var unbounded parameters by passing it by reference, providing it is not written to within the callee procedure.
> +
> +fuse-list=
> +Modula-2 Joined
> +orders the initialization/finalializations for scaffold-static or force linking of modules if scaffold-dynamic
> +
> +fversion
> +Modula-2
> +; Documented in common.opt
> +
> +fwholediv
> +Modula-2
> +turns on all division and modulus by zero checking for ordinal values
> +
> +fwholevalue
> +Modula-2
> +turns on runtime checking to check whether a whole number is about to exceed range
> +
> +iprefix
> +Modula-2
> +; Documented in c.opt
> +
> +isystem
> +Modula-2
> +; Documented in c.opt
> +
> +idirafter
> +Modula-2
> +; Documented in c.opt
> +
> +imultilib
> +Modula-2
> +; Documented in c.opt
> +
> +lang-asm
> +Modula-2
> +; Documented in c.opt
> +
> +-save-temps
> +Modula-2 Alias(save-temps)
> +
> +save-temps
> +Modula-2
> +save temporary preprocessed files
> +
> +save-temps=
> +Modula-2 Joined
> +save temporary preprocessed files
> +
> +traditional-cpp
> +Modula-2
> +; Documented in c.opt
> +
> +v
> +Modula-2
> +; Documented in c.opt
> +
> +x
> +Modula-2 Joined
> +specify the language from the compiler driver
> +
> +; This comment is to ensure we retain the blank line above.
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-lang.cc
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/gm2-lang.cc    2022-12-10 00:04:30.307603788 +0000
> @@ -0,0 +1,892 @@
> +/* gm2-lang.cc language-dependent hooks for GNU Modula-2.
> +
> +Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +Contributed by Gaius Mulley <gaius@glam.ac.uk>.
> +
> +This file is part of GNU Modula-2.
> +
> +GNU Modula-2 is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GNU Modula-2 is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Modula-2; see the file COPYING.  If not, write to the
> +Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301, USA.  */
> +
> +#include "gm2-gcc/gcc-consolidation.h"
> +
> +#include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name.  */
> +#include "tree-pass.h"     /* FIXME: only for PROP_gimple_any.  */
> +#include "toplev.h"
> +#include "debug.h"
> +
> +#include "opts.h"
> +
> +#define GM2_LANG_C
> +#include "gm2-lang.h"
> +#include "m2block.h"
> +#include "dynamicstrings.h"
> +#include "m2options.h"
> +#include "m2convert.h"
> +#include "m2linemap.h"
> +#include "init.h"
> +#include "m2-tree.h"
> +#include "convert.h"
> +#include "rtegraph.h"
> +
> +static void write_globals (void);
> +
> +static int insideCppArgs = FALSE;
> +
> +#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
> +
> +/* start of new stuff.  */
> +
> +/* Language-dependent contents of a type.  */
> +
> +struct GTY (()) lang_type
> +{
> +  char dummy;
> +};
> +
> +/* Language-dependent contents of a decl.  */
> +
> +struct GTY (()) lang_decl
> +{
> +  char dummy;
> +};
> +
> +/* Language-dependent contents of an identifier.  This must include a
> +   tree_identifier.  */
> +
> +struct GTY (()) lang_identifier
> +{
> +  struct tree_identifier common;
> +};
> +
> +/* The resulting tree type.  */
> +
> +union GTY ((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
> +            chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), "
> +                        "TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN "
> +                        "(&%h.generic)) : NULL"))) lang_tree_node
> +{
> +  union tree_node GTY ((tag ("0"),
> +                        desc ("tree_node_structure (&%h)"))) generic;
> +  struct lang_identifier GTY ((tag ("1"))) identifier;
> +};
> +
> +struct GTY (()) language_function
> +{
> +
> +  /* While we are parsing the function, this contains information about
> +  the statement-tree that we are building.  */
> +  /* struct stmt_tree_s stmt_tree;  */
> +  tree stmt_tree;
> +};
> +
> +/* Language hooks.  */
> +
> +bool
> +gm2_langhook_init (void)
> +{
> +  build_common_tree_nodes (false);
> +  build_common_builtin_nodes ();
> +
> +  /* The default precision for floating point numbers.  This is used
> +     for floating point constants with abstract type.  This may eventually
> +     be controllable by a command line option.  */
> +  mpfr_set_default_prec (256);
> +
> +  /* GNU Modula-2 uses exceptions.  */
> +  using_eh_for_cleanups ();
> +  return true;
> +}
> +
> +/* The option mask.  */
> +
> +static unsigned int
> +gm2_langhook_option_lang_mask (void)
> +{
> +  return CL_ModulaX2;
> +}
> +
> +/* Initialize the options structure.  */
> +
> +static void
> +gm2_langhook_init_options_struct (struct gcc_options *opts)
> +{
> +  /* Default to avoiding range issues for complex multiply and divide.  */
> +  opts->x_flag_complex_method = 2;
> +
> +  /* The builtin math functions should not set errno.  */
> +  opts->x_flag_errno_math = 0;
> +  opts->frontend_set_flag_errno_math = true;
> +
> +  /* Exceptions are used.  */
> +  opts->x_flag_exceptions = 1;
> +  init_FrontEndInit ();
> +}
> +
> +/* Infrastructure for a VEC of bool values.  */
> +
> +/* This array determines whether the filename is associated with the
> +   C preprocessor.  */
> +
> +static vec<bool> filename_cpp;
> +
> +void
> +gm2_langhook_init_options (unsigned int decoded_options_count,
> +                           struct cl_decoded_option *decoded_options)
> +{
> +  unsigned int i;
> +  bool in_cpp_args = false;
> +
> +  for (i = 1; i < decoded_options_count; i++)
> +    {
> +      switch (decoded_options[i].opt_index)
> +        {
> +        case OPT_fcpp_begin:
> +          in_cpp_args = true;
> +          break;
> +        case OPT_fcpp_end:
> +          in_cpp_args = false;
> +          break;
> +        case OPT_SPECIAL_input_file:
> +        case OPT_SPECIAL_program_name:
> +          filename_cpp.safe_push (in_cpp_args);
> +        }
> +    }
> +  filename_cpp.safe_push (false);
> +}
> +
> +static bool
> +is_cpp_filename (unsigned int i)
> +{
> +  gcc_assert (i < filename_cpp.length ());
> +  return filename_cpp[i];
> +}
> +
> +/* Handle gm2 specific options.  Return 0 if we didn't do anything.  */
> +
> +bool
> +gm2_langhook_handle_option (
> +    size_t scode, const char *arg, HOST_WIDE_INT value, int kind ATTRIBUTE_UNUSED,
> +    location_t loc ATTRIBUTE_UNUSED,
> +    const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
> +{
> +  enum opt_code code = (enum opt_code)scode;
> +
> +  /* ignore file names.  */
> +  if (code == N_OPTS)
> +    return 1;
> +
> +  switch (code)
> +    {
> +    case OPT_B:
> +      M2Options_SetB (arg);
> +      return 1;
> +    case OPT_c:
> +      M2Options_Setc (value);
> +      return 1;
> +    case OPT_I:
> +      if (insideCppArgs)
> +        {
> +          const struct cl_option *option = &cl_options[scode];
> +          const char *opt = (const char *)option->opt_text;
> +          M2Options_CppArg (opt, arg, TRUE);
> +        }
> +      else
> +        M2Options_SetSearchPath (arg);
> +      return 1;
> +    case OPT_fiso:
> +      M2Options_SetISO (value);
> +      return 1;
> +    case OPT_fpim:
> +      M2Options_SetPIM (value);
> +      return 1;
> +    case OPT_fpim2:
> +      M2Options_SetPIM2 (value);
> +      return 1;
> +    case OPT_fpim3:
> +      M2Options_SetPIM3 (value);
> +      return 1;
> +    case OPT_fpim4:
> +      M2Options_SetPIM4 (value);
> +      return 1;
> +    case OPT_fpositive_mod_floor_div:
> +      M2Options_SetPositiveModFloor (value);
> +      return 1;
> +    case OPT_flibs_:
> +      /* handled in the gm2 driver.  */
> +      return 1;
> +    case OPT_fgen_module_list_:
> +      M2Options_SetGenModuleList (value, arg);
> +      return 1;
> +    case OPT_fnil:
> +      M2Options_SetNilCheck (value);
> +      return 1;
> +    case OPT_fwholediv:
> +      M2Options_SetWholeDiv (value);
> +      return 1;
> +    case OPT_findex:
> +      M2Options_SetIndex (value);
> +      return 1;
> +    case OPT_frange:
> +      M2Options_SetRange (value);
> +      return 1;
> +    case OPT_ffloatvalue:
> +      M2Options_SetFloatValueCheck (value);
> +      return 1;
> +    case OPT_fwholevalue:
> +      M2Options_SetWholeValueCheck (value);
> +      return 1;
> +    case OPT_freturn:
> +      M2Options_SetReturnCheck (value);
> +      return 1;
> +    case OPT_fcase:
> +      M2Options_SetCaseCheck (value);
> +      return 1;
> +    case OPT_fd:
> +      M2Options_SetCompilerDebugging (value);
> +      return 1;
> +    case OPT_fdebug_trace_quad:
> +      M2Options_SetDebugTraceQuad (value);
> +      return 1;
> +    case OPT_fdebug_trace_api:
> +      M2Options_SetDebugTraceAPI (value);
> +      return 1;
> +    case OPT_fdebug_function_line_numbers:
> +      M2Options_SetDebugFunctionLineNumbers (value);
> +      return 1;
> +    case OPT_fauto_init:
> +      M2Options_SetAutoInit (value);
> +      return 1;
> +    case OPT_fsoft_check_all:
> +      M2Options_SetCheckAll (value);
> +      return 1;
> +    case OPT_fexceptions:
> +      M2Options_SetExceptions (value);
> +      return 1;
> +    case OPT_Wstyle:
> +      M2Options_SetStyle (value);
> +      return 1;
> +    case OPT_Wpedantic:
> +      M2Options_SetPedantic (value);
> +      return 1;
> +    case OPT_Wpedantic_param_names:
> +      M2Options_SetPedanticParamNames (value);
> +      return 1;
> +    case OPT_Wpedantic_cast:
> +      M2Options_SetPedanticCast (value);
> +      return 1;
> +    case OPT_fextended_opaque:
> +      M2Options_SetExtendedOpaque (value);
> +      return 1;
> +    case OPT_Wverbose_unbounded:
> +      M2Options_SetVerboseUnbounded (value);
> +      return 1;
> +    case OPT_Wunused_variable:
> +      M2Options_SetUnusedVariableChecking (value);
> +      return 1;
> +    case OPT_Wunused_parameter:
> +      M2Options_SetUnusedParameterChecking (value);
> +      return 1;
> +    case OPT_fm2_strict_type:
> +      M2Options_SetStrictTypeChecking (value);
> +      return 1;
> +    case OPT_Wall:
> +      M2Options_SetWall (value);
> +      return 1;
> +#if 0
> +    /* Not yet implemented.  */
> +    case OPT_fxcode:
> +      M2Options_SetXCode (value);
> +      return 1;
> +#endif
> +    case OPT_fm2_lower_case:
> +      M2Options_SetLowerCaseKeywords (value);
> +      return 1;
> +    case OPT_fuse_list_:
> +      M2Options_SetUselist (value, arg);
> +      return 1;
> +    case OPT_fruntime_modules_:
> +      M2Options_SetRuntimeModuleOverride (arg);
> +      return 1;
> +    case OPT_fpthread:
> +      /* Handled in the driver.  */
> +      return 1;
> +    case OPT_fm2_plugin:
> +      /* Handled in the driver.  */
> +      return 1;
> +    case OPT_fscaffold_dynamic:
> +      M2Options_SetScaffoldDynamic (value);
> +      return 1;
> +    case OPT_fscaffold_static:
> +      M2Options_SetScaffoldStatic (value);
> +      return 1;
> +    case OPT_fscaffold_main:
> +      M2Options_SetScaffoldMain (value);
> +      return 1;
> +    case OPT_fcpp:
> +      M2Options_SetCpp (value);
> +      return 1;
> +    case OPT_fcpp_begin:
> +      insideCppArgs = TRUE;
> +      return 1;
> +    case OPT_fcpp_end:
> +      insideCppArgs = FALSE;
> +      return 1;
> +    case OPT_fq:
> +      M2Options_SetQuadDebugging (value);
> +      return 1;
> +    case OPT_fsources:
> +      M2Options_SetSources (value);
> +      return 1;
> +    case OPT_funbounded_by_reference:
> +      M2Options_SetUnboundedByReference (value);
> +      return 1;
> +    case OPT_fdef_:
> +      M2Options_setdefextension (arg);
> +      return 1;
> +    case OPT_fmod_:
> +      M2Options_setmodextension (arg);
> +      return 1;
> +    case OPT_fdump_system_exports:
> +      M2Options_SetDumpSystemExports (value);
> +      return 1;
> +    case OPT_fswig:
> +      M2Options_SetSwig (value);
> +      return 1;
> +    case OPT_fshared:
> +      M2Options_SetShared (value);
> +      return 1;
> +    case OPT_fm2_statistics:
> +      M2Options_SetStatistics (value);
> +      return 1;
> +    case OPT_fm2_g:
> +      M2Options_SetM2g (value);
> +      return 1;
> +    case OPT_O:
> +      M2Options_SetOptimizing (value);
> +      return 1;
> +    case OPT_quiet:
> +      M2Options_SetQuiet (value);
> +      return 1;
> +    case OPT_fm2_whole_program:
> +      M2Options_SetWholeProgram (value);
> +      return 1;
> +    case OPT_flocation_:
> +      if (strcmp (arg, "builtins") == 0)
> +        {
> +          M2Options_SetForcedLocation (BUILTINS_LOCATION);
> +          return 1;
> +        }
> +      else if (strcmp (arg, "unknown") == 0)
> +        {
> +          M2Options_SetForcedLocation (UNKNOWN_LOCATION);
> +          return 1;
> +        }
> +      else if ((arg != NULL) && (ISDIGIT (arg[0])))
> +        {
> +          M2Options_SetForcedLocation (atoi (arg));
> +          return 1;
> +        }
> +      else
> +        return 0;
> +    case OPT_save_temps:
> +      M2Options_SetSaveTemps (value);
> +      return 1;
> +    case OPT_save_temps_:
> +      M2Options_SetSaveTempsDir (arg);
> +      return 1;
> +    default:
> +      if (insideCppArgs)
> +        {
> +          const struct cl_option *option = &cl_options[scode];
> +          const char *opt = (const char *)option->opt_text;
> +
> +          M2Options_CppArg (opt, arg, TRUE);
> +          return 1;
> +        }
> +      return 0;
> +    }
> +  return 0;
> +}
> +
> +/* Run after parsing options.  */
> +
> +static bool
> +gm2_langhook_post_options (const char **pfilename)
> +{
> +  const char *filename = *pfilename;
> +  flag_excess_precision = EXCESS_PRECISION_FAST;
> +  M2Options_SetCC1Quiet (quiet_flag);
> +  M2Options_FinaliseOptions ();
> +  main_input_filename = filename;
> +
> +  /* Returning false means that the backend should be used.  */
> +  return false;
> +}
> +
> +/* Call the compiler for every source filename on the command line.  */
> +
> +static void
> +gm2_parse_input_files (const char **filenames, unsigned int filename_count)
> +{
> +  unsigned int i;
> +  gcc_assert (filename_count > 0);
> +
> +  for (i = 0; i < filename_count; i++)
> +    if (!is_cpp_filename (i))
> +      {
> +       main_input_filename = filenames[i];
> +       init_PerCompilationInit (filenames[i]);
> +      }
> +}
> +
> +static void
> +gm2_langhook_parse_file (void)
> +{
> +  gm2_parse_input_files (in_fnames, num_in_fnames);
> +  write_globals ();
> +}
> +
> +static tree
> +gm2_langhook_type_for_size (unsigned int bits, int unsignedp)
> +{
> +  return gm2_type_for_size (bits, unsignedp);
> +}
> +
> +static tree
> +gm2_langhook_type_for_mode (machine_mode mode, int unsignedp)
> +{
> +  tree type;
> +
> +  for (int i = 0; i < NUM_INT_N_ENTS; i ++)
> +    if (int_n_enabled_p[i]
> +       && mode == int_n_data[i].m)
> +      return (unsignedp ? int_n_trees[i].unsigned_type
> +             : int_n_trees[i].signed_type);
> +
> +  if (VECTOR_MODE_P (mode))
> +    {
> +      tree inner;
> +
> +      inner = gm2_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp);
> +      if (inner != NULL_TREE)
> +        return build_vector_type_for_mode (inner, mode);
> +      return NULL_TREE;
> +    }
> +
> +  scalar_int_mode imode;
> +  if (is_int_mode (mode, &imode))
> +    return gm2_langhook_type_for_size (GET_MODE_BITSIZE (imode), unsignedp);
> +
> +  if (mode == TYPE_MODE (float_type_node))
> +    return float_type_node;
> +
> +  if (mode == TYPE_MODE (double_type_node))
> +    return double_type_node;
> +
> +  if (mode == TYPE_MODE (long_double_type_node))
> +    return long_double_type_node;
> +
> +  if (COMPLEX_MODE_P (mode))
> +    {
> +      if (mode == TYPE_MODE (complex_float_type_node))
> +       return complex_float_type_node;
> +      if (mode == TYPE_MODE (complex_double_type_node))
> +       return complex_double_type_node;
> +      if (mode == TYPE_MODE (complex_long_double_type_node))
> +       return complex_long_double_type_node;
> +    }
> +
> +#if HOST_BITS_PER_WIDE_INT >= 64
> +  /* The middle-end and some backends rely on TImode being supported
> +  for 64-bit HWI.  */
> +  if (mode == TImode)
> +    {
> +      type = build_nonstandard_integer_type (GET_MODE_BITSIZE (TImode),
> +                                             unsignedp);
> +      if (type && TYPE_MODE (type) == TImode)
> +        return type;
> +    }
> +#endif
> +  return NULL_TREE;
> +}
> +
> +/* Record a builtin function.  We just ignore builtin functions.  */
> +
> +static tree
> +gm2_langhook_builtin_function (tree decl)
> +{
> +  return decl;
> +}
> +
> +/* Return true if we are in the global binding level.  */
> +
> +static bool
> +gm2_langhook_global_bindings_p (void)
> +{
> +  return current_function_decl == NULL_TREE;
> +}
> +
> +/* Unused langhook.  */
> +
> +static tree
> +gm2_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
> +{
> +  gcc_unreachable ();
> +}
> +
> +/* This hook is used to get the current list of declarations as trees.
> +   We don't support that; instead we use write_globals.  This can't
> +   simply crash because it is called by -gstabs.  */
> +
> +static tree
> +gm2_langhook_getdecls (void)
> +{
> +  return NULL;
> +}
> +
> +/* m2_write_global_declarations writes out globals creating an array
> +   of the declarations and calling wrapup_global_declarations.  */
> +
> +static void
> +m2_write_global_declarations (tree globals)
> +{
> +  auto_vec<tree> global_decls;
> +  tree decl = globals;
> +  int n = 0;
> +
> +  while (decl != NULL)
> +    {
> +      global_decls.safe_push (decl);
> +      decl = TREE_CHAIN (decl);
> +      n++;
> +    }
> +  wrapup_global_declarations (global_decls.address (), n);
> +}
> +
> +/* Write out globals.  */
> +
> +static void
> +write_globals (void)
> +{
> +  tree t;
> +  unsigned i;
> +
> +  m2block_finishGlobals ();
> +
> +  /* Process all file scopes in this compilation, and the
> +     external_scope, through wrapup_global_declarations and
> +     check_global_declarations.  */
> +  FOR_EACH_VEC_ELT (*all_translation_units, i, t)
> +  m2_write_global_declarations (BLOCK_VARS (DECL_INITIAL (t)));
> +}
> +
> +
> +/* Gimplify an EXPR_STMT node.  */
> +
> +static void
> +gimplify_expr_stmt (tree *stmt_p)
> +{
> +  gcc_assert (EXPR_STMT_EXPR (*stmt_p) != NULL_TREE);
> +  *stmt_p = EXPR_STMT_EXPR (*stmt_p);
> +}
> +
> +/* Genericize a TRY_BLOCK.  */
> +
> +static void
> +genericize_try_block (tree *stmt_p)
> +{
> +  tree body = TRY_STMTS (*stmt_p);
> +  tree cleanup = TRY_HANDLERS (*stmt_p);
> +
> +  *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup);
> +}
> +
> +/* Genericize a HANDLER by converting to a CATCH_EXPR.  */
> +
> +static void
> +genericize_catch_block (tree *stmt_p)
> +{
> +  tree type = HANDLER_TYPE (*stmt_p);
> +  tree body = HANDLER_BODY (*stmt_p);
> +
> +  /* FIXME should the caught type go in TREE_TYPE?  */
> +  *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body);
> +}
> +
> +/* Convert the tree representation of FNDECL from m2 frontend trees
> +   to GENERIC.  */
> +
> +extern void pf (tree);
> +
> +void
> +gm2_genericize (tree fndecl)
> +{
> +  tree t;
> +  struct cgraph_node *cgn;
> +
> +#if 0
> +  pf (fndecl);
> +#endif
> +  /* Fix up the types of parms passed by invisible reference.  */
> +  for (t = DECL_ARGUMENTS (fndecl); t; t = DECL_CHAIN (t))
> +    if (TREE_ADDRESSABLE (TREE_TYPE (t)))
> +      {
> +
> +        /* If a function's arguments are copied to create a thunk, then
> +          DECL_BY_REFERENCE will be set -- but the type of the argument will be
> +          a pointer type, so we will never get here.  */
> +        gcc_assert (!DECL_BY_REFERENCE (t));
> +        gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t));
> +        TREE_TYPE (t) = DECL_ARG_TYPE (t);
> +        DECL_BY_REFERENCE (t) = 1;
> +        TREE_ADDRESSABLE (t) = 0;
> +        relayout_decl (t);
> +      }
> +
> +  /* Dump all nested functions now.  */
> +  cgn = cgraph_node::get_create (fndecl);
> +  for (cgn = first_nested_function (cgn);
> +       cgn != NULL; cgn = next_nested_function (cgn))
> +    gm2_genericize (cgn->decl);
> +}
> +
> +/* gm2 gimplify expression, currently just change THROW in the same
> +   way as C++ */
> +
> +static int
> +gm2_langhook_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
> +                            gimple_seq *post_p ATTRIBUTE_UNUSED)
> +{
> +  enum tree_code code = TREE_CODE (*expr_p);
> +
> +  switch (code)
> +    {
> +    case THROW_EXPR:
> +
> +      /* FIXME communicate throw type to back end, probably by moving
> +      THROW_EXPR into ../tree.def.  */
> +      *expr_p = TREE_OPERAND (*expr_p, 0);
> +      return GS_OK;
> +
> +    case EXPR_STMT:
> +      gimplify_expr_stmt (expr_p);
> +      return GS_OK;
> +
> +    case TRY_BLOCK:
> +      genericize_try_block (expr_p);
> +      return GS_OK;
> +
> +    case HANDLER:
> +      genericize_catch_block (expr_p);
> +      return GS_OK;
> +
> +    default:
> +      return GS_UNHANDLED;
> +    }
> +}
> +
> +static GTY(()) tree gm2_eh_personality_decl;
> +
> +static tree
> +gm2_langhook_eh_personality (void)
> +{
> +  if (!gm2_eh_personality_decl)
> +    gm2_eh_personality_decl = build_personality_function ("gxx");
> +
> +  return gm2_eh_personality_decl;
> +}
> +
> +/* Functions called directly by the generic backend.  */
> +
> +tree
> +convert_loc (location_t location, tree type, tree expr)
> +{
> +  if (type == error_mark_node || expr == error_mark_node
> +      || TREE_TYPE (expr) == error_mark_node)
> +    return error_mark_node;
> +
> +  if (type == TREE_TYPE (expr))
> +    return expr;
> +
> +  gcc_assert (TYPE_MAIN_VARIANT (type) != NULL);
> +  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
> +    return fold_convert (type, expr);
> +
> +  expr = m2convert_GenericToType (location, type, expr);
> +  switch (TREE_CODE (type))
> +    {
> +    case VOID_TYPE:
> +    case BOOLEAN_TYPE:
> +      return fold_convert (type, expr);
> +    case INTEGER_TYPE:
> +      return fold (convert_to_integer (type, expr));
> +    case POINTER_TYPE:
> +      return fold (convert_to_pointer (type, expr));
> +    case REAL_TYPE:
> +      return fold (convert_to_real (type, expr));
> +    case COMPLEX_TYPE:
> +      return fold (convert_to_complex (type, expr));
> +    case ENUMERAL_TYPE:
> +      return fold (convert_to_integer (type, expr));
> +    default:
> +      error_at (location, "cannot convert expression, only base types can be converted");
> +      break;
> +    }
> +  return error_mark_node;
> +}
> +
> +/* Functions called directly by the generic backend.  */
> +
> +tree
> +convert (tree type, tree expr)
> +{
> +  return convert_loc (m2linemap_UnknownLocation (), type, expr);
> +}
> +
> +/* Mark EXP saying that we need to be able to take the address of it;
> +   it should not be allocated in a register.  Returns true if
> +   successful.  */
> +
> +bool
> +gm2_mark_addressable (tree exp)
> +{
> +  tree x = exp;
> +
> +  while (TRUE)
> +    switch (TREE_CODE (x))
> +      {
> +      case COMPONENT_REF:
> +       if (DECL_PACKED (TREE_OPERAND (x, 1)))
> +         return false;
> +       x = TREE_OPERAND (x, 0);
> +       break;
> +
> +      case ADDR_EXPR:
> +      case ARRAY_REF:
> +      case REALPART_EXPR:
> +      case IMAGPART_EXPR:
> +        x = TREE_OPERAND (x, 0);
> +        break;
> +
> +      case COMPOUND_LITERAL_EXPR:
> +      case CONSTRUCTOR:
> +      case STRING_CST:
> +      case VAR_DECL:
> +      case CONST_DECL:
> +      case PARM_DECL:
> +      case RESULT_DECL:
> +      case FUNCTION_DECL:
> +        TREE_ADDRESSABLE (x) = 1;
> +        return true;
> +      default:
> +        return true;
> +      }
> +  /* Never reach here.  */
> +  gcc_unreachable ();
> +}
> +
> +/* Return an integer type with BITS bits of precision, that is
> +   unsigned if UNSIGNEDP is nonzero, otherwise signed.  */
> +
> +tree
> +gm2_type_for_size (unsigned int bits, int unsignedp)
> +{
> +  tree type;
> +
> +  if (unsignedp)
> +    {
> +      if (bits == INT_TYPE_SIZE)
> +        type = unsigned_type_node;
> +      else if (bits == CHAR_TYPE_SIZE)
> +        type = unsigned_char_type_node;
> +      else if (bits == SHORT_TYPE_SIZE)
> +        type = short_unsigned_type_node;
> +      else if (bits == LONG_TYPE_SIZE)
> +        type = long_unsigned_type_node;
> +      else if (bits == LONG_LONG_TYPE_SIZE)
> +        type = long_long_unsigned_type_node;
> +      else
> +       type = build_nonstandard_integer_type (bits,
> +                                              unsignedp);
> +    }
> +  else
> +    {
> +      if (bits == INT_TYPE_SIZE)
> +        type = integer_type_node;
> +      else if (bits == CHAR_TYPE_SIZE)
> +        type = signed_char_type_node;
> +      else if (bits == SHORT_TYPE_SIZE)
> +        type = short_integer_type_node;
> +      else if (bits == LONG_TYPE_SIZE)
> +        type = long_integer_type_node;
> +      else if (bits == LONG_LONG_TYPE_SIZE)
> +        type = long_long_integer_type_node;
> +      else
> +       type = build_nonstandard_integer_type (bits,
> +                                              unsignedp);
> +    }
> +  return type;
> +}
> +
> +/* Allow the analyzer to understand Storage ALLOCATE/DEALLOCATE.  */
> +
> +bool
> +gm2_langhook_new_dispose_storage_substitution (void)
> +{
> +  return true;
> +}
> +
> +#undef LANG_HOOKS_NAME
> +#undef LANG_HOOKS_INIT
> +#undef LANG_HOOKS_INIT_OPTIONS
> +#undef LANG_HOOKS_OPTION_LANG_MASK
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#undef LANG_HOOKS_HANDLE_OPTION
> +#undef LANG_HOOKS_POST_OPTIONS
> +#undef LANG_HOOKS_PARSE_FILE
> +#undef LANG_HOOKS_TYPE_FOR_MODE
> +#undef LANG_HOOKS_TYPE_FOR_SIZE
> +#undef LANG_HOOKS_BUILTIN_FUNCTION
> +#undef LANG_HOOKS_GLOBAL_BINDINGS_P
> +#undef LANG_HOOKS_PUSHDECL
> +#undef LANG_HOOKS_GETDECLS
> +#undef LANG_HOOKS_GIMPLIFY_EXPR
> +#undef LANG_HOOKS_EH_PERSONALITY
> +#undef LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION
> +
> +#define LANG_HOOKS_NAME "GNU Modula-2"
> +#define LANG_HOOKS_INIT gm2_langhook_init
> +#define LANG_HOOKS_INIT_OPTIONS gm2_langhook_init_options
> +#define LANG_HOOKS_OPTION_LANG_MASK gm2_langhook_option_lang_mask
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT gm2_langhook_init_options_struct
> +#define LANG_HOOKS_HANDLE_OPTION gm2_langhook_handle_option
> +#define LANG_HOOKS_POST_OPTIONS gm2_langhook_post_options
> +#define LANG_HOOKS_PARSE_FILE gm2_langhook_parse_file
> +#define LANG_HOOKS_TYPE_FOR_MODE gm2_langhook_type_for_mode
> +#define LANG_HOOKS_TYPE_FOR_SIZE gm2_langhook_type_for_size
> +#define LANG_HOOKS_BUILTIN_FUNCTION gm2_langhook_builtin_function
> +#define LANG_HOOKS_GLOBAL_BINDINGS_P gm2_langhook_global_bindings_p
> +#define LANG_HOOKS_PUSHDECL gm2_langhook_pushdecl
> +#define LANG_HOOKS_GETDECLS gm2_langhook_getdecls
> +#define LANG_HOOKS_GIMPLIFY_EXPR gm2_langhook_gimplify_expr
> +#define LANG_HOOKS_EH_PERSONALITY gm2_langhook_eh_personality
> +#define LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION \
> +  gm2_langhook_new_dispose_storage_substitution
> +
> +struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
> +
> +#include "gt-m2-gm2-lang.h"
> +#include "gtype-m2.h"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/19] modula2 front end: changes outside gcc/m2, libgm2 and gcc/testsuite.
  2022-12-11 10:42 ` Richard Biener
@ 2022-12-12  9:05   ` Gaius Mulley
  2022-12-14  7:48   ` [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter) Gaius Mulley
  1 sibling, 0 replies; 8+ messages in thread
From: Gaius Mulley @ 2022-12-12  9:05 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Richard Biener <richard.guenther@gmail.com> writes:

> On Sat, Dec 10, 2022 at 1:49 AM Gaius Mulley via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>>
>> While writing the ChangeLog entries git gcc-verify spotted an oversight
>> with v3 of this patch set.  I had forgotten to post gm2.texi and also a
>> tiny patchlet in gcc/configure.ac (to detect Python).  HAVE_PYTHON is
>> used within gcc/m2/Make-lang.in to avoid generating the library section
>> included by gm2.texi should Python not be available.
>
> The configure check doesn't verify the python version.

indeed - I'll fix this

>  Does --enable-generated-files-in-srcdir (used when building release
> tarballs) generate the required section so it's packed up in the
> release tarball and avoid requiring python3 when building from the
> release tarball?

currently working on it - no it fails - should be done rsn.

> Note these kind of dependences should be mentioned in
> install.texi - for python also listing required modules would be nice.

I'll add these.

> Thanks,
> Richard.
>
>> ok to commit?  I've included gm2-lang.cc and lang.opt for reference.
>
> The python script would have been more informative, the generated
> .texi fragment and the Make-lang.in part as well

ah yes this is true, sorry.

regards,
Gaius

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter).
  2022-12-11 10:42 ` Richard Biener
  2022-12-12  9:05   ` Gaius Mulley
@ 2022-12-14  7:48   ` Gaius Mulley
  2022-12-14  8:17     ` Richard Biener
  1 sibling, 1 reply; 8+ messages in thread
From: Gaius Mulley @ 2022-12-14  7:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener



This patch set adds a re-exp ACX_CHECK_PROG_VER to detect python3.
HAVE_PYTHON is then checked in gcc/m2/Make-lang.in to generate library
chapters if python3 is available.  If python3 is unavailable then the
chapters are copied from a target-independent version.

Bugfixed --enable-generated-files-in-srcdir.

Python3 modules section added to install.texi.

Also included are the target-independent versions of the
documentation.  The only difference is in the SYSTEM module which if
generated when HAVE_PYTHON is "yes" will enumerate all fundamental
data types supported by the target and compiler.

I've hand snipped to try and reduce the size/noise as some of
these files have already been reviewed.

I'll post the unedited version as well for completness,

regards,
Gaius



------8<----------8<----------8<----------8<----------8<----------8<----
diff -ruw gcc-git-master/gcc/configure.ac gcc-git-devel-modula2/gcc/configure.ac
--- gcc-git-master/gcc/configure.ac	2022-12-14 06:54:50.040826539 +0000
+++ gcc-git-devel-modula2/gcc/configure.ac	2022-12-14 06:54:59.564964362 +0000
@@ -1263,6 +1263,20 @@
 # Bison?
 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])

+# Python3?
+ACX_CHECK_PROG_VER(PYTHON, python3, --version,
+  [Python.* \([0-9][0-9.]*\)],
+  [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*])
+if test $gcc_cv_prog_python3_modern = no; then
+  AC_MSG_WARN([
+*** Python3 is missing.
+*** Documentation for modula-2 will not include the target SYSTEM module.])
+  HAVE_PYTHON=no
+else
+  HAVE_PYTHON=yes
+fi
+AC_SUBST(HAVE_PYTHON)
+
 # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
 # check for build == host before using them.

@@ -7651,4 +7665,3 @@
 ],
 [subdirs='$subdirs'])
 AC_OUTPUT
-
diff -ruw gcc-git-master/gcc/doc/install.texi gcc-git-devel-modula2/gcc/doc/install.texi
--- gcc-git-master/gcc/doc/install.texi	2022-12-14 06:54:50.132827871 +0000
+++ gcc-git-devel-modula2/gcc/doc/install.texi	2022-12-14 06:54:59.604964941 +0000
@@ -308,6 +308,13 @@
 and works if @option{--enable-libphobos} is used.  Specifics are
 documented for affected targets.

+@item @anchor{GM2-prerequisite}GM2
+
+Python3 is required if you want to build the complete Modula-2
+documentation including the target @code{SYSTEM} definition module.
+If Python3 is unavailable Modula-2 documentation will include a target
+independent version of the SYSTEM modules.
+
 @item A ``working'' POSIX compatible shell, or GNU bash

 Necessary when running @command{configure} because some
@@ -436,6 +443,34 @@
 The library is searched in your default library patch search.
 Alternatively, the @option{--with-zstd} configure option should be used.

+@item Python3 modules
+
+The complete list of Python3 modules broken down by GCC subcomponent
+is shown below:
+
+@table @asis
+@item internal debugging in gdbhooks
+@code{gdb}, @code{gdb.printing}, @code{gdb.types},
+@code{os.path}, @code{re}, @code{sys} and @code{tempfile},
+
+@item g++ testsuite
+@code{gcov}, @code{gzip}, @code{json}, @code{os} and @code{pytest}.
+
+@item c++ cxx api generation
+@code{csv}, @code{os}, @code{sys} and @code{time}.
+
+@item modula-2 documentation
+@code{argparse}, @code{os}, @code{pathlib}, @code{shutil} and
+@code{sys}.
+
+@item git developer tools
+@code{os} and @code{sys}.
+
+@item ada documentation
+@code{latex_elements}, @code{os}, @code{pygments}, @code{re},
+@code{sys} and @code{time}.
+@end table
+
 @end table

 @heading Tools/packages necessary for modifying GCC
@@ -3144,10 +3179,10 @@
 In order to run sets of tests selectively, there are targets
 @samp{make check-gcc} and language specific @samp{make check-c},
 @samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
-@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
-@samp{make check-lto}
-in the @file{gcc} subdirectory of the object directory.  You can also
-just run @samp{make check} in a subdirectory of the object directory.
+@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
+@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
+subdirectory of the object directory.  You can also just run
+@samp{make check} in a subdirectory of the object directory.


 A more selective way to just run all @command{gcc} execute tests in the
diff -ruw /dev/null gcc-git-devel-modula2/gcc/doc/gm2.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/doc/gm2.texi	2022-12-14 06:54:59.604964941 +0000

  snip  (the changed text follows below, at "Finally the results")

@node Regression tests, Limitations, Documentation, Using
@section Regression tests for gm2 in the repository

The regression testsuite can be run from the gcc build directory:

@example
$ cd build-gcc
$ make check -j 24
@end example

which runs the complete testsuite for all compilers using 24 parallel
invocations of the compiler.  Individual language testsuites can be
run by specifying the language, for example the Modula-2 testsuite can
be run using:

@example
$ cd build-gcc
$ make check-m2 -j 24
@end example

+Finally the results of the testsuite can be emailed to the
+@url{https://gcc.gnu.org/lists.html, gcc-testresults} list using the
+@file{test_summary} script found in the gcc source tree:
+
+@example
+$ @samp{directory to the sources}/contrib/test_summary
+@end example

  snip

@node Limitations, Objectives, Regression tests, Using
@section Limitations
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/tools-src/def2doc.py
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/tools-src/def2doc.py	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,539 @@

this file has been review before, I'm including it all for context.
The lines starting + are the additions (near
demangle_system_datatype):

#!/usr/bin/env python3

# def2doc.py creates texi library documentation for all exported procedures.
# Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.

# Copyright (C) 2000-2022 Free Software Foundation, Inc.
# This file is part of GNU Modula-2.
#
# GNU Modula-2 is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Modula-2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Modula-2; see the file COPYING.  If not, write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

import argparse
import os
import sys

Base_Libs = ['gm2-libs', 'Base libraries', 'Basic M2F compatible libraries']

PIM_Log_Desc = 'PIM and Logitech 3.0 compatible libraries'
PIM_Log = ['gm2-libs-pim', 'PIM and Logitech 3.0 Compatible', PIM_Log_Desc]
PIM_Cor_Desc = 'PIM compatible process support'
PIM_Cor = ['gm2-libs-coroutines', 'PIM coroutine support', PIM_Cor_Desc]
ISO_Libs = ['gm2-libs-iso', 'M2 ISO Libraries', 'ISO defined libraries']

library_classifications = [Base_Libs, PIM_Log, PIM_Cor, ISO_Libs]

# state_states
state_none, state_var, state_type, state_const = range(4)
# block states
block_none, block_code, block_text, block_index = range(4)


class state:
    def __init__(self):
        self._state_state = state_none
        self._block = block_none

    def get_state(self):
        return self._state_state

    def set_state(self, value):
        self._state_state = value

    def is_const(self):
        return self._state_state == state_const

    def is_type(self):
        return self._state_state == state_type

    def is_var(self):
        return self._state_state == state_var

    def get_block(self):
        return self._block

    def _change_block(self, new_block):
        if self._block != new_block:
            self._block = new_block
            self._emit_block_desc()

    def _emit_block_desc(self):
        if self._block == block_code:
            output.write('.. code-block:: modula2\n')
        elif self._block == block_index:
            output.write('.. index::\n')

    def to_code(self):
        self._change_block(block_code)

    def to_index(self):
        self._change_block(block_index)


def init_state():
    global state_obj
    state_obj = state()


def emit_node(name, nxt, previous, up):
    if args.texinfo:
        output.write('@node ' + name + ', ' + nxt + ', ')
        output.write(previous + ', ' + up + '\n')
    elif args.sphinx:
        output.write('@c @node ' + name + ', ' + nxt + ', ')
        output.write(previous + ', ' + up + '\n')


def emit_section(name):
    if args.texinfo:
        output.write('@section ' + name + '\n')
    elif args.sphinx:
        output.write(name + '\n')
        output.write('=' * len(name) + '\n')


def emit_sub_section(name):
    if args.texinfo:
        output.write('@subsection ' + name + '\n')
    elif args.sphinx:
        output.write(name + '\n')
        output.write('-' * len(name) + '\n')


def display_library_class():
    # display_library_class displays a node for a library directory and invokes
    # a routine to summarize each module.
    global args
    previous = ''
    nxt = library_classifications[1][1]
    i = 0
    lib = library_classifications[i]
    while True:
        emit_node(lib[1], nxt, previous, args.up)
        emit_section(lib[1])
        output.write('\n')
        display_modules(lib[1], lib[0], args.builddir, args.sourcedir)
        output.write('\n')
        output.write('@c ' + '-' * 60 + '\n')
        previous = lib[1]
        i += 1
        if i == len(library_classifications):
            break
        lib = library_classifications[i]
        if i+1 == len(library_classifications):
            nxt = ''
        else:
            nxt = library_classifications[i+1][1]


def display_menu():
    # display_menu displays the top level menu for library documentation.
    output.write('@menu\n')
    for lib in library_classifications:
        output.write('* ' + lib[1] + '::' + lib[2] + '\n')
    output.write('@end menu\n')
    output.write('\n')
    output.write('@c ' + '=' * 60 + '\n')
    output.write('\n')


def remote_initial_comments(file, line):
    # remote_initial_comments removes any (* *) at the top
    # of the definition module.
    while (line.find('*)') == -1):
        line = file.readline()


def removeable_field(line):
    # removeable_field - returns True if a comment field should be removed
    # from the definition module.
    field_list = ['Author', 'Last edit', 'LastEdit', 'Last update',
                  'Date', 'Title', 'Revision']
    for field in field_list:
        if (line.find(field) != -1) and (line.find(':') != -1):
            return True
    ignore_list = ['System', 'SYSTEM']
    for ignore_field in ignore_list:
        if line.find(ignore_field) != -1:
            if line.find(':') != -1:
                if line.find('Description:') == -1:
                    return True
    return False


def remove_fields(file, line):
    # remove_fields removes Author/Date/Last edit/SYSTEM/Revision
    # fields from a comment within the start of a definition module.
    while (line.find('*)') == -1):
        if not removeable_field(line):
            line = line.rstrip().replace('{', '@{').replace('}', '@}')
            output.write(line + '\n')
        line = file.readline()
    output.write(line.rstrip() + '\n')


def emit_index(entry, tag):
    global state_obj
    if args.texinfo:
        if tag == '':
            output.write('@findex ' + entry.rstrip() + '\n')
        else:
            output.write('@findex ' + entry.rstrip() + ' ' + tag + '\n')
    elif args.sphinx:
        if tag == '':
            state_obj.to_index()
            output.write(' ' * 3 + entry.rstrip() + '\n')
        else:
            state_obj.to_index()
            output.write(' ' * 3 + 'pair: ' + entry.rstrip() + '; ' + tag + '\n')


def check_index(line):
    # check_index - create an index entry for a PROCEDURE, TYPE, CONST or VAR.
    global state_obj

    words = line.split()
    procedure = ''
    if (len(words) > 1) and (words[0] == 'PROCEDURE'):
        state_obj.set_state(state_none)
        if (words[1] == '__BUILTIN__') and (len(words) > 2):
            procedure = words[2]
        else:
            procedure = words[1]
    if (len(line) > 1) and (line[0:2] == '(*'):
        state_obj.set_state(state_none)
    elif line == 'VAR':
        state_obj.set_state(state_var)
        return
    elif line == 'TYPE':
        state_obj.set_state(state_type)
        return
    elif line == 'CONST':
        state_obj.set_state(state_const)
    if state_obj.is_var():
        words = line.split(',')
        for word in words:
            word = word.lstrip()
            if word != '':
                if word.find(':') == -1:
                    emit_index(word, '(var)')
                elif len(word) > 0:
                    var = word.split(':')
                    if len(var) > 0:
                        emit_index(var[0], '(var)')
    if state_obj.is_type():
        words = line.lstrip()
        if words.find('=') != -1:
            word = words.split('=')
            if (len(word[0]) > 0) and (word[0][0] != '_'):
                emit_index(word[0].rstrip(), '(type)')
        else:
            word = words.split()
            if (len(word) > 1) and (word[1] == ';'):
                # hidden type
                if (len(word[0]) > 0) and (word[0][0] != '_'):
                    emit_index(word[0].rstrip(), '(type)')
    if state_obj.is_const():
        words = line.split(';')
        for word in words:
            word = word.lstrip()
            if word != '':
                if word.find('=') != -1:
                    var = word.split('=')
                    if len(var) > 0:
                        emit_index(var[0], '(const)')
    if procedure != '':
        name = procedure.split('(')
        if name[0] != '':
            proc = name[0]
            if proc[-1] == ';':
                proc = proc[:-1]
            if proc != '':
                emit_index(proc, '')

+def demangle_system_datatype(line, indent):
+    # The spaces in front align in the export qualified list.
+    indent += len ('EXPORT QUALIFIED ')
+    line = line.replace('@SYSTEM_DATATYPES@',
+                        '\n' + indent * ' ' + 'Target specific data types.')
+    line = line.replace('@SYSTEM_TYPES@',
+                        '(* Target specific data types.  *)')
+    return line
+
+
def emit_texinfo_content(f, line):
    global state_obj
    output.write(line.rstrip() + '\n')
    line = f.readline()
    if len(line.rstrip()) == 0:
        output.write('\n')
        line = f.readline()
        if (line.find('(*') != -1):
            remove_fields(f, line)
        else:
            output.write(line.rstrip() + '\n')
    else:
        output.write(line.rstrip() + '\n')
    line = f.readline()
    while line:
        line = line.rstrip()
        check_index(line)
        line = line.replace('{', '@{').replace('}', '@}')
+        line = demangle_system_datatype(line, 0)
        output.write(line + '\n')
        line = f.readline()
    return f


def emit_sphinx_content(f, line):
    global state_obj
    state_obj.to_code()
+    indentation = 4
+    indent = ' ' * indentation
    output.write(indent + line.rstrip() + '\n')
    line = f.readline()
    if len(line.rstrip()) == 0:
        output.write('\n')
        line = f.readline()
        if (line.find('(*') != -1):
            remove_fields(f, line)
        else:
            output.write(indent + line.rstrip() + '\n')
    else:
        output.write(indent + line.rstrip() + '\n')
    line = f.readline()
    while line:
        line = line.rstrip()
        check_index(line)
        state_obj.to_code()
+        line = demangle_system_datatype(line, indentation)
        output.write(indent + line + '\n')
        line = f.readline()
    return f

diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/Make-lang.in
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/Make-lang.in	2022-12-14 06:54:59.636965403 +0000

this has been reviewed, so I'm just including the changes.  Feel free
to ask for the whole file though (likewise for the other hand snipped
patches):

   <snip>

# Define the names for selecting modula-2 in LANGUAGES.
m2 modula-2 modula2: gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext) \
                 $(GCC_PASSES) $(GCC_PARTS)
m2.serial = cc1gm2$(exeext)
+
+m2.srcinfo: doc/m2.info
+	-cp -p $^ $(srcdir)/doc
+
+ifeq ($(HAVE_PYTHON),yes)
+m2.srcextra: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/gm2-libs.texi m2/gm2-ebnf.texi
+	-cp -p m2/SYSTEM-pim.texi $(srcdir)/m2
+	-cp -p m2/SYSTEM-iso.texi $(srcdir)/m2
+	-cp -p m2/gm2-libs.texi $(srcdir)/m2
+	-cp -p m2/gm2-ebnf.texi $(srcdir)/m2
+	find . -name '*.texi' -print
+else
+m2.srcextra:
+endif
+
+m2.srcman: doc/gm2.1
+	-cp -p $^ $(srcdir)/doc
+
# Tell GNU make to ignore these if they exist.
.PHONY: m2 modula-2 modula2

GM2_PROG_DEP=gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext)

   <snip>

# gm2-libs.texi

m2/gm2-libs.texi: gm2-libs.texi-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+gm2-libs.texi-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
+                     $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.texi
+else
+gm2-libs.texi-check:
+	cp $(srcdir)/m2/target-independent/gm2-libs.texi $(objdir)/m2/gm2-libs.texi
+endif
+	$(STAMP) gm2-libs.texi-check
+
# gm2-libs.rst

m2/gm2-libs.rst: gm2-libs.rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+gm2-libs.rst-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
+                     $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.rst
+else
+gm2-libs.rst-check:
+	cp $(srcdir)/m2/target-independent/gm2-libs.rst $(objdir)/m2/gm2-libs.rst
+endif
+	$(STAMP) gm2-libs.rst-check
+
# gm2-ebnf.texi

m2/gm2-ebnf.texi: gm2-ebnf.texi-check; @true
+
+gm2-ebnf.texi-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
+	$(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.texi
+	$(STAMP) gm2-ebnf.texi-check
+
# gm2-ebnf.rst

m2/gm2-ebnf.rst: gm2-ebnf.rst-check; @true

+gm2-ebnf.rst-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
+	$(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.rst
+	$(STAMP) gm2-ebnf.rst-check
+
# SYSTEM-pim.texi

m2/SYSTEM-pim.texi: SYSTEM-pim-texi-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.texi
+else
+SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+	cp $(srcdir)/m2/target-independent/SYSTEM-pim.texi $(objdir)/m2/SYSTEM-pim.texi
+endif
+	$(STAMP) SYSTEM-pim-texi-check
+
# SYSTEM-pim.rst

m2/SYSTEM-pim.rst: SYSTEM-pim-rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.rst
+else
+SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+	cp $(srcdir)/m2/target-independent/SYSTEM-pim.rst $(objdir)/m2/SYSTEM-pim.rst
+endif
+	$(STAMP) SYSTEM-pim-rst-check
+
# SYSTEM-pim.texi

m2/SYSTEM-iso.texi:  SYSTEM-iso.texi-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-iso.texi-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.texi
+else
+SYSTEM-iso.texi-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+	cp $(srcdir)/m2/target-independent/SYSTEM-iso.texi $(objdir)/m2/SYSTEM-iso.texi
+endif
+	$(STAMP) SYSTEM-iso.texi-check
+
# SYSTEM-pim.rst

m2/SYSTEM-iso.rst:  SYSTEM-iso.rst-check; @true

+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-iso.rst-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.rst
+else
+SYSTEM-iso.rst-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+	cp $(srcdir)/m2/target-independent/SYSTEM-iso.rst $(objdir)/m2/SYSTEM-iso.rst
+endif
+	$(STAMP) SYSTEM-iso.rst-check
+
+
# m2/Builtins.texi

m2/Builtins.texi:  Builtins.texi-check; @true

+ifeq ($(HAVE_PYTHON),yes)
+Builtins.texi-check:  m2/gm2-libs/Builtins.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.texi
+else
+Builtins.texi-check:  m2/gm2-libs/Builtins.def
+	cp $(srcdir)/m2/target-independent/Builtins.texi $(objdir)/m2/Builtins.texi
+endif
+	$(STAMP) Builtins.texi-check
+
# m2/Builtins.rst

m2/Builtins.rst:  Builtins.rst-check; @true

+ifeq ($(HAVE_PYTHON),yes)
+Builtins.rst-check:  m2/gm2-libs/Builtins.def
+	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.rst
+else
+Builtins.rst-check:  m2/gm2-libs/Builtins.def
+	cp $(srcdir)/m2/target-independent/Builtins.rst $(objdir)/m2/Builtins.rst
+endif
+	$(STAMP) Builtins.rst-check

  <snip>

diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/Make-maintainer.in
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/Make-maintainer.in	2022-12-14 06:54:59.636965403 +0000

  file has been reviewed before, manually snipped to show additions:

+# Recreate the target independent copies of the documentation which is
+# used during the build if Python3 is unavailable.
+
+# m2-target-independent-doc-rst should be enabled once
+# tools-src/def2doc.py is completed (module hyperlinks need rst
+# treatment).
+
+m2-target-independent-doc: m2-target-independent-doc-texi # m2-target-independent-doc-rst
+
+m2-target-independent-doc-texi: force
+ifeq ($(HAVE_PYTHON),yes)
+	python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.texi
+	python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.texi
+	python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.texi
+	python3 $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.texi
+else
+	echo "m2-target-independent-doc-texi will only work if Python3 was detected during configure"
+endif
+
+m2-target-independent-doc-rst: force
+ifeq ($(HAVE_PYTHON),yes)
+	python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.rst
+	python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.rst
+	python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.rst
+	python3 $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.rst
+else
+	echo "m2-target-independent-doc-rst will only work if Python3 was detected during configure"
+endif


here are the target independent SYSTEM-iso.texi, SYSTEM-pim.texi,
gm2-libs.texi, Builtins.texi which are used if python3 is unavailable.
It is maintainer generated via gcc/m2/tools-src/def2doc.py (above).
All files below are machine generated.


diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/readme.txt
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/target-independent/readme.txt	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,3 @@
+This directory contains the target independent copies of the
+documentation which will be used if Python3 is unavailable during the
+build.
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-iso.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-iso.texi	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,237 @@
+
+@example
+DEFINITION MODULE SYSTEM;
+
+  (* Gives access to system programming facilities that are probably
+     non portable. *)
+
+  (* The constants and types define underlying properties of storage *)
+
+EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
+                 LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
+                 Target specific data types.  *)
+                 ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
+                 SHIFT, CAST, TSIZE,
+
+                 (* Internal GM2 compiler functions *)
+                 ShiftVal, ShiftLeft, ShiftRight,
+                 RotateVal, RotateLeft, RotateRight,
+                 THROW, TBITSIZE ;
+
+CONST
+                  (* <implementation-defined constant> ; *)
+@findex BITSPERLOC (const)
+  BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+                  (* <implementation-defined constant> ; *)
+@findex LOCSPERWORD (const)
+  LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+                  (* <implementation-defined constant> ; *)
+@findex LOCSPERBYTE (const)
+  LOCSPERBYTE = 8 DIV BITSPERLOC ;
+
+(*
+   all the objects below are declared internally to gm2
+   ====================================================
+
+TYPE
+   (* Target specific data types.  *)
+
+TYPE
+  LOC; (* A system basic type. Values are the uninterpreted
+          contents of the smallest addressable unit of storage *)
+@findex ADDRESS (type)
+  ADDRESS = POINTER TO LOC;
+@findex WORD (type)
+  WORD = ARRAY [0 .. LOCSPERWORD-1] OF LOC;
+
+  (* BYTE and LOCSPERBYTE are provided if appropriate for machine *)
+
+TYPE
+@findex BYTE (type)
+  BYTE = ARRAY [0 .. LOCSPERBYTE-1] OF LOC;
+
+@findex ADDADR
+PROCEDURE ADDADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
+  (* Returns address given by (addr + offset), or may raise
+     an exception if this address is not valid.
+  *)
+
+@findex SUBADR
+PROCEDURE SUBADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
+  (* Returns address given by (addr - offset), or may raise an
+     exception if this address is not valid.
+  *)
+
+@findex DIFADR
+PROCEDURE DIFADR (addr1, addr2: ADDRESS): INTEGER;
+  (* Returns the difference between addresses (addr1 - addr2),
+     or may raise an exception if the arguments are invalid
+     or address space is non-contiguous.
+  *)
+
+@findex MAKEADR
+PROCEDURE MAKEADR (high: <some type>; ...): ADDRESS;
+  (* Returns an address constructed from a list of values whose
+     types are implementation-defined, or may raise an
+     exception if this address is not valid.
+
+     In GNU Modula-2, MAKEADR can take any number of arguments
+     which are mapped onto the type ADDRESS. The first parameter
+     maps onto the high address bits and subsequent parameters map
+     onto lower address bits. For example:
+
+     a := MAKEADR(BYTE(0FEH), BYTE(0DCH), BYTE(0BAH), BYTE(098H),
+                  BYTE(076H), BYTE(054H), BYTE(032H), BYTE(010H)) ;
+
+     then the value of, a, on a 64 bit machine is: 0FEDCBA9876543210H
+
+     The parameters do not have to be the same type, but constants
+     _must_ be typed.
+  *)
+
+@findex ADR
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+@findex ROTATE
+PROCEDURE ROTATE (val: <a packedset type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up/right
+     or down/right by the absolute value of num.  The direction is
+     down/right if the sign of num is negative, otherwise the direction
+     is up/left.
+  *)
+
+@findex SHIFT
+PROCEDURE SHIFT (val: <a packedset type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up/left
+     or down/right by the absolute value of num, introducing
+     zeros as necessary.  The direction is down/right if the sign of
+     num is negative, otherwise the direction is up/left.
+  *)
+
+@findex CAST
+PROCEDURE CAST (<targettype>; val: <anytype>): <targettype>;
+  (* CAST is a type transfer function.  Given the expression
+     denoted by val, it returns a value of the type <targettype>.
+     An invalid value for the target value or a
+     physical address alignment problem may raise an exception.
+  *)
+
+@findex TSIZE
+PROCEDURE TSIZE (<type>; ... ): CARDINAL;
+  (* Returns the number of LOCS used to store a value of the
+     specified <type>.   The extra parameters, if present,
+     are used to distinguish variants in a variant record.
+  *)
+
+@findex THROW
+PROCEDURE THROW (i: INTEGER) ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the
+     EXCEPT block (assuming it exists).  This is a compiler builtin
+     function which interfaces to the GCC exception handling runtime
+     system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+@findex TBITSIZE
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word set types. They are not part of ISO Modula-2
+   but are used to implement the SHIFT procedure defined above. *)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will only
+              call this routine for larger sets.
+*)
+
+@findex ShiftVal
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+@findex ShiftLeft
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex ShiftRight
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for larger
+               sets.
+*)
+
+@findex RotateVal
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex RotateLeft
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+@findex RotateRight
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
+@end example


and the same for gcc/m2/target-independent/gm2-libs.texi


diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/gm2-libs.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/target-independent/gm2-libs.texi	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,14924 @@
+@c Copyright (C) 2000-2022 Free Software Foundation, Inc.
+@c This file is part of GNU Modula-2.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.2 or
+@c any later version published by the Free Software Foundation.
+@menu
+* Base libraries::Basic M2F compatible libraries
+* PIM and Logitech 3.0 Compatible::PIM and Logitech 3.0 compatible libraries
+* PIM coroutine support::PIM compatible process support
+* M2 ISO Libraries::ISO defined libraries
+@end menu
+
+@c ============================================================
+
+@node Base libraries, PIM and Logitech 3.0 Compatible, , Libraries
+@section Base libraries
+
+@c README.texi describes the pim libraries.
+@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
+@c
+@c This is part of the GM2 manual.
+@c For copying conditions, see the file gcc/doc/include/fdl.texi.
+
+These are the base libraries for the GNU Modula-2 compiler.  These
+modules originally came from the M2F compiler and have been cleaned up
+and extended.  They provide a basic interface to the underlying
+operating system via libc.  They also include a number of libraries to
+allow access to compiler built-ins. Perhaps the largest difference to
+PIM and ISO libraries is the @code{DynamicString} module which
+declares the type @code{String}.  The heavy use of this opaque data
+type results in a number of equivalent modules that can either handle
+@code{ARRAY OF CHAR} or @code{String}.
+
+These modules have been extensively tested and are used throughout
+building the GNU Modula-2 compiler.
+@menu
+* gm2-libs/ASCII::ASCII.def
+* gm2-libs/Args::Args.def
+* gm2-libs/Assertion::Assertion.def
+* gm2-libs/Break::Break.def
+* gm2-libs/Builtins::Builtins.def
+* gm2-libs/COROUTINES::COROUTINES.def
+* gm2-libs/CmdArgs::CmdArgs.def
+* gm2-libs/Debug::Debug.def
+* gm2-libs/DynamicStrings::DynamicStrings.def
+* gm2-libs/Environment::Environment.def
+* gm2-libs/FIO::FIO.def
+* gm2-libs/FormatStrings::FormatStrings.def
+* gm2-libs/FpuIO::FpuIO.def
+* gm2-libs/GetOpt::GetOpt.def
+* gm2-libs/IO::IO.def
+* gm2-libs/Indexing::Indexing.def
+* gm2-libs/LMathLib0::LMathLib0.def
+* gm2-libs/LegacyReal::LegacyReal.def
+* gm2-libs/M2Dependent::M2Dependent.def
+* gm2-libs/M2EXCEPTION::M2EXCEPTION.def
+* gm2-libs/M2LINK::M2LINK.def
+* gm2-libs/M2RTS::M2RTS.def
+* gm2-libs/MathLib0::MathLib0.def
+* gm2-libs/MemUtils::MemUtils.def
+* gm2-libs/NumberIO::NumberIO.def
+* gm2-libs/OptLib::OptLib.def
+* gm2-libs/PushBackInput::PushBackInput.def
+* gm2-libs/RTExceptions::RTExceptions.def
+* gm2-libs/RTint::RTint.def
+* gm2-libs/SArgs::SArgs.def
+* gm2-libs/SCmdArgs::SCmdArgs.def
+* gm2-libs/SEnvironment::SEnvironment.def
+* gm2-libs/SFIO::SFIO.def
+* gm2-libs/SMathLib0::SMathLib0.def
+* gm2-libs/SYSTEM::SYSTEM.def
+* gm2-libs/Scan::Scan.def
+* gm2-libs/Selective::Selective.def
+* gm2-libs/StdIO::StdIO.def
+* gm2-libs/Storage::Storage.def
+* gm2-libs/StrCase::StrCase.def
+* gm2-libs/StrIO::StrIO.def
+* gm2-libs/StrLib::StrLib.def
+* gm2-libs/StringConvert::StringConvert.def
+* gm2-libs/SysExceptions::SysExceptions.def
+* gm2-libs/SysStorage::SysStorage.def
+* gm2-libs/TimeString::TimeString.def
+* gm2-libs/UnixArgs::UnixArgs.def
+* gm2-libs/cbuiltin::cbuiltin.def
+* gm2-libs/cgetopt::cgetopt.def
+* gm2-libs/cxxabi::cxxabi.def
+* gm2-libs/dtoa::dtoa.def
+* gm2-libs/errno::errno.def
+* gm2-libs/gdbif::gdbif.def
+* gm2-libs/ldtoa::ldtoa.def
+* gm2-libs/libc::libc.def
+* gm2-libs/libm::libm.def
+* gm2-libs/sckt::sckt.def
+* gm2-libs/termios::termios.def
+* gm2-libs/wrapc::wrapc.def
+@end menu
+
+@node gm2-libs/ASCII, gm2-libs/Args, , Base libraries
+@subsection gm2-libs/ASCII
+
+@example
+DEFINITION MODULE ASCII ;
+
+EXPORT QUALIFIED
+     nul, soh, stx, etx, eot, enq, ack, bel,
+     bs , ht , nl , vt , np , cr , so , si ,
+     dle, dc1, dc2, dc3, dc4, nak, syn, etb,
+     can, em , sub, esc, fs , gs , rs , us ,
+     sp ,  (* All the above are in order *)
+     lf, ff, eof, del, tab, EOL ;
+
+(*
+   Note that lf, eof and EOL are added.
+*)
+
+CONST
+@findex nul (const)
+@findex soh (const)
+@findex stx (const)
+@findex etx (const)
+     nul=000C; soh=001C; stx=002C; etx=003C;
+@findex eot (const)
+@findex enq (const)
+@findex ack (const)
+@findex bel (const)
+     eot=004C; enq=005C; ack=006C; bel=007C;
+@findex bs (const)
+@findex ht (const)
+@findex nl (const)
+@findex vt (const)
+     bs =010C; ht =011C; nl =012C; vt =013C;
+@findex np (const)
+@findex cr (const)
+@findex so (const)
+@findex si (const)
+     np =014C; cr =015C; so =016C; si =017C;
+@findex dle (const)
+@findex dc1 (const)
+@findex dc2 (const)
+@findex dc3 (const)
+     dle=020C; dc1=021C; dc2=022C; dc3=023C;
+@findex dc4 (const)
+@findex nak (const)
+@findex syn (const)
+@findex etb (const)
+     dc4=024C; nak=025C; syn=026C; etb=027C;
+@findex can (const)
+@findex em (const)
+@findex sub (const)
+@findex esc (const)
+     can=030C; em =031C; sub=032C; esc=033C;
+@findex fs (const)
+@findex gs (const)
+@findex rs (const)
+@findex us (const)
+     fs =034C; gs =035C; rs =036C; us =037C;
+@findex sp (const)
+     sp =040C; (* All the above are in order *)
+@findex lf (const)
+@findex ff (const)
+@findex eof (const)
+@findex tab (const)
+     lf =nl  ; ff =np  ; eof=eot ; tab=ht  ;
+@findex del (const)
+@findex EOL (const)
+     del=177C; EOL=nl  ;
+
+END ASCII.
+@end example
+@page
+
+@node gm2-libs/Args, gm2-libs/Assertion, gm2-libs/ASCII, Base libraries
+@subsection gm2-libs/Args
+
+@example
+DEFINITION MODULE Args ;
+
+EXPORT QUALIFIED GetArg, Narg ;
+
+
+(*
+   GetArg - returns the nth argument from the command line.
+            The success of the operation is returned.
+*)
+
+@findex GetArg
+PROCEDURE GetArg (VAR a: ARRAY OF CHAR; n: CARDINAL) : BOOLEAN ;
+
+
+(*
+   Narg - returns the number of arguments available from
+          command line.
+*)
+
+@findex Narg
+PROCEDURE Narg () : CARDINAL ;
+
+
+END Args.
+@end example
+@page
+
+@node gm2-libs/Assertion, gm2-libs/Break, gm2-libs/Args, Base libraries
+@subsection gm2-libs/Assertion
+
+@example
+DEFINITION MODULE Assertion ;
+
+EXPORT QUALIFIED Assert ;
+
+
+(*
+   Assert - tests the boolean Condition, if it fails then HALT
+            is called.
+*)
+
+@findex Assert
+PROCEDURE Assert (Condition: BOOLEAN) ;
+
+
+END Assertion.
+@end example
+@page
+
+@node gm2-libs/Break, gm2-libs/Builtins, gm2-libs/Assertion, Base libraries
+@subsection gm2-libs/Break
+
+@example
+DEFINITION MODULE Break ;
+
+END Break.
+@end example
+@page
+
+@node gm2-libs/Builtins, gm2-libs/COROUTINES, gm2-libs/Break, Base libraries
+@subsection gm2-libs/Builtins
+
+@example
+DEFINITION MODULE Builtins ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+(* floating point intrinsic procedure functions *)
+
+@findex isfinitef
+PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : BOOLEAN ;
+@findex isfinite
+PROCEDURE __BUILTIN__ isfinite (x: REAL) : BOOLEAN ;
+@findex isfinitel
+PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : BOOLEAN ;
+
+@findex sinf
+PROCEDURE __BUILTIN__ sinf (x: SHORTREAL) : SHORTREAL ;
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
+@findex sinl
+PROCEDURE __BUILTIN__ sinl (x: LONGREAL) : LONGREAL ;
+
+@findex cosf
+PROCEDURE __BUILTIN__ cosf (x: SHORTREAL) : SHORTREAL ;
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
+@findex cosl
+PROCEDURE __BUILTIN__ cosl (x: LONGREAL) : LONGREAL ;
+
+@findex sqrtf
+PROCEDURE __BUILTIN__ sqrtf (x: SHORTREAL) : SHORTREAL ;
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
+@findex sqrtl
+PROCEDURE __BUILTIN__ sqrtl (x: LONGREAL) : LONGREAL ;
+
+@findex atan2f
+PROCEDURE __BUILTIN__ atan2f (x, y: SHORTREAL) : SHORTREAL ;
+@findex atan2
+PROCEDURE __BUILTIN__ atan2 (x, y: REAL) : REAL ;
+@findex atan2l
+PROCEDURE __BUILTIN__ atan2l (x, y: LONGREAL) : LONGREAL ;
+
+@findex fabsf
+PROCEDURE __BUILTIN__ fabsf (x: SHORTREAL) : SHORTREAL ;
+@findex fabs
+PROCEDURE __BUILTIN__ fabs (x: REAL) : REAL ;
+@findex fabsl
+PROCEDURE __BUILTIN__ fabsl (x: LONGREAL) : LONGREAL ;
+
+@findex logf
+PROCEDURE __BUILTIN__ logf (x: SHORTREAL) : SHORTREAL ;
+@findex log
+PROCEDURE __BUILTIN__ log (x: REAL) : REAL ;
+@findex logl
+PROCEDURE __BUILTIN__ logl (x: LONGREAL) : LONGREAL ;
+
+@findex expf
+PROCEDURE __BUILTIN__ expf (x: SHORTREAL) : SHORTREAL ;
+@findex exp
+PROCEDURE __BUILTIN__ exp (x: REAL) : REAL ;
+@findex expl
+PROCEDURE __BUILTIN__ expl (x: LONGREAL) : LONGREAL ;
+
+@findex log10f
+PROCEDURE __BUILTIN__ log10f (x: SHORTREAL) : SHORTREAL ;
+@findex log10
+PROCEDURE __BUILTIN__ log10 (x: REAL) : REAL ;
+@findex log10l
+PROCEDURE __BUILTIN__ log10l (x: LONGREAL) : LONGREAL ;
+
+@findex exp10f
+PROCEDURE __BUILTIN__ exp10f (x: SHORTREAL) : SHORTREAL ;
+@findex exp10
+PROCEDURE __BUILTIN__ exp10 (x: REAL) : REAL ;
+@findex exp10l
+PROCEDURE __BUILTIN__ exp10l (x: LONGREAL) : LONGREAL ;
+
+@findex ilogbf
+PROCEDURE __BUILTIN__ ilogbf (x: SHORTREAL) : INTEGER ;
+@findex ilogb
+PROCEDURE __BUILTIN__ ilogb (x: REAL) : INTEGER ;
+@findex ilogbl
+PROCEDURE __BUILTIN__ ilogbl (x: LONGREAL) : INTEGER ;
+
+@findex huge_val
+PROCEDURE __BUILTIN__ huge_val () : REAL ;
+@findex huge_valf
+PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ;
+@findex huge_vall
+PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ;
+
+@findex significand
+PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ;
+@findex significandf
+PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ;
+@findex significandl
+PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ;
+
+@findex modf
+PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ;
+@findex modff
+PROCEDURE __BUILTIN__ modff (x: SHORTREAL;
+                             VAR y: SHORTREAL) : SHORTREAL ;
+@findex modfl
+PROCEDURE __BUILTIN__ modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
+
+@findex signbit
+PROCEDURE __BUILTIN__ signbit (r: REAL) : INTEGER ;
+@findex signbitf
+PROCEDURE __BUILTIN__ signbitf (s: SHORTREAL) : INTEGER ;
+@findex signbitl
+PROCEDURE __BUILTIN__ signbitl (l: LONGREAL) : INTEGER ;
+
+@findex nextafter
+PROCEDURE __BUILTIN__ nextafter (x, y: REAL) : REAL ;
+@findex nextafterf
+PROCEDURE __BUILTIN__ nextafterf (x, y: SHORTREAL) : SHORTREAL ;
+@findex nextafterl
+PROCEDURE __BUILTIN__ nextafterl (x, y: LONGREAL) : LONGREAL ;
+
+@findex nexttoward
+PROCEDURE __BUILTIN__ nexttoward (x, y: REAL) : LONGREAL ;
+@findex nexttowardf
+PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ;
+@findex nexttowardl
+PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ;
+
+@findex scalb
+PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ;
+@findex scalbf
+PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ;
+@findex scalbl
+PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ;
+
+@findex scalbln
+PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ;
+@findex scalblnf
+PROCEDURE __BUILTIN__ scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
+@findex scalblnl
+PROCEDURE __BUILTIN__ scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
+
+@findex scalbn
+PROCEDURE __BUILTIN__ scalbn (x: REAL; n: INTEGER) : REAL ;
+@findex scalbnf
+PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
+@findex scalbnl
+PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
+
+(* complex arithmetic intrincic procedure functions *)
+
+@findex cabsf
+PROCEDURE __BUILTIN__ cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex cabs
+PROCEDURE __BUILTIN__ cabs (z: COMPLEX) : REAL ;
+@findex cabsl
+PROCEDURE __BUILTIN__ cabsl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex cargf
+PROCEDURE __BUILTIN__ cargf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex carg
+PROCEDURE __BUILTIN__ carg (z: COMPLEX) : REAL ;
+@findex cargl
+PROCEDURE __BUILTIN__ cargl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex conjf
+PROCEDURE __BUILTIN__ conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex conj
+PROCEDURE __BUILTIN__ conj (z: COMPLEX) : COMPLEX ;
+@findex conjl
+PROCEDURE __BUILTIN__ conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cpowerf
+PROCEDURE __BUILTIN__ cpowerf (base: SHORTCOMPLEX;
+                               exp: SHORTREAL) : SHORTCOMPLEX ;
+@findex cpower
+PROCEDURE __BUILTIN__ cpower (base: COMPLEX; exp: REAL) : COMPLEX ;
+@findex cpowerl
+PROCEDURE __BUILTIN__ cpowerl (base: LONGCOMPLEX;
+                               exp: LONGREAL) : LONGCOMPLEX ;
+
+@findex csqrtf
+PROCEDURE __BUILTIN__ csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csqrt
+PROCEDURE __BUILTIN__ csqrt (z: COMPLEX) : COMPLEX ;
+@findex csqrtl
+PROCEDURE __BUILTIN__ csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cexpf
+PROCEDURE __BUILTIN__ cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cexp
+PROCEDURE __BUILTIN__ cexp (z: COMPLEX) : COMPLEX ;
+@findex cexpl
+PROCEDURE __BUILTIN__ cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex clnf
+PROCEDURE __BUILTIN__ clnf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cln
+PROCEDURE __BUILTIN__ cln (z: COMPLEX) : COMPLEX ;
+@findex clnl
+PROCEDURE __BUILTIN__ clnl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex csinf
+PROCEDURE __BUILTIN__ csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csin
+PROCEDURE __BUILTIN__ csin (z: COMPLEX) : COMPLEX ;
+@findex csinl
+PROCEDURE __BUILTIN__ csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ccosf
+PROCEDURE __BUILTIN__ ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ccos
+PROCEDURE __BUILTIN__ ccos (z: COMPLEX) : COMPLEX ;
+@findex ccosl
+PROCEDURE __BUILTIN__ ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ctanf
+PROCEDURE __BUILTIN__ ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ctan
+PROCEDURE __BUILTIN__ ctan (z: COMPLEX) : COMPLEX ;
+@findex ctanl
+PROCEDURE __BUILTIN__ ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carcsinf
+PROCEDURE __BUILTIN__ carcsinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carcsin
+PROCEDURE __BUILTIN__ carcsin (z: COMPLEX) : COMPLEX ;
+@findex carcsinl
+PROCEDURE __BUILTIN__ carcsinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carccosf
+PROCEDURE __BUILTIN__ carccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carccos
+PROCEDURE __BUILTIN__ carccos (z: COMPLEX) : COMPLEX ;
+@findex carccosl
+PROCEDURE __BUILTIN__ carccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carctanf
+PROCEDURE __BUILTIN__ carctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carctan
+PROCEDURE __BUILTIN__ carctan (z: COMPLEX) : COMPLEX ;
+@findex carctanl
+PROCEDURE __BUILTIN__ carctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+(* memory and string intrincic procedure functions *)
+
+@findex alloca
+PROCEDURE __BUILTIN__ alloca (i: CARDINAL) : ADDRESS ;
+@findex memcpy
+PROCEDURE __BUILTIN__ memcpy (dest, src: ADDRESS;
+                              nbytes: CARDINAL) : ADDRESS ;
+@findex index
+PROCEDURE __BUILTIN__ index (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex rindex
+PROCEDURE __BUILTIN__ rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex memcmp
+PROCEDURE __BUILTIN__ memcmp (s1, s2: ADDRESS;
+                              nbytes: CARDINAL) : INTEGER ;
+@findex memset
+PROCEDURE __BUILTIN__ memset (s: ADDRESS; c: INTEGER;
+                              nbytes: CARDINAL) : ADDRESS ;
+@findex memmove
+PROCEDURE __BUILTIN__ memmove (s1, s2: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcat
+PROCEDURE __BUILTIN__ strcat (dest, src: ADDRESS) : ADDRESS ;
+@findex strncat
+PROCEDURE __BUILTIN__ strncat (dest, src: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcpy
+PROCEDURE __BUILTIN__ strcpy (dest, src: ADDRESS) : ADDRESS ;
+@findex strncpy
+PROCEDURE __BUILTIN__ strncpy (dest, src: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcmp
+PROCEDURE __BUILTIN__ strcmp (s1, s2: ADDRESS) : INTEGER ;
+@findex strncmp
+PROCEDURE __BUILTIN__ strncmp (s1, s2: ADDRESS;
+                               nbytes: CARDINAL) : INTEGER ;
+@findex strlen
+PROCEDURE __BUILTIN__ strlen (s: ADDRESS) : INTEGER ;
+@findex strstr
+PROCEDURE __BUILTIN__ strstr (haystack, needle: ADDRESS) : ADDRESS ;
+@findex strpbrk
+PROCEDURE __BUILTIN__ strpbrk (s, accept: ADDRESS) : ADDRESS ;
+@findex strspn
+PROCEDURE __BUILTIN__ strspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strcspn
+PROCEDURE __BUILTIN__ strcspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strchr
+PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex strrchr
+PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+
+(*
+   longjmp - this GCC builtin restricts the val to always 1.
+*)
+(* do not use these two builtins, as gcc, only really
+   anticipates that the Ada front end should use them
+   and it only uses them in its runtime exception handling.
+   We leave them here in the hope that someday they will
+   behave more like their libc counterparts.  *)
+
+@findex longjmp
+PROCEDURE __BUILTIN__ longjmp (env: ADDRESS; val: INTEGER) ;
+@findex setjmp
+PROCEDURE __BUILTIN__ setjmp (env: ADDRESS) : INTEGER ;
+
+
+(*
+   frame_address - returns the address of the frame.
+                   The current frame is obtained if level is 0,
+                   the next level up if level is 1 etc.
+*)
+
+@findex frame_address
+PROCEDURE __BUILTIN__ frame_address (level: CARDINAL) : ADDRESS ;
+
+
+(*
+   return_address - returns the return address of function.
+                    The current function return address is
+                    obtained if level is 0,
+                    the next level up if level is 1 etc.
+*)
+
+@findex return_address
+PROCEDURE __BUILTIN__ return_address (level: CARDINAL) : ADDRESS ;
+
+
+(*
+   alloca_trace - this is a no-op which is used for internal debugging.
+*)
+
+@findex alloca_trace
+PROCEDURE alloca_trace (returned: ADDRESS; nBytes: CARDINAL) : ADDRESS ;
+
+
+END Builtins.
+@end example
+@page
+
+@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/Builtins, Base libraries
+@subsection gm2-libs/COROUTINES
+
+@example
+DEFINITION MODULE FOR "C" COROUTINES ;
+
+CONST
+   UnassignedPriority = 0 ;
+
+TYPE
+@findex INTERRUPTSOURCE (type)
+   INTERRUPTSOURCE = CARDINAL ;
+@findex PROTECTION (type)
+   PROTECTION = [UnassignedPriority..7] ;
+
+END COROUTINES.
+@end example
+@page
+
+@node gm2-libs/CmdArgs, gm2-libs/Debug, gm2-libs/COROUTINES, Base libraries
+@subsection gm2-libs/CmdArgs
+
+@example
+DEFINITION MODULE CmdArgs ;
+
+EXPORT QUALIFIED GetArg, Narg ;
+
+
+(*
+   GetArg - returns the nth argument from the command line, CmdLine
+            the success of the operation is returned.
+*)
+
+@findex GetArg
+PROCEDURE GetArg (CmdLine: ARRAY OF CHAR;
+                  n: CARDINAL; VAR Argi: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   Narg - returns the number of arguments available from
+          command line, CmdLine.
+*)
+
+@findex Narg
+PROCEDURE Narg (CmdLine: ARRAY OF CHAR) : CARDINAL ;
+
+
+END CmdArgs.
+@end example
+@page
+
+@node gm2-libs/Debug, gm2-libs/DynamicStrings, gm2-libs/CmdArgs, Base libraries
+@subsection gm2-libs/Debug
+
+@example
+DEFINITION MODULE Debug ;
+
+(*
+    Description: provides some simple debugging routines.
+*)
+
+EXPORT QUALIFIED Halt, DebugString ;
+
+
+(*
+   Halt - writes a message in the format:
+          Module:Line:Message
+
+          It then terminates by calling HALT.
+*)
+
+@findex Halt
+PROCEDURE Halt (Message: ARRAY OF CHAR;
+                LineNo: CARDINAL;
+                Module: ARRAY OF CHAR) ;
+
+
+(*
+   DebugString - writes a string to the debugging device (Scn.Write).
+                 It interprets \n as carriage return, linefeed.
+*)
+
+@findex DebugString
+PROCEDURE DebugString (a: ARRAY OF CHAR) ;
+
+
+END Debug.
+@end example
+@page
+
+@node gm2-libs/DynamicStrings, gm2-libs/Environment, gm2-libs/Debug, Base libraries
+@subsection gm2-libs/DynamicStrings
+
+@example
+DEFINITION MODULE DynamicStrings ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED String,
+                 InitString, KillString, Fin, InitStringCharStar,
+                 InitStringChar, Index, RIndex,
+                 Mark, Length, ConCat, ConCatChar, Assign, Dup, Add,
+                 Equal, EqualCharStar, EqualArray, ToUpper, ToLower,
+                 CopyOut, Mult, Slice,
+                 RemoveWhitePrefix, RemoveWhitePostfix, RemoveComment,
+                 char, string,
+                 InitStringDB, InitStringCharStarDB, InitStringCharDB,
+                 MultDB, DupDB, SliceDB,
+                 PushAllocation, PopAllocation, PopAllocationExemption ;
+
+TYPE
+@findex String (type)
+   String ;
+
+
+(*
+   InitString - creates and returns a String type object.
+                Initial contents are, a.
+*)
+
+@findex InitString
+PROCEDURE InitString (a: ARRAY OF CHAR) : String ;
+
+
+(*
+   KillString - frees String, s, and its contents.
+                NIL is returned.
+*)
+
+@findex KillString
+PROCEDURE KillString (s: String) : String ;
+
+
+(*
+   Fin - finishes with a string, it calls KillString with, s.
+         The purpose of the procedure is to provide a short cut
+         to calling KillString and then testing the return result.
+*)
+
+@findex Fin
+PROCEDURE Fin (s: String) ;
+
+
+(*
+   InitStringCharStar - initializes and returns a String to contain
+                        the C string.
+*)
+
+@findex InitStringCharStar
+PROCEDURE InitStringCharStar (a: ADDRESS) : String ;
+
+
+(*
+   InitStringChar - initializes and returns a String to contain the
+                    single character, ch.
+*)
+
+@findex InitStringChar
+PROCEDURE InitStringChar (ch: CHAR) : String ;
+
+
+(*
+   Mark - marks String, s, ready for garbage collection.
+*)
+
+@findex Mark
+PROCEDURE Mark (s: String) : String ;
+
+
+(*
+   Length - returns the length of the String, s.
+*)
+
+@findex Length
+PROCEDURE Length (s: String) : CARDINAL ;
+
+
+(*
+   ConCat - returns String, a, after the contents of, b,
+            have been appended.
+*)
+
+@findex ConCat
+PROCEDURE ConCat (a, b: String) : String ;
+
+
+(*
+   ConCatChar - returns String, a, after character, ch,
+                has been appended.
+*)
+
+@findex ConCatChar
+PROCEDURE ConCatChar (a: String; ch: CHAR) : String ;
+
+
+(*
+   Assign - assigns the contents of, b, into, a.
+            String, a, is returned.
+*)
+
+@findex Assign
+PROCEDURE Assign (a, b: String) : String ;
+
+
+(*
+   Dup - duplicate a String, s, returning the copy of s.
+*)
+
+@findex Dup
+PROCEDURE Dup (s: String) : String ;
+
+
+(*
+   Add - returns a new String which contains the contents of a and b.
+*)
+
+@findex Add
+PROCEDURE Add (a, b: String) : String ;
+
+
+(*
+   Equal - returns TRUE if String, a, and, b, are equal.
+*)
+
+@findex Equal
+PROCEDURE Equal (a, b: String) : BOOLEAN ;
+
+
+(*
+   EqualCharStar - returns TRUE if contents of String, s, is
+                   the same as the string, a.
+*)
+
+@findex EqualCharStar
+PROCEDURE EqualCharStar (s: String; a: ADDRESS) : BOOLEAN ;
+
+
+(*
+   EqualArray - returns TRUE if contents of String, s, is the
+                same as the string, a.
+*)
+
+@findex EqualArray
+PROCEDURE EqualArray (s: String; a: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   Mult - returns a new string which is n concatenations of String, s.
+          If n<=0 then an empty string is returned.
+*)
+
+@findex Mult
+PROCEDURE Mult (s: String; n: CARDINAL) : String ;
+
+
+(*
+   Slice - returns a new string which contains the elements
+           low..high-1
+
+           strings start at element 0
+           Slice(s, 0, 2)  will return elements 0, 1 but not 2
+           Slice(s, 1, 3)  will return elements 1, 2 but not 3
+           Slice(s, 2, 0)  will return elements 2..max
+           Slice(s, 3, -1) will return elements 3..max-1
+           Slice(s, 4, -2) will return elements 4..max-2
+*)
+
+@findex Slice
+PROCEDURE Slice (s: String; low, high: INTEGER) : String ;
+
+
+(*
+   Index - returns the indice of the first occurance of, ch, in
+           String, s. -1 is returned if, ch, does not exist.
+           The search starts at position, o.
+*)
+
+@findex Index
+PROCEDURE Index (s: String; ch: CHAR; o: CARDINAL) : INTEGER ;
+
+
+(*
+   RIndex - returns the indice of the last occurance of, ch,
+            in String, s. The search starts at position, o.
+            -1 is returned if, ch, is not found.
+*)
+
+@findex RIndex
+PROCEDURE RIndex (s: String; ch: CHAR; o: CARDINAL) : INTEGER ;
+
+
+(*
+   RemoveComment - assuming that, comment, is a comment delimiter
+                   which indicates anything to its right is a comment
+                   then strip off the comment and also any white space
+                   on the remaining right hand side.
+                   It leaves any white space on the left hand side
+                   alone.
+*)
+
+@findex RemoveComment
+PROCEDURE RemoveComment (s: String; comment: CHAR) : String ;
+
+
+(*
+   RemoveWhitePrefix - removes any leading white space from String, s.
+                       A new string is returned.
+*)
+
+@findex RemoveWhitePrefix
+PROCEDURE RemoveWhitePrefix (s: String) : String ;
+
+
+(*
+   RemoveWhitePostfix - removes any leading white space from String, s.
+                        A new string is returned.
+*)
+
+@findex RemoveWhitePostfix
+PROCEDURE RemoveWhitePostfix (s: String) : String ;
+
+
+(*
+   ToUpper - returns string, s, after it has had its lower case
+             characters replaced by upper case characters.
+             The string, s, is not duplicated.
+*)
+
+@findex ToUpper
+PROCEDURE ToUpper (s: String) : String ;
+
+
+(*
+   ToLower - returns string, s, after it has had its upper case
+             characters replaced by lower case characters.
+             The string, s, is not duplicated.
+*)
+
+@findex ToLower
+PROCEDURE ToLower (s: String) : String ;
+
+
+(*
+   CopyOut - copies string, s, to a.
+*)
+
+@findex CopyOut
+PROCEDURE CopyOut (VAR a: ARRAY OF CHAR; s: String) ;
+
+
+(*
+   char - returns the character, ch, at position, i, in String, s.
+          As Slice the index can be negative so:
+
+          char(s, 0) will return the first character
+          char(s, 1) will return the second character
+          char(s, -1) will return the last character
+          char(s, -2) will return the penultimate character
+
+          a nul character is returned if the index is out of range.
+*)
+
+@findex char
+PROCEDURE char (s: String; i: INTEGER) : CHAR ;
+
+
+(*
+   string - returns the C style char * of String, s.
+*)
+
+@findex string
+PROCEDURE string (s: String) : ADDRESS ;
+
+
+(*
+   to easily debug an application using this library one could use
+   use the following macro processing defines:
+
+   #define InitString(X) InitStringDB(X, __FILE__, __LINE__)
+   #define InitStringCharStar(X) InitStringCharStarDB(X, \
+     __FILE__, __LINE__)
+   #define InitStringChar(X) InitStringCharDB(X, __FILE__, __LINE__)
+   #define Mult(X,Y) MultDB(X, Y, __FILE__, __LINE__)
+   #define Dup(X) DupDB(X, __FILE__, __LINE__)
+   #define Slice(X,Y,Z) SliceDB(X, Y, Z, __FILE__, __LINE__)
+
+   and then invoke gm2 with the -fcpp flag.
+*)
+
+
+(*
+   InitStringDB - the debug version of InitString.
+*)
+
+@findex InitStringDB
+PROCEDURE InitStringDB (a: ARRAY OF CHAR;
+                        file: ARRAY OF CHAR; line: CARDINAL) : String ;
+
+
+(*
+   InitStringCharStarDB - the debug version of InitStringCharStar.
+*)
+
+@findex InitStringCharStarDB
+PROCEDURE InitStringCharStarDB (a: ADDRESS;
+                                file: ARRAY OF CHAR;
+                                line: CARDINAL) : String ;
+
+
+(*
+   InitStringCharDB - the debug version of InitStringChar.
+*)
+
+@findex InitStringCharDB
+PROCEDURE InitStringCharDB (ch: CHAR;
+                            file: ARRAY OF CHAR;
+                            line: CARDINAL) : String ;
+
+
+(*
+   MultDB - the debug version of MultDB.
+*)
+
+@findex MultDB
+PROCEDURE MultDB (s: String; n: CARDINAL;
+                  file: ARRAY OF CHAR; line: CARDINAL) : String ;
+
+
+(*
+   DupDB - the debug version of Dup.
+*)
+
+@findex DupDB
+PROCEDURE DupDB (s: String;
+                 file: ARRAY OF CHAR; line: CARDINAL) : String ;
+
+
+(*
+   SliceDB - debug version of Slice.
+*)
+
+@findex SliceDB
+PROCEDURE SliceDB (s: String; low, high: INTEGER;
+                   file: ARRAY OF CHAR; line: CARDINAL) : String ;
+
+(*
+   PushAllocation - pushes the current allocation/deallocation lists.
+*)
+
+@findex PushAllocation
+PROCEDURE PushAllocation ;
+
+
+(*
+   PopAllocation - test to see that all strings are deallocated since
+                   the last push.  Then it pops to the previous
+                   allocation/deallocation lists.
+
+                   If halt is true then the application terminates
+                   with an exit code of 1.
+*)
+
+@findex PopAllocation
+PROCEDURE PopAllocation (halt: BOOLEAN) ;
+
+
+(*
+   PopAllocationExemption - test to see that all strings are
+                            deallocated, except string, e, since
+                            the last push.
+                            Then it pops to the previous
+                            allocation/deallocation lists.
+
+                            If halt is true then the application
+                            terminates with an exit code of 1.
+
+                            The string, e, is returned unmodified,
+*)
+
+@findex PopAllocationExemption
+PROCEDURE PopAllocationExemption (halt: BOOLEAN; e: String) : String ;
+
+
+END DynamicStrings.
+@end example
+@page
+
+@node gm2-libs/Environment, gm2-libs/FIO, gm2-libs/DynamicStrings, Base libraries
+@subsection gm2-libs/Environment
+
+@example
+DEFINITION MODULE Environment ;
+
+EXPORT QUALIFIED GetEnvironment, PutEnvironment ;
+
+
+(*
+   GetEnvironment - gets the environment variable Env and places
+      	       	    a copy of its value into string, dest.
+                    It returns TRUE if the string Env was found in
+                    the processes environment.
+*)
+
+@findex GetEnvironment
+PROCEDURE GetEnvironment (Env: ARRAY OF CHAR;
+                          VAR dest: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   PutEnvironment - change or add an environment variable definition
+                    EnvDef.
+                    TRUE is returned if the environment variable was
+                    set or changed successfully.
+*)
+
+@findex PutEnvironment
+PROCEDURE PutEnvironment (EnvDef: ARRAY OF CHAR) : BOOLEAN ;
+
+
+END Environment.
+@end example
+@page
+
+@node gm2-libs/FIO, gm2-libs/FormatStrings, gm2-libs/Environment, Base libraries
+@subsection gm2-libs/FIO
+
+@example
+DEFINITION MODULE FIO ;
+
+(* Provides a simple buffered file input/output library.  *)
+
+
+FROM SYSTEM IMPORT ADDRESS, BYTE ;
+
+EXPORT QUALIFIED (* types *)
+                 File,
+                 (* procedures *)
+                 OpenToRead, OpenToWrite, OpenForRandom, Close,
+                 EOF, EOLN, WasEOLN, IsNoError, Exists, IsActive,
+                 exists, openToRead, openToWrite, openForRandom,
+                 SetPositionFromBeginning,
+                 SetPositionFromEnd,
+                 FindPosition,
+                 ReadChar, ReadString,
+                 WriteChar, WriteString, WriteLine,
+                 WriteCardinal, ReadCardinal,
+                 UnReadChar,
+                 WriteNBytes, ReadNBytes,
+                 FlushBuffer,
+                 GetUnixFileDescriptor,
+                 GetFileName, getFileName, getFileNameLength,
+                 FlushOutErr,
+                 (* variables *)
+                 StdIn, StdOut, StdErr ;
+
+TYPE
+@findex File (type)
+   File = CARDINAL ;
+
+(* the following variables are initialized to their UNIX equivalents *)
+VAR
+@findex StdIn (var)
+@findex StdOut (var)
+@findex StdErr (var)
+   StdIn, StdOut, StdErr: File ;
+
+
+
+(*
+   IsNoError - returns a TRUE if no error has occured on file, f.
+*)
+
+@findex IsNoError
+PROCEDURE IsNoError (f: File) : BOOLEAN ;
+
+
+(*
+   IsActive - returns TRUE if the file, f, is still active.
+*)
+
+@findex IsActive
+PROCEDURE IsActive (f: File) : BOOLEAN ;
+
+
+(*
+   Exists - returns TRUE if a file named, fname exists for reading.
+*)
+
+@findex Exists
+PROCEDURE Exists (fname: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   OpenToRead - attempts to open a file, fname, for reading and
+                it returns this file.
+                The success of this operation can be checked by
+                calling IsNoError.
+*)
+
+@findex OpenToRead
+PROCEDURE OpenToRead (fname: ARRAY OF CHAR) : File ;
+
+
+(*
+   OpenToWrite - attempts to open a file, fname, for write and
+                 it returns this file.
+                 The success of this operation can be checked by
+                 calling IsNoError.
+*)
+
+@findex OpenToWrite
+PROCEDURE OpenToWrite (fname: ARRAY OF CHAR) : File ;
+
+
+(*
+   OpenForRandom - attempts to open a file, fname, for random access
+                   read or write and it returns this file.
+                   The success of this operation can be checked by
+                   calling IsNoError.
+                   towrite, determines whether the file should be
+                   opened for writing or reading.
+                   newfile, determines whether a file should be
+                   created if towrite is TRUE or whether the
+                   previous file should be left alone,
+                   allowing this descriptor to seek
+                   and modify an existing file.
+*)
+
+@findex OpenForRandom
+PROCEDURE OpenForRandom (fname: ARRAY OF CHAR;
+                         towrite, newfile: BOOLEAN) : File ;
+
+
+(*
+   Close - close a file which has been previously opened using:
+           OpenToRead, OpenToWrite, OpenForRandom.
+           It is correct to close a file which has an error status.
+*)
+
+@findex Close
+PROCEDURE Close (f: File) ;
+
+
+(* the following functions are functionally equivalent to the above
+   except they allow C style names.
+*)
+
+@findex exists
+PROCEDURE exists        (fname: ADDRESS; flength: CARDINAL) : BOOLEAN ;
+@findex openToRead
+PROCEDURE openToRead    (fname: ADDRESS; flength: CARDINAL) : File ;
+@findex openToWrite
+PROCEDURE openToWrite   (fname: ADDRESS; flength: CARDINAL) : File ;
+@findex openForRandom
+PROCEDURE openForRandom (fname: ADDRESS; flength: CARDINAL;
+                         towrite, newfile: BOOLEAN) : File ;
+
+
+(*
+   FlushBuffer - flush contents of the FIO file, f, to libc.
+*)
+
+@findex FlushBuffer
+PROCEDURE FlushBuffer (f: File) ;
+
+
+(*
+   ReadNBytes - reads nBytes of a file into memory area, dest, returning
+                the number of bytes actually read.
+                This function will consume from the buffer and then
+                perform direct libc reads. It is ideal for large reads.
+*)
+
+@findex ReadNBytes
+PROCEDURE ReadNBytes (f: File; nBytes: CARDINAL;
+                      dest: ADDRESS) : CARDINAL ;
+
+
+(*
+   ReadAny - reads HIGH(a) bytes into, a. All input
+             is fully buffered, unlike ReadNBytes and thus is more
+             suited to small reads.
+*)
+
+@findex ReadAny
+PROCEDURE ReadAny (f: File; VAR a: ARRAY OF BYTE) ;
+
+
+(*
+   WriteNBytes - writes nBytes from memory area src to a file
+                 returning the number of bytes actually written.
+                 This function will flush the buffer and then
+                 write the nBytes using a direct write from libc.
+                 It is ideal for large writes.
+*)
+
+@findex WriteNBytes
+PROCEDURE WriteNBytes (f: File; nBytes: CARDINAL;
+                       src: ADDRESS) : CARDINAL ;
+
+
+(*
+   WriteAny - writes HIGH(a) bytes onto, file, f. All output
+              is fully buffered, unlike WriteNBytes and thus is more
+              suited to small writes.
+*)
+
+@findex WriteAny
+PROCEDURE WriteAny (f: File; VAR a: ARRAY OF BYTE) ;
+
+
+(*
+   WriteChar - writes a single character to file, f.
+*)
+
+@findex WriteChar
+PROCEDURE WriteChar (f: File; ch: CHAR) ;
+
+
+(*
+   EOF - tests to see whether a file, f, has reached end of file.
+*)
+
+@findex EOF
+PROCEDURE EOF (f: File) : BOOLEAN ;
+
+
+(*
+   EOLN - tests to see whether a file, f, is about to read a newline.
+          It does NOT consume the newline.  It reads the next character
+          and then immediately unreads the character.
+*)
+
+@findex EOLN
+PROCEDURE EOLN (f: File) : BOOLEAN ;
+
+
+(*
+   WasEOLN - tests to see whether a file, f, has just read a newline
+             character.
+*)
+
+@findex WasEOLN
+PROCEDURE WasEOLN (f: File) : BOOLEAN ;
+
+
+(*
+   ReadChar - returns a character read from file, f.
+              Sensible to check with IsNoError or EOF after calling
+              this function.
+*)
+
+@findex ReadChar
+PROCEDURE ReadChar (f: File) : CHAR ;
+
+
+(*
+   UnReadChar - replaces a character, ch, back into file, f.
+                This character must have been read by ReadChar
+                and it does not allow successive calls.  It may
+                only be called if the previous read was successful,
+                end of file or end of line seen.
+*)
+
+@findex UnReadChar
+PROCEDURE UnReadChar (f: File ; ch: CHAR) ;
+
+
+(*
+   WriteLine - writes out a linefeed to file, f.
+*)
+
+@findex WriteLine
+PROCEDURE WriteLine (f: File) ;
+
+
+(*
+   WriteString - writes a string to file, f.
+*)
+
+@findex WriteString
+PROCEDURE WriteString (f: File; a: ARRAY OF CHAR) ;
+
+
+(*
+   ReadString - reads a string from file, f, into string, a.
+                It terminates the string if HIGH is reached or
+                if a newline is seen or an error occurs.
+*)
+
+@findex ReadString
+PROCEDURE ReadString (f: File; VAR a: ARRAY OF CHAR) ;
+
+
+(*
+   WriteCardinal - writes a CARDINAL to file, f.
+                   It writes the binary image of the CARDINAL.
+                   to file, f.
+*)
+
+@findex WriteCardinal
+PROCEDURE WriteCardinal (f: File; c: CARDINAL) ;
+
+
+(*
+   ReadCardinal - reads a CARDINAL from file, f.
+                  It reads a bit image of a CARDINAL
+                  from file, f.
+*)
+
+@findex ReadCardinal
+PROCEDURE ReadCardinal (f: File) : CARDINAL ;
+
+
+(*
+   GetUnixFileDescriptor - returns the UNIX file descriptor of a file.
+                           Useful when combining FIO.mod with select
+                           (in Selective.def - but note the comments in
+                            Selective about using read/write primatives)
+*)
+
+@findex GetUnixFileDescriptor
+PROCEDURE GetUnixFileDescriptor (f: File) : INTEGER ;
+
+
+(*
+   SetPositionFromBeginning - sets the position from the beginning
+                              of the file.
+*)
+
+@findex SetPositionFromBeginning
+PROCEDURE SetPositionFromBeginning (f: File; pos: LONGINT) ;
+
+
+(*
+   SetPositionFromEnd - sets the position from the end of the file.
+*)
+
+@findex SetPositionFromEnd
+PROCEDURE SetPositionFromEnd (f: File; pos: LONGINT) ;
+
+
+(*
+   FindPosition - returns the current absolute position in file, f.
+*)
+
+@findex FindPosition
+PROCEDURE FindPosition (f: File) : LONGINT ;
+
+
+(*
+   GetFileName - assigns, a, with the filename associated with, f.
+*)
+
+@findex GetFileName
+PROCEDURE GetFileName (f: File; VAR a: ARRAY OF CHAR) ;
+
+
+(*
+   getFileName - returns the address of the filename associated with, f.
+*)
+
+@findex getFileName
+PROCEDURE getFileName (f: File) : ADDRESS ;
+
+
+(*
+   getFileNameLength - returns the number of characters associated with
+                       filename, f.
+*)
+
+@findex getFileNameLength
+PROCEDURE getFileNameLength (f: File) : CARDINAL ;
+
+
+(*
+   FlushOutErr - flushes, StdOut, and, StdErr.
+*)
+
+@findex FlushOutErr
+PROCEDURE FlushOutErr ;
+
+
+END FIO.
+@end example
+@page
+
+@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FIO, Base libraries
+@subsection gm2-libs/FormatStrings
+
+@example
+DEFINITION MODULE FormatStrings ;
+
+FROM SYSTEM IMPORT BYTE ;
+FROM DynamicStrings IMPORT String ;
+EXPORT QUALIFIED Sprintf0, Sprintf1, Sprintf2, Sprintf3, Sprintf4,
+                 HandleEscape ;
+
+
+(*
+   Sprintf0 - returns a String containing, fmt, after it has had its
+              escape sequences translated.
+*)
+
+@findex Sprintf0
+PROCEDURE Sprintf0 (fmt: String) : String ;
+
+
+(*
+   Sprintf1 - returns a String containing, fmt, together with
+              encapsulated entity, w. It only formats the
+              first %s or %d with n.
+*)
+
+@findex Sprintf1
+PROCEDURE Sprintf1 (fmt: String; w: ARRAY OF BYTE) : String ;
+
+
+(*
+   Sprintf2 - returns a string, fmt, which has been formatted.
+*)
+
+@findex Sprintf2
+PROCEDURE Sprintf2 (fmt: String; w1, w2: ARRAY OF BYTE) : String ;
+
+
+(*
+   Sprintf3 - returns a string, fmt, which has been formatted.
+*)
+
+@findex Sprintf3
+PROCEDURE Sprintf3 (fmt: String; w1, w2, w3: ARRAY OF BYTE) : String ;
+
+
+(*
+   Sprintf4 - returns a string, fmt, which has been formatted.
+*)
+
+@findex Sprintf4
+PROCEDURE Sprintf4 (fmt: String;
+                    w1, w2, w3, w4: ARRAY OF BYTE) : String ;
+
+
+(*
+   HandleEscape - translates \a, \b, \e, \f, \n, \r, \x[hex] \[octal]
+                  into their respective ascii codes.  It also converts
+                  \[any] into a single [any] character.
+*)
+
+@findex HandleEscape
+PROCEDURE HandleEscape (s: String) : String ;
+
+
+END FormatStrings.
+@end example
+@page
+
+@node gm2-libs/FpuIO, gm2-libs/GetOpt, gm2-libs/FormatStrings, Base libraries
+@subsection gm2-libs/FpuIO
+
+@example
+DEFINITION MODULE FpuIO ;
+
+EXPORT QUALIFIED ReadReal, WriteReal, StrToReal, RealToStr,
+                 ReadLongReal, WriteLongReal, StrToLongReal,
+                 LongRealToStr,
+                 ReadLongInt, WriteLongInt, StrToLongInt,
+                 LongIntToStr ;
+
+
+@findex ReadReal
+PROCEDURE ReadReal (VAR x: REAL) ;
+@findex WriteReal
+PROCEDURE WriteReal (x: REAL; TotalWidth, FractionWidth: CARDINAL) ;
+@findex StrToReal
+PROCEDURE StrToReal (a: ARRAY OF CHAR ; VAR x: REAL) ;
+@findex RealToStr
+PROCEDURE RealToStr (x: REAL; TotalWidth, FractionWidth: CARDINAL;
+                     VAR a: ARRAY OF CHAR) ;
+
+@findex ReadLongReal
+PROCEDURE ReadLongReal (VAR x: LONGREAL) ;
+@findex WriteLongReal
+PROCEDURE WriteLongReal (x: LONGREAL;
+                         TotalWidth, FractionWidth: CARDINAL) ;
+@findex StrToLongReal
+PROCEDURE StrToLongReal (a: ARRAY OF CHAR ; VAR x: LONGREAL) ;
+@findex LongRealToStr
+PROCEDURE LongRealToStr (x: LONGREAL;
+                         TotalWidth, FractionWidth: CARDINAL;
+                         VAR a: ARRAY OF CHAR) ;
+
+@findex ReadLongInt
+PROCEDURE ReadLongInt (VAR x: LONGINT) ;
+@findex WriteLongInt
+PROCEDURE WriteLongInt (x: LONGINT; n: CARDINAL) ;
+@findex StrToLongInt
+PROCEDURE StrToLongInt (a: ARRAY OF CHAR ; VAR x: LONGINT) ;
+@findex LongIntToStr
+PROCEDURE LongIntToStr (x: LONGINT; n: CARDINAL; VAR a: ARRAY OF CHAR) ;
+
+
+END FpuIO.
+@end example
+@page
+
+@node gm2-libs/GetOpt, gm2-libs/IO, gm2-libs/FpuIO, Base libraries
+@subsection gm2-libs/GetOpt
+
+@example
+DEFINITION MODULE GetOpt ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM DynamicStrings IMPORT String ;
+
+CONST
+@findex no_argument (const)
+   no_argument = 0 ;
+@findex required_argument (const)
+   required_argument = 1 ;
+@findex optional_argument (const)
+   optional_argument = 2 ;
+
+TYPE
+@findex LongOptions (type)
+   LongOptions ;
+@findex PtrToInteger (type)
+   PtrToInteger = POINTER TO INTEGER ;
+
+(*
+   GetOpt - call C getopt and fill in the parameters:
+            optarg, optind, opterr and optop.
+*)
+
+@findex GetOpt
+PROCEDURE GetOpt (argc: INTEGER; argv: ADDRESS; optstring: String;
+                  VAR optarg: String;
+                  VAR optind, opterr, optopt: INTEGER) : CHAR ;
+
+
+(*
+   InitLongOptions - creates and returns a LongOptions empty array.
+*)
+
+@findex InitLongOptions
+PROCEDURE InitLongOptions () : LongOptions ;
+
+
+(*
+   AddLongOption - appends long option @{name, has_arg, flag, val@} to the
+                   array of options and new long options array is
+                   returned.
+                   The old array, lo, should no longer be used.
+
+   (from man 3 getopt)
+       The meanings of the different fields are:
+
+       name   is the name of the long option.
+
+       has_arg
+              is: no_argument (or 0) if the option does not take an
+              argument; required_argument (or  1) if the option
+              requires an argument; or optional_argument (or 2) if
+              the option takes an optional argument.
+
+       flag   specifies how results are returned for a long option.
+              If flag is NULL, then getopt_long() returns val.
+              (For example, the calling program may set val to the
+              equivalent short option character).  Otherwise,
+              getopt_long() returns 0, and flag points to a
+              variable which is set to val if the option is found,
+              but left unchanged if the option is not found.
+
+       val    is the value to return, or to load into the variable
+              pointed to by flag.
+
+       The last element of the array has to be filled with zeros.
+*)
+
+@findex AddLongOption
+PROCEDURE AddLongOption (lo: LongOptions;
+                         name: String; has_arg: INTEGER;
+                         flag: PtrToInteger;
+                         val: INTEGER) : LongOptions ;
+
+
+(*
+   KillLongOptions - returns NIL and also frees up memory
+                     associated with, lo.
+*)
+
+@findex KillLongOptions
+PROCEDURE KillLongOptions (lo: LongOptions) : LongOptions ;
+
+
+(*
+   GetOptLong - works like GetOpt but will accept long options (using
+                two dashes).  If the program only accepts long options
+                then optstring should be an empty string, not NIL.
+*)
+
+@findex GetOptLong
+PROCEDURE GetOptLong (argc: INTEGER; argv: ADDRESS; optstring: String;
+                      longopts: LongOptions;
+                      VAR longindex: INTEGER) : INTEGER ;
+
+
+(*
+   GetOptLongOnly - works like GetOptLong except that a single dash
+                    can be used for a long option.
+*)
+
+@findex GetOptLongOnly
+PROCEDURE GetOptLongOnly (argc: INTEGER; argv: ADDRESS;
+                          optstring: String; longopts: LongOptions;
+                          VAR longindex: INTEGER) : INTEGER ;
+
+
+END GetOpt.
+@end example
+@page
+
+@node gm2-libs/IO, gm2-libs/Indexing, gm2-libs/GetOpt, Base libraries
+@subsection gm2-libs/IO
+
+@example
+DEFINITION MODULE IO ;
+
+(*
+   Description: provides Read, Write, Errors procedures that map onto UNIX
+                file descriptors 0, 1 and 2. This is achieved by using
+                FIO if we are in buffered mode and using libc.write
+                if not.
+*)
+
+EXPORT QUALIFIED Read, Write, Error,
+                 UnBufferedMode, BufferedMode,
+                 EchoOn, EchoOff ;
+
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+@findex Write
+PROCEDURE Write (ch: CHAR) ;
+@findex Error
+PROCEDURE Error (ch: CHAR) ;
+
+
+(*
+   UnBufferedMode - places file descriptor, fd, into an unbuffered mode.
+*)
+
+@findex UnBufferedMode
+PROCEDURE UnBufferedMode (fd: INTEGER; input: BOOLEAN) ;
+
+
+(*
+   BufferedMode - places file descriptor, fd, into a buffered mode.
+*)
+
+@findex BufferedMode
+PROCEDURE BufferedMode (fd: INTEGER; input: BOOLEAN) ;
+
+
+(*
+   EchoOn - turns on echoing for file descriptor, fd.  This
+            only really makes sence for a file descriptor opened
+            for terminal input or maybe some specific file descriptor
+            which is attached to a particular piece of hardware.
+*)
+
+@findex EchoOn
+PROCEDURE EchoOn (fd: INTEGER; input: BOOLEAN) ;
+
+
+(*
+   EchoOff - turns off echoing for file descriptor, fd.  This
+             only really makes sence for a file descriptor opened
+             for terminal input or maybe some specific file descriptor
+             which is attached to a particular piece of hardware.
+*)
+
+@findex EchoOff
+PROCEDURE EchoOff (fd: INTEGER; input: BOOLEAN) ;
+
+
+END IO.
+@end example
+@page
+
+@node gm2-libs/Indexing, gm2-libs/LMathLib0, gm2-libs/IO, Base libraries
+@subsection gm2-libs/Indexing
+
+@example
+DEFINITION MODULE Indexing ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED Index, InitIndex, KillIndex, GetIndice, PutIndice,
+                 HighIndice, LowIndice, InBounds, IsIndiceInIndex,
+                 RemoveIndiceFromIndex, IncludeIndiceIntoIndex,
+                 ForeachIndiceInIndexDo, DeleteIndice, DebugIndex ;
+
+TYPE
+@findex Index (type)
+   Index ;
+@findex IndexProcedure (type)
+   IndexProcedure = PROCEDURE (ADDRESS) ;
+
+
+(*
+   InitIndex - creates and returns an Index.
+*)
+
+@findex InitIndex
+PROCEDURE InitIndex (low: CARDINAL) : Index ;
+
+
+(*
+   KillIndex - returns Index to free storage.
+*)
+
+@findex KillIndex
+PROCEDURE KillIndex (i: Index) : Index ;
+
+
+(*
+   DebugIndex - turns on debugging within an index.
+*)
+
+@findex DebugIndex
+PROCEDURE DebugIndex (i: Index) : Index ;
+
+
+(*
+   InBounds - returns TRUE if indice, n, is within the bounds
+              of the dynamic array.
+*)
+
+@findex InBounds
+PROCEDURE InBounds (i: Index; n: CARDINAL) : BOOLEAN ;
+
+
+(*
+   HighIndice - returns the last legally accessible indice of this array.
+*)
+
+@findex HighIndice
+PROCEDURE HighIndice (i: Index) : CARDINAL ;
+
+
+(*
+   LowIndice - returns the first legally accessible indice of this array.
+*)
+
+@findex LowIndice
+PROCEDURE LowIndice (i: Index) : CARDINAL ;
+
+
+(*
+   PutIndice - places, a, into the dynamic array at position i[n]
+*)
+
+@findex PutIndice
+PROCEDURE PutIndice (i: Index; n: CARDINAL; a: ADDRESS) ;
+
+
+(*
+   GetIndice - retrieves, element i[n] from the dynamic array.
+*)
+
+@findex GetIndice
+PROCEDURE GetIndice (i: Index; n: CARDINAL) : ADDRESS ;
+
+
+(*
+   IsIndiceInIndex - returns TRUE if, a, is in the index, i.
+*)
+
+@findex IsIndiceInIndex
+PROCEDURE IsIndiceInIndex (i: Index; a: ADDRESS) : BOOLEAN ;
+
+
+(*
+   RemoveIndiceFromIndex - removes, a, from Index, i.
+*)
+
+@findex RemoveIndiceFromIndex
+PROCEDURE RemoveIndiceFromIndex (i: Index; a: ADDRESS) ;
+
+
+(*
+   DeleteIndice - delete i[j] from the array.
+*)
+
+@findex DeleteIndice
+PROCEDURE DeleteIndice (i: Index; j: CARDINAL) ;
+
+
+(*
+   IncludeIndiceIntoIndex - if the indice is not in the index, then
+                            add it at the end.
+*)
+
+@findex IncludeIndiceIntoIndex
+PROCEDURE IncludeIndiceIntoIndex (i: Index; a: ADDRESS) ;
+
+
+(*
+   ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j])
+*)
+
+@findex ForeachIndiceInIndexDo
+PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ;
+
+
+END Indexing.
+@end example
+@page
+
+@node gm2-libs/LMathLib0, gm2-libs/LegacyReal, gm2-libs/Indexing, Base libraries
+@subsection gm2-libs/LMathLib0
+
+@example
+DEFINITION MODULE LMathLib0 ;
+
+CONST
+   pi   = 3.1415926535897932384626433832795028841972;
+   exp1 = 2.7182818284590452353602874713526624977572;
+
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: LONGREAL) : LONGREAL ;
+@findex exp
+PROCEDURE exp (x: LONGREAL) : LONGREAL ;
+@findex ln
+PROCEDURE ln (x: LONGREAL) : LONGREAL ;
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: LONGREAL) : LONGREAL ;
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: LONGREAL) : LONGREAL ;
+@findex tan
+PROCEDURE tan (x: LONGREAL) : LONGREAL ;
+@findex arctan
+PROCEDURE arctan (x: LONGREAL) : LONGREAL ;
+@findex entier
+PROCEDURE entier (x: LONGREAL) : INTEGER ;
+
+
+END LMathLib0.
+@end example
+@page
+
+@node gm2-libs/LegacyReal, gm2-libs/M2Dependent, gm2-libs/LMathLib0, Base libraries
+@subsection gm2-libs/LegacyReal
+
+@example
+DEFINITION MODULE LegacyReal ;
+
+TYPE
+   REAL = SHORTREAL ;
+
+
+END LegacyReal.
+@end example
+@page
+
+@node gm2-libs/M2Dependent, gm2-libs/M2EXCEPTION, gm2-libs/LegacyReal, Base libraries
+@subsection gm2-libs/M2Dependent
+
+@example
+DEFINITION MODULE M2Dependent ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+TYPE
+@findex ArgCVEnvP (type)
+   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
+
+
+@findex ConstructModules
+PROCEDURE ConstructModules (applicationmodule: ADDRESS;
+                            argc: INTEGER; argv, envp: ADDRESS) ;
+
+@findex DeconstructModules
+PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
+                              argc: INTEGER; argv, envp: ADDRESS) ;
+
+
+(*
+   RegisterModule - adds module name to the list of outstanding
+                    modules which need to have their dependencies
+                    explored to determine initialization order.
+*)
+
+@findex RegisterModule
+PROCEDURE RegisterModule (name: ADDRESS;
+                          init, fini:  ArgCVEnvP;
+                          dependencies: PROC) ;
+
+
+(*
+   RequestDependant - used to specify that modulename is dependant upon
+                      module dependantmodule.
+*)
+
+@findex RequestDependant
+PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
+
+
+END M2Dependent.
+@end example
+@page
+
+@node gm2-libs/M2EXCEPTION, gm2-libs/M2LINK, gm2-libs/M2Dependent, Base libraries
+@subsection gm2-libs/M2EXCEPTION
+
+@example
+DEFINITION MODULE M2EXCEPTION;
+
+
+(* This enumerated list of exceptions must match the exceptions in gm2-libs-iso to
+   allow mixed module dialect projects.  *)
+
+TYPE
+@findex M2Exceptions (type)
+  M2Exceptions =
+    (indexException,     rangeException,         caseSelectException,  invalidLocation,
+     functionException,  wholeValueException,    wholeDivException,    realValueException,
+     realDivException,   complexValueException,  complexDivException,  protException,
+     sysException,       coException,            exException
+    );
+
+
+(* If the program or coroutine is in the exception state then return the enumeration
+   value representing the exception cause.  If it is not in the exception state then
+   raises and exception (exException).  *)
+
+@findex M2Exception
+PROCEDURE M2Exception () : M2Exceptions;
+
+(* Returns TRUE if the program or coroutine is in the exception state.
+   Returns FALSE if the program or coroutine is not in the exception state.  *)
+
+@findex IsM2Exception
+PROCEDURE IsM2Exception () : BOOLEAN;
+
+
+END M2EXCEPTION.
+@end example
+@page
+
+@node gm2-libs/M2LINK, gm2-libs/M2RTS, gm2-libs/M2EXCEPTION, Base libraries
+@subsection gm2-libs/M2LINK
+
+@example
+DEFINITION MODULE FOR "C" M2LINK ;
+
+
+TYPE
+@findex PtrToChar (type)
+   PtrToChar = POINTER TO CHAR ;
+
+(* These variables are set by the compiler in the program module
+   according to linking command line options.  *)
+
+VAR
+@findex ForcedModuleInitOrder (var)
+   ForcedModuleInitOrder: PtrToChar ;
+@findex StaticInitialization (var)
+   StaticInitialization : BOOLEAN ;
+
+
+@findex END M2LINK. (var)
+END M2LINK.
+@end example
+@page
+
+@node gm2-libs/M2RTS, gm2-libs/MathLib0, gm2-libs/M2LINK, Base libraries
+@subsection gm2-libs/M2RTS
+
+@example
+DEFINITION MODULE M2RTS ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+TYPE
+@findex ArgCVEnvP (type)
+   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
+
+
+@findex ConstructModules
+PROCEDURE ConstructModules (applicationmodule: ADDRESS;
+                            argc: INTEGER; argv, envp: ADDRESS) ;
+
+@findex DeconstructModules
+PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
+                              argc: INTEGER; argv, envp: ADDRESS) ;
+
+
+(*
+   RegisterModule - adds module name to the list of outstanding
+                    modules which need to have their dependencies
+                    explored to determine initialization order.
+*)
+
+@findex RegisterModule
+PROCEDURE RegisterModule (name: ADDRESS;
+                          init, fini:  ArgCVEnvP;
+                          dependencies: PROC) ;
+
+
+(*
+   RequestDependant - used to specify that modulename is dependant upon
+                      module dependantmodule.
+*)
+
+@findex RequestDependant
+PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
+
+
+(*
+   InstallTerminationProcedure - installs a procedure, p, which will
+                                 be called when the procedure
+                                 ExecuteTerminationProcedures
+                                 is invoked.  It returns TRUE is the
+                                 procedure is installed.
+*)
+
+@findex InstallTerminationProcedure
+PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
+
+
+(*
+   ExecuteInitialProcedures - executes the initial procedures installed
+                              by InstallInitialProcedure.
+*)
+
+@findex ExecuteInitialProcedures
+PROCEDURE ExecuteInitialProcedures ;
+
+
+(*
+   InstallInitialProcedure - installs a procedure to be executed just
+                             before the BEGIN code section of the main
+                             program module.
+*)
+
+@findex InstallInitialProcedure
+PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
+
+
+(*
+   ExecuteTerminationProcedures - calls each installed termination procedure
+                                  in reverse order.
+*)
+
+@findex ExecuteTerminationProcedures
+PROCEDURE ExecuteTerminationProcedures ;
+
+
+(*
+   Terminate - provides compatibility for pim.  It call exit with
+               the exitcode provided in a prior call to ExitOnHalt
+               (or zero if ExitOnHalt was never called).  It does
+               not call ExecuteTerminationProcedures.
+*)
+
+@findex Terminate
+PROCEDURE Terminate <* noreturn *> ;
+
+
+(*
+   HALT - terminate the current program.  The procedure Terminate
+          is called before the program is stopped.  The parameter
+          exitcode is optional.  If the parameter is not supplied
+          HALT will call libc 'abort', otherwise it will exit with
+          the code supplied.  Supplying a parameter to HALT has the
+          same effect as calling ExitOnHalt with the same code and
+          then calling HALT with no parameter.
+*)
+
+@findex HALT
+PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ;
+
+
+(*
+   Halt - provides a more user friendly version of HALT, which takes
+          four parameters to aid debugging.
+*)
+
+@findex Halt
+PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
+                function: ARRAY OF CHAR; description: ARRAY OF CHAR)
+		<* noreturn *> ;
+
+
+(*
+   ExitOnHalt - if HALT is executed then call exit with the exit code, e.
+*)
+
+@findex ExitOnHalt
+PROCEDURE ExitOnHalt (e: INTEGER) ;
+
+
+(*
+   ErrorMessage - emits an error message to stderr and then calls exit (1).
+*)
+
+@findex ErrorMessage
+PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
+                        file: ARRAY OF CHAR;
+                        line: CARDINAL;
+                        function: ARRAY OF CHAR) <* noreturn *> ;
+
+
+(*
+   Length - returns the length of a string, a. This is called whenever
+            the user calls LENGTH and the parameter cannot be calculated
+            at compile time.
+*)
+
+@findex Length
+PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
+
+
+(*
+   The following are the runtime exception handler routines.
+*)
+
+@findex AssignmentException
+PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ReturnException
+PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex IncException
+PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex DecException
+PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex InclException
+PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ExclException
+PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ShiftException
+PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex RotateException
+PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex StaticArraySubscriptException
+PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex DynamicArraySubscriptException
+PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopBeginException
+PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopToException
+PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopEndException
+PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex PointerNilException
+PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex NoReturnException
+PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex CaseException
+PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeNonPosDivException
+PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeNonPosModException
+PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeZeroDivException
+PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeZeroRemException
+PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeValueException
+PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex RealValueException
+PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ParameterException
+PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex NoException
+PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+
+
+END M2RTS.
+@end example
+@page
+
+@node gm2-libs/MathLib0, gm2-libs/MemUtils, gm2-libs/M2RTS, Base libraries
+@subsection gm2-libs/MathLib0
+
+@example
+DEFINITION MODULE MathLib0 ;
+
+CONST
+   pi   = 3.1415926535897932384626433832795028841972;
+   exp1 = 2.7182818284590452353602874713526624977572;
+
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
+@findex exp
+PROCEDURE exp (x: REAL) : REAL ;
+@findex ln
+PROCEDURE ln (x: REAL) : REAL ;
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
+@findex tan
+PROCEDURE tan (x: REAL) : REAL ;
+@findex arctan
+PROCEDURE arctan (x: REAL) : REAL ;
+@findex entier
+PROCEDURE entier (x: REAL) : INTEGER ;
+
+
+END MathLib0.
+@end example
+@page
+
+@node gm2-libs/MemUtils, gm2-libs/NumberIO, gm2-libs/MathLib0, Base libraries
+@subsection gm2-libs/MemUtils
+
+@example
+DEFINITION MODULE MemUtils ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED MemCopy, MemZero ;
+
+
+(*
+   MemCopy - copys a region of memory to the required destination.
+*)
+
+@findex MemCopy
+PROCEDURE MemCopy (from: ADDRESS; length: CARDINAL; to: ADDRESS) ;
+
+
+(*
+   MemZero - sets a region of memory: a..a+length to zero.
+*)
+
+@findex MemZero
+PROCEDURE MemZero (a: ADDRESS; length: CARDINAL) ;
+
+
+END MemUtils.
+@end example
+@page
+
+@node gm2-libs/NumberIO, gm2-libs/OptLib, gm2-libs/MemUtils, Base libraries
+@subsection gm2-libs/NumberIO
+
+@example
+DEFINITION MODULE NumberIO ;
+
+EXPORT QUALIFIED ReadCard, WriteCard, ReadHex, WriteHex, ReadInt, WriteInt,
+                 CardToStr, StrToCard, StrToHex, HexToStr, StrToInt, IntToStr,
+                 ReadOct, WriteOct, OctToStr, StrToOct,
+                 ReadBin, WriteBin, BinToStr, StrToBin,
+                 StrToBinInt, StrToHexInt, StrToOctInt ;
+
+
+@findex ReadCard
+PROCEDURE ReadCard (VAR x: CARDINAL) ;
+
+@findex WriteCard
+PROCEDURE WriteCard (x, n: CARDINAL) ;
+
+@findex ReadHex
+PROCEDURE ReadHex (VAR x: CARDINAL) ;
+
+@findex WriteHex
+PROCEDURE WriteHex (x, n: CARDINAL) ;
+
+@findex ReadInt
+PROCEDURE ReadInt (VAR x: INTEGER) ;
+
+@findex WriteInt
+PROCEDURE WriteInt (x: INTEGER ; n: CARDINAL) ;
+
+@findex CardToStr
+PROCEDURE CardToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
+
+@findex StrToCard
+PROCEDURE StrToCard (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
+
+@findex HexToStr
+PROCEDURE HexToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
+
+@findex StrToHex
+PROCEDURE StrToHex (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
+
+@findex IntToStr
+PROCEDURE IntToStr (x: INTEGER ; n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
+
+@findex StrToInt
+PROCEDURE StrToInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
+
+@findex ReadOct
+PROCEDURE ReadOct (VAR x: CARDINAL) ;
+
+@findex WriteOct
+PROCEDURE WriteOct (x, n: CARDINAL) ;
+
+@findex OctToStr
+PROCEDURE OctToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
+
+@findex StrToOct
+PROCEDURE StrToOct (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
+
+@findex ReadBin
+PROCEDURE ReadBin (VAR x: CARDINAL) ;
+
+@findex WriteBin
+PROCEDURE WriteBin (x, n: CARDINAL) ;
+
+@findex BinToStr
+PROCEDURE BinToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
+
+@findex StrToBin
+PROCEDURE StrToBin (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
+
+@findex StrToBinInt
+PROCEDURE StrToBinInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
+
+@findex StrToHexInt
+PROCEDURE StrToHexInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
+
+@findex StrToOctInt
+PROCEDURE StrToOctInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
+
+
+END NumberIO.
+@end example
+@page
+
+@node gm2-libs/OptLib, gm2-libs/PushBackInput, gm2-libs/NumberIO, Base libraries
+@subsection gm2-libs/OptLib
+
+@example
+DEFINITION MODULE OptLib ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM DynamicStrings IMPORT String ;
+
+TYPE
+@findex Option (type)
+   Option ;
+
+
+(*
+   InitOption - constructor for Option.
+*)
+
+@findex InitOption
+PROCEDURE InitOption (argc: INTEGER; argv: ADDRESS) : Option ;
+
+
+(*
+   KillOption - deconstructor for Option.
+*)
+
+@findex KillOption
+PROCEDURE KillOption (o: Option) : Option ;
+
+
+(*
+   Dup - duplicate the option array inside, o.
+         Notice that this does not duplicate all the contents
+         (strings) of argv.
+         Shallow copy of the top level indices.
+*)
+
+@findex Dup
+PROCEDURE Dup (o: Option) : Option ;
+
+
+(*
+   Slice - return a new option which has elements [low:high] from the
+           options, o.
+*)
+
+@findex Slice
+PROCEDURE Slice (o: Option; low, high: INTEGER) : Option ;
+
+
+(*
+   IndexStrCmp - returns the index in the argv array which matches
+                 string, s.  -1 is returned if the string is not found.
+*)
+
+@findex IndexStrCmp
+PROCEDURE IndexStrCmp (o: Option; s: String) : INTEGER ;
+
+
+(*
+   IndexStrNCmp - returns the index in the argv array where the first
+                  characters are matched by string, s.
+                  -1 is returned if the string is not found.
+*)
+
+@findex IndexStrNCmp
+PROCEDURE IndexStrNCmp (o: Option; s: String) : INTEGER ;
+
+
+(*
+   ConCat - returns the concatenation of a and b.
+*)
+
+@findex ConCat
+PROCEDURE ConCat (a, b: Option) : Option ;
+
+
+(*
+   GetArgv - return the argv component of option.
+*)
+
+@findex GetArgv
+PROCEDURE GetArgv (o: Option) : ADDRESS ;
+
+
+(*
+   GetArgc - return the argc component of option.
+*)
+
+@findex GetArgc
+PROCEDURE GetArgc (o: Option) : INTEGER ;
+
+
+END OptLib.
+@end example
+@page
+
+@node gm2-libs/PushBackInput, gm2-libs/RTExceptions, gm2-libs/OptLib, Base libraries
+@subsection gm2-libs/PushBackInput
+
+@example
+DEFINITION MODULE PushBackInput ;
+
+FROM FIO IMPORT File ;
+FROM DynamicStrings IMPORT String ;
+
+EXPORT QUALIFIED Open, PutCh, GetCh, Error, WarnError, WarnString,
+                 Close, SetDebug, GetExitStatus, PutStr,
+                 PutString, GetColumnPosition, GetCurrentLine ;
+
+
+(*
+   Open - opens a file for reading.
+*)
+
+@findex Open
+PROCEDURE Open (a: ARRAY OF CHAR) : File ;
+
+
+(*
+   GetCh - gets a character from either the push back stack or
+           from file, f.
+*)
+
+@findex GetCh
+PROCEDURE GetCh (f: File) : CHAR ;
+
+
+(*
+   PutCh - pushes a character onto the push back stack, it also
+           returns the character which has been pushed.
+*)
+
+@findex PutCh
+PROCEDURE PutCh (ch: CHAR) : CHAR ;
+
+
+(*
+   PutString - pushes a string onto the push back stack.
+*)
+
+@findex PutString
+PROCEDURE PutString (a: ARRAY OF CHAR) ;
+
+
+(*
+   PutStr - pushes a dynamic string onto the push back stack.
+            The string, s, is not deallocated.
+*)
+
+@findex PutStr
+PROCEDURE PutStr (s: String) ;
+
+
+(*
+   Error - emits an error message with the appropriate file, line combination.
+*)
+
+@findex Error
+PROCEDURE Error (a: ARRAY OF CHAR) ;
+
+
+(*
+   WarnError - emits an error message with the appropriate file, line combination.
+               It does not terminate but when the program finishes an exit status of
+               1 will be issued.
+*)
+
+@findex WarnError
+PROCEDURE WarnError (a: ARRAY OF CHAR) ;
+
+
+(*
+   WarnString - emits an error message with the appropriate file, line combination.
+                It does not terminate but when the program finishes an exit status of
+                1 will be issued.
+*)
+
+@findex WarnString
+PROCEDURE WarnString (s: String) ;
+
+
+(*
+   Close - closes the opened file.
+*)
+
+@findex Close
+PROCEDURE Close (f: File) ;
+
+
+(*
+   GetExitStatus - returns the exit status which will be 1 if any warnings were issued.
+*)
+
+@findex GetExitStatus
+PROCEDURE GetExitStatus () : CARDINAL ;
+
+
+(*
+   SetDebug - sets the debug flag on or off.
+*)
+
+@findex SetDebug
+PROCEDURE SetDebug (d: BOOLEAN) ;
+
+
+(*
+   GetColumnPosition - returns the column position of the current character.
+*)
+
+@findex GetColumnPosition
+PROCEDURE GetColumnPosition () : CARDINAL ;
+
+
+(*
+   GetCurrentLine - returns the current line number.
+*)
+
+@findex GetCurrentLine
+PROCEDURE GetCurrentLine () : CARDINAL ;
+
+
+END PushBackInput.
+@end example
+@page
+
+@node gm2-libs/RTExceptions, gm2-libs/RTint, gm2-libs/PushBackInput, Base libraries
+@subsection gm2-libs/RTExceptions
+
+@example
+DEFINITION MODULE RTExceptions ;
+
+(* Runtime exception handler routines.  This should
+   be considered as a system module for GNU Modula-2
+   and allow the compiler to interface with exception
+   handling.  *)
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED EHBlock,
+                 Raise, SetExceptionBlock, GetExceptionBlock,
+                 GetTextBuffer, GetTextBufferSize, GetNumber,
+                 InitExceptionBlock, KillExceptionBlock,
+                 PushHandler, PopHandler,
+                 BaseExceptionsThrow, DefaultErrorCatch,
+                 IsInExceptionState, SetExceptionState,
+                 SwitchExceptionState, GetBaseExceptionBlock,
+                 SetExceptionSource, GetExceptionSource ;
+
+TYPE
+@findex EHBlock (type)
+   EHBlock ;
+@findex ProcedureHandler (type)
+   ProcedureHandler = PROCEDURE ;
+
+
+(*
+   Raise - invoke the exception handler associated with, number,
+           in the active EHBlock.  It keeps a record of the number
+           and message in the EHBlock for later use.
+*)
+
+@findex Raise
+PROCEDURE Raise (number: CARDINAL;
+                 file: ADDRESS; line: CARDINAL;
+                 column: CARDINAL; function: ADDRESS;
+                 message: ADDRESS) ;
+
+
+(*
+   SetExceptionBlock - sets, source, as the active EHB.
+*)
+
+@findex SetExceptionBlock
+PROCEDURE SetExceptionBlock (source: EHBlock) ;
+
+
+(*
+   GetExceptionBlock - returns the active EHB.
+*)
+
+@findex GetExceptionBlock
+PROCEDURE GetExceptionBlock () : EHBlock ;
+
+
+(*
+   GetTextBuffer - returns the address of the EHB buffer.
+*)
+
+@findex GetTextBuffer
+PROCEDURE GetTextBuffer (e: EHBlock) : ADDRESS ;
+
+
+(*
+   GetTextBufferSize - return the size of the EHB text buffer.
+*)
+
+@findex GetTextBufferSize
+PROCEDURE GetTextBufferSize (e: EHBlock) : CARDINAL ;
+
+
+(*
+   GetNumber - return the exception number associated with,
+               source.
+*)
+
+@findex GetNumber
+PROCEDURE GetNumber (source: EHBlock) : CARDINAL ;
+
+
+(*
+   InitExceptionBlock - creates and returns a new exception block.
+*)
+
+@findex InitExceptionBlock
+PROCEDURE InitExceptionBlock () : EHBlock ;
+
+
+(*
+   KillExceptionBlock - destroys the EHB, e, and all its handlers.
+*)
+
+@findex KillExceptionBlock
+PROCEDURE KillExceptionBlock (e: EHBlock) : EHBlock ;
+
+
+(*
+   PushHandler - install a handler in EHB, e.
+*)
+
+@findex PushHandler
+PROCEDURE PushHandler (e: EHBlock; number: CARDINAL; p: ProcedureHandler) ;
+
+
+(*
+   PopHandler - removes the handler associated with, number, from
+                EHB, e.
+*)
+
+@findex PopHandler
+PROCEDURE PopHandler (e: EHBlock; number: CARDINAL) ;
+
+
+(*
+   DefaultErrorCatch - displays the current error message in
+                       the current exception block and then
+                       calls HALT.
+*)
+
+@findex DefaultErrorCatch
+PROCEDURE DefaultErrorCatch ;
+
+
+(*
+   BaseExceptionsThrow - configures the Modula-2 exceptions to call
+                         THROW which in turn can be caught by an
+                         exception block.  If this is not called then
+                         a Modula-2 exception will simply call an
+                         error message routine and then HALT.
+*)
+
+@findex BaseExceptionsThrow
+PROCEDURE BaseExceptionsThrow ;
+
+
+(*
+   IsInExceptionState - returns TRUE if the program is currently
+                        in the exception state.
+*)
+
+@findex IsInExceptionState
+PROCEDURE IsInExceptionState () : BOOLEAN ;
+
+
+(*
+   SetExceptionState - returns the current exception state and
+                       then sets the current exception state to,
+                       to.
+*)
+
+@findex SetExceptionState
+PROCEDURE SetExceptionState (to: BOOLEAN) : BOOLEAN ;
+
+
+(*
+   SwitchExceptionState - assigns, from, with the current exception
+                          state and then assigns the current exception
+                          to, to.
+*)
+
+@findex SwitchExceptionState
+PROCEDURE SwitchExceptionState (VAR from: BOOLEAN; to: BOOLEAN) ;
+
+
+(*
+   GetBaseExceptionBlock - returns the initial language exception block
+                           created.
+*)
+
+@findex GetBaseExceptionBlock
+PROCEDURE GetBaseExceptionBlock () : EHBlock ;
+
+
+(*
+   SetExceptionSource - sets the current exception source to, source.
+*)
+
+@findex SetExceptionSource
+PROCEDURE SetExceptionSource (source: ADDRESS) ;
+
+
+(*
+   GetExceptionSource - returns the current exception source.
+*)
+
+@findex GetExceptionSource
+PROCEDURE GetExceptionSource () : ADDRESS ;
+
+
+END RTExceptions.
+@end example
+@page
+
+@node gm2-libs/RTint, gm2-libs/SArgs, gm2-libs/RTExceptions, Base libraries
+@subsection gm2-libs/RTint
+
+@example
+DEFINITION MODULE RTint ;
+
+(* Provides users of the COROUTINES library with the
+   ability to create interrupt sources based on
+   file descriptors and timeouts.  *)
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex DispatchVector (type)
+   DispatchVector = PROCEDURE (CARDINAL, CARDINAL, ADDRESS) ;
+
+
+(*
+   InitInputVector - returns an interrupt vector which is associated
+                     with the file descriptor, fd.
+*)
+
+@findex InitInputVector
+PROCEDURE InitInputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
+
+
+(*
+   InitOutputVector - returns an interrupt vector which is associated
+                      with the file descriptor, fd.
+*)
+
+@findex InitOutputVector
+PROCEDURE InitOutputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
+
+
+(*
+   InitTimeVector - returns an interrupt vector associated with
+                    the relative time.
+*)
+
+@findex InitTimeVector
+PROCEDURE InitTimeVector (micro, secs: CARDINAL; pri: CARDINAL) : CARDINAL ;
+
+
+(*
+   ReArmTimeVector - reprimes the vector, vec, to deliver an interrupt
+                     at the new relative time.
+*)
+
+@findex ReArmTimeVector
+PROCEDURE ReArmTimeVector (vec: CARDINAL; micro, secs: CARDINAL) ;
+
+
+(*
+   GetTimeVector - assigns, micro, and, secs, with the remaining
+                   time before this interrupt will expire.
+                   This value is only updated when a Listen
+                   occurs.
+*)
+
+@findex GetTimeVector
+PROCEDURE GetTimeVector (vec: CARDINAL; VAR micro, secs: CARDINAL) ;
+
+
+(*
+   AttachVector - adds the pointer, p, to be associated with the interrupt
+                  vector. It returns the previous value attached to this
+                  vector.
+*)
+
+@findex AttachVector
+PROCEDURE AttachVector (vec: CARDINAL; p: ADDRESS) : ADDRESS ;
+
+
+(*
+   IncludeVector - includes, vec, into the dispatcher list of
+                   possible interrupt causes.
+*)
+
+@findex IncludeVector
+PROCEDURE IncludeVector (vec: CARDINAL) ;
+
+
+(*
+   ExcludeVector - excludes, vec, from the dispatcher list of
+                   possible interrupt causes.
+*)
+
+@findex ExcludeVector
+PROCEDURE ExcludeVector (vec: CARDINAL) ;
+
+
+(*
+   Listen - will either block indefinitely (until an interrupt)
+            or alteratively will test to see whether any interrupts
+            are pending.
+            If a pending interrupt was found then, call, is called
+            and then this procedure returns.
+            It only listens for interrupts > pri.
+*)
+
+@findex Listen
+PROCEDURE Listen (untilInterrupt: BOOLEAN;
+                  call: DispatchVector;
+                  pri: CARDINAL) ;
+
+
+(*
+   Init - allows the user to force the initialize order.
+*)
+
+@findex Init
+PROCEDURE Init ;
+
+
+END RTint.
+@end example
+@page
+
+@node gm2-libs/SArgs, gm2-libs/SCmdArgs, gm2-libs/RTint, Base libraries
+@subsection gm2-libs/SArgs
+
+@example
+DEFINITION MODULE SArgs ;
+
+FROM DynamicStrings IMPORT String ;
+EXPORT QUALIFIED GetArg, Narg ;
+
+
+(*
+   GetArg - returns the nth argument from the command line.
+            The success of the operation is returned.
+            If TRUE is returned then the string, s, contains a
+            new string, otherwise s is set to NIL.
+*)
+
+@findex GetArg
+PROCEDURE GetArg (VAR s: String ; n: CARDINAL) : BOOLEAN ;
+
+
+(*
+   Narg - returns the number of arguments available from
+          command line.
+*)
+
+@findex Narg
+PROCEDURE Narg() : CARDINAL ;
+
+
+END SArgs.
+@end example
+@page
+
+@node gm2-libs/SCmdArgs, gm2-libs/SEnvironment, gm2-libs/SArgs, Base libraries
+@subsection gm2-libs/SCmdArgs
+
+@example
+DEFINITION MODULE SCmdArgs ;
+
+FROM DynamicStrings IMPORT String ;
+
+EXPORT QUALIFIED GetArg, Narg ;
+
+
+(*
+   GetArg - returns the nth argument from the command line, CmdLine
+            the success of the operation is returned.
+*)
+
+@findex GetArg
+PROCEDURE GetArg (CmdLine: String;
+                  n: CARDINAL; VAR Argi: String) : BOOLEAN ;
+
+
+(*
+   Narg - returns the number of arguments available from
+          command line, CmdLine.
+*)
+
+@findex Narg
+PROCEDURE Narg (CmdLine: String) : CARDINAL ;
+
+
+END SCmdArgs.
+@end example
+@page
+
+@node gm2-libs/SEnvironment, gm2-libs/SFIO, gm2-libs/SCmdArgs, Base libraries
+@subsection gm2-libs/SEnvironment
+
+@example
+DEFINITION MODULE SEnvironment ;
+
+
+FROM DynamicStrings IMPORT String ;
+EXPORT QUALIFIED GetEnvironment ;
+
+
+(*
+   GetEnvironment - gets the environment variable Env and places
+      	       	    a copy of its value into String, dest.
+                    It returns TRUE if the string Env was found in
+                    the processes environment.
+*)
+
+@findex GetEnvironment
+PROCEDURE GetEnvironment (Env: String;
+                          VAR dest: String) : BOOLEAN ;
+
+
+(*
+   PutEnvironment - change or add an environment variable definition EnvDef.
+                    TRUE is returned if the environment variable was
+                    set or changed successfully.
+*)
+
+@findex PutEnvironment
+PROCEDURE PutEnvironment (EnvDef: String) : BOOLEAN ;
+
+
+END SEnvironment.
+@end example
+@page
+
+@node gm2-libs/SFIO, gm2-libs/SMathLib0, gm2-libs/SEnvironment, Base libraries
+@subsection gm2-libs/SFIO
+
+@example
+DEFINITION MODULE SFIO ;
+
+FROM DynamicStrings IMPORT String ;
+FROM FIO IMPORT File ;
+
+EXPORT QUALIFIED OpenToRead, OpenToWrite, OpenForRandom, Exists, WriteS, ReadS ;
+
+
+(*
+   Exists - returns TRUE if a file named, fname exists for reading.
+*)
+
+@findex Exists
+PROCEDURE Exists (fname: String) : BOOLEAN ;
+
+
+(*
+   OpenToRead - attempts to open a file, fname, for reading and
+                it returns this file.
+                The success of this operation can be checked by
+                calling IsNoError.
+*)
+
+@findex OpenToRead
+PROCEDURE OpenToRead (fname: String) : File ;
+
+
+(*
+   OpenToWrite - attempts to open a file, fname, for write and
+                 it returns this file.
+                 The success of this operation can be checked by
+                 calling IsNoError.
+*)
+
+@findex OpenToWrite
+PROCEDURE OpenToWrite (fname: String) : File ;
+
+
+(*
+   OpenForRandom - attempts to open a file, fname, for random access
+                   read or write and it returns this file.
+                   The success of this operation can be checked by
+                   calling IsNoError.
+                   towrite, determines whether the file should be
+                   opened for writing or reading.
+                   if towrite is TRUE or whether the previous file should
+                   be left alone, allowing this descriptor to seek
+                   and modify an existing file.
+*)
+
+@findex OpenForRandom
+PROCEDURE OpenForRandom (fname: String; towrite, newfile: BOOLEAN) : File ;
+
+
+(*
+   WriteS - writes a string, s, to, file. It returns the String, s.
+*)
+
+@findex WriteS
+PROCEDURE WriteS (file: File; s: String) : String ;
+
+
+(*
+   ReadS - reads a string, s, from, file. It returns the String, s.
+           It stops reading the string at the end of line or end of file.
+           It consumes the newline at the end of line but does not place
+           this into the returned string.
+*)
+
+@findex ReadS
+PROCEDURE ReadS (file: File) : String ;
+
+
+END SFIO.
+@end example
+@page
+
+@node gm2-libs/SMathLib0, gm2-libs/SYSTEM, gm2-libs/SFIO, Base libraries
+@subsection gm2-libs/SMathLib0
+
+@example
+DEFINITION MODULE SMathLib0 ;
+
+CONST
+   pi   = 3.1415926535897932384626433832795028841972;
+   exp1 = 2.7182818284590452353602874713526624977572;
+
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: SHORTREAL) : SHORTREAL ;
+@findex exp
+PROCEDURE exp (x: SHORTREAL) : SHORTREAL ;
+@findex ln
+PROCEDURE ln (x: SHORTREAL) : SHORTREAL ;
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: SHORTREAL) : SHORTREAL ;
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: SHORTREAL) : SHORTREAL ;
+@findex tan
+PROCEDURE tan (x: SHORTREAL) : SHORTREAL ;
+@findex arctan
+PROCEDURE arctan (x: SHORTREAL) : SHORTREAL ;
+@findex entier
+PROCEDURE entier (x: SHORTREAL) : INTEGER ;
+
+
+END SMathLib0.
+@end example
+@page
+
+@node gm2-libs/SYSTEM, gm2-libs/Scan, gm2-libs/SMathLib0, Base libraries
+@subsection gm2-libs/SYSTEM
+
+@example
+DEFINITION MODULE SYSTEM ;
+
+EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
+                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+                 Target specific data types.  *)
+                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
+                 (* SIZE is also exported if -fpim2 is used.  *)
+
+CONST
+@findex BITSPERBYTE (const)
+  BITSPERBYTE   = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+@findex BYTESPERWORD (const)
+  BYTESPERWORD  = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+
+
+(* all the following types are declared internally to gm2
+TYPE
+   (* Target specific data types.  *)
+*)
+
+
+(*
+   all the functions below are declared internally to gm2
+   ====================================================
+
+@findex ADR
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+@findex SIZE
+PROCEDURE SIZE (v: <type>) : ZType;
+  (* Returns the number of BYTES used to store a v of
+     any specified <type>.  Only available if -fpim2 is used.
+  *)
+
+@findex TSIZE
+PROCEDURE TSIZE (<type>) : CARDINAL;
+  (* Returns the number of BYTES used to store a value of the
+     specified <type>.
+  *)
+
+@findex ROTATE
+PROCEDURE ROTATE (val: <a set type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up/right
+     or down/right by the absolute value of num.  The direction is
+     down/right if the sign of num is negative, otherwise the direction
+     is up/left.
+  *)
+
+@findex SHIFT
+PROCEDURE SHIFT (val: <a set type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up/left
+     or down/right by the absolute value of num, introducing
+     zeros as necessary.  The direction is down/right if the sign of
+     num is negative, otherwise the direction is up/left.
+  *)
+
+@findex THROW
+PROCEDURE THROW (i: INTEGER) ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the
+     EXCEPT block (assuming it exists).  This is a compiler builtin
+     function which interfaces to the GCC exception handling runtime
+     system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+@findex TBITSIZE
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word sized set types. They are not strictly part
+   of the core PIM Modula-2, however they are used
+   to implement the SHIFT procedure defined above,
+   which are in turn used by the Logitech compatible libraries.
+
+   Users will access these procedures by using the procedure
+   SHIFT above and GNU Modula-2 will map SHIFT onto one of
+   the following procedures.
+*)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will only
+              call this routine for larger sets.
+*)
+
+@findex ShiftVal
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+@findex ShiftLeft
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex ShiftRight
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for larger
+               sets.
+*)
+
+@findex RotateVal
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex RotateLeft
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+@findex RotateRight
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
+@end example
+@page
+
+@node gm2-libs/Scan, gm2-libs/Selective, gm2-libs/SYSTEM, Base libraries
+@subsection gm2-libs/Scan
+
+@example
+DEFINITION MODULE Scan ;
+
+(* Provides a primitive symbol fetching from input.
+   Symbols are delimited by spaces and tabs.
+   Limitation only allows one source file at
+   a time to deliver symbols.  *)
+
+
+EXPORT QUALIFIED GetNextSymbol, WriteError,
+                 OpenSource, CloseSource,
+                 TerminateOnError, DefineComments ;
+
+
+(* OpenSource - opens a source file for reading.                  *)
+
+@findex OpenSource
+PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(* CloseSource - closes the current source file from reading.     *)
+
+@findex CloseSource
+PROCEDURE CloseSource ;
+
+
+(* GetNextSymbol gets the next source symbol and returns it in a. *)
+
+@findex GetNextSymbol
+PROCEDURE GetNextSymbol (VAR a: ARRAY OF CHAR) ;
+
+
+(* WriteError writes a message, a, under the source line, which   *)
+(* attempts to pinpoint the Symbol at fault.                      *)
+
+@findex WriteError
+PROCEDURE WriteError (a: ARRAY OF CHAR) ;
+
+
+(*
+   TerminateOnError - exits with status 1 if we call WriteError.
+*)
+
+@findex TerminateOnError
+PROCEDURE TerminateOnError ;
+
+
+(*
+   DefineComments - defines the start of comments within the source
+                    file.
+
+                    The characters in Start define the comment start
+                    and characters in End define the end.
+                    The BOOLEAN eoln determine whether the comment
+                    is terminated by end of line. If eoln is TRUE
+                    then End is ignored.
+
+                    If this procedure is never called then no comments
+                    are allowed.
+*)
+
+@findex DefineComments
+PROCEDURE DefineComments (Start, End: ARRAY OF CHAR; eoln: BOOLEAN) ;
+
+
+END Scan.
+@end example
+@page
+
+@node gm2-libs/Selective, gm2-libs/StdIO, gm2-libs/Scan, Base libraries
+@subsection gm2-libs/Selective
+
+@example
+DEFINITION MODULE Selective ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT QUALIFIED SetOfFd, Timeval,
+                 InitSet, KillSet, InitTime, KillTime,
+                 GetTime, SetTime,
+                 FdZero, FdSet, FdClr, FdIsSet, Select,
+                 MaxFdsPlusOne, WriteCharRaw, ReadCharRaw,
+                 GetTimeOfDay ;
+
+TYPE
+@findex SetOfFd (type)
+   SetOfFd = ADDRESS ;    (* Hidden type in Selective.c *)
+@findex Timeval (type)
+   Timeval = ADDRESS ;    (* Hidden type in Selective.c *)
+
+
+@findex Select
+PROCEDURE Select (nooffds: CARDINAL;
+                  readfds, writefds, exceptfds: SetOfFd;
+                  timeout: Timeval) : INTEGER ;
+
+@findex InitTime
+PROCEDURE InitTime (sec, usec: CARDINAL) : Timeval ;
+@findex KillTime
+PROCEDURE KillTime (t: Timeval) : Timeval ;
+@findex GetTime
+PROCEDURE GetTime (t: Timeval; VAR sec, usec: CARDINAL) ;
+@findex SetTime
+PROCEDURE SetTime (t: Timeval; sec, usec: CARDINAL) ;
+@findex InitSet
+PROCEDURE InitSet () : SetOfFd ;
+@findex KillSet
+PROCEDURE KillSet (s: SetOfFd) : SetOfFd ;
+@findex FdZero
+PROCEDURE FdZero (s: SetOfFd) ;
+@findex FdSet
+PROCEDURE FdSet (fd: INTEGER; s: SetOfFd) ;
+@findex FdClr
+PROCEDURE FdClr (fd: INTEGER; s: SetOfFd) ;
+@findex FdIsSet
+PROCEDURE FdIsSet (fd: INTEGER; s: SetOfFd) : BOOLEAN ;
+@findex MaxFdsPlusOne
+PROCEDURE MaxFdsPlusOne (a, b: INTEGER) : INTEGER ;
+
+(* you must use the raw routines with select - not the FIO buffered routines *)
+@findex WriteCharRaw
+PROCEDURE WriteCharRaw (fd: INTEGER; ch: CHAR) ;
+@findex ReadCharRaw
+PROCEDURE ReadCharRaw (fd: INTEGER) : CHAR ;
+
+(*
+   GetTimeOfDay - fills in a record, Timeval, filled in with the
+                  current system time in seconds and microseconds.
+                  It returns zero (see man 3p gettimeofday)
+*)
+
+@findex GetTimeOfDay
+PROCEDURE GetTimeOfDay (tv: Timeval) : INTEGER ;
+
+
+END Selective.
+@end example
+@page
+
+@node gm2-libs/StdIO, gm2-libs/Storage, gm2-libs/Selective, Base libraries
+@subsection gm2-libs/StdIO
+
+@example
+DEFINITION MODULE StdIO ;
+
+EXPORT QUALIFIED ProcRead, ProcWrite,
+                 Read, Write,
+                 PushOutput, PopOutput, GetCurrentOutput,
+                 PushInput, PopInput, GetCurrentInput ;
+
+
+TYPE
+@findex ProcWrite (type)
+   ProcWrite = PROCEDURE (CHAR) ;
+@findex ProcRead (type)
+   ProcRead  = PROCEDURE (VAR CHAR) ;
+
+
+(*
+   Read - is the generic procedure that all higher application layers
+          should use to receive a character.
+*)
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+
+
+(*
+   Write - is the generic procedure that all higher application layers
+           should use to emit a character.
+*)
+
+@findex Write
+PROCEDURE Write (ch: CHAR) ;
+
+
+(*
+   PushOutput - pushes the current Write procedure onto a stack,
+                any future references to Write will actually invoke
+                procedure, p.
+*)
+
+@findex PushOutput
+PROCEDURE PushOutput (p: ProcWrite) ;
+
+
+(*
+   PopOutput - restores Write to use the previous output procedure.
+*)
+
+@findex PopOutput
+PROCEDURE PopOutput ;
+
+
+(*
+   GetCurrentOutput - returns the current output procedure.
+*)
+
+@findex GetCurrentOutput
+PROCEDURE GetCurrentOutput () : ProcWrite ;
+
+
+(*
+   PushInput - pushes the current Read procedure onto a stack,
+               any future references to Read will actually invoke
+               procedure, p.
+*)
+
+@findex PushInput
+PROCEDURE PushInput (p: ProcRead) ;
+
+
+(*
+   PopInput - restores Write to use the previous output procedure.
+*)
+
+@findex PopInput
+PROCEDURE PopInput ;
+
+
+(*
+   GetCurrentInput - returns the current input procedure.
+*)
+
+@findex GetCurrentInput
+PROCEDURE GetCurrentInput () : ProcRead ;
+
+
+END StdIO.
+@end example
+@page
+
+@node gm2-libs/Storage, gm2-libs/StrCase, gm2-libs/StdIO, Base libraries
+@subsection gm2-libs/Storage
+
+@example
+DEFINITION MODULE Storage ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT QUALIFIED ALLOCATE, DEALLOCATE, REALLOCATE, Available ;
+
+
+
+(*
+   ALLOCATE - attempt to allocate memory from the heap.
+              NIL is returned in, a, if ALLOCATE fails.
+*)
+
+@findex ALLOCATE
+PROCEDURE ALLOCATE (VAR a: ADDRESS ; Size: CARDINAL) ;
+
+
+(*
+   DEALLOCATE - return, Size, bytes to the heap.
+                The variable, a, is set to NIL.
+*)
+
+@findex DEALLOCATE
+PROCEDURE DEALLOCATE (VAR a: ADDRESS ; Size: CARDINAL) ;
+
+
+(*
+   REALLOCATE - attempts to reallocate storage. The address,
+                a, should either be NIL in which case ALLOCATE
+                is called, or alternatively it should have already
+                been initialized by ALLOCATE. The allocated storage
+                is resized accordingly.
+*)
+
+@findex REALLOCATE
+PROCEDURE REALLOCATE (VAR a: ADDRESS; Size: CARDINAL) ;
+
+
+(*
+   Available - returns TRUE if, Size, bytes can be allocated.
+*)
+
+@findex Available
+PROCEDURE Available (Size: CARDINAL) : BOOLEAN ;
+
+
+END Storage.
+@end example
+@page
+
+@node gm2-libs/StrCase, gm2-libs/StrIO, gm2-libs/Storage, Base libraries
+@subsection gm2-libs/StrCase
+
+@example
+DEFINITION MODULE StrCase ;
+
+
+EXPORT QUALIFIED StrToUpperCase, StrToLowerCase, Cap, Lower ;
+
+
+(*
+   StrToUpperCase - converts string, a, to uppercase returning the
+                    result in, b.
+*)
+
+@findex StrToUpperCase
+PROCEDURE StrToUpperCase (a: ARRAY OF CHAR ; VAR b: ARRAY OF CHAR) ;
+
+
+(*
+   StrToLowerCase - converts string, a, to lowercase returning the
+                    result in, b.
+*)
+
+@findex StrToLowerCase
+PROCEDURE StrToLowerCase (a: ARRAY OF CHAR ; VAR b: ARRAY OF CHAR) ;
+
+
+(*
+   Cap - converts a lower case character into a capital character.
+         If the character is not a lower case character 'a'..'z'
+         then the character is simply returned unaltered.
+*)
+
+@findex Cap
+PROCEDURE Cap (ch: CHAR) : CHAR ;
+
+
+(*
+   Lower - converts an upper case character into a lower case character.
+           If the character is not an upper case character 'A'..'Z'
+           then the character is simply returned unaltered.
+*)
+
+@findex Lower
+PROCEDURE Lower (ch: CHAR) : CHAR ;
+
+
+END StrCase.
+@end example
+@page
+
+@node gm2-libs/StrIO, gm2-libs/StrLib, gm2-libs/StrCase, Base libraries
+@subsection gm2-libs/StrIO
+
+@example
+DEFINITION MODULE StrIO ;
+
+EXPORT QUALIFIED ReadString, WriteString,
+                 WriteLn ;
+
+
+(*
+   WriteLn - writes a carriage return and a newline
+             character.
+*)
+
+@findex WriteLn
+PROCEDURE WriteLn ;
+
+
+(*
+   ReadString - reads a sequence of characters into a string.
+                Line editing accepts Del, Ctrl H, Ctrl W and
+                Ctrl U.
+*)
+
+@findex ReadString
+PROCEDURE ReadString (VAR a: ARRAY OF CHAR) ;
+
+
+(*
+   WriteString - writes a string to the default output.
+*)
+
+@findex WriteString
+PROCEDURE WriteString (a: ARRAY OF CHAR) ;
+
+
+END StrIO.
+@end example
+@page
+
+@node gm2-libs/StrLib, gm2-libs/StringConvert, gm2-libs/StrIO, Base libraries
+@subsection gm2-libs/StrLib
+
+@example
+DEFINITION MODULE StrLib ;
+
+EXPORT QUALIFIED StrConCat, StrLen, StrCopy, StrEqual, StrLess,
+      	       	 IsSubString, StrRemoveWhitePrefix ;
+
+
+(*
+   StrConCat - combines a and b into c.
+*)
+
+@findex StrConCat
+PROCEDURE StrConCat (a, b: ARRAY OF CHAR; VAR c: ARRAY OF CHAR) ;
+
+
+(*
+   StrLess - returns TRUE if string, a, alphabetically occurs before
+             string, b.
+*)
+
+@findex StrLess
+PROCEDURE StrLess (a, b: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   StrEqual - performs a = b on two strings.
+*)
+
+@findex StrEqual
+PROCEDURE StrEqual (a, b: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   StrLen - returns the length of string, a.
+*)
+
+@findex StrLen
+PROCEDURE StrLen (a: ARRAY OF CHAR) : CARDINAL ;
+
+
+(*
+   StrCopy - copy string src into string dest providing dest is large enough.
+             If dest is smaller than a then src then the string is truncated when
+             dest is full.  Add a nul character if there is room in dest.
+*)
+
+@findex StrCopy
+PROCEDURE StrCopy (src: ARRAY OF CHAR ; VAR dest: ARRAY OF CHAR) ;
+
+
+(*
+   IsSubString - returns true if b is a subcomponent of a.
+*)
+
+@findex IsSubString
+PROCEDURE IsSubString (a, b: ARRAY OF CHAR) : BOOLEAN ;
+
+
+(*
+   StrRemoveWhitePrefix - copies string, into string, b, excluding any white
+                          space infront of a.
+*)
+
+@findex StrRemoveWhitePrefix
+PROCEDURE StrRemoveWhitePrefix (a: ARRAY OF CHAR; VAR b: ARRAY OF CHAR) ;
+
+
+END StrLib.
+@end example
+@page
+
+@node gm2-libs/StringConvert, gm2-libs/SysExceptions, gm2-libs/StrLib, Base libraries
+@subsection gm2-libs/StringConvert
+
+@example
+DEFINITION MODULE StringConvert ;
+
+FROM DynamicStrings IMPORT String ;
+EXPORT QUALIFIED IntegerToString, StringToInteger,
+                 StringToLongInteger, LongIntegerToString,
+                 StringToCardinal, CardinalToString,
+                 StringToLongCardinal, LongCardinalToString,
+                 StringToShortCardinal, ShortCardinalToString,
+                 StringToLongreal, LongrealToString,
+                 ToSigFig,
+                 stoi, itos, ctos, stoc, hstoi, ostoi, bstoi,
+                 hstoc, ostoc, bstoc,
+                 stor, stolr ;
+
+
+(*
+   IntegerToString - converts INTEGER, i, into a String. The field with
+                     can be specified if non zero. Leading characters
+                     are defined by padding and this function will
+                     prepend a + if sign is set to TRUE.
+                     The base allows the caller to generate binary,
+                     octal, decimal, hexidecimal numbers.
+                     The value of lower is only used when hexidecimal
+                     numbers are generated and if TRUE then digits
+                     abcdef are used, and if FALSE then ABCDEF are used.
+*)
+
+@findex IntegerToString
+PROCEDURE IntegerToString (i: INTEGER; width: CARDINAL; padding: CHAR; sign: BOOLEAN;
+                           base: CARDINAL; lower: BOOLEAN) : String ;
+
+
+(*
+   CardinalToString - converts CARDINAL, c, into a String. The field
+                      width can be specified if non zero. Leading
+                      characters are defined by padding.
+                      The base allows the caller to generate binary,
+                      octal, decimal, hexidecimal numbers.
+                      The value of lower is only used when hexidecimal
+                      numbers are generated and if TRUE then digits
+                      abcdef are used, and if FALSE then ABCDEF are used.
+*)
+
+@findex CardinalToString
+PROCEDURE CardinalToString (c: CARDINAL; width: CARDINAL; padding: CHAR;
+                            base: CARDINAL; lower: BOOLEAN) : String ;
+
+
+(*
+   StringToInteger - converts a string, s, of, base, into an INTEGER.
+                     Leading white space is ignored. It stops converting
+                     when either the string is exhausted or if an illegal
+                     numeral is found.
+                     The parameter found is set TRUE if a number was found.
+*)
+
+@findex StringToInteger
+PROCEDURE StringToInteger (s: String; base: CARDINAL; VAR found: BOOLEAN) : INTEGER ;
+
+
+(*
+   StringToCardinal - converts a string, s, of, base, into a CARDINAL.
+                      Leading white space is ignored. It stops converting
+                      when either the string is exhausted or if an illegal
+                      numeral is found.
+                      The parameter found is set TRUE if a number was found.
+*)
+
+@findex StringToCardinal
+PROCEDURE StringToCardinal (s: String; base: CARDINAL; VAR found: BOOLEAN) : CARDINAL ;
+
+
+(*
+   LongIntegerToString - converts LONGINT, i, into a String. The field with
+                         can be specified if non zero. Leading characters
+                         are defined by padding and this function will
+                         prepend a + if sign is set to TRUE.
+                         The base allows the caller to generate binary,
+                         octal, decimal, hexidecimal numbers.
+                         The value of lower is only used when hexidecimal
+                         numbers are generated and if TRUE then digits
+                         abcdef are used, and if FALSE then ABCDEF are used.
+*)
+
+@findex LongIntegerToString
+PROCEDURE LongIntegerToString (i: LONGINT; width: CARDINAL; padding: CHAR;
+                               sign: BOOLEAN; base: CARDINAL; lower: BOOLEAN) : String ;
+
+
+
+(*
+   StringToLongInteger - converts a string, s, of, base, into an LONGINT.
+                         Leading white space is ignored. It stops converting
+                         when either the string is exhausted or if an illegal
+                         numeral is found.
+                         The parameter found is set TRUE if a number was found.
+*)
+
+@findex StringToLongInteger
+PROCEDURE StringToLongInteger (s: String; base: CARDINAL; VAR found: BOOLEAN) : LONGINT ;
+
+
+(*
+   LongCardinalToString - converts LONGCARD, c, into a String. The field
+                          width can be specified if non zero. Leading
+                          characters are defined by padding.
+                          The base allows the caller to generate binary,
+                          octal, decimal, hexidecimal numbers.
+                          The value of lower is only used when hexidecimal
+                          numbers are generated and if TRUE then digits
+                          abcdef are used, and if FALSE then ABCDEF are used.
+*)
+
+@findex LongCardinalToString
+PROCEDURE LongCardinalToString (c: LONGCARD; width: CARDINAL; padding: CHAR;
+                                base: CARDINAL; lower: BOOLEAN) : String ;
+
+
+(*
+   StringToLongCardinal - converts a string, s, of, base, into a LONGCARD.
+                          Leading white space is ignored. It stops converting
+                          when either the string is exhausted or if an illegal
+                          numeral is found.
+                          The parameter found is set TRUE if a number was found.
+*)
+
+@findex StringToLongCardinal
+PROCEDURE StringToLongCardinal (s: String; base: CARDINAL; VAR found: BOOLEAN) : LONGCARD ;
+
+
+(*
+   ShortCardinalToString - converts SHORTCARD, c, into a String. The field
+                           width can be specified if non zero. Leading
+                           characters are defined by padding.
+                           The base allows the caller to generate binary,
+                           octal, decimal, hexidecimal numbers.
+                           The value of lower is only used when hexidecimal
+                           numbers are generated and if TRUE then digits
+                           abcdef are used, and if FALSE then ABCDEF are used.
+*)
+
+@findex ShortCardinalToString
+PROCEDURE ShortCardinalToString (c: SHORTCARD; width: CARDINAL; padding: CHAR;
+                                 base: CARDINAL; lower: BOOLEAN) : String ;
+
+
+(*
+   StringToShortCardinal - converts a string, s, of, base, into a SHORTCARD.
+                           Leading white space is ignored. It stops converting
+                           when either the string is exhausted or if an illegal
+                           numeral is found.
+                           The parameter found is set TRUE if a number was found.
+*)
+
+@findex StringToShortCardinal
+PROCEDURE StringToShortCardinal (s: String; base: CARDINAL;
+                                 VAR found: BOOLEAN) : SHORTCARD ;
+
+
+(*
+   stoi - decimal string to INTEGER
+*)
+
+@findex stoi
+PROCEDURE stoi (s: String) : INTEGER ;
+
+
+(*
+   itos - integer to decimal string.
+*)
+
+@findex itos
+PROCEDURE itos (i: INTEGER; width: CARDINAL; padding: CHAR; sign: BOOLEAN) : String ;
+
+
+(*
+   ctos - cardinal to decimal string.
+*)
+
+@findex ctos
+PROCEDURE ctos (c: CARDINAL; width: CARDINAL; padding: CHAR) : String ;
+
+
+(*
+   stoc - decimal string to CARDINAL
+*)
+
+@findex stoc
+PROCEDURE stoc (s: String) : CARDINAL ;
+
+
+(*
+   hstoi - hexidecimal string to INTEGER
+*)
+
+@findex hstoi
+PROCEDURE hstoi (s: String) : INTEGER ;
+
+
+(*
+   ostoi - octal string to INTEGER
+*)
+
+@findex ostoi
+PROCEDURE ostoi (s: String) : INTEGER ;
+
+
+(*
+   bstoi - binary string to INTEGER
+*)
+
+@findex bstoi
+PROCEDURE bstoi (s: String) : INTEGER ;
+
+
+(*
+   hstoc - hexidecimal string to CARDINAL
+*)
+
+@findex hstoc
+PROCEDURE hstoc (s: String) : CARDINAL ;
+
+
+(*
+   ostoc - octal string to CARDINAL
+*)
+
+@findex ostoc
+PROCEDURE ostoc (s: String) : CARDINAL ;
+
+
+(*
+   bstoc - binary string to CARDINAL
+*)
+
+@findex bstoc
+PROCEDURE bstoc (s: String) : CARDINAL ;
+
+
+(*
+   StringToLongreal - returns a LONGREAL and sets found to TRUE
+                      if a legal number is seen.
+*)
+
+@findex StringToLongreal
+PROCEDURE StringToLongreal (s: String; VAR found: BOOLEAN) : LONGREAL ;
+
+
+(*
+   LongrealToString - converts a LONGREAL number, Real, which has,
+                      TotalWidth, and FractionWidth into a string.
+
+                      So for example:
+
+                      LongrealToString(1.0, 4, 2)  -> '1.00'
+                      LongrealToString(12.3, 5, 2) -> '12.30'
+                      LongrealToString(12.3, 6, 2) -> ' 12.30'
+                      LongrealToString(12.3, 6, 3) -> '12.300'
+
+                      if total width is too small then the fraction
+                      becomes truncated.
+
+                      LongrealToString(12.3, 5, 3) -> '12.30'
+
+                      If TotalWidth is 0 then the function
+                      will return the value of x which is converted
+                      into as a fixed point number with exhaustive
+                      precision.
+*)
+
+@findex LongrealToString
+PROCEDURE LongrealToString (x: LONGREAL;
+                            TotalWidth, FractionWidth: CARDINAL) : String ;
+
+
+(*
+   stor - returns a REAL given a string.
+*)
+
+@findex stor
+PROCEDURE stor (s: String) : REAL ;
+
+
+(*
+   stolr - returns a LONGREAL given a string.
+*)
+
+@findex stolr
+PROCEDURE stolr (s: String) : LONGREAL ;
+
+
+(*
+   ToSigFig - returns a floating point or base 10 integer
+              string which is accurate to, n, significant
+              figures.  It will return a new String
+              and, s, will be destroyed.
+
+
+              So:  12.345
+
+              rounded to the following significant figures yields
+
+              5      12.345
+              4      12.34
+              3      12.3
+              2      12
+              1      10
+*)
+
+@findex ToSigFig
+PROCEDURE ToSigFig (s: String; n: CARDINAL) : String ;
+
+
+(*
+   ToDecimalPlaces - returns a floating point or base 10 integer
+                     string which is accurate to, n, decimal
+                     places.  It will return a new String
+                     and, s, will be destroyed.
+                     Decimal places yields, n, digits after
+                     the .
+
+                     So:  12.345
+
+                     rounded to the following decimal places yields
+
+                     5      12.34500
+                     4      12.3450
+                     3      12.345
+                     2      12.34
+                     1      12.3
+*)
+
+@findex ToDecimalPlaces
+PROCEDURE ToDecimalPlaces (s: String; n: CARDINAL) : String ;
+
+
+END StringConvert.
+@end example
+@page
+
+@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringConvert, Base libraries
+@subsection gm2-libs/SysExceptions
+
+@example
+DEFINITION MODULE SysExceptions ;
+
+(* Provides a mechanism for the underlying libraries to
+   configure the exception routines.  This mechanism
+   is used by both the ISO and PIM libraries.
+   It is written to be ISO compliant and this also
+   allows for mixed dialect projects.  *)
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex PROCEXCEPTION (type)
+   PROCEXCEPTION = PROCEDURE (ADDRESS) ;
+
+@findex InitExceptionHandlers
+PROCEDURE InitExceptionHandlers (indexf, range, casef, invalidloc,
+                                 function, wholevalue, wholediv,
+                                 realvalue, realdiv, complexvalue,
+                                 complexdiv, protection, systemf,
+                                 coroutine, exception: PROCEXCEPTION) ;
+
+
+END SysExceptions.
+@end example
+@page
+
+@node gm2-libs/SysStorage, gm2-libs/TimeString, gm2-libs/SysExceptions, Base libraries
+@subsection gm2-libs/SysStorage
+
+@example
+DEFINITION MODULE SysStorage ;
+
+(*  Provides dynamic allocation for the system components.
+    This allows the application to use the traditional Storage module
+    which can be handled differently.  *)
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED ALLOCATE, DEALLOCATE, REALLOCATE, Available, Init ;
+
+
+(*
+   ALLOCATE - attempt to allocate memory from the heap.
+              NIL is returned in, a, if ALLOCATE fails.
+*)
+
+@findex ALLOCATE
+PROCEDURE ALLOCATE (VAR a: ADDRESS ; size: CARDINAL) ;
+
+
+(*
+   DEALLOCATE - return, size, bytes to the heap.
+                The variable, a, is set to NIL.
+*)
+
+@findex DEALLOCATE
+PROCEDURE DEALLOCATE (VAR a: ADDRESS ; size: CARDINAL) ;
+
+
+(*
+   REALLOCATE - attempts to reallocate storage. The address,
+                a, should either be NIL in which case ALLOCATE
+                is called, or alternatively it should have already
+                been initialized by ALLOCATE. The allocated storage
+                is resized accordingly.
+*)
+
+@findex REALLOCATE
+PROCEDURE REALLOCATE (VAR a: ADDRESS; size: CARDINAL) ;
+
+
+(*
+   Available - returns TRUE if, size, bytes can be allocated.
+*)
+
+@findex Available
+PROCEDURE Available (size: CARDINAL) : BOOLEAN;
+
+
+(*
+   Init - initializes the heap.
+          This does nothing on a GNU/Linux system.
+          But it remains here since it might be used in an
+          embedded system.
+*)
+
+@findex Init
+PROCEDURE Init ;
+
+
+END SysStorage.
+@end example
+@page
+
+@node gm2-libs/TimeString, gm2-libs/UnixArgs, gm2-libs/SysStorage, Base libraries
+@subsection gm2-libs/TimeString
+
+@example
+DEFINITION MODULE TimeString ;
+
+EXPORT QUALIFIED GetTimeString ;
+
+
+(*
+   GetTimeString - places the time in ascii format into array, a.
+
+*)
+
+@findex GetTimeString
+PROCEDURE GetTimeString (VAR a: ARRAY OF CHAR) ;
+
+
+END TimeString.
+@end example
+@page
+
+@node gm2-libs/UnixArgs, gm2-libs/cbuiltin, gm2-libs/TimeString, Base libraries
+@subsection gm2-libs/UnixArgs
+
+@example
+DEFINITION MODULE UnixArgs ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT QUALIFIED GetArgC, GetArgV, GetEnvV ;
+
+@findex GetArgC
+PROCEDURE GetArgC () : INTEGER ;
+@findex GetArgV
+PROCEDURE GetArgV () : ADDRESS ;
+@findex GetEnvV
+PROCEDURE GetEnvV () : ADDRESS ;
+
+
+END UnixArgs.
+@end example
+@page
+
+@node gm2-libs/cbuiltin, gm2-libs/cgetopt, gm2-libs/UnixArgs, Base libraries
+@subsection gm2-libs/cbuiltin
+
+@example
+DEFINITION MODULE FOR "C" cbuiltin ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT UNQUALIFIED alloca, memcpy,
+		   isfinite, isfinitef, isfinitel,
+		   isinf_sign, isinf_signf, isinf_signl,
+                   sinf, sinl, sin,
+                   cosf, cosl, cos,
+                   atan2f, atan2l, atan2,
+                   sqrtf, sqrtl, sqrt,
+                   fabsf, fabsl, fabs,
+                   logf, logl, log,
+                   expf, expl, exp,
+                   log10f, log10l, log10,
+                   exp10f, exp10l, exp10,
+                   ilogbf, ilogbl, ilogb,
+                   significand, significandf, significandl,
+                   modf, modff, modfl,
+                   nextafter, nextafterf, nextafterl,
+                   nexttoward, nexttowardf, nexttowardl,
+                   scalb, scalbf, scalbl,
+                   scalbn, scalbnf, scalbnl,
+                   scalbln, scalblnf, scalblnl,
+
+                   cabsf, cabsl, cabs,
+                   cargf, carg, cargl,
+                   conjf, conj, conjl,
+                   cpowf, cpow, cpowl,
+                   csqrtf, csqrt, csqrtl,
+                   cexpf, cexp, cexpl,
+                   clogf, clog, clogl,
+                   csinf, csin, csinl,
+                   ccosf, ccos, ccosl,
+                   ctanf, ctan, ctanl,
+                   casinf, casin, casinl,
+                   cacosf, cacos, cacosl,
+                   catanf, catan, catanl,
+
+                   index, rindex,
+                   memcmp, memset, memmove,
+                   strcat, strncat, strcpy, strncpy, strcmp, strncmp,
+                   strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr ;
+
+@findex alloca
+PROCEDURE alloca (i: CARDINAL) : ADDRESS ;
+@findex memcpy
+PROCEDURE memcpy (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
+@findex isfinite
+PROCEDURE isfinite (x: REAL) : BOOLEAN ;
+@findex isfinitel
+PROCEDURE isfinitel (x: LONGREAL) : BOOLEAN ;
+@findex isfinitef
+PROCEDURE isfinitef (x: SHORTREAL) : BOOLEAN ;
+@findex isinf_sign
+PROCEDURE isinf_sign (x: REAL) : BOOLEAN ;
+@findex isinf_signl
+PROCEDURE isinf_signl (x: LONGREAL) : BOOLEAN ;
+@findex isinf_signf
+PROCEDURE isinf_signf (x: SHORTREAL) : BOOLEAN ;
+@findex sinf
+PROCEDURE sinf (x: SHORTREAL) : SHORTREAL ;
+@findex sin
+PROCEDURE sin (x: REAL) : REAL ;
+@findex sinl
+PROCEDURE sinl (x: LONGREAL) : LONGREAL ;
+@findex cosf
+PROCEDURE cosf (x: SHORTREAL) : SHORTREAL ;
+@findex cos
+PROCEDURE cos (x: REAL) : REAL ;
+@findex cosl
+PROCEDURE cosl (x: LONGREAL) : LONGREAL ;
+@findex atan2f
+PROCEDURE atan2f (x, y: SHORTREAL) : SHORTREAL ;
+@findex atan2
+PROCEDURE atan2 (x, y: REAL) : REAL ;
+@findex atan2l
+PROCEDURE atan2l (x, y: LONGREAL) : LONGREAL ;
+@findex sqrtf
+PROCEDURE sqrtf (x: SHORTREAL) : SHORTREAL ;
+@findex sqrt
+PROCEDURE sqrt (x: REAL) : REAL ;
+@findex sqrtl
+PROCEDURE sqrtl (x: LONGREAL) : LONGREAL ;
+@findex fabsf
+PROCEDURE fabsf (x: SHORTREAL) : SHORTREAL ;
+@findex fabs
+PROCEDURE fabs (x: REAL) : REAL ;
+@findex fabsl
+PROCEDURE fabsl (x: LONGREAL) : LONGREAL ;
+@findex logf
+PROCEDURE logf (x: SHORTREAL) : SHORTREAL ;
+@findex log
+PROCEDURE log (x: REAL) : REAL ;
+@findex logl
+PROCEDURE logl (x: LONGREAL) : LONGREAL ;
+@findex expf
+PROCEDURE expf (x: SHORTREAL) : SHORTREAL ;
+@findex exp
+PROCEDURE exp (x: REAL) : REAL ;
+@findex expl
+PROCEDURE expl (x: LONGREAL) : LONGREAL ;
+@findex log10f
+PROCEDURE log10f (x: SHORTREAL) : SHORTREAL ;
+@findex log10
+PROCEDURE log10 (x: REAL) : REAL ;
+@findex log10l
+PROCEDURE log10l (x: LONGREAL) : LONGREAL ;
+@findex exp10f
+PROCEDURE exp10f (x: SHORTREAL) : SHORTREAL ;
+@findex exp10
+PROCEDURE exp10 (x: REAL) : REAL ;
+@findex exp10l
+PROCEDURE exp10l (x: LONGREAL) : LONGREAL ;
+@findex ilogbf
+PROCEDURE ilogbf (x: SHORTREAL) : INTEGER ;
+@findex ilogb
+PROCEDURE ilogb (x: REAL) : INTEGER ;
+@findex ilogbl
+PROCEDURE ilogbl (x: LONGREAL) : INTEGER ;
+
+@findex significand
+PROCEDURE significand (r: REAL) : REAL ;
+@findex significandf
+PROCEDURE significandf (s: SHORTREAL) : SHORTREAL ;
+@findex significandl
+PROCEDURE significandl (l: LONGREAL) : LONGREAL ;
+
+@findex modf
+PROCEDURE modf (x: REAL; VAR y: REAL) : REAL ;
+@findex modff
+PROCEDURE modff (x: SHORTREAL; VAR y: SHORTREAL) : SHORTREAL ;
+@findex modfl
+PROCEDURE modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
+
+@findex nextafter
+PROCEDURE nextafter (x, y: REAL) : REAL ;
+@findex nextafterf
+PROCEDURE nextafterf (x, y: SHORTREAL) : SHORTREAL ;
+@findex nextafterl
+PROCEDURE nextafterl (x, y: LONGREAL) : LONGREAL ;
+
+@findex nexttoward
+PROCEDURE nexttoward (x, y: REAL) : REAL ;
+@findex nexttowardf
+PROCEDURE nexttowardf (x, y: SHORTREAL) : SHORTREAL ;
+@findex nexttowardl
+PROCEDURE nexttowardl (x, y: LONGREAL) : LONGREAL ;
+
+@findex scalb
+PROCEDURE scalb (x, n: REAL) : REAL ;
+@findex scalbf
+PROCEDURE scalbf (x, n: SHORTREAL) : SHORTREAL ;
+@findex scalbl
+PROCEDURE scalbl (x, n: LONGREAL) : LONGREAL ;
+
+@findex scalbn
+PROCEDURE scalbn (x: REAL; n: INTEGER) : REAL ;
+@findex scalbnf
+PROCEDURE scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
+@findex scalbnl
+PROCEDURE scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
+
+@findex scalbln
+PROCEDURE scalbln (x: REAL; n: LONGINT) : REAL ;
+@findex scalblnf
+PROCEDURE scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
+@findex scalblnl
+PROCEDURE scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
+
+@findex cabsf
+PROCEDURE cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex cabs
+PROCEDURE cabs (z: COMPLEX) : REAL ;
+@findex cabsl
+PROCEDURE cabsl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex cargf
+PROCEDURE cargf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex carg
+PROCEDURE carg (z: COMPLEX) : REAL ;
+@findex cargl
+PROCEDURE cargl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex conjf
+PROCEDURE conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex conj
+PROCEDURE conj (z: COMPLEX) : COMPLEX ;
+@findex conjl
+PROCEDURE conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cpowf
+PROCEDURE cpowf (base: SHORTCOMPLEX; exp: SHORTREAL) : SHORTCOMPLEX ;
+@findex cpow
+PROCEDURE cpow (base: COMPLEX; exp: REAL) : COMPLEX ;
+@findex cpowl
+PROCEDURE cpowl (base: LONGCOMPLEX; exp: LONGREAL) : LONGCOMPLEX ;
+
+@findex csqrtf
+PROCEDURE csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csqrt
+PROCEDURE csqrt (z: COMPLEX) : COMPLEX ;
+@findex csqrtl
+PROCEDURE csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cexpf
+PROCEDURE cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cexp
+PROCEDURE cexp (z: COMPLEX) : COMPLEX ;
+@findex cexpl
+PROCEDURE cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex clogf
+PROCEDURE clogf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex clog
+PROCEDURE clog (z: COMPLEX) : COMPLEX ;
+@findex clogl
+PROCEDURE clogl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex csinf
+PROCEDURE csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csin
+PROCEDURE csin (z: COMPLEX) : COMPLEX ;
+@findex csinl
+PROCEDURE csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ccosf
+PROCEDURE ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ccos
+PROCEDURE ccos (z: COMPLEX) : COMPLEX ;
+@findex ccosl
+PROCEDURE ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ctanf
+PROCEDURE ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ctan
+PROCEDURE ctan (z: COMPLEX) : COMPLEX ;
+@findex ctanl
+PROCEDURE ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex casinf
+PROCEDURE casinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex casin
+PROCEDURE casin (z: COMPLEX) : COMPLEX ;
+@findex casinl
+PROCEDURE casinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cacosf
+PROCEDURE cacosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cacos
+PROCEDURE cacos (z: COMPLEX) : COMPLEX ;
+@findex cacosl
+PROCEDURE cacosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex catanf
+PROCEDURE catanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex catan
+PROCEDURE catan (z: COMPLEX) : COMPLEX ;
+@findex catanl
+PROCEDURE catanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex index
+PROCEDURE index (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex rindex
+PROCEDURE rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex memcmp
+PROCEDURE memcmp (s1, s2: ADDRESS; n: CARDINAL) : INTEGER ;
+@findex memmove
+PROCEDURE memmove (s1, s2: ADDRESS; n: CARDINAL) : ADDRESS ;
+@findex memset
+PROCEDURE memset (s: ADDRESS; c: INTEGER; n: CARDINAL) : ADDRESS ;
+@findex strcat
+PROCEDURE strcat (dest, src: ADDRESS) : ADDRESS ;
+@findex strncat
+PROCEDURE strncat (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
+@findex strcpy
+PROCEDURE strcpy (dest, src: ADDRESS) : ADDRESS ;
+@findex strncpy
+PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
+@findex strcmp
+PROCEDURE strcmp (s1, s2: ADDRESS) : INTEGER ;
+@findex strncmp
+PROCEDURE strncmp (s1, s2: ADDRESS; n: CARDINAL) : INTEGER ;
+@findex strlen
+PROCEDURE strlen (s: ADDRESS) : INTEGER ;
+@findex strstr
+PROCEDURE strstr (haystack, needle: ADDRESS) : ADDRESS ;
+@findex strpbrk
+PROCEDURE strpbrk (s, accept: ADDRESS) : ADDRESS ;
+@findex strspn
+PROCEDURE strspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strcspn
+PROCEDURE strcspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strchr
+PROCEDURE strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex strrchr
+PROCEDURE strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+
+END cbuiltin.
+@end example
+@page
+
+@node gm2-libs/cgetopt, gm2-libs/cxxabi, gm2-libs/cbuiltin, Base libraries
+@subsection gm2-libs/cgetopt
+
+@example
+DEFINITION MODULE cgetopt ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+TYPE
+@findex Options (type)
+   Options = ADDRESS ;
+
+VAR
+@findex optarg (var)
+   optarg                : ADDRESS ;
+@findex optind (var)
+@findex opterr (var)
+@findex optopt (var)
+   optind, opterr, optopt: INTEGER ;
+
+
+(*
+   getopt - the getopt() function parses the command-line arguments.
+            Its arguments argc and argv are the argument count and array as
+            passed to the main() function on program invocation.  An element of
+            argv that starts with '-' (and is not exactly "-" or "--") is an
+            option element.  The characters of this element (aside from the
+            initial '-') are option characters.  If getopt() is called
+            repeatedly, it returns successively each of the option characters
+            from each of the option elements.
+*)
+
+@findex getopt
+PROCEDURE getopt (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS) : CHAR ;
+
+
+(*
+   getopt_long - works like getopt() except that it also accepts long options,
+                 started with two dashes.  (If the program accepts only long
+                 options, then optstring should be specified as an empty string (""),
+                 not NULL.)  Long option names may be abbreviated if the abbreviation
+                 is unique or is an exact match for some defined option.  A
+                 long option may take a parameter, of the form --arg=param or
+                 --arg param.
+*)
+
+@findex getopt_long
+PROCEDURE getopt_long (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
+                       longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
+
+
+(*
+   getopt_long_only - a wrapper for the C getopt_long_only.
+*)
+
+@findex getopt_long_only
+PROCEDURE getopt_long_only (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
+                            longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
+
+
+(*
+   InitOptions - constructor for empty Options.
+*)
+
+@findex InitOptions
+PROCEDURE InitOptions () : Options ;
+
+
+(*
+   KillOptions - deconstructor for empty Options.
+*)
+
+@findex KillOptions
+PROCEDURE KillOptions (o: Options) : Options ;
+
+
+(*
+   SetOption - set option[index] with @{name, has_arg, flag, val@}.
+*)
+
+@findex SetOption
+PROCEDURE SetOption (o: Options; index: CARDINAL;
+                     name: ADDRESS; has_arg: BOOLEAN;
+                     VAR flag: INTEGER; val: INTEGER) ;
+
+
+(*
+   GetLongOptionArray - return a pointer to the C array containing all
+                        long options.
+*)
+
+@findex GetLongOptionArray
+PROCEDURE GetLongOptionArray (o: Options) : ADDRESS ;
+
+
+END cgetopt.
+@end example
+@page
+
+@node gm2-libs/cxxabi, gm2-libs/dtoa, gm2-libs/cgetopt, Base libraries
+@subsection gm2-libs/cxxabi
+
+@example
+DEFINITION MODULE FOR "C" cxxabi ;
+
+(* This should only be used by the compiler and it matches the
+    g++ implementation.  *)
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT UNQUALIFIED __cxa_begin_catch, __cxa_end_catch, __cxa_rethrow ;
+
+
+@findex __cxa_begin_catch
+PROCEDURE __cxa_begin_catch (a: ADDRESS) : ADDRESS ;
+@findex __cxa_end_catch
+PROCEDURE __cxa_end_catch ;
+@findex __cxa_rethrow
+PROCEDURE __cxa_rethrow ;
+
+
+END cxxabi.
+@end example
+@page
+
+@node gm2-libs/dtoa, gm2-libs/errno, gm2-libs/cxxabi, Base libraries
+@subsection gm2-libs/dtoa
+
+@example
+DEFINITION MODULE dtoa ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex Mode (type)
+   Mode = (maxsignificant, decimaldigits) ;
+
+
+(*
+   strtod - returns a REAL given a string, s.  It will set
+            error to TRUE if the number is too large.
+*)
+
+@findex strtod
+PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ;
+
+
+(*
+   dtoa - converts a REAL, d, into a string.  The address of the
+          string is returned.
+          mode       indicates the type of conversion required.
+          ndigits    determines the number of digits according to mode.
+          decpt      the position of the decimal point.
+          sign       does the string have a sign?
+*)
+
+@findex dtoa
+PROCEDURE dtoa (d        : REAL;
+                mode     : Mode;
+                ndigits  : INTEGER;
+	        VAR decpt: INTEGER;
+	        VAR sign : BOOLEAN) : ADDRESS ;
+
+
+END dtoa.
+@end example
+@page
+
+@node gm2-libs/errno, gm2-libs/gdbif, gm2-libs/dtoa, Base libraries
+@subsection gm2-libs/errno
+
+@example
+DEFINITION MODULE errno ;
+
+CONST
+    EINTR  =  4 ;   (* system call interrupted *)
+    ERANGE = 34 ;   (* result is too large     *)
+    EAGAIN = 11 ;   (* retry the system call   *)
+
+@findex geterrno
+PROCEDURE geterrno () : INTEGER ;
+
+
+END errno.
+@end example
+@page
+
+@node gm2-libs/gdbif, gm2-libs/ldtoa, gm2-libs/errno, Base libraries
+@subsection gm2-libs/gdbif
+
+@example
+DEFINITION MODULE gdbif ;
+
+(*  Provides interactive connectivity with gdb useful for debugging
+    Modula-2 shared libraries.  *)
+
+EXPORT UNQUALIFIED sleepSpin, finishSpin, connectSpin ;
+
+
+(*
+   finishSpin - sets boolean mustWait to FALSE.
+*)
+
+@findex finishSpin
+PROCEDURE finishSpin ;
+
+
+(*
+   sleepSpin - waits for the boolean variable mustWait to become FALSE.
+               It sleeps for a second between each test of the variable.
+*)
+
+@findex sleepSpin
+PROCEDURE sleepSpin ;
+
+
+(*
+   connectSpin - breakpoint placeholder.  Its only purpose is to allow users
+                 to set a breakpoint.  This procedure is called once
+                 sleepSpin is released from its spin (via a call from
+                 finishSpin).
+*)
+
+@findex connectSpin
+PROCEDURE connectSpin ;
+
+
+END gdbif.
+@end example
+@page
+
+@node gm2-libs/ldtoa, gm2-libs/libc, gm2-libs/gdbif, Base libraries
+@subsection gm2-libs/ldtoa
+
+@example
+DEFINITION MODULE ldtoa ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex Mode (type)
+   Mode = (maxsignificant, decimaldigits) ;
+
+
+(*
+   strtold - returns a LONGREAL given a C string, s.  It will set
+             error to TRUE if the number is too large or badly formed.
+*)
+
+@findex strtold
+PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ;
+
+
+(*
+   ldtoa - converts a LONGREAL, d, into a string.  The address of the
+           string is returned.
+           mode       indicates the type of conversion required.
+           ndigits    determines the number of digits according to mode.
+           decpt      the position of the decimal point.
+           sign       does the string have a sign?
+*)
+
+@findex ldtoa
+PROCEDURE ldtoa (d        : LONGREAL;
+                 mode     : Mode;
+                 ndigits  : INTEGER;
+                 VAR decpt: INTEGER;
+                 VAR sign : BOOLEAN) : ADDRESS ;
+
+
+END ldtoa.
+@end example
+@page
+
+@node gm2-libs/libc, gm2-libs/libm, gm2-libs/ldtoa, Base libraries
+@subsection gm2-libs/libc
+
+@example
+DEFINITION MODULE FOR "C" libc ;
+
+FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T ;
+
+EXPORT UNQUALIFIED time_t, timeb, tm, ptrToTM,
+                   write, read,
+                   system, abort,
+                   malloc, free,
+                   exit, isatty,
+                   getenv, putenv, getpid,
+                   dup, close, open, lseek,
+                   readv, writev,
+                   perror, creat,
+                   getcwd, chown, strlen, strcpy, strncpy,
+                   unlink, setenv,
+                   memcpy, memset, memmove, printf, realloc,
+                   rand, srand,
+                   time, localtime, ftime,
+                   shutdown, rename, setjmp, longjmp, atexit,
+                   ttyname, sleep, execv ;
+
+
+TYPE
+@findex time_t (type)
+   time_t = LONGINT ;
+
+@findex ptrToTM (type)
+   ptrToTM = POINTER TO tm ;
+@findex tm (type)
+   tm = RECORD
+           tm_sec: INTEGER ;     (* Seconds.     [0-60] (1 leap second) *)
+           tm_min: INTEGER ;     (* Minutes.     [0-59]   *)
+           tm_hour: INTEGER ;    (* Hours.       [0-23]   *)
+           tm_mday: INTEGER ;    (* Day.         [1-31]   *)
+           tm_mon: INTEGER ;     (* Month.       [0-11]   *)
+           tm_year: INTEGER ;    (* Year - 1900.          *)
+           tm_wday: INTEGER ;    (* Day of week. [0-6]    *)
+           tm_yday: INTEGER ;    (* Days in year.[0-365]  *)
+           tm_isdst: INTEGER ;   (* DST.         [-1/0/1] *)
+           tm_gmtoff: LONGINT ;  (* Seconds east of UTC.  *)
+           tm_zone: ADDRESS ;    (* char * zone name      *)
+@findex END (type)
+        END ;
+
+@findex timeb (type)
+   timeb = RECORD
+              time    : time_t ;
+              millitm : SHORTCARD ;
+              timezone: SHORTCARD ;
+              dstflag : SHORTCARD ;
+@findex END (type)
+           END ;
+
+@findex exitP (type)
+   exitP = PROCEDURE () : INTEGER ;
+
+
+(*
+     ssize_t write (int d, void *buf, size_t nbytes)
+*)
+
+@findex write
+PROCEDURE write (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
+
+
+(*
+     ssize_t read (int d, void *buf, size_t nbytes)
+*)
+
+@findex read
+PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
+
+
+(*
+     int system(string)
+     char *string;
+*)
+
+@findex system
+PROCEDURE system (a: ADDRESS) : [ INTEGER ] ;
+
+
+(*
+     abort - generate a fault
+
+     abort() first closes all open files if possible, then sends
+     an IOT signal to the process.  This signal usually results
+     in termination with a core dump, which may be used for
+     debugging.
+
+     It is possible for abort() to return control if is caught or
+     ignored, in which case the value returned is that of the
+     kill(2V) system call.
+*)
+
+@findex abort
+PROCEDURE abort <* noreturn *> ;
+
+
+(*
+     malloc - memory allocator.
+
+     void *malloc(size_t size);
+
+     malloc() returns a pointer to a block of at least size
+     bytes, which is appropriately aligned.  If size is zero,
+     malloc() returns a non-NULL pointer, but this pointer should
+     not be dereferenced.
+*)
+
+@findex malloc
+PROCEDURE malloc (size: CSIZE_T) : ADDRESS ;
+
+
+(*
+     free - memory deallocator.
+
+     free (void *ptr);
+
+     free() releases a previously allocated block.  Its argument
+     is a pointer to a block previously allocated by malloc,
+     calloc, realloc, malloc, or memalign.
+*)
+
+@findex free
+PROCEDURE free (ptr: ADDRESS) ;
+
+
+(*
+     void *realloc (void *ptr, size_t size);
+
+     realloc changes the size of the memory block pointed to
+     by ptr to size bytes. The contents will be  unchanged  to
+     the minimum of the old and new sizes; newly allocated memory
+     will be uninitialized. If ptr is NIL, the call is
+     equivalent  to malloc(size); if size is equal to zero, the
+     call is equivalent to free(ptr). Unless ptr is NIL, it
+     must have been returned by an earlier call to malloc(),
+     realloc.
+*)
+
+@findex realloc
+PROCEDURE realloc (ptr: ADDRESS; size: CSIZE_T) : ADDRESS ;
+
+
+(*
+   isatty - does this descriptor refer to a terminal.
+*)
+
+@findex isatty
+PROCEDURE isatty (fd: INTEGER) : INTEGER ;
+
+
+(*
+   exit - returns control to the invoking process. Result, r, is
+          returned.
+*)
+
+@findex exit
+PROCEDURE exit (r: INTEGER) <* noreturn *> ;
+
+
+(*
+   getenv - returns the C string for the equivalent C environment
+            variable.
+*)
+
+@findex getenv
+PROCEDURE getenv (s: ADDRESS) : ADDRESS ;
+
+
+(*
+   putenv - change or add an environment variable.
+*)
+
+@findex putenv
+PROCEDURE putenv (s: ADDRESS) : INTEGER ;
+
+
+(*
+   getpid - returns the UNIX process identification number.
+*)
+
+@findex getpid
+PROCEDURE getpid () : INTEGER ;
+
+
+(*
+   dup - duplicates the file descriptor, d.
+*)
+
+@findex dup
+PROCEDURE dup (d: INTEGER) : INTEGER ;
+
+
+(*
+   close - closes the file descriptor, d.
+*)
+
+@findex close
+PROCEDURE close (d: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   open - open the file, filename with flag and mode.
+*)
+
+@findex open
+PROCEDURE open (filename: ADDRESS; oflag: INTEGER; ...) : INTEGER ;
+
+
+(*
+   creat - creates a new file
+*)
+
+@findex creat
+PROCEDURE creat (filename: ADDRESS; mode: CARDINAL) : INTEGER;
+
+
+(*
+   lseek - calls unix lseek:
+
+           off_t lseek(int fildes, off_t offset, int whence);
+*)
+
+@findex lseek
+PROCEDURE lseek (fd: INTEGER; offset: LONGINT; whence: INTEGER) : LONGINT ;
+
+
+(*
+   perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).
+*)
+
+@findex perror
+PROCEDURE perror (string: ARRAY OF CHAR);
+
+
+(*
+   readv - reads an io vector of bytes.
+*)
+
+@findex readv
+PROCEDURE readv (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   writev - writes an io vector of bytes.
+*)
+
+@findex writev
+PROCEDURE writev (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   getcwd - copies the absolute pathname of the
+            current working directory to the array pointed to by buf,
+            which is of length size.
+
+            If the current absolute path name would require a buffer
+            longer than size elements, NULL is returned, and errno is
+            set to ERANGE; an application should check for this error,
+            and allocate a larger buffer if necessary.
+*)
+
+@findex getcwd
+PROCEDURE getcwd (buf: ADDRESS; size: CSIZE_T) : ADDRESS ;
+
+
+(*
+   chown - The  owner  of  the  file  specified  by  path or by fd is
+           changed.  Only the super-user may change the  owner  of  a
+           file.   The  owner  of  a file may change the group of the
+           file to any group of which that owner is  a  member.   The
+           super-user may change the group arbitrarily.
+
+           If  the owner or group is specified as -1, then that ID is
+           not changed.
+
+           On success, zero is returned.  On error, -1  is  returned,
+           and errno is set appropriately.
+*)
+
+@findex chown
+PROCEDURE chown (filename: ADDRESS; uid, gid: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   strlen - returns the length of string, a.
+*)
+
+@findex strlen
+PROCEDURE strlen (a: ADDRESS) : CSIZE_T ;
+
+
+(*
+   strcpy - copies string, src, into, dest.
+            It returns dest.
+*)
+
+@findex strcpy
+PROCEDURE strcpy (dest, src: ADDRESS) : [ ADDRESS ] ;
+
+
+(*
+   strncpy - copies string, src, into, dest, copying at most, n, bytes.
+             It returns dest.
+*)
+
+@findex strncpy
+PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : [ ADDRESS ] ;
+
+
+(*
+   unlink - removes file and returns 0 if successful.
+*)
+
+@findex unlink
+PROCEDURE unlink (file: ADDRESS) : [ INTEGER ] ;
+
+
+(*
+   memcpy - copy memory area
+
+   SYNOPSIS
+
+   #include <string.h>
+
+   void *memcpy(void *dest, const void *src, size_t n);
+   It returns dest.
+*)
+
+@findex memcpy
+PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
+
+
+(*
+   memset - fill memory with a constant byte
+
+   SYNOPSIS
+
+   #include <string.h>
+
+   void *memset(void *s, int c, size_t n);
+   It returns s.
+*)
+
+@findex memset
+PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : [ ADDRESS ] ;
+
+
+(*
+   memmove - copy memory areas which may overlap
+
+   SYNOPSIS
+
+   #include <string.h>
+
+   void *memmove(void *dest, const void *src, size_t n);
+   It returns dest.
+*)
+
+@findex memmove
+PROCEDURE memmove (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
+
+
+(*
+   int printf(const char *format, ...);
+*)
+
+@findex printf
+PROCEDURE printf (format: ARRAY OF CHAR; ...) : [ INTEGER ] ;
+
+
+(*
+   setenv - sets environment variable, name, to value.
+            It will overwrite an existing value if, overwrite,
+            is true.  It returns 0 on success and -1 for an error.
+*)
+
+@findex setenv
+PROCEDURE setenv (name: ADDRESS; value: ADDRESS; overwrite: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   srand - initialize the random number seed.
+*)
+
+@findex srand
+PROCEDURE srand (seed: INTEGER) ;
+
+
+(*
+   rand - return a random integer.
+*)
+
+@findex rand
+PROCEDURE rand () : INTEGER ;
+
+
+(*
+   time - returns a pointer to the time_t value. If, a,
+          is not NIL then the libc value is copied into
+          memory at address, a.
+*)
+
+@findex time
+PROCEDURE time (a: ADDRESS) : time_t ;
+
+
+(*
+   localtime - returns a pointer to the libc copy of the tm
+               structure.
+*)
+
+@findex localtime
+PROCEDURE localtime (VAR t: time_t) : ADDRESS ;
+
+
+(*
+   ftime - return date and time.
+*)
+
+@findex ftime
+PROCEDURE ftime (VAR t: timeb) : [ INTEGER ] ;
+
+
+(*
+   shutdown - shutdown a socket, s.
+              if how = 0, then no more reads are allowed.
+              if how = 1, then no more writes are allowed.
+              if how = 2, then mo more reads or writes are allowed.
+*)
+
+@findex shutdown
+PROCEDURE shutdown (s: INTEGER; how: INTEGER) : [ INTEGER ] ;
+
+
+(*
+   rename - change the name or location of a file
+*)
+
+@findex rename
+PROCEDURE rename (oldpath, newpath: ADDRESS) : [ INTEGER ] ;
+
+
+(*
+   setjmp - returns 0 if returning directly, and non-zero
+            when returning from longjmp using the saved
+            context.
+*)
+
+@findex setjmp
+PROCEDURE setjmp (env: ADDRESS) : INTEGER ;
+
+
+(*
+   longjmp - restores the environment saved by the last call
+             of setjmp with the corresponding env argument.
+             After longjmp is completed, program execution
+             continues as if the corresponding call of setjmp
+             had just returned the value val.  The value of
+             val must not be zero.
+*)
+
+@findex longjmp
+PROCEDURE longjmp (env: ADDRESS; val: INTEGER) ;
+
+
+(*
+   atexit - execute, proc, when the function exit is called.
+*)
+
+@findex atexit
+PROCEDURE atexit (proc: exitP) : [ INTEGER ] ;
+
+
+(*
+   ttyname - returns a pointer to a string determining the ttyname.
+*)
+
+@findex ttyname
+PROCEDURE ttyname (filedes: INTEGER) : ADDRESS ;
+
+
+(*
+   sleep - calling thread sleeps for seconds.
+*)
+
+@findex sleep
+PROCEDURE sleep (seconds: CARDINAL) : [ CARDINAL ] ;
+
+
+(*
+   execv - execute a file.
+*)
+
+@findex execv
+PROCEDURE execv (pathname: ADDRESS; argv: ADDRESS) : [ INTEGER ] ;
+
+
+END libc.
+@end example
+@page
+
+@node gm2-libs/libm, gm2-libs/sckt, gm2-libs/libc, Base libraries
+@subsection gm2-libs/libm
+
+@example
+DEFINITION MODULE FOR "C" libm ;
+
+(* Users are strongly advised to use MathLib0 or RealMath as calls
+   to functions within these modules will generate inline code.
+   This module is used by MathLib0 and RealMath when inline code cannot
+   be generated.  *)
+
+EXPORT UNQUALIFIED sin, sinl, sinf,
+                   cos, cosl, cosf,
+                   tan, tanl, tanf,
+                   sqrt, sqrtl, sqrtf,
+                   asin, asinl, asinf,
+                   acos, acosl, acosf,
+                   atan, atanl, atanf,
+                   atan2, atan2l, atan2f,
+                   exp, expl, expf,
+                   log, logl, logf,
+                   exp10, exp10l, exp10f,
+                   pow, powl, powf,
+                   floor, floorl, floorf,
+                   ceil, ceill, ceilf ;
+
+@findex sin
+PROCEDURE sin (x: REAL) : REAL ;
+@findex sinl
+PROCEDURE sinl (x: LONGREAL) : LONGREAL ;
+@findex sinf
+PROCEDURE sinf (x: SHORTREAL) : SHORTREAL ;
+@findex cos
+PROCEDURE cos (x: REAL) : REAL ;
+@findex cosl
+PROCEDURE cosl (x: LONGREAL) : LONGREAL ;
+@findex cosf
+PROCEDURE cosf (x: SHORTREAL) : SHORTREAL ;
+@findex tan
+PROCEDURE tan (x: REAL) : REAL ;
+@findex tanl
+PROCEDURE tanl (x: LONGREAL) : LONGREAL ;
+@findex tanf
+PROCEDURE tanf (x: SHORTREAL) : SHORTREAL ;
+@findex sqrt
+PROCEDURE sqrt (x: REAL) : REAL ;
+@findex sqrtl
+PROCEDURE sqrtl (x: LONGREAL) : LONGREAL ;
+@findex sqrtf
+PROCEDURE sqrtf (x: SHORTREAL) : SHORTREAL ;
+@findex asin
+PROCEDURE asin (x: REAL) : REAL ;
+@findex asinl
+PROCEDURE asinl (x: LONGREAL) : LONGREAL ;
+@findex asinf
+PROCEDURE asinf (x: SHORTREAL) : SHORTREAL ;
+@findex acos
+PROCEDURE acos (x: REAL) : REAL ;
+@findex acosl
+PROCEDURE acosl (x: LONGREAL) : LONGREAL ;
+@findex acosf
+PROCEDURE acosf (x: SHORTREAL) : SHORTREAL ;
+@findex atan
+PROCEDURE atan (x: REAL) : REAL ;
+@findex atanl
+PROCEDURE atanl (x: LONGREAL) : LONGREAL ;
+@findex atanf
+PROCEDURE atanf (x: SHORTREAL) : SHORTREAL ;
+@findex atan2
+PROCEDURE atan2 (x, y: REAL) : REAL ;
+@findex atan2l
+PROCEDURE atan2l (x, y: LONGREAL) : LONGREAL ;
+@findex atan2f
+PROCEDURE atan2f (x, y: SHORTREAL) : SHORTREAL ;
+@findex exp
+PROCEDURE exp (x: REAL) : REAL ;
+@findex expl
+PROCEDURE expl (x: LONGREAL) : LONGREAL ;
+@findex expf
+PROCEDURE expf (x: SHORTREAL) : SHORTREAL ;
+@findex log
+PROCEDURE log (x: REAL) : REAL ;
+@findex logl
+PROCEDURE logl (x: LONGREAL) : LONGREAL ;
+@findex logf
+PROCEDURE logf (x: SHORTREAL) : SHORTREAL ;
+@findex exp10
+PROCEDURE exp10 (x: REAL) : REAL ;
+@findex exp10l
+PROCEDURE exp10l (x: LONGREAL) : LONGREAL ;
+@findex exp10f
+PROCEDURE exp10f (x: SHORTREAL) : SHORTREAL ;
+@findex pow
+PROCEDURE pow (x, y: REAL) : REAL ;
+@findex powl
+PROCEDURE powl (x, y: LONGREAL) : LONGREAL ;
+@findex powf
+PROCEDURE powf (x, y: SHORTREAL) : SHORTREAL ;
+@findex floor
+PROCEDURE floor (x: REAL) : REAL ;
+@findex floorl
+PROCEDURE floorl (x: LONGREAL) : LONGREAL ;
+@findex floorf
+PROCEDURE floorf (x: SHORTREAL) : SHORTREAL ;
+@findex ceil
+PROCEDURE ceil (x: REAL) : REAL ;
+@findex ceill
+PROCEDURE ceill (x: LONGREAL) : LONGREAL ;
+@findex ceilf
+PROCEDURE ceilf (x: SHORTREAL) : SHORTREAL ;
+
+END libm.
+@end example
+@page
+
+@node gm2-libs/sckt, gm2-libs/termios, gm2-libs/libm, Base libraries
+@subsection gm2-libs/sckt
+
+@example
+DEFINITION MODULE sckt ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT UNQUALIFIED tcpServerState,
+                   tcpServerEstablish, tcpServerEstablishPort,
+                   tcpServerAccept, getLocalIP,
+                   tcpServerPortNo, tcpServerIP, tcpServerSocketFd,
+                   tcpServerClientIP, tcpServerClientPortNo,
+                   tcpClientState,
+                   tcpClientSocket, tcpClientSocketIP, tcpClientConnect,
+                   tcpClientPortNo, tcpClientIP, tcpClientSocketFd ;
+
+TYPE
+@findex tcpServerState (type)
+   tcpServerState = ADDRESS ;
+@findex tcpClientState (type)
+   tcpClientState = ADDRESS ;
+
+
+(*
+   tcpServerEstablish - returns a tcpState containing the relevant
+                        information about a socket declared to receive
+                        tcp connections.
+*)
+
+@findex tcpServerEstablish
+PROCEDURE tcpServerEstablish () : tcpServerState ;
+
+
+(*
+   tcpServerEstablishPort - returns a tcpState containing the relevant
+                            information about a socket declared to receive
+                            tcp connections.  This method attempts to use
+                            the port specified by the parameter.
+*)
+
+@findex tcpServerEstablishPort
+PROCEDURE tcpServerEstablishPort (port: CARDINAL) : tcpServerState ;
+
+
+(*
+   tcpServerAccept - returns a file descriptor once a client has connected and
+                     been accepted.
+*)
+
+@findex tcpServerAccept
+PROCEDURE tcpServerAccept (s: tcpServerState) : INTEGER ;
+
+
+(*
+   tcpServerPortNo - returns the portNo from structure, s.
+*)
+
+@findex tcpServerPortNo
+PROCEDURE tcpServerPortNo (s: tcpServerState) : CARDINAL ;
+
+
+(*
+   tcpSocketFd - returns the sockFd from structure, s.
+*)
+
+@findex tcpServerSocketFd
+PROCEDURE tcpServerSocketFd (s: tcpServerState) : INTEGER ;
+
+
+(*
+   getLocalIP - returns the IP address of this machine.
+*)
+
+@findex getLocalIP
+PROCEDURE getLocalIP (s: tcpServerState) : CARDINAL ;
+
+
+(*
+   tcpServerIP - returns the IP address from structure, s.
+*)
+
+@findex tcpServerIP
+PROCEDURE tcpServerIP (s: tcpServerState) : CARDINAL ;
+
+
+(*
+   tcpServerClientIP - returns the IP address of the client who
+                       has connected to server, s.
+*)
+
+@findex tcpServerClientIP
+PROCEDURE tcpServerClientIP (s: tcpServerState) : CARDINAL ;
+
+
+(*
+   tcpServerClientPortNo - returns the port number of the client who
+                           has connected to server, s.
+*)
+
+@findex tcpServerClientPortNo
+PROCEDURE tcpServerClientPortNo (s: tcpServerState) : CARDINAL ;
+
+
+(*
+   tcpClientSocket - returns a file descriptor (socket) which has
+                     connected to, serverName:portNo.
+*)
+
+@findex tcpClientSocket
+PROCEDURE tcpClientSocket (serverName: ADDRESS; portNo: CARDINAL) : tcpClientState ;
+
+
+(*
+   tcpClientSocketIP - returns a file descriptor (socket) which has
+                       connected to, ip:portNo.
+*)
+
+@findex tcpClientSocketIP
+PROCEDURE tcpClientSocketIP (ip: CARDINAL; portNo: CARDINAL) : tcpClientState ;
+
+
+(*
+   tcpClientConnect - returns the file descriptor associated with, s,
+                      once a connect has been performed.
+*)
+
+@findex tcpClientConnect
+PROCEDURE tcpClientConnect (s: tcpClientState) : INTEGER ;
+
+
+(*
+   tcpClientPortNo - returns the portNo from structure, s.
+*)
+
+@findex tcpClientPortNo
+PROCEDURE tcpClientPortNo (s: tcpClientState) : INTEGER ;
+
+
+(*
+   tcpClientSocketFd - returns the sockFd from structure, s.
+*)
+
+@findex tcpClientSocketFd
+PROCEDURE tcpClientSocketFd (s: tcpClientState) : INTEGER ;
+
+
+(*
+   tcpClientIP - returns the IP address from structure, s.
+*)
+
+@findex tcpClientIP
+PROCEDURE tcpClientIP (s: tcpClientState) : CARDINAL ;
+
+
+END sckt.
+@end example
+@page
+
+@node gm2-libs/termios, gm2-libs/wrapc, gm2-libs/sckt, Base libraries
+@subsection gm2-libs/termios
+
+@example
+DEFINITION MODULE termios ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex TERMIOS (type)
+   TERMIOS = ADDRESS ;
+
+@findex ControlChar (type)
+   ControlChar = (vintr, vquit, verase, vkill, veof, vtime, vmin,
+                  vswtc, vstart, vstop, vsusp, veol, vreprint, vdiscard,
+                  vwerase, vlnext, veol2) ;
+
+@findex Flag (type)
+   Flag = (
+           (* input flag bits *)
+           ignbrk, ibrkint, ignpar, iparmrk, inpck, istrip, inlcr,
+           igncr, icrnl, iuclc, ixon, ixany, ixoff, imaxbel,
+           (* output flag bits *)
+           opost, olcuc, onlcr, ocrnl, onocr, onlret, ofill, ofdel,
+           onl0, onl1, ocr0, ocr1, ocr2, ocr3,
+           otab0, otab1, otab2, otab3, obs0, obs1, off0, off1, ovt0, ovt1,
+           (* baud rate *)
+           b0, b50, b75, b110, b135, b150, b200, b300, b600, b1200,
+           b1800, b2400, b4800, b9600, b19200, b38400,
+           b57600, b115200, b240400, b460800, b500000, b576000,
+           b921600, b1000000, b1152000, b1500000, b2000000, b2500000,
+           b3000000, b3500000, b4000000, maxbaud, crtscts,
+           (* character size *)
+           cs5, cs6, cs7, cs8, cstopb, cread, parenb, parodd, hupcl, clocal,
+           (* local flags *)
+           lisig, licanon, lxcase, lecho, lechoe, lechok, lechonl, lnoflsh,
+           ltopstop, lechoctl, lechoprt, lechoke, lflusho, lpendin, liexten) ;
+
+
+(*
+   InitTermios - new data structure.
+*)
+
+@findex InitTermios
+PROCEDURE InitTermios () : TERMIOS ;
+
+
+(*
+   KillTermios - delete data structure.
+*)
+
+@findex KillTermios
+PROCEDURE KillTermios (t: TERMIOS) : TERMIOS ;
+
+
+(*
+   cfgetospeed - return output baud rate.
+*)
+
+@findex cfgetospeed
+PROCEDURE cfgetospeed (t: TERMIOS) : INTEGER ;
+
+
+(*
+   cfgetispeed - return input baud rate.
+*)
+
+@findex cfgetispeed
+PROCEDURE cfgetispeed (t: TERMIOS) : INTEGER ;
+
+
+(*
+   cfsetospeed - set output baud rate.
+*)
+
+@findex cfsetospeed
+PROCEDURE cfsetospeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
+
+
+(*
+   cfsetispeed - set input baud rate.
+*)
+
+@findex cfsetispeed
+PROCEDURE cfsetispeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
+
+
+(*
+   cfsetspeed - set input and output baud rate.
+*)
+
+@findex cfsetspeed
+PROCEDURE cfsetspeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
+
+
+(*
+   tcgetattr - get state of, fd, into, t.
+*)
+
+@findex tcgetattr
+PROCEDURE tcgetattr (fd: INTEGER; t: TERMIOS) : INTEGER ;
+
+
+(*
+   The following three functions return the different option values.
+*)
+
+@findex tcsnow
+PROCEDURE tcsnow () : INTEGER ;   (* alter fd now *)
+@findex tcsdrain
+PROCEDURE tcsdrain () : INTEGER ; (* alter when all output has been sent *)
+@findex tcsflush
+PROCEDURE tcsflush () : INTEGER ; (* like drain, except discard any pending input *)
+
+
+(*
+   tcsetattr - set state of, fd, to, t, using option.
+*)
+
+@findex tcsetattr
+PROCEDURE tcsetattr (fd: INTEGER; option: INTEGER; t: TERMIOS) : INTEGER ;
+
+
+(*
+   cfmakeraw - sets, t, to raw mode.
+*)
+
+@findex cfmakeraw
+PROCEDURE cfmakeraw (t: TERMIOS) ;
+
+
+(*
+   tcsendbreak - send zero bits for duration.
+*)
+
+@findex tcsendbreak
+PROCEDURE tcsendbreak (fd: INTEGER; duration: INTEGER) : INTEGER ;
+
+
+(*
+   tcdrain - waits for pending output to be written on, fd.
+*)
+
+@findex tcdrain
+PROCEDURE tcdrain (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflushi - flush input.
+*)
+
+@findex tcflushi
+PROCEDURE tcflushi (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflusho - flush output.
+*)
+
+@findex tcflusho
+PROCEDURE tcflusho (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflushio - flush input and output.
+*)
+
+@findex tcflushio
+PROCEDURE tcflushio (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflowoni - restart input on, fd.
+*)
+
+@findex tcflowoni
+PROCEDURE tcflowoni (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflowoffi - stop input on, fd.
+*)
+
+@findex tcflowoffi
+PROCEDURE tcflowoffi (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflowono - restart output on, fd.
+*)
+
+@findex tcflowono
+PROCEDURE tcflowono (fd: INTEGER) : INTEGER ;
+
+
+(*
+   tcflowoffo - stop output on, fd.
+*)
+
+@findex tcflowoffo
+PROCEDURE tcflowoffo (fd: INTEGER) : INTEGER ;
+
+
+(*
+   GetFlag - sets a flag value from, t, in, b, and returns TRUE
+             if, t, supports, f.
+*)
+
+@findex GetFlag
+PROCEDURE GetFlag (t: TERMIOS; f: Flag; VAR b: BOOLEAN) : BOOLEAN ;
+
+
+(*
+   SetFlag - sets a flag value in, t, to, b, and returns TRUE if
+             this flag value is supported.
+*)
+
+@findex SetFlag
+PROCEDURE SetFlag (t: TERMIOS; f: Flag; b: BOOLEAN) : BOOLEAN ;
+
+
+(*
+   GetChar - sets a CHAR, ch, value from, t, and returns TRUE if
+             this value is supported.
+*)
+
+@findex GetChar
+PROCEDURE GetChar (t: TERMIOS; c: ControlChar; VAR ch: CHAR) : BOOLEAN ;
+
+
+(*
+   SetChar - sets a CHAR value in, t, and returns TRUE if, c,
+             is supported.
+*)
+
+@findex SetChar
+PROCEDURE SetChar (t: TERMIOS; c: ControlChar; ch: CHAR) : BOOLEAN ;
+
+
+END termios.
+@end example
+@page
+
+@node gm2-libs/wrapc, , gm2-libs/termios, Base libraries
+@subsection gm2-libs/wrapc
+
+@example
+DEFINITION MODULE wrapc ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT QUALIFIED strtime, filesize, fileinode,
+                 getrand, getusername, filemtime,
+                 getnameuidgid, signbit, signbitf, signbitl,
+		 isfinite, isfinitel, isfinitef ;
+
+
+(*
+   strtime - returns the C string for the equivalent C asctime
+             function.
+*)
+
+@findex strtime
+PROCEDURE strtime () : ADDRESS ;
+
+
+(*
+   filesize - assigns the size of a file, f, into low, high and
+              returns zero if successful.
+*)
+
+@findex filesize
+PROCEDURE filesize (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ;
+
+
+(*
+   fileinode - return the inode associated with file, f.
+*)
+
+@findex fileinode
+PROCEDURE fileinode (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ;
+
+
+(*
+   filemtime - returns the mtime of a file, f.
+*)
+
+@findex filemtime
+PROCEDURE filemtime (f: INTEGER) : INTEGER ;
+
+
+(*
+   getrand - returns a random number between 0..n-1
+*)
+
+@findex getrand
+PROCEDURE getrand (n: INTEGER) : INTEGER ;
+
+
+(*
+   getusername - returns a C string describing the current user.
+*)
+
+@findex getusername
+PROCEDURE getusername () : ADDRESS ;
+
+
+(*
+   getnameuidgid - fills in the, uid, and, gid, which represents
+                   user, name.
+*)
+
+@findex getnameuidgid
+PROCEDURE getnameuidgid (name: ADDRESS; VAR uid, gid: INTEGER) ;
+
+
+(*
+   in C these procedure functions are really macros, so we provide
+   real C functions and let gm2 call these if the builtins
+   are unavailable.
+*)
+
+@findex signbit
+PROCEDURE signbit (r: REAL) : INTEGER ;
+@findex signbitf
+PROCEDURE signbitf (s: SHORTREAL) : INTEGER ;
+@findex signbitl
+PROCEDURE signbitl (l: LONGREAL) : INTEGER ;
+
+
+(*
+   isfinite - provide non builtin alternative to the gcc builtin isfinite.
+              Returns 1 if x is finite and 0 if it is not.
+*)
+
+@findex isfinite
+PROCEDURE isfinite (x: REAL) : INTEGER ;
+
+
+(*
+   isfinitef - provide non builtin alternative to the gcc builtin isfinite.
+               Returns 1 if x is finite and 0 if it is not.
+*)
+
+@findex isfinitef
+PROCEDURE isfinitef (x: SHORTREAL) : INTEGER ;
+
+
+(*
+   isfinitel - provide non builtin alternative to the gcc builtin isfinite.
+               Returns 1 if x is finite and 0 if it is not.
+*)
+
+@findex isfinitel
+PROCEDURE isfinitel (x: LONGREAL) : INTEGER ;
+
+
+END wrapc.
+@end example
+@page
+
+
+@c ------------------------------------------------------------
+@node PIM and Logitech 3.0 Compatible, PIM coroutine support, Base libraries, Libraries
+@section PIM and Logitech 3.0 Compatible
+
+@c README.texi describes the additional PIM libraries.
+@c Copyright @copyright{} 2000-2020 Free Software Foundation, Inc.
+@c
+@c This is part of the GM2 manual.
+@c For copying conditions, see the file gcc/doc/include/fdl.texi.
+
+These modules are provided to enable legacy Modula-2 applications to
+build with GNU Modula-2. It is advised that these module should not
+be used for new projects, maybe the ISO libraries or the native
+compiler PIM libraries (FIO) should be used instead.
+
+Here is an outline of the module layering:
+
+@example
+
+InOut  RealInOut  LongIO CardinalIO
+    \     |       |      /
+           Terminal
+-----------------------------------
+              |
+           Termbase
+           /      \
+    Keyboard      Display
+
+@end example
+
+Above the line are user level PIM [234] and Logitech 3.0 compatible
+modules.  Below the line Logitech 3.0 advised that these modules
+should be considered part of the runtime system. The libraries do
+not provide all the features found in the Logitech libraries as
+a number of these features were MS-DOS related. Essentially the
+basic input/output, file system, string manipulation and conversion
+routines are provided. Access to DOSCALL, graphics, time and date
+are not as these were constrained by the limitations of MS-DOS.
+
+The following libraries are contained within the base GNU Modula-2
+libraries and are also Logitech-3.0 compatible: @xref{gm2-libs/ASCII},
+@xref{gm2-libs/Storage} and @xref{gm2-libs/MathLib0}.  These libraries
+are always available for any dialect of the language (although their
+implementation and behaviour might differ, for example Storage ISO and
+PIM).
+
+The following libraries are Logitech-3.0 compatible but fall outside
+the base GNU Modula-2 libraries.
+@menu
+* gm2-libs-pim/BitBlockOps::BitBlockOps.def
+* gm2-libs-pim/BitByteOps::BitByteOps.def
+* gm2-libs-pim/BitWordOps::BitWordOps.def
+* gm2-libs-pim/BlockOps::BlockOps.def
+* gm2-libs-pim/Break::Break.def
+* gm2-libs-pim/CardinalIO::CardinalIO.def
+* gm2-libs-pim/Conversions::Conversions.def
+* gm2-libs-pim/DebugPMD::DebugPMD.def
+* gm2-libs-pim/DebugTrace::DebugTrace.def
+* gm2-libs-pim/Delay::Delay.def
+* gm2-libs-pim/Display::Display.def
+* gm2-libs-pim/ErrorCode::ErrorCode.def
+* gm2-libs-pim/FileSystem::FileSystem.def
+* gm2-libs-pim/FloatingUtilities::FloatingUtilities.def
+* gm2-libs-pim/InOut::InOut.def
+* gm2-libs-pim/Keyboard::Keyboard.def
+* gm2-libs-pim/LongIO::LongIO.def
+* gm2-libs-pim/NumberConversion::NumberConversion.def
+* gm2-libs-pim/Random::Random.def
+* gm2-libs-pim/RealConversions::RealConversions.def
+* gm2-libs-pim/RealInOut::RealInOut.def
+* gm2-libs-pim/Strings::Strings.def
+* gm2-libs-pim/Termbase::Termbase.def
+* gm2-libs-pim/Terminal::Terminal.def
+* gm2-libs-pim/TimeDate::TimeDate.def
+@end menu
+
+@node gm2-libs-pim/BitBlockOps, gm2-libs-pim/BitByteOps, , PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/BitBlockOps
+
+@example
+DEFINITION MODULE BitBlockOps ;
+
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+(*
+   BlockAnd - performs a bitwise AND on blocks
+              [dest..dest+size-1] := [dest..dest+size-1] AND
+                                     [src..src+size-1]
+*)
+
+@findex BlockAnd
+PROCEDURE BlockAnd (dest, src: ADDRESS; size: CARDINAL) ;
+
+
+(*
+   BlockOr - performs a bitwise OR on blocks
+             [dest..dest+size-1] := [dest..dest+size-1] OR
+                                    [src..src+size-1]
+*)
+
+@findex BlockOr
+PROCEDURE BlockOr (dest, src: ADDRESS; size: CARDINAL) ;
+
+
+(*
+   BlockXor - performs a bitwise XOR on blocks
+              [dest..dest+size-1] := [dest..dest+size-1] XOR
+                                     [src..src+size-1]
+*)
+
+@findex BlockXor
+PROCEDURE BlockXor (dest, src: ADDRESS; size: CARDINAL) ;
+
+
+(*
+   BlockNot - performs a bitsize NOT on the block as defined
+              by:  [dest..dest+size-1]
+*)
+
+@findex BlockNot
+PROCEDURE BlockNot (dest: ADDRESS; size: CARDINAL) ;
+
+
+(*
+   BlockShr - performs a block shift right of, count, bits.
+              Where the block is defined as:
+              [dest..dest+size-1].
+              The block is considered to be an ARRAY OF BYTEs
+              which is shifted, bit at a time over each byte in
+              turn.  The left most byte is considered the byte
+              located at the lowest address.
+              If you require an endianness SHIFT use
+              the SYSTEM.SHIFT procedure and declare the
+              block as a POINTER TO set type.
+*)
+
+@findex BlockShr
+PROCEDURE BlockShr (dest: ADDRESS; size, count: CARDINAL) ;
+
+
+(*
+   BlockShl - performs a block shift left of, count, bits.
+              Where the block is defined as:
+              [dest..dest+size-1].
+              The block is considered to be an ARRAY OF BYTEs
+              which is shifted, bit at a time over each byte in
+              turn.  The left most byte is considered the byte
+              located at the lowest address.
+              If you require an endianness SHIFT use
+              the SYSTEM.SHIFT procedure and declare the
+              block as a POINTER TO set type.
+*)
+
+@findex BlockShl
+PROCEDURE BlockShl (dest: ADDRESS; size, count: CARDINAL) ;
+
+
+(*
+   BlockRor - performs a block rotate right of, count, bits.
+              Where the block is defined as:
+              [dest..dest+size-1].
+              The block is considered to be an ARRAY OF BYTEs
+              which is rotated, bit at a time over each byte in
+              turn.  The left most byte is considered the byte
+              located at the lowest address.
+              If you require an endianness ROTATE use
+              the SYSTEM.ROTATE procedure and declare the
+              block as a POINTER TO set type.
+*)
+
+@findex BlockRor
+PROCEDURE BlockRor (dest: ADDRESS; size, count: CARDINAL) ;
+
+
+(*
+   BlockRol - performs a block rotate left of, count, bits.
+              Where the block is defined as:
+              [dest..dest+size-1].
+              The block is considered to be an ARRAY OF BYTEs
+              which is rotated, bit at a time over each byte in
+              turn.  The left most byte is considered the byte
+              located at the lowest address.
+              If you require an endianness ROTATE use
+              the SYSTEM.ROTATE procedure and declare the
+              block as a POINTER TO set type.
+*)
+
+@findex BlockRol
+PROCEDURE BlockRol (dest: ADDRESS; size, count: CARDINAL) ;
+
+
+END BitBlockOps.
+@end example
+@page
+
+@node gm2-libs-pim/BitByteOps, gm2-libs-pim/BitWordOps, gm2-libs-pim/BitBlockOps, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/BitByteOps
+
+@example
+DEFINITION MODULE BitByteOps ;
+
+FROM SYSTEM IMPORT BYTE ;
+
+
+(*
+   GetBits - returns the bits firstBit..lastBit from source.
+             Bit 0 of byte maps onto the firstBit of source.
+*)
+
+@findex GetBits
+PROCEDURE GetBits (source: BYTE; firstBit, lastBit: CARDINAL) : BYTE ;
+
+
+(*
+   SetBits - sets bits in, byte, starting at, firstBit, and ending at,
+             lastBit, with, pattern.  The bit zero of, pattern, will
+             be placed into, byte, at position, firstBit.
+*)
+
+@findex SetBits
+PROCEDURE SetBits (VAR byte: BYTE; firstBit, lastBit: CARDINAL;
+                   pattern: BYTE) ;
+
+
+(*
+   ByteAnd - returns a bitwise (left AND right)
+*)
+
+@findex ByteAnd
+PROCEDURE ByteAnd (left, right: BYTE) : BYTE ;
+
+
+(*
+   ByteOr - returns a bitwise (left OR right)
+*)
+
+@findex ByteOr
+PROCEDURE ByteOr (left, right: BYTE) : BYTE ;
+
+
+(*
+   ByteXor - returns a bitwise (left XOR right)
+*)
+
+@findex ByteXor
+PROCEDURE ByteXor (left, right: BYTE) : BYTE ;
+
+
+(*
+   ByteNot - returns a byte with all bits inverted.
+*)
+
+@findex ByteNot
+PROCEDURE ByteNot (byte: BYTE) : BYTE ;
+
+
+(*
+   ByteShr - returns a, byte, which has been shifted, count
+             bits to the right.
+*)
+
+@findex ByteShr
+PROCEDURE ByteShr (byte: BYTE; count: CARDINAL) : BYTE ;
+
+
+(*
+   ByteShl - returns a, byte, which has been shifted, count
+             bits to the left.
+*)
+
+@findex ByteShl
+PROCEDURE ByteShl (byte: BYTE; count: CARDINAL) : BYTE ;
+
+
+(*
+   ByteSar - shift byte arthemetic right.  Preserves the top
+             end bit and as the value is shifted right.
+*)
+
+@findex ByteSar
+PROCEDURE ByteSar (byte: BYTE; count: CARDINAL) : BYTE ;
+
+
+(*
+   ByteRor - returns a, byte, which has been rotated, count
+             bits to the right.
+*)
+
+@findex ByteRor
+PROCEDURE ByteRor (byte: BYTE; count: CARDINAL) : BYTE ;
+
+
+(*
+   ByteRol - returns a, byte, which has been rotated, count
+             bits to the left.
+*)
+
+@findex ByteRol
+PROCEDURE ByteRol (byte: BYTE; count: CARDINAL) : BYTE ;
+
+
+(*
+   HighNibble - returns the top nibble only from, byte.
+                The top nibble of, byte, is extracted and
+                returned in the bottom nibble of the return
+                value.
+*)
+
+@findex HighNibble
+PROCEDURE HighNibble (byte: BYTE) : BYTE ;
+
+
+(*
+   LowNibble - returns the low nibble only from, byte.
+               The top nibble is replaced by zeros.
+*)
+
+@findex LowNibble
+PROCEDURE LowNibble (byte: BYTE) : BYTE ;
+
+
+(*
+   Swap - swaps the low and high nibbles in the, byte.
+*)
+
+@findex Swap
+PROCEDURE Swap (byte: BYTE) : BYTE ;
+
+
+END BitByteOps.
+@end example
+@page
+
+@node gm2-libs-pim/BitWordOps, gm2-libs-pim/BlockOps, gm2-libs-pim/BitByteOps, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/BitWordOps
+
+@example
+DEFINITION MODULE BitWordOps ;
+
+FROM SYSTEM IMPORT WORD ;
+
+
+(*
+   GetBits - returns the bits firstBit..lastBit from source.
+             Bit 0 of word maps onto the firstBit of source.
+*)
+
+@findex GetBits
+PROCEDURE GetBits (source: WORD; firstBit, lastBit: CARDINAL) : WORD ;
+
+
+(*
+   SetBits - sets bits in, word, starting at, firstBit, and ending at,
+             lastBit, with, pattern.  The bit zero of, pattern, will
+             be placed into, word, at position, firstBit.
+*)
+
+@findex SetBits
+PROCEDURE SetBits (VAR word: WORD; firstBit, lastBit: CARDINAL;
+                   pattern: WORD) ;
+
+
+(*
+   WordAnd - returns a bitwise (left AND right)
+*)
+
+@findex WordAnd
+PROCEDURE WordAnd (left, right: WORD) : WORD ;
+
+
+(*
+   WordOr - returns a bitwise (left OR right)
+*)
+
+@findex WordOr
+PROCEDURE WordOr (left, right: WORD) : WORD ;
+
+
+(*
+   WordXor - returns a bitwise (left XOR right)
+*)
+
+@findex WordXor
+PROCEDURE WordXor (left, right: WORD) : WORD ;
+
+
+(*
+   WordNot - returns a word with all bits inverted.
+*)
+
+@findex WordNot
+PROCEDURE WordNot (word: WORD) : WORD ;
+
+
+(*
+   WordShr - returns a, word, which has been shifted, count
+             bits to the right.
+*)
+
+@findex WordShr
+PROCEDURE WordShr (word: WORD; count: CARDINAL) : WORD ;
+
+
+(*
+   WordShl - returns a, word, which has been shifted, count
+             bits to the left.
+*)
+
+@findex WordShl
+PROCEDURE WordShl (word: WORD; count: CARDINAL) : WORD ;
+
+
+(*
+   WordSar - shift word arthemetic right.  Preserves the top
+             end bit and as the value is shifted right.
+*)
+
+@findex WordSar
+PROCEDURE WordSar (word: WORD; count: CARDINAL) : WORD ;
+
+
+(*
+   WordRor - returns a, word, which has been rotated, count
+             bits to the right.
+*)
+
+@findex WordRor
+PROCEDURE WordRor (word: WORD; count: CARDINAL) : WORD ;
+
+
+(*
+   WordRol - returns a, word, which has been rotated, count
+             bits to the left.
+*)
+
+@findex WordRol
+PROCEDURE WordRol (word: WORD; count: CARDINAL) : WORD ;
+
+
+(*
+   HighByte - returns the top byte only from, word.
+              The byte is returned in the bottom byte
+              in the return value.
+*)
+
+@findex HighByte
+PROCEDURE HighByte (word: WORD) : WORD ;
+
+
+(*
+   LowByte - returns the low byte only from, word.
+             The byte is returned in the bottom byte
+             in the return value.
+*)
+
+@findex LowByte
+PROCEDURE LowByte (word: WORD) : WORD ;
+
+
+(*
+   Swap - byte flips the contents of word.
+*)
+
+@findex Swap
+PROCEDURE Swap (word: WORD) : WORD ;
+
+
+END BitWordOps.
+@end example
+@page
+
+@node gm2-libs-pim/BlockOps, gm2-libs-pim/Break, gm2-libs-pim/BitWordOps, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/BlockOps
+
+@example
+DEFINITION MODULE BlockOps ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+(*
+   MoveBlockForward - moves, n, bytes from, src, to, dest.
+                      Starts copying from src and keep copying
+                      until, n, bytes have been copied.
+*)
+
+@findex BlockMoveForward
+PROCEDURE BlockMoveForward (dest, src: ADDRESS; n: CARDINAL) ;
+
+
+(*
+   MoveBlockBackward - moves, n, bytes from, src, to, dest.
+                       Starts copying from src+n and keeps copying
+                       until, n, bytes have been copied.
+                       The last datum to be copied will be the byte
+                       at address, src.
+*)
+
+@findex BlockMoveBackward
+PROCEDURE BlockMoveBackward (dest, src: ADDRESS; n: CARDINAL) ;
+
+
+(*
+   BlockClear - fills, block..block+n-1, with zero's.
+*)
+
+@findex BlockClear
+PROCEDURE BlockClear (block: ADDRESS; n: CARDINAL) ;
+
+
+(*
+   BlockSet - fills, n, bytes starting at, block, with a pattern
+              defined at address pattern..pattern+patternSize-1.
+*)
+
+@findex BlockSet
+PROCEDURE BlockSet (block: ADDRESS; n: CARDINAL;
+                    pattern: ADDRESS; patternSize: CARDINAL) ;
+
+
+(*
+   BlockEqual - returns TRUE if the blocks defined, a..a+n-1, and,
+                b..b+n-1 contain the same bytes.
+*)
+
+@findex BlockEqual
+PROCEDURE BlockEqual (a, b: ADDRESS; n: CARDINAL) : BOOLEAN ;
+
+
+(*
+   BlockPosition - searches for a pattern as defined by
+                   pattern..patternSize-1 in the block,
+                   block..block+blockSize-1.  It returns
+                   the offset from block indicating the
+                   first occurence of, pattern.
+                   MAX(CARDINAL) is returned if no match
+                   is detected.
+*)
+
+@findex BlockPosition
+PROCEDURE BlockPosition (block: ADDRESS; blockSize: CARDINAL;
+                         pattern: ADDRESS; patternSize: CARDINAL) : CARDINAL ;
+
+
+END BlockOps.
+@end example
+@page
+
+@node gm2-libs-pim/Break, gm2-libs-pim/CardinalIO, gm2-libs-pim/BlockOps, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Break
+
+@example
+DEFINITION MODULE Break ;
+
+
+EXPORT QUALIFIED EnableBreak, DisableBreak, InstallBreak, UnInstallBreak ;
+
+
+(*
+   EnableBreak - enable the current break handler.
+*)
+
+@findex EnableBreak
+PROCEDURE EnableBreak ;
+
+
+(*
+   DisableBreak - disable the current break handler (and all
+                  installed handlers).
+*)
+
+@findex DisableBreak
+PROCEDURE DisableBreak ;
+
+
+(*
+   InstallBreak - installs a procedure, p, to be invoked when
+                  a ctrl-c is caught. Any number of these
+                  procedures may be stacked. Only the top
+                  procedure is run when ctrl-c is caught.
+*)
+
+@findex InstallBreak
+PROCEDURE InstallBreak (p: PROC) ;
+
+
+(*
+   UnInstallBreak - pops the break handler stack.
+*)
+
+@findex UnInstallBreak
+PROCEDURE UnInstallBreak ;
+
+
+END Break.
+@end example
+@page
+
+@node gm2-libs-pim/CardinalIO, gm2-libs-pim/Conversions, gm2-libs-pim/Break, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/CardinalIO
+
+@example
+DEFINITION MODULE CardinalIO ;
+
+EXPORT QUALIFIED Done,
+                 ReadCardinal, WriteCardinal, ReadHex, WriteHex,
+                 ReadLongCardinal, WriteLongCardinal, ReadLongHex,
+                 WriteLongHex,
+                 ReadShortCardinal, WriteShortCardinal, ReadShortHex,
+                 WriteShortHex ;
+
+
+VAR
+@findex Done (var)
+   Done: BOOLEAN ;
+
+
+(*
+   ReadCardinal - read an unsigned decimal number from the terminal.
+                  The read continues until a space, newline, esc or
+                  end of file is reached.
+*)
+
+@findex ReadCardinal
+PROCEDURE ReadCardinal (VAR c: CARDINAL) ;
+
+
+(*
+   WriteCardinal - writes the value, c, to the terminal and ensures
+                   that at least, n, characters are written. The number
+                   will be padded out by preceeding spaces if necessary.
+*)
+
+@findex WriteCardinal
+PROCEDURE WriteCardinal (c: CARDINAL; n: CARDINAL) ;
+
+
+(*
+   ReadHex - reads in an unsigned hexadecimal number from the terminal.
+             The read continues until a space, newline, esc or
+             end of file is reached.
+*)
+
+@findex ReadHex
+PROCEDURE ReadHex (VAR c: CARDINAL) ;
+
+
+(*
+   WriteHex - writes out a CARDINAL, c, in hexadecimal format padding
+              with, n, characters (leading with '0')
+*)
+
+@findex WriteHex
+PROCEDURE WriteHex (c: CARDINAL; n: CARDINAL) ;
+
+
+(*
+   ReadLongCardinal - read an unsigned decimal number from the terminal.
+                      The read continues until a space, newline, esc or
+                      end of file is reached.
+*)
+
+@findex ReadLongCardinal
+PROCEDURE ReadLongCardinal (VAR c: LONGCARD) ;
+
+
+(*
+   WriteLongCardinal - writes the value, c, to the terminal and ensures
+                       that at least, n, characters are written. The number
+                       will be padded out by preceeding spaces if necessary.
+*)
+
+@findex WriteLongCardinal
+PROCEDURE WriteLongCardinal (c: LONGCARD; n: CARDINAL) ;
+
+
+(*
+   ReadLongHex - reads in an unsigned hexadecimal number from the terminal.
+                 The read continues until a space, newline, esc or
+                 end of file is reached.
+*)
+
+@findex ReadLongHex
+PROCEDURE ReadLongHex (VAR c: LONGCARD) ;
+
+
+(*
+   WriteLongHex - writes out a LONGCARD, c, in hexadecimal format padding
+                  with, n, characters (leading with '0')
+*)
+
+@findex WriteLongHex
+PROCEDURE WriteLongHex (c: LONGCARD; n: CARDINAL) ;
+
+
+(*
+   WriteShortCardinal - writes the value, c, to the terminal and ensures
+                       that at least, n, characters are written. The number
+                       will be padded out by preceeding spaces if necessary.
+*)
+
+@findex WriteShortCardinal
+PROCEDURE WriteShortCardinal (c: SHORTCARD; n: CARDINAL) ;
+
+
+(*
+   ReadShortCardinal - read an unsigned decimal number from the terminal.
+                       The read continues until a space, newline, esc or
+                       end of file is reached.
+*)
+
+@findex ReadShortCardinal
+PROCEDURE ReadShortCardinal (VAR c: SHORTCARD) ;
+
+
+(*
+   ReadShortHex - reads in an unsigned hexadecimal number from the terminal.
+                 The read continues until a space, newline, esc or
+                 end of file is reached.
+*)
+
+@findex ReadShortHex
+PROCEDURE ReadShortHex (VAR c: SHORTCARD) ;
+
+
+(*
+   WriteShortHex - writes out a SHORTCARD, c, in hexadecimal format padding
+                  with, n, characters (leading with '0')
+*)
+
+@findex WriteShortHex
+PROCEDURE WriteShortHex (c: SHORTCARD; n: CARDINAL) ;
+
+
+END CardinalIO.
+@end example
+@page
+
+@node gm2-libs-pim/Conversions, gm2-libs-pim/DebugPMD, gm2-libs-pim/CardinalIO, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Conversions
+
+@example
+DEFINITION MODULE Conversions ;
+
+EXPORT QUALIFIED ConvertOctal, ConvertHex, ConvertCardinal,
+                 ConvertInteger, ConvertLongInt, ConvertShortInt ;
+
+(*
+   ConvertOctal - converts a CARDINAL, num, into an octal/hex/decimal
+                  string and right justifies the string. It adds
+                  spaces rather than '0' to pad out the string
+                  to len characters.
+
+                  If the length of str is < num then the number is
+                  truncated on the right.
+*)
+
+@findex ConvertOctal
+PROCEDURE ConvertOctal    (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+@findex ConvertHex
+PROCEDURE ConvertHex      (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+@findex ConvertCardinal
+PROCEDURE ConvertCardinal (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+
+(*
+   The INTEGER counterparts will add a '-' if, num, is <0
+*)
+
+@findex ConvertInteger
+PROCEDURE ConvertInteger  (num: INTEGER; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+@findex ConvertLongInt
+PROCEDURE ConvertLongInt  (num: LONGINT; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+@findex ConvertShortInt
+PROCEDURE ConvertShortInt (num: SHORTINT; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
+
+
+END Conversions.
+@end example
+@page
+
+@node gm2-libs-pim/DebugPMD, gm2-libs-pim/DebugTrace, gm2-libs-pim/Conversions, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/DebugPMD
+
+@example
+DEFINITION MODULE DebugPMD ;
+
+END DebugPMD.
+@end example
+@page
+
+@node gm2-libs-pim/DebugTrace, gm2-libs-pim/Delay, gm2-libs-pim/DebugPMD, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/DebugTrace
+
+@example
+DEFINITION MODULE DebugTrace ;
+
+END DebugTrace.
+@end example
+@page
+
+@node gm2-libs-pim/Delay, gm2-libs-pim/Display, gm2-libs-pim/DebugTrace, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Delay
+
+@example
+DEFINITION MODULE Delay ;
+
+EXPORT QUALIFIED Delay ;
+
+
+(*
+   milliSec - delays the program by approximately, milliSec, milliseconds.
+*)
+
+@findex Delay
+PROCEDURE Delay (milliSec: INTEGER) ;
+
+
+END Delay.
+@end example
+@page
+
+@node gm2-libs-pim/Display, gm2-libs-pim/ErrorCode, gm2-libs-pim/Delay, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Display
+
+@example
+DEFINITION MODULE Display ;
+
+EXPORT QUALIFIED Write ;
+
+
+(*
+   Write - display a character to the stdout.
+           ASCII.EOL moves to the beginning of the next line.
+           ASCII.del erases the character to the left of the cursor.
+*)
+
+@findex Write
+PROCEDURE Write (ch: CHAR) ;
+
+
+END Display.
+@end example
+@page
+
+@node gm2-libs-pim/ErrorCode, gm2-libs-pim/FileSystem, gm2-libs-pim/Display, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/ErrorCode
+
+@example
+DEFINITION MODULE ErrorCode ;
+
+EXPORT QUALIFIED SetErrorCode, GetErrorCode, ExitToOS ;
+
+
+(*
+   SetErrorCode - sets the exit value which will be used if
+                  the application terminates normally.
+*)
+
+@findex SetErrorCode
+PROCEDURE SetErrorCode (value: INTEGER) ;
+
+
+(*
+   GetErrorCode - returns the current value to be used upon
+                  application termination.
+*)
+
+@findex GetErrorCode
+PROCEDURE GetErrorCode (VAR value: INTEGER) ;
+
+
+(*
+   ExitToOS - terminate the application and exit returning
+              the last value set by SetErrorCode to the OS.
+*)
+
+@findex ExitToOS
+PROCEDURE ExitToOS ;
+
+
+END ErrorCode.
+@end example
+@page
+
+@node gm2-libs-pim/FileSystem, gm2-libs-pim/FloatingUtilities, gm2-libs-pim/ErrorCode, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/FileSystem
+
+@example
+DEFINITION MODULE FileSystem ;
+
+(*  Use this module sparingly, FIO or the ISO file modules have a
+    much cleaner interface.  *)
+
+FROM SYSTEM IMPORT WORD, BYTE, ADDRESS ;
+IMPORT FIO ;
+FROM DynamicStrings IMPORT String ;
+
+EXPORT QUALIFIED File, Response, Flag, FlagSet,
+
+                 Create, Close, Lookup, Rename, Delete,
+                 SetRead, SetWrite, SetModify, SetOpen,
+                 Doio, SetPos, GetPos, Length, Reset,
+
+                 ReadWord, ReadChar, ReadByte, ReadNBytes,
+                 WriteWord, WriteChar, WriteByte, WriteNBytes ;
+
+TYPE
+@findex File (type)
+   File = RECORD
+             res     : Response ;
+             flags   : FlagSet ;
+             eof     : BOOLEAN ;
+             lastWord: WORD ;
+             lastByte: BYTE ;
+             fio     : FIO.File ;
+             highpos,
+             lowpos  : CARDINAL ;
+             name    : String ;
+@findex END (type)
+          END ;
+
+@findex Flag (type)
+   Flag = (
+           read,        (* read access mode *)
+           write,       (* write access mode *)
+           modify,
+           truncate,    (* truncate file when closed *)
+           again,       (* reread the last character *)
+           temporary,   (* file is temporary *)
+           opened       (* file has been opened *)
+          );
+
+@findex FlagSet (type)
+   FlagSet = SET OF Flag;
+
+@findex Response (type)
+   Response = (done, notdone, notsupported, callerror,
+               unknownfile, paramerror, toomanyfiles,
+@findex userdeverror) (type)
+               userdeverror) ;
+
+@findex Command (type)
+   Command = (create, close, lookup, rename, delete,
+              setread, setwrite, setmodify, setopen,
+              doio, setpos, getpos, length) ;
+
+
+(*
+   Create - creates a temporary file. To make the file perminant
+            the file must be renamed.
+*)
+
+@findex Create
+PROCEDURE Create (VAR f: File) ;
+
+
+(*
+   Close - closes an open file.
+*)
+
+@findex Close
+PROCEDURE Close (f: File) ;
+
+
+(*
+   Lookup - looks for a file, filename. If the file is found
+            then, f, is opened. If it is not found and, newFile,
+            is TRUE then a new file is created and attached to, f.
+            If, newFile, is FALSE and no file was found then f.res
+            is set to notdone.
+*)
+
+@findex Lookup
+PROCEDURE Lookup (VAR f: File; filename: ARRAY OF CHAR; newFile: BOOLEAN) ;
+
+
+(*
+   Rename - rename a file and change a temporary file to a permanent
+            file. f.res is set appropriately.
+*)
+
+@findex Rename
+PROCEDURE Rename (VAR f: File; newname: ARRAY OF CHAR) ;
+
+
+(*
+   Delete - deletes a file, name, and sets the f.res field.
+            f.res is set appropriately.
+*)
+
+@findex Delete
+PROCEDURE Delete (name: ARRAY OF CHAR; VAR f: File) ;
+
+
+(*
+   ReadWord - reads a WORD, w, from file, f.
+              f.res is set appropriately.
+*)
+
+@findex ReadWord
+PROCEDURE ReadWord (VAR f: File; VAR w: WORD) ;
+
+
+(*
+   WriteWord - writes one word to a file, f.
+               f.res is set appropriately.
+*)
+
+@findex WriteWord
+PROCEDURE WriteWord (VAR f: File; w: WORD) ;
+
+
+(*
+   ReadChar - reads one character from a file, f.
+*)
+
+@findex ReadChar
+PROCEDURE ReadChar (VAR f: File; VAR ch: CHAR) ;
+
+
+(*
+   WriteChar - writes a character, ch, to a file, f.
+               f.res is set appropriately.
+*)
+
+@findex WriteChar
+PROCEDURE WriteChar (VAR f: File; ch: CHAR) ;
+
+
+(*
+   ReadByte - reads a BYTE, b, from file, f.
+              f.res is set appropriately.
+*)
+
+@findex ReadByte
+PROCEDURE ReadByte (VAR f: File; VAR b: BYTE) ;
+
+
+(*
+   WriteByte - writes one BYTE, b, to a file, f.
+               f.res is set appropriately.
+*)
+
+@findex WriteByte
+PROCEDURE WriteByte (VAR f: File; b: BYTE) ;
+
+
+(*
+   ReadNBytes - reads a sequence of bytes from a file, f.
+*)
+
+@findex ReadNBytes
+PROCEDURE ReadNBytes (VAR f: File; a: ADDRESS; amount: CARDINAL;
+                      VAR actuallyRead: CARDINAL) ;
+
+
+(*
+   WriteNBytes - writes a sequence of bytes to file, f.
+*)
+
+@findex WriteNBytes
+PROCEDURE WriteNBytes (VAR f: File; a: ADDRESS; amount: CARDINAL;
+                       VAR actuallyWritten: CARDINAL) ;
+
+
+(*
+   Again - returns the last character read to the internal buffer
+           so that it can be read again.
+*)
+
+@findex Again
+PROCEDURE Again (VAR f: File) ;
+
+
+(*
+   SetRead - puts the file, f, into the read state.
+             The file position is unchanged.
+*)
+
+@findex SetRead
+PROCEDURE SetRead (VAR f: File) ;
+
+
+(*
+   SetWrite - puts the file, f, into the write state.
+              The file position is unchanged.
+*)
+
+@findex SetWrite
+PROCEDURE SetWrite (VAR f: File) ;
+
+
+(*
+   SetModify - puts the file, f, into the modify state.
+               The file position is unchanged but the file can be
+               read and written.
+*)
+
+@findex SetModify
+PROCEDURE SetModify (VAR f: File) ;
+
+
+(*
+   SetOpen - places a file, f, into the open state. The file may
+             have been in the read/write/modify state before and
+             in which case the previous buffer contents are flushed
+             and the file state is reset to open. The position is
+             unaltered.
+*)
+
+@findex SetOpen
+PROCEDURE SetOpen (VAR f: File) ;
+
+
+(*
+   Reset - places a file, f, into the open state and reset the
+           position to the start of the file.
+*)
+
+@findex Reset
+PROCEDURE Reset (VAR f: File) ;
+
+
+(*
+   SetPos - lseek to a position within a file.
+*)
+
+@findex SetPos
+PROCEDURE SetPos (VAR f: File; high, low: CARDINAL) ;
+
+
+(*
+   GetPos - return the position within a file.
+*)
+
+@findex GetPos
+PROCEDURE GetPos (VAR f: File; VAR high, low: CARDINAL) ;
+
+
+(*
+   Length - returns the length of file, in, high, and, low.
+*)
+
+@findex Length
+PROCEDURE Length (VAR f: File; VAR high, low: CARDINAL) ;
+
+
+(*
+   Doio - effectively flushes a file in write mode, rereads the
+          current buffer from disk if in read mode and writes
+          and rereads the buffer if in modify mode.
+*)
+
+@findex Doio
+PROCEDURE Doio (VAR f: File) ;
+
+
+(*
+   FileNameChar - checks to see whether the character, ch, is
+                  legal in a filename. nul is returned if the
+                  character was illegal.
+*)
+
+@findex FileNameChar
+PROCEDURE FileNameChar (ch: CHAR) ;
+
+
+END FileSystem.
+@end example
+@page
+
+@node gm2-libs-pim/FloatingUtilities, gm2-libs-pim/InOut, gm2-libs-pim/FileSystem, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/FloatingUtilities
+
+@example
+DEFINITION MODULE FloatingUtilities ;
+
+EXPORT QUALIFIED Frac, Round, Float, Trunc,
+                 Fracl, Roundl, Floatl, Truncl ;
+
+
+(*
+   Frac - returns the fractional component of, r.
+*)
+
+@findex Frac
+PROCEDURE Frac (r: REAL) : REAL ;
+
+
+(*
+   Int - returns the integer part of r. It rounds the value towards zero.
+*)
+
+@findex Int
+PROCEDURE Int (r: REAL) : INTEGER ;
+
+
+(*
+   Round - returns the number rounded to the nearest integer.
+*)
+
+@findex Round
+PROCEDURE Round (r: REAL) : INTEGER ;
+
+
+(*
+   Float - returns a REAL value corresponding to, i.
+*)
+
+@findex Float
+PROCEDURE Float (i: INTEGER) : REAL ;
+
+
+(*
+   Trunc - round to the nearest integer not larger in absolute
+           value.
+*)
+
+@findex Trunc
+PROCEDURE Trunc (r: REAL) : INTEGER ;
+
+
+(*
+   Fracl - returns the fractional component of, r.
+*)
+
+@findex Fracl
+PROCEDURE Fracl (r: LONGREAL) : LONGREAL ;
+
+
+(*
+   Intl - returns the integer part of r. It rounds the value towards zero.
+*)
+
+@findex Intl
+PROCEDURE Intl (r: LONGREAL) : LONGINT ;
+
+
+(*
+   Roundl - returns the number rounded to the nearest integer.
+*)
+
+@findex Roundl
+PROCEDURE Roundl (r: LONGREAL) : LONGINT ;
+
+
+(*
+   Floatl - returns a REAL value corresponding to, i.
+*)
+
+@findex Floatl
+PROCEDURE Floatl (i: INTEGER) : LONGREAL ;
+
+
+(*
+   Truncl - round to the nearest integer not larger in absolute
+            value.
+*)
+
+@findex Truncl
+PROCEDURE Truncl (r: LONGREAL) : LONGINT ;
+
+
+END FloatingUtilities.
+@end example
+@page
+
+@node gm2-libs-pim/InOut, gm2-libs-pim/Keyboard, gm2-libs-pim/FloatingUtilities, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/InOut
+
+@example
+DEFINITION MODULE InOut ;
+
+IMPORT ASCII ;
+FROM DynamicStrings IMPORT String ;
+EXPORT QUALIFIED EOL, Done, termCH, OpenInput, OpenOutput,
+                 CloseInput, CloseOutput,
+                 Read, ReadString, ReadInt, ReadCard,
+                 Write, WriteLn, WriteString, WriteInt, WriteCard,
+                 WriteOct, WriteHex,
+                 ReadS, WriteS ;
+
+CONST
+@findex EOL (const)
+   EOL = ASCII.EOL ;
+
+VAR
+@findex Done (var)
+   Done  : BOOLEAN ;
+@findex termCH (var)
+   termCH: CHAR ;
+
+
+(*
+   OpenInput - reads a string from stdin as the filename for reading.
+               If the filename ends with `.' then it appends the defext
+               extension. The global variable Done is set if all
+               was successful.
+*)
+
+@findex OpenInput
+PROCEDURE OpenInput (defext: ARRAY OF CHAR) ;
+
+
+(*
+   CloseInput - closes an opened input file and returns input back to
+                StdIn.
+*)
+
+@findex CloseInput
+PROCEDURE CloseInput ;
+
+
+(*
+   OpenOutput - reads a string from stdin as the filename for writing.
+                If the filename ends with `.' then it appends the defext
+                extension. The global variable Done is set if all
+                was successful.
+*)
+
+@findex OpenOutput
+PROCEDURE OpenOutput (defext: ARRAY OF CHAR) ;
+
+
+(*
+   CloseOutput - closes an opened output file and returns output back to
+                 StdOut.
+*)
+
+@findex CloseOutput
+PROCEDURE CloseOutput ;
+
+
+(*
+   Read - reads a single character from the current input file.
+          Done is set to FALSE if end of file is reached or an
+          error occurs.
+*)
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+
+
+(*
+   ReadString - reads a sequence of characters. Leading white space
+                is ignored and the string is terminated with a character
+                <= ' '
+*)
+
+@findex ReadString
+PROCEDURE ReadString (VAR s: ARRAY OF CHAR) ;
+
+
+(*
+   WriteString - writes a string to the output file.
+*)
+
+@findex WriteString
+PROCEDURE WriteString (s: ARRAY OF CHAR) ;
+
+
+(*
+   Write - writes out a single character, ch, to the current output file.
+*)
+
+@findex Write
+PROCEDURE Write (ch: CHAR) ;
+
+
+(*
+   WriteLn - writes a newline to the output file.
+*)
+
+@findex WriteLn
+PROCEDURE WriteLn ;
+
+
+(*
+   ReadInt - reads a string and converts it into an INTEGER, x.
+             Done is set if an INTEGER is read.
+*)
+
+@findex ReadInt
+PROCEDURE ReadInt (VAR x: INTEGER) ;
+
+
+(*
+   ReadInt - reads a string and converts it into an INTEGER, x.
+             Done is set if an INTEGER is read.
+*)
+
+@findex ReadCard
+PROCEDURE ReadCard (VAR x: CARDINAL) ;
+
+
+(*
+   WriteCard - writes the CARDINAL, x, to the output file. It ensures
+               that the number occupies, n, characters. Leading spaces
+               are added if required.
+*)
+
+@findex WriteCard
+PROCEDURE WriteCard (x, n: CARDINAL) ;
+
+
+(*
+   WriteInt - writes the INTEGER, x, to the output file. It ensures
+              that the number occupies, n, characters. Leading spaces
+              are added if required.
+*)
+
+@findex WriteInt
+PROCEDURE WriteInt (x: INTEGER; n: CARDINAL) ;
+
+
+(*
+   WriteOct - writes the CARDINAL, x, to the output file in octal.
+              It ensures that the number occupies, n, characters.
+              Leading spaces are added if required.
+*)
+
+@findex WriteOct
+PROCEDURE WriteOct (x, n: CARDINAL) ;
+
+
+(*
+   WriteHex - writes the CARDINAL, x, to the output file in hexadecimal.
+              It ensures that the number occupies, n, characters.
+              Leading spaces are added if required.
+*)
+
+@findex WriteHex
+PROCEDURE WriteHex (x, n: CARDINAL) ;
+
+
+(*
+   ReadS - returns a string which has is a sequence of characters.
+           Leading white space is ignored and string is terminated
+           with a character <= ' '.
+*)
+
+@findex ReadS
+PROCEDURE ReadS () : String ;
+
+
+(*
+   WriteS - writes a String to the output device.
+            It returns the string, s.
+*)
+
+@findex WriteS
+PROCEDURE WriteS (s: String) : String ;
+
+
+END InOut.
+@end example
+@page
+
+@node gm2-libs-pim/Keyboard, gm2-libs-pim/LongIO, gm2-libs-pim/InOut, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Keyboard
+
+@example
+DEFINITION MODULE Keyboard ;
+
+EXPORT QUALIFIED Read, KeyPressed ;
+
+
+(*
+   Read - reads a character from StdIn. If necessary it will wait
+          for a key to become present on StdIn.
+*)
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+
+
+(*
+   KeyPressed - returns TRUE if a character can be read from StdIn
+                without blocking the caller.
+*)
+
+@findex KeyPressed
+PROCEDURE KeyPressed () : BOOLEAN ;
+
+
+END Keyboard.
+@end example
+@page
+
+@node gm2-libs-pim/LongIO, gm2-libs-pim/NumberConversion, gm2-libs-pim/Keyboard, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/LongIO
+
+@example
+DEFINITION MODULE LongIO ;
+
+EXPORT QUALIFIED Done, ReadLongInt, WriteLongInt ;
+
+VAR
+@findex Done (var)
+   Done: BOOLEAN ;
+
+@findex ReadLongInt
+PROCEDURE ReadLongInt (VAR i: LONGINT) ;
+@findex WriteLongInt
+PROCEDURE WriteLongInt (i: LONGINT; n: CARDINAL) ;
+
+
+END LongIO.
+@end example
+@page
+
+@node gm2-libs-pim/NumberConversion, gm2-libs-pim/Random, gm2-libs-pim/LongIO, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/NumberConversion
+
+@example
+DEFINITION MODULE NumberConversion ;
+
+(* --fixme-- finish this.  *)
+
+END NumberConversion.
+@end example
+@page
+
+@node gm2-libs-pim/Random, gm2-libs-pim/RealConversions, gm2-libs-pim/NumberConversion, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Random
+
+@example
+DEFINITION MODULE Random ;
+
+FROM SYSTEM IMPORT BYTE ;
+EXPORT QUALIFIED Randomize, RandomInit, RandomBytes, RandomCard, RandomInt, RandomReal, RandomLongReal ;
+
+
+(*
+   Randomize - initialize the random number generator with a seed
+               based on the microseconds.
+*)
+
+@findex Randomize
+PROCEDURE Randomize ;
+
+
+(*
+   RandomInit - initialize the random number generator with value, seed.
+*)
+
+@findex RandomInit
+PROCEDURE RandomInit (seed: CARDINAL) ;
+
+
+(*
+   RandomBytes - fills in an array with random values.
+*)
+
+@findex RandomBytes
+PROCEDURE RandomBytes (VAR a: ARRAY OF BYTE) ;
+
+
+(*
+   RandomInt - return an INTEGER in the range 0..bound-1
+*)
+
+@findex RandomInt
+PROCEDURE RandomInt (bound: INTEGER) : INTEGER ;
+
+
+(*
+   RandomCard - return a CARDINAL in the range 0..bound-1
+*)
+
+@findex RandomCard
+PROCEDURE RandomCard (bound: CARDINAL) : CARDINAL ;
+
+
+(*
+   RandomReal - return a REAL number in the range 0.0..1.0
+*)
+
+@findex RandomReal
+PROCEDURE RandomReal () : REAL ;
+
+
+(*
+   RandomLongReal - return a LONGREAL number in the range 0.0..1.0
+*)
+
+@findex RandomLongReal
+PROCEDURE RandomLongReal () : LONGREAL ;
+
+
+END Random.
+@end example
+@page
+
+@node gm2-libs-pim/RealConversions, gm2-libs-pim/RealInOut, gm2-libs-pim/Random, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/RealConversions
+
+@example
+DEFINITION MODULE RealConversions ;
+
+EXPORT QUALIFIED SetNoOfExponentDigits,
+                 RealToString, StringToReal,
+                 LongRealToString, StringToLongReal ;
+
+
+(*
+   SetNoOfExponentDigits - sets the number of exponent digits to be
+                           used during future calls of LongRealToString
+                           and RealToString providing that the width
+                           is sufficient.
+                           If this value is set to 0 (the default) then
+                           the number digits used is the minimum necessary.
+*)
+
+@findex SetNoOfExponentDigits
+PROCEDURE SetNoOfExponentDigits (places: CARDINAL) ;
+
+
+(*
+   RealToString - converts a real, r, into a right justified string, str.
+                  The number of digits to the right of the decimal point
+                  is given in, digits.  The value, width, represents the
+                  maximum number of characters to be used in the string,
+                  str.
+
+                  If digits is negative then exponent notation is used
+                  whereas if digits is positive then fixed point notation
+                  is used.
+
+                  If, r, is less than 0.0 then a '-' preceeds the value,
+                  str.  However, if, r, is >= 0.0 a '+' is not added.
+
+                  If the conversion of, r, to a string requires more
+                  than, width, characters then the string, str, is set
+                  to a nul string and, ok is assigned FALSE.
+
+                  For fixed point notation the minimum width required is
+                  ABS(width)+8
+
+                  For exponent notation the minimum width required is
+                  ABS(digits)+2+log10(magnitude).
+
+                  if r is a NaN then the string 'nan' is returned formatted and
+                  ok will be FALSE.
+*)
+
+@findex RealToString
+PROCEDURE RealToString (r: REAL; digits, width: INTEGER;
+                        VAR str: ARRAY OF CHAR; VAR ok: BOOLEAN) ;
+
+
+(*
+   LongRealToString - converts a real, r, into a right justified string, str.
+                      The number of digits to the right of the decimal point
+                      is given in, digits. The value, width, represents the
+                      maximum number of characters to be used in the string,
+                      str.
+
+                      If digits is negative then exponent notation is used
+                      whereas if digits is positive then fixed point notation
+                      is used.
+
+                      If, r, is less than 0.0 then a '-' preceeds the value,
+                      str. However, if, r, is >= 0.0 a '+' is not added.
+
+                      If the conversion of, r, to a string requires more
+                      than, width, characters then the string, str, is set
+                      to a nul string and, ok is assigned FALSE.
+
+                      For fixed point notation the minimum width required is
+                      ABS(width)+8
+
+                      For exponent notation the minimum width required is
+                      ABS(digits)+2+log10(magnitude).
+
+                      Examples:
+                      RealToString(100.0, 10, 10, a, ok)       ->  '100.000000'
+                      RealToString(100.0, -5, 12, a, ok)       ->  '  1.00000E+2'
+
+                      RealToString(123.456789, 10, 10, a, ok)  ->  '123.456789'
+                      RealToString(123.456789, -5, 13, a, ok)  ->  '    1.23456E+2'
+
+                      RealToString(123.456789, -2, 15, a, ok)  ->  '          1.23E+2'
+
+                      if r is a NaN then the string 'nan' is returned formatted and
+                      ok will be FALSE.
+*)
+
+@findex LongRealToString
+PROCEDURE LongRealToString (r: LONGREAL; digits, width: INTEGER;
+                            VAR str: ARRAY OF CHAR; VAR ok: BOOLEAN) ;
+
+
+(*
+   StringToReal - converts, str, into a REAL, r. The parameter, ok, is
+                  set to TRUE if the conversion was successful.
+*)
+
+@findex StringToReal
+PROCEDURE StringToReal (str: ARRAY OF CHAR; VAR r: REAL; VAR ok: BOOLEAN) ;
+
+
+(*
+   StringToLongReal - converts, str, into a LONGREAL, r. The parameter, ok, is
+                      set to TRUE if the conversion was successful.
+*)
+
+@findex StringToLongReal
+PROCEDURE StringToLongReal (str: ARRAY OF CHAR; VAR r: LONGREAL; VAR ok: BOOLEAN) ;
+
+
+END RealConversions.
+@end example
+@page
+
+@node gm2-libs-pim/RealInOut, gm2-libs-pim/Strings, gm2-libs-pim/RealConversions, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/RealInOut
+
+@example
+DEFINITION MODULE RealInOut ;
+
+EXPORT QUALIFIED SetNoOfDecimalPlaces,
+                 ReadReal, WriteReal, WriteRealOct,
+                 ReadLongReal, WriteLongReal, WriteLongRealOct,
+                 ReadShortReal, WriteShortReal, WriteShortRealOct,
+                 Done ;
+
+CONST
+@findex DefaultDecimalPlaces (const)
+   DefaultDecimalPlaces = 6 ;
+
+VAR
+@findex Done (var)
+   Done: BOOLEAN ;
+
+
+(*
+   SetNoOfDecimalPlaces - number of decimal places WriteReal and
+                          WriteLongReal should emit.  This procedure
+                          can be used to override the default
+                          DefaultDecimalPlaces constant.
+*)
+
+@findex SetNoOfDecimalPlaces
+PROCEDURE SetNoOfDecimalPlaces (places: CARDINAL) ;
+
+
+(*
+   ReadReal - reads a real number, legal syntaxes include:
+              100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
+*)
+
+@findex ReadReal
+PROCEDURE ReadReal (VAR x: REAL) ;
+
+
+(*
+   WriteReal - writes a real to the terminal. The real number
+               is right justified and, n, is the minimum field
+               width.
+*)
+
+@findex WriteReal
+PROCEDURE WriteReal (x: REAL; n: CARDINAL) ;
+
+
+(*
+   WriteRealOct - writes the real to terminal in octal words.
+*)
+
+@findex WriteRealOct
+PROCEDURE WriteRealOct (x: REAL) ;
+
+
+(*
+   ReadLongReal - reads a LONGREAL number, legal syntaxes include:
+                  100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
+*)
+
+@findex ReadLongReal
+PROCEDURE ReadLongReal (VAR x: LONGREAL) ;
+
+
+(*
+   WriteLongReal - writes a LONGREAL to the terminal. The real number
+                   is right justified and, n, is the minimum field
+                   width.
+*)
+
+@findex WriteLongReal
+PROCEDURE WriteLongReal (x: LONGREAL; n: CARDINAL) ;
+
+
+(*
+   WriteLongRealOct - writes the LONGREAL to terminal in octal words.
+*)
+
+@findex WriteLongRealOct
+PROCEDURE WriteLongRealOct (x: LONGREAL) ;
+
+
+(*
+   ReadShortReal - reads a SHORTREAL number, legal syntaxes include:
+                   100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
+*)
+
+@findex ReadShortReal
+PROCEDURE ReadShortReal (VAR x: SHORTREAL) ;
+
+
+(*
+   WriteShortReal - writes a SHORTREAL to the terminal. The real number
+                    is right justified and, n, is the minimum field
+                    width.
+*)
+
+@findex WriteShortReal
+PROCEDURE WriteShortReal (x: SHORTREAL; n: CARDINAL) ;
+
+
+(*
+   WriteShortRealOct - writes the SHORTREAL to terminal in octal words.
+*)
+
+@findex WriteShortRealOct
+PROCEDURE WriteShortRealOct (x: SHORTREAL) ;
+
+
+END RealInOut.
+@end example
+@page
+
+@node gm2-libs-pim/Strings, gm2-libs-pim/Termbase, gm2-libs-pim/RealInOut, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Strings
+
+@example
+DEFINITION MODULE Strings ;
+
+EXPORT QUALIFIED Assign, Insert, Delete, Pos, Copy, ConCat, Length,
+                 CompareStr ;
+
+(*
+   Assign - dest := source.
+*)
+
+@findex Assign
+PROCEDURE Assign (VAR dest: ARRAY OF CHAR; source: ARRAY OF CHAR) ;
+
+
+(*
+   Insert - insert the string, substr, into str at position, index.
+            substr, is added to the end of, str, if, index >= length(str)
+*)
+
+@findex Insert
+PROCEDURE Insert (substr: ARRAY OF CHAR; VAR str: ARRAY OF CHAR;
+                  index: CARDINAL) ;
+
+
+(*
+   Delete - delete len characters from, str, starting at, index.
+*)
+
+@findex Delete
+PROCEDURE Delete (VAR str: ARRAY OF CHAR; index: CARDINAL; length: CARDINAL) ;
+
+
+(*
+   Pos - return the first position of, substr, in, str.
+*)
+
+@findex Pos
+PROCEDURE Pos (substr, str: ARRAY OF CHAR) : CARDINAL ;
+
+
+(*
+   Copy - copy at most, length, characters in, substr, to, str,
+          starting at position, index.
+*)
+
+@findex Copy
+PROCEDURE Copy (str: ARRAY OF CHAR;
+                index, length: CARDINAL; VAR result: ARRAY OF CHAR) ;
+
+(*
+   ConCat - concatenates two strings, s1, and, s2
+            and places the result into, dest.
+*)
+
+@findex ConCat
+PROCEDURE ConCat (s1, s2: ARRAY OF CHAR; VAR dest: ARRAY OF CHAR) ;
+
+
+(*
+   Length - return the length of string, s.
+*)
+
+@findex Length
+PROCEDURE Length (s: ARRAY OF CHAR) : CARDINAL ;
+
+
+(*
+   CompareStr - compare two strings, left, and, right.
+*)
+
+@findex CompareStr
+PROCEDURE CompareStr (left, right: ARRAY OF CHAR) : INTEGER ;
+
+
+END Strings.
+@end example
+@page
+
+@node gm2-libs-pim/Termbase, gm2-libs-pim/Terminal, gm2-libs-pim/Strings, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Termbase
+
+@example
+DEFINITION MODULE Termbase ;
+
+(*
+   Initially the read routines from Keyboard and the
+   write routine from Display is assigned to the Read,
+   KeyPressed and Write procedures.
+*)
+
+EXPORT QUALIFIED ReadProcedure, StatusProcedure, WriteProcedure,
+                 AssignRead, AssignWrite, UnAssignRead, UnAssignWrite,
+                 Read, KeyPressed, Write ;
+
+TYPE
+@findex ReadProcedure (type)
+   ReadProcedure = PROCEDURE (VAR CHAR) ;
+@findex WriteProcedure (type)
+   WriteProcedure = PROCEDURE (CHAR) ;
+@findex StatusProcedure (type)
+   StatusProcedure = PROCEDURE () : BOOLEAN ;
+
+
+(*
+   AssignRead - assigns a read procedure and status procedure for terminal
+                input. Done is set to TRUE if successful. Subsequent
+                Read and KeyPressed calls are mapped onto the user supplied
+                procedures. The previous read and status procedures are
+                uncovered and reused after UnAssignRead is called.
+*)
+
+@findex AssignRead
+PROCEDURE AssignRead (rp: ReadProcedure; sp: StatusProcedure;
+                      VAR Done: BOOLEAN) ;
+
+
+(*
+   UnAssignRead - undo the last call to AssignRead and set Done to TRUE
+                  on success.
+*)
+
+@findex UnAssignRead
+PROCEDURE UnAssignRead (VAR Done: BOOLEAN) ;
+
+
+(*
+   Read - reads a single character using the currently active read
+          procedure.
+*)
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+
+
+(*
+   KeyPressed - returns TRUE if a character is available to be read.
+*)
+
+@findex KeyPressed
+PROCEDURE KeyPressed () : BOOLEAN ;
+
+
+(*
+   AssignWrite - assigns a write procedure for terminal output.
+                 Done is set to TRUE if successful. Subsequent
+                 Write calls are mapped onto the user supplied
+                 procedure. The previous write procedure is
+                 uncovered and reused after UnAssignWrite is called.
+*)
+
+@findex AssignWrite
+PROCEDURE AssignWrite (wp: WriteProcedure; VAR Done: BOOLEAN) ;
+
+
+(*
+   UnAssignWrite - undo the last call to AssignWrite and set Done to TRUE
+                   on success.
+*)
+
+@findex UnAssignWrite
+PROCEDURE UnAssignWrite (VAR Done: BOOLEAN) ;
+
+
+(*
+   Write - writes a single character using the currently active write
+           procedure.
+*)
+
+@findex Write
+PROCEDURE Write (VAR ch: CHAR) ;
+
+
+END Termbase.
+@end example
+@page
+
+@node gm2-libs-pim/Terminal, gm2-libs-pim/TimeDate, gm2-libs-pim/Termbase, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/Terminal
+
+@example
+DEFINITION MODULE Terminal ;
+
+(*
+   It provides simple terminal input output
+   routines which all utilize the TermBase module.
+*)
+
+EXPORT QUALIFIED Read, KeyPressed, ReadAgain, ReadString, Write,
+                 WriteString, WriteLn ;
+
+
+(*
+   Read - reads a single character.
+*)
+
+@findex Read
+PROCEDURE Read (VAR ch: CHAR) ;
+
+
+(*
+   KeyPressed - returns TRUE if a character can be read without blocking
+                the caller.
+*)
+
+@findex KeyPressed
+PROCEDURE KeyPressed () : BOOLEAN ;
+
+
+(*
+   ReadString - reads a sequence of characters.
+                Tabs are expanded into 8 spaces and <cr> or <lf> terminates
+                the string.
+*)
+
+@findex ReadString
+PROCEDURE ReadString (VAR s: ARRAY OF CHAR) ;
+
+
+(*
+   ReadAgain - makes the last character readable again.
+*)
+
+@findex ReadAgain
+PROCEDURE ReadAgain ;
+
+
+(*
+   Write - writes a single character to the Termbase module.
+*)
+
+@findex Write
+PROCEDURE Write (ch: CHAR) ;
+
+
+(*
+   WriteString - writes out a string which is terminated by a <nul>
+                 character or the end of string HIGH(s).
+*)
+
+@findex WriteString
+PROCEDURE WriteString (s: ARRAY OF CHAR) ;
+
+
+(*
+   WriteLn - writes a lf character.
+*)
+
+@findex WriteLn
+PROCEDURE WriteLn ;
+
+
+END Terminal.
+@end example
+@page
+
+@node gm2-libs-pim/TimeDate, , gm2-libs-pim/Terminal, PIM and Logitech 3.0 Compatible
+@subsection gm2-libs-pim/TimeDate
+
+@example
+DEFINITION MODULE TimeDate ;
+
+(*
+   Legacy compatibility - you are advised to use cleaner
+   designed modules based on 'man 3 strtime'
+   and friends for new projects as the day value here is ugly.
+   [it was mapped onto MSDOS pre 2000].
+*)
+
+EXPORT QUALIFIED Time, GetTime, SetTime, CompareTime, TimeToZero,
+                 TimeToString ;
+
+TYPE
+(*
+   day holds:  bits 0..4 = day of month (1..31)
+                    5..8 = month of year (1..12)
+                    9..  = year - 1900
+   minute holds:    hours * 60 + minutes
+   millisec holds:  seconds * 1000 + millisec
+                    which is reset to 0 every minute
+*)
+
+   Time = RECORD
+             day, minute, millisec: CARDINAL ;
+          END ;
+
+
+(*
+   GetTime - returns the current date and time.
+*)
+
+@findex GetTime
+PROCEDURE GetTime (VAR curTime: Time) ;
+
+
+(*
+   SetTime - does nothing, but provides compatibility with
+             the Logitech-3.0 library.
+*)
+
+@findex SetTime
+PROCEDURE SetTime (curTime: Time) ;
+
+
+(*
+   CompareTime - compare two dates and time which returns:
+
+                 -1  if t1 < t2
+                  0  if t1 = t2
+                  1  if t1 > t2
+*)
+
+@findex CompareTime
+PROCEDURE CompareTime (t1, t2: Time) : INTEGER ;
+
+
+(*
+   TimeToZero - initializes, t, to zero.
+*)
+
+@findex TimeToZero
+PROCEDURE TimeToZero (VAR t: Time) ;
+
+
+(*
+   TimeToString - convert time, t, to a string.
+                  The string, s, should be at least 19 characters
+                  long and the returned string will be
+
+                  yyyy-mm-dd hh:mm:ss
+*)
+
+@findex TimeToString
+PROCEDURE TimeToString (t: Time; VAR s: ARRAY OF CHAR) ;
+
+
+END TimeDate.
+@end example
+@page
+
+
+@c ------------------------------------------------------------
+@node PIM coroutine support, M2 ISO Libraries, PIM and Logitech 3.0 Compatible, Libraries
+@section PIM coroutine support
+
+@c README.texi describes the PIM coroutine libraries.
+@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
+@c
+@c This is part of the GM2 manual.
+@c For copying conditions, see the file gcc/doc/include/fdl.texi.
+
+This directory contains a PIM @code{SYSTEM} containing the
+@code{PROCESS} primitives built on top of @code{gthread}s.
+@menu
+* gm2-libs-coroutines/Debug::Debug.def
+* gm2-libs-coroutines/Executive::Executive.def
+* gm2-libs-coroutines/KeyBoardLEDs::KeyBoardLEDs.def
+* gm2-libs-coroutines/SYSTEM::SYSTEM.def
+* gm2-libs-coroutines/TimerHandler::TimerHandler.def
+@end menu
+
+@node gm2-libs-coroutines/Debug, gm2-libs-coroutines/Executive, , PIM coroutine support
+@subsection gm2-libs-coroutines/Debug
+
+@example
+DEFINITION MODULE Debug ;
+
+(*
+    Description: provides some simple debugging routines.
+*)
+
+EXPORT QUALIFIED Halt, DebugString, PushOutput ;
+
+TYPE
+@findex WriteP (type)
+   WriteP = PROCEDURE (CHAR) ;
+
+
+(*
+   Halt - writes a message in the format:
+          Module:Line:Message
+
+          It then terminates by calling HALT.
+*)
+
+@findex Halt
+PROCEDURE Halt (File    : ARRAY OF CHAR;
+                LineNo  : CARDINAL;
+                Function,
+                Message : ARRAY OF CHAR) ;
+
+
+(*
+   DebugString - writes a string to the debugging device (Scn.Write).
+                 It interprets \n as carriage return, linefeed.
+*)
+
+@findex DebugString
+PROCEDURE DebugString (a: ARRAY OF CHAR) ;
+
+
+(*
+   PushOutput - pushes the output procedure, p, which is used Debug.
+*)
+
+@findex PushOutput
+PROCEDURE PushOutput (p: WriteP) ;
+
+
+(*
+   PopOutput - pops the current output procedure from the stack.
+*)
+
+@findex PopOutput
+PROCEDURE PopOutput ;
+
+
+END Debug.
+@end example
+@page
+
+@node gm2-libs-coroutines/Executive, gm2-libs-coroutines/KeyBoardLEDs, gm2-libs-coroutines/Debug, PIM coroutine support
+@subsection gm2-libs-coroutines/Executive
+
+@example
+DEFINITION MODULE Executive ;
+
+EXPORT QUALIFIED SEMAPHORE, DESCRIPTOR,
+                 InitProcess, KillProcess, Resume, Suspend, InitSemaphore,
+                 Wait, Signal, WaitForIO, Ps, GetCurrentProcess,
+                 RotateRunQueue, ProcessName, DebugProcess ;
+
+TYPE
+@findex SEMAPHORE (type)
+   SEMAPHORE ;         (* defines Dijkstra's semaphores *)
+@findex DESCRIPTOR (type)
+   DESCRIPTOR ;        (* handle onto a process         *)
+
+
+(*
+   InitProcess - initializes a process which is held in the suspended
+                 state. When the process is resumed it will start executing
+                 procedure, p. The process has a maximum stack size of,
+                 StackSize, bytes and its textual name is, Name.
+                 The StackSize should be at least 5000 bytes.
+*)
+
+@findex InitProcess
+PROCEDURE InitProcess (p: PROC; StackSize: CARDINAL;
+                       Name: ARRAY OF CHAR) : DESCRIPTOR ;
+
+
+(*
+   KillProcess - kills the current process. Notice that if InitProcess
+                 is called again, it might reuse the DESCRIPTOR of the
+                 killed process. It is the responsibility of the caller
+                 to ensure all other processes understand this process
+                 is different.
+*)
+
+@findex KillProcess
+PROCEDURE KillProcess ;
+
+
+(*
+   Resume - resumes a suspended process. If all is successful then the process, p,
+            is returned. If it fails then NIL is returned.
+*)
+
+@findex Resume
+PROCEDURE Resume (d: DESCRIPTOR) : DESCRIPTOR ;
+
+
+(*
+   Suspend - suspend the calling process.
+             The process can only continue running if another process
+             Resumes it.
+*)
+
+@findex Suspend
+PROCEDURE Suspend ;
+
+
+(*
+   InitSemaphore - creates a semaphore whose initial value is, v, and
+                   whose name is, Name.
+*)
+
+@findex InitSemaphore
+PROCEDURE InitSemaphore (v: CARDINAL; Name: ARRAY OF CHAR) : SEMAPHORE ;
+
+
+(*
+   Wait - performs dijkstra's P operation on a semaphore.
+          A process which calls this procedure will
+          wait until the value of the semaphore is > 0
+          and then it will decrement this value.
+*)
+
+@findex Wait
+PROCEDURE Wait (s: SEMAPHORE) ;
+
+
+(*
+   Signal - performs dijkstra's V operation on a semaphore.
+            A process which calls the procedure will increment
+            the semaphores value.
+*)
+
+@findex Signal
+PROCEDURE Signal (s: SEMAPHORE) ;
+
+
+(*
+   WaitForIO - waits for an interrupt to occur on vector, VectorNo.
+*)
+
+@findex WaitForIO
+PROCEDURE WaitForIO (VectorNo: CARDINAL) ;
+
+
+(*
+   Ps - displays a process list together with process status.
+*)
+
+@findex Ps
+PROCEDURE Ps ;
+
+
+(*
+   GetCurrentProcess - returns the descriptor of the current running
+                       process.
+*)
+
+@findex GetCurrentProcess
+PROCEDURE GetCurrentProcess () : DESCRIPTOR ;
+
+
+(*
+   RotateRunQueue - rotates the process run queue.
+                    It does not call the scheduler.
+*)
+
+@findex RotateRunQueue
+PROCEDURE RotateRunQueue ;
+
+
+(*
+   ProcessName - displays the name of process, d, through
+                 DebugString.
+*)
+
+@findex ProcessName
+PROCEDURE ProcessName (d: DESCRIPTOR) ;
+
+
+(*
+   DebugProcess - gdb debug handle to enable users to debug deadlocked
+                  semaphore processes.
+*)
+
+@findex DebugProcess
+PROCEDURE DebugProcess (d: DESCRIPTOR) ;
+
+
+END Executive.
+@end example
+@page
+
+@node gm2-libs-coroutines/KeyBoardLEDs, gm2-libs-coroutines/SYSTEM, gm2-libs-coroutines/Executive, PIM coroutine support
+@subsection gm2-libs-coroutines/KeyBoardLEDs
+
+@example
+DEFINITION MODULE KeyBoardLEDs ;
+
+
+EXPORT QUALIFIED SwitchLeds,
+                 SwitchScroll, SwitchNum, SwitchCaps ;
+
+
+(*
+   SwitchLeds - switch the keyboard LEDs to the state defined
+                by the BOOLEAN variables. TRUE = ON.
+*)
+
+@findex SwitchLeds
+PROCEDURE SwitchLeds (NumLock, CapsLock, ScrollLock: BOOLEAN) ;
+
+
+(*
+   SwitchScroll - switchs the scroll LED on or off.
+*)
+
+@findex SwitchScroll
+PROCEDURE SwitchScroll (Scroll: BOOLEAN) ;
+
+
+(*
+   SwitchNum - switches the Num LED on or off.
+*)
+
+@findex SwitchNum
+PROCEDURE SwitchNum (Num: BOOLEAN) ;
+
+
+(*
+   SwitchCaps - switches the Caps LED on or off.
+*)
+
+@findex SwitchCaps
+PROCEDURE SwitchCaps (Caps: BOOLEAN) ;
+
+
+END KeyBoardLEDs.
+@end example
+@page
+
+@node gm2-libs-coroutines/SYSTEM, gm2-libs-coroutines/TimerHandler, gm2-libs-coroutines/KeyBoardLEDs, PIM coroutine support
+@subsection gm2-libs-coroutines/SYSTEM
+
+@example
+DEFINITION MODULE SYSTEM ;
+
+(* This module is designed to be used on a native operating system
+   rather than an embedded system as it implements the coroutine
+   primitives TRANSFER, IOTRANSFER and
+   NEWPROCESS through the GNU Pthread library.  *)
+
+FROM COROUTINES IMPORT PROTECTION ;
+
+EXPORT QUALIFIED (* the following are built into the compiler: *)
+                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+                 Target specific data types. *)
+                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE,
+                 (* SIZE is exported depending upon -fpim2 and
+                    -fpedantic.  *)
+                 (* The rest are implemented in SYSTEM.mod.  *)
+                 PROCESS, TRANSFER, NEWPROCESS, IOTRANSFER,
+                 LISTEN,
+                 ListenLoop, TurnInterrupts,
+                 (* Internal GM2 compiler functions.  *)
+                 ShiftVal, ShiftLeft, ShiftRight,
+                 RotateVal, RotateLeft, RotateRight ;
+
+
+TYPE
+@findex PROCESS (type)
+   PROCESS  = RECORD
+                 context: INTEGER ;
+@findex END (type)
+              END ;
+(* all the following types are declared internally to gm2
+   (* Target specific data types.  *)
+*)
+
+
+(*
+   TRANSFER - save the current volatile environment into, p1.
+              Restore the volatile environment from, p2.
+*)
+
+@findex TRANSFER
+PROCEDURE TRANSFER (VAR p1: PROCESS; p2: PROCESS) ;
+
+
+(*
+   NEWPROCESS - p is a parameterless procedure, a, is the origin of
+                the workspace used for the process stack and containing
+                the volatile environment of the process.  StackSize, is
+                the maximum size of the stack in bytes which can be used
+                by this process.  new, is the new process.
+*)
+
+@findex NEWPROCESS
+PROCEDURE NEWPROCESS (p: PROC; a: ADDRESS; StackSize: CARDINAL; VAR new: PROCESS) ;
+
+
+(*
+   IOTRANSFER - saves the current volatile environment into, First,
+                and restores volatile environment, Second.
+                When an interrupt, InterruptNo, is encountered then
+                the reverse takes place.  (The then current volatile
+                environment is shelved onto Second and First is resumed).
+
+                NOTE: that upon interrupt the Second might not be the
+                      same process as that before the original call to
+                      IOTRANSFER.
+*)
+
+@findex IOTRANSFER
+PROCEDURE IOTRANSFER (VAR First, Second: PROCESS; InterruptNo: CARDINAL) ;
+
+
+(*
+   LISTEN - briefly listen for any interrupts.
+*)
+
+@findex LISTEN
+PROCEDURE LISTEN ;
+
+
+(*
+   ListenLoop - should be called instead of users writing:
+
+                LOOP
+                   LISTEN
+                END
+
+                It performs the same function but yields
+                control back to the underlying operating system
+                via a call to pth_select.
+                It also checks for deadlock.
+                This function returns when an interrupt occurs ie
+                a file descriptor becomes ready or a time event
+                expires.  See the module RTint.
+*)
+
+@findex ListenLoop
+PROCEDURE ListenLoop ;
+
+
+(*
+   TurnInterrupts - switches processor interrupts to the protection
+                    level, to.  It returns the old value.
+*)
+
+@findex TurnInterrupts
+PROCEDURE TurnInterrupts (to: PROTECTION) : PROTECTION ;
+
+
+(*
+   all the functions below are declared internally to gm2
+   ====================================================
+
+@findex ADR
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+@findex SIZE
+PROCEDURE SIZE (v: <type>) : ZType;
+  (* Returns the number of BYTES used to store a v of
+     any specified <type>.  Only available if -fpim2 is used.
+  *)
+
+@findex TSIZE
+PROCEDURE TSIZE (<type>) : CARDINAL;
+  (* Returns the number of BYTES used to store a value of the
+     specified <type>.
+  *)
+
+@findex ROTATE
+PROCEDURE ROTATE (val: <a set type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up or down
+     (left or right) by the absolute value of num.  The direction is
+     down if the sign of num is negative, otherwise the direction is up.
+  *)
+
+@findex SHIFT
+PROCEDURE SHIFT (val: <a set type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up or down
+     (left or right) by the absolute value of num, introducing
+     zeros as necessary.  The direction is down if the sign of
+     num is negative, otherwise the direction is up.
+  *)
+
+@findex THROW
+PROCEDURE THROW (i: INTEGER) ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the EXCEPT
+     block (assuming it exists).  This is a compiler builtin function which
+     interfaces to the GCC exception handling runtime system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+@findex TBITSIZE
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word sized set types.  They are not strictly part
+   of the core PIM Modula-2, however they are used
+   to implement the SHIFT procedure defined above,
+   which are in turn used by the Logitech compatible libraries.
+
+   Users will access these procedures by using the procedure
+   SHIFT above and GNU Modula-2 will map SHIFT onto one of
+   the following procedures.
+*)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will
+              only call this routine for larger sets.
+*)
+
+@findex ShiftVal
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+@findex ShiftLeft
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex ShiftRight
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM.  GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for
+               larger sets.
+*)
+
+@findex RotateVal
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known
+                at compile time.
+*)
+
+@findex RotateLeft
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+@findex RotateRight
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
+@end example
+@page
+
+@node gm2-libs-coroutines/TimerHandler, , gm2-libs-coroutines/SYSTEM, PIM coroutine support
+@subsection gm2-libs-coroutines/TimerHandler
+
+@example
+DEFINITION MODULE TimerHandler ;
+
+(* It also provides the Executive with a basic round robin scheduler.  *)
+
+EXPORT QUALIFIED TicksPerSecond, GetTicks,
+                 EVENT,
+                 Sleep, ArmEvent, WaitOn, Cancel, ReArmEvent ;
+
+
+CONST
+@findex TicksPerSecond (const)
+   TicksPerSecond =   25 ;  (* Number of ticks per second.  *)
+
+TYPE
+@findex EVENT (type)
+   EVENT ;
+
+
+(*
+   GetTicks - returns the number of ticks since boottime.
+*)
+
+@findex GetTicks
+PROCEDURE GetTicks () : CARDINAL ;
+
+
+(*
+   Sleep - suspends the current process for a time, t.
+           The time is measured in ticks.
+*)
+
+@findex Sleep
+PROCEDURE Sleep (t: CARDINAL) ;
+
+
+(*
+   ArmEvent - initializes an event, e, to occur at time, t.
+              The time, t, is measured in ticks.
+              The event is NOT placed onto the event queue.
+*)
+
+@findex ArmEvent
+PROCEDURE ArmEvent (t: CARDINAL) : EVENT ;
+
+
+(*
+   WaitOn - places event, e, onto the event queue and then the calling
+            process suspends. It is resumed up by either the event
+            expiring or the event, e, being cancelled.
+            TRUE is returned if the event was cancelled
+            FALSE is returned if the event expires.
+            The event, e, is always assigned to NIL when the function
+            finishes.
+*)
+
+@findex WaitOn
+PROCEDURE WaitOn (VAR e: EVENT) : BOOLEAN ;
+
+
+(*
+   Cancel - cancels the event, e, on the event queue and makes
+            the appropriate process runnable again.
+            TRUE is returned if the event was cancelled and
+            FALSE is returned is the event was not found or
+                  no process was waiting on this event.
+*)
+
+@findex Cancel
+PROCEDURE Cancel (e: EVENT) : BOOLEAN ;
+
+
+(*
+   ReArmEvent - removes an event, e, from the event queue. A new time
+                is given to this event and it is then re-inserted onto the
+                event queue in the correct place.
+                TRUE is returned if this occurred
+                FALSE is returned if the event was not found.
+*)
+
+@findex ReArmEvent
+PROCEDURE ReArmEvent (e: EVENT; t: CARDINAL) : BOOLEAN ;
+
+
+END TimerHandler.
+@end example
+@page
+
+
+@c ------------------------------------------------------------
+@node M2 ISO Libraries, , PIM coroutine support, Libraries
+@section M2 ISO Libraries
+
+@c README.texi describes the ISO libraries.
+@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
+@c
+@c This is part of the GM2 manual.
+@c For copying conditions, see the file gcc/doc/include/fdl.texi.
+
+This directory contains the ISO definition modules and some
+corresponding implementation modules.  The definition files:
+@file{ChanConsts.def}, @file{CharClass.def}, @file{ComplexMath.def},
+@file{ConvStringLong.def}, @file{ConvStringReal.def},
+@file{ConvTypes.def}, @file{COROUTINES.def}, @file{EXCEPTIONS.def},
+@file{GeneralUserExceptions.def}, @file{IOChan.def},
+@file{IOConsts.def}, @file{IOLink.def}, @file{IOLink.def},
+@file{IOResult.def}, @file{LongComplexMath.def}, @file{LongConv.def},
+@file{LongIO.def}, @file{LongMath.def}, @file{LongStr.def},
+@file{LowLong.def}, @file{LowReal.def}, @file{M2EXCEPTION.def},
+@file{Processes.def}, @file{ProgramArgs.def}, @file{RawIO.def},
+@file{RealConv.def}, @file{RealIO.def}, @file{RealMath.def},
+@file{RealStr.def}, @file{RndFile.def}, @file{Semaphores.def},
+@file{SeqFile.def}, @file{SIOResult.def}, @file{SLongIO.def},
+@file{SRawIO.def}, @file{SRealIO.def}, @file{StdChans.def},
+@file{STextIO.def}, @file{Storage.def}, @file{StreamFile.def},
+@file{Strings.def}, @file{SWholeIO.def}, @file{SysClock.def},
+@file{SYSTEM.def}, @file{TERMINATION.def}, @file{TextIO.def},
+@file{WholeConv.def}, @file{WholeIO.def} and @file{WholeStr.def}
+were defined by the International Standard
+Information technology - programming languages BS ISO/IEC
+10514-1:1996E Part 1: Modula-2, Base Language.
+
+The Copyright to the definition files @file{ChanConsts.def},
+@file{CharClass.def}, @file{ComplexMath.def},
+@file{ConvStringLong.def}, @file{ConvStringReal.def},
+@file{ConvTypes.def}, @file{COROUTINES.def}, @file{EXCEPTIONS.def},
+@file{GeneralUserExceptions.def}, @file{IOChan.def},
+@file{IOConsts.def}, @file{IOLink.def}, @file{IOLink.def},
+@file{IOResult.def}, @file{LongComplexMath.def}, @file{LongConv.def},
+@file{LongIO.def}, @file{LongMath.def}, @file{LongStr.def},
+@file{LowLong.def}, @file{LowReal.def}, @file{M2EXCEPTION.def},
+@file{Processes.def}, @file{ProgramArgs.def}, @file{RawIO.def},
+@file{RealConv.def}, @file{RealIO.def}, @file{RealMath.def},
+@file{RealStr.def}, @file{RndFile.def}, @file{Semaphores.def},
+@file{SeqFile.def}, @file{SIOResult.def}, @file{SLongIO.def},
+@file{SRawIO.def}, @file{SRealIO.def}, @file{StdChans.def},
+@file{STextIO.def}, @file{Storage.def}, @file{StreamFile.def},
+@file{Strings.def}, @file{SWholeIO.def}, @file{SysClock.def},
+@file{SYSTEM.def}, @file{TERMINATION.def}, @file{TextIO.def},
+@file{WholeConv.def}, @file{WholeIO.def} and @file{WholeStr.def}
+belong to ISO/IEC (International Organization for Standardization and
+International Electrotechnical Commission).  The licence allows them
+to be distributed with the compiler (as described on page
+707 of the Information technology - Programming languages Part 1:
+Modula-2, Base Language.  BS ISO/IEC 10514-1:1996).
+
+All implementation modules and @file{ClientSocket.def},
+@file{LongWholeIO.def}, @file{M2RTS.def}, @file{MemStream.def},
+@file{pth.def}, @file{RandomNumber.def}, @file{RTdata.def},
+@file{RTentity.def}, @file{RTfio.def}, @file{RTio.def},
+@file{ShortComplexMath.def}, @file{ShortIO.def},
+@file{ShortWholeIO.def}, @file{SimpleCipher.def},
+@file{SLongWholeIO.def}, @file{SShortIO.def},
+@file{SShortWholeIO.def}, @file{StringChan.def} and
+@file{wraptime.def} are Copyright of the FSF and are held under the
+GPLv3 with runtime exceptions.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+@url{http://www.gnu.org/licenses/}.
+
+Notice that GNU Modula-2 contains additional libraries for
+input/output of @code{SHORTREAL}, @code{SHORTCARD}, @code{SHORTINT},
+@code{LONGCARD}, @code{LONGINT} data types.  It also provides a
+@code{RandomNumber}, @code{SimpleCipher} and @code{ClientSocket}
+modules as well as low level modules which allow the IO libraries to
+coexist with their PIM counterparts.
+@menu
+* gm2-libs-iso/COROUTINES::COROUTINES.def
+* gm2-libs-iso/ChanConsts::ChanConsts.def
+* gm2-libs-iso/CharClass::CharClass.def
+* gm2-libs-iso/ClientSocket::ClientSocket.def
+* gm2-libs-iso/ComplexMath::ComplexMath.def
+* gm2-libs-iso/ConvStringLong::ConvStringLong.def
+* gm2-libs-iso/ConvStringReal::ConvStringReal.def
+* gm2-libs-iso/ConvTypes::ConvTypes.def
+* gm2-libs-iso/EXCEPTIONS::EXCEPTIONS.def
+* gm2-libs-iso/ErrnoCategory::ErrnoCategory.def
+* gm2-libs-iso/GeneralUserExceptions::GeneralUserExceptions.def
+* gm2-libs-iso/IOChan::IOChan.def
+* gm2-libs-iso/IOConsts::IOConsts.def
+* gm2-libs-iso/IOLink::IOLink.def
+* gm2-libs-iso/IOResult::IOResult.def
+* gm2-libs-iso/LongComplexMath::LongComplexMath.def
+* gm2-libs-iso/LongConv::LongConv.def
+* gm2-libs-iso/LongIO::LongIO.def
+* gm2-libs-iso/LongMath::LongMath.def
+* gm2-libs-iso/LongStr::LongStr.def
+* gm2-libs-iso/LongWholeIO::LongWholeIO.def
+* gm2-libs-iso/LowLong::LowLong.def
+* gm2-libs-iso/LowReal::LowReal.def
+* gm2-libs-iso/LowShort::LowShort.def
+* gm2-libs-iso/M2EXCEPTION::M2EXCEPTION.def
+* gm2-libs-iso/M2RTS::M2RTS.def
+* gm2-libs-iso/MemStream::MemStream.def
+* gm2-libs-iso/Preemptive::Preemptive.def
+* gm2-libs-iso/Processes::Processes.def
+* gm2-libs-iso/ProgramArgs::ProgramArgs.def
+* gm2-libs-iso/RTco::RTco.def
+* gm2-libs-iso/RTdata::RTdata.def
+* gm2-libs-iso/RTentity::RTentity.def
+* gm2-libs-iso/RTfio::RTfio.def
+* gm2-libs-iso/RTgen::RTgen.def
+* gm2-libs-iso/RTgenif::RTgenif.def
+* gm2-libs-iso/RTio::RTio.def
+* gm2-libs-iso/RandomNumber::RandomNumber.def
+* gm2-libs-iso/RawIO::RawIO.def
+* gm2-libs-iso/RealConv::RealConv.def
+* gm2-libs-iso/RealIO::RealIO.def
+* gm2-libs-iso/RealMath::RealMath.def
+* gm2-libs-iso/RealStr::RealStr.def
+* gm2-libs-iso/RndFile::RndFile.def
+* gm2-libs-iso/SIOResult::SIOResult.def
+* gm2-libs-iso/SLongIO::SLongIO.def
+* gm2-libs-iso/SLongWholeIO::SLongWholeIO.def
+* gm2-libs-iso/SRawIO::SRawIO.def
+* gm2-libs-iso/SRealIO::SRealIO.def
+* gm2-libs-iso/SShortIO::SShortIO.def
+* gm2-libs-iso/SShortWholeIO::SShortWholeIO.def
+* gm2-libs-iso/STextIO::STextIO.def
+* gm2-libs-iso/SWholeIO::SWholeIO.def
+* gm2-libs-iso/SYSTEM::SYSTEM.def
+* gm2-libs-iso/Semaphores::Semaphores.def
+* gm2-libs-iso/SeqFile::SeqFile.def
+* gm2-libs-iso/ShortComplexMath::ShortComplexMath.def
+* gm2-libs-iso/ShortIO::ShortIO.def
+* gm2-libs-iso/ShortWholeIO::ShortWholeIO.def
+* gm2-libs-iso/SimpleCipher::SimpleCipher.def
+* gm2-libs-iso/StdChans::StdChans.def
+* gm2-libs-iso/Storage::Storage.def
+* gm2-libs-iso/StreamFile::StreamFile.def
+* gm2-libs-iso/StringChan::StringChan.def
+* gm2-libs-iso/Strings::Strings.def
+* gm2-libs-iso/SysClock::SysClock.def
+* gm2-libs-iso/TERMINATION::TERMINATION.def
+* gm2-libs-iso/TermFile::TermFile.def
+* gm2-libs-iso/TextIO::TextIO.def
+* gm2-libs-iso/WholeConv::WholeConv.def
+* gm2-libs-iso/WholeIO::WholeIO.def
+* gm2-libs-iso/WholeStr::WholeStr.def
+* gm2-libs-iso/wrapsock::wrapsock.def
+* gm2-libs-iso/wraptime::wraptime.def
+@end menu
+
+@node gm2-libs-iso/COROUTINES, gm2-libs-iso/ChanConsts, , M2 ISO Libraries
+@subsection gm2-libs-iso/COROUTINES
+
+@example
+DEFINITION MODULE COROUTINES;
+
+(* Facilities for coroutines and the handling of interrupts *)
+
+IMPORT SYSTEM ;
+
+
+CONST
+@findex UnassignedPriority (const)
+  UnassignedPriority = 0 ;
+
+TYPE
+@findex COROUTINE (type)
+  COROUTINE ; (* Values of this type are created dynamically by NEWCOROUTINE
+                 and identify the coroutine in subsequent operations *)
+@findex INTERRUPTSOURCE (type)
+  INTERRUPTSOURCE = CARDINAL ;
+@findex PROTECTION (type)
+  PROTECTION = [UnassignedPriority..7] ;
+
+
+@findex NEWCOROUTINE
+PROCEDURE NEWCOROUTINE (procBody: PROC;
+                        workspace: SYSTEM.ADDRESS;
+                        size: CARDINAL;
+                        VAR cr: COROUTINE;
+                        [initProtection: PROTECTION = UnassignedPriority]);
+  (* Creates a new coroutine whose body is given by procBody, and
+     returns the identity of the coroutine in cr. workspace is a
+     pointer to the work space allocated to the coroutine; size
+     specifies the size of this workspace in terms of SYSTEM.LOC.
+
+     The optarg, initProtection, may contain a single parameter which
+     specifies the initial protection level of the coroutine.
+  *)
+
+@findex TRANSFER
+PROCEDURE TRANSFER (VAR from: COROUTINE; to: COROUTINE);
+  (* Returns the identity of the calling coroutine in from, and
+     transfers control to the coroutine specified by to.
+  *)
+
+@findex IOTRANSFER
+PROCEDURE IOTRANSFER (VAR from: COROUTINE; to: COROUTINE);
+  (* Returns the identity of the calling coroutine in from and
+     transfers control to the coroutine specified by to.  On
+     occurrence of an interrupt, associated with the caller, control
+     is transferred back to the caller, and the identity of the
+     interrupted coroutine is returned in from.  The calling coroutine
+     must be associated with a source of interrupts.
+  *)
+
+@findex ATTACH
+PROCEDURE ATTACH (source: INTERRUPTSOURCE);
+  (* Associates the specified source of interrupts with the calling
+     coroutine. *)
+
+@findex DETACH
+PROCEDURE DETACH (source: INTERRUPTSOURCE);
+  (* Dissociates the specified source of interrupts from the calling
+     coroutine. *)
+
+@findex IsATTACHED
+PROCEDURE IsATTACHED (source: INTERRUPTSOURCE): BOOLEAN;
+  (* Returns TRUE if and only if the specified source of interrupts is
+     currently associated with a coroutine; otherwise returns FALSE.
+  *)
+
+@findex HANDLER
+PROCEDURE HANDLER (source: INTERRUPTSOURCE): COROUTINE;
+  (* Returns the coroutine, if any, that is associated with the source
+     of interrupts. The result is undefined if IsATTACHED(source) =
+     FALSE.
+  *)
+
+@findex CURRENT
+PROCEDURE CURRENT (): COROUTINE;
+  (* Returns the identity of the calling coroutine. *)
+
+@findex LISTEN
+PROCEDURE LISTEN (p: PROTECTION);
+  (* Momentarily changes the protection of the calling coroutine to
+     p. *)
+
+@findex PROT
+PROCEDURE PROT (): PROTECTION;
+  (* Returns the protection of the calling coroutine. *)
+
+
+(*
+   TurnInterrupts - switches processor interrupts to the protection
+                    level, to.  It returns the old value.
+*)
+
+@findex TurnInterrupts
+PROCEDURE TurnInterrupts (to: PROTECTION) : PROTECTION ;
+
+
+(*
+   ListenLoop - should be called instead of users writing:
+
+                LOOP
+                   LISTEN
+                END
+
+                It performs the same function but yields
+                control back to the underlying operating system.
+                It also checks for deadlock.
+                Note that this function does return when an interrupt occurs.
+                (File descriptor becomes ready or time event expires).
+*)
+
+@findex ListenLoop
+PROCEDURE ListenLoop ;
+
+
+END COROUTINES.
+@end example
+@page
+
+@node gm2-libs-iso/ChanConsts, gm2-libs-iso/CharClass, gm2-libs-iso/COROUTINES, M2 ISO Libraries
+@subsection gm2-libs-iso/ChanConsts
+
+@example
+DEFINITION MODULE ChanConsts;
+
+  (* Common types and values for channel open requests and results *)
+
+TYPE
+@findex ChanFlags (type)
+  ChanFlags =        (* Request flags possibly given when a channel is opened *)
+  ( readFlag,        (* input operations are requested/available *)
+    writeFlag,       (* output operations are requested/available *)
+    oldFlag,         (* a file may/must/did exist before the channel is opened *)
+    textFlag,        (* text operations are requested/available *)
+    rawFlag,         (* raw operations are requested/available *)
+    interactiveFlag, (* interactive use is requested/applies *)
+    echoFlag         (* echoing by interactive device on removal of characters from input
+                        stream requested/applies *)
+  );
+
+@findex FlagSet (type)
+  FlagSet = SET OF ChanFlags;
+
+  (* Singleton values of FlagSet, to allow for example, read + write *)
+
+CONST
+@findex read (const)
+  read = FlagSet@{readFlag@};   (* input operations are requested/available *)
+@findex write (const)
+  write = FlagSet@{writeFlag@}; (* output operations are requested/available *)
+@findex old (const)
+  old = FlagSet@{oldFlag@};     (* a file may/must/did exist before the channel is opened *)
+@findex text (const)
+  text = FlagSet@{textFlag@};   (* text operations are requested/available *)
+@findex raw (const)
+  raw = FlagSet@{rawFlag@};     (* raw operations are requested/available *)
+@findex interactive (const)
+  interactive = FlagSet@{interactiveFlag@}; (* interactive use is requested/applies *)
+@findex echo (const)
+  echo = FlagSet@{echoFlag@};   (* echoing by interactive device on removal of characters from
+                                 input stream requested/applies *)
+
+TYPE
+@findex OpenResults (type)
+  OpenResults =        (* Possible results of open requests *)
+    (opened,           (* the open succeeded as requested *)
+     wrongNameFormat,  (* given name is in the wrong format for the implementation *)
+     wrongFlags,       (* given flags include a value that does not apply to the device *)
+     tooManyOpen,      (* this device cannot support any more open channels *)
+     outOfChans,       (* no more channels can be allocated *)
+     wrongPermissions, (* file or directory permissions do not allow request *)
+     noRoomOnDevice,   (* storage limits on the device prevent the open *)
+     noSuchFile,       (* a needed file does not exist *)
+     fileExists,       (* a file of the given name already exists when a new one is required *)
+     wrongFileType,    (* the file is of the wrong type to support the required operations *)
+     noTextOperations, (* text operations have been requested, but are not supported *)
+     noRawOperations,  (* raw operations have been requested, but are not supported *)
+     noMixedOperations,(* text and raw operations have been requested, but they
+                          are not supported in combination *)
+     alreadyOpen,      (* the source/destination is already open for operations not supported
+                          in combination with the requested operations *)
+     otherProblem      (* open failed for some other reason *)
+    );
+
+END ChanConsts.
+
+@end example
+@page
+
+@node gm2-libs-iso/CharClass, gm2-libs-iso/ClientSocket, gm2-libs-iso/ChanConsts, M2 ISO Libraries
+@subsection gm2-libs-iso/CharClass
+
+@example
+DEFINITION MODULE CharClass;
+
+  (* Classification of values of the type CHAR *)
+
+@findex IsNumeric
+PROCEDURE IsNumeric (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch is classified as a numeric character *)
+
+@findex IsLetter
+PROCEDURE IsLetter (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch is classified as a letter *)
+
+@findex IsUpper
+PROCEDURE IsUpper (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch is classified as an upper case letter *)
+
+@findex IsLower
+PROCEDURE IsLower (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch is classified as a lower case letter *)
+
+@findex IsControl
+PROCEDURE IsControl (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch represents a control function *)
+
+@findex IsWhiteSpace
+PROCEDURE IsWhiteSpace (ch: CHAR): BOOLEAN;
+  (* Returns TRUE if and only if ch represents a space character or a format effector *)
+
+END CharClass.
+
+@end example
+@page
+
+@node gm2-libs-iso/ClientSocket, gm2-libs-iso/ComplexMath, gm2-libs-iso/CharClass, M2 ISO Libraries
+@subsection gm2-libs-iso/ClientSocket
+
+@example
+DEFINITION MODULE ClientSocket ;
+
+FROM IOChan IMPORT ChanId ;
+FROM ChanConsts IMPORT FlagSet, OpenResults ;
+
+
+(*
+   OpenSocket - opens a TCP client connection to host:port.
+*)
+
+@findex OpenSocket
+PROCEDURE OpenSocket (VAR cid: ChanId;
+                      host: ARRAY OF CHAR; port: CARDINAL;
+                      f: FlagSet; VAR res: OpenResults) ;
+
+(*
+   Close - if the channel identified by cid is not open to
+           a socket stream, the exception wrongDevice is
+           raised; otherwise closes the channel, and assigns
+           the value identifying the invalid channel to cid.
+*)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId) ;
+
+
+(*
+   IsSocket - tests if the channel identified by cid is open as
+              a client socket stream.
+*)
+
+@findex IsSocket
+PROCEDURE IsSocket (cid: ChanId) : BOOLEAN ;
+
+
+END ClientSocket.
+@end example
+@page
+
+@node gm2-libs-iso/ComplexMath, gm2-libs-iso/ConvStringLong, gm2-libs-iso/ClientSocket, M2 ISO Libraries
+@subsection gm2-libs-iso/ComplexMath
+
+@example
+DEFINITION MODULE ComplexMath;
+
+  (* Mathematical functions for the type COMPLEX *)
+
+CONST
+@findex i (const)
+  i =    CMPLX (0.0, 1.0);
+@findex one (const)
+  one =  CMPLX (1.0, 0.0);
+@findex zero (const)
+  zero = CMPLX (0.0, 0.0);
+
+@findex abs
+PROCEDURE __BUILTIN__ abs (z: COMPLEX): REAL;
+  (* Returns the length of z *)
+
+@findex arg
+PROCEDURE __BUILTIN__ arg (z: COMPLEX): REAL;
+  (* Returns the angle that z subtends to the positive real axis *)
+
+@findex conj
+PROCEDURE __BUILTIN__ conj (z: COMPLEX): COMPLEX;
+  (* Returns the complex conjugate of z *)
+
+@findex power
+PROCEDURE __BUILTIN__ power (base: COMPLEX; exponent: REAL): COMPLEX;
+  (* Returns the value of the number base raised to the power exponent *)
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (z: COMPLEX): COMPLEX;
+  (* Returns the principal square root of z *)
+
+@findex exp
+PROCEDURE __BUILTIN__ exp (z: COMPLEX): COMPLEX;
+  (* Returns the complex exponential of z *)
+
+@findex ln
+PROCEDURE __BUILTIN__ ln (z: COMPLEX): COMPLEX;
+  (* Returns the principal value of the natural logarithm of z *)
+
+@findex sin
+PROCEDURE __BUILTIN__ sin (z: COMPLEX): COMPLEX;
+  (* Returns the sine of z *)
+
+@findex cos
+PROCEDURE __BUILTIN__ cos (z: COMPLEX): COMPLEX;
+  (* Returns the cosine of z *)
+
+@findex tan
+PROCEDURE __BUILTIN__ tan (z: COMPLEX): COMPLEX;
+  (* Returns the tangent of z *)
+
+@findex arcsin
+PROCEDURE __BUILTIN__ arcsin (z: COMPLEX): COMPLEX;
+  (* Returns the arcsine of z *)
+
+@findex arccos
+PROCEDURE __BUILTIN__ arccos (z: COMPLEX): COMPLEX;
+  (* Returns the arccosine of z *)
+
+@findex arctan
+PROCEDURE __BUILTIN__ arctan (z: COMPLEX): COMPLEX;
+  (* Returns the arctangent of z *)
+
+@findex polarToComplex
+PROCEDURE polarToComplex (abs, arg: REAL): COMPLEX;
+  (* Returns the complex number with the specified polar coordinates *)
+
+@findex scalarMult
+PROCEDURE scalarMult (scalar: REAL; z: COMPLEX): COMPLEX;
+  (* Returns the scalar product of scalar with z *)
+
+@findex IsCMathException
+PROCEDURE IsCMathException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception in a
+     routine from this module; otherwise returns FALSE.
+  *)
+
+END ComplexMath.
+
+@end example
+@page
+
+@node gm2-libs-iso/ConvStringLong, gm2-libs-iso/ConvStringReal, gm2-libs-iso/ComplexMath, M2 ISO Libraries
+@subsection gm2-libs-iso/ConvStringLong
+
+@example
+DEFINITION MODULE ConvStringLong ;
+
+FROM DynamicStrings IMPORT String ;
+
+
+(*
+   RealToFloatString - converts a real with, sigFigs, into a string
+                       and returns the result as a string.
+*)
+
+@findex RealToFloatString
+PROCEDURE RealToFloatString (real: LONGREAL; sigFigs: CARDINAL) : String ;
+
+
+(*
+   RealToEngString - converts the value of real to floating-point
+                     string form, with sigFigs significant figures.
+                     The number is scaled with one to three digits
+                     in the whole number part and with an exponent
+                     that is a multiple of three.
+*)
+
+@findex RealToEngString
+PROCEDURE RealToEngString (real: LONGREAL; sigFigs: CARDINAL) : String ;
+
+
+(*
+   RealToFixedString - returns the number of characters in the fixed-point
+                       string representation of real rounded to the given
+                       place relative to the decimal point.
+*)
+
+@findex RealToFixedString
+PROCEDURE RealToFixedString (real: LONGREAL; place: INTEGER) : String ;
+
+
+END ConvStringLong.
+@end example
+@page
+
+@node gm2-libs-iso/ConvStringReal, gm2-libs-iso/ConvTypes, gm2-libs-iso/ConvStringLong, M2 ISO Libraries
+@subsection gm2-libs-iso/ConvStringReal
+
+@example
+DEFINITION MODULE ConvStringReal ;
+
+FROM DynamicStrings IMPORT String ;
+
+
+(*
+   RealToFloatString - converts a real with, sigFigs, into a string
+                       and returns the result as a string.
+*)
+
+@findex RealToFloatString
+PROCEDURE RealToFloatString (real: REAL; sigFigs: CARDINAL) : String ;
+
+
+(*
+   RealToEngString - converts the value of real to floating-point
+                     string form, with sigFigs significant figures.
+                     The number is scaled with one to three digits
+                     in the whole number part and with an exponent
+                     that is a multiple of three.
+*)
+
+@findex RealToEngString
+PROCEDURE RealToEngString (real: REAL; sigFigs: CARDINAL) : String ;
+
+
+(*
+   RealToFixedString - returns the number of characters in the fixed-point
+                       string representation of real rounded to the given
+                       place relative to the decimal point.
+*)
+
+@findex RealToFixedString
+PROCEDURE RealToFixedString (real: REAL; place: INTEGER) : String ;
+
+
+END ConvStringReal.
+@end example
+@page
+
+@node gm2-libs-iso/ConvTypes, gm2-libs-iso/EXCEPTIONS, gm2-libs-iso/ConvStringReal, M2 ISO Libraries
+@subsection gm2-libs-iso/ConvTypes
+
+@example
+DEFINITION MODULE ConvTypes;
+
+  (* Common types used in the string conversion modules *)
+
+TYPE
+@findex ConvResults (type)
+  ConvResults =     (* Values of this type are used to express the format of a string *)
+  (
+    strAllRight,    (* the string format is correct for the corresponding conversion *)
+    strOutOfRange,  (* the string is well-formed but the value cannot be represented *)
+    strWrongFormat, (* the string is in the wrong format for the conversion *)
+    strEmpty        (* the given string is empty *)
+  );
+
+@findex ScanClass (type)
+  ScanClass =  (* Values of this type are used to classify input to finite state scanners *)
+  (
+    padding,   (* a leading or padding character at this point in the scan - ignore it *)
+    valid,     (* a valid character at this point in the scan - accept it *)
+    invalid,   (* an invalid character at this point in the scan - reject it *)
+    terminator (* a terminating character at this point in the scan (not part of token) *)
+  );
+
+@findex ScanState (type)
+  ScanState =  (* The type of lexical scanning control procedures *)
+    PROCEDURE (CHAR, VAR ScanClass, VAR ScanState);
+
+END ConvTypes.
+
+@end example
+@page
+
+@node gm2-libs-iso/EXCEPTIONS, gm2-libs-iso/ErrnoCategory, gm2-libs-iso/ConvTypes, M2 ISO Libraries
+@subsection gm2-libs-iso/EXCEPTIONS
+
+@example
+DEFINITION MODULE EXCEPTIONS;
+
+(* Provides facilities for raising user exceptions
+   and for making enquiries concerning the current execution state.
+*)
+
+TYPE
+  ExceptionSource;   (* values of this type are used within library
+                        modules to identify the source of raised
+                        exceptions *)
+@findex ExceptionNumber (type)
+  ExceptionNumber = CARDINAL;
+
+@findex AllocateSource
+PROCEDURE AllocateSource(VAR newSource: ExceptionSource);
+  (* Allocates a unique value of type ExceptionSource *)
+
+@findex RAISE
+PROCEDURE RAISE (source: ExceptionSource;
+                 number: ExceptionNumber; message: ARRAY OF CHAR);
+  (* Associates the given values of source, number and message with
+     the current context and raises an exception.
+  *)
+
+@findex CurrentNumber
+PROCEDURE CurrentNumber (source: ExceptionSource): ExceptionNumber;
+  (* If the current coroutine is in the exceptional execution state
+     because of the raising of an exception from source, returns
+     the corresponding number, and otherwise raises an exception.
+  *)
+
+@findex GetMessage
+PROCEDURE GetMessage (VAR text: ARRAY OF CHAR);
+  (* If the current coroutine is in the exceptional execution state,
+     returns the possibly truncated string associated with the
+     current context.  Otherwise, in normal execution state,
+     returns the empty string.
+  *)
+
+@findex IsCurrentSource
+PROCEDURE IsCurrentSource (source: ExceptionSource): BOOLEAN;
+  (* If the current coroutine is in the exceptional execution state
+     because of the raising of an exception from source, returns
+     TRUE, and otherwise returns FALSE.
+  *)
+
+@findex IsExceptionalExecution
+PROCEDURE IsExceptionalExecution (): BOOLEAN;
+  (* If the current coroutine is in the exceptional execution state
+     because of the raising of an exception, returns TRUE, and
+     otherwise returns FALSE.
+  *)
+
+END EXCEPTIONS.
+@end example
+@page
+
+@node gm2-libs-iso/ErrnoCategory, gm2-libs-iso/GeneralUserExceptions, gm2-libs-iso/EXCEPTIONS, M2 ISO Libraries
+@subsection gm2-libs-iso/ErrnoCategory
+
+@example
+DEFINITION MODULE ErrnoCategory ;
+
+(*
+   provides an interface to errno (if the system
+   supports it) which determines whether the current
+   errno is a hard or soft error.  These distinctions
+   are needed by the ISO Modula-2 libraries.  Not all
+   errno values are tested, only those which could be
+   related to a device.
+*)
+
+IMPORT ChanConsts ;
+
+
+(*
+   IsErrnoHard - returns TRUE if the value of errno is associated with
+                 a hard device error.
+*)
+
+@findex IsErrnoHard
+PROCEDURE IsErrnoHard (e: INTEGER) : BOOLEAN ;
+
+
+(*
+   IsErrnoSoft - returns TRUE if the value of errno is associated with
+                 a soft device error.
+*)
+
+@findex IsErrnoSoft
+PROCEDURE IsErrnoSoft (e: INTEGER) : BOOLEAN ;
+
+
+(*
+   UnAvailable - returns TRUE if the value of errno indicates that
+                 the resource or device is unavailable for some
+                 reason.
+*)
+
+@findex UnAvailable
+PROCEDURE UnAvailable (e: INTEGER) : BOOLEAN ;
+
+
+(*
+   GetOpenResults - maps errno onto the ISO Modula-2 enumerated
+                    type, OpenResults.
+*)
+
+@findex GetOpenResults
+PROCEDURE GetOpenResults (e: INTEGER) : ChanConsts.OpenResults ;
+
+
+END ErrnoCategory.
+@end example
+@page
+
+@node gm2-libs-iso/GeneralUserExceptions, gm2-libs-iso/IOChan, gm2-libs-iso/ErrnoCategory, M2 ISO Libraries
+@subsection gm2-libs-iso/GeneralUserExceptions
+
+@example
+DEFINITION MODULE GeneralUserExceptions;
+
+(* Provides facilities for general user-defined exceptions *)
+
+TYPE
+@findex GeneralExceptions (type)
+  GeneralExceptions = (problem, disaster);
+
+@findex RaiseGeneralException
+PROCEDURE RaiseGeneralException (exception: GeneralExceptions;
+                                 text: ARRAY OF CHAR);
+  (* Raises exception using text as the associated message *)
+
+@findex IsGeneralException
+PROCEDURE IsGeneralException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception from
+     GeneralExceptions; otherwise returns FALSE.
+  *)
+
+@findex GeneralException
+PROCEDURE GeneralException(): GeneralExceptions;
+  (* If the current coroutine is in the exceptional execution
+     state because of the raising of an exception from
+     GeneralExceptions, returns the corresponding enumeration value,
+     and otherwise raises an exception.
+  *)
+
+END GeneralUserExceptions.
+@end example
+@page
+
+@node gm2-libs-iso/IOChan, gm2-libs-iso/IOConsts, gm2-libs-iso/GeneralUserExceptions, M2 ISO Libraries
+@subsection gm2-libs-iso/IOChan
+
+@example
+DEFINITION MODULE IOChan;
+
+  (* Types and procedures forming the interface to channels for
+     device-independent data transfer modules
+  *)
+
+IMPORT IOConsts, ChanConsts, SYSTEM;
+
+TYPE
+  ChanId; (* Values of this type are used to identify channels *)
+
+  (* There is one pre-defined value identifying an invalid channel
+     on which no data transfer operations are available.  It may
+     be used to initialize variables of type ChanId.
+  *)
+
+@findex InvalidChan
+PROCEDURE InvalidChan (): ChanId;
+  (* Returns the value identifying the invalid channel. *)
+
+  (* For each of the following operations, if the device supports
+     the operation on the channel, the behaviour of the procedure
+     conforms with the description below.  The full behaviour is
+     defined for each device module.  If the device does not
+     support the operation on the channel, the behaviour of the
+     procedure is to raise the exception notAvailable.
+  *)
+
+  (* Text operations - these perform any required translation between the
+     internal and external representation of text.
+  *)
+
+@findex Look
+PROCEDURE Look (cid: ChanId; VAR ch: CHAR; VAR res: IOConsts.ReadResults);
+  (* If there is a character as the next item in the input stream
+     cid, assigns its value to ch without removing it from the stream;
+     otherwise the value of ch is not defined.  res (and the stored
+     read result) are set to the value allRight, endOfLine, or endOfInput.
+  *)
+
+@findex Skip
+PROCEDURE Skip (cid: ChanId);
+  (* If the input stream cid has ended, the exception skipAtEnd
+     is raised; otherwise the next character or line mark in cid is
+     removed, and the stored read result is set to the value
+     allRight.
+  *)
+
+@findex SkipLook
+PROCEDURE SkipLook (cid: ChanId; VAR ch: CHAR; VAR res: IOConsts.ReadResults);
+  (* If the input stream cid has ended, the exception skipAtEnd is
+     raised; otherwise the next character or line mark in cid is
+     removed.  If there is a character as the next item in cid
+     stream, assigns its value to ch without removing it from the
+     stream.  Otherwise, the value of ch is not defined.  res
+     (and the stored read result) are set to the value allRight,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteLn
+PROCEDURE WriteLn (cid: ChanId);
+  (* Writes a line mark over the channel cid. *)
+
+@findex TextRead
+PROCEDURE TextRead (cid: ChanId; to: SYSTEM.ADDRESS; maxChars: CARDINAL;
+                    VAR charsRead: CARDINAL);
+  (* Reads at most maxChars characters from the current line in cid,
+     and assigns corresponding values to successive components of
+     an ARRAY OF CHAR variable for which the address of the first
+     component is to. The number of characters read is assigned to charsRead.
+     The stored read result is set to allRight, endOfLine, or endOfInput.
+  *)
+
+@findex TextWrite
+PROCEDURE TextWrite (cid: ChanId; from: SYSTEM.ADDRESS;
+                     charsToWrite: CARDINAL);
+  (* Writes a number of characters given by the value of charsToWrite,
+     from successive components of an ARRAY OF CHAR variable for which
+     the address of the first component is from, to the channel cid.
+  *)
+
+  (* Direct raw operations  - these do not effect translation between
+     the internal and external representation of data
+  *)
+
+@findex RawRead
+PROCEDURE RawRead (cid: ChanId; to: SYSTEM.ADDRESS; maxLocs: CARDINAL;
+                   VAR locsRead: CARDINAL);
+  (* Reads at most maxLocs items from cid, and assigns corresponding
+     values to successive components of an ARRAY OF LOC variable for
+     which the address of the first component is to. The number of
+     characters read is assigned to charsRead. The stored read result
+     is set to the value allRight, or endOfInput.
+  *)
+
+@findex RawWrite
+PROCEDURE RawWrite (cid: ChanId; from: SYSTEM.ADDRESS; locsToWrite: CARDINAL);
+  (* Writes a number of items given by the value of charsToWrite,
+     from successive components of an ARRAY OF LOC variable for
+     which the address of the first component is from, to the channel cid.
+  *)
+
+  (* Common operations *)
+
+@findex GetName
+PROCEDURE GetName (cid: ChanId; VAR s: ARRAY OF CHAR);
+  (* Copies to s a name associated with the channel cid, possibly truncated
+     (depending on the capacity of s).
+  *)
+
+@findex Reset
+PROCEDURE Reset (cid: ChanId);
+  (* Resets the channel cid to a state defined by the device module. *)
+
+@findex Flush
+PROCEDURE Flush (cid: ChanId);
+  (* Flushes any data buffered by the device module out to the channel cid. *)
+
+  (* Access to read results *)
+
+@findex SetReadResult
+PROCEDURE SetReadResult (cid: ChanId; res: IOConsts.ReadResults);
+  (* Sets the read result value for the channel cid to the value res. *)
+
+@findex ReadResult
+PROCEDURE ReadResult (cid: ChanId): IOConsts.ReadResults;
+  (* Returns the stored read result value for the channel cid.
+     (This is initially the value notKnown).
+  *)
+
+  (* Users can discover which flags actually apply to a channel *)
+
+@findex CurrentFlags
+PROCEDURE CurrentFlags (cid: ChanId): ChanConsts.FlagSet;
+  (* Returns the set of flags that currently apply to the channel cid. *)
+
+  (* The following exceptions are defined for this module and its clients *)
+
+TYPE
+@findex ChanExceptions (type)
+  ChanExceptions =
+    (wrongDevice,      (* device specific operation on wrong device *)
+     notAvailable,     (* operation attempted that is not available on that
+                          channel *)
+     skipAtEnd,        (* attempt to skip data from a stream that has ended *)
+     softDeviceError,  (* device specific recoverable error *)
+     hardDeviceError,  (* device specific non-recoverable error *)
+     textParseError,   (* input data does not correspond to a character or
+                          line mark - optional detection *)
+     notAChannel       (* given value does not identify a channel -
+                          optional detection *)
+    );
+
+@findex IsChanException
+PROCEDURE IsChanException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception from
+     ChanExceptions; otherwise returns FALSE.
+  *)
+
+@findex ChanException
+PROCEDURE ChanException (): ChanExceptions;
+  (* If the current coroutine is in the exceptional execution state
+     because of the raising of an exception from ChanExceptions,
+     returns the corresponding enumeration value, and otherwise
+     raises an exception.
+  *)
+
+  (* When a device procedure detects a device error, it raises the
+     exception softDeviceError or hardDeviceError.  If these
+     exceptions are handled, the following facilities may be
+     used to discover an implementation-defined error number for
+     the channel.
+  *)
+
+TYPE
+@findex DeviceErrNum (type)
+  DeviceErrNum = INTEGER;
+
+@findex DeviceError
+PROCEDURE DeviceError (cid: ChanId): DeviceErrNum;
+  (* If a device error exception has been raised for the channel cid,
+     returns the error number stored by the device module.
+  *)
+
+END IOChan.
+@end example
+@page
+
+@node gm2-libs-iso/IOConsts, gm2-libs-iso/IOLink, gm2-libs-iso/IOChan, M2 ISO Libraries
+@subsection gm2-libs-iso/IOConsts
+
+@example
+DEFINITION MODULE IOConsts;
+
+  (* Types and constants for input/output modules *)
+
+TYPE
+@findex ReadResults (type)
+  ReadResults =  (* This type is used to classify the result of an input operation *)
+  (
+    notKnown,    (* no read result is set *)
+    allRight,    (* data is as expected or as required *)
+    outOfRange,  (* data cannot be represented *)
+    wrongFormat, (* data not in expected format *)
+    endOfLine,   (* end of line seen before expected data *)
+    endOfInput   (* end of input seen before expected data *)
+  );
+
+END IOConsts.
+
+@end example
+@page
+
+@node gm2-libs-iso/IOLink, gm2-libs-iso/IOResult, gm2-libs-iso/IOConsts, M2 ISO Libraries
+@subsection gm2-libs-iso/IOLink
+
+@example
+DEFINITION MODULE IOLink;
+
+(* Types and procedures for the standard implementation of channels *)
+
+IMPORT IOChan, IOConsts, ChanConsts, SYSTEM;
+
+TYPE
+  DeviceId;
+    (* Values of this type are used to identify new device modules,
+       and are normally obtained by them during their initialization.
+    *)
+
+@findex AllocateDeviceId
+PROCEDURE AllocateDeviceId (VAR did: DeviceId);
+  (* Allocates a unique value of type DeviceId, and assigns this
+     value to did. *)
+
+@findex MakeChan
+PROCEDURE MakeChan (did: DeviceId; VAR cid: IOChan.ChanId);
+  (* Attempts to make a new channel for the device module identified
+     by did. If no more channels can be made, the identity of
+     the invalid channel is assigned to cid.  Otherwise, the identity
+     of a new channel is assigned to cid.
+  *)
+
+@findex UnMakeChan
+PROCEDURE UnMakeChan (did: DeviceId; VAR cid: IOChan.ChanId);
+  (* If the device module identified by did is not the module that
+     made the channel identified by cid, the exception wrongDevice is
+     raised; otherwise the channel is deallocated, and the value
+     identifying the invalid channel is assigned to cid.
+  *)
+
+TYPE
+@findex DeviceTablePtr (type)
+  DeviceTablePtr = POINTER TO DeviceTable;
+    (* Values of this type are used to refer to device tables *)
+
+TYPE
+@findex LookProc (type)
+  LookProc      = PROCEDURE (DeviceTablePtr, VAR CHAR, VAR IOConsts.ReadResults) ;
+@findex SkipProc (type)
+  SkipProc      = PROCEDURE (DeviceTablePtr) ;
+@findex SkipLookProc (type)
+  SkipLookProc  = PROCEDURE (DeviceTablePtr, VAR CHAR, VAR IOConsts.ReadResults) ;
+@findex WriteLnProc (type)
+  WriteLnProc   = PROCEDURE (DeviceTablePtr) ;
+@findex TextReadProc (type)
+  TextReadProc  = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL, VAR CARDINAL) ;
+@findex TextWriteProc (type)
+  TextWriteProc = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL) ;
+@findex RawReadProc (type)
+  RawReadProc   = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL, VAR CARDINAL) ;
+@findex RawWriteProc (type)
+  RawWriteProc  = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL) ;
+@findex GetNameProc (type)
+  GetNameProc   = PROCEDURE (DeviceTablePtr, VAR ARRAY OF CHAR) ;
+@findex ResetProc (type)
+  ResetProc     = PROCEDURE (DeviceTablePtr) ;
+@findex FlushProc (type)
+  FlushProc     = PROCEDURE (DeviceTablePtr) ;
+@findex FreeProc (type)
+  FreeProc      = PROCEDURE (DeviceTablePtr) ;
+     (* Carry out the operations involved in closing the corresponding
+        channel, including flushing buffers, but do not unmake the
+        channel.
+     *)
+
+
+TYPE
+@findex DeviceData (type)
+  DeviceData = SYSTEM.ADDRESS;
+
+@findex DeviceTable (type)
+  DeviceTable =
+    RECORD                         (* Initialized by MakeChan to: *)
+      cd: DeviceData;              (* the value NIL *)
+      did: DeviceId;               (* the value given in the call of MakeChan *)
+      cid: IOChan.ChanId;          (* the identity of the channel *)
+      result: IOConsts.ReadResults;(* the value notKnown *)
+      errNum: IOChan.DeviceErrNum; (* undefined *)
+      flags: ChanConsts.FlagSet;   (* ChanConsts.FlagSet@{@} *)
+      doLook: LookProc;            (* raise exception notAvailable *)
+      doSkip: SkipProc;            (* raise exception notAvailable *)
+      doSkipLook: SkipLookProc;    (* raise exception notAvailable *)
+      doLnWrite: WriteLnProc;      (* raise exception notAvailable *)
+      doTextRead: TextReadProc;    (* raise exception notAvailable *)
+      doTextWrite: TextWriteProc;  (* raise exception notAvailable *)
+      doRawRead: RawReadProc;      (* raise exception notAvailable *)
+      doRawWrite: RawWriteProc;    (* raise exception notAvailable *)
+      doGetName: GetNameProc;      (* return the empty string *)
+      doReset: ResetProc;          (* do nothing *)
+      doFlush: FlushProc;          (* do nothing *)
+      doFree: FreeProc;            (* do nothing *)
+    END;
+
+
+  (* The pointer to the device table for a channel is obtained using the
+     following procedure: *)
+
+(*
+   If the device module identified by did is not the module that made
+   the channel identified by cid, the exception wrongDevice is raised.
+*)
+
+@findex DeviceTablePtrValue
+PROCEDURE DeviceTablePtrValue (cid: IOChan.ChanId; did: DeviceId): DeviceTablePtr;
+
+
+(*
+   Tests if the device module identified by did is the module
+   that made the channel identified by cid.
+*)
+
+@findex IsDevice
+PROCEDURE IsDevice (cid: IOChan.ChanId; did: DeviceId) : BOOLEAN;
+
+
+TYPE
+@findex DevExceptionRange (type)
+  DevExceptionRange = IOChan.ChanExceptions;
+
+(*
+  ISO standard states defines
+
+  DevExceptionRange = [IOChan.notAvailable ..  IOChan.textParseError];
+
+  however this must be a bug as other modules need to raise
+  IOChan.wrongDevice exceptions.
+*)
+
+@findex RAISEdevException
+PROCEDURE RAISEdevException (cid: IOChan.ChanId; did: DeviceId;
+                             x: DevExceptionRange; s: ARRAY OF CHAR);
+
+  (* If the device module identified by did is not the module that made the channel
+     identified by cid, the exception wrongDevice is raised; otherwise the given exception
+     is raised, and the string value in s is included in the exception message.
+  *)
+
+@findex IsIOException
+PROCEDURE IsIOException () : BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising af an exception from ChanExceptions;
+     otherwise FALSE.
+  *)
+
+@findex IOException
+PROCEDURE IOException () : IOChan.ChanExceptions;
+  (* If the current coroutine is in the exceptional execution state because of the
+     raising af an exception from ChanExceptions, returns the corresponding
+     enumeration value, and otherwise raises an exception.
+  *)
+
+END IOLink.
+@end example
+@page
+
+@node gm2-libs-iso/IOResult, gm2-libs-iso/LongComplexMath, gm2-libs-iso/IOLink, M2 ISO Libraries
+@subsection gm2-libs-iso/IOResult
+
+@example
+DEFINITION MODULE IOResult;
+
+  (* Read results for specified channels *)
+
+IMPORT IOConsts, IOChan;
+
+TYPE
+@findex ReadResults (type)
+  ReadResults = IOConsts.ReadResults;
+
+  (*
+@findex ReadResults (type)
+    ReadResults =  (* This type is used to classify the result of an input operation *)
+    (
+      notKnown,    (* no read result is set *)
+      allRight,    (* data is as expected or as required *)
+      outOfRange,  (* data cannot be represented *)
+      wrongFormat, (* data not in expected format *)
+      endOfLine,   (* end of line seen before expected data *)
+      endOfInput   (* end of input seen before expected data *)
+    );
+  *)
+
+@findex ReadResult
+PROCEDURE ReadResult (cid: IOChan.ChanId): ReadResults;
+  (* Returns the result for the last read operation on the channel cid. *)
+
+END IOResult.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongComplexMath, gm2-libs-iso/LongConv, gm2-libs-iso/IOResult, M2 ISO Libraries
+@subsection gm2-libs-iso/LongComplexMath
+
+@example
+DEFINITION MODULE LongComplexMath;
+
+  (* Mathematical functions for the type LONGCOMPLEX *)
+
+CONST
+@findex i (const)
+  i =    CMPLX (0.0, 1.0);
+@findex one (const)
+  one =  CMPLX (1.0, 0.0);
+@findex zero (const)
+  zero = CMPLX (0.0, 0.0);
+
+@findex abs
+PROCEDURE abs (z: LONGCOMPLEX): LONGREAL;
+  (* Returns the length of z *)
+
+@findex arg
+PROCEDURE arg (z: LONGCOMPLEX): LONGREAL;
+  (* Returns the angle that z subtends to the positive real axis *)
+
+@findex conj
+PROCEDURE conj (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the complex conjugate of z *)
+
+@findex power
+PROCEDURE power (base: LONGCOMPLEX; exponent: LONGREAL): LONGCOMPLEX;
+  (* Returns the value of the number base raised to the power exponent *)
+
+@findex sqrt
+PROCEDURE sqrt (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the principal square root of z *)
+
+@findex exp
+PROCEDURE exp (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the complex exponential of z *)
+
+@findex ln
+PROCEDURE ln (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the principal value of the natural logarithm of z *)
+
+@findex sin
+PROCEDURE sin (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the sine of z *)
+
+@findex cos
+PROCEDURE cos (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the cosine of z *)
+
+@findex tan
+PROCEDURE tan (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the tangent of z *)
+
+@findex arcsin
+PROCEDURE arcsin (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the arcsine of z *)
+
+@findex arccos
+PROCEDURE arccos (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the arccosine of z *)
+
+@findex arctan
+PROCEDURE arctan (z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the arctangent of z *)
+
+@findex polarToComplex
+PROCEDURE polarToComplex (abs, arg: LONGREAL): LONGCOMPLEX;
+  (* Returns the complex number with the specified polar coordinates *)
+
+@findex scalarMult
+PROCEDURE scalarMult (scalar: LONGREAL; z: LONGCOMPLEX): LONGCOMPLEX;
+  (* Returns the scalar product of scalar with z *)
+
+@findex IsCMathException
+PROCEDURE IsCMathException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END LongComplexMath.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongConv, gm2-libs-iso/LongIO, gm2-libs-iso/LongComplexMath, M2 ISO Libraries
+@subsection gm2-libs-iso/LongConv
+
+@example
+DEFINITION MODULE LongConv;
+
+  (* Low-level LONGREAL/string conversions *)
+
+IMPORT
+  ConvTypes;
+
+TYPE
+@findex ConvResults (type)
+  ConvResults = ConvTypes.ConvResults; (* strAllRight, strOutOfRange,
+                                          strWrongFormat, strEmpty *)
+
+@findex ScanReal
+PROCEDURE ScanReal (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
+                    VAR nextState: ConvTypes.ScanState);
+  (* Represents the start state of a finite state scanner for real
+     numbers - assigns class of inputCh to chClass and a procedure
+     representing the next state to nextState.
+  *)
+
+@findex FormatReal
+PROCEDURE FormatReal (str: ARRAY OF CHAR): ConvResults;
+  (* Returns the format of the string value for conversion to LONGREAL. *)
+
+@findex ValueReal
+PROCEDURE ValueReal (str: ARRAY OF CHAR): LONGREAL;
+  (* Returns the value corresponding to the real number string value
+     str if str is well-formed; otherwise raises the LongConv exception.
+  *)
+
+@findex LengthFloatReal
+PROCEDURE LengthFloatReal (real: LONGREAL; sigFigs: CARDINAL): CARDINAL;
+  (* Returns the number of characters in the floating-point string
+     representation of real with sigFigs significant figures.
+  *)
+
+@findex LengthEngReal
+PROCEDURE LengthEngReal (real: LONGREAL; sigFigs: CARDINAL): CARDINAL;
+  (* Returns the number of characters in the floating-point engineering
+     string representation of real with sigFigs significant figures.
+  *)
+
+@findex LengthFixedReal
+PROCEDURE LengthFixedReal (real: LONGREAL; place: INTEGER): CARDINAL;
+  (* Returns the number of characters in the fixed-point string
+     representation of real rounded to the given place relative to the
+     decimal point.
+  *)
+
+@findex IsRConvException
+PROCEDURE IsRConvException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception in a
+     routine from this module; otherwise returns FALSE.
+  *)
+
+END LongConv.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongIO, gm2-libs-iso/LongMath, gm2-libs-iso/LongConv, M2 ISO Libraries
+@subsection gm2-libs-iso/LongIO
+
+@example
+DEFINITION MODULE LongIO;
+
+  (* Input and output of long real numbers in decimal text form
+     over specified channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@}, [".",
+       @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: LONGREAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed fixed or floating
+     point number.  The value of this number is assigned to real.
+     The read result is set to the value allRight, outOfRange,
+     wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (cid: IOChan.ChanId; real: LONGREAL;
+                      sigFigs: CARDINAL; width: CARDINAL);
+  (* Writes the value of real to cid in floating-point text form,
+     with sigFigs significant figures, in a field of the given
+     minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (cid: IOChan.ChanId; real: LONGREAL;
+                    sigFigs: CARDINAL; width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with
+     one to three digits in the whole number part, and with an
+     exponent that is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (cid: IOChan.ChanId; real: LONGREAL;
+                      place: INTEGER; width: CARDINAL);
+  (* Writes the value of real to cid in fixed-point text form,
+     rounded to the given place relative to the decimal point,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (cid: IOChan.ChanId; real: LONGREAL;
+                     width: CARDINAL);
+  (* Writes the value of real to cid, as WriteFixed if the
+     sign and magnitude can be shown in the given width, or
+     otherwise as WriteFloat.  The number of places or
+     significant digits depends on the given width.
+  *)
+
+END LongIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongMath, gm2-libs-iso/LongStr, gm2-libs-iso/LongIO, M2 ISO Libraries
+@subsection gm2-libs-iso/LongMath
+
+@example
+DEFINITION MODULE LongMath;
+
+  (* Mathematical functions for the type LONGREAL *)
+
+CONST
+@findex pi (const)
+  pi   = 3.1415926535897932384626433832795028841972;
+@findex exp1 (const)
+  exp1 = 2.7182818284590452353602874713526624977572;
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: LONGREAL): LONGREAL;
+  (* Returns the positive square root of x *)
+
+@findex exp
+PROCEDURE __BUILTIN__ exp (x: LONGREAL): LONGREAL;
+  (* Returns the exponential of x *)
+
+@findex ln
+PROCEDURE __BUILTIN__ ln (x: LONGREAL): LONGREAL;
+  (* Returns the natural logarithm of x *)
+
+  (* The angle in all trigonometric functions is measured in radians *)
+
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: LONGREAL): LONGREAL;
+  (* Returns the sine of x *)
+
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: LONGREAL): LONGREAL;
+  (* Returns the cosine of x *)
+
+@findex tan
+PROCEDURE tan (x: LONGREAL): LONGREAL;
+  (* Returns the tangent of x *)
+
+@findex arcsin
+PROCEDURE arcsin (x: LONGREAL): LONGREAL;
+  (* Returns the arcsine of x *)
+
+@findex arccos
+PROCEDURE arccos (x: LONGREAL): LONGREAL;
+  (* Returns the arccosine of x *)
+
+@findex arctan
+PROCEDURE arctan (x: LONGREAL): LONGREAL;
+  (* Returns the arctangent of x *)
+
+@findex power
+PROCEDURE power (base, exponent: LONGREAL): LONGREAL;
+  (* Returns the value of the number base raised to the power exponent *)
+
+@findex round
+PROCEDURE round (x: LONGREAL): INTEGER;
+  (* Returns the value of x rounded to the nearest integer *)
+
+@findex IsRMathException
+PROCEDURE IsRMathException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception in a
+     routine from this module; otherwise returns FALSE.
+  *)
+
+END LongMath.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongStr, gm2-libs-iso/LongWholeIO, gm2-libs-iso/LongMath, M2 ISO Libraries
+@subsection gm2-libs-iso/LongStr
+
+@example
+DEFINITION MODULE LongStr;
+
+  (* LONGREAL/string conversions *)
+
+IMPORT
+   ConvTypes;
+
+TYPE
+   (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
+@findex ConvResults (type)
+   ConvResults = ConvTypes.ConvResults;
+
+(* the string form of a signed fixed-point real number is
+     ["+" | "-"], decimal digit, @{decimal digit@}, [".",
+     @{decimal digit@}]
+*)
+
+(* the string form of a signed floating-point real number is
+     signed fixed-point real number, "E", ["+" | "-"],
+     decimal digit, @{decimal digit@}
+*)
+
+@findex StrToReal
+PROCEDURE StrToReal (str: ARRAY OF CHAR; VAR real: LONGREAL;
+                     VAR res: ConvResults);
+  (* Ignores any leading spaces in str. If the subsequent characters
+     in str are in the format of a signed real number, assigns a
+     corresponding value to real.  Assigns a value indicating the
+     format of str to res.
+  *)
+
+@findex RealToFloat
+PROCEDURE RealToFloat (real: LONGREAL; sigFigs: CARDINAL;
+                       VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to floating-point string form, with
+     sigFigs significant figures, and copies the possibly truncated
+     result to str.
+  *)
+
+@findex RealToEng
+PROCEDURE RealToEng (real: LONGREAL; sigFigs: CARDINAL;
+                     VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to floating-point string form, with
+     sigFigs significant figures, and copies the possibly truncated
+     result to str. The number is scaled with one to three digits
+     in the whole number part and with an exponent that is a
+     multiple of three.
+  *)
+
+@findex RealToFixed
+PROCEDURE RealToFixed (real: LONGREAL; place: INTEGER;
+                       VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to fixed-point string form, rounded
+     to the given place relative to the decimal point, and copies
+     the possibly truncated result to str.
+  *)
+
+@findex RealToStr
+PROCEDURE RealToStr (real: LONGREAL; VAR str: ARRAY OF CHAR);
+  (* Converts the value of real as RealToFixed if the sign and
+     magnitude can be shown within the capacity of str, or
+     otherwise as RealToFloat, and copies the possibly truncated
+     result to str. The number of places or significant digits
+     depend on the capacity of str.
+  *)
+
+END LongStr.
+
+@end example
+@page
+
+@node gm2-libs-iso/LongWholeIO, gm2-libs-iso/LowLong, gm2-libs-iso/LongStr, M2 ISO Libraries
+@subsection gm2-libs-iso/LongWholeIO
+
+@example
+DEFINITION MODULE LongWholeIO;
+
+  (* Input and output of whole numbers in decimal text form
+     over specified channels.  The read result is of the
+     type IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: LONGINT);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed whole number.  The
+     value of this number is assigned to int.  The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (cid: IOChan.ChanId; int: LONGINT;
+                    width: CARDINAL);
+  (* Writes the value of int to cid in text form, in a field of
+     the given minimum width. *)
+
+@findex ReadCard
+PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: LONGCARD);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of an unsigned whole number.  The
+     value of this number is assigned to card. The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (cid: IOChan.ChanId; card: LONGCARD;
+                     width: CARDINAL);
+  (* Writes the value of card to cid in text form, in a field
+     of the given minimum width. *)
+
+END LongWholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/LowLong, gm2-libs-iso/LowReal, gm2-libs-iso/LongWholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/LowLong
+
+@example
+DEFINITION MODULE LowLong;
+
+  (* Access to underlying properties of the type LONGREAL *)
+
+CONST
+@findex radix (const)
+  radix      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, radix> )) ;      (* ZType *)
+@findex places (const)
+  places     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, places> )) ;     (* ZType *)
+@findex expoMin (const)
+  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, expoMin> )) ;    (* ZType *)
+@findex expoMax (const)
+  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, expoMax> )) ;    (* ZType *)
+@findex large (const)
+  large      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, large> )) ;      (* RType *)
+@findex small (const)
+  small      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, small> )) ;      (* RType *)
+@findex IEC559 (const)
+  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, IEC559> )) ;     (* BOOLEAN *)
+@findex LIA1 (const)
+  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, LIA1> )) ;       (* BOOLEAN *)
+@findex ISO (const)
+  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, ISO> )) ;        (* BOOLEAN *)
+@findex IEEE (const)
+  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, IEEE> )) ;       (* BOOLEAN *)
+@findex rounds (const)
+  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, rounds> )) ;     (* BOOLEAN *)
+@findex gUnderflow (const)
+  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, gUnderflow> )) ; (* BOOLEAN *)
+@findex exception (const)
+  exception  = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, exception> )) ;  (* BOOLEAN *)
+@findex extend (const)
+  extend     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, extend> )) ;     (* BOOLEAN *)
+@findex nModes (const)
+  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, nModes> )) ;     (* ZType *)
+
+TYPE
+@findex Modes (type)
+  Modes = PACKEDSET OF [0 .. nModes-1];
+
+@findex exponent
+PROCEDURE exponent (x: LONGREAL): INTEGER;
+  (* Returns the exponent value of x *)
+
+@findex fraction
+PROCEDURE fraction (x: LONGREAL): LONGREAL;
+  (* Returns the significand (or significant part) of x *)
+
+@findex sign
+PROCEDURE sign (x: LONGREAL): LONGREAL;
+  (* Returns the signum of x *)
+
+@findex succ
+PROCEDURE succ (x: LONGREAL): LONGREAL;
+  (* Returns the next value of the type LONGREAL greater than x *)
+
+@findex ulp
+PROCEDURE ulp (x: LONGREAL): LONGREAL;
+  (* Returns the value of a unit in the last place of x *)
+
+@findex pred
+PROCEDURE pred (x: LONGREAL): LONGREAL;
+  (* Returns the previous value of the type LONGREAL less than x *)
+
+@findex intpart
+PROCEDURE intpart (x: LONGREAL): LONGREAL;
+  (* Returns the integer part of x *)
+
+@findex fractpart
+PROCEDURE fractpart (x: LONGREAL): LONGREAL;
+  (* Returns the fractional part of x *)
+
+@findex scale
+PROCEDURE scale (x: LONGREAL; n: INTEGER): LONGREAL;
+  (* Returns the value of x * radix ** n *)
+
+@findex trunc
+PROCEDURE trunc (x: LONGREAL; n: INTEGER): LONGREAL;
+  (* Returns the value of the first n places of x *)
+
+@findex round
+PROCEDURE round (x: LONGREAL; n: INTEGER): LONGREAL;
+  (* Returns the value of x rounded to the first n places *)
+
+@findex synthesize
+PROCEDURE synthesize (expart: INTEGER; frapart: LONGREAL): LONGREAL;
+  (* Returns a value of the type LONGREAL constructed from the given expart and frapart *)
+
+@findex setMode
+PROCEDURE setMode (m: Modes);
+  (* Sets status flags appropriate to the underlying implementation of the type LONGREAL *)
+
+@findex currentMode
+PROCEDURE currentMode (): Modes;
+  (* Returns the current status flags in the form set by setMode *)
+
+@findex IsLowException
+PROCEDURE IsLowException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END LowLong.
+
+@end example
+@page
+
+@node gm2-libs-iso/LowReal, gm2-libs-iso/LowShort, gm2-libs-iso/LowLong, M2 ISO Libraries
+@subsection gm2-libs-iso/LowReal
+
+@example
+DEFINITION MODULE LowReal;
+
+  (* Access to underlying properties of the type REAL *)
+
+CONST
+@findex radix (const)
+  radix      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, radix> )) ;      (* ZType *)
+@findex places (const)
+  places     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, places> )) ;     (* ZType *)
+@findex expoMin (const)
+  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMin> )) ;    (* ZType *)
+@findex expoMax (const)
+  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMax> )) ;    (* ZType *)
+@findex large (const)
+  large      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, large> )) ;      (* RType *)
+@findex small (const)
+  small      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, small> )) ;      (* RType *)
+@findex IEC559 (const)
+  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEC559> )) ;     (* BOOLEAN *)
+@findex LIA1 (const)
+  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, LIA1> )) ;       (* BOOLEAN *)
+@findex ISO (const)
+  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <REAL, ISO> )) ;        (* BOOLEAN *)
+@findex IEEE (const)
+  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEEE> )) ;       (* BOOLEAN *)
+@findex rounds (const)
+  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, rounds> )) ;     (* BOOLEAN *)
+@findex gUnderflow (const)
+  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <REAL, gUnderflow> )) ; (* BOOLEAN *)
+@findex exception (const)
+  exception  = __ATTRIBUTE__ __BUILTIN__ (( <REAL, exception> )) ;  (* BOOLEAN *)
+@findex extend (const)
+  extend     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, extend> )) ;     (* BOOLEAN *)
+@findex nModes (const)
+  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, nModes> )) ;     (* ZType *)
+
+TYPE
+@findex Modes (type)
+  Modes = PACKEDSET OF [0..nModes-1];
+
+@findex exponent
+PROCEDURE exponent (x: REAL): INTEGER;
+  (* Returns the exponent value of x *)
+
+@findex fraction
+PROCEDURE fraction (x: REAL): REAL;
+  (* Returns the significand (or significant part) of x *)
+
+@findex sign
+PROCEDURE sign (x: REAL): REAL;
+  (* Returns the signum of x *)
+
+@findex succ
+PROCEDURE succ (x: REAL): REAL;
+  (* Returns the next value of the type REAL greater than x *)
+
+@findex ulp
+PROCEDURE ulp (x: REAL): REAL;
+  (* Returns the value of a unit in the last place of x *)
+
+@findex pred
+PROCEDURE pred (x: REAL): REAL;
+  (* Returns the previous value of the type REAL less than x *)
+
+@findex intpart
+PROCEDURE intpart (x: REAL): REAL;
+  (* Returns the integer part of x *)
+
+@findex fractpart
+PROCEDURE fractpart (x: REAL): REAL;
+  (* Returns the fractional part of x *)
+
+@findex scale
+PROCEDURE scale (x: REAL; n: INTEGER): REAL;
+  (* Returns the value of x * radix ** n *)
+
+@findex trunc
+PROCEDURE trunc (x: REAL; n: INTEGER): REAL;
+  (* Returns the value of the first n places of x *)
+
+@findex round
+PROCEDURE round (x: REAL; n: INTEGER): REAL;
+  (* Returns the value of x rounded to the first n places *)
+
+@findex synthesize
+PROCEDURE synthesize (expart: INTEGER; frapart: REAL): REAL;
+  (* Returns a value of the type REAL constructed from the given expart and frapart *)
+
+@findex setMode
+PROCEDURE setMode (m: Modes);
+  (* Sets status flags appropriate to the underlying implementation of the type REAL *)
+
+@findex currentMode
+PROCEDURE currentMode (): Modes;
+  (* Returns the current status flags in the form set by setMode *)
+
+@findex IsLowException
+PROCEDURE IsLowException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END LowReal.
+
+@end example
+@page
+
+@node gm2-libs-iso/LowShort, gm2-libs-iso/M2EXCEPTION, gm2-libs-iso/LowReal, M2 ISO Libraries
+@subsection gm2-libs-iso/LowShort
+
+@example
+DEFINITION MODULE LowShort;
+
+  (* Access to underlying properties of the type SHORTREAL *)
+
+CONST
+@findex radix (const)
+  radix      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, radix> )) ;      (* ZType *)
+@findex places (const)
+  places     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, places> )) ;     (* ZType *)
+@findex expoMin (const)
+  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMin> )) ;    (* ZType *)
+@findex expoMax (const)
+  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMax> )) ;    (* ZType *)
+@findex large (const)
+  large      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, large> )) ;      (* RType *)
+@findex small (const)
+  small      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, small> )) ;      (* RType *)
+@findex IEC559 (const)
+  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEC559> )) ;     (* BOOLEAN *)
+@findex LIA1 (const)
+  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, LIA1> )) ;       (* BOOLEAN *)
+@findex ISO (const)
+  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, ISO> )) ;        (* BOOLEAN *)
+@findex IEEE (const)
+  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEEE> )) ;       (* BOOLEAN *)
+@findex rounds (const)
+  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, rounds> )) ;     (* BOOLEAN *)
+@findex gUnderflow (const)
+  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, gUnderflow> )) ; (* BOOLEAN *)
+@findex exception (const)
+  exception  = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, exception> )) ;  (* BOOLEAN *)
+@findex extend (const)
+  extend     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, extend> )) ;     (* BOOLEAN *)
+@findex nModes (const)
+  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, nModes> )) ;     (* ZType *)
+
+TYPE
+@findex Modes (type)
+  Modes = PACKEDSET OF [0 .. nModes-1];
+
+@findex exponent
+PROCEDURE exponent (x: SHORTREAL): INTEGER;
+  (* Returns the exponent value of x *)
+
+@findex fraction
+PROCEDURE fraction (x: SHORTREAL): SHORTREAL;
+  (* Returns the significand (or significant part) of x *)
+
+@findex sign
+PROCEDURE sign (x: SHORTREAL): SHORTREAL;
+  (* Returns the signum of x *)
+
+@findex succ
+PROCEDURE succ (x: SHORTREAL): SHORTREAL;
+  (* Returns the next value of the type SHORTREAL greater than x *)
+
+@findex ulp
+PROCEDURE ulp (x: SHORTREAL): SHORTREAL;
+  (* Returns the value of a unit in the last place of x *)
+
+@findex pred
+PROCEDURE pred (x: SHORTREAL): SHORTREAL;
+  (* Returns the previous value of the type SHORTREAL less than x *)
+
+@findex intpart
+PROCEDURE intpart (x: SHORTREAL): SHORTREAL;
+  (* Returns the integer part of x *)
+
+@findex fractpart
+PROCEDURE fractpart (x: SHORTREAL): SHORTREAL;
+  (* Returns the fractional part of x *)
+
+@findex scale
+PROCEDURE scale (x: SHORTREAL; n: INTEGER): SHORTREAL;
+  (* Returns the value of x * radix ** n *)
+
+@findex trunc
+PROCEDURE trunc (x: SHORTREAL; n: INTEGER): SHORTREAL;
+  (* Returns the value of the first n places of x *)
+
+@findex round
+PROCEDURE round (x: SHORTREAL; n: INTEGER): SHORTREAL;
+  (* Returns the value of x rounded to the first n places *)
+
+@findex synthesize
+PROCEDURE synthesize (expart: INTEGER; frapart: SHORTREAL): SHORTREAL;
+  (* Returns a value of the type SHORTREAL constructed from the given expart and frapart *)
+
+@findex setMode
+PROCEDURE setMode (m: Modes);
+  (* Sets status flags appropriate to the underlying implementation of the type SHORTREAL *)
+
+@findex currentMode
+PROCEDURE currentMode (): Modes;
+  (* Returns the current status flags in the form set by setMode *)
+
+@findex IsLowException
+PROCEDURE IsLowException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END LowShort.
+@end example
+@page
+
+@node gm2-libs-iso/M2EXCEPTION, gm2-libs-iso/M2RTS, gm2-libs-iso/LowShort, M2 ISO Libraries
+@subsection gm2-libs-iso/M2EXCEPTION
+
+@example
+DEFINITION MODULE M2EXCEPTION;
+
+(* Provides facilities for identifying language exceptions *)
+
+TYPE
+@findex M2Exceptions (type)
+  M2Exceptions =
+    (indexException,     rangeException,         caseSelectException,  invalidLocation,
+     functionException,  wholeValueException,    wholeDivException,    realValueException,
+     realDivException,   complexValueException,  complexDivException,  protException,
+     sysException,       coException,            exException
+    );
+
+@findex M2Exception
+PROCEDURE M2Exception (): M2Exceptions;
+  (* If the current coroutine is in the exceptional execution state because of the raising
+     of a language exception, returns the corresponding enumeration value, and otherwise
+     raises an exception.
+  *)
+
+@findex IsM2Exception
+PROCEDURE IsM2Exception (): BOOLEAN;
+  (* If the current coroutine is in the exceptional execution state because of the raising
+     of a language exception, returns TRUE, and otherwise returns FALSE.
+  *)
+
+END M2EXCEPTION.
+@end example
+@page
+
+@node gm2-libs-iso/M2RTS, gm2-libs-iso/MemStream, gm2-libs-iso/M2EXCEPTION, M2 ISO Libraries
+@subsection gm2-libs-iso/M2RTS
+
+@example
+DEFINITION MODULE M2RTS ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+TYPE
+@findex ArgCVEnvP (type)
+   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
+
+
+@findex ConstructModules
+PROCEDURE ConstructModules (applicationmodule: ADDRESS;
+                            argc: INTEGER; argv, envp: ADDRESS) ;
+
+@findex DeconstructModules
+PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
+                              argc: INTEGER; argv, envp: ADDRESS) ;
+
+
+(*
+   RegisterModule - adds module name to the list of outstanding
+                    modules which need to have their dependencies
+                    explored to determine initialization order.
+*)
+
+@findex RegisterModule
+PROCEDURE RegisterModule (name: ADDRESS;
+                          init, fini:  ArgCVEnvP;
+                          dependencies: PROC) ;
+
+
+(*
+   RequestDependant - used to specify that modulename is dependant upon
+                      module dependantmodule.
+*)
+
+@findex RequestDependant
+PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
+
+
+(*
+   ExecuteTerminationProcedures - calls each installed termination
+                                  procedure in reverse order.
+*)
+
+@findex ExecuteTerminationProcedures
+PROCEDURE ExecuteTerminationProcedures ;
+
+
+(*
+   InstallTerminationProcedure - installs a procedure, p, which will
+                                 be called when the procedure
+                                 ExecuteTerminationProcedures
+                                 is invoked.  It returns TRUE is the
+                                 procedure is installed.
+*)
+
+@findex InstallTerminationProcedure
+PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
+
+
+(*
+   ExecuteInitialProcedures - executes the initial procedures installed
+                              by InstallInitialProcedure.
+*)
+
+@findex ExecuteInitialProcedures
+PROCEDURE ExecuteInitialProcedures ;
+
+
+(*
+   InstallInitialProcedure - installs a procedure to be executed just
+                             before the BEGIN code section of the main
+                             program module.
+*)
+
+@findex InstallInitialProcedure
+PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
+
+
+(*
+   HALT - terminate the current program.  The procedure
+          ExecuteTerminationProcedures
+          is called before the program is stopped.  The parameter
+          exitcode is optional.  If the parameter is not supplied
+          HALT will call libc 'abort', otherwise it will exit with
+          the code supplied.  Supplying a parameter to HALT has the
+          same effect as calling ExitOnHalt with the same code and
+          then calling HALT with no parameter.
+*)
+
+@findex HALT
+PROCEDURE HALT ([exitcode: INTEGER = -1]) ;
+
+
+(*
+   Halt - provides a more user friendly version of HALT, which takes
+          four parameters to aid debugging.
+*)
+
+@findex Halt
+PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
+                function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
+
+
+(*
+   ExitOnHalt - if HALT is executed then call exit with the exit code, e.
+*)
+
+@findex ExitOnHalt
+PROCEDURE ExitOnHalt (e: INTEGER) ;
+
+
+(*
+   ErrorMessage - emits an error message to stderr and then calls exit (1).
+*)
+
+@findex ErrorMessage
+PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
+                        file: ARRAY OF CHAR;
+                        line: CARDINAL;
+                        function: ARRAY OF CHAR) ;
+
+
+(*
+   IsTerminating - Returns true if any coroutine has started program termination
+                   and false otherwise.
+*)
+
+@findex IsTerminating
+PROCEDURE IsTerminating () : BOOLEAN ;
+
+
+(*
+   HasHalted - Returns true if a call to HALT has been made and false
+               otherwise.
+*)
+
+@findex HasHalted
+PROCEDURE HasHalted () : BOOLEAN ;
+
+
+(*
+   Length - returns the length of a string, a. This is called whenever
+            the user calls LENGTH and the parameter cannot be calculated
+            at compile time.
+*)
+
+@findex Length
+PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
+
+
+(*
+   The following are the runtime exception handler routines.
+*)
+
+@findex AssignmentException
+PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ReturnException
+PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex IncException
+PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex DecException
+PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex InclException
+PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ExclException
+PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ShiftException
+PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex RotateException
+PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex StaticArraySubscriptException
+PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex DynamicArraySubscriptException
+PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopBeginException
+PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopToException
+PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ForLoopEndException
+PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex PointerNilException
+PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex NoReturnException
+PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex CaseException
+PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeNonPosDivException
+PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeNonPosModException
+PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeZeroDivException
+PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeZeroRemException
+PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex WholeValueException
+PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex RealValueException
+PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex ParameterException
+PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+@findex NoException
+PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
+
+
+END M2RTS.
+@end example
+@page
+
+@node gm2-libs-iso/MemStream, gm2-libs-iso/Preemptive, gm2-libs-iso/M2RTS, M2 ISO Libraries
+@subsection gm2-libs-iso/MemStream
+
+@example
+DEFINITION MODULE MemStream ;
+
+(*
+    Description: provides an ISO module which can write to a memory
+                 buffer or read from a memory buffer.
+*)
+
+FROM IOChan IMPORT ChanId ;
+FROM ChanConsts IMPORT FlagSet, OpenResults ;
+FROM SYSTEM IMPORT ADDRESS, LOC ;
+
+
+(*
+   Attempts to obtain and open a channel connected to a contigeous
+   buffer in memory.  The write flag is implied; without the raw
+   flag, text is implied.  If successful, assigns to cid the identity of
+   the opened channel, assigns the value opened to res.
+   If a channel cannot be opened as required,
+   the value of res indicates the reason, and cid identifies the
+   invalid channel.
+
+   The parameters, buffer, length and used maybe updated as
+   data is written.  The buffer maybe reallocated
+   and its address might alter, however the parameters will
+   always reflect the current active buffer.  When this
+   channel is closed the buffer is deallocated and
+   buffer will be set to NIL, length and used will be set to
+   zero.
+*)
+
+@findex OpenWrite
+PROCEDURE OpenWrite (VAR cid: ChanId; flags: FlagSet;
+                     VAR res: OpenResults;
+                     VAR buffer: ADDRESS;
+                     VAR length: CARDINAL;
+                     VAR used: CARDINAL;
+                     deallocOnClose: BOOLEAN) ;
+
+
+(*
+   Attempts to obtain and open a channel connected to a contigeous
+   buffer in memory.  The read and old flags are implied; without
+   the raw flag, text is implied.  If successful, assigns to cid the
+   identity of the opened channel, assigns the value opened to res, and
+   selects input mode, with the read position corresponding to the start
+   of the buffer.  If a channel cannot be opened as required, the value of
+   res indicates the reason, and cid identifies the invalid channel.
+*)
+
+@findex OpenRead
+PROCEDURE OpenRead (VAR cid: ChanId; flags: FlagSet;
+                    VAR res: OpenResults;
+                    buffer: ADDRESS; length: CARDINAL;
+                    deallocOnClose: BOOLEAN) ;
+
+
+(*
+   Close - if the channel identified by cid is not open to
+           a memory stream, the exception wrongDevice is
+           raised; otherwise closes the channel, and assigns
+           the value identifying the invalid channel to cid.
+*)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId) ;
+
+
+(*
+   Rewrite - assigns the buffer index to zero.  Subsequent
+             writes will overwrite the previous buffer contents.
+*)
+
+@findex Rewrite
+PROCEDURE Rewrite (cid: ChanId) ;
+
+
+(*
+   Reread - assigns the buffer index to zero.  Subsequent
+            reads will read the previous buffer contents.
+*)
+
+@findex Reread
+PROCEDURE Reread (cid: ChanId) ;
+
+
+(*
+   IsMem - tests if the channel identified by cid is open as
+           a memory stream.
+*)
+
+@findex IsMem
+PROCEDURE IsMem (cid: ChanId) : BOOLEAN ;
+
+
+END MemStream.
+@end example
+@page
+
+@node gm2-libs-iso/Preemptive, gm2-libs-iso/Processes, gm2-libs-iso/MemStream, M2 ISO Libraries
+@subsection gm2-libs-iso/Preemptive
+
+@example
+DEFINITION MODULE Preemptive ;
+
+
+(*
+   initPreemptive - if microsecs > 0 then turn on preemptive scheduling.
+                    if microsecs = 0 then preemptive scheduling is turned off.
+*)
+
+@findex initPreemptive
+PROCEDURE initPreemptive (seconds, microsecs: CARDINAL) ;
+
+
+END Preemptive.
+@end example
+@page
+
+@node gm2-libs-iso/Processes, gm2-libs-iso/ProgramArgs, gm2-libs-iso/Preemptive, M2 ISO Libraries
+@subsection gm2-libs-iso/Processes
+
+@example
+DEFINITION MODULE Processes;
+
+  (* This module allows concurrent algorithms to be expressed using
+     processes. A process is a unit of a program that has the
+     potential to run in parallel with other processes.
+  *)
+
+IMPORT SYSTEM;
+
+TYPE
+  ProcessId;                      (* Used to identify processes *)
+@findex Parameter (type)
+  Parameter     = SYSTEM.ADDRESS; (* Used to pass data between processes *)
+@findex Body (type)
+  Body          = PROC;           (* Used as the type of a process body *)
+@findex Urgency (type)
+  Urgency       = INTEGER;        (* Used by the internal scheduler *)
+@findex Sources (type)
+  Sources       = CARDINAL;       (* Used to identify event sources *)
+@findex ProcessesExceptions (type)
+  ProcessesExceptions =           (* Exceptions raised by this module *)
+    (passiveProgram, processError);
+
+(* The following procedures create processes and switch control between
+   them. *)
+
+@findex Create
+PROCEDURE Create (procBody: Body; extraSpace: CARDINAL; procUrg: Urgency;
+                  procParams: Parameter; VAR procId: ProcessId);
+  (* Creates a new process with procBody as its body, and with urgency
+     and parameters given by procUrg and procParams.  At least as
+     much workspace (in units of SYSTEM.LOC) as is specified by
+     extraSpace is allocated to the process.
+     An identity for the new process is returned in procId.
+     The process is created in the passive state; it will not run
+     until activated.
+  *)
+
+@findex Start
+PROCEDURE Start (procBody: Body; extraSpace: CARDINAL; procUrg: Urgency;
+                 procParams: Parameter; VAR procId: ProcessId);
+  (* Creates a new process, with parameters as for Create.
+     The process is created in the ready state; it is eligible to
+     run immediately.
+  *)
+
+@findex StopMe
+PROCEDURE StopMe ();
+  (* Terminates the calling process.
+     The process must not be associated with a source of events.
+  *)
+
+@findex SuspendMe
+PROCEDURE SuspendMe ();
+  (* Causes the calling process to enter the passive state.  The
+     procedure only returns when the calling process is again
+     activated by another process.
+  *)
+
+@findex Activate
+PROCEDURE Activate (procId: ProcessId);
+  (* Causes the process identified by procId to enter the ready
+     state, and thus to become eligible to run again.
+  *)
+
+@findex SuspendMeAndActivate
+PROCEDURE SuspendMeAndActivate (procId: ProcessId);
+  (* Executes an atomic sequence of SuspendMe() and
+     Activate(procId). *)
+
+@findex Switch
+PROCEDURE Switch (procId: ProcessId; VAR info: Parameter);
+  (* Causes the calling process to enter the passive state; the
+     process identified by procId becomes the currently executing
+     process.  info is used to pass parameter information from the
+     calling to the activated process.  On return, info will
+     contain information from the process that chooses to switch
+     back to this one (or will be NIL if Activate or
+     SuspendMeAndActivate are used instead of Switch).
+  *)
+
+@findex Wait
+PROCEDURE Wait ();
+  (* Causes the calling process to enter the waiting state.
+     The procedure will return when the calling process is
+     activated by another process, or when one of its associated
+     eventSources has generated an event.
+  *)
+
+(* The following procedures allow the association of processes
+   with sources of external events.
+*)
+
+@findex Attach
+PROCEDURE Attach (eventSource: Sources);
+  (* Associates the specified eventSource with the calling
+     process. *)
+
+@findex Detach
+PROCEDURE Detach (eventSource: Sources);
+  (* Dissociates the specified eventSource from the program. *)
+
+@findex IsAttached
+PROCEDURE IsAttached (eventSource: Sources): BOOLEAN;
+  (* Returns TRUE if and only if the specified eventSource is
+     currently associated with one of the processes of the
+     program.
+  *)
+
+@findex Handler
+PROCEDURE Handler (eventSource: Sources): ProcessId;
+  (* Returns the identity of the process, if any, that is
+     associated with the specified eventSource.
+  *)
+
+(* The following procedures allow processes to obtain their
+   identity, parameters, and urgency.
+*)
+
+@findex Me
+PROCEDURE Me (): ProcessId;
+  (* Returns the identity of the calling process (as assigned
+     when the process was first created).
+  *)
+
+@findex MyParam
+PROCEDURE MyParam (): Parameter;
+  (* Returns the value specified as procParams when the calling
+     process was created. *)
+
+@findex UrgencyOf
+PROCEDURE UrgencyOf (procId: ProcessId): Urgency;
+  (* Returns the urgency established when the process identified
+     by procId was first created.
+  *)
+
+(* The following procedure provides facilities for exception
+   handlers. *)
+
+@findex ProcessesException
+PROCEDURE ProcessesException (): ProcessesExceptions;
+  (* If the current coroutine is in the exceptional execution state
+     because of the raising of a language exception, returns the
+     corresponding enumeration value, and otherwise raises an
+     exception.
+  *)
+
+@findex IsProcessesException
+PROCEDURE IsProcessesException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception in
+     a routine from this module; otherwise returns FALSE.
+  *)
+
+(*
+   Reschedule - rotates the ready queue and transfers to the process
+                with the highest run priority.
+*)
+
+@findex Reschedule
+PROCEDURE Reschedule ;
+
+
+(*
+   displayProcesses -
+*)
+
+@findex displayProcesses
+PROCEDURE displayProcesses (message: ARRAY OF CHAR) ;
+
+
+END Processes.
+@end example
+@page
+
+@node gm2-libs-iso/ProgramArgs, gm2-libs-iso/RTco, gm2-libs-iso/Processes, M2 ISO Libraries
+@subsection gm2-libs-iso/ProgramArgs
+
+@example
+DEFINITION MODULE ProgramArgs;
+
+  (* Access to program arguments *)
+
+IMPORT IOChan;
+
+TYPE
+@findex ChanId (type)
+  ChanId = IOChan.ChanId;
+
+@findex ArgChan
+PROCEDURE ArgChan (): ChanId;
+  (* Returns a value that identifies a channel for reading
+     program arguments *)
+
+@findex IsArgPresent
+PROCEDURE IsArgPresent (): BOOLEAN;
+  (* Tests if there is a current argument to read from.  If not,
+     read <= IOChan.CurrentFlags() will be FALSE, and attempting
+     to read from the argument channel will raise the exception
+     notAvailable.
+  *)
+
+@findex NextArg
+PROCEDURE NextArg ();
+  (* If there is another argument, causes subsequent input from the
+     argument device to come from the start of the next argument.
+     Otherwise there is no argument to read from, and a call of
+     IsArgPresent will return FALSE.
+  *)
+
+END ProgramArgs.
+@end example
+@page
+
+@node gm2-libs-iso/RTco, gm2-libs-iso/RTdata, gm2-libs-iso/ProgramArgs, M2 ISO Libraries
+@subsection gm2-libs-iso/RTco
+
+@example
+DEFINITION MODULE RTco ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+(* init initializes the module and allows the application to lazily invoke threads.  *)
+
+@findex init
+PROCEDURE init () : INTEGER ;
+
+@findex initThread
+PROCEDURE initThread (p: PROC; stackSize: CARDINAL; interruptLevel: CARDINAL) : INTEGER ;
+
+@findex initSemaphore
+PROCEDURE initSemaphore (value: CARDINAL) : INTEGER ;
+
+@findex wait
+PROCEDURE wait (semaphore: INTEGER) ;
+
+@findex signal
+PROCEDURE signal (semaphore: INTEGER) ;
+
+@findex transfer
+PROCEDURE transfer (VAR p1: INTEGER; p2: INTEGER) ;
+
+@findex waitThread
+PROCEDURE waitThread (tid: INTEGER) ;
+
+@findex signalThread
+PROCEDURE signalThread (tid: INTEGER) ;
+
+@findex currentThread
+PROCEDURE currentThread () : INTEGER ;
+
+
+(* currentInterruptLevel returns the interrupt level of the current thread.  *)
+
+@findex currentInterruptLevel
+PROCEDURE currentInterruptLevel () : CARDINAL ;
+
+
+(* turninterrupts returns the old interrupt level and assigns the interrupt level
+   to newLevel.  *)
+
+@findex turnInterrupts
+PROCEDURE turnInterrupts (newLevel: CARDINAL) : CARDINAL ;
+
+
+(*
+   select access to the select system call which will be thread safe.
+   This is typically called from the idle process to wait for an interrupt.
+*)
+
+@findex select
+PROCEDURE select (p1: INTEGER;
+                  p2: ADDRESS;
+                  p3: ADDRESS;
+                  p4: ADDRESS;
+                  p5: ADDRESS) : INTEGER ;
+
+
+END RTco.
+@end example
+@page
+
+@node gm2-libs-iso/RTdata, gm2-libs-iso/RTentity, gm2-libs-iso/RTco, M2 ISO Libraries
+@subsection gm2-libs-iso/RTdata
+
+@example
+DEFINITION MODULE RTdata ;
+
+(*
+    Description: provides a mechanism whereby devices can store
+                 data attached to a device.
+*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM IOLink IMPORT DeviceTablePtr ;
+
+TYPE
+@findex ModuleId (type)
+   ModuleId ;
+@findex FreeProcedure (type)
+   FreeProcedure = PROCEDURE (ADDRESS) ;
+
+
+(*
+   MakeModuleId - creates a unique module Id.
+*)
+
+@findex MakeModuleId
+PROCEDURE MakeModuleId (VAR m: ModuleId) ;
+
+
+(*
+   InitData - adds, datum, to the device, d.  The datum
+              is associated with ModuleID, m.
+*)
+
+@findex InitData
+PROCEDURE InitData (d: DeviceTablePtr; m: ModuleId;
+                    datum: ADDRESS; f: FreeProcedure) ;
+
+
+(*
+   GetData - returns the datum assocated with ModuleId, m.
+*)
+
+@findex GetData
+PROCEDURE GetData (d: DeviceTablePtr; m: ModuleId) : ADDRESS ;
+
+
+(*
+   KillData - destroys the datum associated with ModuleId, m,
+              in device, d.  It invokes the free procedure
+              given during InitData.
+*)
+
+@findex KillData
+PROCEDURE KillData (d: DeviceTablePtr; m: ModuleId) ;
+
+
+END RTdata.
+@end example
+@page
+
+@node gm2-libs-iso/RTentity, gm2-libs-iso/RTfio, gm2-libs-iso/RTdata, M2 ISO Libraries
+@subsection gm2-libs-iso/RTentity
+
+@example
+DEFINITION MODULE RTentity ;
+
+(*
+    Description: provides a set of routines for maintaining an
+                 efficient mechanism to group opaque (or pointer)
+                 data structures together.  Internally the
+                 entities are grouped together using a binary
+                 tree.  It does not use Storage - and instead
+                 uses malloc, free from libc as Storage uses the
+                 module to detect erroneous deallocations.
+*)
+
+IMPORT SYSTEM ;
+
+TYPE
+@findex Group (type)
+   Group ;
+
+
+@findex InitGroup
+PROCEDURE InitGroup () : Group ;
+@findex KillGroup
+PROCEDURE KillGroup (g: Group) : Group ;
+@findex GetKey
+PROCEDURE GetKey (g: Group; a: SYSTEM.ADDRESS) : CARDINAL ;
+@findex PutKey
+PROCEDURE PutKey (g: Group; a: SYSTEM.ADDRESS; key: CARDINAL) ;
+@findex DelKey
+PROCEDURE DelKey (g: Group; a: SYSTEM.ADDRESS) ;
+@findex IsIn
+PROCEDURE IsIn (g: Group; a: SYSTEM.ADDRESS) : BOOLEAN ;
+
+
+END RTentity.
+@end example
+@page
+
+@node gm2-libs-iso/RTfio, gm2-libs-iso/RTgen, gm2-libs-iso/RTentity, M2 ISO Libraries
+@subsection gm2-libs-iso/RTfio
+
+@example
+DEFINITION MODULE RTfio ;
+
+(*
+    Description: provides default FIO based methods for the RTgenif
+                 procedures.  These will be used by StreamFile,
+                 SeqFile, StdChans, TermFile and RndFile.
+*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM IOLink IMPORT DeviceTablePtr;
+FROM RTgenif IMPORT GenDevIF ;
+
+
+(*
+   doreadchar - returns a CHAR from the file associated with, g.
+*)
+
+@findex doreadchar
+PROCEDURE doreadchar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
+
+
+(*
+   dounreadchar - pushes a CHAR back onto the file associated
+                  with, g.
+*)
+
+@findex dounreadchar
+PROCEDURE dounreadchar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
+
+
+(*
+   dogeterrno - returns the errno relating to the generic device.
+*)
+
+@findex dogeterrno
+PROCEDURE dogeterrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
+
+
+(*
+   dorbytes - reads upto, max, bytes setting, actual, and
+              returning FALSE if an error (not due to eof)
+              occurred.
+*)
+
+@findex dorbytes
+PROCEDURE dorbytes (g: GenDevIF;
+                    d: DeviceTablePtr;
+                    to: ADDRESS;
+                    max: CARDINAL;
+                    VAR actual: CARDINAL) : BOOLEAN ;
+
+(*
+   dowbytes - writes up to, nBytes.  It returns FALSE
+              if an error occurred and it sets actual
+              to the amount of data written.
+*)
+
+@findex dowbytes
+PROCEDURE dowbytes (g: GenDevIF;
+                    d: DeviceTablePtr;
+                    from: ADDRESS;
+                    nBytes: CARDINAL;
+                    VAR actual: CARDINAL) : BOOLEAN ;
+
+
+(*
+   dowriteln - attempt to write an end of line marker to the
+               file and returns TRUE if successful.
+*)
+
+@findex dowriteln
+PROCEDURE dowriteln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   iseof - returns TRUE if end of file has been seen.
+*)
+
+@findex iseof
+PROCEDURE iseof (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   iseoln - returns TRUE if end of line has been seen.
+*)
+
+@findex iseoln
+PROCEDURE iseoln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   iserror - returns TRUE if an error was seen on the device.
+             Note that reaching EOF is not classified as an
+             error.
+*)
+
+@findex iserror
+PROCEDURE iserror (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+END RTfio.
+@end example
+@page
+
+@node gm2-libs-iso/RTgen, gm2-libs-iso/RTgenif, gm2-libs-iso/RTfio, M2 ISO Libraries
+@subsection gm2-libs-iso/RTgen
+
+@example
+DEFINITION MODULE RTgen ;
+
+(*
+    Description: provides a generic device interface between
+                 ISO channels and the underlying PIM style
+                 FIO procedure calls.
+*)
+
+FROM RTgenif IMPORT GenDevIF ;
+FROM IOLink IMPORT DeviceId, DeviceTablePtr;
+FROM IOConsts IMPORT ReadResults ;
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+TYPE
+@findex ChanDev (type)
+   ChanDev ;
+@findex DeviceType (type)
+   DeviceType = (seqfile, streamfile, programargs, stdchans, term, socket, rndfile) ;
+
+
+(*
+   InitChanDev - initialize and return a ChanDev.
+*)
+
+@findex InitChanDev
+PROCEDURE InitChanDev (t: DeviceType; d: DeviceId; g: GenDevIF) : ChanDev ;
+
+
+(*
+   KillChanDev - deallocates, g.
+*)
+
+@findex KillChanDev
+PROCEDURE KillChanDev (g: GenDevIF) : GenDevIF ;
+
+
+(*
+   RaiseEOFinLook - returns TRUE if the Look procedure
+                    should raise an exception if it
+                    sees end of file.
+*)
+
+@findex RaiseEOFinLook
+PROCEDURE RaiseEOFinLook (g: ChanDev) : BOOLEAN ;
+
+
+(*
+   RaiseEOFinSkip - returns TRUE if the Skip procedure
+                    should raise an exception if it
+                    sees end of file.
+*)
+
+@findex RaiseEOFinSkip
+PROCEDURE RaiseEOFinSkip (g: ChanDev) : BOOLEAN ;
+
+
+@findex doLook
+PROCEDURE doLook (g: ChanDev;
+                  d: DeviceTablePtr;
+                  VAR ch: CHAR;
+                  VAR r: ReadResults) ;
+
+@findex doSkip
+PROCEDURE doSkip (g: ChanDev;
+                  d: DeviceTablePtr) ;
+
+@findex doSkipLook
+PROCEDURE doSkipLook (g: ChanDev;
+                      d: DeviceTablePtr;
+                      VAR ch: CHAR;
+                      VAR r: ReadResults) ;
+
+@findex doWriteLn
+PROCEDURE doWriteLn (g: ChanDev;
+                     d: DeviceTablePtr) ;
+
+@findex doReadText
+PROCEDURE doReadText (g: ChanDev;
+                      d: DeviceTablePtr;
+                      to: ADDRESS;
+                      maxChars: CARDINAL;
+                      VAR charsRead: CARDINAL) ;
+
+@findex doWriteText
+PROCEDURE doWriteText (g: ChanDev;
+                       d: DeviceTablePtr;
+                       from: ADDRESS;
+                       charsToWrite: CARDINAL) ;
+
+@findex doReadLocs
+PROCEDURE doReadLocs (g: ChanDev;
+                      d: DeviceTablePtr;
+                      to: ADDRESS;
+                      maxLocs: CARDINAL;
+                      VAR locsRead: CARDINAL) ;
+
+@findex doWriteLocs
+PROCEDURE doWriteLocs (g: ChanDev;
+                       d: DeviceTablePtr;
+                       from: ADDRESS;
+                       locsToWrite: CARDINAL) ;
+
+(*
+   checkErrno - checks a number of errno conditions and raises
+                appropriate ISO exceptions if they occur.
+*)
+
+@findex checkErrno
+PROCEDURE checkErrno (g: ChanDev; d: DeviceTablePtr) ;
+
+
+END RTgen.
+@end example
+@page
+
+@node gm2-libs-iso/RTgenif, gm2-libs-iso/RTio, gm2-libs-iso/RTgen, M2 ISO Libraries
+@subsection gm2-libs-iso/RTgenif
+
+@example
+DEFINITION MODULE RTgenif ;
+
+(*
+    Description: provides a generic interface mechanism used
+                 by RTgen.  This is not an ISO module but rather
+                 a runtime support module.
+*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM IOLink IMPORT DeviceId, DeviceTablePtr ;
+
+TYPE
+@findex GenDevIF (type)
+   GenDevIF ;
+@findex readchar (type)
+   readchar   = PROCEDURE (GenDevIF, DeviceTablePtr) : CHAR ;
+@findex unreadchar (type)
+   unreadchar = PROCEDURE (GenDevIF, DeviceTablePtr, CHAR) : CHAR ;
+@findex geterrno (type)
+   geterrno   = PROCEDURE (GenDevIF, DeviceTablePtr) : INTEGER ;
+@findex readbytes (type)
+   readbytes  = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
+@findex writebytes (type)
+   writebytes = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
+@findex writeln (type)
+   writeln    = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
+@findex iseof (type)
+   iseof      = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
+@findex iseoln (type)
+   iseoln     = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
+@findex iserror (type)
+   iserror    = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   InitGenDevIF - initializes a generic device.
+*)
+
+@findex InitGenDevIF
+PROCEDURE InitGenDevIF (d     : DeviceId;
+                        rc    : readchar;
+                        urc   : unreadchar;
+                        geterr: geterrno;
+                        rbytes: readbytes;
+                        wbytes: writebytes;
+                        wl    : writeln;
+                        eof   : iseof;
+                        eoln  : iseoln;
+                        iserr : iserror) : GenDevIF ;
+
+
+(*
+   getDID - returns the device id this generic interface.
+*)
+
+@findex getDID
+PROCEDURE getDID (g: GenDevIF) : DeviceId ;
+
+
+(*
+   doReadChar - returns the next character from the generic
+                device.
+*)
+
+@findex doReadChar
+PROCEDURE doReadChar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
+
+
+(*
+   doUnReadChar - pushes back a character to the generic device.
+*)
+
+@findex doUnReadChar
+PROCEDURE doUnReadChar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
+
+
+(*
+   doGetErrno - returns the errno relating to the generic device.
+*)
+
+@findex doGetErrno
+PROCEDURE doGetErrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
+
+
+(*
+   doRBytes - attempts to read, n, bytes from the generic device.
+              It set the actual amount read and returns a boolean
+              to determine whether an error occurred.
+*)
+
+@findex doRBytes
+PROCEDURE doRBytes (g: GenDevIF; d: DeviceTablePtr;
+                    to: ADDRESS; max: CARDINAL;
+                    VAR actual: CARDINAL) : BOOLEAN ;
+
+
+(*
+   doWBytes - attempts to write, n, bytes to the generic device.
+              It sets the actual amount written and returns a
+              boolean to determine whether an error occurred.
+*)
+
+@findex doWBytes
+PROCEDURE doWBytes (g: GenDevIF; d: DeviceTablePtr;
+                    from: ADDRESS; max: CARDINAL;
+                    VAR actual: CARDINAL) : BOOLEAN ;
+
+
+(*
+   doWrLn - writes an end of line marker and returns
+            TRUE if successful.
+*)
+
+@findex doWrLn
+PROCEDURE doWrLn (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   isEOF - returns true if the end of file was reached.
+*)
+
+@findex isEOF
+PROCEDURE isEOF (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   isEOLN - returns true if the end of line was reached.
+*)
+
+@findex isEOLN
+PROCEDURE isEOLN (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   isError - returns true if an error was seen in the device.
+*)
+
+@findex isError
+PROCEDURE isError (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
+
+
+(*
+   KillGenDevIF - deallocates a generic device.
+*)
+
+@findex KillGenDevIF
+PROCEDURE KillGenDevIF (g: GenDevIF) : GenDevIF ;
+
+
+END RTgenif.
+@end example
+@page
+
+@node gm2-libs-iso/RTio, gm2-libs-iso/RandomNumber, gm2-libs-iso/RTgenif, M2 ISO Libraries
+@subsection gm2-libs-iso/RTio
+
+@example
+DEFINITION MODULE RTio ;
+
+(*
+    Description: provides low level routines for creating and destroying
+                 ChanIds.  This is necessary to allow multiple modules
+                 to create, ChanId values, where ChanId is an opaque
+                 type.
+*)
+
+IMPORT FIO, IOLink ;
+
+TYPE
+@findex ChanId (type)
+   ChanId ;
+
+
+(*
+   InitChanId - return a new ChanId.
+*)
+
+@findex InitChanId
+PROCEDURE InitChanId () : ChanId ;
+
+
+(*
+   KillChanId - deallocate a ChanId.
+*)
+
+@findex KillChanId
+PROCEDURE KillChanId (c: ChanId) : ChanId ;
+
+
+(*
+   NilChanId - return a NIL pointer.
+*)
+
+@findex NilChanId
+PROCEDURE NilChanId () : ChanId ;
+
+
+(*
+   GetDeviceId - returns the device id, from, c.
+*)
+
+@findex GetDeviceId
+PROCEDURE GetDeviceId (c: ChanId) : IOLink.DeviceId ;
+
+
+(*
+   SetDeviceId - sets the device id in, c.
+*)
+
+@findex SetDeviceId
+PROCEDURE SetDeviceId (c: ChanId; d: IOLink.DeviceId) ;
+
+
+(*
+   GetDevicePtr - returns the device table ptr, from, c.
+*)
+
+@findex GetDevicePtr
+PROCEDURE GetDevicePtr (c: ChanId) : IOLink.DeviceTablePtr ;
+
+
+(*
+   SetDevicePtr - sets the device table ptr in, c.
+*)
+
+@findex SetDevicePtr
+PROCEDURE SetDevicePtr (c: ChanId; p: IOLink.DeviceTablePtr) ;
+
+
+(*
+   GetFile - returns the file field from, c.
+*)
+
+@findex GetFile
+PROCEDURE GetFile (c: ChanId) : FIO.File ;
+
+
+(*
+   SetFile - sets the file field in, c.
+*)
+
+@findex SetFile
+PROCEDURE SetFile (c: ChanId; f: FIO.File) ;
+
+
+END RTio.
+@end example
+@page
+
+@node gm2-libs-iso/RandomNumber, gm2-libs-iso/RawIO, gm2-libs-iso/RTio, M2 ISO Libraries
+@subsection gm2-libs-iso/RandomNumber
+
+@example
+DEFINITION MODULE RandomNumber ;
+
+(*
+    Description: provides primitives for obtaining random numbers on
+                 pervasive data types.
+*)
+
+FROM SYSTEM IMPORT BYTE ;
+EXPORT QUALIFIED Randomize, RandomInit, RandomBytes,
+                 RandomCard, RandomShortCard, RandomLongCard,
+                 RandomInt, RandomShortInt, RandomLongInt,
+                 RandomReal, RandomLongReal, RandomShortReal ;
+
+
+(*
+   Randomize - initialize the random number generator with a seed
+               based on the microseconds.
+*)
+
+@findex Randomize
+PROCEDURE Randomize ;
+
+
+(*
+   RandomInit - initialize the random number generator with value, seed.
+*)
+
+@findex RandomInit
+PROCEDURE RandomInit (seed: CARDINAL) ;
+
+
+(*
+   RandomBytes - fills in an array with random values.
+*)
+
+@findex RandomBytes
+PROCEDURE RandomBytes (VAR a: ARRAY OF BYTE) ;
+
+
+(*
+   RandomInt - return an INTEGER in the range [low .. high].
+*)
+
+@findex RandomInt
+PROCEDURE RandomInt (low, high: INTEGER) : INTEGER ;
+
+
+(*
+   RandomShortInt - return an SHORTINT in the range [low..high].
+*)
+
+@findex RandomShortInt
+PROCEDURE RandomShortInt (low, high: SHORTINT) : SHORTINT ;
+
+
+(*
+   RandomLongInt - return an LONGINT in the range [low..high].
+*)
+
+@findex RandomLongInt
+PROCEDURE RandomLongInt (low, high: LONGINT) : LONGINT ;
+
+
+(*
+   RandomShortCard - return a SHORTCARD in the range [low..high].
+*)
+
+@findex RandomShortCard
+PROCEDURE RandomShortCard (low, high: CARDINAL) : CARDINAL ;
+
+
+(*
+   RandomCard - return a CARDINAL in the range [low..high].
+*)
+
+@findex RandomCard
+PROCEDURE RandomCard (low, high: CARDINAL) : CARDINAL ;
+
+
+(*
+   RandomLongCard - return an LONGCARD in the range [low..high].
+*)
+
+@findex RandomLongCard
+PROCEDURE RandomLongCard (low, high: LONGCARD) : LONGCARD ;
+
+
+(*
+   RandomReal - return a REAL number in the range 0.0..1.0
+*)
+
+@findex RandomReal
+PROCEDURE RandomReal () : REAL ;
+
+
+(*
+   RandomShortReal - return a SHORTREAL number in the range 0.0..1.0
+*)
+
+@findex RandomShortReal
+PROCEDURE RandomShortReal () : SHORTREAL ;
+
+
+(*
+   RandomLongReal - return a LONGREAL number in the range 0.0..1.0
+*)
+
+@findex RandomLongReal
+PROCEDURE RandomLongReal () : LONGREAL ;
+
+
+END RandomNumber.
+@end example
+@page
+
+@node gm2-libs-iso/RawIO, gm2-libs-iso/RealConv, gm2-libs-iso/RandomNumber, M2 ISO Libraries
+@subsection gm2-libs-iso/RawIO
+
+@example
+DEFINITION MODULE RawIO;
+
+  (* Reading and writing data over specified channels using raw
+     operations, that is, with no conversion or interpretation.
+     The read result is of the type IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan, SYSTEM;
+
+@findex Read
+PROCEDURE Read (cid: IOChan.ChanId; VAR to: ARRAY OF SYSTEM.LOC);
+  (* Reads storage units from cid, and assigns them to
+     successive components of to. The read result is set
+     to the value allRight, wrongFormat, or endOfInput.
+  *)
+
+@findex Write
+PROCEDURE Write (cid: IOChan.ChanId; from: ARRAY OF SYSTEM.LOC);
+  (* Writes storage units to cid from successive components
+     of from. *)
+
+END RawIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/RealConv, gm2-libs-iso/RealIO, gm2-libs-iso/RawIO, M2 ISO Libraries
+@subsection gm2-libs-iso/RealConv
+
+@example
+DEFINITION MODULE RealConv;
+
+  (* Low-level REAL/string conversions *)
+
+IMPORT
+  ConvTypes;
+
+TYPE
+  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
+@findex ConvResults (type)
+  ConvResults = ConvTypes.ConvResults;
+
+@findex ScanReal
+PROCEDURE ScanReal (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
+                    VAR nextState: ConvTypes.ScanState);
+  (* Represents the start state of a finite state scanner for real
+     numbers - assigns class of inputCh to chClass and a procedure
+     representing the next state to nextState.
+   *)
+
+@findex FormatReal
+PROCEDURE FormatReal (str: ARRAY OF CHAR): ConvResults;
+  (* Returns the format of the string value for conversion to REAL. *)
+
+@findex ValueReal
+PROCEDURE ValueReal (str: ARRAY OF CHAR): REAL;
+  (* Returns the value corresponding to the real number string value
+     str if str is well-formed; otherwise raises the RealConv
+     exception.
+  *)
+
+@findex LengthFloatReal
+PROCEDURE LengthFloatReal (real: REAL; sigFigs: CARDINAL): CARDINAL;
+  (* Returns the number of characters in the floating-point string
+     representation of real with sigFigs significant figures.
+  *)
+
+@findex LengthEngReal
+PROCEDURE LengthEngReal (real: REAL; sigFigs: CARDINAL): CARDINAL;
+  (* Returns the number of characters in the floating-point engineering
+     string representation of real with sigFigs significant figures.
+  *)
+
+@findex LengthFixedReal
+PROCEDURE LengthFixedReal (real: REAL; place: INTEGER): CARDINAL;
+  (* Returns the number of characters in the fixed-point string
+     representation of real rounded to the given place relative to the
+     decimal point.
+  *)
+
+@findex IsRConvException
+PROCEDURE IsRConvException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception in a
+     routine from this module; otherwise returns FALSE.
+  *)
+
+END RealConv.
+@end example
+@page
+
+@node gm2-libs-iso/RealIO, gm2-libs-iso/RealMath, gm2-libs-iso/RealConv, M2 ISO Libraries
+@subsection gm2-libs-iso/RealIO
+
+@example
+DEFINITION MODULE RealIO;
+
+  (* Input and output of real numbers in decimal text form
+     over specified channels.  The read result is of the
+     type IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@},
+       [".", @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: REAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed fixed or floating
+     point number.  The value of this number is assigned to real.
+     The read result is set to the value allRight, outOfRange,
+     wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (cid: IOChan.ChanId; real: REAL;
+                      sigFigs: CARDINAL; width: CARDINAL);
+  (* Writes the value of real to cid in floating-point text form,
+     with sigFigs significant figures, in a field of the given
+     minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (cid: IOChan.ChanId; real: REAL;
+                    sigFigs: CARDINAL; width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with
+     one to three digits in the whole number part, and with an
+     exponent that is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (cid: IOChan.ChanId; real: REAL;
+                      place: INTEGER; width: CARDINAL);
+  (* Writes the value of real to cid in fixed-point text form,
+     rounded to the given place relative to the decimal point,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (cid: IOChan.ChanId;
+                     real: REAL; width: CARDINAL);
+  (* Writes the value of real to cid, as WriteFixed if the sign
+     and magnitude can be shown in the given width, or otherwise
+     as WriteFloat.  The number of places or significant digits
+     depends on the given width.
+  *)
+
+END RealIO.
+@end example
+@page
+
+@node gm2-libs-iso/RealMath, gm2-libs-iso/RealStr, gm2-libs-iso/RealIO, M2 ISO Libraries
+@subsection gm2-libs-iso/RealMath
+
+@example
+DEFINITION MODULE RealMath;
+
+  (* Mathematical functions for the type REAL *)
+
+CONST
+@findex pi (const)
+  pi   = 3.1415926535897932384626433832795028841972;
+@findex exp1 (const)
+  exp1 = 2.7182818284590452353602874713526624977572;
+
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: REAL): REAL;
+  (* Returns the positive square root of x *)
+
+@findex exp
+PROCEDURE __BUILTIN__ exp (x: REAL): REAL;
+  (* Returns the exponential of x *)
+
+@findex ln
+PROCEDURE __BUILTIN__ ln (x: REAL): REAL;
+  (* Returns the natural logarithm of x *)
+
+  (* The angle in all trigonometric functions is measured in radians *)
+
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: REAL): REAL;
+  (* Returns the sine of x *)
+
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: REAL): REAL;
+  (* Returns the cosine of x *)
+
+@findex tan
+PROCEDURE tan (x: REAL): REAL;
+  (* Returns the tangent of x *)
+
+@findex arcsin
+PROCEDURE arcsin (x: REAL): REAL;
+  (* Returns the arcsine of x *)
+
+@findex arccos
+PROCEDURE arccos (x: REAL): REAL;
+  (* Returns the arccosine of x *)
+
+@findex arctan
+PROCEDURE arctan (x: REAL): REAL;
+  (* Returns the arctangent of x *)
+
+@findex power
+PROCEDURE power (base, exponent: REAL) : REAL;
+  (* Returns the value of the number base raised to the power exponent *)
+
+@findex round
+PROCEDURE round (x: REAL) : INTEGER;
+  (* Returns the value of x rounded to the nearest integer *)
+
+@findex IsRMathException
+PROCEDURE IsRMathException () : BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END RealMath.
+
+@end example
+@page
+
+@node gm2-libs-iso/RealStr, gm2-libs-iso/RndFile, gm2-libs-iso/RealMath, M2 ISO Libraries
+@subsection gm2-libs-iso/RealStr
+
+@example
+DEFINITION MODULE RealStr;
+
+  (* REAL/string conversions *)
+
+IMPORT
+  ConvTypes;
+
+TYPE
+  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
+@findex ConvResults (type)
+  ConvResults = ConvTypes.ConvResults;
+
+(* the string form of a signed fixed-point real number is
+     ["+" | "-"], decimal digit, @{decimal digit@}, [".",
+     @{decimal digit@}]
+*)
+
+(* the string form of a signed floating-point real number is
+     signed fixed-point real number, "E", ["+" | "-"],
+     decimal digit, @{decimal digit@}
+*)
+
+@findex StrToReal
+PROCEDURE StrToReal (str: ARRAY OF CHAR; VAR real: REAL;
+                     VAR res: ConvResults);
+  (* Ignores any leading spaces in str. If the subsequent characters
+     in str are in the format of a signed real number, assigns a
+     corresponding value to real.  Assigns a value indicating the
+     format of str to res.
+  *)
+
+@findex RealToFloat
+PROCEDURE RealToFloat (real: REAL; sigFigs: CARDINAL;
+                       VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to floating-point string form, with
+     sigFigs significant figures, and copies the possibly truncated
+     result to str.
+  *)
+
+@findex RealToEng
+PROCEDURE RealToEng (real: REAL; sigFigs: CARDINAL;
+                     VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to floating-point string form, with
+     sigFigs significant figures, and copies the possibly truncated
+     result to str.  The number is scaled with one to three digits
+     in the whole number part and with an exponent that is a multiple
+     of three.
+  *)
+
+@findex RealToFixed
+PROCEDURE RealToFixed (real: REAL; place: INTEGER;
+                       VAR str: ARRAY OF CHAR);
+  (* Converts the value of real to fixed-point string form, rounded
+     to the given place relative to the decimal point, and copies
+     the possibly truncated result to str.
+  *)
+
+@findex RealToStr
+PROCEDURE RealToStr (real: REAL; VAR str: ARRAY OF CHAR);
+  (* Converts the value of real as RealToFixed if the sign and
+     magnitude can be shown within the capacity of str, or
+     otherwise as RealToFloat, and copies the possibly truncated
+     result to str. The number of places or significant digits are
+     implementation-defined.
+  *)
+
+END RealStr.
+
+@end example
+@page
+
+@node gm2-libs-iso/RndFile, gm2-libs-iso/SIOResult, gm2-libs-iso/RealStr, M2 ISO Libraries
+@subsection gm2-libs-iso/RndFile
+
+@example
+DEFINITION MODULE RndFile;
+
+  (* Random access files *)
+
+IMPORT IOChan, ChanConsts, SYSTEM;
+
+TYPE
+@findex ChanId (type)
+   ChanId = IOChan.ChanId;
+@findex FlagSet (type)
+   FlagSet = ChanConsts.FlagSet;
+@findex OpenResults (type)
+   OpenResults = ChanConsts.OpenResults;
+
+   (* Accepted singleton values of FlagSet *)
+
+CONST
+   (* input operations are requested/available *)
+@findex read (const)
+   read = FlagSet@{ChanConsts.readFlag@};
+   (* output operations are requested/available *)
+@findex write (const)
+   write = FlagSet@{ChanConsts.writeFlag@};
+   (* a file may/must/did exist before the channel is opened *)
+@findex old (const)
+   old = FlagSet@{ChanConsts.oldFlag@};
+   (* text operations are requested/available *)
+@findex text (const)
+   text = FlagSet@{ChanConsts.textFlag@};
+   (* raw operations are requested/available *)
+@findex raw (const)
+   raw = FlagSet@{ChanConsts.rawFlag@};
+
+@findex OpenOld
+PROCEDURE OpenOld (VAR cid: ChanId; name: ARRAY OF CHAR; flags: FlagSet;
+                   VAR res: OpenResults);
+  (* Attempts to obtain and open a channel connected to a stored random
+     access file of the given name.
+     The old flag is implied; without the write flag, read is implied;
+     without the text flag, raw is implied.
+     If successful, assigns to cid the identity of the opened channel,
+     assigns the value opened to res, and sets the read/write position
+     to the start of the file.
+     If a channel cannot be opened as required, the value of res indicates
+     the reason, and cid identifies the invalid channel.
+  *)
+
+@findex OpenClean
+PROCEDURE OpenClean (VAR cid: ChanId; name: ARRAY OF CHAR; flags: FlagSet;
+                     VAR res: OpenResults);
+  (* Attempts to obtain and open a channel connected to a stored random
+     access file of the given name.
+     The write flag is implied; without the text flag, raw is implied.
+     If successful, assigns to cid the identity of the opened channel,
+     assigns the value opened to res, and truncates the file to zero length.
+     If a channel cannot be opened as required, the value of res indicates
+     the reason, and cid identifies the invalid channel.
+  *)
+
+@findex IsRndFile
+PROCEDURE IsRndFile (cid: ChanId): BOOLEAN;
+  (* Tests if the channel identified by cid is open to a random access file. *)
+
+@findex IsRndFileException
+PROCEDURE IsRndFileException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution
+     state because of the raising of a RndFile exception; otherwise returns
+     FALSE.
+  *)
+
+CONST
+@findex FilePosSize (const)
+   FilePosSize = SIZE(LONGINT) ;
+   (* <implementation-defined whole number greater than zero>; *)
+
+TYPE
+@findex FilePos (type)
+   FilePos = LONGINT ;  (* ARRAY [1 .. FilePosSize] OF SYSTEM.LOC; *)
+
+@findex StartPos
+PROCEDURE StartPos (cid: ChanId): FilePos;
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise returns the position of
+     the start of the file.
+  *)
+
+@findex CurrentPos
+PROCEDURE CurrentPos (cid: ChanId): FilePos;
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise returns the position
+     of the current read/write position.
+  *)
+
+@findex EndPos
+PROCEDURE EndPos (cid: ChanId): FilePos;
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise returns the first
+     position after which there have been no writes.
+  *)
+
+@findex NewPos
+PROCEDURE NewPos (cid: ChanId; chunks: INTEGER; chunkSize: CARDINAL;
+                  from: FilePos): FilePos;
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise returns the position
+     (chunks * chunkSize) relative to the position given by from, or
+     raises the exception posRange if the required position cannot be
+     represented as a value of type FilePos.
+  *)
+
+@findex SetPos
+PROCEDURE SetPos (cid: ChanId; pos: FilePos);
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise sets the read/write
+     position to the value given by pos.
+  *)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId);
+  (* If the channel identified by cid is not open to a random access file,
+     the exception wrongDevice is raised; otherwise closes the channel,
+     and assigns the value identifying the invalid channel to cid.
+  *)
+
+END RndFile.
+@end example
+@page
+
+@node gm2-libs-iso/SIOResult, gm2-libs-iso/SLongIO, gm2-libs-iso/RndFile, M2 ISO Libraries
+@subsection gm2-libs-iso/SIOResult
+
+@example
+DEFINITION MODULE SIOResult;
+
+  (* Read results for the default input channel *)
+
+IMPORT IOConsts;
+
+TYPE
+@findex ReadResults (type)
+  ReadResults = IOConsts.ReadResults;
+
+  (*
+@findex ReadResults (type)
+    ReadResults =   (* This type is used to classify the result of an input operation *)
+    (
+      notKnown,     (* no read result is set *)
+      allRight,     (* data is as expected or as required *)
+      outOfRange,   (* data cannot be represented *)
+      wrongFormat,  (* data not in expected format *)
+      endOfLine,    (* end of line seen before expected data *)
+      endOfInput    (* end of input seen before expected data *)
+    );
+  *)
+
+@findex ReadResult
+PROCEDURE ReadResult (): ReadResults;
+  (* Returns the result for the last read operation on the default input channel. *)
+
+END SIOResult.
+
+@end example
+@page
+
+@node gm2-libs-iso/SLongIO, gm2-libs-iso/SLongWholeIO, gm2-libs-iso/SIOResult, M2 ISO Libraries
+@subsection gm2-libs-iso/SLongIO
+
+@example
+DEFINITION MODULE SLongIO;
+
+  (* Input and output of long real numbers in decimal text form
+     using default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@},
+       [".", @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (VAR real: LONGREAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     fixed or floating point number. The value of this number
+     is assigned to real.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (real: LONGREAL; sigFigs: CARDINAL;
+                      width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     floating-point text form, with sigFigs significant figures,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (real: LONGREAL; sigFigs: CARDINAL;
+                    width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with
+     one to three digits in the whole number part, and with an
+     exponent that is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (real: LONGREAL; place: INTEGER;
+                      width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     fixed-point text form, rounded to the given place relative
+     to the decimal point, in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (real: LONGREAL; width: CARDINAL);
+  (* Writes the value of real to the default output channel, as
+     WriteFixed if the sign and magnitude can be shown in the
+     given width, or otherwise as WriteFloat. The number of
+     places or significant digits depends on the given width.
+  *)
+
+END SLongIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/SLongWholeIO, gm2-libs-iso/SRawIO, gm2-libs-iso/SLongIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SLongWholeIO
+
+@example
+DEFINITION MODULE SLongWholeIO;
+
+  (* Input and output of whole numbers in decimal text form over
+     default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (VAR int: LONGINT);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     whole number.  The value of this number is assigned
+     to int.  The read result is set to the value allRight,
+     outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (int: LONGINT; width: CARDINAL);
+  (* Writes the value of int to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+@findex ReadCard
+PROCEDURE ReadCard (VAR card: LONGCARD);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of an
+     unsigned whole number.  The value of this number is
+     assigned to card.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (card: LONGCARD; width: CARDINAL);
+  (* Writes the value of card to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+END SLongWholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/SRawIO, gm2-libs-iso/SRealIO, gm2-libs-iso/SLongWholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SRawIO
+
+@example
+DEFINITION MODULE SRawIO;
+
+  (* Reading and writing data over default channels using raw operations, that is, with no
+     conversion or interpretation. The read result is of the type IOConsts.ReadResults.
+  *)
+
+IMPORT SYSTEM;
+
+@findex Read
+PROCEDURE Read (VAR to: ARRAY OF SYSTEM.LOC);
+  (* Reads storage units from the default input channel, and assigns them to successive
+     components of to.  The read result is set to the value allRight, wrongFormat, or
+     endOfInput.
+  *)
+
+@findex Write
+PROCEDURE Write (from: ARRAY OF SYSTEM.LOC);
+  (* Writes storage units to the default output channel from successive components of from.
+  *)
+
+END SRawIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/SRealIO, gm2-libs-iso/SShortIO, gm2-libs-iso/SRawIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SRealIO
+
+@example
+DEFINITION MODULE SRealIO;
+
+  (* Input and output of real numbers in decimal text form over
+     default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@},
+       [".", @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (VAR real: REAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     fixed or floating point number. The value of this number
+     is assigned to real.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (real: REAL; sigFigs: CARDINAL; width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     floating-point text form, with sigFigs significant figures,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (real: REAL; sigFigs: CARDINAL; width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with one to
+     three digits in the whole number part, and with an exponent that
+     is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (real: REAL; place: INTEGER; width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     fixed-point text form, rounded to the given place relative
+     to the decimal point, in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (real: REAL; width: CARDINAL);
+  (* Writes the value of real to the default output channel, as
+     WriteFixed if the sign and magnitude can be shown in the
+     given width, or otherwise as WriteFloat. The number of
+     places or significant digits depends on the given width.
+  *)
+
+END SRealIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/SShortIO, gm2-libs-iso/SShortWholeIO, gm2-libs-iso/SRealIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SShortIO
+
+@example
+DEFINITION MODULE SShortIO;
+
+  (* Input and output of short real numbers in decimal text form
+     using default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@},
+       [".", @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (VAR real: SHORTREAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     fixed or floating point number. The value of this number
+     is assigned to real.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (real: SHORTREAL; sigFigs: CARDINAL;
+                      width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     floating-point text form, with sigFigs significant figures,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (real: SHORTREAL; sigFigs: CARDINAL;
+                    width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with
+     one to three digits in the whole number part, and with an
+     exponent that is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (real: SHORTREAL; place: INTEGER;
+                      width: CARDINAL);
+  (* Writes the value of real to the default output channel in
+     fixed-point text form, rounded to the given place relative
+     to the decimal point, in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (real: SHORTREAL; width: CARDINAL);
+  (* Writes the value of real to the default output channel, as
+     WriteFixed if the sign and magnitude can be shown in the
+     given width, or otherwise as WriteFloat. The number of
+     places or significant digits depends on the given width.
+  *)
+
+END SShortIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/SShortWholeIO, gm2-libs-iso/STextIO, gm2-libs-iso/SShortIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SShortWholeIO
+
+@example
+DEFINITION MODULE SShortWholeIO;
+
+  (* Input and output of whole numbers in decimal text form over
+     default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (VAR int: SHORTINT);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     whole number.  The value of this number is assigned
+     to int.  The read result is set to the value allRight,
+     outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (int: SHORTINT; width: CARDINAL);
+  (* Writes the value of int to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+@findex ReadCard
+PROCEDURE ReadCard (VAR card: SHORTCARD);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of an
+     unsigned whole number.  The value of this number is
+     assigned to card.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (card: SHORTCARD; width: CARDINAL);
+  (* Writes the value of card to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+END SShortWholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/STextIO, gm2-libs-iso/SWholeIO, gm2-libs-iso/SShortWholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/STextIO
+
+@example
+DEFINITION MODULE STextIO;
+
+  (* Input and output of character and string types over default channels. The read result
+     is of the type IOConsts.ReadResults.
+  *)
+
+  (* The following procedures do not read past line marks *)
+
+@findex ReadChar
+PROCEDURE ReadChar (VAR ch: CHAR);
+  (* If possible, removes a character from the default input stream, and assigns the
+     corresponding value to ch.  The read result is set to allRight, endOfLine or
+     endOfInput.
+  *)
+
+@findex ReadRestLine
+PROCEDURE ReadRestLine (VAR s: ARRAY OF CHAR);
+  (* Removes any remaining characters from the default input stream before the next line
+     mark, copying to s as many as can be accommodated as a string value.  The read result
+     is set to the value allRight, outOfRange, endOfLine, or endOfInput.
+  *)
+
+@findex ReadString
+PROCEDURE ReadString (VAR s: ARRAY OF CHAR);
+  (* Removes only those characters from the default input stream before the next line mark
+     that can be accommodated in s as a string value, and copies them to s. The read result
+     is set to the value allRight, endOfLine, or endOfInput.
+  *)
+
+@findex ReadToken
+PROCEDURE ReadToken (VAR s: ARRAY OF CHAR);
+  (* Skips leading spaces, and then removes characters from the default input stream before
+     the next space or line mark, copying to s as many as can be accommodated as a string
+     value.  The read result is set to the value allRight, outOfRange, endOfLine, or
+     endOfInput.
+  *)
+
+  (* The following procedure reads past the next line mark *)
+
+@findex SkipLine
+PROCEDURE SkipLine;
+  (* Removes successive items from the default input stream up to and including the next
+     line mark or until the end of input is reached. The read result is set to the value
+     allRight, or endOfInput.
+  *)
+
+
+  (* Output procedures *)
+
+@findex WriteChar
+PROCEDURE WriteChar (ch: CHAR);
+  (* Writes the value of ch to the default output stream. *)
+
+@findex WriteLn
+PROCEDURE WriteLn;
+  (* Writes a line mark to the default output stream. *)
+
+@findex WriteString
+PROCEDURE WriteString (s: ARRAY OF CHAR);
+  (* Writes the string value of s to the default output stream. *)
+
+END STextIO.
+@end example
+@page
+
+@node gm2-libs-iso/SWholeIO, gm2-libs-iso/SYSTEM, gm2-libs-iso/STextIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SWholeIO
+
+@example
+DEFINITION MODULE SWholeIO;
+
+  (* Input and output of whole numbers in decimal text form over
+     default channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (VAR int: INTEGER);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of a signed
+     whole number.  The value of this number is assigned
+     to int.  The read result is set to the value allRight,
+     outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (int: INTEGER; width: CARDINAL);
+  (* Writes the value of int to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+@findex ReadCard
+PROCEDURE ReadCard (VAR card: CARDINAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from the default input channel that form part of an
+     unsigned whole number.  The value of this number is
+     assigned to card.  The read result is set to the value
+     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (card: CARDINAL; width: CARDINAL);
+  (* Writes the value of card to the default output channel in
+     text form, in a field of the given minimum width.
+  *)
+
+END SWholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/SYSTEM, gm2-libs-iso/Semaphores, gm2-libs-iso/SWholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SYSTEM
+
+@example
+DEFINITION MODULE SYSTEM;
+
+  (* Gives access to system programming facilities that are probably
+     non portable. *)
+
+  (* The constants and types define underlying properties of storage *)
+
+EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
+                 LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
+                 Target specific data types.  *)
+                 ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
+                 SHIFT, CAST, TSIZE,
+
+                 (* Internal GM2 compiler functions *)
+                 ShiftVal, ShiftLeft, ShiftRight,
+                 RotateVal, RotateLeft, RotateRight,
+                 THROW, TBITSIZE ;
+
+CONST
+                  (* <implementation-defined constant> ; *)
+@findex BITSPERLOC (const)
+  BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+                  (* <implementation-defined constant> ; *)
+@findex LOCSPERWORD (const)
+  LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+                  (* <implementation-defined constant> ; *)
+@findex LOCSPERBYTE (const)
+  LOCSPERBYTE = 8 DIV BITSPERLOC ;
+
+(*
+   all the objects below are declared internally to gm2
+   ====================================================
+
+TYPE
+   (* Target specific data types.  *)
+
+TYPE
+  LOC; (* A system basic type. Values are the uninterpreted
+          contents of the smallest addressable unit of storage *)
+@findex ADDRESS (type)
+  ADDRESS = POINTER TO LOC;
+@findex WORD (type)
+  WORD = ARRAY [0 .. LOCSPERWORD-1] OF LOC;
+
+  (* BYTE and LOCSPERBYTE are provided if appropriate for machine *)
+
+TYPE
+@findex BYTE (type)
+  BYTE = ARRAY [0 .. LOCSPERBYTE-1] OF LOC;
+
+@findex ADDADR
+PROCEDURE ADDADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
+  (* Returns address given by (addr + offset), or may raise
+     an exception if this address is not valid.
+  *)
+
+@findex SUBADR
+PROCEDURE SUBADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
+  (* Returns address given by (addr - offset), or may raise an
+     exception if this address is not valid.
+  *)
+
+@findex DIFADR
+PROCEDURE DIFADR (addr1, addr2: ADDRESS): INTEGER;
+  (* Returns the difference between addresses (addr1 - addr2),
+     or may raise an exception if the arguments are invalid
+     or address space is non-contiguous.
+  *)
+
+@findex MAKEADR
+PROCEDURE MAKEADR (high: <some type>; ...): ADDRESS;
+  (* Returns an address constructed from a list of values whose
+     types are implementation-defined, or may raise an
+     exception if this address is not valid.
+
+     In GNU Modula-2, MAKEADR can take any number of arguments
+     which are mapped onto the type ADDRESS. The first parameter
+     maps onto the high address bits and subsequent parameters map
+     onto lower address bits. For example:
+
+     a := MAKEADR(BYTE(0FEH), BYTE(0DCH), BYTE(0BAH), BYTE(098H),
+                  BYTE(076H), BYTE(054H), BYTE(032H), BYTE(010H)) ;
+
+     then the value of, a, on a 64 bit machine is: 0FEDCBA9876543210H
+
+     The parameters do not have to be the same type, but constants
+     _must_ be typed.
+  *)
+
+@findex ADR
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+@findex ROTATE
+PROCEDURE ROTATE (val: <a packedset type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up/right
+     or down/right by the absolute value of num.  The direction is
+     down/right if the sign of num is negative, otherwise the direction
+     is up/left.
+  *)
+
+@findex SHIFT
+PROCEDURE SHIFT (val: <a packedset type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up/left
+     or down/right by the absolute value of num, introducing
+     zeros as necessary.  The direction is down/right if the sign of
+     num is negative, otherwise the direction is up/left.
+  *)
+
+@findex CAST
+PROCEDURE CAST (<targettype>; val: <anytype>): <targettype>;
+  (* CAST is a type transfer function.  Given the expression
+     denoted by val, it returns a value of the type <targettype>.
+     An invalid value for the target value or a
+     physical address alignment problem may raise an exception.
+  *)
+
+@findex TSIZE
+PROCEDURE TSIZE (<type>; ... ): CARDINAL;
+  (* Returns the number of LOCS used to store a value of the
+     specified <type>.   The extra parameters, if present,
+     are used to distinguish variants in a variant record.
+  *)
+
+@findex THROW
+PROCEDURE THROW (i: INTEGER) ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the
+     EXCEPT block (assuming it exists).  This is a compiler builtin
+     function which interfaces to the GCC exception handling runtime
+     system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+@findex TBITSIZE
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word set types. They are not part of ISO Modula-2
+   but are used to implement the SHIFT procedure defined above. *)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will only
+              call this routine for larger sets.
+*)
+
+@findex ShiftVal
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+@findex ShiftLeft
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex ShiftRight
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for larger
+               sets.
+*)
+
+@findex RotateVal
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex RotateLeft
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+@findex RotateRight
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
+@end example
+@page
+
+@node gm2-libs-iso/Semaphores, gm2-libs-iso/SeqFile, gm2-libs-iso/SYSTEM, M2 ISO Libraries
+@subsection gm2-libs-iso/Semaphores
+
+@example
+DEFINITION MODULE Semaphores;
+
+  (* Provides mutual exclusion facilities for use by processes. *)
+
+TYPE
+  SEMAPHORE;
+
+@findex Create
+PROCEDURE Create (VAR s: SEMAPHORE; initialCount: CARDINAL );
+  (* Creates and returns s as the identity of a new semaphore that
+     has its associated count initialized to initialCount, and has
+     no processes yet waiting on it.
+  *)
+
+@findex Destroy
+PROCEDURE Destroy (VAR s: SEMAPHORE);
+  (* Recovers the resources used to implement the semaphore s,
+     provided that no process is waiting for s to become free.
+  *)
+
+@findex Claim
+PROCEDURE Claim (s: SEMAPHORE);
+  (* If the count associated with the semaphore s is non-zero,
+     decrements this count and allows the calling process to
+     continue; otherwise suspends the calling process until
+     s is released.
+  *)
+
+@findex Release
+PROCEDURE Release (s: SEMAPHORE);
+  (* If there are any processes waiting on the semaphore s,
+     allows one of them to enter the ready state; otherwise
+     increments the count associated with s.
+  *)
+
+@findex CondClaim
+PROCEDURE CondClaim (s: SEMAPHORE): BOOLEAN;
+  (* Returns FALSE if the call Claim(s) would cause the calling
+     process to be suspended; in this case the count associated
+     with s is not changed. Otherwise returns TRUE and the
+     associated count is decremented.
+  *)
+
+END Semaphores.
+
+@end example
+@page
+
+@node gm2-libs-iso/SeqFile, gm2-libs-iso/ShortComplexMath, gm2-libs-iso/Semaphores, M2 ISO Libraries
+@subsection gm2-libs-iso/SeqFile
+
+@example
+DEFINITION MODULE SeqFile;
+
+  (* Rewindable sequential files *)
+
+IMPORT IOChan, ChanConsts;
+
+TYPE
+@findex ChanId (type)
+  ChanId = IOChan.ChanId;
+@findex FlagSet (type)
+  FlagSet = ChanConsts.FlagSet;
+@findex OpenResults (type)
+  OpenResults = ChanConsts.OpenResults;
+
+  (* Accepted singleton values of FlagSet *)
+
+CONST
+  (* input operations are requested/available *)
+@findex read (const)
+  read = FlagSet@{ChanConsts.readFlag@};
+
+  (* output operations are requested/available *)
+@findex write (const)
+  write = FlagSet@{ChanConsts.writeFlag@};
+
+  (* a file may/must/did exist before the channel is opened *)
+@findex old (const)
+  old = FlagSet@{ChanConsts.oldFlag@};
+
+  (* text operations are requested/available *)
+@findex text (const)
+  text = FlagSet@{ChanConsts.textFlag@};
+
+  (* raw operations are requested/available *)
+@findex raw (const)
+  raw = FlagSet@{ChanConsts.rawFlag@};
+
+@findex OpenWrite
+PROCEDURE OpenWrite (VAR cid: ChanId; name: ARRAY OF CHAR;
+                     flags: FlagSet; VAR res: OpenResults);
+  (*
+     Attempts to obtain and open a channel connected to a stored
+     rewindable file of the given name.
+     The write flag is implied; without the raw flag, text is
+     implied.  If successful, assigns to cid the identity of
+     the opened channel, assigns the value opened to res, and
+     selects output mode, with the write position at the start
+     of the file (i.e. the file is of zero length).
+     If a channel cannot be opened as required, the value of
+     res indicates the reason, and cid identifies the invalid
+     channel.
+  *)
+
+@findex OpenAppend
+PROCEDURE OpenAppend (VAR cid: ChanId; name: ARRAY OF CHAR;
+                      flags: FlagSet; VAR res: OpenResults);
+  (*
+     Attempts to obtain and open a channel connected to a stored
+     rewindable file of the given name.  The write and old flags
+     are implied; without the raw flag, text is implied.  If
+     successful, assigns to cid the identity of the opened channel,
+     assigns the value opened to res, and selects output mode,
+     with the write position corresponding to the length of the
+     file.  If a channel cannot be opened as required, the value
+     of res indicates the reason, and cid identifies the invalid
+     channel.
+  *)
+
+@findex OpenRead
+PROCEDURE OpenRead (VAR cid: ChanId; name: ARRAY OF CHAR;
+                    flags: FlagSet; VAR res: OpenResults);
+  (* Attempts to obtain and open a channel connected to a stored
+     rewindable file of the given name.
+     The read and old flags are implied; without the raw flag,
+     text is implied.  If successful, assigns to cid the
+     identity of the opened channel, assigns the value opened to
+     res, and selects input mode, with the read position
+     corresponding to the start of the file.
+     If a channel cannot be opened as required, the value of
+     res indicates the reason, and cid identifies the invalid
+     channel.
+  *)
+
+@findex IsSeqFile
+PROCEDURE IsSeqFile (cid: ChanId): BOOLEAN;
+  (* Tests if the channel identified by cid is open to a
+     rewindable sequential file. *)
+
+@findex Reread
+PROCEDURE Reread (cid: ChanId);
+  (* If the channel identified by cid is not open to a rewindable
+     sequential file, the exception wrongDevice is raised;
+     otherwise attempts to set the read position to the
+     start of the file, and to select input mode.
+     If the operation cannot be performed (perhaps because of
+     insufficient permissions) neither input mode nor output
+     mode is selected.
+  *)
+
+@findex Rewrite
+PROCEDURE Rewrite (cid: ChanId);
+  (* If the channel identified by cid is not open to a
+     rewindable sequential file, the exception wrongDevice is
+     raised; otherwise, attempts to truncate the file to zero
+     length, and to select output mode.  If the operation
+     cannot be performed (perhaps because of insufficient
+     permissions) neither input mode nor output mode is selected.
+  *)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId);
+  (* If the channel identified by cid is not open to a rewindable
+     sequential file, the exception wrongDevice is raised;
+     otherwise closes the channel, and assigns the value
+     identifying the invalid channel to cid.
+  *)
+
+END SeqFile.
+
+@end example
+@page
+
+@node gm2-libs-iso/ShortComplexMath, gm2-libs-iso/ShortIO, gm2-libs-iso/SeqFile, M2 ISO Libraries
+@subsection gm2-libs-iso/ShortComplexMath
+
+@example
+DEFINITION MODULE ShortComplexMath;
+
+  (* Mathematical functions for the type SHORTCOMPLEX *)
+
+CONST
+@findex i (const)
+  i =    CMPLX (0.0, 1.0);
+@findex one (const)
+  one =  CMPLX (1.0, 0.0);
+@findex zero (const)
+  zero = CMPLX (0.0, 0.0);
+
+@findex abs
+PROCEDURE abs (z: SHORTCOMPLEX): SHORTREAL;
+  (* Returns the length of z *)
+
+@findex arg
+PROCEDURE arg (z: SHORTCOMPLEX): SHORTREAL;
+  (* Returns the angle that z subtends to the positive real axis *)
+
+@findex conj
+PROCEDURE conj (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the complex conjugate of z *)
+
+@findex power
+PROCEDURE power (base: SHORTCOMPLEX; exponent: SHORTREAL): SHORTCOMPLEX;
+  (* Returns the value of the number base raised to the power exponent *)
+
+@findex sqrt
+PROCEDURE sqrt (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the principal square root of z *)
+
+@findex exp
+PROCEDURE exp (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the complex exponential of z *)
+
+@findex ln
+PROCEDURE ln (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the principal value of the natural logarithm of z *)
+
+@findex sin
+PROCEDURE sin (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the sine of z *)
+
+@findex cos
+PROCEDURE cos (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the cosine of z *)
+
+@findex tan
+PROCEDURE tan (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the tangent of z *)
+
+@findex arcsin
+PROCEDURE arcsin (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the arcsine of z *)
+
+@findex arccos
+PROCEDURE arccos (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the arccosine of z *)
+
+@findex arctan
+PROCEDURE arctan (z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the arctangent of z *)
+
+@findex polarToComplex
+PROCEDURE polarToComplex (abs, arg: SHORTREAL): SHORTCOMPLEX;
+  (* Returns the complex number with the specified polar coordinates *)
+
+@findex scalarMult
+PROCEDURE scalarMult (scalar: SHORTREAL; z: SHORTCOMPLEX): SHORTCOMPLEX;
+  (* Returns the scalar product of scalar with z *)
+
+@findex IsCMathException
+PROCEDURE IsCMathException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution state
+     because of the raising of an exception in a routine from this module; otherwise
+     returns FALSE.
+  *)
+
+END ShortComplexMath.
+
+@end example
+@page
+
+@node gm2-libs-iso/ShortIO, gm2-libs-iso/ShortWholeIO, gm2-libs-iso/ShortComplexMath, M2 ISO Libraries
+@subsection gm2-libs-iso/ShortIO
+
+@example
+DEFINITION MODULE ShortIO;
+
+  (* Input and output of short real numbers in decimal text form
+     over specified channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed fixed-point real number is
+       ["+" | "-"], decimal digit, @{decimal digit@}, [".",
+       @{decimal digit@}]
+
+     The text form of a signed floating-point real number is
+       signed fixed-point real number,
+       "E", ["+" | "-"], decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadReal
+PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: SHORTREAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed fixed or floating
+     point number.  The value of this number is assigned to real.
+     The read result is set to the value allRight, outOfRange,
+     wrongFormat, endOfLine, or endOfInput.
+  *)
+
+@findex WriteFloat
+PROCEDURE WriteFloat (cid: IOChan.ChanId; real: SHORTREAL;
+                      sigFigs: CARDINAL; width: CARDINAL);
+  (* Writes the value of real to cid in floating-point text form,
+     with sigFigs significant figures, in a field of the given
+     minimum width.
+  *)
+
+@findex WriteEng
+PROCEDURE WriteEng (cid: IOChan.ChanId; real: SHORTREAL;
+                    sigFigs: CARDINAL; width: CARDINAL);
+  (* As for WriteFloat, except that the number is scaled with
+     one to three digits in the whole number part, and with an
+     exponent that is a multiple of three.
+  *)
+
+@findex WriteFixed
+PROCEDURE WriteFixed (cid: IOChan.ChanId; real: SHORTREAL;
+                      place: INTEGER; width: CARDINAL);
+  (* Writes the value of real to cid in fixed-point text form,
+     rounded to the given place relative to the decimal point,
+     in a field of the given minimum width.
+  *)
+
+@findex WriteReal
+PROCEDURE WriteReal (cid: IOChan.ChanId; real: SHORTREAL;
+                     width: CARDINAL);
+  (* Writes the value of real to cid, as WriteFixed if the
+     sign and magnitude can be shown in the given width, or
+     otherwise as WriteFloat.  The number of places or
+     significant digits depends on the given width.
+  *)
+
+END ShortIO.
+@end example
+@page
+
+@node gm2-libs-iso/ShortWholeIO, gm2-libs-iso/SimpleCipher, gm2-libs-iso/ShortIO, M2 ISO Libraries
+@subsection gm2-libs-iso/ShortWholeIO
+
+@example
+DEFINITION MODULE ShortWholeIO;
+
+  (* Input and output of whole numbers in decimal text form
+     over specified channels.  The read result is of the
+     type IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: SHORTINT);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed whole number.  The
+     value of this number is assigned to int.  The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (cid: IOChan.ChanId; int: SHORTINT;
+                    width: CARDINAL);
+  (* Writes the value of int to cid in text form, in a field of
+     the given minimum width. *)
+
+@findex ReadCard
+PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: SHORTCARD);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of an unsigned whole number.  The
+     value of this number is assigned to card. The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (cid: IOChan.ChanId; card: SHORTCARD;
+                     width: CARDINAL);
+  (* Writes the value of card to cid in text form, in a field
+     of the given minimum width. *)
+
+END ShortWholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/SimpleCipher, gm2-libs-iso/StdChans, gm2-libs-iso/ShortWholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/SimpleCipher
+
+@example
+DEFINITION MODULE SimpleCipher ;
+
+(*
+    Description: provides a simple Caesar cipher layer which
+                 can be attached to any channel device.  This,
+                 pedagogical, module is designed to show how
+                 it is possible to add further layers underneath
+                 the channel devices.
+*)
+
+FROM IOChan IMPORT ChanId ;
+
+
+(*
+   InsertCipherLayer - inserts a caesar cipher below channel, cid.
+                       The encryption, key, is specified.
+*)
+
+@findex InsertCipherLayer
+PROCEDURE InsertCipherLayer (cid: ChanId; key: INTEGER) ;
+
+
+(*
+   RemoveCipherLayer - removes a Caesar cipher below channel, cid.
+*)
+
+@findex RemoveCipherLayer
+PROCEDURE RemoveCipherLayer (cid: ChanId) ;
+
+
+END SimpleCipher.
+@end example
+@page
+
+@node gm2-libs-iso/StdChans, gm2-libs-iso/Storage, gm2-libs-iso/SimpleCipher, M2 ISO Libraries
+@subsection gm2-libs-iso/StdChans
+
+@example
+DEFINITION MODULE StdChans;
+
+  (* Access to standard and default channels *)
+
+IMPORT IOChan;
+
+TYPE
+@findex ChanId (type)
+  ChanId = IOChan.ChanId;
+    (* Values of this type are used to identify channels *)
+
+  (* The following functions return the standard channel values.
+     These channels cannot be closed.
+  *)
+
+@findex StdInChan
+PROCEDURE StdInChan (): ChanId;
+  (* Returns the identity of the implementation-defined standard source for
+program
+     input.
+  *)
+
+@findex StdOutChan
+PROCEDURE StdOutChan (): ChanId;
+  (* Returns the identity of the implementation-defined standard source for program
+     output.
+  *)
+
+@findex StdErrChan
+PROCEDURE StdErrChan (): ChanId;
+  (* Returns the identity of the implementation-defined standard destination for program
+     error messages.
+  *)
+
+@findex NullChan
+PROCEDURE NullChan (): ChanId;
+  (* Returns the identity of a channel open to the null device. *)
+
+  (* The following functions return the default channel values *)
+
+@findex InChan
+PROCEDURE InChan (): ChanId;
+  (* Returns the identity of the current default input channel. *)
+
+@findex OutChan
+PROCEDURE OutChan (): ChanId;
+  (* Returns the identity of the current default output channel. *)
+
+@findex ErrChan
+PROCEDURE ErrChan (): ChanId;
+  (* Returns the identity of the current default error message channel. *)
+
+  (* The following procedures allow for redirection of the default channels *)
+
+@findex SetInChan
+PROCEDURE SetInChan (cid: ChanId);
+  (* Sets the current default input channel to that identified by cid. *)
+
+@findex SetOutChan
+PROCEDURE SetOutChan (cid: ChanId);
+  (* Sets the current default output channel to that identified by cid. *)
+
+@findex SetErrChan
+PROCEDURE SetErrChan (cid: ChanId);
+  (* Sets the current default error channel to that identified by cid. *)
+
+END StdChans.
+@end example
+@page
+
+@node gm2-libs-iso/Storage, gm2-libs-iso/StreamFile, gm2-libs-iso/StdChans, M2 ISO Libraries
+@subsection gm2-libs-iso/Storage
+
+@example
+DEFINITION MODULE Storage;
+
+  (* Facilities for dynamically allocating and deallocating storage *)
+
+IMPORT SYSTEM;
+
+@findex ALLOCATE
+PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
+  (* Allocates storage for a variable of size amount and assigns
+     the address of this variable to addr. If there is insufficient
+     unallocated storage to do this, the value NIL is assigned to addr.
+  *)
+
+@findex DEALLOCATE
+PROCEDURE DEALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
+  (* Deallocates amount locations allocated by ALLOCATE for
+     the storage of the variable addressed by addr and assigns
+     the value NIL to addr.
+  *)
+
+@findex REALLOCATE
+PROCEDURE REALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
+  (* Attempts to reallocate, amount of storage.  Effectively it
+     calls ALLOCATE, copies the amount of data pointed to by
+     addr into the new space and DEALLOCATES the addr.
+     This procedure is a GNU extension.
+  *)
+
+TYPE
+@findex StorageExceptions (type)
+  StorageExceptions = (
+    nilDeallocation,             (* first argument to DEALLOCATE is NIL *)
+    pointerToUnallocatedStorage, (* storage to deallocate not allocated by ALLOCATE *)
+    wrongStorageToUnallocate     (* amount to deallocate is not amount allocated *)
+  );
+
+@findex IsStorageException
+PROCEDURE IsStorageException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional
+     execution state because of the raising of an exception from
+     StorageExceptions; otherwise returns FALSE.
+  *)
+
+@findex StorageException
+PROCEDURE StorageException (): StorageExceptions;
+  (* If the current coroutine is in the exceptional execution
+     state because of the raising of an exception from
+     StorageExceptions, returns the corresponding
+     enumeration value, and otherwise raises an exception.
+  *)
+
+END Storage.
+@end example
+@page
+
+@node gm2-libs-iso/StreamFile, gm2-libs-iso/StringChan, gm2-libs-iso/Storage, M2 ISO Libraries
+@subsection gm2-libs-iso/StreamFile
+
+@example
+DEFINITION MODULE StreamFile;
+
+  (* Independent sequential data streams *)
+
+IMPORT IOChan, ChanConsts;
+
+TYPE
+@findex ChanId (type)
+  ChanId = IOChan.ChanId;
+@findex FlagSet (type)
+  FlagSet = ChanConsts.FlagSet;
+@findex OpenResults (type)
+  OpenResults = ChanConsts.OpenResults;
+
+  (* Accepted singleton values of FlagSet *)
+
+CONST
+@findex read (const)
+  read = FlagSet@{ChanConsts.readFlag@};   (* input operations are requested/available *)
+@findex write (const)
+  write = FlagSet@{ChanConsts.writeFlag@}; (* output operations are requested/available *)
+@findex old (const)
+  old = FlagSet@{ChanConsts.oldFlag@};     (* a file may/must/did exist before the channel is
+                                            opened *)
+@findex text (const)
+  text = FlagSet@{ChanConsts.textFlag@};   (* text operations are requested/available *)
+@findex raw (const)
+  raw = FlagSet@{ChanConsts.rawFlag@};     (* raw operations are requested/available *)
+
+
+@findex Open
+PROCEDURE Open (VAR cid: ChanId; name: ARRAY OF CHAR;
+                flags: FlagSet; VAR res: OpenResults);
+  (* Attempts to obtain and open a channel connected to a
+     sequential stream of the given name.
+     The read flag implies old; without the raw flag, text is
+     implied.  If successful, assigns to cid the identity of
+     the opened channel, and assigns the value opened to res.
+     If a channel cannot be opened as required, the value of
+     res indicates the reason, and cid identifies the invalid
+     channel.
+  *)
+
+@findex IsStreamFile
+PROCEDURE IsStreamFile (cid: ChanId): BOOLEAN;
+  (* Tests if the channel identified by cid is open to a sequential stream. *)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId);
+  (* If the channel identified by cid is not open to a sequential stream, the exception
+     wrongDevice is raised; otherwise closes the channel, and assigns the value identifying
+     the invalid channel to cid.
+  *)
+
+END StreamFile.
+
+@end example
+@page
+
+@node gm2-libs-iso/StringChan, gm2-libs-iso/Strings, gm2-libs-iso/StreamFile, M2 ISO Libraries
+@subsection gm2-libs-iso/StringChan
+
+@example
+DEFINITION MODULE StringChan ;
+
+(*
+    Description: provides a set of Channel and String
+                 input and output procedures.
+*)
+
+FROM DynamicStrings IMPORT String ;
+IMPORT IOChan;
+
+
+(*
+   writeString - writes a string, s, to ChanId, cid.
+                 The string, s, is not destroyed.
+*)
+
+@findex writeString
+PROCEDURE writeString (cid: IOChan.ChanId; s: String) ;
+
+
+(*
+   writeFieldWidth - writes a string, s, to ChanId, cid.
+                     The string, s, is not destroyed and it
+                     is prefixed by spaces so that at least,
+                     width, characters are written.  If the
+                     string, s, is longer than width then
+                     no spaces are prefixed to the output
+                     and the entire string is written.
+*)
+
+@findex writeFieldWidth
+PROCEDURE writeFieldWidth (cid: IOChan.ChanId;
+                           s: String; width: CARDINAL) ;
+
+
+END StringChan.
+@end example
+@page
+
+@node gm2-libs-iso/Strings, gm2-libs-iso/SysClock, gm2-libs-iso/StringChan, M2 ISO Libraries
+@subsection gm2-libs-iso/Strings
+
+@example
+DEFINITION MODULE Strings;
+
+  (* Facilities for manipulating strings *)
+
+TYPE
+@findex String1 (type)
+  String1 = ARRAY [0..0] OF CHAR;
+    (* String1 is provided for constructing a value of a single-character string type from a
+       single character value in order to pass CHAR values to ARRAY OF CHAR parameters.
+    *)
+
+@findex Length
+PROCEDURE Length (stringVal: ARRAY OF CHAR): CARDINAL;
+  (* Returns the length of stringVal (the same value as would be returned by the
+     pervasive function LENGTH).
+  *)
+
+
+(* The following seven procedures construct a string value, and attempt to assign it to a
+   variable parameter.  They all have the property that if the length of the constructed string
+   value exceeds the capacity of the variable parameter, a truncated value is assigned, while
+   if the length of the constructed string value is less than the capacity of the variable
+   parameter, a string terminator is appended before assignment is performed.
+*)
+
+@findex Assign
+PROCEDURE Assign (source: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
+  (* Copies source to destination *)
+
+@findex Extract
+PROCEDURE Extract (source: ARRAY OF CHAR; startIndex, numberToExtract: CARDINAL;
+                   VAR destination: ARRAY OF CHAR);
+  (* Copies at most numberToExtract characters from source to destination, starting at position
+     startIndex in source.
+  *)
+
+@findex Delete
+PROCEDURE Delete (VAR stringVar: ARRAY OF CHAR; startIndex, numberToDelete:
+CARDINAL);
+  (* Deletes at most numberToDelete characters from stringVar, starting at position
+     startIndex.
+  *)
+
+@findex Insert
+PROCEDURE Insert (source: ARRAY OF CHAR; startIndex: CARDINAL;
+                  VAR destination: ARRAY OF CHAR);
+  (* Inserts source into destination at position startIndex *)
+
+@findex Replace
+PROCEDURE Replace (source: ARRAY OF CHAR; startIndex: CARDINAL;
+                   VAR destination: ARRAY OF CHAR);
+  (* Copies source into destination, starting at position startIndex. Copying stops when
+     all of source has been copied, or when the last character of the string value in
+     destination has been replaced.
+  *)
+
+@findex Append
+PROCEDURE Append (source: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
+  (* Appends source to destination. *)
+
+@findex Concat
+PROCEDURE Concat (source1, source2: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
+  (* Concatenates source2 onto source1 and copies the result into destination. *)
+
+(* The following predicates provide for pre-testing of the operation-completion
+   conditions for the procedures above.
+*)
+
+@findex CanAssignAll
+PROCEDURE CanAssignAll (sourceLength: CARDINAL; VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if a number of characters, indicated by sourceLength, will fit into
+     destination; otherwise returns FALSE.
+  *)
+
+@findex CanExtractAll
+PROCEDURE CanExtractAll (sourceLength, startIndex, numberToExtract: CARDINAL;
+                         VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if there are numberToExtract characters starting at startIndex and
+     within the sourceLength of some string, and if the capacity of destination is
+     sufficient to hold numberToExtract characters; otherwise returns FALSE.
+  *)
+
+@findex CanDeleteAll
+PROCEDURE CanDeleteAll (stringLength, startIndex, numberToDelete: CARDINAL): BOOLEAN;
+  (* Returns TRUE if there are numberToDelete characters starting at startIndex and
+     within the stringLength of some string; otherwise returns FALSE.
+  *)
+
+@findex CanInsertAll
+PROCEDURE CanInsertAll (sourceLength, startIndex: CARDINAL;
+                        VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if there is room for the insertion of sourceLength characters from
+     some string into destination starting at startIndex; otherwise returns FALSE.
+  *)
+
+@findex CanReplaceAll
+PROCEDURE CanReplaceAll (sourceLength, startIndex: CARDINAL;
+                         VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if there is room for the replacement of sourceLength characters in
+     destination starting at startIndex; otherwise returns FALSE.
+  *)
+
+@findex CanAppendAll
+PROCEDURE CanAppendAll (sourceLength: CARDINAL; VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if there is sufficient room in destination to append a string of
+     length sourceLength to the string in destination; otherwise returns FALSE.
+  *)
+
+@findex CanConcatAll
+PROCEDURE CanConcatAll (source1Length, source2Length: CARDINAL;
+                        VAR destination: ARRAY OF CHAR): BOOLEAN;
+  (* Returns TRUE if there is sufficient room in destination for a two strings of
+     lengths source1Length and source2Length; otherwise returns FALSE.
+  *)
+
+(* The following type and procedures provide for the comparison of string values, and for the
+   location of substrings within strings.
+*)
+
+TYPE
+@findex CompareResults (type)
+  CompareResults = (less, equal, greater);
+
+@findex Compare
+PROCEDURE Compare (stringVal1, stringVal2: ARRAY OF CHAR): CompareResults;
+  (* Returns less, equal, or greater, according as stringVal1 is lexically less than,
+     equal to, or greater than stringVal2.
+  *)
+
+@findex Equal
+PROCEDURE Equal (stringVal1, stringVal2: ARRAY OF CHAR): BOOLEAN;
+  (* Returns Strings.Compare(stringVal1, stringVal2) = Strings.equal *)
+
+@findex FindNext
+PROCEDURE FindNext (pattern, stringToSearch: ARRAY OF CHAR; startIndex: CARDINAL;
+                    VAR patternFound: BOOLEAN; VAR posOfPattern: CARDINAL);
+  (* Looks forward for next occurrence of pattern in stringToSearch, starting the search at
+     position startIndex. If startIndex < LENGTH(stringToSearch) and pattern is found,
+     patternFound is returned as TRUE, and posOfPattern contains the start position in
+     stringToSearch of pattern. Otherwise patternFound is returned as FALSE, and posOfPattern
+     is unchanged.
+  *)
+
+@findex FindPrev
+PROCEDURE FindPrev (pattern, stringToSearch: ARRAY OF CHAR; startIndex: CARDINAL;
+                    VAR patternFound: BOOLEAN; VAR posOfPattern: CARDINAL);
+  (* Looks backward for the previous occurrence of pattern in stringToSearch and returns the
+     position of the first character of the pattern if found. The search for the pattern
+     begins at startIndex. If pattern is found, patternFound is returned as TRUE, and
+     posOfPattern contains the start position in stringToSearch of pattern in the range
+     [0..startIndex]. Otherwise patternFound is returned as FALSE, and posOfPattern is unchanged.
+  *)
+
+@findex FindDiff
+PROCEDURE FindDiff (stringVal1, stringVal2: ARRAY OF CHAR;
+                    VAR differenceFound: BOOLEAN; VAR posOfDifference: CARDINAL);
+  (* Compares the string values in stringVal1 and stringVal2 for differences. If they
+     are equal, differenceFound is returned as FALSE, and TRUE otherwise. If
+     differenceFound is TRUE, posOfDifference is set to the position of the first
+     difference; otherwise posOfDifference is unchanged.
+  *)
+
+@findex Capitalize
+PROCEDURE Capitalize (VAR stringVar: ARRAY OF CHAR);
+  (* Applies the function CAP to each character of the string value in stringVar. *)
+
+
+END Strings.
+
+@end example
+@page
+
+@node gm2-libs-iso/SysClock, gm2-libs-iso/TERMINATION, gm2-libs-iso/Strings, M2 ISO Libraries
+@subsection gm2-libs-iso/SysClock
+
+@example
+DEFINITION MODULE SysClock;
+
+(* Facilities for accessing a system clock that records the date
+   and time of day *)
+
+CONST
+@findex maxSecondParts (const)
+  maxSecondParts = 1000000 ;
+
+TYPE
+@findex Month (type)
+  Month    = [1 .. 12];
+@findex Day (type)
+  Day      = [1 .. 31];
+@findex Hour (type)
+  Hour     = [0 .. 23];
+@findex Min (type)
+  Min      = [0 .. 59];
+@findex Sec (type)
+  Sec      = [0 .. 59];
+@findex Fraction (type)
+  Fraction = [0 .. maxSecondParts];
+@findex UTCDiff (type)
+  UTCDiff  = [-780 .. 720];
+@findex DateTime (type)
+  DateTime =
+    RECORD
+      year:      CARDINAL;
+      month:     Month;
+      day:       Day;
+      hour:      Hour;
+      minute:    Min;
+      second:    Sec;
+      fractions: Fraction;      (* parts of a second *)
+      zone:      UTCDiff;       (* Time zone differential
+                                   factor which is the number
+                                   of minutes to add to local
+                                   time to obtain UTC. *)
+      summerTimeFlag: BOOLEAN;  (* Interpretation of flag
+                                   depends on local usage. *)
+    END;
+
+@findex CanGetClock
+PROCEDURE CanGetClock(): BOOLEAN;
+(* Tests if the clock can be read *)
+
+@findex CanSetClock
+PROCEDURE CanSetClock(): BOOLEAN;
+(* Tests if the clock can be set *)
+
+@findex IsValidDateTime
+PROCEDURE IsValidDateTime(userData: DateTime): BOOLEAN;
+(* Tests if the value of userData is a valid *)
+
+@findex GetClock
+PROCEDURE GetClock(VAR userData: DateTime);
+(* Assigns local date and time of the day to userData *)
+
+@findex SetClock
+PROCEDURE SetClock(userData: DateTime);
+(* Sets the system time clock to the given local date and
+   time *)
+
+END SysClock.
+@end example
+@page
+
+@node gm2-libs-iso/TERMINATION, gm2-libs-iso/TermFile, gm2-libs-iso/SysClock, M2 ISO Libraries
+@subsection gm2-libs-iso/TERMINATION
+
+@example
+DEFINITION MODULE TERMINATION;
+
+(* Provides facilities for enquiries concerning the occurrence of termination events. *)
+
+@findex IsTerminating
+PROCEDURE IsTerminating (): BOOLEAN ;
+  (* Returns true if any coroutine has started  program termination and false otherwise. *)
+
+@findex HasHalted
+PROCEDURE HasHalted (): BOOLEAN ;
+  (* Returns true if a call to HALT has been made and false otherwise. *)
+
+END TERMINATION.
+@end example
+@page
+
+@node gm2-libs-iso/TermFile, gm2-libs-iso/TextIO, gm2-libs-iso/TERMINATION, M2 ISO Libraries
+@subsection gm2-libs-iso/TermFile
+
+@example
+DEFINITION MODULE TermFile;
+
+  (* Access to the terminal device *)
+
+  (* Channels opened by this module are connected to a single
+     terminal device; typed characters are distributed between
+     channels according to the sequence of read requests.
+  *)
+
+IMPORT IOChan, ChanConsts;
+
+TYPE
+@findex ChanId (type)
+  ChanId = IOChan.ChanId;
+@findex FlagSet (type)
+  FlagSet = ChanConsts.FlagSet;
+@findex OpenResults (type)
+  OpenResults = ChanConsts.OpenResults;
+
+  (* Accepted singleton values of FlagSet *)
+
+CONST
+@findex read (const)
+  read = FlagSet@{ChanConsts.readFlag@};
+  (* input operations are requested/available *)
+@findex write (const)
+  write = FlagSet@{ChanConsts.writeFlag@};
+  (* output operations are requested/available *)
+@findex text (const)
+  text = FlagSet@{ChanConsts.textFlag@};
+  (* text operations are requested/available *)
+@findex raw (const)
+  raw = FlagSet@{ChanConsts.rawFlag@};
+  (* raw operations are requested/available *)
+@findex echo (const)
+  echo = FlagSet@{ChanConsts.echoFlag@};
+  (* echoing by interactive device on reading of
+     characters from input stream requested/applies
+  *)
+
+@findex Open
+PROCEDURE Open (VAR cid: ChanId; flagset: FlagSet; VAR res: OpenResults);
+  (* Attempts to obtain and open a channel connected to
+     the terminal.  Without the raw flag, text is implied.
+     Without the echo flag, line mode is requested,
+     otherwise single character mode is requested.
+     If successful, assigns to cid the identity of
+     the opened channel, and assigns the value opened to res.
+     If a channel cannot be opened as required, the value of
+     res indicates the reason, and cid identifies the
+     invalid channel.
+  *)
+
+@findex IsTermFile
+PROCEDURE IsTermFile (cid: ChanId): BOOLEAN;
+  (* Tests if the channel identified by cid is open to
+     the terminal. *)
+
+@findex Close
+PROCEDURE Close (VAR cid: ChanId);
+  (* If the channel identified by cid is not open to the terminal,
+     the exception wrongDevice is raised; otherwise closes the
+     channel and assigns the value identifying the invalid channel
+     to cid.
+  *)
+
+END TermFile.
+
+@end example
+@page
+
+@node gm2-libs-iso/TextIO, gm2-libs-iso/WholeConv, gm2-libs-iso/TermFile, M2 ISO Libraries
+@subsection gm2-libs-iso/TextIO
+
+@example
+DEFINITION MODULE TextIO;
+
+  (* Input and output of character and string types over
+     specified channels.  The read result is of the type
+     IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The following procedures do not read past line marks *)
+
+@findex ReadChar
+PROCEDURE ReadChar (cid: IOChan.ChanId; VAR ch: CHAR);
+  (* If possible, removes a character from the input stream
+     cid and assigns the corresponding value to ch.  The
+     read result is set to the value allRight, endOfLine, or
+     endOfInput.
+  *)
+
+@findex ReadRestLine
+PROCEDURE ReadRestLine (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
+  (* Removes any remaining characters from the input stream
+     cid before the next line mark,  copying to s as many as
+     can be accommodated as a string value.  The read result is
+     set to the value allRight, outOfRange, endOfLine, or
+     endOfInput.
+  *)
+
+@findex ReadString
+PROCEDURE ReadString (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
+  (* Removes only those characters from the input stream cid
+     before the next line mark that can be accommodated in s
+     as a string value, and copies them to s.  The read result
+     is set to the value allRight, endOfLine, or endOfInput.
+  *)
+
+@findex ReadToken
+PROCEDURE ReadToken (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
+  (* Skips leading spaces, and then removes characters from
+     the input stream cid before the next space or line mark,
+     copying to s as many as can be accommodated as a string
+     value.  The read result is set to the value allRight,
+     outOfRange, endOfLine, or endOfInput.
+  *)
+
+  (* The following procedure reads past the next line mark *)
+
+@findex SkipLine
+PROCEDURE SkipLine (cid: IOChan.ChanId);
+  (* Removes successive items from the input stream cid up
+     to and including the next line mark, or until the end
+     of input is reached.  The read result is set to the
+     value allRight, or endOfInput.
+  *)
+
+  (* Output procedures *)
+
+@findex WriteChar
+PROCEDURE WriteChar (cid: IOChan.ChanId; ch: CHAR);
+  (* Writes the value of ch to the output stream cid. *)
+
+@findex WriteLn
+PROCEDURE WriteLn (cid: IOChan.ChanId);
+  (* Writes a line mark to the output stream cid. *)
+
+@findex WriteString
+PROCEDURE WriteString (cid: IOChan.ChanId; s: ARRAY OF CHAR);
+  (* Writes the string value in s to the output stream cid. *)
+
+END TextIO.
+
+@end example
+@page
+
+@node gm2-libs-iso/WholeConv, gm2-libs-iso/WholeIO, gm2-libs-iso/TextIO, M2 ISO Libraries
+@subsection gm2-libs-iso/WholeConv
+
+@example
+DEFINITION MODULE WholeConv;
+
+  (* Low-level whole-number/string conversions *)
+
+IMPORT
+  ConvTypes;
+
+TYPE
+@findex ConvResults (type)
+  ConvResults = ConvTypes.ConvResults;
+        (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
+
+@findex ScanInt
+PROCEDURE ScanInt (inputCh: CHAR;
+                   VAR chClass: ConvTypes.ScanClass;
+                   VAR nextState: ConvTypes.ScanState) ;
+  (* Represents the start state of a finite state scanner for signed
+     whole numbers - assigns class of inputCh to chClass and a
+     procedure representing the next state to nextState.
+  *)
+
+@findex FormatInt
+PROCEDURE FormatInt (str: ARRAY OF CHAR): ConvResults;
+  (* Returns the format of the string value for conversion to INTEGER. *)
+
+@findex ValueInt
+PROCEDURE ValueInt (str: ARRAY OF CHAR): INTEGER;
+  (* Returns the value corresponding to the signed whole number string
+     value str if str is well-formed; otherwise raises the WholeConv
+     exception.
+   *)
+
+@findex LengthInt
+PROCEDURE LengthInt (int: INTEGER): CARDINAL;
+  (* Returns the number of characters in the string representation of
+     int.
+   *)
+
+@findex ScanCard
+PROCEDURE ScanCard (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
+                    VAR nextState: ConvTypes.ScanState);
+  (* Represents the start state of a finite state scanner for unsigned
+     whole numbers - assigns class of inputCh to chClass and a procedure
+     representing the next state to nextState.
+   *)
+
+@findex FormatCard
+PROCEDURE FormatCard (str: ARRAY OF CHAR): ConvResults;
+  (* Returns the format of the string value for conversion to CARDINAL.
+   *)
+
+@findex ValueCard
+PROCEDURE ValueCard (str: ARRAY OF CHAR): CARDINAL;
+  (* Returns the value corresponding to the unsigned whole number string
+     value str if str is well-formed; otherwise raises the WholeConv
+     exception.
+   *)
+
+@findex LengthCard
+PROCEDURE LengthCard (card: CARDINAL): CARDINAL;
+  (* Returns the number of characters in the string representation of
+     card.
+   *)
+
+@findex IsWholeConvException
+PROCEDURE IsWholeConvException (): BOOLEAN;
+  (* Returns TRUE if the current coroutine is in the exceptional execution
+     state because of the raising of an exception in a routine from this
+     module; otherwise returns FALSE.
+  *)
+
+END WholeConv.
+@end example
+@page
+
+@node gm2-libs-iso/WholeIO, gm2-libs-iso/WholeStr, gm2-libs-iso/WholeConv, M2 ISO Libraries
+@subsection gm2-libs-iso/WholeIO
+
+@example
+DEFINITION MODULE WholeIO;
+
+  (* Input and output of whole numbers in decimal text form
+     over specified channels.  The read result is of the
+     type IOConsts.ReadResults.
+  *)
+
+IMPORT IOChan;
+
+  (* The text form of a signed whole number is
+       ["+" | "-"], decimal digit, @{decimal digit@}
+
+     The text form of an unsigned whole number is
+       decimal digit, @{decimal digit@}
+  *)
+
+@findex ReadInt
+PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: INTEGER);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of a signed whole number.  The
+     value of this number is assigned to int.  The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteInt
+PROCEDURE WriteInt (cid: IOChan.ChanId; int: INTEGER;
+                    width: CARDINAL);
+  (* Writes the value of int to cid in text form, in a field of
+     the given minimum width. *)
+
+@findex ReadCard
+PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: CARDINAL);
+  (* Skips leading spaces, and removes any remaining characters
+     from cid that form part of an unsigned whole number.  The
+     value of this number is assigned to card. The read result
+     is set to the value allRight, outOfRange, wrongFormat,
+     endOfLine, or endOfInput.
+  *)
+
+@findex WriteCard
+PROCEDURE WriteCard (cid: IOChan.ChanId; card: CARDINAL;
+                     width: CARDINAL);
+  (* Writes the value of card to cid in text form, in a field
+     of the given minimum width. *)
+
+END WholeIO.
+@end example
+@page
+
+@node gm2-libs-iso/WholeStr, gm2-libs-iso/wrapsock, gm2-libs-iso/WholeIO, M2 ISO Libraries
+@subsection gm2-libs-iso/WholeStr
+
+@example
+DEFINITION MODULE WholeStr;
+
+  (* Whole-number/string conversions *)
+
+IMPORT
+  ConvTypes;
+
+TYPE
+@findex ConvResults (type)
+  ConvResults = ConvTypes.ConvResults;
+  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
+
+(* the string form of a signed whole number is
+     ["+" | "-"], decimal digit, @{decimal digit@}
+*)
+
+@findex StrToInt
+PROCEDURE StrToInt (str: ARRAY OF CHAR; VAR int: INTEGER;
+                    VAR res: ConvResults);
+  (* Ignores any leading spaces in str. If the subsequent
+     characters in str are in the format of a signed whole
+     number, assigns a corresponding value to int. Assigns
+     a value indicating the format of str to res.
+  *)
+
+@findex IntToStr
+PROCEDURE IntToStr (int: INTEGER; VAR str: ARRAY OF CHAR);
+  (* Converts the value of int to string form and copies the
+     possibly truncated result to str. *)
+
+(* the string form of an unsigned whole number is
+     decimal digit, @{decimal digit@}
+*)
+
+@findex StrToCard
+PROCEDURE StrToCard (str: ARRAY OF CHAR;
+                     VAR card: CARDINAL;
+                     VAR res: ConvResults);
+  (* Ignores any leading spaces in str. If the subsequent
+     characters in str are in the format of an unsigned
+     whole number, assigns a corresponding value to card.
+     Assigns a value indicating the format of str to res.
+  *)
+
+@findex CardToStr
+PROCEDURE CardToStr (card: CARDINAL; VAR str: ARRAY OF CHAR);
+  (* Converts the value of card to string form and copies the
+     possibly truncated result to str. *)
+
+END WholeStr.
+@end example
+@page
+
+@node gm2-libs-iso/wrapsock, gm2-libs-iso/wraptime, gm2-libs-iso/WholeStr, M2 ISO Libraries
+@subsection gm2-libs-iso/wrapsock
+
+@example
+DEFINITION MODULE wrapsock ;
+
+(*
+    Description: provides a set of wrappers to some client side
+                 tcp socket primatives.
+*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+FROM ChanConsts IMPORT OpenResults ;
+
+
+TYPE
+@findex clientInfo (type)
+   clientInfo = ADDRESS ;
+
+
+(*
+   clientOpen - returns an ISO Modula-2 OpenResult.
+                It attempts to connect to:  hostname:portNo.
+                If successful then the data structure, c,
+                will have its fields initialized.
+*)
+
+@findex clientOpen
+PROCEDURE clientOpen (c: clientInfo;
+                      hostname: ADDRESS;
+                      length: CARDINAL;
+                      portNo: CARDINAL) : OpenResults ;
+
+
+(*
+   clientOpenIP - returns an ISO Modula-2 OpenResult.
+                  It attempts to connect to:  ipaddress:portNo.
+                  If successful then the data structure, c,
+                  will have its fields initialized.
+*)
+
+@findex clientOpenIP
+PROCEDURE clientOpenIP (c: clientInfo;
+                        ip: CARDINAL;
+                        portNo: CARDINAL) : OpenResults ;
+
+
+(*
+   getClientPortNo - returns the portNo from structure, c.
+*)
+
+@findex getClientPortNo
+PROCEDURE getClientPortNo (c: clientInfo) : CARDINAL ;
+
+
+(*
+   getClientHostname - fills in the hostname of the server
+                       the to which the client is connecting.
+*)
+
+@findex getClientHostname
+PROCEDURE getClientHostname (c: clientInfo;
+                             hostname: ADDRESS; high: CARDINAL) ;
+
+
+(*
+   getClientSocketFd - returns the sockFd from structure, c.
+*)
+
+@findex getClientSocketFd
+PROCEDURE getClientSocketFd (c: clientInfo) : INTEGER ;
+
+
+(*
+   getClientIP - returns the sockFd from structure, s.
+*)
+
+@findex getClientIP
+PROCEDURE getClientIP (c: clientInfo) : CARDINAL ;
+
+
+(*
+   getPushBackChar - returns TRUE if a pushed back character
+                     is available.
+*)
+
+@findex getPushBackChar
+PROCEDURE getPushBackChar (c: clientInfo; VAR ch: CHAR) : BOOLEAN ;
+
+
+(*
+   setPushBackChar - returns TRUE if it is able to push back a
+                     character.
+*)
+
+@findex setPushBackChar
+PROCEDURE setPushBackChar (c: clientInfo; ch: CHAR) : BOOLEAN ;
+
+
+(*
+   getSizeOfClientInfo - returns the sizeof (opaque data type).
+*)
+
+@findex getSizeOfClientInfo
+PROCEDURE getSizeOfClientInfo () : CARDINAL ;
+
+
+END wrapsock.
+@end example
+@page
+
+@node gm2-libs-iso/wraptime, , gm2-libs-iso/wrapsock, M2 ISO Libraries
+@subsection gm2-libs-iso/wraptime
+
+@example
+DEFINITION MODULE wraptime ;
+
+(*
+    Description: provides an interface to various time related
+                 entities on the underlying host operating system.
+                 It provides access to the glibc/libc functions:
+                 gettimeofday, settimeofday and localtime_r.
+*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+TYPE
+@findex timeval (type)
+   timeval  = ADDRESS ;
+@findex timezone (type)
+   timezone = ADDRESS ;
+@findex tm (type)
+   tm       = ADDRESS ;
+
+
+(*
+   InitTimeval - returns a newly created opaque type.
+*)
+
+@findex InitTimeval
+PROCEDURE InitTimeval () : timeval ;
+
+
+(*
+   KillTimeval - deallocates the memory associated with an
+                 opaque type.
+*)
+
+@findex KillTimeval
+PROCEDURE KillTimeval (tv: timeval) : timeval ;
+
+
+(*
+   InitTimezone - returns a newly created opaque type.
+*)
+
+@findex InitTimezone
+PROCEDURE InitTimezone () : timezone ;
+
+
+(*
+   KillTimezone - deallocates the memory associated with an
+                  opaque type.
+*)
+
+@findex KillTimezone
+PROCEDURE KillTimezone (tv: timezone) : timezone ;
+
+
+(*
+   InitTM - returns a newly created opaque type.
+*)
+
+@findex InitTM
+PROCEDURE InitTM () : tm ;
+
+
+(*
+   KillTM - deallocates the memory associated with an
+            opaque type.
+*)
+
+@findex KillTM
+PROCEDURE KillTM (tv: tm) : tm ;
+
+
+(*
+   gettimeofday - calls gettimeofday(2) with the same parameters, tv,
+                  and, tz.  It returns 0 on success.
+*)
+
+@findex gettimeofday
+PROCEDURE gettimeofday (tv: timeval; tz: timezone) : INTEGER ;
+
+
+(*
+   settimeofday - calls settimeofday(2) with the same parameters, tv,
+                  and, tz.  It returns 0 on success.
+*)
+
+@findex settimeofday
+PROCEDURE settimeofday (tv: timeval; tz: timezone) : INTEGER ;
+
+
+(*
+   GetFractions - returns the tv_usec field inside the timeval structure
+                  as a CARDINAL.
+*)
+
+@findex GetFractions
+PROCEDURE GetFractions (tv: timeval) : CARDINAL ;
+
+
+(*
+   localtime_r - returns the tm parameter, m, after it has been assigned with
+                 appropriate contents determined by, tv.  Notice that
+                 this procedure function expects, timeval, as its first
+                 parameter and not a time_t (as expected by the posix
+                 equivalent).  This avoids having to expose a time_t
+                 system dependant definition.
+*)
+
+@findex localtime_r
+PROCEDURE localtime_r (tv: timeval; m: tm) : tm ;
+
+
+(*
+   GetYear - returns the year from the structure, m.
+*)
+
+@findex GetYear
+PROCEDURE GetYear (m: tm) : CARDINAL ;
+
+
+(*
+   GetMonth - returns the month from the structure, m.
+*)
+
+@findex GetMonth
+PROCEDURE GetMonth (m: tm) : CARDINAL ;
+
+
+(*
+   GetDay - returns the day of the month from the structure, m.
+*)
+
+@findex GetDay
+PROCEDURE GetDay (m: tm) : CARDINAL ;
+
+
+(*
+   GetHour - returns the hour of the day from the structure, m.
+*)
+
+@findex GetHour
+PROCEDURE GetHour (m: tm) : CARDINAL ;
+
+
+(*
+   GetMinute - returns the minute within the hour from the structure, m.
+*)
+
+@findex GetMinute
+PROCEDURE GetMinute (m: tm) : CARDINAL ;
+
+
+(*
+   GetSecond - returns the seconds in the minute from the structure, m.
+               The return value will always be in the range 0..59.
+               A leap minute of value 60 will be truncated to 59.
+*)
+
+@findex GetSecond
+PROCEDURE GetSecond (m: tm) : CARDINAL ;
+
+
+(*
+   GetSummerTime - returns a boolean indicating whether summer time is
+                   set.
+*)
+
+@findex GetSummerTime
+PROCEDURE GetSummerTime (tz: timezone) : BOOLEAN ;
+
+
+(*
+   GetDST - returns the number of minutes west of GMT.
+*)
+
+@findex GetDST
+PROCEDURE GetDST (tz: timezone) : INTEGER ;
+
+
+(*
+   SetTimeval - sets the fields in timeval, tv, with:
+                second, minute, hour, day, month, year, fractions.
+*)
+
+@findex SetTimeval
+PROCEDURE SetTimeval (tv: timeval;
+                      second, minute, hour, day,
+                      month, year, yday, wday, isdst: CARDINAL) ;
+
+
+(*
+   SetTimezone - set the timezone field inside timeval, tv.
+*)
+
+@findex SetTimezone
+PROCEDURE SetTimezone (tv: timeval;
+                       zone: CARDINAL; minuteswest: INTEGER) ;
+
+
+END wraptime.
+@end example
+@page
+
+
+@c ------------------------------------------------------------
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/Builtins.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/target-independent/Builtins.texi	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,340 @@
+
+@example
+DEFINITION MODULE Builtins ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+(* floating point intrinsic procedure functions *)
+
+@findex isfinitef
+PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : BOOLEAN ;
+@findex isfinite
+PROCEDURE __BUILTIN__ isfinite (x: REAL) : BOOLEAN ;
+@findex isfinitel
+PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : BOOLEAN ;
+
+@findex sinf
+PROCEDURE __BUILTIN__ sinf (x: SHORTREAL) : SHORTREAL ;
+@findex sin
+PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
+@findex sinl
+PROCEDURE __BUILTIN__ sinl (x: LONGREAL) : LONGREAL ;
+
+@findex cosf
+PROCEDURE __BUILTIN__ cosf (x: SHORTREAL) : SHORTREAL ;
+@findex cos
+PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
+@findex cosl
+PROCEDURE __BUILTIN__ cosl (x: LONGREAL) : LONGREAL ;
+
+@findex sqrtf
+PROCEDURE __BUILTIN__ sqrtf (x: SHORTREAL) : SHORTREAL ;
+@findex sqrt
+PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
+@findex sqrtl
+PROCEDURE __BUILTIN__ sqrtl (x: LONGREAL) : LONGREAL ;
+
+@findex atan2f
+PROCEDURE __BUILTIN__ atan2f (x, y: SHORTREAL) : SHORTREAL ;
+@findex atan2
+PROCEDURE __BUILTIN__ atan2 (x, y: REAL) : REAL ;
+@findex atan2l
+PROCEDURE __BUILTIN__ atan2l (x, y: LONGREAL) : LONGREAL ;
+
+@findex fabsf
+PROCEDURE __BUILTIN__ fabsf (x: SHORTREAL) : SHORTREAL ;
+@findex fabs
+PROCEDURE __BUILTIN__ fabs (x: REAL) : REAL ;
+@findex fabsl
+PROCEDURE __BUILTIN__ fabsl (x: LONGREAL) : LONGREAL ;
+
+@findex logf
+PROCEDURE __BUILTIN__ logf (x: SHORTREAL) : SHORTREAL ;
+@findex log
+PROCEDURE __BUILTIN__ log (x: REAL) : REAL ;
+@findex logl
+PROCEDURE __BUILTIN__ logl (x: LONGREAL) : LONGREAL ;
+
+@findex expf
+PROCEDURE __BUILTIN__ expf (x: SHORTREAL) : SHORTREAL ;
+@findex exp
+PROCEDURE __BUILTIN__ exp (x: REAL) : REAL ;
+@findex expl
+PROCEDURE __BUILTIN__ expl (x: LONGREAL) : LONGREAL ;
+
+@findex log10f
+PROCEDURE __BUILTIN__ log10f (x: SHORTREAL) : SHORTREAL ;
+@findex log10
+PROCEDURE __BUILTIN__ log10 (x: REAL) : REAL ;
+@findex log10l
+PROCEDURE __BUILTIN__ log10l (x: LONGREAL) : LONGREAL ;
+
+@findex exp10f
+PROCEDURE __BUILTIN__ exp10f (x: SHORTREAL) : SHORTREAL ;
+@findex exp10
+PROCEDURE __BUILTIN__ exp10 (x: REAL) : REAL ;
+@findex exp10l
+PROCEDURE __BUILTIN__ exp10l (x: LONGREAL) : LONGREAL ;
+
+@findex ilogbf
+PROCEDURE __BUILTIN__ ilogbf (x: SHORTREAL) : INTEGER ;
+@findex ilogb
+PROCEDURE __BUILTIN__ ilogb (x: REAL) : INTEGER ;
+@findex ilogbl
+PROCEDURE __BUILTIN__ ilogbl (x: LONGREAL) : INTEGER ;
+
+@findex huge_val
+PROCEDURE __BUILTIN__ huge_val () : REAL ;
+@findex huge_valf
+PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ;
+@findex huge_vall
+PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ;
+
+@findex significand
+PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ;
+@findex significandf
+PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ;
+@findex significandl
+PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ;
+
+@findex modf
+PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ;
+@findex modff
+PROCEDURE __BUILTIN__ modff (x: SHORTREAL;
+                             VAR y: SHORTREAL) : SHORTREAL ;
+@findex modfl
+PROCEDURE __BUILTIN__ modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
+
+@findex signbit
+PROCEDURE __BUILTIN__ signbit (r: REAL) : INTEGER ;
+@findex signbitf
+PROCEDURE __BUILTIN__ signbitf (s: SHORTREAL) : INTEGER ;
+@findex signbitl
+PROCEDURE __BUILTIN__ signbitl (l: LONGREAL) : INTEGER ;
+
+@findex nextafter
+PROCEDURE __BUILTIN__ nextafter (x, y: REAL) : REAL ;
+@findex nextafterf
+PROCEDURE __BUILTIN__ nextafterf (x, y: SHORTREAL) : SHORTREAL ;
+@findex nextafterl
+PROCEDURE __BUILTIN__ nextafterl (x, y: LONGREAL) : LONGREAL ;
+
+@findex nexttoward
+PROCEDURE __BUILTIN__ nexttoward (x, y: REAL) : LONGREAL ;
+@findex nexttowardf
+PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ;
+@findex nexttowardl
+PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ;
+
+@findex scalb
+PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ;
+@findex scalbf
+PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ;
+@findex scalbl
+PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ;
+
+@findex scalbln
+PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ;
+@findex scalblnf
+PROCEDURE __BUILTIN__ scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
+@findex scalblnl
+PROCEDURE __BUILTIN__ scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
+
+@findex scalbn
+PROCEDURE __BUILTIN__ scalbn (x: REAL; n: INTEGER) : REAL ;
+@findex scalbnf
+PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
+@findex scalbnl
+PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
+
+(* complex arithmetic intrincic procedure functions *)
+
+@findex cabsf
+PROCEDURE __BUILTIN__ cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex cabs
+PROCEDURE __BUILTIN__ cabs (z: COMPLEX) : REAL ;
+@findex cabsl
+PROCEDURE __BUILTIN__ cabsl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex cargf
+PROCEDURE __BUILTIN__ cargf (z: SHORTCOMPLEX) : SHORTREAL ;
+@findex carg
+PROCEDURE __BUILTIN__ carg (z: COMPLEX) : REAL ;
+@findex cargl
+PROCEDURE __BUILTIN__ cargl (z: LONGCOMPLEX) : LONGREAL ;
+
+@findex conjf
+PROCEDURE __BUILTIN__ conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex conj
+PROCEDURE __BUILTIN__ conj (z: COMPLEX) : COMPLEX ;
+@findex conjl
+PROCEDURE __BUILTIN__ conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cpowerf
+PROCEDURE __BUILTIN__ cpowerf (base: SHORTCOMPLEX;
+                               exp: SHORTREAL) : SHORTCOMPLEX ;
+@findex cpower
+PROCEDURE __BUILTIN__ cpower (base: COMPLEX; exp: REAL) : COMPLEX ;
+@findex cpowerl
+PROCEDURE __BUILTIN__ cpowerl (base: LONGCOMPLEX;
+                               exp: LONGREAL) : LONGCOMPLEX ;
+
+@findex csqrtf
+PROCEDURE __BUILTIN__ csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csqrt
+PROCEDURE __BUILTIN__ csqrt (z: COMPLEX) : COMPLEX ;
+@findex csqrtl
+PROCEDURE __BUILTIN__ csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex cexpf
+PROCEDURE __BUILTIN__ cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cexp
+PROCEDURE __BUILTIN__ cexp (z: COMPLEX) : COMPLEX ;
+@findex cexpl
+PROCEDURE __BUILTIN__ cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex clnf
+PROCEDURE __BUILTIN__ clnf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex cln
+PROCEDURE __BUILTIN__ cln (z: COMPLEX) : COMPLEX ;
+@findex clnl
+PROCEDURE __BUILTIN__ clnl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex csinf
+PROCEDURE __BUILTIN__ csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex csin
+PROCEDURE __BUILTIN__ csin (z: COMPLEX) : COMPLEX ;
+@findex csinl
+PROCEDURE __BUILTIN__ csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ccosf
+PROCEDURE __BUILTIN__ ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ccos
+PROCEDURE __BUILTIN__ ccos (z: COMPLEX) : COMPLEX ;
+@findex ccosl
+PROCEDURE __BUILTIN__ ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex ctanf
+PROCEDURE __BUILTIN__ ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex ctan
+PROCEDURE __BUILTIN__ ctan (z: COMPLEX) : COMPLEX ;
+@findex ctanl
+PROCEDURE __BUILTIN__ ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carcsinf
+PROCEDURE __BUILTIN__ carcsinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carcsin
+PROCEDURE __BUILTIN__ carcsin (z: COMPLEX) : COMPLEX ;
+@findex carcsinl
+PROCEDURE __BUILTIN__ carcsinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carccosf
+PROCEDURE __BUILTIN__ carccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carccos
+PROCEDURE __BUILTIN__ carccos (z: COMPLEX) : COMPLEX ;
+@findex carccosl
+PROCEDURE __BUILTIN__ carccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+@findex carctanf
+PROCEDURE __BUILTIN__ carctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
+@findex carctan
+PROCEDURE __BUILTIN__ carctan (z: COMPLEX) : COMPLEX ;
+@findex carctanl
+PROCEDURE __BUILTIN__ carctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
+
+(* memory and string intrincic procedure functions *)
+
+@findex alloca
+PROCEDURE __BUILTIN__ alloca (i: CARDINAL) : ADDRESS ;
+@findex memcpy
+PROCEDURE __BUILTIN__ memcpy (dest, src: ADDRESS;
+                              nbytes: CARDINAL) : ADDRESS ;
+@findex index
+PROCEDURE __BUILTIN__ index (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex rindex
+PROCEDURE __BUILTIN__ rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex memcmp
+PROCEDURE __BUILTIN__ memcmp (s1, s2: ADDRESS;
+                              nbytes: CARDINAL) : INTEGER ;
+@findex memset
+PROCEDURE __BUILTIN__ memset (s: ADDRESS; c: INTEGER;
+                              nbytes: CARDINAL) : ADDRESS ;
+@findex memmove
+PROCEDURE __BUILTIN__ memmove (s1, s2: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcat
+PROCEDURE __BUILTIN__ strcat (dest, src: ADDRESS) : ADDRESS ;
+@findex strncat
+PROCEDURE __BUILTIN__ strncat (dest, src: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcpy
+PROCEDURE __BUILTIN__ strcpy (dest, src: ADDRESS) : ADDRESS ;
+@findex strncpy
+PROCEDURE __BUILTIN__ strncpy (dest, src: ADDRESS;
+                               nbytes: CARDINAL) : ADDRESS ;
+@findex strcmp
+PROCEDURE __BUILTIN__ strcmp (s1, s2: ADDRESS) : INTEGER ;
+@findex strncmp
+PROCEDURE __BUILTIN__ strncmp (s1, s2: ADDRESS;
+                               nbytes: CARDINAL) : INTEGER ;
+@findex strlen
+PROCEDURE __BUILTIN__ strlen (s: ADDRESS) : INTEGER ;
+@findex strstr
+PROCEDURE __BUILTIN__ strstr (haystack, needle: ADDRESS) : ADDRESS ;
+@findex strpbrk
+PROCEDURE __BUILTIN__ strpbrk (s, accept: ADDRESS) : ADDRESS ;
+@findex strspn
+PROCEDURE __BUILTIN__ strspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strcspn
+PROCEDURE __BUILTIN__ strcspn (s, accept: ADDRESS) : CARDINAL ;
+@findex strchr
+PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex strrchr
+PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+
+(*
+   longjmp - this GCC builtin restricts the val to always 1.
+*)
+(* do not use these two builtins, as gcc, only really
+   anticipates that the Ada front end should use them
+   and it only uses them in its runtime exception handling.
+   We leave them here in the hope that someday they will
+   behave more like their libc counterparts.  *)
+
+@findex longjmp
+PROCEDURE __BUILTIN__ longjmp (env: ADDRESS; val: INTEGER) ;
+@findex setjmp
+PROCEDURE __BUILTIN__ setjmp (env: ADDRESS) : INTEGER ;
+
+
+(*
+   frame_address - returns the address of the frame.
+                   The current frame is obtained if level is 0,
+                   the next level up if level is 1 etc.
+*)
+
+@findex frame_address
+PROCEDURE __BUILTIN__ frame_address (level: CARDINAL) : ADDRESS ;
+
+
+(*
+   return_address - returns the return address of function.
+                    The current function return address is
+                    obtained if level is 0,
+                    the next level up if level is 1 etc.
+*)
+
+@findex return_address
+PROCEDURE __BUILTIN__ return_address (level: CARDINAL) : ADDRESS ;
+
+
+(*
+   alloca_trace - this is a no-op which is used for internal debugging.
+*)
+
+@findex alloca_trace
+PROCEDURE alloca_trace (returned: ADDRESS; nBytes: CARDINAL) : ADDRESS ;
+
+
+END Builtins.
+@end example
diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-pim.texi
--- /dev/null	2022-08-24 16:22:16.888000070 +0100
+++ gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-pim.texi	2022-12-14 06:54:59.688966155 +0000
@@ -0,0 +1,176 @@
+
+@example
+DEFINITION MODULE SYSTEM ;
+
+EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
+                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+                 Target specific data types.  *)
+                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
+                 (* SIZE is also exported if -fpim2 is used.  *)
+
+CONST
+@findex BITSPERBYTE (const)
+  BITSPERBYTE   = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+@findex BYTESPERWORD (const)
+  BYTESPERWORD  = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+
+
+(* all the following types are declared internally to gm2
+TYPE
+   (* Target specific data types.  *)
+*)
+
+
+(*
+   all the functions below are declared internally to gm2
+   ====================================================
+
+@findex ADR
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+@findex SIZE
+PROCEDURE SIZE (v: <type>) : ZType;
+  (* Returns the number of BYTES used to store a v of
+     any specified <type>.  Only available if -fpim2 is used.
+  *)
+
+@findex TSIZE
+PROCEDURE TSIZE (<type>) : CARDINAL;
+  (* Returns the number of BYTES used to store a value of the
+     specified <type>.
+  *)
+
+@findex ROTATE
+PROCEDURE ROTATE (val: <a set type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up/right
+     or down/right by the absolute value of num.  The direction is
+     down/right if the sign of num is negative, otherwise the direction
+     is up/left.
+  *)
+
+@findex SHIFT
+PROCEDURE SHIFT (val: <a set type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up/left
+     or down/right by the absolute value of num, introducing
+     zeros as necessary.  The direction is down/right if the sign of
+     num is negative, otherwise the direction is up/left.
+  *)
+
+@findex THROW
+PROCEDURE THROW (i: INTEGER) ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the
+     EXCEPT block (assuming it exists).  This is a compiler builtin
+     function which interfaces to the GCC exception handling runtime
+     system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+@findex TBITSIZE
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word sized set types. They are not strictly part
+   of the core PIM Modula-2, however they are used
+   to implement the SHIFT procedure defined above,
+   which are in turn used by the Logitech compatible libraries.
+
+   Users will access these procedures by using the procedure
+   SHIFT above and GNU Modula-2 will map SHIFT onto one of
+   the following procedures.
+*)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will only
+              call this routine for larger sets.
+*)
+
+@findex ShiftVal
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+@findex ShiftLeft
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex ShiftRight
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for larger
+               sets.
+*)
+
+@findex RotateVal
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+@findex RotateLeft
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+@findex RotateRight
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
+@end example

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter).
  2022-12-14  7:48   ` [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter) Gaius Mulley
@ 2022-12-14  8:17     ` Richard Biener
  2022-12-14  8:35       ` Gaius Mulley
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2022-12-14  8:17 UTC (permalink / raw)
  To: Gaius Mulley; +Cc: gcc-patches

On Wed, Dec 14, 2022 at 8:48 AM Gaius Mulley <gaiusmod2@gmail.com> wrote:
>
>
>
> This patch set adds a re-exp ACX_CHECK_PROG_VER to detect python3.
> HAVE_PYTHON is then checked in gcc/m2/Make-lang.in to generate library
> chapters if python3 is available.  If python3 is unavailable then the
> chapters are copied from a target-independent version.
>
> Bugfixed --enable-generated-files-in-srcdir.
>
> Python3 modules section added to install.texi.
>
> Also included are the target-independent versions of the
> documentation.  The only difference is in the SYSTEM module which if
> generated when HAVE_PYTHON is "yes" will enumerate all fundamental
> data types supported by the target and compiler.
>
> I've hand snipped to try and reduce the size/noise as some of
> these files have already been reviewed.
>
> I'll post the unedited version as well for completness,

LGTM.

I'll note that in other GCC manuals we have target dependent
things documented for each supported target.  It looks like
the M2 docs will have only documentation built for the target
the compiler is built for?  So for example the online documentation
hosted on gcc.gnu.org will then contain only documentation for
the x86_64-linux target specific SYSTEM module?  Likewise when
building documentation for openSUSE (caveat: we only build
.info docs and manpages) the documentation is only built once
(aka for rpm 'noarch') with the idea it will be the same on all targets.

So it seems to me that enumerating the SYSTEM module documentation
for all targets or somehow differently organizing it would be better?

Thanks,
Richard.

> regards,
> Gaius
>
>
>
> ------8<----------8<----------8<----------8<----------8<----------8<----
> diff -ruw gcc-git-master/gcc/configure.ac gcc-git-devel-modula2/gcc/configure.ac
> --- gcc-git-master/gcc/configure.ac     2022-12-14 06:54:50.040826539 +0000
> +++ gcc-git-devel-modula2/gcc/configure.ac      2022-12-14 06:54:59.564964362 +0000
> @@ -1263,6 +1263,20 @@
>  # Bison?
>  AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
>
> +# Python3?
> +ACX_CHECK_PROG_VER(PYTHON, python3, --version,
> +  [Python.* \([0-9][0-9.]*\)],
> +  [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*])
> +if test $gcc_cv_prog_python3_modern = no; then
> +  AC_MSG_WARN([
> +*** Python3 is missing.
> +*** Documentation for modula-2 will not include the target SYSTEM module.])
> +  HAVE_PYTHON=no
> +else
> +  HAVE_PYTHON=yes
> +fi
> +AC_SUBST(HAVE_PYTHON)
> +
>  # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
>  # check for build == host before using them.
>
> @@ -7651,4 +7665,3 @@
>  ],
>  [subdirs='$subdirs'])
>  AC_OUTPUT
> -
> diff -ruw gcc-git-master/gcc/doc/install.texi gcc-git-devel-modula2/gcc/doc/install.texi
> --- gcc-git-master/gcc/doc/install.texi 2022-12-14 06:54:50.132827871 +0000
> +++ gcc-git-devel-modula2/gcc/doc/install.texi  2022-12-14 06:54:59.604964941 +0000
> @@ -308,6 +308,13 @@
>  and works if @option{--enable-libphobos} is used.  Specifics are
>  documented for affected targets.
>
> +@item @anchor{GM2-prerequisite}GM2
> +
> +Python3 is required if you want to build the complete Modula-2
> +documentation including the target @code{SYSTEM} definition module.
> +If Python3 is unavailable Modula-2 documentation will include a target
> +independent version of the SYSTEM modules.
> +
>  @item A ``working'' POSIX compatible shell, or GNU bash
>
>  Necessary when running @command{configure} because some
> @@ -436,6 +443,34 @@
>  The library is searched in your default library patch search.
>  Alternatively, the @option{--with-zstd} configure option should be used.
>
> +@item Python3 modules
> +
> +The complete list of Python3 modules broken down by GCC subcomponent
> +is shown below:
> +
> +@table @asis
> +@item internal debugging in gdbhooks
> +@code{gdb}, @code{gdb.printing}, @code{gdb.types},
> +@code{os.path}, @code{re}, @code{sys} and @code{tempfile},
> +
> +@item g++ testsuite
> +@code{gcov}, @code{gzip}, @code{json}, @code{os} and @code{pytest}.
> +
> +@item c++ cxx api generation
> +@code{csv}, @code{os}, @code{sys} and @code{time}.
> +
> +@item modula-2 documentation
> +@code{argparse}, @code{os}, @code{pathlib}, @code{shutil} and
> +@code{sys}.
> +
> +@item git developer tools
> +@code{os} and @code{sys}.
> +
> +@item ada documentation
> +@code{latex_elements}, @code{os}, @code{pygments}, @code{re},
> +@code{sys} and @code{time}.
> +@end table
> +
>  @end table
>
>  @heading Tools/packages necessary for modifying GCC
> @@ -3144,10 +3179,10 @@
>  In order to run sets of tests selectively, there are targets
>  @samp{make check-gcc} and language specific @samp{make check-c},
>  @samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
> -@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
> -@samp{make check-lto}
> -in the @file{gcc} subdirectory of the object directory.  You can also
> -just run @samp{make check} in a subdirectory of the object directory.
> +@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
> +@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
> +subdirectory of the object directory.  You can also just run
> +@samp{make check} in a subdirectory of the object directory.
>
>
>  A more selective way to just run all @command{gcc} execute tests in the
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/doc/gm2.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/doc/gm2.texi      2022-12-14 06:54:59.604964941 +0000
>
>   snip  (the changed text follows below, at "Finally the results")
>
> @node Regression tests, Limitations, Documentation, Using
> @section Regression tests for gm2 in the repository
>
> The regression testsuite can be run from the gcc build directory:
>
> @example
> $ cd build-gcc
> $ make check -j 24
> @end example
>
> which runs the complete testsuite for all compilers using 24 parallel
> invocations of the compiler.  Individual language testsuites can be
> run by specifying the language, for example the Modula-2 testsuite can
> be run using:
>
> @example
> $ cd build-gcc
> $ make check-m2 -j 24
> @end example
>
> +Finally the results of the testsuite can be emailed to the
> +@url{https://gcc.gnu.org/lists.html, gcc-testresults} list using the
> +@file{test_summary} script found in the gcc source tree:
> +
> +@example
> +$ @samp{directory to the sources}/contrib/test_summary
> +@end example
>
>   snip
>
> @node Limitations, Objectives, Regression tests, Using
> @section Limitations
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/tools-src/def2doc.py
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/tools-src/def2doc.py   2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,539 @@
>
> this file has been review before, I'm including it all for context.
> The lines starting + are the additions (near
> demangle_system_datatype):
>
> #!/usr/bin/env python3
>
> # def2doc.py creates texi library documentation for all exported procedures.
> # Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
>
> # Copyright (C) 2000-2022 Free Software Foundation, Inc.
> # This file is part of GNU Modula-2.
> #
> # GNU Modula-2 is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 3, or (at your option)
> # any later version.
> #
> # GNU Modula-2 is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> # along with GNU Modula-2; see the file COPYING.  If not, write to the
> # Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
> # 02110-1301, USA.
> #
>
> import argparse
> import os
> import sys
>
> Base_Libs = ['gm2-libs', 'Base libraries', 'Basic M2F compatible libraries']
>
> PIM_Log_Desc = 'PIM and Logitech 3.0 compatible libraries'
> PIM_Log = ['gm2-libs-pim', 'PIM and Logitech 3.0 Compatible', PIM_Log_Desc]
> PIM_Cor_Desc = 'PIM compatible process support'
> PIM_Cor = ['gm2-libs-coroutines', 'PIM coroutine support', PIM_Cor_Desc]
> ISO_Libs = ['gm2-libs-iso', 'M2 ISO Libraries', 'ISO defined libraries']
>
> library_classifications = [Base_Libs, PIM_Log, PIM_Cor, ISO_Libs]
>
> # state_states
> state_none, state_var, state_type, state_const = range(4)
> # block states
> block_none, block_code, block_text, block_index = range(4)
>
>
> class state:
>     def __init__(self):
>         self._state_state = state_none
>         self._block = block_none
>
>     def get_state(self):
>         return self._state_state
>
>     def set_state(self, value):
>         self._state_state = value
>
>     def is_const(self):
>         return self._state_state == state_const
>
>     def is_type(self):
>         return self._state_state == state_type
>
>     def is_var(self):
>         return self._state_state == state_var
>
>     def get_block(self):
>         return self._block
>
>     def _change_block(self, new_block):
>         if self._block != new_block:
>             self._block = new_block
>             self._emit_block_desc()
>
>     def _emit_block_desc(self):
>         if self._block == block_code:
>             output.write('.. code-block:: modula2\n')
>         elif self._block == block_index:
>             output.write('.. index::\n')
>
>     def to_code(self):
>         self._change_block(block_code)
>
>     def to_index(self):
>         self._change_block(block_index)
>
>
> def init_state():
>     global state_obj
>     state_obj = state()
>
>
> def emit_node(name, nxt, previous, up):
>     if args.texinfo:
>         output.write('@node ' + name + ', ' + nxt + ', ')
>         output.write(previous + ', ' + up + '\n')
>     elif args.sphinx:
>         output.write('@c @node ' + name + ', ' + nxt + ', ')
>         output.write(previous + ', ' + up + '\n')
>
>
> def emit_section(name):
>     if args.texinfo:
>         output.write('@section ' + name + '\n')
>     elif args.sphinx:
>         output.write(name + '\n')
>         output.write('=' * len(name) + '\n')
>
>
> def emit_sub_section(name):
>     if args.texinfo:
>         output.write('@subsection ' + name + '\n')
>     elif args.sphinx:
>         output.write(name + '\n')
>         output.write('-' * len(name) + '\n')
>
>
> def display_library_class():
>     # display_library_class displays a node for a library directory and invokes
>     # a routine to summarize each module.
>     global args
>     previous = ''
>     nxt = library_classifications[1][1]
>     i = 0
>     lib = library_classifications[i]
>     while True:
>         emit_node(lib[1], nxt, previous, args.up)
>         emit_section(lib[1])
>         output.write('\n')
>         display_modules(lib[1], lib[0], args.builddir, args.sourcedir)
>         output.write('\n')
>         output.write('@c ' + '-' * 60 + '\n')
>         previous = lib[1]
>         i += 1
>         if i == len(library_classifications):
>             break
>         lib = library_classifications[i]
>         if i+1 == len(library_classifications):
>             nxt = ''
>         else:
>             nxt = library_classifications[i+1][1]
>
>
> def display_menu():
>     # display_menu displays the top level menu for library documentation.
>     output.write('@menu\n')
>     for lib in library_classifications:
>         output.write('* ' + lib[1] + '::' + lib[2] + '\n')
>     output.write('@end menu\n')
>     output.write('\n')
>     output.write('@c ' + '=' * 60 + '\n')
>     output.write('\n')
>
>
> def remote_initial_comments(file, line):
>     # remote_initial_comments removes any (* *) at the top
>     # of the definition module.
>     while (line.find('*)') == -1):
>         line = file.readline()
>
>
> def removeable_field(line):
>     # removeable_field - returns True if a comment field should be removed
>     # from the definition module.
>     field_list = ['Author', 'Last edit', 'LastEdit', 'Last update',
>                   'Date', 'Title', 'Revision']
>     for field in field_list:
>         if (line.find(field) != -1) and (line.find(':') != -1):
>             return True
>     ignore_list = ['System', 'SYSTEM']
>     for ignore_field in ignore_list:
>         if line.find(ignore_field) != -1:
>             if line.find(':') != -1:
>                 if line.find('Description:') == -1:
>                     return True
>     return False
>
>
> def remove_fields(file, line):
>     # remove_fields removes Author/Date/Last edit/SYSTEM/Revision
>     # fields from a comment within the start of a definition module.
>     while (line.find('*)') == -1):
>         if not removeable_field(line):
>             line = line.rstrip().replace('{', '@{').replace('}', '@}')
>             output.write(line + '\n')
>         line = file.readline()
>     output.write(line.rstrip() + '\n')
>
>
> def emit_index(entry, tag):
>     global state_obj
>     if args.texinfo:
>         if tag == '':
>             output.write('@findex ' + entry.rstrip() + '\n')
>         else:
>             output.write('@findex ' + entry.rstrip() + ' ' + tag + '\n')
>     elif args.sphinx:
>         if tag == '':
>             state_obj.to_index()
>             output.write(' ' * 3 + entry.rstrip() + '\n')
>         else:
>             state_obj.to_index()
>             output.write(' ' * 3 + 'pair: ' + entry.rstrip() + '; ' + tag + '\n')
>
>
> def check_index(line):
>     # check_index - create an index entry for a PROCEDURE, TYPE, CONST or VAR.
>     global state_obj
>
>     words = line.split()
>     procedure = ''
>     if (len(words) > 1) and (words[0] == 'PROCEDURE'):
>         state_obj.set_state(state_none)
>         if (words[1] == '__BUILTIN__') and (len(words) > 2):
>             procedure = words[2]
>         else:
>             procedure = words[1]
>     if (len(line) > 1) and (line[0:2] == '(*'):
>         state_obj.set_state(state_none)
>     elif line == 'VAR':
>         state_obj.set_state(state_var)
>         return
>     elif line == 'TYPE':
>         state_obj.set_state(state_type)
>         return
>     elif line == 'CONST':
>         state_obj.set_state(state_const)
>     if state_obj.is_var():
>         words = line.split(',')
>         for word in words:
>             word = word.lstrip()
>             if word != '':
>                 if word.find(':') == -1:
>                     emit_index(word, '(var)')
>                 elif len(word) > 0:
>                     var = word.split(':')
>                     if len(var) > 0:
>                         emit_index(var[0], '(var)')
>     if state_obj.is_type():
>         words = line.lstrip()
>         if words.find('=') != -1:
>             word = words.split('=')
>             if (len(word[0]) > 0) and (word[0][0] != '_'):
>                 emit_index(word[0].rstrip(), '(type)')
>         else:
>             word = words.split()
>             if (len(word) > 1) and (word[1] == ';'):
>                 # hidden type
>                 if (len(word[0]) > 0) and (word[0][0] != '_'):
>                     emit_index(word[0].rstrip(), '(type)')
>     if state_obj.is_const():
>         words = line.split(';')
>         for word in words:
>             word = word.lstrip()
>             if word != '':
>                 if word.find('=') != -1:
>                     var = word.split('=')
>                     if len(var) > 0:
>                         emit_index(var[0], '(const)')
>     if procedure != '':
>         name = procedure.split('(')
>         if name[0] != '':
>             proc = name[0]
>             if proc[-1] == ';':
>                 proc = proc[:-1]
>             if proc != '':
>                 emit_index(proc, '')
>
> +def demangle_system_datatype(line, indent):
> +    # The spaces in front align in the export qualified list.
> +    indent += len ('EXPORT QUALIFIED ')
> +    line = line.replace('@SYSTEM_DATATYPES@',
> +                        '\n' + indent * ' ' + 'Target specific data types.')
> +    line = line.replace('@SYSTEM_TYPES@',
> +                        '(* Target specific data types.  *)')
> +    return line
> +
> +
> def emit_texinfo_content(f, line):
>     global state_obj
>     output.write(line.rstrip() + '\n')
>     line = f.readline()
>     if len(line.rstrip()) == 0:
>         output.write('\n')
>         line = f.readline()
>         if (line.find('(*') != -1):
>             remove_fields(f, line)
>         else:
>             output.write(line.rstrip() + '\n')
>     else:
>         output.write(line.rstrip() + '\n')
>     line = f.readline()
>     while line:
>         line = line.rstrip()
>         check_index(line)
>         line = line.replace('{', '@{').replace('}', '@}')
> +        line = demangle_system_datatype(line, 0)
>         output.write(line + '\n')
>         line = f.readline()
>     return f
>
>
> def emit_sphinx_content(f, line):
>     global state_obj
>     state_obj.to_code()
> +    indentation = 4
> +    indent = ' ' * indentation
>     output.write(indent + line.rstrip() + '\n')
>     line = f.readline()
>     if len(line.rstrip()) == 0:
>         output.write('\n')
>         line = f.readline()
>         if (line.find('(*') != -1):
>             remove_fields(f, line)
>         else:
>             output.write(indent + line.rstrip() + '\n')
>     else:
>         output.write(indent + line.rstrip() + '\n')
>     line = f.readline()
>     while line:
>         line = line.rstrip()
>         check_index(line)
>         state_obj.to_code()
> +        line = demangle_system_datatype(line, indentation)
>         output.write(indent + line + '\n')
>         line = f.readline()
>     return f
>
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/Make-lang.in
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/Make-lang.in   2022-12-14 06:54:59.636965403 +0000
>
> this has been reviewed, so I'm just including the changes.  Feel free
> to ask for the whole file though (likewise for the other hand snipped
> patches):
>
>    <snip>
>
> # Define the names for selecting modula-2 in LANGUAGES.
> m2 modula-2 modula2: gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext) \
>                  $(GCC_PASSES) $(GCC_PARTS)
> m2.serial = cc1gm2$(exeext)
> +
> +m2.srcinfo: doc/m2.info
> +       -cp -p $^ $(srcdir)/doc
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +m2.srcextra: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/gm2-libs.texi m2/gm2-ebnf.texi
> +       -cp -p m2/SYSTEM-pim.texi $(srcdir)/m2
> +       -cp -p m2/SYSTEM-iso.texi $(srcdir)/m2
> +       -cp -p m2/gm2-libs.texi $(srcdir)/m2
> +       -cp -p m2/gm2-ebnf.texi $(srcdir)/m2
> +       find . -name '*.texi' -print
> +else
> +m2.srcextra:
> +endif
> +
> +m2.srcman: doc/gm2.1
> +       -cp -p $^ $(srcdir)/doc
> +
> # Tell GNU make to ignore these if they exist.
> .PHONY: m2 modula-2 modula2
>
> GM2_PROG_DEP=gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext)
>
>    <snip>
>
> # gm2-libs.texi
>
> m2/gm2-libs.texi: gm2-libs.texi-check; @true
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +gm2-libs.texi-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
> +                     $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.texi
> +else
> +gm2-libs.texi-check:
> +       cp $(srcdir)/m2/target-independent/gm2-libs.texi $(objdir)/m2/gm2-libs.texi
> +endif
> +       $(STAMP) gm2-libs.texi-check
> +
> # gm2-libs.rst
>
> m2/gm2-libs.rst: gm2-libs.rst-check; @true
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +gm2-libs.rst-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
> +                     $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.rst
> +else
> +gm2-libs.rst-check:
> +       cp $(srcdir)/m2/target-independent/gm2-libs.rst $(objdir)/m2/gm2-libs.rst
> +endif
> +       $(STAMP) gm2-libs.rst-check
> +
> # gm2-ebnf.texi
>
> m2/gm2-ebnf.texi: gm2-ebnf.texi-check; @true
> +
> +gm2-ebnf.texi-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
> +       $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.texi
> +       $(STAMP) gm2-ebnf.texi-check
> +
> # gm2-ebnf.rst
>
> m2/gm2-ebnf.rst: gm2-ebnf.rst-check; @true
>
> +gm2-ebnf.rst-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
> +       $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.rst
> +       $(STAMP) gm2-ebnf.rst-check
> +
> # SYSTEM-pim.texi
>
> m2/SYSTEM-pim.texi: SYSTEM-pim-texi-check; @true
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.texi
> +else
> +SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
> +       cp $(srcdir)/m2/target-independent/SYSTEM-pim.texi $(objdir)/m2/SYSTEM-pim.texi
> +endif
> +       $(STAMP) SYSTEM-pim-texi-check
> +
> # SYSTEM-pim.rst
>
> m2/SYSTEM-pim.rst: SYSTEM-pim-rst-check; @true
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.rst
> +else
> +SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
> +       cp $(srcdir)/m2/target-independent/SYSTEM-pim.rst $(objdir)/m2/SYSTEM-pim.rst
> +endif
> +       $(STAMP) SYSTEM-pim-rst-check
> +
> # SYSTEM-pim.texi
>
> m2/SYSTEM-iso.texi:  SYSTEM-iso.texi-check; @true
> +
> +ifeq ($(HAVE_PYTHON),yes)
> +SYSTEM-iso.texi-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.texi
> +else
> +SYSTEM-iso.texi-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
> +       cp $(srcdir)/m2/target-independent/SYSTEM-iso.texi $(objdir)/m2/SYSTEM-iso.texi
> +endif
> +       $(STAMP) SYSTEM-iso.texi-check
> +
> # SYSTEM-pim.rst
>
> m2/SYSTEM-iso.rst:  SYSTEM-iso.rst-check; @true
>
> +ifeq ($(HAVE_PYTHON),yes)
> +SYSTEM-iso.rst-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.rst
> +else
> +SYSTEM-iso.rst-check:  $(objdir)/m2/gm2-libs-iso/SYSTEM.def
> +       cp $(srcdir)/m2/target-independent/SYSTEM-iso.rst $(objdir)/m2/SYSTEM-iso.rst
> +endif
> +       $(STAMP) SYSTEM-iso.rst-check
> +
> +
> # m2/Builtins.texi
>
> m2/Builtins.texi:  Builtins.texi-check; @true
>
> +ifeq ($(HAVE_PYTHON),yes)
> +Builtins.texi-check:  m2/gm2-libs/Builtins.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.texi
> +else
> +Builtins.texi-check:  m2/gm2-libs/Builtins.def
> +       cp $(srcdir)/m2/target-independent/Builtins.texi $(objdir)/m2/Builtins.texi
> +endif
> +       $(STAMP) Builtins.texi-check
> +
> # m2/Builtins.rst
>
> m2/Builtins.rst:  Builtins.rst-check; @true
>
> +ifeq ($(HAVE_PYTHON),yes)
> +Builtins.rst-check:  m2/gm2-libs/Builtins.def
> +       $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.rst
> +else
> +Builtins.rst-check:  m2/gm2-libs/Builtins.def
> +       cp $(srcdir)/m2/target-independent/Builtins.rst $(objdir)/m2/Builtins.rst
> +endif
> +       $(STAMP) Builtins.rst-check
>
>   <snip>
>
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/Make-maintainer.in
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/Make-maintainer.in     2022-12-14 06:54:59.636965403 +0000
>
>   file has been reviewed before, manually snipped to show additions:
>
> +# Recreate the target independent copies of the documentation which is
> +# used during the build if Python3 is unavailable.
> +
> +# m2-target-independent-doc-rst should be enabled once
> +# tools-src/def2doc.py is completed (module hyperlinks need rst
> +# treatment).
> +
> +m2-target-independent-doc: m2-target-independent-doc-texi # m2-target-independent-doc-rst
> +
> +m2-target-independent-doc-texi: force
> +ifeq ($(HAVE_PYTHON),yes)
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.texi
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.texi
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.texi
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.texi
> +else
> +       echo "m2-target-independent-doc-texi will only work if Python3 was detected during configure"
> +endif
> +
> +m2-target-independent-doc-rst: force
> +ifeq ($(HAVE_PYTHON),yes)
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.rst
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.rst
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.rst
> +       python3 $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.rst
> +else
> +       echo "m2-target-independent-doc-rst will only work if Python3 was detected during configure"
> +endif
>
>
> here are the target independent SYSTEM-iso.texi, SYSTEM-pim.texi,
> gm2-libs.texi, Builtins.texi which are used if python3 is unavailable.
> It is maintainer generated via gcc/m2/tools-src/def2doc.py (above).
> All files below are machine generated.
>
>
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/readme.txt
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/target-independent/readme.txt  2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,3 @@
> +This directory contains the target independent copies of the
> +documentation which will be used if Python3 is unavailable during the
> +build.
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-iso.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-iso.texi     2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,237 @@
> +
> +@example
> +DEFINITION MODULE SYSTEM;
> +
> +  (* Gives access to system programming facilities that are probably
> +     non portable. *)
> +
> +  (* The constants and types define underlying properties of storage *)
> +
> +EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
> +                 LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
> +                 Target specific data types.  *)
> +                 ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
> +                 SHIFT, CAST, TSIZE,
> +
> +                 (* Internal GM2 compiler functions *)
> +                 ShiftVal, ShiftLeft, ShiftRight,
> +                 RotateVal, RotateLeft, RotateRight,
> +                 THROW, TBITSIZE ;
> +
> +CONST
> +                  (* <implementation-defined constant> ; *)
> +@findex BITSPERLOC (const)
> +  BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
> +                  (* <implementation-defined constant> ; *)
> +@findex LOCSPERWORD (const)
> +  LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
> +                  (* <implementation-defined constant> ; *)
> +@findex LOCSPERBYTE (const)
> +  LOCSPERBYTE = 8 DIV BITSPERLOC ;
> +
> +(*
> +   all the objects below are declared internally to gm2
> +   ====================================================
> +
> +TYPE
> +   (* Target specific data types.  *)
> +
> +TYPE
> +  LOC; (* A system basic type. Values are the uninterpreted
> +          contents of the smallest addressable unit of storage *)
> +@findex ADDRESS (type)
> +  ADDRESS = POINTER TO LOC;
> +@findex WORD (type)
> +  WORD = ARRAY [0 .. LOCSPERWORD-1] OF LOC;
> +
> +  (* BYTE and LOCSPERBYTE are provided if appropriate for machine *)
> +
> +TYPE
> +@findex BYTE (type)
> +  BYTE = ARRAY [0 .. LOCSPERBYTE-1] OF LOC;
> +
> +@findex ADDADR
> +PROCEDURE ADDADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
> +  (* Returns address given by (addr + offset), or may raise
> +     an exception if this address is not valid.
> +  *)
> +
> +@findex SUBADR
> +PROCEDURE SUBADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
> +  (* Returns address given by (addr - offset), or may raise an
> +     exception if this address is not valid.
> +  *)
> +
> +@findex DIFADR
> +PROCEDURE DIFADR (addr1, addr2: ADDRESS): INTEGER;
> +  (* Returns the difference between addresses (addr1 - addr2),
> +     or may raise an exception if the arguments are invalid
> +     or address space is non-contiguous.
> +  *)
> +
> +@findex MAKEADR
> +PROCEDURE MAKEADR (high: <some type>; ...): ADDRESS;
> +  (* Returns an address constructed from a list of values whose
> +     types are implementation-defined, or may raise an
> +     exception if this address is not valid.
> +
> +     In GNU Modula-2, MAKEADR can take any number of arguments
> +     which are mapped onto the type ADDRESS. The first parameter
> +     maps onto the high address bits and subsequent parameters map
> +     onto lower address bits. For example:
> +
> +     a := MAKEADR(BYTE(0FEH), BYTE(0DCH), BYTE(0BAH), BYTE(098H),
> +                  BYTE(076H), BYTE(054H), BYTE(032H), BYTE(010H)) ;
> +
> +     then the value of, a, on a 64 bit machine is: 0FEDCBA9876543210H
> +
> +     The parameters do not have to be the same type, but constants
> +     _must_ be typed.
> +  *)
> +
> +@findex ADR
> +PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
> +  (* Returns the address of variable v. *)
> +
> +@findex ROTATE
> +PROCEDURE ROTATE (val: <a packedset type>;
> +                  num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by rotating up/right
> +     or down/right by the absolute value of num.  The direction is
> +     down/right if the sign of num is negative, otherwise the direction
> +     is up/left.
> +  *)
> +
> +@findex SHIFT
> +PROCEDURE SHIFT (val: <a packedset type>;
> +                 num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by shifting up/left
> +     or down/right by the absolute value of num, introducing
> +     zeros as necessary.  The direction is down/right if the sign of
> +     num is negative, otherwise the direction is up/left.
> +  *)
> +
> +@findex CAST
> +PROCEDURE CAST (<targettype>; val: <anytype>): <targettype>;
> +  (* CAST is a type transfer function.  Given the expression
> +     denoted by val, it returns a value of the type <targettype>.
> +     An invalid value for the target value or a
> +     physical address alignment problem may raise an exception.
> +  *)
> +
> +@findex TSIZE
> +PROCEDURE TSIZE (<type>; ... ): CARDINAL;
> +  (* Returns the number of LOCS used to store a value of the
> +     specified <type>.   The extra parameters, if present,
> +     are used to distinguish variants in a variant record.
> +  *)
> +
> +@findex THROW
> +PROCEDURE THROW (i: INTEGER) ;
> +  (*
> +     THROW is a GNU extension and was not part of the PIM or ISO
> +     standards.  It throws an exception which will be caught by the
> +     EXCEPT block (assuming it exists).  This is a compiler builtin
> +     function which interfaces to the GCC exception handling runtime
> +     system.
> +     GCC uses the term throw, hence the naming distinction between
> +     the GCC builtin and the Modula-2 runtime library procedure Raise.
> +     The later library procedure Raise will call SYSTEM.THROW after
> +     performing various housekeeping activities.
> +  *)
> +
> +@findex TBITSIZE
> +PROCEDURE TBITSIZE (<type>) : CARDINAL ;
> +  (* Returns the minimum number of bits necessary to represent
> +     <type>.  This procedure function is only useful for determining
> +     the number of bits used for any type field within a packed RECORD.
> +     It is not particularly useful elsewhere since <type> might be
> +     optimized for speed, for example a BOOLEAN could occupy a WORD.
> +  *)
> +*)
> +
> +
> +(* The following procedures are invoked by GNU Modula-2 to
> +   shift non word set types. They are not part of ISO Modula-2
> +   but are used to implement the SHIFT procedure defined above. *)
> +
> +(*
> +   ShiftVal - is a runtime procedure whose job is to implement
> +              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
> +              inline a SHIFT of a single WORD sized set and will only
> +              call this routine for larger sets.
> +*)
> +
> +@findex ShiftVal
> +PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
> +                    SetSizeInBits: CARDINAL;
> +                    ShiftCount: INTEGER) ;
> +
> +
> +(*
> +   ShiftLeft - performs the shift left for a multi word set.
> +               This procedure might be called by the back end of
> +               GNU Modula-2 depending whether amount is known at
> +               compile time.
> +*)
> +
> +@findex ShiftLeft
> +PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +(*
> +   ShiftRight - performs the shift left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex ShiftRight
> +PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateVal - is a runtime procedure whose job is to implement
> +               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
> +               inline a ROTATE of a single WORD (or less)
> +               sized set and will only call this routine for larger
> +               sets.
> +*)
> +
> +@findex RotateVal
> +PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     RotateCount: INTEGER) ;
> +
> +
> +(*
> +   RotateLeft - performs the rotate left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex RotateLeft
> +PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      RotateCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateRight - performs the rotate right for a multi word set.
> +                 This procedure might be called by the back end of
> +                 GNU Modula-2 depending whether amount is known at
> +                 compile time.
> +*)
> +
> +@findex RotateRight
> +PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
> +                       SetSizeInBits: CARDINAL;
> +                       RotateCount: CARDINAL) ;
> +
> +
> +END SYSTEM.
> +@end example
>
>
> and the same for gcc/m2/target-independent/gm2-libs.texi
>
>
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/gm2-libs.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/target-independent/gm2-libs.texi       2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,14924 @@
> +@c Copyright (C) 2000-2022 Free Software Foundation, Inc.
> +@c This file is part of GNU Modula-2.
> +
> +@c Permission is granted to copy, distribute and/or modify this document
> +@c under the terms of the GNU Free Documentation License, Version 1.2 or
> +@c any later version published by the Free Software Foundation.
> +@menu
> +* Base libraries::Basic M2F compatible libraries
> +* PIM and Logitech 3.0 Compatible::PIM and Logitech 3.0 compatible libraries
> +* PIM coroutine support::PIM compatible process support
> +* M2 ISO Libraries::ISO defined libraries
> +@end menu
> +
> +@c ============================================================
> +
> +@node Base libraries, PIM and Logitech 3.0 Compatible, , Libraries
> +@section Base libraries
> +
> +@c README.texi describes the pim libraries.
> +@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
> +@c
> +@c This is part of the GM2 manual.
> +@c For copying conditions, see the file gcc/doc/include/fdl.texi.
> +
> +These are the base libraries for the GNU Modula-2 compiler.  These
> +modules originally came from the M2F compiler and have been cleaned up
> +and extended.  They provide a basic interface to the underlying
> +operating system via libc.  They also include a number of libraries to
> +allow access to compiler built-ins. Perhaps the largest difference to
> +PIM and ISO libraries is the @code{DynamicString} module which
> +declares the type @code{String}.  The heavy use of this opaque data
> +type results in a number of equivalent modules that can either handle
> +@code{ARRAY OF CHAR} or @code{String}.
> +
> +These modules have been extensively tested and are used throughout
> +building the GNU Modula-2 compiler.
> +@menu
> +* gm2-libs/ASCII::ASCII.def
> +* gm2-libs/Args::Args.def
> +* gm2-libs/Assertion::Assertion.def
> +* gm2-libs/Break::Break.def
> +* gm2-libs/Builtins::Builtins.def
> +* gm2-libs/COROUTINES::COROUTINES.def
> +* gm2-libs/CmdArgs::CmdArgs.def
> +* gm2-libs/Debug::Debug.def
> +* gm2-libs/DynamicStrings::DynamicStrings.def
> +* gm2-libs/Environment::Environment.def
> +* gm2-libs/FIO::FIO.def
> +* gm2-libs/FormatStrings::FormatStrings.def
> +* gm2-libs/FpuIO::FpuIO.def
> +* gm2-libs/GetOpt::GetOpt.def
> +* gm2-libs/IO::IO.def
> +* gm2-libs/Indexing::Indexing.def
> +* gm2-libs/LMathLib0::LMathLib0.def
> +* gm2-libs/LegacyReal::LegacyReal.def
> +* gm2-libs/M2Dependent::M2Dependent.def
> +* gm2-libs/M2EXCEPTION::M2EXCEPTION.def
> +* gm2-libs/M2LINK::M2LINK.def
> +* gm2-libs/M2RTS::M2RTS.def
> +* gm2-libs/MathLib0::MathLib0.def
> +* gm2-libs/MemUtils::MemUtils.def
> +* gm2-libs/NumberIO::NumberIO.def
> +* gm2-libs/OptLib::OptLib.def
> +* gm2-libs/PushBackInput::PushBackInput.def
> +* gm2-libs/RTExceptions::RTExceptions.def
> +* gm2-libs/RTint::RTint.def
> +* gm2-libs/SArgs::SArgs.def
> +* gm2-libs/SCmdArgs::SCmdArgs.def
> +* gm2-libs/SEnvironment::SEnvironment.def
> +* gm2-libs/SFIO::SFIO.def
> +* gm2-libs/SMathLib0::SMathLib0.def
> +* gm2-libs/SYSTEM::SYSTEM.def
> +* gm2-libs/Scan::Scan.def
> +* gm2-libs/Selective::Selective.def
> +* gm2-libs/StdIO::StdIO.def
> +* gm2-libs/Storage::Storage.def
> +* gm2-libs/StrCase::StrCase.def
> +* gm2-libs/StrIO::StrIO.def
> +* gm2-libs/StrLib::StrLib.def
> +* gm2-libs/StringConvert::StringConvert.def
> +* gm2-libs/SysExceptions::SysExceptions.def
> +* gm2-libs/SysStorage::SysStorage.def
> +* gm2-libs/TimeString::TimeString.def
> +* gm2-libs/UnixArgs::UnixArgs.def
> +* gm2-libs/cbuiltin::cbuiltin.def
> +* gm2-libs/cgetopt::cgetopt.def
> +* gm2-libs/cxxabi::cxxabi.def
> +* gm2-libs/dtoa::dtoa.def
> +* gm2-libs/errno::errno.def
> +* gm2-libs/gdbif::gdbif.def
> +* gm2-libs/ldtoa::ldtoa.def
> +* gm2-libs/libc::libc.def
> +* gm2-libs/libm::libm.def
> +* gm2-libs/sckt::sckt.def
> +* gm2-libs/termios::termios.def
> +* gm2-libs/wrapc::wrapc.def
> +@end menu
> +
> +@node gm2-libs/ASCII, gm2-libs/Args, , Base libraries
> +@subsection gm2-libs/ASCII
> +
> +@example
> +DEFINITION MODULE ASCII ;
> +
> +EXPORT QUALIFIED
> +     nul, soh, stx, etx, eot, enq, ack, bel,
> +     bs , ht , nl , vt , np , cr , so , si ,
> +     dle, dc1, dc2, dc3, dc4, nak, syn, etb,
> +     can, em , sub, esc, fs , gs , rs , us ,
> +     sp ,  (* All the above are in order *)
> +     lf, ff, eof, del, tab, EOL ;
> +
> +(*
> +   Note that lf, eof and EOL are added.
> +*)
> +
> +CONST
> +@findex nul (const)
> +@findex soh (const)
> +@findex stx (const)
> +@findex etx (const)
> +     nul=000C; soh=001C; stx=002C; etx=003C;
> +@findex eot (const)
> +@findex enq (const)
> +@findex ack (const)
> +@findex bel (const)
> +     eot=004C; enq=005C; ack=006C; bel=007C;
> +@findex bs (const)
> +@findex ht (const)
> +@findex nl (const)
> +@findex vt (const)
> +     bs =010C; ht =011C; nl =012C; vt =013C;
> +@findex np (const)
> +@findex cr (const)
> +@findex so (const)
> +@findex si (const)
> +     np =014C; cr =015C; so =016C; si =017C;
> +@findex dle (const)
> +@findex dc1 (const)
> +@findex dc2 (const)
> +@findex dc3 (const)
> +     dle=020C; dc1=021C; dc2=022C; dc3=023C;
> +@findex dc4 (const)
> +@findex nak (const)
> +@findex syn (const)
> +@findex etb (const)
> +     dc4=024C; nak=025C; syn=026C; etb=027C;
> +@findex can (const)
> +@findex em (const)
> +@findex sub (const)
> +@findex esc (const)
> +     can=030C; em =031C; sub=032C; esc=033C;
> +@findex fs (const)
> +@findex gs (const)
> +@findex rs (const)
> +@findex us (const)
> +     fs =034C; gs =035C; rs =036C; us =037C;
> +@findex sp (const)
> +     sp =040C; (* All the above are in order *)
> +@findex lf (const)
> +@findex ff (const)
> +@findex eof (const)
> +@findex tab (const)
> +     lf =nl  ; ff =np  ; eof=eot ; tab=ht  ;
> +@findex del (const)
> +@findex EOL (const)
> +     del=177C; EOL=nl  ;
> +
> +END ASCII.
> +@end example
> +@page
> +
> +@node gm2-libs/Args, gm2-libs/Assertion, gm2-libs/ASCII, Base libraries
> +@subsection gm2-libs/Args
> +
> +@example
> +DEFINITION MODULE Args ;
> +
> +EXPORT QUALIFIED GetArg, Narg ;
> +
> +
> +(*
> +   GetArg - returns the nth argument from the command line.
> +            The success of the operation is returned.
> +*)
> +
> +@findex GetArg
> +PROCEDURE GetArg (VAR a: ARRAY OF CHAR; n: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   Narg - returns the number of arguments available from
> +          command line.
> +*)
> +
> +@findex Narg
> +PROCEDURE Narg () : CARDINAL ;
> +
> +
> +END Args.
> +@end example
> +@page
> +
> +@node gm2-libs/Assertion, gm2-libs/Break, gm2-libs/Args, Base libraries
> +@subsection gm2-libs/Assertion
> +
> +@example
> +DEFINITION MODULE Assertion ;
> +
> +EXPORT QUALIFIED Assert ;
> +
> +
> +(*
> +   Assert - tests the boolean Condition, if it fails then HALT
> +            is called.
> +*)
> +
> +@findex Assert
> +PROCEDURE Assert (Condition: BOOLEAN) ;
> +
> +
> +END Assertion.
> +@end example
> +@page
> +
> +@node gm2-libs/Break, gm2-libs/Builtins, gm2-libs/Assertion, Base libraries
> +@subsection gm2-libs/Break
> +
> +@example
> +DEFINITION MODULE Break ;
> +
> +END Break.
> +@end example
> +@page
> +
> +@node gm2-libs/Builtins, gm2-libs/COROUTINES, gm2-libs/Break, Base libraries
> +@subsection gm2-libs/Builtins
> +
> +@example
> +DEFINITION MODULE Builtins ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +(* floating point intrinsic procedure functions *)
> +
> +@findex isfinitef
> +PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : BOOLEAN ;
> +@findex isfinite
> +PROCEDURE __BUILTIN__ isfinite (x: REAL) : BOOLEAN ;
> +@findex isfinitel
> +PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : BOOLEAN ;
> +
> +@findex sinf
> +PROCEDURE __BUILTIN__ sinf (x: SHORTREAL) : SHORTREAL ;
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
> +@findex sinl
> +PROCEDURE __BUILTIN__ sinl (x: LONGREAL) : LONGREAL ;
> +
> +@findex cosf
> +PROCEDURE __BUILTIN__ cosf (x: SHORTREAL) : SHORTREAL ;
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
> +@findex cosl
> +PROCEDURE __BUILTIN__ cosl (x: LONGREAL) : LONGREAL ;
> +
> +@findex sqrtf
> +PROCEDURE __BUILTIN__ sqrtf (x: SHORTREAL) : SHORTREAL ;
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
> +@findex sqrtl
> +PROCEDURE __BUILTIN__ sqrtl (x: LONGREAL) : LONGREAL ;
> +
> +@findex atan2f
> +PROCEDURE __BUILTIN__ atan2f (x, y: SHORTREAL) : SHORTREAL ;
> +@findex atan2
> +PROCEDURE __BUILTIN__ atan2 (x, y: REAL) : REAL ;
> +@findex atan2l
> +PROCEDURE __BUILTIN__ atan2l (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex fabsf
> +PROCEDURE __BUILTIN__ fabsf (x: SHORTREAL) : SHORTREAL ;
> +@findex fabs
> +PROCEDURE __BUILTIN__ fabs (x: REAL) : REAL ;
> +@findex fabsl
> +PROCEDURE __BUILTIN__ fabsl (x: LONGREAL) : LONGREAL ;
> +
> +@findex logf
> +PROCEDURE __BUILTIN__ logf (x: SHORTREAL) : SHORTREAL ;
> +@findex log
> +PROCEDURE __BUILTIN__ log (x: REAL) : REAL ;
> +@findex logl
> +PROCEDURE __BUILTIN__ logl (x: LONGREAL) : LONGREAL ;
> +
> +@findex expf
> +PROCEDURE __BUILTIN__ expf (x: SHORTREAL) : SHORTREAL ;
> +@findex exp
> +PROCEDURE __BUILTIN__ exp (x: REAL) : REAL ;
> +@findex expl
> +PROCEDURE __BUILTIN__ expl (x: LONGREAL) : LONGREAL ;
> +
> +@findex log10f
> +PROCEDURE __BUILTIN__ log10f (x: SHORTREAL) : SHORTREAL ;
> +@findex log10
> +PROCEDURE __BUILTIN__ log10 (x: REAL) : REAL ;
> +@findex log10l
> +PROCEDURE __BUILTIN__ log10l (x: LONGREAL) : LONGREAL ;
> +
> +@findex exp10f
> +PROCEDURE __BUILTIN__ exp10f (x: SHORTREAL) : SHORTREAL ;
> +@findex exp10
> +PROCEDURE __BUILTIN__ exp10 (x: REAL) : REAL ;
> +@findex exp10l
> +PROCEDURE __BUILTIN__ exp10l (x: LONGREAL) : LONGREAL ;
> +
> +@findex ilogbf
> +PROCEDURE __BUILTIN__ ilogbf (x: SHORTREAL) : INTEGER ;
> +@findex ilogb
> +PROCEDURE __BUILTIN__ ilogb (x: REAL) : INTEGER ;
> +@findex ilogbl
> +PROCEDURE __BUILTIN__ ilogbl (x: LONGREAL) : INTEGER ;
> +
> +@findex huge_val
> +PROCEDURE __BUILTIN__ huge_val () : REAL ;
> +@findex huge_valf
> +PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ;
> +@findex huge_vall
> +PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ;
> +
> +@findex significand
> +PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ;
> +@findex significandf
> +PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ;
> +@findex significandl
> +PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ;
> +
> +@findex modf
> +PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ;
> +@findex modff
> +PROCEDURE __BUILTIN__ modff (x: SHORTREAL;
> +                             VAR y: SHORTREAL) : SHORTREAL ;
> +@findex modfl
> +PROCEDURE __BUILTIN__ modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
> +
> +@findex signbit
> +PROCEDURE __BUILTIN__ signbit (r: REAL) : INTEGER ;
> +@findex signbitf
> +PROCEDURE __BUILTIN__ signbitf (s: SHORTREAL) : INTEGER ;
> +@findex signbitl
> +PROCEDURE __BUILTIN__ signbitl (l: LONGREAL) : INTEGER ;
> +
> +@findex nextafter
> +PROCEDURE __BUILTIN__ nextafter (x, y: REAL) : REAL ;
> +@findex nextafterf
> +PROCEDURE __BUILTIN__ nextafterf (x, y: SHORTREAL) : SHORTREAL ;
> +@findex nextafterl
> +PROCEDURE __BUILTIN__ nextafterl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex nexttoward
> +PROCEDURE __BUILTIN__ nexttoward (x, y: REAL) : LONGREAL ;
> +@findex nexttowardf
> +PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ;
> +@findex nexttowardl
> +PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex scalb
> +PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ;
> +@findex scalbf
> +PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ;
> +@findex scalbl
> +PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ;
> +
> +@findex scalbln
> +PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ;
> +@findex scalblnf
> +PROCEDURE __BUILTIN__ scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
> +@findex scalblnl
> +PROCEDURE __BUILTIN__ scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
> +
> +@findex scalbn
> +PROCEDURE __BUILTIN__ scalbn (x: REAL; n: INTEGER) : REAL ;
> +@findex scalbnf
> +PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
> +@findex scalbnl
> +PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
> +
> +(* complex arithmetic intrincic procedure functions *)
> +
> +@findex cabsf
> +PROCEDURE __BUILTIN__ cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex cabs
> +PROCEDURE __BUILTIN__ cabs (z: COMPLEX) : REAL ;
> +@findex cabsl
> +PROCEDURE __BUILTIN__ cabsl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex cargf
> +PROCEDURE __BUILTIN__ cargf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex carg
> +PROCEDURE __BUILTIN__ carg (z: COMPLEX) : REAL ;
> +@findex cargl
> +PROCEDURE __BUILTIN__ cargl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex conjf
> +PROCEDURE __BUILTIN__ conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex conj
> +PROCEDURE __BUILTIN__ conj (z: COMPLEX) : COMPLEX ;
> +@findex conjl
> +PROCEDURE __BUILTIN__ conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cpowerf
> +PROCEDURE __BUILTIN__ cpowerf (base: SHORTCOMPLEX;
> +                               exp: SHORTREAL) : SHORTCOMPLEX ;
> +@findex cpower
> +PROCEDURE __BUILTIN__ cpower (base: COMPLEX; exp: REAL) : COMPLEX ;
> +@findex cpowerl
> +PROCEDURE __BUILTIN__ cpowerl (base: LONGCOMPLEX;
> +                               exp: LONGREAL) : LONGCOMPLEX ;
> +
> +@findex csqrtf
> +PROCEDURE __BUILTIN__ csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csqrt
> +PROCEDURE __BUILTIN__ csqrt (z: COMPLEX) : COMPLEX ;
> +@findex csqrtl
> +PROCEDURE __BUILTIN__ csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cexpf
> +PROCEDURE __BUILTIN__ cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cexp
> +PROCEDURE __BUILTIN__ cexp (z: COMPLEX) : COMPLEX ;
> +@findex cexpl
> +PROCEDURE __BUILTIN__ cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex clnf
> +PROCEDURE __BUILTIN__ clnf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cln
> +PROCEDURE __BUILTIN__ cln (z: COMPLEX) : COMPLEX ;
> +@findex clnl
> +PROCEDURE __BUILTIN__ clnl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex csinf
> +PROCEDURE __BUILTIN__ csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csin
> +PROCEDURE __BUILTIN__ csin (z: COMPLEX) : COMPLEX ;
> +@findex csinl
> +PROCEDURE __BUILTIN__ csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ccosf
> +PROCEDURE __BUILTIN__ ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ccos
> +PROCEDURE __BUILTIN__ ccos (z: COMPLEX) : COMPLEX ;
> +@findex ccosl
> +PROCEDURE __BUILTIN__ ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ctanf
> +PROCEDURE __BUILTIN__ ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ctan
> +PROCEDURE __BUILTIN__ ctan (z: COMPLEX) : COMPLEX ;
> +@findex ctanl
> +PROCEDURE __BUILTIN__ ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carcsinf
> +PROCEDURE __BUILTIN__ carcsinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carcsin
> +PROCEDURE __BUILTIN__ carcsin (z: COMPLEX) : COMPLEX ;
> +@findex carcsinl
> +PROCEDURE __BUILTIN__ carcsinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carccosf
> +PROCEDURE __BUILTIN__ carccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carccos
> +PROCEDURE __BUILTIN__ carccos (z: COMPLEX) : COMPLEX ;
> +@findex carccosl
> +PROCEDURE __BUILTIN__ carccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carctanf
> +PROCEDURE __BUILTIN__ carctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carctan
> +PROCEDURE __BUILTIN__ carctan (z: COMPLEX) : COMPLEX ;
> +@findex carctanl
> +PROCEDURE __BUILTIN__ carctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +(* memory and string intrincic procedure functions *)
> +
> +@findex alloca
> +PROCEDURE __BUILTIN__ alloca (i: CARDINAL) : ADDRESS ;
> +@findex memcpy
> +PROCEDURE __BUILTIN__ memcpy (dest, src: ADDRESS;
> +                              nbytes: CARDINAL) : ADDRESS ;
> +@findex index
> +PROCEDURE __BUILTIN__ index (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex rindex
> +PROCEDURE __BUILTIN__ rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex memcmp
> +PROCEDURE __BUILTIN__ memcmp (s1, s2: ADDRESS;
> +                              nbytes: CARDINAL) : INTEGER ;
> +@findex memset
> +PROCEDURE __BUILTIN__ memset (s: ADDRESS; c: INTEGER;
> +                              nbytes: CARDINAL) : ADDRESS ;
> +@findex memmove
> +PROCEDURE __BUILTIN__ memmove (s1, s2: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcat
> +PROCEDURE __BUILTIN__ strcat (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncat
> +PROCEDURE __BUILTIN__ strncat (dest, src: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcpy
> +PROCEDURE __BUILTIN__ strcpy (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncpy
> +PROCEDURE __BUILTIN__ strncpy (dest, src: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcmp
> +PROCEDURE __BUILTIN__ strcmp (s1, s2: ADDRESS) : INTEGER ;
> +@findex strncmp
> +PROCEDURE __BUILTIN__ strncmp (s1, s2: ADDRESS;
> +                               nbytes: CARDINAL) : INTEGER ;
> +@findex strlen
> +PROCEDURE __BUILTIN__ strlen (s: ADDRESS) : INTEGER ;
> +@findex strstr
> +PROCEDURE __BUILTIN__ strstr (haystack, needle: ADDRESS) : ADDRESS ;
> +@findex strpbrk
> +PROCEDURE __BUILTIN__ strpbrk (s, accept: ADDRESS) : ADDRESS ;
> +@findex strspn
> +PROCEDURE __BUILTIN__ strspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strcspn
> +PROCEDURE __BUILTIN__ strcspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strchr
> +PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex strrchr
> +PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +
> +(*
> +   longjmp - this GCC builtin restricts the val to always 1.
> +*)
> +(* do not use these two builtins, as gcc, only really
> +   anticipates that the Ada front end should use them
> +   and it only uses them in its runtime exception handling.
> +   We leave them here in the hope that someday they will
> +   behave more like their libc counterparts.  *)
> +
> +@findex longjmp
> +PROCEDURE __BUILTIN__ longjmp (env: ADDRESS; val: INTEGER) ;
> +@findex setjmp
> +PROCEDURE __BUILTIN__ setjmp (env: ADDRESS) : INTEGER ;
> +
> +
> +(*
> +   frame_address - returns the address of the frame.
> +                   The current frame is obtained if level is 0,
> +                   the next level up if level is 1 etc.
> +*)
> +
> +@findex frame_address
> +PROCEDURE __BUILTIN__ frame_address (level: CARDINAL) : ADDRESS ;
> +
> +
> +(*
> +   return_address - returns the return address of function.
> +                    The current function return address is
> +                    obtained if level is 0,
> +                    the next level up if level is 1 etc.
> +*)
> +
> +@findex return_address
> +PROCEDURE __BUILTIN__ return_address (level: CARDINAL) : ADDRESS ;
> +
> +
> +(*
> +   alloca_trace - this is a no-op which is used for internal debugging.
> +*)
> +
> +@findex alloca_trace
> +PROCEDURE alloca_trace (returned: ADDRESS; nBytes: CARDINAL) : ADDRESS ;
> +
> +
> +END Builtins.
> +@end example
> +@page
> +
> +@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/Builtins, Base libraries
> +@subsection gm2-libs/COROUTINES
> +
> +@example
> +DEFINITION MODULE FOR "C" COROUTINES ;
> +
> +CONST
> +   UnassignedPriority = 0 ;
> +
> +TYPE
> +@findex INTERRUPTSOURCE (type)
> +   INTERRUPTSOURCE = CARDINAL ;
> +@findex PROTECTION (type)
> +   PROTECTION = [UnassignedPriority..7] ;
> +
> +END COROUTINES.
> +@end example
> +@page
> +
> +@node gm2-libs/CmdArgs, gm2-libs/Debug, gm2-libs/COROUTINES, Base libraries
> +@subsection gm2-libs/CmdArgs
> +
> +@example
> +DEFINITION MODULE CmdArgs ;
> +
> +EXPORT QUALIFIED GetArg, Narg ;
> +
> +
> +(*
> +   GetArg - returns the nth argument from the command line, CmdLine
> +            the success of the operation is returned.
> +*)
> +
> +@findex GetArg
> +PROCEDURE GetArg (CmdLine: ARRAY OF CHAR;
> +                  n: CARDINAL; VAR Argi: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   Narg - returns the number of arguments available from
> +          command line, CmdLine.
> +*)
> +
> +@findex Narg
> +PROCEDURE Narg (CmdLine: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +END CmdArgs.
> +@end example
> +@page
> +
> +@node gm2-libs/Debug, gm2-libs/DynamicStrings, gm2-libs/CmdArgs, Base libraries
> +@subsection gm2-libs/Debug
> +
> +@example
> +DEFINITION MODULE Debug ;
> +
> +(*
> +    Description: provides some simple debugging routines.
> +*)
> +
> +EXPORT QUALIFIED Halt, DebugString ;
> +
> +
> +(*
> +   Halt - writes a message in the format:
> +          Module:Line:Message
> +
> +          It then terminates by calling HALT.
> +*)
> +
> +@findex Halt
> +PROCEDURE Halt (Message: ARRAY OF CHAR;
> +                LineNo: CARDINAL;
> +                Module: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   DebugString - writes a string to the debugging device (Scn.Write).
> +                 It interprets \n as carriage return, linefeed.
> +*)
> +
> +@findex DebugString
> +PROCEDURE DebugString (a: ARRAY OF CHAR) ;
> +
> +
> +END Debug.
> +@end example
> +@page
> +
> +@node gm2-libs/DynamicStrings, gm2-libs/Environment, gm2-libs/Debug, Base libraries
> +@subsection gm2-libs/DynamicStrings
> +
> +@example
> +DEFINITION MODULE DynamicStrings ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT QUALIFIED String,
> +                 InitString, KillString, Fin, InitStringCharStar,
> +                 InitStringChar, Index, RIndex,
> +                 Mark, Length, ConCat, ConCatChar, Assign, Dup, Add,
> +                 Equal, EqualCharStar, EqualArray, ToUpper, ToLower,
> +                 CopyOut, Mult, Slice,
> +                 RemoveWhitePrefix, RemoveWhitePostfix, RemoveComment,
> +                 char, string,
> +                 InitStringDB, InitStringCharStarDB, InitStringCharDB,
> +                 MultDB, DupDB, SliceDB,
> +                 PushAllocation, PopAllocation, PopAllocationExemption ;
> +
> +TYPE
> +@findex String (type)
> +   String ;
> +
> +
> +(*
> +   InitString - creates and returns a String type object.
> +                Initial contents are, a.
> +*)
> +
> +@findex InitString
> +PROCEDURE InitString (a: ARRAY OF CHAR) : String ;
> +
> +
> +(*
> +   KillString - frees String, s, and its contents.
> +                NIL is returned.
> +*)
> +
> +@findex KillString
> +PROCEDURE KillString (s: String) : String ;
> +
> +
> +(*
> +   Fin - finishes with a string, it calls KillString with, s.
> +         The purpose of the procedure is to provide a short cut
> +         to calling KillString and then testing the return result.
> +*)
> +
> +@findex Fin
> +PROCEDURE Fin (s: String) ;
> +
> +
> +(*
> +   InitStringCharStar - initializes and returns a String to contain
> +                        the C string.
> +*)
> +
> +@findex InitStringCharStar
> +PROCEDURE InitStringCharStar (a: ADDRESS) : String ;
> +
> +
> +(*
> +   InitStringChar - initializes and returns a String to contain the
> +                    single character, ch.
> +*)
> +
> +@findex InitStringChar
> +PROCEDURE InitStringChar (ch: CHAR) : String ;
> +
> +
> +(*
> +   Mark - marks String, s, ready for garbage collection.
> +*)
> +
> +@findex Mark
> +PROCEDURE Mark (s: String) : String ;
> +
> +
> +(*
> +   Length - returns the length of the String, s.
> +*)
> +
> +@findex Length
> +PROCEDURE Length (s: String) : CARDINAL ;
> +
> +
> +(*
> +   ConCat - returns String, a, after the contents of, b,
> +            have been appended.
> +*)
> +
> +@findex ConCat
> +PROCEDURE ConCat (a, b: String) : String ;
> +
> +
> +(*
> +   ConCatChar - returns String, a, after character, ch,
> +                has been appended.
> +*)
> +
> +@findex ConCatChar
> +PROCEDURE ConCatChar (a: String; ch: CHAR) : String ;
> +
> +
> +(*
> +   Assign - assigns the contents of, b, into, a.
> +            String, a, is returned.
> +*)
> +
> +@findex Assign
> +PROCEDURE Assign (a, b: String) : String ;
> +
> +
> +(*
> +   Dup - duplicate a String, s, returning the copy of s.
> +*)
> +
> +@findex Dup
> +PROCEDURE Dup (s: String) : String ;
> +
> +
> +(*
> +   Add - returns a new String which contains the contents of a and b.
> +*)
> +
> +@findex Add
> +PROCEDURE Add (a, b: String) : String ;
> +
> +
> +(*
> +   Equal - returns TRUE if String, a, and, b, are equal.
> +*)
> +
> +@findex Equal
> +PROCEDURE Equal (a, b: String) : BOOLEAN ;
> +
> +
> +(*
> +   EqualCharStar - returns TRUE if contents of String, s, is
> +                   the same as the string, a.
> +*)
> +
> +@findex EqualCharStar
> +PROCEDURE EqualCharStar (s: String; a: ADDRESS) : BOOLEAN ;
> +
> +
> +(*
> +   EqualArray - returns TRUE if contents of String, s, is the
> +                same as the string, a.
> +*)
> +
> +@findex EqualArray
> +PROCEDURE EqualArray (s: String; a: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   Mult - returns a new string which is n concatenations of String, s.
> +          If n<=0 then an empty string is returned.
> +*)
> +
> +@findex Mult
> +PROCEDURE Mult (s: String; n: CARDINAL) : String ;
> +
> +
> +(*
> +   Slice - returns a new string which contains the elements
> +           low..high-1
> +
> +           strings start at element 0
> +           Slice(s, 0, 2)  will return elements 0, 1 but not 2
> +           Slice(s, 1, 3)  will return elements 1, 2 but not 3
> +           Slice(s, 2, 0)  will return elements 2..max
> +           Slice(s, 3, -1) will return elements 3..max-1
> +           Slice(s, 4, -2) will return elements 4..max-2
> +*)
> +
> +@findex Slice
> +PROCEDURE Slice (s: String; low, high: INTEGER) : String ;
> +
> +
> +(*
> +   Index - returns the indice of the first occurance of, ch, in
> +           String, s. -1 is returned if, ch, does not exist.
> +           The search starts at position, o.
> +*)
> +
> +@findex Index
> +PROCEDURE Index (s: String; ch: CHAR; o: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   RIndex - returns the indice of the last occurance of, ch,
> +            in String, s. The search starts at position, o.
> +            -1 is returned if, ch, is not found.
> +*)
> +
> +@findex RIndex
> +PROCEDURE RIndex (s: String; ch: CHAR; o: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   RemoveComment - assuming that, comment, is a comment delimiter
> +                   which indicates anything to its right is a comment
> +                   then strip off the comment and also any white space
> +                   on the remaining right hand side.
> +                   It leaves any white space on the left hand side
> +                   alone.
> +*)
> +
> +@findex RemoveComment
> +PROCEDURE RemoveComment (s: String; comment: CHAR) : String ;
> +
> +
> +(*
> +   RemoveWhitePrefix - removes any leading white space from String, s.
> +                       A new string is returned.
> +*)
> +
> +@findex RemoveWhitePrefix
> +PROCEDURE RemoveWhitePrefix (s: String) : String ;
> +
> +
> +(*
> +   RemoveWhitePostfix - removes any leading white space from String, s.
> +                        A new string is returned.
> +*)
> +
> +@findex RemoveWhitePostfix
> +PROCEDURE RemoveWhitePostfix (s: String) : String ;
> +
> +
> +(*
> +   ToUpper - returns string, s, after it has had its lower case
> +             characters replaced by upper case characters.
> +             The string, s, is not duplicated.
> +*)
> +
> +@findex ToUpper
> +PROCEDURE ToUpper (s: String) : String ;
> +
> +
> +(*
> +   ToLower - returns string, s, after it has had its upper case
> +             characters replaced by lower case characters.
> +             The string, s, is not duplicated.
> +*)
> +
> +@findex ToLower
> +PROCEDURE ToLower (s: String) : String ;
> +
> +
> +(*
> +   CopyOut - copies string, s, to a.
> +*)
> +
> +@findex CopyOut
> +PROCEDURE CopyOut (VAR a: ARRAY OF CHAR; s: String) ;
> +
> +
> +(*
> +   char - returns the character, ch, at position, i, in String, s.
> +          As Slice the index can be negative so:
> +
> +          char(s, 0) will return the first character
> +          char(s, 1) will return the second character
> +          char(s, -1) will return the last character
> +          char(s, -2) will return the penultimate character
> +
> +          a nul character is returned if the index is out of range.
> +*)
> +
> +@findex char
> +PROCEDURE char (s: String; i: INTEGER) : CHAR ;
> +
> +
> +(*
> +   string - returns the C style char * of String, s.
> +*)
> +
> +@findex string
> +PROCEDURE string (s: String) : ADDRESS ;
> +
> +
> +(*
> +   to easily debug an application using this library one could use
> +   use the following macro processing defines:
> +
> +   #define InitString(X) InitStringDB(X, __FILE__, __LINE__)
> +   #define InitStringCharStar(X) InitStringCharStarDB(X, \
> +     __FILE__, __LINE__)
> +   #define InitStringChar(X) InitStringCharDB(X, __FILE__, __LINE__)
> +   #define Mult(X,Y) MultDB(X, Y, __FILE__, __LINE__)
> +   #define Dup(X) DupDB(X, __FILE__, __LINE__)
> +   #define Slice(X,Y,Z) SliceDB(X, Y, Z, __FILE__, __LINE__)
> +
> +   and then invoke gm2 with the -fcpp flag.
> +*)
> +
> +
> +(*
> +   InitStringDB - the debug version of InitString.
> +*)
> +
> +@findex InitStringDB
> +PROCEDURE InitStringDB (a: ARRAY OF CHAR;
> +                        file: ARRAY OF CHAR; line: CARDINAL) : String ;
> +
> +
> +(*
> +   InitStringCharStarDB - the debug version of InitStringCharStar.
> +*)
> +
> +@findex InitStringCharStarDB
> +PROCEDURE InitStringCharStarDB (a: ADDRESS;
> +                                file: ARRAY OF CHAR;
> +                                line: CARDINAL) : String ;
> +
> +
> +(*
> +   InitStringCharDB - the debug version of InitStringChar.
> +*)
> +
> +@findex InitStringCharDB
> +PROCEDURE InitStringCharDB (ch: CHAR;
> +                            file: ARRAY OF CHAR;
> +                            line: CARDINAL) : String ;
> +
> +
> +(*
> +   MultDB - the debug version of MultDB.
> +*)
> +
> +@findex MultDB
> +PROCEDURE MultDB (s: String; n: CARDINAL;
> +                  file: ARRAY OF CHAR; line: CARDINAL) : String ;
> +
> +
> +(*
> +   DupDB - the debug version of Dup.
> +*)
> +
> +@findex DupDB
> +PROCEDURE DupDB (s: String;
> +                 file: ARRAY OF CHAR; line: CARDINAL) : String ;
> +
> +
> +(*
> +   SliceDB - debug version of Slice.
> +*)
> +
> +@findex SliceDB
> +PROCEDURE SliceDB (s: String; low, high: INTEGER;
> +                   file: ARRAY OF CHAR; line: CARDINAL) : String ;
> +
> +(*
> +   PushAllocation - pushes the current allocation/deallocation lists.
> +*)
> +
> +@findex PushAllocation
> +PROCEDURE PushAllocation ;
> +
> +
> +(*
> +   PopAllocation - test to see that all strings are deallocated since
> +                   the last push.  Then it pops to the previous
> +                   allocation/deallocation lists.
> +
> +                   If halt is true then the application terminates
> +                   with an exit code of 1.
> +*)
> +
> +@findex PopAllocation
> +PROCEDURE PopAllocation (halt: BOOLEAN) ;
> +
> +
> +(*
> +   PopAllocationExemption - test to see that all strings are
> +                            deallocated, except string, e, since
> +                            the last push.
> +                            Then it pops to the previous
> +                            allocation/deallocation lists.
> +
> +                            If halt is true then the application
> +                            terminates with an exit code of 1.
> +
> +                            The string, e, is returned unmodified,
> +*)
> +
> +@findex PopAllocationExemption
> +PROCEDURE PopAllocationExemption (halt: BOOLEAN; e: String) : String ;
> +
> +
> +END DynamicStrings.
> +@end example
> +@page
> +
> +@node gm2-libs/Environment, gm2-libs/FIO, gm2-libs/DynamicStrings, Base libraries
> +@subsection gm2-libs/Environment
> +
> +@example
> +DEFINITION MODULE Environment ;
> +
> +EXPORT QUALIFIED GetEnvironment, PutEnvironment ;
> +
> +
> +(*
> +   GetEnvironment - gets the environment variable Env and places
> +                   a copy of its value into string, dest.
> +                    It returns TRUE if the string Env was found in
> +                    the processes environment.
> +*)
> +
> +@findex GetEnvironment
> +PROCEDURE GetEnvironment (Env: ARRAY OF CHAR;
> +                          VAR dest: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   PutEnvironment - change or add an environment variable definition
> +                    EnvDef.
> +                    TRUE is returned if the environment variable was
> +                    set or changed successfully.
> +*)
> +
> +@findex PutEnvironment
> +PROCEDURE PutEnvironment (EnvDef: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +END Environment.
> +@end example
> +@page
> +
> +@node gm2-libs/FIO, gm2-libs/FormatStrings, gm2-libs/Environment, Base libraries
> +@subsection gm2-libs/FIO
> +
> +@example
> +DEFINITION MODULE FIO ;
> +
> +(* Provides a simple buffered file input/output library.  *)
> +
> +
> +FROM SYSTEM IMPORT ADDRESS, BYTE ;
> +
> +EXPORT QUALIFIED (* types *)
> +                 File,
> +                 (* procedures *)
> +                 OpenToRead, OpenToWrite, OpenForRandom, Close,
> +                 EOF, EOLN, WasEOLN, IsNoError, Exists, IsActive,
> +                 exists, openToRead, openToWrite, openForRandom,
> +                 SetPositionFromBeginning,
> +                 SetPositionFromEnd,
> +                 FindPosition,
> +                 ReadChar, ReadString,
> +                 WriteChar, WriteString, WriteLine,
> +                 WriteCardinal, ReadCardinal,
> +                 UnReadChar,
> +                 WriteNBytes, ReadNBytes,
> +                 FlushBuffer,
> +                 GetUnixFileDescriptor,
> +                 GetFileName, getFileName, getFileNameLength,
> +                 FlushOutErr,
> +                 (* variables *)
> +                 StdIn, StdOut, StdErr ;
> +
> +TYPE
> +@findex File (type)
> +   File = CARDINAL ;
> +
> +(* the following variables are initialized to their UNIX equivalents *)
> +VAR
> +@findex StdIn (var)
> +@findex StdOut (var)
> +@findex StdErr (var)
> +   StdIn, StdOut, StdErr: File ;
> +
> +
> +
> +(*
> +   IsNoError - returns a TRUE if no error has occured on file, f.
> +*)
> +
> +@findex IsNoError
> +PROCEDURE IsNoError (f: File) : BOOLEAN ;
> +
> +
> +(*
> +   IsActive - returns TRUE if the file, f, is still active.
> +*)
> +
> +@findex IsActive
> +PROCEDURE IsActive (f: File) : BOOLEAN ;
> +
> +
> +(*
> +   Exists - returns TRUE if a file named, fname exists for reading.
> +*)
> +
> +@findex Exists
> +PROCEDURE Exists (fname: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   OpenToRead - attempts to open a file, fname, for reading and
> +                it returns this file.
> +                The success of this operation can be checked by
> +                calling IsNoError.
> +*)
> +
> +@findex OpenToRead
> +PROCEDURE OpenToRead (fname: ARRAY OF CHAR) : File ;
> +
> +
> +(*
> +   OpenToWrite - attempts to open a file, fname, for write and
> +                 it returns this file.
> +                 The success of this operation can be checked by
> +                 calling IsNoError.
> +*)
> +
> +@findex OpenToWrite
> +PROCEDURE OpenToWrite (fname: ARRAY OF CHAR) : File ;
> +
> +
> +(*
> +   OpenForRandom - attempts to open a file, fname, for random access
> +                   read or write and it returns this file.
> +                   The success of this operation can be checked by
> +                   calling IsNoError.
> +                   towrite, determines whether the file should be
> +                   opened for writing or reading.
> +                   newfile, determines whether a file should be
> +                   created if towrite is TRUE or whether the
> +                   previous file should be left alone,
> +                   allowing this descriptor to seek
> +                   and modify an existing file.
> +*)
> +
> +@findex OpenForRandom
> +PROCEDURE OpenForRandom (fname: ARRAY OF CHAR;
> +                         towrite, newfile: BOOLEAN) : File ;
> +
> +
> +(*
> +   Close - close a file which has been previously opened using:
> +           OpenToRead, OpenToWrite, OpenForRandom.
> +           It is correct to close a file which has an error status.
> +*)
> +
> +@findex Close
> +PROCEDURE Close (f: File) ;
> +
> +
> +(* the following functions are functionally equivalent to the above
> +   except they allow C style names.
> +*)
> +
> +@findex exists
> +PROCEDURE exists        (fname: ADDRESS; flength: CARDINAL) : BOOLEAN ;
> +@findex openToRead
> +PROCEDURE openToRead    (fname: ADDRESS; flength: CARDINAL) : File ;
> +@findex openToWrite
> +PROCEDURE openToWrite   (fname: ADDRESS; flength: CARDINAL) : File ;
> +@findex openForRandom
> +PROCEDURE openForRandom (fname: ADDRESS; flength: CARDINAL;
> +                         towrite, newfile: BOOLEAN) : File ;
> +
> +
> +(*
> +   FlushBuffer - flush contents of the FIO file, f, to libc.
> +*)
> +
> +@findex FlushBuffer
> +PROCEDURE FlushBuffer (f: File) ;
> +
> +
> +(*
> +   ReadNBytes - reads nBytes of a file into memory area, dest, returning
> +                the number of bytes actually read.
> +                This function will consume from the buffer and then
> +                perform direct libc reads. It is ideal for large reads.
> +*)
> +
> +@findex ReadNBytes
> +PROCEDURE ReadNBytes (f: File; nBytes: CARDINAL;
> +                      dest: ADDRESS) : CARDINAL ;
> +
> +
> +(*
> +   ReadAny - reads HIGH(a) bytes into, a. All input
> +             is fully buffered, unlike ReadNBytes and thus is more
> +             suited to small reads.
> +*)
> +
> +@findex ReadAny
> +PROCEDURE ReadAny (f: File; VAR a: ARRAY OF BYTE) ;
> +
> +
> +(*
> +   WriteNBytes - writes nBytes from memory area src to a file
> +                 returning the number of bytes actually written.
> +                 This function will flush the buffer and then
> +                 write the nBytes using a direct write from libc.
> +                 It is ideal for large writes.
> +*)
> +
> +@findex WriteNBytes
> +PROCEDURE WriteNBytes (f: File; nBytes: CARDINAL;
> +                       src: ADDRESS) : CARDINAL ;
> +
> +
> +(*
> +   WriteAny - writes HIGH(a) bytes onto, file, f. All output
> +              is fully buffered, unlike WriteNBytes and thus is more
> +              suited to small writes.
> +*)
> +
> +@findex WriteAny
> +PROCEDURE WriteAny (f: File; VAR a: ARRAY OF BYTE) ;
> +
> +
> +(*
> +   WriteChar - writes a single character to file, f.
> +*)
> +
> +@findex WriteChar
> +PROCEDURE WriteChar (f: File; ch: CHAR) ;
> +
> +
> +(*
> +   EOF - tests to see whether a file, f, has reached end of file.
> +*)
> +
> +@findex EOF
> +PROCEDURE EOF (f: File) : BOOLEAN ;
> +
> +
> +(*
> +   EOLN - tests to see whether a file, f, is about to read a newline.
> +          It does NOT consume the newline.  It reads the next character
> +          and then immediately unreads the character.
> +*)
> +
> +@findex EOLN
> +PROCEDURE EOLN (f: File) : BOOLEAN ;
> +
> +
> +(*
> +   WasEOLN - tests to see whether a file, f, has just read a newline
> +             character.
> +*)
> +
> +@findex WasEOLN
> +PROCEDURE WasEOLN (f: File) : BOOLEAN ;
> +
> +
> +(*
> +   ReadChar - returns a character read from file, f.
> +              Sensible to check with IsNoError or EOF after calling
> +              this function.
> +*)
> +
> +@findex ReadChar
> +PROCEDURE ReadChar (f: File) : CHAR ;
> +
> +
> +(*
> +   UnReadChar - replaces a character, ch, back into file, f.
> +                This character must have been read by ReadChar
> +                and it does not allow successive calls.  It may
> +                only be called if the previous read was successful,
> +                end of file or end of line seen.
> +*)
> +
> +@findex UnReadChar
> +PROCEDURE UnReadChar (f: File ; ch: CHAR) ;
> +
> +
> +(*
> +   WriteLine - writes out a linefeed to file, f.
> +*)
> +
> +@findex WriteLine
> +PROCEDURE WriteLine (f: File) ;
> +
> +
> +(*
> +   WriteString - writes a string to file, f.
> +*)
> +
> +@findex WriteString
> +PROCEDURE WriteString (f: File; a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   ReadString - reads a string from file, f, into string, a.
> +                It terminates the string if HIGH is reached or
> +                if a newline is seen or an error occurs.
> +*)
> +
> +@findex ReadString
> +PROCEDURE ReadString (f: File; VAR a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WriteCardinal - writes a CARDINAL to file, f.
> +                   It writes the binary image of the CARDINAL.
> +                   to file, f.
> +*)
> +
> +@findex WriteCardinal
> +PROCEDURE WriteCardinal (f: File; c: CARDINAL) ;
> +
> +
> +(*
> +   ReadCardinal - reads a CARDINAL from file, f.
> +                  It reads a bit image of a CARDINAL
> +                  from file, f.
> +*)
> +
> +@findex ReadCardinal
> +PROCEDURE ReadCardinal (f: File) : CARDINAL ;
> +
> +
> +(*
> +   GetUnixFileDescriptor - returns the UNIX file descriptor of a file.
> +                           Useful when combining FIO.mod with select
> +                           (in Selective.def - but note the comments in
> +                            Selective about using read/write primatives)
> +*)
> +
> +@findex GetUnixFileDescriptor
> +PROCEDURE GetUnixFileDescriptor (f: File) : INTEGER ;
> +
> +
> +(*
> +   SetPositionFromBeginning - sets the position from the beginning
> +                              of the file.
> +*)
> +
> +@findex SetPositionFromBeginning
> +PROCEDURE SetPositionFromBeginning (f: File; pos: LONGINT) ;
> +
> +
> +(*
> +   SetPositionFromEnd - sets the position from the end of the file.
> +*)
> +
> +@findex SetPositionFromEnd
> +PROCEDURE SetPositionFromEnd (f: File; pos: LONGINT) ;
> +
> +
> +(*
> +   FindPosition - returns the current absolute position in file, f.
> +*)
> +
> +@findex FindPosition
> +PROCEDURE FindPosition (f: File) : LONGINT ;
> +
> +
> +(*
> +   GetFileName - assigns, a, with the filename associated with, f.
> +*)
> +
> +@findex GetFileName
> +PROCEDURE GetFileName (f: File; VAR a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   getFileName - returns the address of the filename associated with, f.
> +*)
> +
> +@findex getFileName
> +PROCEDURE getFileName (f: File) : ADDRESS ;
> +
> +
> +(*
> +   getFileNameLength - returns the number of characters associated with
> +                       filename, f.
> +*)
> +
> +@findex getFileNameLength
> +PROCEDURE getFileNameLength (f: File) : CARDINAL ;
> +
> +
> +(*
> +   FlushOutErr - flushes, StdOut, and, StdErr.
> +*)
> +
> +@findex FlushOutErr
> +PROCEDURE FlushOutErr ;
> +
> +
> +END FIO.
> +@end example
> +@page
> +
> +@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FIO, Base libraries
> +@subsection gm2-libs/FormatStrings
> +
> +@example
> +DEFINITION MODULE FormatStrings ;
> +
> +FROM SYSTEM IMPORT BYTE ;
> +FROM DynamicStrings IMPORT String ;
> +EXPORT QUALIFIED Sprintf0, Sprintf1, Sprintf2, Sprintf3, Sprintf4,
> +                 HandleEscape ;
> +
> +
> +(*
> +   Sprintf0 - returns a String containing, fmt, after it has had its
> +              escape sequences translated.
> +*)
> +
> +@findex Sprintf0
> +PROCEDURE Sprintf0 (fmt: String) : String ;
> +
> +
> +(*
> +   Sprintf1 - returns a String containing, fmt, together with
> +              encapsulated entity, w. It only formats the
> +              first %s or %d with n.
> +*)
> +
> +@findex Sprintf1
> +PROCEDURE Sprintf1 (fmt: String; w: ARRAY OF BYTE) : String ;
> +
> +
> +(*
> +   Sprintf2 - returns a string, fmt, which has been formatted.
> +*)
> +
> +@findex Sprintf2
> +PROCEDURE Sprintf2 (fmt: String; w1, w2: ARRAY OF BYTE) : String ;
> +
> +
> +(*
> +   Sprintf3 - returns a string, fmt, which has been formatted.
> +*)
> +
> +@findex Sprintf3
> +PROCEDURE Sprintf3 (fmt: String; w1, w2, w3: ARRAY OF BYTE) : String ;
> +
> +
> +(*
> +   Sprintf4 - returns a string, fmt, which has been formatted.
> +*)
> +
> +@findex Sprintf4
> +PROCEDURE Sprintf4 (fmt: String;
> +                    w1, w2, w3, w4: ARRAY OF BYTE) : String ;
> +
> +
> +(*
> +   HandleEscape - translates \a, \b, \e, \f, \n, \r, \x[hex] \[octal]
> +                  into their respective ascii codes.  It also converts
> +                  \[any] into a single [any] character.
> +*)
> +
> +@findex HandleEscape
> +PROCEDURE HandleEscape (s: String) : String ;
> +
> +
> +END FormatStrings.
> +@end example
> +@page
> +
> +@node gm2-libs/FpuIO, gm2-libs/GetOpt, gm2-libs/FormatStrings, Base libraries
> +@subsection gm2-libs/FpuIO
> +
> +@example
> +DEFINITION MODULE FpuIO ;
> +
> +EXPORT QUALIFIED ReadReal, WriteReal, StrToReal, RealToStr,
> +                 ReadLongReal, WriteLongReal, StrToLongReal,
> +                 LongRealToStr,
> +                 ReadLongInt, WriteLongInt, StrToLongInt,
> +                 LongIntToStr ;
> +
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (VAR x: REAL) ;
> +@findex WriteReal
> +PROCEDURE WriteReal (x: REAL; TotalWidth, FractionWidth: CARDINAL) ;
> +@findex StrToReal
> +PROCEDURE StrToReal (a: ARRAY OF CHAR ; VAR x: REAL) ;
> +@findex RealToStr
> +PROCEDURE RealToStr (x: REAL; TotalWidth, FractionWidth: CARDINAL;
> +                     VAR a: ARRAY OF CHAR) ;
> +
> +@findex ReadLongReal
> +PROCEDURE ReadLongReal (VAR x: LONGREAL) ;
> +@findex WriteLongReal
> +PROCEDURE WriteLongReal (x: LONGREAL;
> +                         TotalWidth, FractionWidth: CARDINAL) ;
> +@findex StrToLongReal
> +PROCEDURE StrToLongReal (a: ARRAY OF CHAR ; VAR x: LONGREAL) ;
> +@findex LongRealToStr
> +PROCEDURE LongRealToStr (x: LONGREAL;
> +                         TotalWidth, FractionWidth: CARDINAL;
> +                         VAR a: ARRAY OF CHAR) ;
> +
> +@findex ReadLongInt
> +PROCEDURE ReadLongInt (VAR x: LONGINT) ;
> +@findex WriteLongInt
> +PROCEDURE WriteLongInt (x: LONGINT; n: CARDINAL) ;
> +@findex StrToLongInt
> +PROCEDURE StrToLongInt (a: ARRAY OF CHAR ; VAR x: LONGINT) ;
> +@findex LongIntToStr
> +PROCEDURE LongIntToStr (x: LONGINT; n: CARDINAL; VAR a: ARRAY OF CHAR) ;
> +
> +
> +END FpuIO.
> +@end example
> +@page
> +
> +@node gm2-libs/GetOpt, gm2-libs/IO, gm2-libs/FpuIO, Base libraries
> +@subsection gm2-libs/GetOpt
> +
> +@example
> +DEFINITION MODULE GetOpt ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM DynamicStrings IMPORT String ;
> +
> +CONST
> +@findex no_argument (const)
> +   no_argument = 0 ;
> +@findex required_argument (const)
> +   required_argument = 1 ;
> +@findex optional_argument (const)
> +   optional_argument = 2 ;
> +
> +TYPE
> +@findex LongOptions (type)
> +   LongOptions ;
> +@findex PtrToInteger (type)
> +   PtrToInteger = POINTER TO INTEGER ;
> +
> +(*
> +   GetOpt - call C getopt and fill in the parameters:
> +            optarg, optind, opterr and optop.
> +*)
> +
> +@findex GetOpt
> +PROCEDURE GetOpt (argc: INTEGER; argv: ADDRESS; optstring: String;
> +                  VAR optarg: String;
> +                  VAR optind, opterr, optopt: INTEGER) : CHAR ;
> +
> +
> +(*
> +   InitLongOptions - creates and returns a LongOptions empty array.
> +*)
> +
> +@findex InitLongOptions
> +PROCEDURE InitLongOptions () : LongOptions ;
> +
> +
> +(*
> +   AddLongOption - appends long option @{name, has_arg, flag, val@} to the
> +                   array of options and new long options array is
> +                   returned.
> +                   The old array, lo, should no longer be used.
> +
> +   (from man 3 getopt)
> +       The meanings of the different fields are:
> +
> +       name   is the name of the long option.
> +
> +       has_arg
> +              is: no_argument (or 0) if the option does not take an
> +              argument; required_argument (or  1) if the option
> +              requires an argument; or optional_argument (or 2) if
> +              the option takes an optional argument.
> +
> +       flag   specifies how results are returned for a long option.
> +              If flag is NULL, then getopt_long() returns val.
> +              (For example, the calling program may set val to the
> +              equivalent short option character).  Otherwise,
> +              getopt_long() returns 0, and flag points to a
> +              variable which is set to val if the option is found,
> +              but left unchanged if the option is not found.
> +
> +       val    is the value to return, or to load into the variable
> +              pointed to by flag.
> +
> +       The last element of the array has to be filled with zeros.
> +*)
> +
> +@findex AddLongOption
> +PROCEDURE AddLongOption (lo: LongOptions;
> +                         name: String; has_arg: INTEGER;
> +                         flag: PtrToInteger;
> +                         val: INTEGER) : LongOptions ;
> +
> +
> +(*
> +   KillLongOptions - returns NIL and also frees up memory
> +                     associated with, lo.
> +*)
> +
> +@findex KillLongOptions
> +PROCEDURE KillLongOptions (lo: LongOptions) : LongOptions ;
> +
> +
> +(*
> +   GetOptLong - works like GetOpt but will accept long options (using
> +                two dashes).  If the program only accepts long options
> +                then optstring should be an empty string, not NIL.
> +*)
> +
> +@findex GetOptLong
> +PROCEDURE GetOptLong (argc: INTEGER; argv: ADDRESS; optstring: String;
> +                      longopts: LongOptions;
> +                      VAR longindex: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   GetOptLongOnly - works like GetOptLong except that a single dash
> +                    can be used for a long option.
> +*)
> +
> +@findex GetOptLongOnly
> +PROCEDURE GetOptLongOnly (argc: INTEGER; argv: ADDRESS;
> +                          optstring: String; longopts: LongOptions;
> +                          VAR longindex: INTEGER) : INTEGER ;
> +
> +
> +END GetOpt.
> +@end example
> +@page
> +
> +@node gm2-libs/IO, gm2-libs/Indexing, gm2-libs/GetOpt, Base libraries
> +@subsection gm2-libs/IO
> +
> +@example
> +DEFINITION MODULE IO ;
> +
> +(*
> +   Description: provides Read, Write, Errors procedures that map onto UNIX
> +                file descriptors 0, 1 and 2. This is achieved by using
> +                FIO if we are in buffered mode and using libc.write
> +                if not.
> +*)
> +
> +EXPORT QUALIFIED Read, Write, Error,
> +                 UnBufferedMode, BufferedMode,
> +                 EchoOn, EchoOff ;
> +
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +@findex Write
> +PROCEDURE Write (ch: CHAR) ;
> +@findex Error
> +PROCEDURE Error (ch: CHAR) ;
> +
> +
> +(*
> +   UnBufferedMode - places file descriptor, fd, into an unbuffered mode.
> +*)
> +
> +@findex UnBufferedMode
> +PROCEDURE UnBufferedMode (fd: INTEGER; input: BOOLEAN) ;
> +
> +
> +(*
> +   BufferedMode - places file descriptor, fd, into a buffered mode.
> +*)
> +
> +@findex BufferedMode
> +PROCEDURE BufferedMode (fd: INTEGER; input: BOOLEAN) ;
> +
> +
> +(*
> +   EchoOn - turns on echoing for file descriptor, fd.  This
> +            only really makes sence for a file descriptor opened
> +            for terminal input or maybe some specific file descriptor
> +            which is attached to a particular piece of hardware.
> +*)
> +
> +@findex EchoOn
> +PROCEDURE EchoOn (fd: INTEGER; input: BOOLEAN) ;
> +
> +
> +(*
> +   EchoOff - turns off echoing for file descriptor, fd.  This
> +             only really makes sence for a file descriptor opened
> +             for terminal input or maybe some specific file descriptor
> +             which is attached to a particular piece of hardware.
> +*)
> +
> +@findex EchoOff
> +PROCEDURE EchoOff (fd: INTEGER; input: BOOLEAN) ;
> +
> +
> +END IO.
> +@end example
> +@page
> +
> +@node gm2-libs/Indexing, gm2-libs/LMathLib0, gm2-libs/IO, Base libraries
> +@subsection gm2-libs/Indexing
> +
> +@example
> +DEFINITION MODULE Indexing ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT QUALIFIED Index, InitIndex, KillIndex, GetIndice, PutIndice,
> +                 HighIndice, LowIndice, InBounds, IsIndiceInIndex,
> +                 RemoveIndiceFromIndex, IncludeIndiceIntoIndex,
> +                 ForeachIndiceInIndexDo, DeleteIndice, DebugIndex ;
> +
> +TYPE
> +@findex Index (type)
> +   Index ;
> +@findex IndexProcedure (type)
> +   IndexProcedure = PROCEDURE (ADDRESS) ;
> +
> +
> +(*
> +   InitIndex - creates and returns an Index.
> +*)
> +
> +@findex InitIndex
> +PROCEDURE InitIndex (low: CARDINAL) : Index ;
> +
> +
> +(*
> +   KillIndex - returns Index to free storage.
> +*)
> +
> +@findex KillIndex
> +PROCEDURE KillIndex (i: Index) : Index ;
> +
> +
> +(*
> +   DebugIndex - turns on debugging within an index.
> +*)
> +
> +@findex DebugIndex
> +PROCEDURE DebugIndex (i: Index) : Index ;
> +
> +
> +(*
> +   InBounds - returns TRUE if indice, n, is within the bounds
> +              of the dynamic array.
> +*)
> +
> +@findex InBounds
> +PROCEDURE InBounds (i: Index; n: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   HighIndice - returns the last legally accessible indice of this array.
> +*)
> +
> +@findex HighIndice
> +PROCEDURE HighIndice (i: Index) : CARDINAL ;
> +
> +
> +(*
> +   LowIndice - returns the first legally accessible indice of this array.
> +*)
> +
> +@findex LowIndice
> +PROCEDURE LowIndice (i: Index) : CARDINAL ;
> +
> +
> +(*
> +   PutIndice - places, a, into the dynamic array at position i[n]
> +*)
> +
> +@findex PutIndice
> +PROCEDURE PutIndice (i: Index; n: CARDINAL; a: ADDRESS) ;
> +
> +
> +(*
> +   GetIndice - retrieves, element i[n] from the dynamic array.
> +*)
> +
> +@findex GetIndice
> +PROCEDURE GetIndice (i: Index; n: CARDINAL) : ADDRESS ;
> +
> +
> +(*
> +   IsIndiceInIndex - returns TRUE if, a, is in the index, i.
> +*)
> +
> +@findex IsIndiceInIndex
> +PROCEDURE IsIndiceInIndex (i: Index; a: ADDRESS) : BOOLEAN ;
> +
> +
> +(*
> +   RemoveIndiceFromIndex - removes, a, from Index, i.
> +*)
> +
> +@findex RemoveIndiceFromIndex
> +PROCEDURE RemoveIndiceFromIndex (i: Index; a: ADDRESS) ;
> +
> +
> +(*
> +   DeleteIndice - delete i[j] from the array.
> +*)
> +
> +@findex DeleteIndice
> +PROCEDURE DeleteIndice (i: Index; j: CARDINAL) ;
> +
> +
> +(*
> +   IncludeIndiceIntoIndex - if the indice is not in the index, then
> +                            add it at the end.
> +*)
> +
> +@findex IncludeIndiceIntoIndex
> +PROCEDURE IncludeIndiceIntoIndex (i: Index; a: ADDRESS) ;
> +
> +
> +(*
> +   ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j])
> +*)
> +
> +@findex ForeachIndiceInIndexDo
> +PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ;
> +
> +
> +END Indexing.
> +@end example
> +@page
> +
> +@node gm2-libs/LMathLib0, gm2-libs/LegacyReal, gm2-libs/Indexing, Base libraries
> +@subsection gm2-libs/LMathLib0
> +
> +@example
> +DEFINITION MODULE LMathLib0 ;
> +
> +CONST
> +   pi   = 3.1415926535897932384626433832795028841972;
> +   exp1 = 2.7182818284590452353602874713526624977572;
> +
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: LONGREAL) : LONGREAL ;
> +@findex exp
> +PROCEDURE exp (x: LONGREAL) : LONGREAL ;
> +@findex ln
> +PROCEDURE ln (x: LONGREAL) : LONGREAL ;
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: LONGREAL) : LONGREAL ;
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: LONGREAL) : LONGREAL ;
> +@findex tan
> +PROCEDURE tan (x: LONGREAL) : LONGREAL ;
> +@findex arctan
> +PROCEDURE arctan (x: LONGREAL) : LONGREAL ;
> +@findex entier
> +PROCEDURE entier (x: LONGREAL) : INTEGER ;
> +
> +
> +END LMathLib0.
> +@end example
> +@page
> +
> +@node gm2-libs/LegacyReal, gm2-libs/M2Dependent, gm2-libs/LMathLib0, Base libraries
> +@subsection gm2-libs/LegacyReal
> +
> +@example
> +DEFINITION MODULE LegacyReal ;
> +
> +TYPE
> +   REAL = SHORTREAL ;
> +
> +
> +END LegacyReal.
> +@end example
> +@page
> +
> +@node gm2-libs/M2Dependent, gm2-libs/M2EXCEPTION, gm2-libs/LegacyReal, Base libraries
> +@subsection gm2-libs/M2Dependent
> +
> +@example
> +DEFINITION MODULE M2Dependent ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +TYPE
> +@findex ArgCVEnvP (type)
> +   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
> +
> +
> +@findex ConstructModules
> +PROCEDURE ConstructModules (applicationmodule: ADDRESS;
> +                            argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +@findex DeconstructModules
> +PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
> +                              argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +
> +(*
> +   RegisterModule - adds module name to the list of outstanding
> +                    modules which need to have their dependencies
> +                    explored to determine initialization order.
> +*)
> +
> +@findex RegisterModule
> +PROCEDURE RegisterModule (name: ADDRESS;
> +                          init, fini:  ArgCVEnvP;
> +                          dependencies: PROC) ;
> +
> +
> +(*
> +   RequestDependant - used to specify that modulename is dependant upon
> +                      module dependantmodule.
> +*)
> +
> +@findex RequestDependant
> +PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
> +
> +
> +END M2Dependent.
> +@end example
> +@page
> +
> +@node gm2-libs/M2EXCEPTION, gm2-libs/M2LINK, gm2-libs/M2Dependent, Base libraries
> +@subsection gm2-libs/M2EXCEPTION
> +
> +@example
> +DEFINITION MODULE M2EXCEPTION;
> +
> +
> +(* This enumerated list of exceptions must match the exceptions in gm2-libs-iso to
> +   allow mixed module dialect projects.  *)
> +
> +TYPE
> +@findex M2Exceptions (type)
> +  M2Exceptions =
> +    (indexException,     rangeException,         caseSelectException,  invalidLocation,
> +     functionException,  wholeValueException,    wholeDivException,    realValueException,
> +     realDivException,   complexValueException,  complexDivException,  protException,
> +     sysException,       coException,            exException
> +    );
> +
> +
> +(* If the program or coroutine is in the exception state then return the enumeration
> +   value representing the exception cause.  If it is not in the exception state then
> +   raises and exception (exException).  *)
> +
> +@findex M2Exception
> +PROCEDURE M2Exception () : M2Exceptions;
> +
> +(* Returns TRUE if the program or coroutine is in the exception state.
> +   Returns FALSE if the program or coroutine is not in the exception state.  *)
> +
> +@findex IsM2Exception
> +PROCEDURE IsM2Exception () : BOOLEAN;
> +
> +
> +END M2EXCEPTION.
> +@end example
> +@page
> +
> +@node gm2-libs/M2LINK, gm2-libs/M2RTS, gm2-libs/M2EXCEPTION, Base libraries
> +@subsection gm2-libs/M2LINK
> +
> +@example
> +DEFINITION MODULE FOR "C" M2LINK ;
> +
> +
> +TYPE
> +@findex PtrToChar (type)
> +   PtrToChar = POINTER TO CHAR ;
> +
> +(* These variables are set by the compiler in the program module
> +   according to linking command line options.  *)
> +
> +VAR
> +@findex ForcedModuleInitOrder (var)
> +   ForcedModuleInitOrder: PtrToChar ;
> +@findex StaticInitialization (var)
> +   StaticInitialization : BOOLEAN ;
> +
> +
> +@findex END M2LINK. (var)
> +END M2LINK.
> +@end example
> +@page
> +
> +@node gm2-libs/M2RTS, gm2-libs/MathLib0, gm2-libs/M2LINK, Base libraries
> +@subsection gm2-libs/M2RTS
> +
> +@example
> +DEFINITION MODULE M2RTS ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +TYPE
> +@findex ArgCVEnvP (type)
> +   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
> +
> +
> +@findex ConstructModules
> +PROCEDURE ConstructModules (applicationmodule: ADDRESS;
> +                            argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +@findex DeconstructModules
> +PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
> +                              argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +
> +(*
> +   RegisterModule - adds module name to the list of outstanding
> +                    modules which need to have their dependencies
> +                    explored to determine initialization order.
> +*)
> +
> +@findex RegisterModule
> +PROCEDURE RegisterModule (name: ADDRESS;
> +                          init, fini:  ArgCVEnvP;
> +                          dependencies: PROC) ;
> +
> +
> +(*
> +   RequestDependant - used to specify that modulename is dependant upon
> +                      module dependantmodule.
> +*)
> +
> +@findex RequestDependant
> +PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
> +
> +
> +(*
> +   InstallTerminationProcedure - installs a procedure, p, which will
> +                                 be called when the procedure
> +                                 ExecuteTerminationProcedures
> +                                 is invoked.  It returns TRUE is the
> +                                 procedure is installed.
> +*)
> +
> +@findex InstallTerminationProcedure
> +PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
> +
> +
> +(*
> +   ExecuteInitialProcedures - executes the initial procedures installed
> +                              by InstallInitialProcedure.
> +*)
> +
> +@findex ExecuteInitialProcedures
> +PROCEDURE ExecuteInitialProcedures ;
> +
> +
> +(*
> +   InstallInitialProcedure - installs a procedure to be executed just
> +                             before the BEGIN code section of the main
> +                             program module.
> +*)
> +
> +@findex InstallInitialProcedure
> +PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
> +
> +
> +(*
> +   ExecuteTerminationProcedures - calls each installed termination procedure
> +                                  in reverse order.
> +*)
> +
> +@findex ExecuteTerminationProcedures
> +PROCEDURE ExecuteTerminationProcedures ;
> +
> +
> +(*
> +   Terminate - provides compatibility for pim.  It call exit with
> +               the exitcode provided in a prior call to ExitOnHalt
> +               (or zero if ExitOnHalt was never called).  It does
> +               not call ExecuteTerminationProcedures.
> +*)
> +
> +@findex Terminate
> +PROCEDURE Terminate <* noreturn *> ;
> +
> +
> +(*
> +   HALT - terminate the current program.  The procedure Terminate
> +          is called before the program is stopped.  The parameter
> +          exitcode is optional.  If the parameter is not supplied
> +          HALT will call libc 'abort', otherwise it will exit with
> +          the code supplied.  Supplying a parameter to HALT has the
> +          same effect as calling ExitOnHalt with the same code and
> +          then calling HALT with no parameter.
> +*)
> +
> +@findex HALT
> +PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ;
> +
> +
> +(*
> +   Halt - provides a more user friendly version of HALT, which takes
> +          four parameters to aid debugging.
> +*)
> +
> +@findex Halt
> +PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
> +                function: ARRAY OF CHAR; description: ARRAY OF CHAR)
> +               <* noreturn *> ;
> +
> +
> +(*
> +   ExitOnHalt - if HALT is executed then call exit with the exit code, e.
> +*)
> +
> +@findex ExitOnHalt
> +PROCEDURE ExitOnHalt (e: INTEGER) ;
> +
> +
> +(*
> +   ErrorMessage - emits an error message to stderr and then calls exit (1).
> +*)
> +
> +@findex ErrorMessage
> +PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
> +                        file: ARRAY OF CHAR;
> +                        line: CARDINAL;
> +                        function: ARRAY OF CHAR) <* noreturn *> ;
> +
> +
> +(*
> +   Length - returns the length of a string, a. This is called whenever
> +            the user calls LENGTH and the parameter cannot be calculated
> +            at compile time.
> +*)
> +
> +@findex Length
> +PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +(*
> +   The following are the runtime exception handler routines.
> +*)
> +
> +@findex AssignmentException
> +PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ReturnException
> +PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex IncException
> +PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex DecException
> +PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex InclException
> +PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ExclException
> +PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ShiftException
> +PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex RotateException
> +PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex StaticArraySubscriptException
> +PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex DynamicArraySubscriptException
> +PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopBeginException
> +PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopToException
> +PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopEndException
> +PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex PointerNilException
> +PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex NoReturnException
> +PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex CaseException
> +PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeNonPosDivException
> +PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeNonPosModException
> +PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeZeroDivException
> +PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeZeroRemException
> +PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeValueException
> +PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex RealValueException
> +PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ParameterException
> +PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex NoException
> +PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +
> +
> +END M2RTS.
> +@end example
> +@page
> +
> +@node gm2-libs/MathLib0, gm2-libs/MemUtils, gm2-libs/M2RTS, Base libraries
> +@subsection gm2-libs/MathLib0
> +
> +@example
> +DEFINITION MODULE MathLib0 ;
> +
> +CONST
> +   pi   = 3.1415926535897932384626433832795028841972;
> +   exp1 = 2.7182818284590452353602874713526624977572;
> +
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
> +@findex exp
> +PROCEDURE exp (x: REAL) : REAL ;
> +@findex ln
> +PROCEDURE ln (x: REAL) : REAL ;
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
> +@findex tan
> +PROCEDURE tan (x: REAL) : REAL ;
> +@findex arctan
> +PROCEDURE arctan (x: REAL) : REAL ;
> +@findex entier
> +PROCEDURE entier (x: REAL) : INTEGER ;
> +
> +
> +END MathLib0.
> +@end example
> +@page
> +
> +@node gm2-libs/MemUtils, gm2-libs/NumberIO, gm2-libs/MathLib0, Base libraries
> +@subsection gm2-libs/MemUtils
> +
> +@example
> +DEFINITION MODULE MemUtils ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT QUALIFIED MemCopy, MemZero ;
> +
> +
> +(*
> +   MemCopy - copys a region of memory to the required destination.
> +*)
> +
> +@findex MemCopy
> +PROCEDURE MemCopy (from: ADDRESS; length: CARDINAL; to: ADDRESS) ;
> +
> +
> +(*
> +   MemZero - sets a region of memory: a..a+length to zero.
> +*)
> +
> +@findex MemZero
> +PROCEDURE MemZero (a: ADDRESS; length: CARDINAL) ;
> +
> +
> +END MemUtils.
> +@end example
> +@page
> +
> +@node gm2-libs/NumberIO, gm2-libs/OptLib, gm2-libs/MemUtils, Base libraries
> +@subsection gm2-libs/NumberIO
> +
> +@example
> +DEFINITION MODULE NumberIO ;
> +
> +EXPORT QUALIFIED ReadCard, WriteCard, ReadHex, WriteHex, ReadInt, WriteInt,
> +                 CardToStr, StrToCard, StrToHex, HexToStr, StrToInt, IntToStr,
> +                 ReadOct, WriteOct, OctToStr, StrToOct,
> +                 ReadBin, WriteBin, BinToStr, StrToBin,
> +                 StrToBinInt, StrToHexInt, StrToOctInt ;
> +
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (VAR x: CARDINAL) ;
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (x, n: CARDINAL) ;
> +
> +@findex ReadHex
> +PROCEDURE ReadHex (VAR x: CARDINAL) ;
> +
> +@findex WriteHex
> +PROCEDURE WriteHex (x, n: CARDINAL) ;
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (VAR x: INTEGER) ;
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (x: INTEGER ; n: CARDINAL) ;
> +
> +@findex CardToStr
> +PROCEDURE CardToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
> +
> +@findex StrToCard
> +PROCEDURE StrToCard (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
> +
> +@findex HexToStr
> +PROCEDURE HexToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
> +
> +@findex StrToHex
> +PROCEDURE StrToHex (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
> +
> +@findex IntToStr
> +PROCEDURE IntToStr (x: INTEGER ; n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
> +
> +@findex StrToInt
> +PROCEDURE StrToInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
> +
> +@findex ReadOct
> +PROCEDURE ReadOct (VAR x: CARDINAL) ;
> +
> +@findex WriteOct
> +PROCEDURE WriteOct (x, n: CARDINAL) ;
> +
> +@findex OctToStr
> +PROCEDURE OctToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
> +
> +@findex StrToOct
> +PROCEDURE StrToOct (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
> +
> +@findex ReadBin
> +PROCEDURE ReadBin (VAR x: CARDINAL) ;
> +
> +@findex WriteBin
> +PROCEDURE WriteBin (x, n: CARDINAL) ;
> +
> +@findex BinToStr
> +PROCEDURE BinToStr (x, n: CARDINAL ; VAR a: ARRAY OF CHAR) ;
> +
> +@findex StrToBin
> +PROCEDURE StrToBin (a: ARRAY OF CHAR ; VAR x: CARDINAL) ;
> +
> +@findex StrToBinInt
> +PROCEDURE StrToBinInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
> +
> +@findex StrToHexInt
> +PROCEDURE StrToHexInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
> +
> +@findex StrToOctInt
> +PROCEDURE StrToOctInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
> +
> +
> +END NumberIO.
> +@end example
> +@page
> +
> +@node gm2-libs/OptLib, gm2-libs/PushBackInput, gm2-libs/NumberIO, Base libraries
> +@subsection gm2-libs/OptLib
> +
> +@example
> +DEFINITION MODULE OptLib ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM DynamicStrings IMPORT String ;
> +
> +TYPE
> +@findex Option (type)
> +   Option ;
> +
> +
> +(*
> +   InitOption - constructor for Option.
> +*)
> +
> +@findex InitOption
> +PROCEDURE InitOption (argc: INTEGER; argv: ADDRESS) : Option ;
> +
> +
> +(*
> +   KillOption - deconstructor for Option.
> +*)
> +
> +@findex KillOption
> +PROCEDURE KillOption (o: Option) : Option ;
> +
> +
> +(*
> +   Dup - duplicate the option array inside, o.
> +         Notice that this does not duplicate all the contents
> +         (strings) of argv.
> +         Shallow copy of the top level indices.
> +*)
> +
> +@findex Dup
> +PROCEDURE Dup (o: Option) : Option ;
> +
> +
> +(*
> +   Slice - return a new option which has elements [low:high] from the
> +           options, o.
> +*)
> +
> +@findex Slice
> +PROCEDURE Slice (o: Option; low, high: INTEGER) : Option ;
> +
> +
> +(*
> +   IndexStrCmp - returns the index in the argv array which matches
> +                 string, s.  -1 is returned if the string is not found.
> +*)
> +
> +@findex IndexStrCmp
> +PROCEDURE IndexStrCmp (o: Option; s: String) : INTEGER ;
> +
> +
> +(*
> +   IndexStrNCmp - returns the index in the argv array where the first
> +                  characters are matched by string, s.
> +                  -1 is returned if the string is not found.
> +*)
> +
> +@findex IndexStrNCmp
> +PROCEDURE IndexStrNCmp (o: Option; s: String) : INTEGER ;
> +
> +
> +(*
> +   ConCat - returns the concatenation of a and b.
> +*)
> +
> +@findex ConCat
> +PROCEDURE ConCat (a, b: Option) : Option ;
> +
> +
> +(*
> +   GetArgv - return the argv component of option.
> +*)
> +
> +@findex GetArgv
> +PROCEDURE GetArgv (o: Option) : ADDRESS ;
> +
> +
> +(*
> +   GetArgc - return the argc component of option.
> +*)
> +
> +@findex GetArgc
> +PROCEDURE GetArgc (o: Option) : INTEGER ;
> +
> +
> +END OptLib.
> +@end example
> +@page
> +
> +@node gm2-libs/PushBackInput, gm2-libs/RTExceptions, gm2-libs/OptLib, Base libraries
> +@subsection gm2-libs/PushBackInput
> +
> +@example
> +DEFINITION MODULE PushBackInput ;
> +
> +FROM FIO IMPORT File ;
> +FROM DynamicStrings IMPORT String ;
> +
> +EXPORT QUALIFIED Open, PutCh, GetCh, Error, WarnError, WarnString,
> +                 Close, SetDebug, GetExitStatus, PutStr,
> +                 PutString, GetColumnPosition, GetCurrentLine ;
> +
> +
> +(*
> +   Open - opens a file for reading.
> +*)
> +
> +@findex Open
> +PROCEDURE Open (a: ARRAY OF CHAR) : File ;
> +
> +
> +(*
> +   GetCh - gets a character from either the push back stack or
> +           from file, f.
> +*)
> +
> +@findex GetCh
> +PROCEDURE GetCh (f: File) : CHAR ;
> +
> +
> +(*
> +   PutCh - pushes a character onto the push back stack, it also
> +           returns the character which has been pushed.
> +*)
> +
> +@findex PutCh
> +PROCEDURE PutCh (ch: CHAR) : CHAR ;
> +
> +
> +(*
> +   PutString - pushes a string onto the push back stack.
> +*)
> +
> +@findex PutString
> +PROCEDURE PutString (a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   PutStr - pushes a dynamic string onto the push back stack.
> +            The string, s, is not deallocated.
> +*)
> +
> +@findex PutStr
> +PROCEDURE PutStr (s: String) ;
> +
> +
> +(*
> +   Error - emits an error message with the appropriate file, line combination.
> +*)
> +
> +@findex Error
> +PROCEDURE Error (a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WarnError - emits an error message with the appropriate file, line combination.
> +               It does not terminate but when the program finishes an exit status of
> +               1 will be issued.
> +*)
> +
> +@findex WarnError
> +PROCEDURE WarnError (a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WarnString - emits an error message with the appropriate file, line combination.
> +                It does not terminate but when the program finishes an exit status of
> +                1 will be issued.
> +*)
> +
> +@findex WarnString
> +PROCEDURE WarnString (s: String) ;
> +
> +
> +(*
> +   Close - closes the opened file.
> +*)
> +
> +@findex Close
> +PROCEDURE Close (f: File) ;
> +
> +
> +(*
> +   GetExitStatus - returns the exit status which will be 1 if any warnings were issued.
> +*)
> +
> +@findex GetExitStatus
> +PROCEDURE GetExitStatus () : CARDINAL ;
> +
> +
> +(*
> +   SetDebug - sets the debug flag on or off.
> +*)
> +
> +@findex SetDebug
> +PROCEDURE SetDebug (d: BOOLEAN) ;
> +
> +
> +(*
> +   GetColumnPosition - returns the column position of the current character.
> +*)
> +
> +@findex GetColumnPosition
> +PROCEDURE GetColumnPosition () : CARDINAL ;
> +
> +
> +(*
> +   GetCurrentLine - returns the current line number.
> +*)
> +
> +@findex GetCurrentLine
> +PROCEDURE GetCurrentLine () : CARDINAL ;
> +
> +
> +END PushBackInput.
> +@end example
> +@page
> +
> +@node gm2-libs/RTExceptions, gm2-libs/RTint, gm2-libs/PushBackInput, Base libraries
> +@subsection gm2-libs/RTExceptions
> +
> +@example
> +DEFINITION MODULE RTExceptions ;
> +
> +(* Runtime exception handler routines.  This should
> +   be considered as a system module for GNU Modula-2
> +   and allow the compiler to interface with exception
> +   handling.  *)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT QUALIFIED EHBlock,
> +                 Raise, SetExceptionBlock, GetExceptionBlock,
> +                 GetTextBuffer, GetTextBufferSize, GetNumber,
> +                 InitExceptionBlock, KillExceptionBlock,
> +                 PushHandler, PopHandler,
> +                 BaseExceptionsThrow, DefaultErrorCatch,
> +                 IsInExceptionState, SetExceptionState,
> +                 SwitchExceptionState, GetBaseExceptionBlock,
> +                 SetExceptionSource, GetExceptionSource ;
> +
> +TYPE
> +@findex EHBlock (type)
> +   EHBlock ;
> +@findex ProcedureHandler (type)
> +   ProcedureHandler = PROCEDURE ;
> +
> +
> +(*
> +   Raise - invoke the exception handler associated with, number,
> +           in the active EHBlock.  It keeps a record of the number
> +           and message in the EHBlock for later use.
> +*)
> +
> +@findex Raise
> +PROCEDURE Raise (number: CARDINAL;
> +                 file: ADDRESS; line: CARDINAL;
> +                 column: CARDINAL; function: ADDRESS;
> +                 message: ADDRESS) ;
> +
> +
> +(*
> +   SetExceptionBlock - sets, source, as the active EHB.
> +*)
> +
> +@findex SetExceptionBlock
> +PROCEDURE SetExceptionBlock (source: EHBlock) ;
> +
> +
> +(*
> +   GetExceptionBlock - returns the active EHB.
> +*)
> +
> +@findex GetExceptionBlock
> +PROCEDURE GetExceptionBlock () : EHBlock ;
> +
> +
> +(*
> +   GetTextBuffer - returns the address of the EHB buffer.
> +*)
> +
> +@findex GetTextBuffer
> +PROCEDURE GetTextBuffer (e: EHBlock) : ADDRESS ;
> +
> +
> +(*
> +   GetTextBufferSize - return the size of the EHB text buffer.
> +*)
> +
> +@findex GetTextBufferSize
> +PROCEDURE GetTextBufferSize (e: EHBlock) : CARDINAL ;
> +
> +
> +(*
> +   GetNumber - return the exception number associated with,
> +               source.
> +*)
> +
> +@findex GetNumber
> +PROCEDURE GetNumber (source: EHBlock) : CARDINAL ;
> +
> +
> +(*
> +   InitExceptionBlock - creates and returns a new exception block.
> +*)
> +
> +@findex InitExceptionBlock
> +PROCEDURE InitExceptionBlock () : EHBlock ;
> +
> +
> +(*
> +   KillExceptionBlock - destroys the EHB, e, and all its handlers.
> +*)
> +
> +@findex KillExceptionBlock
> +PROCEDURE KillExceptionBlock (e: EHBlock) : EHBlock ;
> +
> +
> +(*
> +   PushHandler - install a handler in EHB, e.
> +*)
> +
> +@findex PushHandler
> +PROCEDURE PushHandler (e: EHBlock; number: CARDINAL; p: ProcedureHandler) ;
> +
> +
> +(*
> +   PopHandler - removes the handler associated with, number, from
> +                EHB, e.
> +*)
> +
> +@findex PopHandler
> +PROCEDURE PopHandler (e: EHBlock; number: CARDINAL) ;
> +
> +
> +(*
> +   DefaultErrorCatch - displays the current error message in
> +                       the current exception block and then
> +                       calls HALT.
> +*)
> +
> +@findex DefaultErrorCatch
> +PROCEDURE DefaultErrorCatch ;
> +
> +
> +(*
> +   BaseExceptionsThrow - configures the Modula-2 exceptions to call
> +                         THROW which in turn can be caught by an
> +                         exception block.  If this is not called then
> +                         a Modula-2 exception will simply call an
> +                         error message routine and then HALT.
> +*)
> +
> +@findex BaseExceptionsThrow
> +PROCEDURE BaseExceptionsThrow ;
> +
> +
> +(*
> +   IsInExceptionState - returns TRUE if the program is currently
> +                        in the exception state.
> +*)
> +
> +@findex IsInExceptionState
> +PROCEDURE IsInExceptionState () : BOOLEAN ;
> +
> +
> +(*
> +   SetExceptionState - returns the current exception state and
> +                       then sets the current exception state to,
> +                       to.
> +*)
> +
> +@findex SetExceptionState
> +PROCEDURE SetExceptionState (to: BOOLEAN) : BOOLEAN ;
> +
> +
> +(*
> +   SwitchExceptionState - assigns, from, with the current exception
> +                          state and then assigns the current exception
> +                          to, to.
> +*)
> +
> +@findex SwitchExceptionState
> +PROCEDURE SwitchExceptionState (VAR from: BOOLEAN; to: BOOLEAN) ;
> +
> +
> +(*
> +   GetBaseExceptionBlock - returns the initial language exception block
> +                           created.
> +*)
> +
> +@findex GetBaseExceptionBlock
> +PROCEDURE GetBaseExceptionBlock () : EHBlock ;
> +
> +
> +(*
> +   SetExceptionSource - sets the current exception source to, source.
> +*)
> +
> +@findex SetExceptionSource
> +PROCEDURE SetExceptionSource (source: ADDRESS) ;
> +
> +
> +(*
> +   GetExceptionSource - returns the current exception source.
> +*)
> +
> +@findex GetExceptionSource
> +PROCEDURE GetExceptionSource () : ADDRESS ;
> +
> +
> +END RTExceptions.
> +@end example
> +@page
> +
> +@node gm2-libs/RTint, gm2-libs/SArgs, gm2-libs/RTExceptions, Base libraries
> +@subsection gm2-libs/RTint
> +
> +@example
> +DEFINITION MODULE RTint ;
> +
> +(* Provides users of the COROUTINES library with the
> +   ability to create interrupt sources based on
> +   file descriptors and timeouts.  *)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex DispatchVector (type)
> +   DispatchVector = PROCEDURE (CARDINAL, CARDINAL, ADDRESS) ;
> +
> +
> +(*
> +   InitInputVector - returns an interrupt vector which is associated
> +                     with the file descriptor, fd.
> +*)
> +
> +@findex InitInputVector
> +PROCEDURE InitInputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   InitOutputVector - returns an interrupt vector which is associated
> +                      with the file descriptor, fd.
> +*)
> +
> +@findex InitOutputVector
> +PROCEDURE InitOutputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   InitTimeVector - returns an interrupt vector associated with
> +                    the relative time.
> +*)
> +
> +@findex InitTimeVector
> +PROCEDURE InitTimeVector (micro, secs: CARDINAL; pri: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   ReArmTimeVector - reprimes the vector, vec, to deliver an interrupt
> +                     at the new relative time.
> +*)
> +
> +@findex ReArmTimeVector
> +PROCEDURE ReArmTimeVector (vec: CARDINAL; micro, secs: CARDINAL) ;
> +
> +
> +(*
> +   GetTimeVector - assigns, micro, and, secs, with the remaining
> +                   time before this interrupt will expire.
> +                   This value is only updated when a Listen
> +                   occurs.
> +*)
> +
> +@findex GetTimeVector
> +PROCEDURE GetTimeVector (vec: CARDINAL; VAR micro, secs: CARDINAL) ;
> +
> +
> +(*
> +   AttachVector - adds the pointer, p, to be associated with the interrupt
> +                  vector. It returns the previous value attached to this
> +                  vector.
> +*)
> +
> +@findex AttachVector
> +PROCEDURE AttachVector (vec: CARDINAL; p: ADDRESS) : ADDRESS ;
> +
> +
> +(*
> +   IncludeVector - includes, vec, into the dispatcher list of
> +                   possible interrupt causes.
> +*)
> +
> +@findex IncludeVector
> +PROCEDURE IncludeVector (vec: CARDINAL) ;
> +
> +
> +(*
> +   ExcludeVector - excludes, vec, from the dispatcher list of
> +                   possible interrupt causes.
> +*)
> +
> +@findex ExcludeVector
> +PROCEDURE ExcludeVector (vec: CARDINAL) ;
> +
> +
> +(*
> +   Listen - will either block indefinitely (until an interrupt)
> +            or alteratively will test to see whether any interrupts
> +            are pending.
> +            If a pending interrupt was found then, call, is called
> +            and then this procedure returns.
> +            It only listens for interrupts > pri.
> +*)
> +
> +@findex Listen
> +PROCEDURE Listen (untilInterrupt: BOOLEAN;
> +                  call: DispatchVector;
> +                  pri: CARDINAL) ;
> +
> +
> +(*
> +   Init - allows the user to force the initialize order.
> +*)
> +
> +@findex Init
> +PROCEDURE Init ;
> +
> +
> +END RTint.
> +@end example
> +@page
> +
> +@node gm2-libs/SArgs, gm2-libs/SCmdArgs, gm2-libs/RTint, Base libraries
> +@subsection gm2-libs/SArgs
> +
> +@example
> +DEFINITION MODULE SArgs ;
> +
> +FROM DynamicStrings IMPORT String ;
> +EXPORT QUALIFIED GetArg, Narg ;
> +
> +
> +(*
> +   GetArg - returns the nth argument from the command line.
> +            The success of the operation is returned.
> +            If TRUE is returned then the string, s, contains a
> +            new string, otherwise s is set to NIL.
> +*)
> +
> +@findex GetArg
> +PROCEDURE GetArg (VAR s: String ; n: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   Narg - returns the number of arguments available from
> +          command line.
> +*)
> +
> +@findex Narg
> +PROCEDURE Narg() : CARDINAL ;
> +
> +
> +END SArgs.
> +@end example
> +@page
> +
> +@node gm2-libs/SCmdArgs, gm2-libs/SEnvironment, gm2-libs/SArgs, Base libraries
> +@subsection gm2-libs/SCmdArgs
> +
> +@example
> +DEFINITION MODULE SCmdArgs ;
> +
> +FROM DynamicStrings IMPORT String ;
> +
> +EXPORT QUALIFIED GetArg, Narg ;
> +
> +
> +(*
> +   GetArg - returns the nth argument from the command line, CmdLine
> +            the success of the operation is returned.
> +*)
> +
> +@findex GetArg
> +PROCEDURE GetArg (CmdLine: String;
> +                  n: CARDINAL; VAR Argi: String) : BOOLEAN ;
> +
> +
> +(*
> +   Narg - returns the number of arguments available from
> +          command line, CmdLine.
> +*)
> +
> +@findex Narg
> +PROCEDURE Narg (CmdLine: String) : CARDINAL ;
> +
> +
> +END SCmdArgs.
> +@end example
> +@page
> +
> +@node gm2-libs/SEnvironment, gm2-libs/SFIO, gm2-libs/SCmdArgs, Base libraries
> +@subsection gm2-libs/SEnvironment
> +
> +@example
> +DEFINITION MODULE SEnvironment ;
> +
> +
> +FROM DynamicStrings IMPORT String ;
> +EXPORT QUALIFIED GetEnvironment ;
> +
> +
> +(*
> +   GetEnvironment - gets the environment variable Env and places
> +                   a copy of its value into String, dest.
> +                    It returns TRUE if the string Env was found in
> +                    the processes environment.
> +*)
> +
> +@findex GetEnvironment
> +PROCEDURE GetEnvironment (Env: String;
> +                          VAR dest: String) : BOOLEAN ;
> +
> +
> +(*
> +   PutEnvironment - change or add an environment variable definition EnvDef.
> +                    TRUE is returned if the environment variable was
> +                    set or changed successfully.
> +*)
> +
> +@findex PutEnvironment
> +PROCEDURE PutEnvironment (EnvDef: String) : BOOLEAN ;
> +
> +
> +END SEnvironment.
> +@end example
> +@page
> +
> +@node gm2-libs/SFIO, gm2-libs/SMathLib0, gm2-libs/SEnvironment, Base libraries
> +@subsection gm2-libs/SFIO
> +
> +@example
> +DEFINITION MODULE SFIO ;
> +
> +FROM DynamicStrings IMPORT String ;
> +FROM FIO IMPORT File ;
> +
> +EXPORT QUALIFIED OpenToRead, OpenToWrite, OpenForRandom, Exists, WriteS, ReadS ;
> +
> +
> +(*
> +   Exists - returns TRUE if a file named, fname exists for reading.
> +*)
> +
> +@findex Exists
> +PROCEDURE Exists (fname: String) : BOOLEAN ;
> +
> +
> +(*
> +   OpenToRead - attempts to open a file, fname, for reading and
> +                it returns this file.
> +                The success of this operation can be checked by
> +                calling IsNoError.
> +*)
> +
> +@findex OpenToRead
> +PROCEDURE OpenToRead (fname: String) : File ;
> +
> +
> +(*
> +   OpenToWrite - attempts to open a file, fname, for write and
> +                 it returns this file.
> +                 The success of this operation can be checked by
> +                 calling IsNoError.
> +*)
> +
> +@findex OpenToWrite
> +PROCEDURE OpenToWrite (fname: String) : File ;
> +
> +
> +(*
> +   OpenForRandom - attempts to open a file, fname, for random access
> +                   read or write and it returns this file.
> +                   The success of this operation can be checked by
> +                   calling IsNoError.
> +                   towrite, determines whether the file should be
> +                   opened for writing or reading.
> +                   if towrite is TRUE or whether the previous file should
> +                   be left alone, allowing this descriptor to seek
> +                   and modify an existing file.
> +*)
> +
> +@findex OpenForRandom
> +PROCEDURE OpenForRandom (fname: String; towrite, newfile: BOOLEAN) : File ;
> +
> +
> +(*
> +   WriteS - writes a string, s, to, file. It returns the String, s.
> +*)
> +
> +@findex WriteS
> +PROCEDURE WriteS (file: File; s: String) : String ;
> +
> +
> +(*
> +   ReadS - reads a string, s, from, file. It returns the String, s.
> +           It stops reading the string at the end of line or end of file.
> +           It consumes the newline at the end of line but does not place
> +           this into the returned string.
> +*)
> +
> +@findex ReadS
> +PROCEDURE ReadS (file: File) : String ;
> +
> +
> +END SFIO.
> +@end example
> +@page
> +
> +@node gm2-libs/SMathLib0, gm2-libs/SYSTEM, gm2-libs/SFIO, Base libraries
> +@subsection gm2-libs/SMathLib0
> +
> +@example
> +DEFINITION MODULE SMathLib0 ;
> +
> +CONST
> +   pi   = 3.1415926535897932384626433832795028841972;
> +   exp1 = 2.7182818284590452353602874713526624977572;
> +
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: SHORTREAL) : SHORTREAL ;
> +@findex exp
> +PROCEDURE exp (x: SHORTREAL) : SHORTREAL ;
> +@findex ln
> +PROCEDURE ln (x: SHORTREAL) : SHORTREAL ;
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: SHORTREAL) : SHORTREAL ;
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: SHORTREAL) : SHORTREAL ;
> +@findex tan
> +PROCEDURE tan (x: SHORTREAL) : SHORTREAL ;
> +@findex arctan
> +PROCEDURE arctan (x: SHORTREAL) : SHORTREAL ;
> +@findex entier
> +PROCEDURE entier (x: SHORTREAL) : INTEGER ;
> +
> +
> +END SMathLib0.
> +@end example
> +@page
> +
> +@node gm2-libs/SYSTEM, gm2-libs/Scan, gm2-libs/SMathLib0, Base libraries
> +@subsection gm2-libs/SYSTEM
> +
> +@example
> +DEFINITION MODULE SYSTEM ;
> +
> +EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
> +                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
> +                 Target specific data types.  *)
> +                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
> +                 (* SIZE is also exported if -fpim2 is used.  *)
> +
> +CONST
> +@findex BITSPERBYTE (const)
> +  BITSPERBYTE   = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
> +@findex BYTESPERWORD (const)
> +  BYTESPERWORD  = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
> +
> +
> +(* all the following types are declared internally to gm2
> +TYPE
> +   (* Target specific data types.  *)
> +*)
> +
> +
> +(*
> +   all the functions below are declared internally to gm2
> +   ====================================================
> +
> +@findex ADR
> +PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
> +  (* Returns the address of variable v. *)
> +
> +@findex SIZE
> +PROCEDURE SIZE (v: <type>) : ZType;
> +  (* Returns the number of BYTES used to store a v of
> +     any specified <type>.  Only available if -fpim2 is used.
> +  *)
> +
> +@findex TSIZE
> +PROCEDURE TSIZE (<type>) : CARDINAL;
> +  (* Returns the number of BYTES used to store a value of the
> +     specified <type>.
> +  *)
> +
> +@findex ROTATE
> +PROCEDURE ROTATE (val: <a set type>;
> +                  num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by rotating up/right
> +     or down/right by the absolute value of num.  The direction is
> +     down/right if the sign of num is negative, otherwise the direction
> +     is up/left.
> +  *)
> +
> +@findex SHIFT
> +PROCEDURE SHIFT (val: <a set type>;
> +                 num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by shifting up/left
> +     or down/right by the absolute value of num, introducing
> +     zeros as necessary.  The direction is down/right if the sign of
> +     num is negative, otherwise the direction is up/left.
> +  *)
> +
> +@findex THROW
> +PROCEDURE THROW (i: INTEGER) ;
> +  (*
> +     THROW is a GNU extension and was not part of the PIM or ISO
> +     standards.  It throws an exception which will be caught by the
> +     EXCEPT block (assuming it exists).  This is a compiler builtin
> +     function which interfaces to the GCC exception handling runtime
> +     system.
> +     GCC uses the term throw, hence the naming distinction between
> +     the GCC builtin and the Modula-2 runtime library procedure Raise.
> +     The later library procedure Raise will call SYSTEM.THROW after
> +     performing various housekeeping activities.
> +  *)
> +
> +@findex TBITSIZE
> +PROCEDURE TBITSIZE (<type>) : CARDINAL ;
> +  (* Returns the minimum number of bits necessary to represent
> +     <type>.  This procedure function is only useful for determining
> +     the number of bits used for any type field within a packed RECORD.
> +     It is not particularly useful elsewhere since <type> might be
> +     optimized for speed, for example a BOOLEAN could occupy a WORD.
> +  *)
> +*)
> +
> +(* The following procedures are invoked by GNU Modula-2 to
> +   shift non word sized set types. They are not strictly part
> +   of the core PIM Modula-2, however they are used
> +   to implement the SHIFT procedure defined above,
> +   which are in turn used by the Logitech compatible libraries.
> +
> +   Users will access these procedures by using the procedure
> +   SHIFT above and GNU Modula-2 will map SHIFT onto one of
> +   the following procedures.
> +*)
> +
> +(*
> +   ShiftVal - is a runtime procedure whose job is to implement
> +              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
> +              inline a SHIFT of a single WORD sized set and will only
> +              call this routine for larger sets.
> +*)
> +
> +@findex ShiftVal
> +PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
> +                    SetSizeInBits: CARDINAL;
> +                    ShiftCount: INTEGER) ;
> +
> +
> +(*
> +   ShiftLeft - performs the shift left for a multi word set.
> +               This procedure might be called by the back end of
> +               GNU Modula-2 depending whether amount is known at
> +               compile time.
> +*)
> +
> +@findex ShiftLeft
> +PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +(*
> +   ShiftRight - performs the shift left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex ShiftRight
> +PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      ShiftCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateVal - is a runtime procedure whose job is to implement
> +               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
> +               inline a ROTATE of a single WORD (or less)
> +               sized set and will only call this routine for larger
> +               sets.
> +*)
> +
> +@findex RotateVal
> +PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     RotateCount: INTEGER) ;
> +
> +
> +(*
> +   RotateLeft - performs the rotate left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex RotateLeft
> +PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      RotateCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateRight - performs the rotate right for a multi word set.
> +                 This procedure might be called by the back end of
> +                 GNU Modula-2 depending whether amount is known at
> +                 compile time.
> +*)
> +
> +@findex RotateRight
> +PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
> +                       SetSizeInBits: CARDINAL;
> +                       RotateCount: CARDINAL) ;
> +
> +
> +END SYSTEM.
> +@end example
> +@page
> +
> +@node gm2-libs/Scan, gm2-libs/Selective, gm2-libs/SYSTEM, Base libraries
> +@subsection gm2-libs/Scan
> +
> +@example
> +DEFINITION MODULE Scan ;
> +
> +(* Provides a primitive symbol fetching from input.
> +   Symbols are delimited by spaces and tabs.
> +   Limitation only allows one source file at
> +   a time to deliver symbols.  *)
> +
> +
> +EXPORT QUALIFIED GetNextSymbol, WriteError,
> +                 OpenSource, CloseSource,
> +                 TerminateOnError, DefineComments ;
> +
> +
> +(* OpenSource - opens a source file for reading.                  *)
> +
> +@findex OpenSource
> +PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(* CloseSource - closes the current source file from reading.     *)
> +
> +@findex CloseSource
> +PROCEDURE CloseSource ;
> +
> +
> +(* GetNextSymbol gets the next source symbol and returns it in a. *)
> +
> +@findex GetNextSymbol
> +PROCEDURE GetNextSymbol (VAR a: ARRAY OF CHAR) ;
> +
> +
> +(* WriteError writes a message, a, under the source line, which   *)
> +(* attempts to pinpoint the Symbol at fault.                      *)
> +
> +@findex WriteError
> +PROCEDURE WriteError (a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   TerminateOnError - exits with status 1 if we call WriteError.
> +*)
> +
> +@findex TerminateOnError
> +PROCEDURE TerminateOnError ;
> +
> +
> +(*
> +   DefineComments - defines the start of comments within the source
> +                    file.
> +
> +                    The characters in Start define the comment start
> +                    and characters in End define the end.
> +                    The BOOLEAN eoln determine whether the comment
> +                    is terminated by end of line. If eoln is TRUE
> +                    then End is ignored.
> +
> +                    If this procedure is never called then no comments
> +                    are allowed.
> +*)
> +
> +@findex DefineComments
> +PROCEDURE DefineComments (Start, End: ARRAY OF CHAR; eoln: BOOLEAN) ;
> +
> +
> +END Scan.
> +@end example
> +@page
> +
> +@node gm2-libs/Selective, gm2-libs/StdIO, gm2-libs/Scan, Base libraries
> +@subsection gm2-libs/Selective
> +
> +@example
> +DEFINITION MODULE Selective ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +EXPORT QUALIFIED SetOfFd, Timeval,
> +                 InitSet, KillSet, InitTime, KillTime,
> +                 GetTime, SetTime,
> +                 FdZero, FdSet, FdClr, FdIsSet, Select,
> +                 MaxFdsPlusOne, WriteCharRaw, ReadCharRaw,
> +                 GetTimeOfDay ;
> +
> +TYPE
> +@findex SetOfFd (type)
> +   SetOfFd = ADDRESS ;    (* Hidden type in Selective.c *)
> +@findex Timeval (type)
> +   Timeval = ADDRESS ;    (* Hidden type in Selective.c *)
> +
> +
> +@findex Select
> +PROCEDURE Select (nooffds: CARDINAL;
> +                  readfds, writefds, exceptfds: SetOfFd;
> +                  timeout: Timeval) : INTEGER ;
> +
> +@findex InitTime
> +PROCEDURE InitTime (sec, usec: CARDINAL) : Timeval ;
> +@findex KillTime
> +PROCEDURE KillTime (t: Timeval) : Timeval ;
> +@findex GetTime
> +PROCEDURE GetTime (t: Timeval; VAR sec, usec: CARDINAL) ;
> +@findex SetTime
> +PROCEDURE SetTime (t: Timeval; sec, usec: CARDINAL) ;
> +@findex InitSet
> +PROCEDURE InitSet () : SetOfFd ;
> +@findex KillSet
> +PROCEDURE KillSet (s: SetOfFd) : SetOfFd ;
> +@findex FdZero
> +PROCEDURE FdZero (s: SetOfFd) ;
> +@findex FdSet
> +PROCEDURE FdSet (fd: INTEGER; s: SetOfFd) ;
> +@findex FdClr
> +PROCEDURE FdClr (fd: INTEGER; s: SetOfFd) ;
> +@findex FdIsSet
> +PROCEDURE FdIsSet (fd: INTEGER; s: SetOfFd) : BOOLEAN ;
> +@findex MaxFdsPlusOne
> +PROCEDURE MaxFdsPlusOne (a, b: INTEGER) : INTEGER ;
> +
> +(* you must use the raw routines with select - not the FIO buffered routines *)
> +@findex WriteCharRaw
> +PROCEDURE WriteCharRaw (fd: INTEGER; ch: CHAR) ;
> +@findex ReadCharRaw
> +PROCEDURE ReadCharRaw (fd: INTEGER) : CHAR ;
> +
> +(*
> +   GetTimeOfDay - fills in a record, Timeval, filled in with the
> +                  current system time in seconds and microseconds.
> +                  It returns zero (see man 3p gettimeofday)
> +*)
> +
> +@findex GetTimeOfDay
> +PROCEDURE GetTimeOfDay (tv: Timeval) : INTEGER ;
> +
> +
> +END Selective.
> +@end example
> +@page
> +
> +@node gm2-libs/StdIO, gm2-libs/Storage, gm2-libs/Selective, Base libraries
> +@subsection gm2-libs/StdIO
> +
> +@example
> +DEFINITION MODULE StdIO ;
> +
> +EXPORT QUALIFIED ProcRead, ProcWrite,
> +                 Read, Write,
> +                 PushOutput, PopOutput, GetCurrentOutput,
> +                 PushInput, PopInput, GetCurrentInput ;
> +
> +
> +TYPE
> +@findex ProcWrite (type)
> +   ProcWrite = PROCEDURE (CHAR) ;
> +@findex ProcRead (type)
> +   ProcRead  = PROCEDURE (VAR CHAR) ;
> +
> +
> +(*
> +   Read - is the generic procedure that all higher application layers
> +          should use to receive a character.
> +*)
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +
> +
> +(*
> +   Write - is the generic procedure that all higher application layers
> +           should use to emit a character.
> +*)
> +
> +@findex Write
> +PROCEDURE Write (ch: CHAR) ;
> +
> +
> +(*
> +   PushOutput - pushes the current Write procedure onto a stack,
> +                any future references to Write will actually invoke
> +                procedure, p.
> +*)
> +
> +@findex PushOutput
> +PROCEDURE PushOutput (p: ProcWrite) ;
> +
> +
> +(*
> +   PopOutput - restores Write to use the previous output procedure.
> +*)
> +
> +@findex PopOutput
> +PROCEDURE PopOutput ;
> +
> +
> +(*
> +   GetCurrentOutput - returns the current output procedure.
> +*)
> +
> +@findex GetCurrentOutput
> +PROCEDURE GetCurrentOutput () : ProcWrite ;
> +
> +
> +(*
> +   PushInput - pushes the current Read procedure onto a stack,
> +               any future references to Read will actually invoke
> +               procedure, p.
> +*)
> +
> +@findex PushInput
> +PROCEDURE PushInput (p: ProcRead) ;
> +
> +
> +(*
> +   PopInput - restores Write to use the previous output procedure.
> +*)
> +
> +@findex PopInput
> +PROCEDURE PopInput ;
> +
> +
> +(*
> +   GetCurrentInput - returns the current input procedure.
> +*)
> +
> +@findex GetCurrentInput
> +PROCEDURE GetCurrentInput () : ProcRead ;
> +
> +
> +END StdIO.
> +@end example
> +@page
> +
> +@node gm2-libs/Storage, gm2-libs/StrCase, gm2-libs/StdIO, Base libraries
> +@subsection gm2-libs/Storage
> +
> +@example
> +DEFINITION MODULE Storage ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +EXPORT QUALIFIED ALLOCATE, DEALLOCATE, REALLOCATE, Available ;
> +
> +
> +
> +(*
> +   ALLOCATE - attempt to allocate memory from the heap.
> +              NIL is returned in, a, if ALLOCATE fails.
> +*)
> +
> +@findex ALLOCATE
> +PROCEDURE ALLOCATE (VAR a: ADDRESS ; Size: CARDINAL) ;
> +
> +
> +(*
> +   DEALLOCATE - return, Size, bytes to the heap.
> +                The variable, a, is set to NIL.
> +*)
> +
> +@findex DEALLOCATE
> +PROCEDURE DEALLOCATE (VAR a: ADDRESS ; Size: CARDINAL) ;
> +
> +
> +(*
> +   REALLOCATE - attempts to reallocate storage. The address,
> +                a, should either be NIL in which case ALLOCATE
> +                is called, or alternatively it should have already
> +                been initialized by ALLOCATE. The allocated storage
> +                is resized accordingly.
> +*)
> +
> +@findex REALLOCATE
> +PROCEDURE REALLOCATE (VAR a: ADDRESS; Size: CARDINAL) ;
> +
> +
> +(*
> +   Available - returns TRUE if, Size, bytes can be allocated.
> +*)
> +
> +@findex Available
> +PROCEDURE Available (Size: CARDINAL) : BOOLEAN ;
> +
> +
> +END Storage.
> +@end example
> +@page
> +
> +@node gm2-libs/StrCase, gm2-libs/StrIO, gm2-libs/Storage, Base libraries
> +@subsection gm2-libs/StrCase
> +
> +@example
> +DEFINITION MODULE StrCase ;
> +
> +
> +EXPORT QUALIFIED StrToUpperCase, StrToLowerCase, Cap, Lower ;
> +
> +
> +(*
> +   StrToUpperCase - converts string, a, to uppercase returning the
> +                    result in, b.
> +*)
> +
> +@findex StrToUpperCase
> +PROCEDURE StrToUpperCase (a: ARRAY OF CHAR ; VAR b: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   StrToLowerCase - converts string, a, to lowercase returning the
> +                    result in, b.
> +*)
> +
> +@findex StrToLowerCase
> +PROCEDURE StrToLowerCase (a: ARRAY OF CHAR ; VAR b: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   Cap - converts a lower case character into a capital character.
> +         If the character is not a lower case character 'a'..'z'
> +         then the character is simply returned unaltered.
> +*)
> +
> +@findex Cap
> +PROCEDURE Cap (ch: CHAR) : CHAR ;
> +
> +
> +(*
> +   Lower - converts an upper case character into a lower case character.
> +           If the character is not an upper case character 'A'..'Z'
> +           then the character is simply returned unaltered.
> +*)
> +
> +@findex Lower
> +PROCEDURE Lower (ch: CHAR) : CHAR ;
> +
> +
> +END StrCase.
> +@end example
> +@page
> +
> +@node gm2-libs/StrIO, gm2-libs/StrLib, gm2-libs/StrCase, Base libraries
> +@subsection gm2-libs/StrIO
> +
> +@example
> +DEFINITION MODULE StrIO ;
> +
> +EXPORT QUALIFIED ReadString, WriteString,
> +                 WriteLn ;
> +
> +
> +(*
> +   WriteLn - writes a carriage return and a newline
> +             character.
> +*)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn ;
> +
> +
> +(*
> +   ReadString - reads a sequence of characters into a string.
> +                Line editing accepts Del, Ctrl H, Ctrl W and
> +                Ctrl U.
> +*)
> +
> +@findex ReadString
> +PROCEDURE ReadString (VAR a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WriteString - writes a string to the default output.
> +*)
> +
> +@findex WriteString
> +PROCEDURE WriteString (a: ARRAY OF CHAR) ;
> +
> +
> +END StrIO.
> +@end example
> +@page
> +
> +@node gm2-libs/StrLib, gm2-libs/StringConvert, gm2-libs/StrIO, Base libraries
> +@subsection gm2-libs/StrLib
> +
> +@example
> +DEFINITION MODULE StrLib ;
> +
> +EXPORT QUALIFIED StrConCat, StrLen, StrCopy, StrEqual, StrLess,
> +                IsSubString, StrRemoveWhitePrefix ;
> +
> +
> +(*
> +   StrConCat - combines a and b into c.
> +*)
> +
> +@findex StrConCat
> +PROCEDURE StrConCat (a, b: ARRAY OF CHAR; VAR c: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   StrLess - returns TRUE if string, a, alphabetically occurs before
> +             string, b.
> +*)
> +
> +@findex StrLess
> +PROCEDURE StrLess (a, b: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   StrEqual - performs a = b on two strings.
> +*)
> +
> +@findex StrEqual
> +PROCEDURE StrEqual (a, b: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   StrLen - returns the length of string, a.
> +*)
> +
> +@findex StrLen
> +PROCEDURE StrLen (a: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +(*
> +   StrCopy - copy string src into string dest providing dest is large enough.
> +             If dest is smaller than a then src then the string is truncated when
> +             dest is full.  Add a nul character if there is room in dest.
> +*)
> +
> +@findex StrCopy
> +PROCEDURE StrCopy (src: ARRAY OF CHAR ; VAR dest: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   IsSubString - returns true if b is a subcomponent of a.
> +*)
> +
> +@findex IsSubString
> +PROCEDURE IsSubString (a, b: ARRAY OF CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   StrRemoveWhitePrefix - copies string, into string, b, excluding any white
> +                          space infront of a.
> +*)
> +
> +@findex StrRemoveWhitePrefix
> +PROCEDURE StrRemoveWhitePrefix (a: ARRAY OF CHAR; VAR b: ARRAY OF CHAR) ;
> +
> +
> +END StrLib.
> +@end example
> +@page
> +
> +@node gm2-libs/StringConvert, gm2-libs/SysExceptions, gm2-libs/StrLib, Base libraries
> +@subsection gm2-libs/StringConvert
> +
> +@example
> +DEFINITION MODULE StringConvert ;
> +
> +FROM DynamicStrings IMPORT String ;
> +EXPORT QUALIFIED IntegerToString, StringToInteger,
> +                 StringToLongInteger, LongIntegerToString,
> +                 StringToCardinal, CardinalToString,
> +                 StringToLongCardinal, LongCardinalToString,
> +                 StringToShortCardinal, ShortCardinalToString,
> +                 StringToLongreal, LongrealToString,
> +                 ToSigFig,
> +                 stoi, itos, ctos, stoc, hstoi, ostoi, bstoi,
> +                 hstoc, ostoc, bstoc,
> +                 stor, stolr ;
> +
> +
> +(*
> +   IntegerToString - converts INTEGER, i, into a String. The field with
> +                     can be specified if non zero. Leading characters
> +                     are defined by padding and this function will
> +                     prepend a + if sign is set to TRUE.
> +                     The base allows the caller to generate binary,
> +                     octal, decimal, hexidecimal numbers.
> +                     The value of lower is only used when hexidecimal
> +                     numbers are generated and if TRUE then digits
> +                     abcdef are used, and if FALSE then ABCDEF are used.
> +*)
> +
> +@findex IntegerToString
> +PROCEDURE IntegerToString (i: INTEGER; width: CARDINAL; padding: CHAR; sign: BOOLEAN;
> +                           base: CARDINAL; lower: BOOLEAN) : String ;
> +
> +
> +(*
> +   CardinalToString - converts CARDINAL, c, into a String. The field
> +                      width can be specified if non zero. Leading
> +                      characters are defined by padding.
> +                      The base allows the caller to generate binary,
> +                      octal, decimal, hexidecimal numbers.
> +                      The value of lower is only used when hexidecimal
> +                      numbers are generated and if TRUE then digits
> +                      abcdef are used, and if FALSE then ABCDEF are used.
> +*)
> +
> +@findex CardinalToString
> +PROCEDURE CardinalToString (c: CARDINAL; width: CARDINAL; padding: CHAR;
> +                            base: CARDINAL; lower: BOOLEAN) : String ;
> +
> +
> +(*
> +   StringToInteger - converts a string, s, of, base, into an INTEGER.
> +                     Leading white space is ignored. It stops converting
> +                     when either the string is exhausted or if an illegal
> +                     numeral is found.
> +                     The parameter found is set TRUE if a number was found.
> +*)
> +
> +@findex StringToInteger
> +PROCEDURE StringToInteger (s: String; base: CARDINAL; VAR found: BOOLEAN) : INTEGER ;
> +
> +
> +(*
> +   StringToCardinal - converts a string, s, of, base, into a CARDINAL.
> +                      Leading white space is ignored. It stops converting
> +                      when either the string is exhausted or if an illegal
> +                      numeral is found.
> +                      The parameter found is set TRUE if a number was found.
> +*)
> +
> +@findex StringToCardinal
> +PROCEDURE StringToCardinal (s: String; base: CARDINAL; VAR found: BOOLEAN) : CARDINAL ;
> +
> +
> +(*
> +   LongIntegerToString - converts LONGINT, i, into a String. The field with
> +                         can be specified if non zero. Leading characters
> +                         are defined by padding and this function will
> +                         prepend a + if sign is set to TRUE.
> +                         The base allows the caller to generate binary,
> +                         octal, decimal, hexidecimal numbers.
> +                         The value of lower is only used when hexidecimal
> +                         numbers are generated and if TRUE then digits
> +                         abcdef are used, and if FALSE then ABCDEF are used.
> +*)
> +
> +@findex LongIntegerToString
> +PROCEDURE LongIntegerToString (i: LONGINT; width: CARDINAL; padding: CHAR;
> +                               sign: BOOLEAN; base: CARDINAL; lower: BOOLEAN) : String ;
> +
> +
> +
> +(*
> +   StringToLongInteger - converts a string, s, of, base, into an LONGINT.
> +                         Leading white space is ignored. It stops converting
> +                         when either the string is exhausted or if an illegal
> +                         numeral is found.
> +                         The parameter found is set TRUE if a number was found.
> +*)
> +
> +@findex StringToLongInteger
> +PROCEDURE StringToLongInteger (s: String; base: CARDINAL; VAR found: BOOLEAN) : LONGINT ;
> +
> +
> +(*
> +   LongCardinalToString - converts LONGCARD, c, into a String. The field
> +                          width can be specified if non zero. Leading
> +                          characters are defined by padding.
> +                          The base allows the caller to generate binary,
> +                          octal, decimal, hexidecimal numbers.
> +                          The value of lower is only used when hexidecimal
> +                          numbers are generated and if TRUE then digits
> +                          abcdef are used, and if FALSE then ABCDEF are used.
> +*)
> +
> +@findex LongCardinalToString
> +PROCEDURE LongCardinalToString (c: LONGCARD; width: CARDINAL; padding: CHAR;
> +                                base: CARDINAL; lower: BOOLEAN) : String ;
> +
> +
> +(*
> +   StringToLongCardinal - converts a string, s, of, base, into a LONGCARD.
> +                          Leading white space is ignored. It stops converting
> +                          when either the string is exhausted or if an illegal
> +                          numeral is found.
> +                          The parameter found is set TRUE if a number was found.
> +*)
> +
> +@findex StringToLongCardinal
> +PROCEDURE StringToLongCardinal (s: String; base: CARDINAL; VAR found: BOOLEAN) : LONGCARD ;
> +
> +
> +(*
> +   ShortCardinalToString - converts SHORTCARD, c, into a String. The field
> +                           width can be specified if non zero. Leading
> +                           characters are defined by padding.
> +                           The base allows the caller to generate binary,
> +                           octal, decimal, hexidecimal numbers.
> +                           The value of lower is only used when hexidecimal
> +                           numbers are generated and if TRUE then digits
> +                           abcdef are used, and if FALSE then ABCDEF are used.
> +*)
> +
> +@findex ShortCardinalToString
> +PROCEDURE ShortCardinalToString (c: SHORTCARD; width: CARDINAL; padding: CHAR;
> +                                 base: CARDINAL; lower: BOOLEAN) : String ;
> +
> +
> +(*
> +   StringToShortCardinal - converts a string, s, of, base, into a SHORTCARD.
> +                           Leading white space is ignored. It stops converting
> +                           when either the string is exhausted or if an illegal
> +                           numeral is found.
> +                           The parameter found is set TRUE if a number was found.
> +*)
> +
> +@findex StringToShortCardinal
> +PROCEDURE StringToShortCardinal (s: String; base: CARDINAL;
> +                                 VAR found: BOOLEAN) : SHORTCARD ;
> +
> +
> +(*
> +   stoi - decimal string to INTEGER
> +*)
> +
> +@findex stoi
> +PROCEDURE stoi (s: String) : INTEGER ;
> +
> +
> +(*
> +   itos - integer to decimal string.
> +*)
> +
> +@findex itos
> +PROCEDURE itos (i: INTEGER; width: CARDINAL; padding: CHAR; sign: BOOLEAN) : String ;
> +
> +
> +(*
> +   ctos - cardinal to decimal string.
> +*)
> +
> +@findex ctos
> +PROCEDURE ctos (c: CARDINAL; width: CARDINAL; padding: CHAR) : String ;
> +
> +
> +(*
> +   stoc - decimal string to CARDINAL
> +*)
> +
> +@findex stoc
> +PROCEDURE stoc (s: String) : CARDINAL ;
> +
> +
> +(*
> +   hstoi - hexidecimal string to INTEGER
> +*)
> +
> +@findex hstoi
> +PROCEDURE hstoi (s: String) : INTEGER ;
> +
> +
> +(*
> +   ostoi - octal string to INTEGER
> +*)
> +
> +@findex ostoi
> +PROCEDURE ostoi (s: String) : INTEGER ;
> +
> +
> +(*
> +   bstoi - binary string to INTEGER
> +*)
> +
> +@findex bstoi
> +PROCEDURE bstoi (s: String) : INTEGER ;
> +
> +
> +(*
> +   hstoc - hexidecimal string to CARDINAL
> +*)
> +
> +@findex hstoc
> +PROCEDURE hstoc (s: String) : CARDINAL ;
> +
> +
> +(*
> +   ostoc - octal string to CARDINAL
> +*)
> +
> +@findex ostoc
> +PROCEDURE ostoc (s: String) : CARDINAL ;
> +
> +
> +(*
> +   bstoc - binary string to CARDINAL
> +*)
> +
> +@findex bstoc
> +PROCEDURE bstoc (s: String) : CARDINAL ;
> +
> +
> +(*
> +   StringToLongreal - returns a LONGREAL and sets found to TRUE
> +                      if a legal number is seen.
> +*)
> +
> +@findex StringToLongreal
> +PROCEDURE StringToLongreal (s: String; VAR found: BOOLEAN) : LONGREAL ;
> +
> +
> +(*
> +   LongrealToString - converts a LONGREAL number, Real, which has,
> +                      TotalWidth, and FractionWidth into a string.
> +
> +                      So for example:
> +
> +                      LongrealToString(1.0, 4, 2)  -> '1.00'
> +                      LongrealToString(12.3, 5, 2) -> '12.30'
> +                      LongrealToString(12.3, 6, 2) -> ' 12.30'
> +                      LongrealToString(12.3, 6, 3) -> '12.300'
> +
> +                      if total width is too small then the fraction
> +                      becomes truncated.
> +
> +                      LongrealToString(12.3, 5, 3) -> '12.30'
> +
> +                      If TotalWidth is 0 then the function
> +                      will return the value of x which is converted
> +                      into as a fixed point number with exhaustive
> +                      precision.
> +*)
> +
> +@findex LongrealToString
> +PROCEDURE LongrealToString (x: LONGREAL;
> +                            TotalWidth, FractionWidth: CARDINAL) : String ;
> +
> +
> +(*
> +   stor - returns a REAL given a string.
> +*)
> +
> +@findex stor
> +PROCEDURE stor (s: String) : REAL ;
> +
> +
> +(*
> +   stolr - returns a LONGREAL given a string.
> +*)
> +
> +@findex stolr
> +PROCEDURE stolr (s: String) : LONGREAL ;
> +
> +
> +(*
> +   ToSigFig - returns a floating point or base 10 integer
> +              string which is accurate to, n, significant
> +              figures.  It will return a new String
> +              and, s, will be destroyed.
> +
> +
> +              So:  12.345
> +
> +              rounded to the following significant figures yields
> +
> +              5      12.345
> +              4      12.34
> +              3      12.3
> +              2      12
> +              1      10
> +*)
> +
> +@findex ToSigFig
> +PROCEDURE ToSigFig (s: String; n: CARDINAL) : String ;
> +
> +
> +(*
> +   ToDecimalPlaces - returns a floating point or base 10 integer
> +                     string which is accurate to, n, decimal
> +                     places.  It will return a new String
> +                     and, s, will be destroyed.
> +                     Decimal places yields, n, digits after
> +                     the .
> +
> +                     So:  12.345
> +
> +                     rounded to the following decimal places yields
> +
> +                     5      12.34500
> +                     4      12.3450
> +                     3      12.345
> +                     2      12.34
> +                     1      12.3
> +*)
> +
> +@findex ToDecimalPlaces
> +PROCEDURE ToDecimalPlaces (s: String; n: CARDINAL) : String ;
> +
> +
> +END StringConvert.
> +@end example
> +@page
> +
> +@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringConvert, Base libraries
> +@subsection gm2-libs/SysExceptions
> +
> +@example
> +DEFINITION MODULE SysExceptions ;
> +
> +(* Provides a mechanism for the underlying libraries to
> +   configure the exception routines.  This mechanism
> +   is used by both the ISO and PIM libraries.
> +   It is written to be ISO compliant and this also
> +   allows for mixed dialect projects.  *)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex PROCEXCEPTION (type)
> +   PROCEXCEPTION = PROCEDURE (ADDRESS) ;
> +
> +@findex InitExceptionHandlers
> +PROCEDURE InitExceptionHandlers (indexf, range, casef, invalidloc,
> +                                 function, wholevalue, wholediv,
> +                                 realvalue, realdiv, complexvalue,
> +                                 complexdiv, protection, systemf,
> +                                 coroutine, exception: PROCEXCEPTION) ;
> +
> +
> +END SysExceptions.
> +@end example
> +@page
> +
> +@node gm2-libs/SysStorage, gm2-libs/TimeString, gm2-libs/SysExceptions, Base libraries
> +@subsection gm2-libs/SysStorage
> +
> +@example
> +DEFINITION MODULE SysStorage ;
> +
> +(*  Provides dynamic allocation for the system components.
> +    This allows the application to use the traditional Storage module
> +    which can be handled differently.  *)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT QUALIFIED ALLOCATE, DEALLOCATE, REALLOCATE, Available, Init ;
> +
> +
> +(*
> +   ALLOCATE - attempt to allocate memory from the heap.
> +              NIL is returned in, a, if ALLOCATE fails.
> +*)
> +
> +@findex ALLOCATE
> +PROCEDURE ALLOCATE (VAR a: ADDRESS ; size: CARDINAL) ;
> +
> +
> +(*
> +   DEALLOCATE - return, size, bytes to the heap.
> +                The variable, a, is set to NIL.
> +*)
> +
> +@findex DEALLOCATE
> +PROCEDURE DEALLOCATE (VAR a: ADDRESS ; size: CARDINAL) ;
> +
> +
> +(*
> +   REALLOCATE - attempts to reallocate storage. The address,
> +                a, should either be NIL in which case ALLOCATE
> +                is called, or alternatively it should have already
> +                been initialized by ALLOCATE. The allocated storage
> +                is resized accordingly.
> +*)
> +
> +@findex REALLOCATE
> +PROCEDURE REALLOCATE (VAR a: ADDRESS; size: CARDINAL) ;
> +
> +
> +(*
> +   Available - returns TRUE if, size, bytes can be allocated.
> +*)
> +
> +@findex Available
> +PROCEDURE Available (size: CARDINAL) : BOOLEAN;
> +
> +
> +(*
> +   Init - initializes the heap.
> +          This does nothing on a GNU/Linux system.
> +          But it remains here since it might be used in an
> +          embedded system.
> +*)
> +
> +@findex Init
> +PROCEDURE Init ;
> +
> +
> +END SysStorage.
> +@end example
> +@page
> +
> +@node gm2-libs/TimeString, gm2-libs/UnixArgs, gm2-libs/SysStorage, Base libraries
> +@subsection gm2-libs/TimeString
> +
> +@example
> +DEFINITION MODULE TimeString ;
> +
> +EXPORT QUALIFIED GetTimeString ;
> +
> +
> +(*
> +   GetTimeString - places the time in ascii format into array, a.
> +
> +*)
> +
> +@findex GetTimeString
> +PROCEDURE GetTimeString (VAR a: ARRAY OF CHAR) ;
> +
> +
> +END TimeString.
> +@end example
> +@page
> +
> +@node gm2-libs/UnixArgs, gm2-libs/cbuiltin, gm2-libs/TimeString, Base libraries
> +@subsection gm2-libs/UnixArgs
> +
> +@example
> +DEFINITION MODULE UnixArgs ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +EXPORT QUALIFIED GetArgC, GetArgV, GetEnvV ;
> +
> +@findex GetArgC
> +PROCEDURE GetArgC () : INTEGER ;
> +@findex GetArgV
> +PROCEDURE GetArgV () : ADDRESS ;
> +@findex GetEnvV
> +PROCEDURE GetEnvV () : ADDRESS ;
> +
> +
> +END UnixArgs.
> +@end example
> +@page
> +
> +@node gm2-libs/cbuiltin, gm2-libs/cgetopt, gm2-libs/UnixArgs, Base libraries
> +@subsection gm2-libs/cbuiltin
> +
> +@example
> +DEFINITION MODULE FOR "C" cbuiltin ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT UNQUALIFIED alloca, memcpy,
> +                  isfinite, isfinitef, isfinitel,
> +                  isinf_sign, isinf_signf, isinf_signl,
> +                   sinf, sinl, sin,
> +                   cosf, cosl, cos,
> +                   atan2f, atan2l, atan2,
> +                   sqrtf, sqrtl, sqrt,
> +                   fabsf, fabsl, fabs,
> +                   logf, logl, log,
> +                   expf, expl, exp,
> +                   log10f, log10l, log10,
> +                   exp10f, exp10l, exp10,
> +                   ilogbf, ilogbl, ilogb,
> +                   significand, significandf, significandl,
> +                   modf, modff, modfl,
> +                   nextafter, nextafterf, nextafterl,
> +                   nexttoward, nexttowardf, nexttowardl,
> +                   scalb, scalbf, scalbl,
> +                   scalbn, scalbnf, scalbnl,
> +                   scalbln, scalblnf, scalblnl,
> +
> +                   cabsf, cabsl, cabs,
> +                   cargf, carg, cargl,
> +                   conjf, conj, conjl,
> +                   cpowf, cpow, cpowl,
> +                   csqrtf, csqrt, csqrtl,
> +                   cexpf, cexp, cexpl,
> +                   clogf, clog, clogl,
> +                   csinf, csin, csinl,
> +                   ccosf, ccos, ccosl,
> +                   ctanf, ctan, ctanl,
> +                   casinf, casin, casinl,
> +                   cacosf, cacos, cacosl,
> +                   catanf, catan, catanl,
> +
> +                   index, rindex,
> +                   memcmp, memset, memmove,
> +                   strcat, strncat, strcpy, strncpy, strcmp, strncmp,
> +                   strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr ;
> +
> +@findex alloca
> +PROCEDURE alloca (i: CARDINAL) : ADDRESS ;
> +@findex memcpy
> +PROCEDURE memcpy (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
> +@findex isfinite
> +PROCEDURE isfinite (x: REAL) : BOOLEAN ;
> +@findex isfinitel
> +PROCEDURE isfinitel (x: LONGREAL) : BOOLEAN ;
> +@findex isfinitef
> +PROCEDURE isfinitef (x: SHORTREAL) : BOOLEAN ;
> +@findex isinf_sign
> +PROCEDURE isinf_sign (x: REAL) : BOOLEAN ;
> +@findex isinf_signl
> +PROCEDURE isinf_signl (x: LONGREAL) : BOOLEAN ;
> +@findex isinf_signf
> +PROCEDURE isinf_signf (x: SHORTREAL) : BOOLEAN ;
> +@findex sinf
> +PROCEDURE sinf (x: SHORTREAL) : SHORTREAL ;
> +@findex sin
> +PROCEDURE sin (x: REAL) : REAL ;
> +@findex sinl
> +PROCEDURE sinl (x: LONGREAL) : LONGREAL ;
> +@findex cosf
> +PROCEDURE cosf (x: SHORTREAL) : SHORTREAL ;
> +@findex cos
> +PROCEDURE cos (x: REAL) : REAL ;
> +@findex cosl
> +PROCEDURE cosl (x: LONGREAL) : LONGREAL ;
> +@findex atan2f
> +PROCEDURE atan2f (x, y: SHORTREAL) : SHORTREAL ;
> +@findex atan2
> +PROCEDURE atan2 (x, y: REAL) : REAL ;
> +@findex atan2l
> +PROCEDURE atan2l (x, y: LONGREAL) : LONGREAL ;
> +@findex sqrtf
> +PROCEDURE sqrtf (x: SHORTREAL) : SHORTREAL ;
> +@findex sqrt
> +PROCEDURE sqrt (x: REAL) : REAL ;
> +@findex sqrtl
> +PROCEDURE sqrtl (x: LONGREAL) : LONGREAL ;
> +@findex fabsf
> +PROCEDURE fabsf (x: SHORTREAL) : SHORTREAL ;
> +@findex fabs
> +PROCEDURE fabs (x: REAL) : REAL ;
> +@findex fabsl
> +PROCEDURE fabsl (x: LONGREAL) : LONGREAL ;
> +@findex logf
> +PROCEDURE logf (x: SHORTREAL) : SHORTREAL ;
> +@findex log
> +PROCEDURE log (x: REAL) : REAL ;
> +@findex logl
> +PROCEDURE logl (x: LONGREAL) : LONGREAL ;
> +@findex expf
> +PROCEDURE expf (x: SHORTREAL) : SHORTREAL ;
> +@findex exp
> +PROCEDURE exp (x: REAL) : REAL ;
> +@findex expl
> +PROCEDURE expl (x: LONGREAL) : LONGREAL ;
> +@findex log10f
> +PROCEDURE log10f (x: SHORTREAL) : SHORTREAL ;
> +@findex log10
> +PROCEDURE log10 (x: REAL) : REAL ;
> +@findex log10l
> +PROCEDURE log10l (x: LONGREAL) : LONGREAL ;
> +@findex exp10f
> +PROCEDURE exp10f (x: SHORTREAL) : SHORTREAL ;
> +@findex exp10
> +PROCEDURE exp10 (x: REAL) : REAL ;
> +@findex exp10l
> +PROCEDURE exp10l (x: LONGREAL) : LONGREAL ;
> +@findex ilogbf
> +PROCEDURE ilogbf (x: SHORTREAL) : INTEGER ;
> +@findex ilogb
> +PROCEDURE ilogb (x: REAL) : INTEGER ;
> +@findex ilogbl
> +PROCEDURE ilogbl (x: LONGREAL) : INTEGER ;
> +
> +@findex significand
> +PROCEDURE significand (r: REAL) : REAL ;
> +@findex significandf
> +PROCEDURE significandf (s: SHORTREAL) : SHORTREAL ;
> +@findex significandl
> +PROCEDURE significandl (l: LONGREAL) : LONGREAL ;
> +
> +@findex modf
> +PROCEDURE modf (x: REAL; VAR y: REAL) : REAL ;
> +@findex modff
> +PROCEDURE modff (x: SHORTREAL; VAR y: SHORTREAL) : SHORTREAL ;
> +@findex modfl
> +PROCEDURE modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
> +
> +@findex nextafter
> +PROCEDURE nextafter (x, y: REAL) : REAL ;
> +@findex nextafterf
> +PROCEDURE nextafterf (x, y: SHORTREAL) : SHORTREAL ;
> +@findex nextafterl
> +PROCEDURE nextafterl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex nexttoward
> +PROCEDURE nexttoward (x, y: REAL) : REAL ;
> +@findex nexttowardf
> +PROCEDURE nexttowardf (x, y: SHORTREAL) : SHORTREAL ;
> +@findex nexttowardl
> +PROCEDURE nexttowardl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex scalb
> +PROCEDURE scalb (x, n: REAL) : REAL ;
> +@findex scalbf
> +PROCEDURE scalbf (x, n: SHORTREAL) : SHORTREAL ;
> +@findex scalbl
> +PROCEDURE scalbl (x, n: LONGREAL) : LONGREAL ;
> +
> +@findex scalbn
> +PROCEDURE scalbn (x: REAL; n: INTEGER) : REAL ;
> +@findex scalbnf
> +PROCEDURE scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
> +@findex scalbnl
> +PROCEDURE scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
> +
> +@findex scalbln
> +PROCEDURE scalbln (x: REAL; n: LONGINT) : REAL ;
> +@findex scalblnf
> +PROCEDURE scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
> +@findex scalblnl
> +PROCEDURE scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
> +
> +@findex cabsf
> +PROCEDURE cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex cabs
> +PROCEDURE cabs (z: COMPLEX) : REAL ;
> +@findex cabsl
> +PROCEDURE cabsl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex cargf
> +PROCEDURE cargf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex carg
> +PROCEDURE carg (z: COMPLEX) : REAL ;
> +@findex cargl
> +PROCEDURE cargl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex conjf
> +PROCEDURE conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex conj
> +PROCEDURE conj (z: COMPLEX) : COMPLEX ;
> +@findex conjl
> +PROCEDURE conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cpowf
> +PROCEDURE cpowf (base: SHORTCOMPLEX; exp: SHORTREAL) : SHORTCOMPLEX ;
> +@findex cpow
> +PROCEDURE cpow (base: COMPLEX; exp: REAL) : COMPLEX ;
> +@findex cpowl
> +PROCEDURE cpowl (base: LONGCOMPLEX; exp: LONGREAL) : LONGCOMPLEX ;
> +
> +@findex csqrtf
> +PROCEDURE csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csqrt
> +PROCEDURE csqrt (z: COMPLEX) : COMPLEX ;
> +@findex csqrtl
> +PROCEDURE csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cexpf
> +PROCEDURE cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cexp
> +PROCEDURE cexp (z: COMPLEX) : COMPLEX ;
> +@findex cexpl
> +PROCEDURE cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex clogf
> +PROCEDURE clogf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex clog
> +PROCEDURE clog (z: COMPLEX) : COMPLEX ;
> +@findex clogl
> +PROCEDURE clogl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex csinf
> +PROCEDURE csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csin
> +PROCEDURE csin (z: COMPLEX) : COMPLEX ;
> +@findex csinl
> +PROCEDURE csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ccosf
> +PROCEDURE ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ccos
> +PROCEDURE ccos (z: COMPLEX) : COMPLEX ;
> +@findex ccosl
> +PROCEDURE ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ctanf
> +PROCEDURE ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ctan
> +PROCEDURE ctan (z: COMPLEX) : COMPLEX ;
> +@findex ctanl
> +PROCEDURE ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex casinf
> +PROCEDURE casinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex casin
> +PROCEDURE casin (z: COMPLEX) : COMPLEX ;
> +@findex casinl
> +PROCEDURE casinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cacosf
> +PROCEDURE cacosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cacos
> +PROCEDURE cacos (z: COMPLEX) : COMPLEX ;
> +@findex cacosl
> +PROCEDURE cacosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex catanf
> +PROCEDURE catanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex catan
> +PROCEDURE catan (z: COMPLEX) : COMPLEX ;
> +@findex catanl
> +PROCEDURE catanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex index
> +PROCEDURE index (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex rindex
> +PROCEDURE rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex memcmp
> +PROCEDURE memcmp (s1, s2: ADDRESS; n: CARDINAL) : INTEGER ;
> +@findex memmove
> +PROCEDURE memmove (s1, s2: ADDRESS; n: CARDINAL) : ADDRESS ;
> +@findex memset
> +PROCEDURE memset (s: ADDRESS; c: INTEGER; n: CARDINAL) : ADDRESS ;
> +@findex strcat
> +PROCEDURE strcat (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncat
> +PROCEDURE strncat (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
> +@findex strcpy
> +PROCEDURE strcpy (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncpy
> +PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
> +@findex strcmp
> +PROCEDURE strcmp (s1, s2: ADDRESS) : INTEGER ;
> +@findex strncmp
> +PROCEDURE strncmp (s1, s2: ADDRESS; n: CARDINAL) : INTEGER ;
> +@findex strlen
> +PROCEDURE strlen (s: ADDRESS) : INTEGER ;
> +@findex strstr
> +PROCEDURE strstr (haystack, needle: ADDRESS) : ADDRESS ;
> +@findex strpbrk
> +PROCEDURE strpbrk (s, accept: ADDRESS) : ADDRESS ;
> +@findex strspn
> +PROCEDURE strspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strcspn
> +PROCEDURE strcspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strchr
> +PROCEDURE strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex strrchr
> +PROCEDURE strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +
> +END cbuiltin.
> +@end example
> +@page
> +
> +@node gm2-libs/cgetopt, gm2-libs/cxxabi, gm2-libs/cbuiltin, Base libraries
> +@subsection gm2-libs/cgetopt
> +
> +@example
> +DEFINITION MODULE cgetopt ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +TYPE
> +@findex Options (type)
> +   Options = ADDRESS ;
> +
> +VAR
> +@findex optarg (var)
> +   optarg                : ADDRESS ;
> +@findex optind (var)
> +@findex opterr (var)
> +@findex optopt (var)
> +   optind, opterr, optopt: INTEGER ;
> +
> +
> +(*
> +   getopt - the getopt() function parses the command-line arguments.
> +            Its arguments argc and argv are the argument count and array as
> +            passed to the main() function on program invocation.  An element of
> +            argv that starts with '-' (and is not exactly "-" or "--") is an
> +            option element.  The characters of this element (aside from the
> +            initial '-') are option characters.  If getopt() is called
> +            repeatedly, it returns successively each of the option characters
> +            from each of the option elements.
> +*)
> +
> +@findex getopt
> +PROCEDURE getopt (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS) : CHAR ;
> +
> +
> +(*
> +   getopt_long - works like getopt() except that it also accepts long options,
> +                 started with two dashes.  (If the program accepts only long
> +                 options, then optstring should be specified as an empty string (""),
> +                 not NULL.)  Long option names may be abbreviated if the abbreviation
> +                 is unique or is an exact match for some defined option.  A
> +                 long option may take a parameter, of the form --arg=param or
> +                 --arg param.
> +*)
> +
> +@findex getopt_long
> +PROCEDURE getopt_long (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
> +                       longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   getopt_long_only - a wrapper for the C getopt_long_only.
> +*)
> +
> +@findex getopt_long_only
> +PROCEDURE getopt_long_only (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
> +                            longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   InitOptions - constructor for empty Options.
> +*)
> +
> +@findex InitOptions
> +PROCEDURE InitOptions () : Options ;
> +
> +
> +(*
> +   KillOptions - deconstructor for empty Options.
> +*)
> +
> +@findex KillOptions
> +PROCEDURE KillOptions (o: Options) : Options ;
> +
> +
> +(*
> +   SetOption - set option[index] with @{name, has_arg, flag, val@}.
> +*)
> +
> +@findex SetOption
> +PROCEDURE SetOption (o: Options; index: CARDINAL;
> +                     name: ADDRESS; has_arg: BOOLEAN;
> +                     VAR flag: INTEGER; val: INTEGER) ;
> +
> +
> +(*
> +   GetLongOptionArray - return a pointer to the C array containing all
> +                        long options.
> +*)
> +
> +@findex GetLongOptionArray
> +PROCEDURE GetLongOptionArray (o: Options) : ADDRESS ;
> +
> +
> +END cgetopt.
> +@end example
> +@page
> +
> +@node gm2-libs/cxxabi, gm2-libs/dtoa, gm2-libs/cgetopt, Base libraries
> +@subsection gm2-libs/cxxabi
> +
> +@example
> +DEFINITION MODULE FOR "C" cxxabi ;
> +
> +(* This should only be used by the compiler and it matches the
> +    g++ implementation.  *)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT UNQUALIFIED __cxa_begin_catch, __cxa_end_catch, __cxa_rethrow ;
> +
> +
> +@findex __cxa_begin_catch
> +PROCEDURE __cxa_begin_catch (a: ADDRESS) : ADDRESS ;
> +@findex __cxa_end_catch
> +PROCEDURE __cxa_end_catch ;
> +@findex __cxa_rethrow
> +PROCEDURE __cxa_rethrow ;
> +
> +
> +END cxxabi.
> +@end example
> +@page
> +
> +@node gm2-libs/dtoa, gm2-libs/errno, gm2-libs/cxxabi, Base libraries
> +@subsection gm2-libs/dtoa
> +
> +@example
> +DEFINITION MODULE dtoa ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex Mode (type)
> +   Mode = (maxsignificant, decimaldigits) ;
> +
> +
> +(*
> +   strtod - returns a REAL given a string, s.  It will set
> +            error to TRUE if the number is too large.
> +*)
> +
> +@findex strtod
> +PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ;
> +
> +
> +(*
> +   dtoa - converts a REAL, d, into a string.  The address of the
> +          string is returned.
> +          mode       indicates the type of conversion required.
> +          ndigits    determines the number of digits according to mode.
> +          decpt      the position of the decimal point.
> +          sign       does the string have a sign?
> +*)
> +
> +@findex dtoa
> +PROCEDURE dtoa (d        : REAL;
> +                mode     : Mode;
> +                ndigits  : INTEGER;
> +               VAR decpt: INTEGER;
> +               VAR sign : BOOLEAN) : ADDRESS ;
> +
> +
> +END dtoa.
> +@end example
> +@page
> +
> +@node gm2-libs/errno, gm2-libs/gdbif, gm2-libs/dtoa, Base libraries
> +@subsection gm2-libs/errno
> +
> +@example
> +DEFINITION MODULE errno ;
> +
> +CONST
> +    EINTR  =  4 ;   (* system call interrupted *)
> +    ERANGE = 34 ;   (* result is too large     *)
> +    EAGAIN = 11 ;   (* retry the system call   *)
> +
> +@findex geterrno
> +PROCEDURE geterrno () : INTEGER ;
> +
> +
> +END errno.
> +@end example
> +@page
> +
> +@node gm2-libs/gdbif, gm2-libs/ldtoa, gm2-libs/errno, Base libraries
> +@subsection gm2-libs/gdbif
> +
> +@example
> +DEFINITION MODULE gdbif ;
> +
> +(*  Provides interactive connectivity with gdb useful for debugging
> +    Modula-2 shared libraries.  *)
> +
> +EXPORT UNQUALIFIED sleepSpin, finishSpin, connectSpin ;
> +
> +
> +(*
> +   finishSpin - sets boolean mustWait to FALSE.
> +*)
> +
> +@findex finishSpin
> +PROCEDURE finishSpin ;
> +
> +
> +(*
> +   sleepSpin - waits for the boolean variable mustWait to become FALSE.
> +               It sleeps for a second between each test of the variable.
> +*)
> +
> +@findex sleepSpin
> +PROCEDURE sleepSpin ;
> +
> +
> +(*
> +   connectSpin - breakpoint placeholder.  Its only purpose is to allow users
> +                 to set a breakpoint.  This procedure is called once
> +                 sleepSpin is released from its spin (via a call from
> +                 finishSpin).
> +*)
> +
> +@findex connectSpin
> +PROCEDURE connectSpin ;
> +
> +
> +END gdbif.
> +@end example
> +@page
> +
> +@node gm2-libs/ldtoa, gm2-libs/libc, gm2-libs/gdbif, Base libraries
> +@subsection gm2-libs/ldtoa
> +
> +@example
> +DEFINITION MODULE ldtoa ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex Mode (type)
> +   Mode = (maxsignificant, decimaldigits) ;
> +
> +
> +(*
> +   strtold - returns a LONGREAL given a C string, s.  It will set
> +             error to TRUE if the number is too large or badly formed.
> +*)
> +
> +@findex strtold
> +PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ;
> +
> +
> +(*
> +   ldtoa - converts a LONGREAL, d, into a string.  The address of the
> +           string is returned.
> +           mode       indicates the type of conversion required.
> +           ndigits    determines the number of digits according to mode.
> +           decpt      the position of the decimal point.
> +           sign       does the string have a sign?
> +*)
> +
> +@findex ldtoa
> +PROCEDURE ldtoa (d        : LONGREAL;
> +                 mode     : Mode;
> +                 ndigits  : INTEGER;
> +                 VAR decpt: INTEGER;
> +                 VAR sign : BOOLEAN) : ADDRESS ;
> +
> +
> +END ldtoa.
> +@end example
> +@page
> +
> +@node gm2-libs/libc, gm2-libs/libm, gm2-libs/ldtoa, Base libraries
> +@subsection gm2-libs/libc
> +
> +@example
> +DEFINITION MODULE FOR "C" libc ;
> +
> +FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T ;
> +
> +EXPORT UNQUALIFIED time_t, timeb, tm, ptrToTM,
> +                   write, read,
> +                   system, abort,
> +                   malloc, free,
> +                   exit, isatty,
> +                   getenv, putenv, getpid,
> +                   dup, close, open, lseek,
> +                   readv, writev,
> +                   perror, creat,
> +                   getcwd, chown, strlen, strcpy, strncpy,
> +                   unlink, setenv,
> +                   memcpy, memset, memmove, printf, realloc,
> +                   rand, srand,
> +                   time, localtime, ftime,
> +                   shutdown, rename, setjmp, longjmp, atexit,
> +                   ttyname, sleep, execv ;
> +
> +
> +TYPE
> +@findex time_t (type)
> +   time_t = LONGINT ;
> +
> +@findex ptrToTM (type)
> +   ptrToTM = POINTER TO tm ;
> +@findex tm (type)
> +   tm = RECORD
> +           tm_sec: INTEGER ;     (* Seconds.     [0-60] (1 leap second) *)
> +           tm_min: INTEGER ;     (* Minutes.     [0-59]   *)
> +           tm_hour: INTEGER ;    (* Hours.       [0-23]   *)
> +           tm_mday: INTEGER ;    (* Day.         [1-31]   *)
> +           tm_mon: INTEGER ;     (* Month.       [0-11]   *)
> +           tm_year: INTEGER ;    (* Year - 1900.          *)
> +           tm_wday: INTEGER ;    (* Day of week. [0-6]    *)
> +           tm_yday: INTEGER ;    (* Days in year.[0-365]  *)
> +           tm_isdst: INTEGER ;   (* DST.         [-1/0/1] *)
> +           tm_gmtoff: LONGINT ;  (* Seconds east of UTC.  *)
> +           tm_zone: ADDRESS ;    (* char * zone name      *)
> +@findex END (type)
> +        END ;
> +
> +@findex timeb (type)
> +   timeb = RECORD
> +              time    : time_t ;
> +              millitm : SHORTCARD ;
> +              timezone: SHORTCARD ;
> +              dstflag : SHORTCARD ;
> +@findex END (type)
> +           END ;
> +
> +@findex exitP (type)
> +   exitP = PROCEDURE () : INTEGER ;
> +
> +
> +(*
> +     ssize_t write (int d, void *buf, size_t nbytes)
> +*)
> +
> +@findex write
> +PROCEDURE write (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
> +
> +
> +(*
> +     ssize_t read (int d, void *buf, size_t nbytes)
> +*)
> +
> +@findex read
> +PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
> +
> +
> +(*
> +     int system(string)
> +     char *string;
> +*)
> +
> +@findex system
> +PROCEDURE system (a: ADDRESS) : [ INTEGER ] ;
> +
> +
> +(*
> +     abort - generate a fault
> +
> +     abort() first closes all open files if possible, then sends
> +     an IOT signal to the process.  This signal usually results
> +     in termination with a core dump, which may be used for
> +     debugging.
> +
> +     It is possible for abort() to return control if is caught or
> +     ignored, in which case the value returned is that of the
> +     kill(2V) system call.
> +*)
> +
> +@findex abort
> +PROCEDURE abort <* noreturn *> ;
> +
> +
> +(*
> +     malloc - memory allocator.
> +
> +     void *malloc(size_t size);
> +
> +     malloc() returns a pointer to a block of at least size
> +     bytes, which is appropriately aligned.  If size is zero,
> +     malloc() returns a non-NULL pointer, but this pointer should
> +     not be dereferenced.
> +*)
> +
> +@findex malloc
> +PROCEDURE malloc (size: CSIZE_T) : ADDRESS ;
> +
> +
> +(*
> +     free - memory deallocator.
> +
> +     free (void *ptr);
> +
> +     free() releases a previously allocated block.  Its argument
> +     is a pointer to a block previously allocated by malloc,
> +     calloc, realloc, malloc, or memalign.
> +*)
> +
> +@findex free
> +PROCEDURE free (ptr: ADDRESS) ;
> +
> +
> +(*
> +     void *realloc (void *ptr, size_t size);
> +
> +     realloc changes the size of the memory block pointed to
> +     by ptr to size bytes. The contents will be  unchanged  to
> +     the minimum of the old and new sizes; newly allocated memory
> +     will be uninitialized. If ptr is NIL, the call is
> +     equivalent  to malloc(size); if size is equal to zero, the
> +     call is equivalent to free(ptr). Unless ptr is NIL, it
> +     must have been returned by an earlier call to malloc(),
> +     realloc.
> +*)
> +
> +@findex realloc
> +PROCEDURE realloc (ptr: ADDRESS; size: CSIZE_T) : ADDRESS ;
> +
> +
> +(*
> +   isatty - does this descriptor refer to a terminal.
> +*)
> +
> +@findex isatty
> +PROCEDURE isatty (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   exit - returns control to the invoking process. Result, r, is
> +          returned.
> +*)
> +
> +@findex exit
> +PROCEDURE exit (r: INTEGER) <* noreturn *> ;
> +
> +
> +(*
> +   getenv - returns the C string for the equivalent C environment
> +            variable.
> +*)
> +
> +@findex getenv
> +PROCEDURE getenv (s: ADDRESS) : ADDRESS ;
> +
> +
> +(*
> +   putenv - change or add an environment variable.
> +*)
> +
> +@findex putenv
> +PROCEDURE putenv (s: ADDRESS) : INTEGER ;
> +
> +
> +(*
> +   getpid - returns the UNIX process identification number.
> +*)
> +
> +@findex getpid
> +PROCEDURE getpid () : INTEGER ;
> +
> +
> +(*
> +   dup - duplicates the file descriptor, d.
> +*)
> +
> +@findex dup
> +PROCEDURE dup (d: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   close - closes the file descriptor, d.
> +*)
> +
> +@findex close
> +PROCEDURE close (d: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   open - open the file, filename with flag and mode.
> +*)
> +
> +@findex open
> +PROCEDURE open (filename: ADDRESS; oflag: INTEGER; ...) : INTEGER ;
> +
> +
> +(*
> +   creat - creates a new file
> +*)
> +
> +@findex creat
> +PROCEDURE creat (filename: ADDRESS; mode: CARDINAL) : INTEGER;
> +
> +
> +(*
> +   lseek - calls unix lseek:
> +
> +           off_t lseek(int fildes, off_t offset, int whence);
> +*)
> +
> +@findex lseek
> +PROCEDURE lseek (fd: INTEGER; offset: LONGINT; whence: INTEGER) : LONGINT ;
> +
> +
> +(*
> +   perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).
> +*)
> +
> +@findex perror
> +PROCEDURE perror (string: ARRAY OF CHAR);
> +
> +
> +(*
> +   readv - reads an io vector of bytes.
> +*)
> +
> +@findex readv
> +PROCEDURE readv (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   writev - writes an io vector of bytes.
> +*)
> +
> +@findex writev
> +PROCEDURE writev (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   getcwd - copies the absolute pathname of the
> +            current working directory to the array pointed to by buf,
> +            which is of length size.
> +
> +            If the current absolute path name would require a buffer
> +            longer than size elements, NULL is returned, and errno is
> +            set to ERANGE; an application should check for this error,
> +            and allocate a larger buffer if necessary.
> +*)
> +
> +@findex getcwd
> +PROCEDURE getcwd (buf: ADDRESS; size: CSIZE_T) : ADDRESS ;
> +
> +
> +(*
> +   chown - The  owner  of  the  file  specified  by  path or by fd is
> +           changed.  Only the super-user may change the  owner  of  a
> +           file.   The  owner  of  a file may change the group of the
> +           file to any group of which that owner is  a  member.   The
> +           super-user may change the group arbitrarily.
> +
> +           If  the owner or group is specified as -1, then that ID is
> +           not changed.
> +
> +           On success, zero is returned.  On error, -1  is  returned,
> +           and errno is set appropriately.
> +*)
> +
> +@findex chown
> +PROCEDURE chown (filename: ADDRESS; uid, gid: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   strlen - returns the length of string, a.
> +*)
> +
> +@findex strlen
> +PROCEDURE strlen (a: ADDRESS) : CSIZE_T ;
> +
> +
> +(*
> +   strcpy - copies string, src, into, dest.
> +            It returns dest.
> +*)
> +
> +@findex strcpy
> +PROCEDURE strcpy (dest, src: ADDRESS) : [ ADDRESS ] ;
> +
> +
> +(*
> +   strncpy - copies string, src, into, dest, copying at most, n, bytes.
> +             It returns dest.
> +*)
> +
> +@findex strncpy
> +PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : [ ADDRESS ] ;
> +
> +
> +(*
> +   unlink - removes file and returns 0 if successful.
> +*)
> +
> +@findex unlink
> +PROCEDURE unlink (file: ADDRESS) : [ INTEGER ] ;
> +
> +
> +(*
> +   memcpy - copy memory area
> +
> +   SYNOPSIS
> +
> +   #include <string.h>
> +
> +   void *memcpy(void *dest, const void *src, size_t n);
> +   It returns dest.
> +*)
> +
> +@findex memcpy
> +PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
> +
> +
> +(*
> +   memset - fill memory with a constant byte
> +
> +   SYNOPSIS
> +
> +   #include <string.h>
> +
> +   void *memset(void *s, int c, size_t n);
> +   It returns s.
> +*)
> +
> +@findex memset
> +PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : [ ADDRESS ] ;
> +
> +
> +(*
> +   memmove - copy memory areas which may overlap
> +
> +   SYNOPSIS
> +
> +   #include <string.h>
> +
> +   void *memmove(void *dest, const void *src, size_t n);
> +   It returns dest.
> +*)
> +
> +@findex memmove
> +PROCEDURE memmove (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
> +
> +
> +(*
> +   int printf(const char *format, ...);
> +*)
> +
> +@findex printf
> +PROCEDURE printf (format: ARRAY OF CHAR; ...) : [ INTEGER ] ;
> +
> +
> +(*
> +   setenv - sets environment variable, name, to value.
> +            It will overwrite an existing value if, overwrite,
> +            is true.  It returns 0 on success and -1 for an error.
> +*)
> +
> +@findex setenv
> +PROCEDURE setenv (name: ADDRESS; value: ADDRESS; overwrite: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   srand - initialize the random number seed.
> +*)
> +
> +@findex srand
> +PROCEDURE srand (seed: INTEGER) ;
> +
> +
> +(*
> +   rand - return a random integer.
> +*)
> +
> +@findex rand
> +PROCEDURE rand () : INTEGER ;
> +
> +
> +(*
> +   time - returns a pointer to the time_t value. If, a,
> +          is not NIL then the libc value is copied into
> +          memory at address, a.
> +*)
> +
> +@findex time
> +PROCEDURE time (a: ADDRESS) : time_t ;
> +
> +
> +(*
> +   localtime - returns a pointer to the libc copy of the tm
> +               structure.
> +*)
> +
> +@findex localtime
> +PROCEDURE localtime (VAR t: time_t) : ADDRESS ;
> +
> +
> +(*
> +   ftime - return date and time.
> +*)
> +
> +@findex ftime
> +PROCEDURE ftime (VAR t: timeb) : [ INTEGER ] ;
> +
> +
> +(*
> +   shutdown - shutdown a socket, s.
> +              if how = 0, then no more reads are allowed.
> +              if how = 1, then no more writes are allowed.
> +              if how = 2, then mo more reads or writes are allowed.
> +*)
> +
> +@findex shutdown
> +PROCEDURE shutdown (s: INTEGER; how: INTEGER) : [ INTEGER ] ;
> +
> +
> +(*
> +   rename - change the name or location of a file
> +*)
> +
> +@findex rename
> +PROCEDURE rename (oldpath, newpath: ADDRESS) : [ INTEGER ] ;
> +
> +
> +(*
> +   setjmp - returns 0 if returning directly, and non-zero
> +            when returning from longjmp using the saved
> +            context.
> +*)
> +
> +@findex setjmp
> +PROCEDURE setjmp (env: ADDRESS) : INTEGER ;
> +
> +
> +(*
> +   longjmp - restores the environment saved by the last call
> +             of setjmp with the corresponding env argument.
> +             After longjmp is completed, program execution
> +             continues as if the corresponding call of setjmp
> +             had just returned the value val.  The value of
> +             val must not be zero.
> +*)
> +
> +@findex longjmp
> +PROCEDURE longjmp (env: ADDRESS; val: INTEGER) ;
> +
> +
> +(*
> +   atexit - execute, proc, when the function exit is called.
> +*)
> +
> +@findex atexit
> +PROCEDURE atexit (proc: exitP) : [ INTEGER ] ;
> +
> +
> +(*
> +   ttyname - returns a pointer to a string determining the ttyname.
> +*)
> +
> +@findex ttyname
> +PROCEDURE ttyname (filedes: INTEGER) : ADDRESS ;
> +
> +
> +(*
> +   sleep - calling thread sleeps for seconds.
> +*)
> +
> +@findex sleep
> +PROCEDURE sleep (seconds: CARDINAL) : [ CARDINAL ] ;
> +
> +
> +(*
> +   execv - execute a file.
> +*)
> +
> +@findex execv
> +PROCEDURE execv (pathname: ADDRESS; argv: ADDRESS) : [ INTEGER ] ;
> +
> +
> +END libc.
> +@end example
> +@page
> +
> +@node gm2-libs/libm, gm2-libs/sckt, gm2-libs/libc, Base libraries
> +@subsection gm2-libs/libm
> +
> +@example
> +DEFINITION MODULE FOR "C" libm ;
> +
> +(* Users are strongly advised to use MathLib0 or RealMath as calls
> +   to functions within these modules will generate inline code.
> +   This module is used by MathLib0 and RealMath when inline code cannot
> +   be generated.  *)
> +
> +EXPORT UNQUALIFIED sin, sinl, sinf,
> +                   cos, cosl, cosf,
> +                   tan, tanl, tanf,
> +                   sqrt, sqrtl, sqrtf,
> +                   asin, asinl, asinf,
> +                   acos, acosl, acosf,
> +                   atan, atanl, atanf,
> +                   atan2, atan2l, atan2f,
> +                   exp, expl, expf,
> +                   log, logl, logf,
> +                   exp10, exp10l, exp10f,
> +                   pow, powl, powf,
> +                   floor, floorl, floorf,
> +                   ceil, ceill, ceilf ;
> +
> +@findex sin
> +PROCEDURE sin (x: REAL) : REAL ;
> +@findex sinl
> +PROCEDURE sinl (x: LONGREAL) : LONGREAL ;
> +@findex sinf
> +PROCEDURE sinf (x: SHORTREAL) : SHORTREAL ;
> +@findex cos
> +PROCEDURE cos (x: REAL) : REAL ;
> +@findex cosl
> +PROCEDURE cosl (x: LONGREAL) : LONGREAL ;
> +@findex cosf
> +PROCEDURE cosf (x: SHORTREAL) : SHORTREAL ;
> +@findex tan
> +PROCEDURE tan (x: REAL) : REAL ;
> +@findex tanl
> +PROCEDURE tanl (x: LONGREAL) : LONGREAL ;
> +@findex tanf
> +PROCEDURE tanf (x: SHORTREAL) : SHORTREAL ;
> +@findex sqrt
> +PROCEDURE sqrt (x: REAL) : REAL ;
> +@findex sqrtl
> +PROCEDURE sqrtl (x: LONGREAL) : LONGREAL ;
> +@findex sqrtf
> +PROCEDURE sqrtf (x: SHORTREAL) : SHORTREAL ;
> +@findex asin
> +PROCEDURE asin (x: REAL) : REAL ;
> +@findex asinl
> +PROCEDURE asinl (x: LONGREAL) : LONGREAL ;
> +@findex asinf
> +PROCEDURE asinf (x: SHORTREAL) : SHORTREAL ;
> +@findex acos
> +PROCEDURE acos (x: REAL) : REAL ;
> +@findex acosl
> +PROCEDURE acosl (x: LONGREAL) : LONGREAL ;
> +@findex acosf
> +PROCEDURE acosf (x: SHORTREAL) : SHORTREAL ;
> +@findex atan
> +PROCEDURE atan (x: REAL) : REAL ;
> +@findex atanl
> +PROCEDURE atanl (x: LONGREAL) : LONGREAL ;
> +@findex atanf
> +PROCEDURE atanf (x: SHORTREAL) : SHORTREAL ;
> +@findex atan2
> +PROCEDURE atan2 (x, y: REAL) : REAL ;
> +@findex atan2l
> +PROCEDURE atan2l (x, y: LONGREAL) : LONGREAL ;
> +@findex atan2f
> +PROCEDURE atan2f (x, y: SHORTREAL) : SHORTREAL ;
> +@findex exp
> +PROCEDURE exp (x: REAL) : REAL ;
> +@findex expl
> +PROCEDURE expl (x: LONGREAL) : LONGREAL ;
> +@findex expf
> +PROCEDURE expf (x: SHORTREAL) : SHORTREAL ;
> +@findex log
> +PROCEDURE log (x: REAL) : REAL ;
> +@findex logl
> +PROCEDURE logl (x: LONGREAL) : LONGREAL ;
> +@findex logf
> +PROCEDURE logf (x: SHORTREAL) : SHORTREAL ;
> +@findex exp10
> +PROCEDURE exp10 (x: REAL) : REAL ;
> +@findex exp10l
> +PROCEDURE exp10l (x: LONGREAL) : LONGREAL ;
> +@findex exp10f
> +PROCEDURE exp10f (x: SHORTREAL) : SHORTREAL ;
> +@findex pow
> +PROCEDURE pow (x, y: REAL) : REAL ;
> +@findex powl
> +PROCEDURE powl (x, y: LONGREAL) : LONGREAL ;
> +@findex powf
> +PROCEDURE powf (x, y: SHORTREAL) : SHORTREAL ;
> +@findex floor
> +PROCEDURE floor (x: REAL) : REAL ;
> +@findex floorl
> +PROCEDURE floorl (x: LONGREAL) : LONGREAL ;
> +@findex floorf
> +PROCEDURE floorf (x: SHORTREAL) : SHORTREAL ;
> +@findex ceil
> +PROCEDURE ceil (x: REAL) : REAL ;
> +@findex ceill
> +PROCEDURE ceill (x: LONGREAL) : LONGREAL ;
> +@findex ceilf
> +PROCEDURE ceilf (x: SHORTREAL) : SHORTREAL ;
> +
> +END libm.
> +@end example
> +@page
> +
> +@node gm2-libs/sckt, gm2-libs/termios, gm2-libs/libm, Base libraries
> +@subsection gm2-libs/sckt
> +
> +@example
> +DEFINITION MODULE sckt ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +EXPORT UNQUALIFIED tcpServerState,
> +                   tcpServerEstablish, tcpServerEstablishPort,
> +                   tcpServerAccept, getLocalIP,
> +                   tcpServerPortNo, tcpServerIP, tcpServerSocketFd,
> +                   tcpServerClientIP, tcpServerClientPortNo,
> +                   tcpClientState,
> +                   tcpClientSocket, tcpClientSocketIP, tcpClientConnect,
> +                   tcpClientPortNo, tcpClientIP, tcpClientSocketFd ;
> +
> +TYPE
> +@findex tcpServerState (type)
> +   tcpServerState = ADDRESS ;
> +@findex tcpClientState (type)
> +   tcpClientState = ADDRESS ;
> +
> +
> +(*
> +   tcpServerEstablish - returns a tcpState containing the relevant
> +                        information about a socket declared to receive
> +                        tcp connections.
> +*)
> +
> +@findex tcpServerEstablish
> +PROCEDURE tcpServerEstablish () : tcpServerState ;
> +
> +
> +(*
> +   tcpServerEstablishPort - returns a tcpState containing the relevant
> +                            information about a socket declared to receive
> +                            tcp connections.  This method attempts to use
> +                            the port specified by the parameter.
> +*)
> +
> +@findex tcpServerEstablishPort
> +PROCEDURE tcpServerEstablishPort (port: CARDINAL) : tcpServerState ;
> +
> +
> +(*
> +   tcpServerAccept - returns a file descriptor once a client has connected and
> +                     been accepted.
> +*)
> +
> +@findex tcpServerAccept
> +PROCEDURE tcpServerAccept (s: tcpServerState) : INTEGER ;
> +
> +
> +(*
> +   tcpServerPortNo - returns the portNo from structure, s.
> +*)
> +
> +@findex tcpServerPortNo
> +PROCEDURE tcpServerPortNo (s: tcpServerState) : CARDINAL ;
> +
> +
> +(*
> +   tcpSocketFd - returns the sockFd from structure, s.
> +*)
> +
> +@findex tcpServerSocketFd
> +PROCEDURE tcpServerSocketFd (s: tcpServerState) : INTEGER ;
> +
> +
> +(*
> +   getLocalIP - returns the IP address of this machine.
> +*)
> +
> +@findex getLocalIP
> +PROCEDURE getLocalIP (s: tcpServerState) : CARDINAL ;
> +
> +
> +(*
> +   tcpServerIP - returns the IP address from structure, s.
> +*)
> +
> +@findex tcpServerIP
> +PROCEDURE tcpServerIP (s: tcpServerState) : CARDINAL ;
> +
> +
> +(*
> +   tcpServerClientIP - returns the IP address of the client who
> +                       has connected to server, s.
> +*)
> +
> +@findex tcpServerClientIP
> +PROCEDURE tcpServerClientIP (s: tcpServerState) : CARDINAL ;
> +
> +
> +(*
> +   tcpServerClientPortNo - returns the port number of the client who
> +                           has connected to server, s.
> +*)
> +
> +@findex tcpServerClientPortNo
> +PROCEDURE tcpServerClientPortNo (s: tcpServerState) : CARDINAL ;
> +
> +
> +(*
> +   tcpClientSocket - returns a file descriptor (socket) which has
> +                     connected to, serverName:portNo.
> +*)
> +
> +@findex tcpClientSocket
> +PROCEDURE tcpClientSocket (serverName: ADDRESS; portNo: CARDINAL) : tcpClientState ;
> +
> +
> +(*
> +   tcpClientSocketIP - returns a file descriptor (socket) which has
> +                       connected to, ip:portNo.
> +*)
> +
> +@findex tcpClientSocketIP
> +PROCEDURE tcpClientSocketIP (ip: CARDINAL; portNo: CARDINAL) : tcpClientState ;
> +
> +
> +(*
> +   tcpClientConnect - returns the file descriptor associated with, s,
> +                      once a connect has been performed.
> +*)
> +
> +@findex tcpClientConnect
> +PROCEDURE tcpClientConnect (s: tcpClientState) : INTEGER ;
> +
> +
> +(*
> +   tcpClientPortNo - returns the portNo from structure, s.
> +*)
> +
> +@findex tcpClientPortNo
> +PROCEDURE tcpClientPortNo (s: tcpClientState) : INTEGER ;
> +
> +
> +(*
> +   tcpClientSocketFd - returns the sockFd from structure, s.
> +*)
> +
> +@findex tcpClientSocketFd
> +PROCEDURE tcpClientSocketFd (s: tcpClientState) : INTEGER ;
> +
> +
> +(*
> +   tcpClientIP - returns the IP address from structure, s.
> +*)
> +
> +@findex tcpClientIP
> +PROCEDURE tcpClientIP (s: tcpClientState) : CARDINAL ;
> +
> +
> +END sckt.
> +@end example
> +@page
> +
> +@node gm2-libs/termios, gm2-libs/wrapc, gm2-libs/sckt, Base libraries
> +@subsection gm2-libs/termios
> +
> +@example
> +DEFINITION MODULE termios ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex TERMIOS (type)
> +   TERMIOS = ADDRESS ;
> +
> +@findex ControlChar (type)
> +   ControlChar = (vintr, vquit, verase, vkill, veof, vtime, vmin,
> +                  vswtc, vstart, vstop, vsusp, veol, vreprint, vdiscard,
> +                  vwerase, vlnext, veol2) ;
> +
> +@findex Flag (type)
> +   Flag = (
> +           (* input flag bits *)
> +           ignbrk, ibrkint, ignpar, iparmrk, inpck, istrip, inlcr,
> +           igncr, icrnl, iuclc, ixon, ixany, ixoff, imaxbel,
> +           (* output flag bits *)
> +           opost, olcuc, onlcr, ocrnl, onocr, onlret, ofill, ofdel,
> +           onl0, onl1, ocr0, ocr1, ocr2, ocr3,
> +           otab0, otab1, otab2, otab3, obs0, obs1, off0, off1, ovt0, ovt1,
> +           (* baud rate *)
> +           b0, b50, b75, b110, b135, b150, b200, b300, b600, b1200,
> +           b1800, b2400, b4800, b9600, b19200, b38400,
> +           b57600, b115200, b240400, b460800, b500000, b576000,
> +           b921600, b1000000, b1152000, b1500000, b2000000, b2500000,
> +           b3000000, b3500000, b4000000, maxbaud, crtscts,
> +           (* character size *)
> +           cs5, cs6, cs7, cs8, cstopb, cread, parenb, parodd, hupcl, clocal,
> +           (* local flags *)
> +           lisig, licanon, lxcase, lecho, lechoe, lechok, lechonl, lnoflsh,
> +           ltopstop, lechoctl, lechoprt, lechoke, lflusho, lpendin, liexten) ;
> +
> +
> +(*
> +   InitTermios - new data structure.
> +*)
> +
> +@findex InitTermios
> +PROCEDURE InitTermios () : TERMIOS ;
> +
> +
> +(*
> +   KillTermios - delete data structure.
> +*)
> +
> +@findex KillTermios
> +PROCEDURE KillTermios (t: TERMIOS) : TERMIOS ;
> +
> +
> +(*
> +   cfgetospeed - return output baud rate.
> +*)
> +
> +@findex cfgetospeed
> +PROCEDURE cfgetospeed (t: TERMIOS) : INTEGER ;
> +
> +
> +(*
> +   cfgetispeed - return input baud rate.
> +*)
> +
> +@findex cfgetispeed
> +PROCEDURE cfgetispeed (t: TERMIOS) : INTEGER ;
> +
> +
> +(*
> +   cfsetospeed - set output baud rate.
> +*)
> +
> +@findex cfsetospeed
> +PROCEDURE cfsetospeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   cfsetispeed - set input baud rate.
> +*)
> +
> +@findex cfsetispeed
> +PROCEDURE cfsetispeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   cfsetspeed - set input and output baud rate.
> +*)
> +
> +@findex cfsetspeed
> +PROCEDURE cfsetspeed (t: TERMIOS; b: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   tcgetattr - get state of, fd, into, t.
> +*)
> +
> +@findex tcgetattr
> +PROCEDURE tcgetattr (fd: INTEGER; t: TERMIOS) : INTEGER ;
> +
> +
> +(*
> +   The following three functions return the different option values.
> +*)
> +
> +@findex tcsnow
> +PROCEDURE tcsnow () : INTEGER ;   (* alter fd now *)
> +@findex tcsdrain
> +PROCEDURE tcsdrain () : INTEGER ; (* alter when all output has been sent *)
> +@findex tcsflush
> +PROCEDURE tcsflush () : INTEGER ; (* like drain, except discard any pending input *)
> +
> +
> +(*
> +   tcsetattr - set state of, fd, to, t, using option.
> +*)
> +
> +@findex tcsetattr
> +PROCEDURE tcsetattr (fd: INTEGER; option: INTEGER; t: TERMIOS) : INTEGER ;
> +
> +
> +(*
> +   cfmakeraw - sets, t, to raw mode.
> +*)
> +
> +@findex cfmakeraw
> +PROCEDURE cfmakeraw (t: TERMIOS) ;
> +
> +
> +(*
> +   tcsendbreak - send zero bits for duration.
> +*)
> +
> +@findex tcsendbreak
> +PROCEDURE tcsendbreak (fd: INTEGER; duration: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcdrain - waits for pending output to be written on, fd.
> +*)
> +
> +@findex tcdrain
> +PROCEDURE tcdrain (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflushi - flush input.
> +*)
> +
> +@findex tcflushi
> +PROCEDURE tcflushi (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflusho - flush output.
> +*)
> +
> +@findex tcflusho
> +PROCEDURE tcflusho (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflushio - flush input and output.
> +*)
> +
> +@findex tcflushio
> +PROCEDURE tcflushio (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflowoni - restart input on, fd.
> +*)
> +
> +@findex tcflowoni
> +PROCEDURE tcflowoni (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflowoffi - stop input on, fd.
> +*)
> +
> +@findex tcflowoffi
> +PROCEDURE tcflowoffi (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflowono - restart output on, fd.
> +*)
> +
> +@findex tcflowono
> +PROCEDURE tcflowono (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   tcflowoffo - stop output on, fd.
> +*)
> +
> +@findex tcflowoffo
> +PROCEDURE tcflowoffo (fd: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   GetFlag - sets a flag value from, t, in, b, and returns TRUE
> +             if, t, supports, f.
> +*)
> +
> +@findex GetFlag
> +PROCEDURE GetFlag (t: TERMIOS; f: Flag; VAR b: BOOLEAN) : BOOLEAN ;
> +
> +
> +(*
> +   SetFlag - sets a flag value in, t, to, b, and returns TRUE if
> +             this flag value is supported.
> +*)
> +
> +@findex SetFlag
> +PROCEDURE SetFlag (t: TERMIOS; f: Flag; b: BOOLEAN) : BOOLEAN ;
> +
> +
> +(*
> +   GetChar - sets a CHAR, ch, value from, t, and returns TRUE if
> +             this value is supported.
> +*)
> +
> +@findex GetChar
> +PROCEDURE GetChar (t: TERMIOS; c: ControlChar; VAR ch: CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   SetChar - sets a CHAR value in, t, and returns TRUE if, c,
> +             is supported.
> +*)
> +
> +@findex SetChar
> +PROCEDURE SetChar (t: TERMIOS; c: ControlChar; ch: CHAR) : BOOLEAN ;
> +
> +
> +END termios.
> +@end example
> +@page
> +
> +@node gm2-libs/wrapc, , gm2-libs/termios, Base libraries
> +@subsection gm2-libs/wrapc
> +
> +@example
> +DEFINITION MODULE wrapc ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +EXPORT QUALIFIED strtime, filesize, fileinode,
> +                 getrand, getusername, filemtime,
> +                 getnameuidgid, signbit, signbitf, signbitl,
> +                isfinite, isfinitel, isfinitef ;
> +
> +
> +(*
> +   strtime - returns the C string for the equivalent C asctime
> +             function.
> +*)
> +
> +@findex strtime
> +PROCEDURE strtime () : ADDRESS ;
> +
> +
> +(*
> +   filesize - assigns the size of a file, f, into low, high and
> +              returns zero if successful.
> +*)
> +
> +@findex filesize
> +PROCEDURE filesize (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   fileinode - return the inode associated with file, f.
> +*)
> +
> +@findex fileinode
> +PROCEDURE fileinode (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ;
> +
> +
> +(*
> +   filemtime - returns the mtime of a file, f.
> +*)
> +
> +@findex filemtime
> +PROCEDURE filemtime (f: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   getrand - returns a random number between 0..n-1
> +*)
> +
> +@findex getrand
> +PROCEDURE getrand (n: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   getusername - returns a C string describing the current user.
> +*)
> +
> +@findex getusername
> +PROCEDURE getusername () : ADDRESS ;
> +
> +
> +(*
> +   getnameuidgid - fills in the, uid, and, gid, which represents
> +                   user, name.
> +*)
> +
> +@findex getnameuidgid
> +PROCEDURE getnameuidgid (name: ADDRESS; VAR uid, gid: INTEGER) ;
> +
> +
> +(*
> +   in C these procedure functions are really macros, so we provide
> +   real C functions and let gm2 call these if the builtins
> +   are unavailable.
> +*)
> +
> +@findex signbit
> +PROCEDURE signbit (r: REAL) : INTEGER ;
> +@findex signbitf
> +PROCEDURE signbitf (s: SHORTREAL) : INTEGER ;
> +@findex signbitl
> +PROCEDURE signbitl (l: LONGREAL) : INTEGER ;
> +
> +
> +(*
> +   isfinite - provide non builtin alternative to the gcc builtin isfinite.
> +              Returns 1 if x is finite and 0 if it is not.
> +*)
> +
> +@findex isfinite
> +PROCEDURE isfinite (x: REAL) : INTEGER ;
> +
> +
> +(*
> +   isfinitef - provide non builtin alternative to the gcc builtin isfinite.
> +               Returns 1 if x is finite and 0 if it is not.
> +*)
> +
> +@findex isfinitef
> +PROCEDURE isfinitef (x: SHORTREAL) : INTEGER ;
> +
> +
> +(*
> +   isfinitel - provide non builtin alternative to the gcc builtin isfinite.
> +               Returns 1 if x is finite and 0 if it is not.
> +*)
> +
> +@findex isfinitel
> +PROCEDURE isfinitel (x: LONGREAL) : INTEGER ;
> +
> +
> +END wrapc.
> +@end example
> +@page
> +
> +
> +@c ------------------------------------------------------------
> +@node PIM and Logitech 3.0 Compatible, PIM coroutine support, Base libraries, Libraries
> +@section PIM and Logitech 3.0 Compatible
> +
> +@c README.texi describes the additional PIM libraries.
> +@c Copyright @copyright{} 2000-2020 Free Software Foundation, Inc.
> +@c
> +@c This is part of the GM2 manual.
> +@c For copying conditions, see the file gcc/doc/include/fdl.texi.
> +
> +These modules are provided to enable legacy Modula-2 applications to
> +build with GNU Modula-2. It is advised that these module should not
> +be used for new projects, maybe the ISO libraries or the native
> +compiler PIM libraries (FIO) should be used instead.
> +
> +Here is an outline of the module layering:
> +
> +@example
> +
> +InOut  RealInOut  LongIO CardinalIO
> +    \     |       |      /
> +           Terminal
> +-----------------------------------
> +              |
> +           Termbase
> +           /      \
> +    Keyboard      Display
> +
> +@end example
> +
> +Above the line are user level PIM [234] and Logitech 3.0 compatible
> +modules.  Below the line Logitech 3.0 advised that these modules
> +should be considered part of the runtime system. The libraries do
> +not provide all the features found in the Logitech libraries as
> +a number of these features were MS-DOS related. Essentially the
> +basic input/output, file system, string manipulation and conversion
> +routines are provided. Access to DOSCALL, graphics, time and date
> +are not as these were constrained by the limitations of MS-DOS.
> +
> +The following libraries are contained within the base GNU Modula-2
> +libraries and are also Logitech-3.0 compatible: @xref{gm2-libs/ASCII},
> +@xref{gm2-libs/Storage} and @xref{gm2-libs/MathLib0}.  These libraries
> +are always available for any dialect of the language (although their
> +implementation and behaviour might differ, for example Storage ISO and
> +PIM).
> +
> +The following libraries are Logitech-3.0 compatible but fall outside
> +the base GNU Modula-2 libraries.
> +@menu
> +* gm2-libs-pim/BitBlockOps::BitBlockOps.def
> +* gm2-libs-pim/BitByteOps::BitByteOps.def
> +* gm2-libs-pim/BitWordOps::BitWordOps.def
> +* gm2-libs-pim/BlockOps::BlockOps.def
> +* gm2-libs-pim/Break::Break.def
> +* gm2-libs-pim/CardinalIO::CardinalIO.def
> +* gm2-libs-pim/Conversions::Conversions.def
> +* gm2-libs-pim/DebugPMD::DebugPMD.def
> +* gm2-libs-pim/DebugTrace::DebugTrace.def
> +* gm2-libs-pim/Delay::Delay.def
> +* gm2-libs-pim/Display::Display.def
> +* gm2-libs-pim/ErrorCode::ErrorCode.def
> +* gm2-libs-pim/FileSystem::FileSystem.def
> +* gm2-libs-pim/FloatingUtilities::FloatingUtilities.def
> +* gm2-libs-pim/InOut::InOut.def
> +* gm2-libs-pim/Keyboard::Keyboard.def
> +* gm2-libs-pim/LongIO::LongIO.def
> +* gm2-libs-pim/NumberConversion::NumberConversion.def
> +* gm2-libs-pim/Random::Random.def
> +* gm2-libs-pim/RealConversions::RealConversions.def
> +* gm2-libs-pim/RealInOut::RealInOut.def
> +* gm2-libs-pim/Strings::Strings.def
> +* gm2-libs-pim/Termbase::Termbase.def
> +* gm2-libs-pim/Terminal::Terminal.def
> +* gm2-libs-pim/TimeDate::TimeDate.def
> +@end menu
> +
> +@node gm2-libs-pim/BitBlockOps, gm2-libs-pim/BitByteOps, , PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/BitBlockOps
> +
> +@example
> +DEFINITION MODULE BitBlockOps ;
> +
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +(*
> +   BlockAnd - performs a bitwise AND on blocks
> +              [dest..dest+size-1] := [dest..dest+size-1] AND
> +                                     [src..src+size-1]
> +*)
> +
> +@findex BlockAnd
> +PROCEDURE BlockAnd (dest, src: ADDRESS; size: CARDINAL) ;
> +
> +
> +(*
> +   BlockOr - performs a bitwise OR on blocks
> +             [dest..dest+size-1] := [dest..dest+size-1] OR
> +                                    [src..src+size-1]
> +*)
> +
> +@findex BlockOr
> +PROCEDURE BlockOr (dest, src: ADDRESS; size: CARDINAL) ;
> +
> +
> +(*
> +   BlockXor - performs a bitwise XOR on blocks
> +              [dest..dest+size-1] := [dest..dest+size-1] XOR
> +                                     [src..src+size-1]
> +*)
> +
> +@findex BlockXor
> +PROCEDURE BlockXor (dest, src: ADDRESS; size: CARDINAL) ;
> +
> +
> +(*
> +   BlockNot - performs a bitsize NOT on the block as defined
> +              by:  [dest..dest+size-1]
> +*)
> +
> +@findex BlockNot
> +PROCEDURE BlockNot (dest: ADDRESS; size: CARDINAL) ;
> +
> +
> +(*
> +   BlockShr - performs a block shift right of, count, bits.
> +              Where the block is defined as:
> +              [dest..dest+size-1].
> +              The block is considered to be an ARRAY OF BYTEs
> +              which is shifted, bit at a time over each byte in
> +              turn.  The left most byte is considered the byte
> +              located at the lowest address.
> +              If you require an endianness SHIFT use
> +              the SYSTEM.SHIFT procedure and declare the
> +              block as a POINTER TO set type.
> +*)
> +
> +@findex BlockShr
> +PROCEDURE BlockShr (dest: ADDRESS; size, count: CARDINAL) ;
> +
> +
> +(*
> +   BlockShl - performs a block shift left of, count, bits.
> +              Where the block is defined as:
> +              [dest..dest+size-1].
> +              The block is considered to be an ARRAY OF BYTEs
> +              which is shifted, bit at a time over each byte in
> +              turn.  The left most byte is considered the byte
> +              located at the lowest address.
> +              If you require an endianness SHIFT use
> +              the SYSTEM.SHIFT procedure and declare the
> +              block as a POINTER TO set type.
> +*)
> +
> +@findex BlockShl
> +PROCEDURE BlockShl (dest: ADDRESS; size, count: CARDINAL) ;
> +
> +
> +(*
> +   BlockRor - performs a block rotate right of, count, bits.
> +              Where the block is defined as:
> +              [dest..dest+size-1].
> +              The block is considered to be an ARRAY OF BYTEs
> +              which is rotated, bit at a time over each byte in
> +              turn.  The left most byte is considered the byte
> +              located at the lowest address.
> +              If you require an endianness ROTATE use
> +              the SYSTEM.ROTATE procedure and declare the
> +              block as a POINTER TO set type.
> +*)
> +
> +@findex BlockRor
> +PROCEDURE BlockRor (dest: ADDRESS; size, count: CARDINAL) ;
> +
> +
> +(*
> +   BlockRol - performs a block rotate left of, count, bits.
> +              Where the block is defined as:
> +              [dest..dest+size-1].
> +              The block is considered to be an ARRAY OF BYTEs
> +              which is rotated, bit at a time over each byte in
> +              turn.  The left most byte is considered the byte
> +              located at the lowest address.
> +              If you require an endianness ROTATE use
> +              the SYSTEM.ROTATE procedure and declare the
> +              block as a POINTER TO set type.
> +*)
> +
> +@findex BlockRol
> +PROCEDURE BlockRol (dest: ADDRESS; size, count: CARDINAL) ;
> +
> +
> +END BitBlockOps.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/BitByteOps, gm2-libs-pim/BitWordOps, gm2-libs-pim/BitBlockOps, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/BitByteOps
> +
> +@example
> +DEFINITION MODULE BitByteOps ;
> +
> +FROM SYSTEM IMPORT BYTE ;
> +
> +
> +(*
> +   GetBits - returns the bits firstBit..lastBit from source.
> +             Bit 0 of byte maps onto the firstBit of source.
> +*)
> +
> +@findex GetBits
> +PROCEDURE GetBits (source: BYTE; firstBit, lastBit: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   SetBits - sets bits in, byte, starting at, firstBit, and ending at,
> +             lastBit, with, pattern.  The bit zero of, pattern, will
> +             be placed into, byte, at position, firstBit.
> +*)
> +
> +@findex SetBits
> +PROCEDURE SetBits (VAR byte: BYTE; firstBit, lastBit: CARDINAL;
> +                   pattern: BYTE) ;
> +
> +
> +(*
> +   ByteAnd - returns a bitwise (left AND right)
> +*)
> +
> +@findex ByteAnd
> +PROCEDURE ByteAnd (left, right: BYTE) : BYTE ;
> +
> +
> +(*
> +   ByteOr - returns a bitwise (left OR right)
> +*)
> +
> +@findex ByteOr
> +PROCEDURE ByteOr (left, right: BYTE) : BYTE ;
> +
> +
> +(*
> +   ByteXor - returns a bitwise (left XOR right)
> +*)
> +
> +@findex ByteXor
> +PROCEDURE ByteXor (left, right: BYTE) : BYTE ;
> +
> +
> +(*
> +   ByteNot - returns a byte with all bits inverted.
> +*)
> +
> +@findex ByteNot
> +PROCEDURE ByteNot (byte: BYTE) : BYTE ;
> +
> +
> +(*
> +   ByteShr - returns a, byte, which has been shifted, count
> +             bits to the right.
> +*)
> +
> +@findex ByteShr
> +PROCEDURE ByteShr (byte: BYTE; count: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   ByteShl - returns a, byte, which has been shifted, count
> +             bits to the left.
> +*)
> +
> +@findex ByteShl
> +PROCEDURE ByteShl (byte: BYTE; count: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   ByteSar - shift byte arthemetic right.  Preserves the top
> +             end bit and as the value is shifted right.
> +*)
> +
> +@findex ByteSar
> +PROCEDURE ByteSar (byte: BYTE; count: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   ByteRor - returns a, byte, which has been rotated, count
> +             bits to the right.
> +*)
> +
> +@findex ByteRor
> +PROCEDURE ByteRor (byte: BYTE; count: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   ByteRol - returns a, byte, which has been rotated, count
> +             bits to the left.
> +*)
> +
> +@findex ByteRol
> +PROCEDURE ByteRol (byte: BYTE; count: CARDINAL) : BYTE ;
> +
> +
> +(*
> +   HighNibble - returns the top nibble only from, byte.
> +                The top nibble of, byte, is extracted and
> +                returned in the bottom nibble of the return
> +                value.
> +*)
> +
> +@findex HighNibble
> +PROCEDURE HighNibble (byte: BYTE) : BYTE ;
> +
> +
> +(*
> +   LowNibble - returns the low nibble only from, byte.
> +               The top nibble is replaced by zeros.
> +*)
> +
> +@findex LowNibble
> +PROCEDURE LowNibble (byte: BYTE) : BYTE ;
> +
> +
> +(*
> +   Swap - swaps the low and high nibbles in the, byte.
> +*)
> +
> +@findex Swap
> +PROCEDURE Swap (byte: BYTE) : BYTE ;
> +
> +
> +END BitByteOps.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/BitWordOps, gm2-libs-pim/BlockOps, gm2-libs-pim/BitByteOps, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/BitWordOps
> +
> +@example
> +DEFINITION MODULE BitWordOps ;
> +
> +FROM SYSTEM IMPORT WORD ;
> +
> +
> +(*
> +   GetBits - returns the bits firstBit..lastBit from source.
> +             Bit 0 of word maps onto the firstBit of source.
> +*)
> +
> +@findex GetBits
> +PROCEDURE GetBits (source: WORD; firstBit, lastBit: CARDINAL) : WORD ;
> +
> +
> +(*
> +   SetBits - sets bits in, word, starting at, firstBit, and ending at,
> +             lastBit, with, pattern.  The bit zero of, pattern, will
> +             be placed into, word, at position, firstBit.
> +*)
> +
> +@findex SetBits
> +PROCEDURE SetBits (VAR word: WORD; firstBit, lastBit: CARDINAL;
> +                   pattern: WORD) ;
> +
> +
> +(*
> +   WordAnd - returns a bitwise (left AND right)
> +*)
> +
> +@findex WordAnd
> +PROCEDURE WordAnd (left, right: WORD) : WORD ;
> +
> +
> +(*
> +   WordOr - returns a bitwise (left OR right)
> +*)
> +
> +@findex WordOr
> +PROCEDURE WordOr (left, right: WORD) : WORD ;
> +
> +
> +(*
> +   WordXor - returns a bitwise (left XOR right)
> +*)
> +
> +@findex WordXor
> +PROCEDURE WordXor (left, right: WORD) : WORD ;
> +
> +
> +(*
> +   WordNot - returns a word with all bits inverted.
> +*)
> +
> +@findex WordNot
> +PROCEDURE WordNot (word: WORD) : WORD ;
> +
> +
> +(*
> +   WordShr - returns a, word, which has been shifted, count
> +             bits to the right.
> +*)
> +
> +@findex WordShr
> +PROCEDURE WordShr (word: WORD; count: CARDINAL) : WORD ;
> +
> +
> +(*
> +   WordShl - returns a, word, which has been shifted, count
> +             bits to the left.
> +*)
> +
> +@findex WordShl
> +PROCEDURE WordShl (word: WORD; count: CARDINAL) : WORD ;
> +
> +
> +(*
> +   WordSar - shift word arthemetic right.  Preserves the top
> +             end bit and as the value is shifted right.
> +*)
> +
> +@findex WordSar
> +PROCEDURE WordSar (word: WORD; count: CARDINAL) : WORD ;
> +
> +
> +(*
> +   WordRor - returns a, word, which has been rotated, count
> +             bits to the right.
> +*)
> +
> +@findex WordRor
> +PROCEDURE WordRor (word: WORD; count: CARDINAL) : WORD ;
> +
> +
> +(*
> +   WordRol - returns a, word, which has been rotated, count
> +             bits to the left.
> +*)
> +
> +@findex WordRol
> +PROCEDURE WordRol (word: WORD; count: CARDINAL) : WORD ;
> +
> +
> +(*
> +   HighByte - returns the top byte only from, word.
> +              The byte is returned in the bottom byte
> +              in the return value.
> +*)
> +
> +@findex HighByte
> +PROCEDURE HighByte (word: WORD) : WORD ;
> +
> +
> +(*
> +   LowByte - returns the low byte only from, word.
> +             The byte is returned in the bottom byte
> +             in the return value.
> +*)
> +
> +@findex LowByte
> +PROCEDURE LowByte (word: WORD) : WORD ;
> +
> +
> +(*
> +   Swap - byte flips the contents of word.
> +*)
> +
> +@findex Swap
> +PROCEDURE Swap (word: WORD) : WORD ;
> +
> +
> +END BitWordOps.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/BlockOps, gm2-libs-pim/Break, gm2-libs-pim/BitWordOps, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/BlockOps
> +
> +@example
> +DEFINITION MODULE BlockOps ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +(*
> +   MoveBlockForward - moves, n, bytes from, src, to, dest.
> +                      Starts copying from src and keep copying
> +                      until, n, bytes have been copied.
> +*)
> +
> +@findex BlockMoveForward
> +PROCEDURE BlockMoveForward (dest, src: ADDRESS; n: CARDINAL) ;
> +
> +
> +(*
> +   MoveBlockBackward - moves, n, bytes from, src, to, dest.
> +                       Starts copying from src+n and keeps copying
> +                       until, n, bytes have been copied.
> +                       The last datum to be copied will be the byte
> +                       at address, src.
> +*)
> +
> +@findex BlockMoveBackward
> +PROCEDURE BlockMoveBackward (dest, src: ADDRESS; n: CARDINAL) ;
> +
> +
> +(*
> +   BlockClear - fills, block..block+n-1, with zero's.
> +*)
> +
> +@findex BlockClear
> +PROCEDURE BlockClear (block: ADDRESS; n: CARDINAL) ;
> +
> +
> +(*
> +   BlockSet - fills, n, bytes starting at, block, with a pattern
> +              defined at address pattern..pattern+patternSize-1.
> +*)
> +
> +@findex BlockSet
> +PROCEDURE BlockSet (block: ADDRESS; n: CARDINAL;
> +                    pattern: ADDRESS; patternSize: CARDINAL) ;
> +
> +
> +(*
> +   BlockEqual - returns TRUE if the blocks defined, a..a+n-1, and,
> +                b..b+n-1 contain the same bytes.
> +*)
> +
> +@findex BlockEqual
> +PROCEDURE BlockEqual (a, b: ADDRESS; n: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   BlockPosition - searches for a pattern as defined by
> +                   pattern..patternSize-1 in the block,
> +                   block..block+blockSize-1.  It returns
> +                   the offset from block indicating the
> +                   first occurence of, pattern.
> +                   MAX(CARDINAL) is returned if no match
> +                   is detected.
> +*)
> +
> +@findex BlockPosition
> +PROCEDURE BlockPosition (block: ADDRESS; blockSize: CARDINAL;
> +                         pattern: ADDRESS; patternSize: CARDINAL) : CARDINAL ;
> +
> +
> +END BlockOps.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Break, gm2-libs-pim/CardinalIO, gm2-libs-pim/BlockOps, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Break
> +
> +@example
> +DEFINITION MODULE Break ;
> +
> +
> +EXPORT QUALIFIED EnableBreak, DisableBreak, InstallBreak, UnInstallBreak ;
> +
> +
> +(*
> +   EnableBreak - enable the current break handler.
> +*)
> +
> +@findex EnableBreak
> +PROCEDURE EnableBreak ;
> +
> +
> +(*
> +   DisableBreak - disable the current break handler (and all
> +                  installed handlers).
> +*)
> +
> +@findex DisableBreak
> +PROCEDURE DisableBreak ;
> +
> +
> +(*
> +   InstallBreak - installs a procedure, p, to be invoked when
> +                  a ctrl-c is caught. Any number of these
> +                  procedures may be stacked. Only the top
> +                  procedure is run when ctrl-c is caught.
> +*)
> +
> +@findex InstallBreak
> +PROCEDURE InstallBreak (p: PROC) ;
> +
> +
> +(*
> +   UnInstallBreak - pops the break handler stack.
> +*)
> +
> +@findex UnInstallBreak
> +PROCEDURE UnInstallBreak ;
> +
> +
> +END Break.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/CardinalIO, gm2-libs-pim/Conversions, gm2-libs-pim/Break, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/CardinalIO
> +
> +@example
> +DEFINITION MODULE CardinalIO ;
> +
> +EXPORT QUALIFIED Done,
> +                 ReadCardinal, WriteCardinal, ReadHex, WriteHex,
> +                 ReadLongCardinal, WriteLongCardinal, ReadLongHex,
> +                 WriteLongHex,
> +                 ReadShortCardinal, WriteShortCardinal, ReadShortHex,
> +                 WriteShortHex ;
> +
> +
> +VAR
> +@findex Done (var)
> +   Done: BOOLEAN ;
> +
> +
> +(*
> +   ReadCardinal - read an unsigned decimal number from the terminal.
> +                  The read continues until a space, newline, esc or
> +                  end of file is reached.
> +*)
> +
> +@findex ReadCardinal
> +PROCEDURE ReadCardinal (VAR c: CARDINAL) ;
> +
> +
> +(*
> +   WriteCardinal - writes the value, c, to the terminal and ensures
> +                   that at least, n, characters are written. The number
> +                   will be padded out by preceeding spaces if necessary.
> +*)
> +
> +@findex WriteCardinal
> +PROCEDURE WriteCardinal (c: CARDINAL; n: CARDINAL) ;
> +
> +
> +(*
> +   ReadHex - reads in an unsigned hexadecimal number from the terminal.
> +             The read continues until a space, newline, esc or
> +             end of file is reached.
> +*)
> +
> +@findex ReadHex
> +PROCEDURE ReadHex (VAR c: CARDINAL) ;
> +
> +
> +(*
> +   WriteHex - writes out a CARDINAL, c, in hexadecimal format padding
> +              with, n, characters (leading with '0')
> +*)
> +
> +@findex WriteHex
> +PROCEDURE WriteHex (c: CARDINAL; n: CARDINAL) ;
> +
> +
> +(*
> +   ReadLongCardinal - read an unsigned decimal number from the terminal.
> +                      The read continues until a space, newline, esc or
> +                      end of file is reached.
> +*)
> +
> +@findex ReadLongCardinal
> +PROCEDURE ReadLongCardinal (VAR c: LONGCARD) ;
> +
> +
> +(*
> +   WriteLongCardinal - writes the value, c, to the terminal and ensures
> +                       that at least, n, characters are written. The number
> +                       will be padded out by preceeding spaces if necessary.
> +*)
> +
> +@findex WriteLongCardinal
> +PROCEDURE WriteLongCardinal (c: LONGCARD; n: CARDINAL) ;
> +
> +
> +(*
> +   ReadLongHex - reads in an unsigned hexadecimal number from the terminal.
> +                 The read continues until a space, newline, esc or
> +                 end of file is reached.
> +*)
> +
> +@findex ReadLongHex
> +PROCEDURE ReadLongHex (VAR c: LONGCARD) ;
> +
> +
> +(*
> +   WriteLongHex - writes out a LONGCARD, c, in hexadecimal format padding
> +                  with, n, characters (leading with '0')
> +*)
> +
> +@findex WriteLongHex
> +PROCEDURE WriteLongHex (c: LONGCARD; n: CARDINAL) ;
> +
> +
> +(*
> +   WriteShortCardinal - writes the value, c, to the terminal and ensures
> +                       that at least, n, characters are written. The number
> +                       will be padded out by preceeding spaces if necessary.
> +*)
> +
> +@findex WriteShortCardinal
> +PROCEDURE WriteShortCardinal (c: SHORTCARD; n: CARDINAL) ;
> +
> +
> +(*
> +   ReadShortCardinal - read an unsigned decimal number from the terminal.
> +                       The read continues until a space, newline, esc or
> +                       end of file is reached.
> +*)
> +
> +@findex ReadShortCardinal
> +PROCEDURE ReadShortCardinal (VAR c: SHORTCARD) ;
> +
> +
> +(*
> +   ReadShortHex - reads in an unsigned hexadecimal number from the terminal.
> +                 The read continues until a space, newline, esc or
> +                 end of file is reached.
> +*)
> +
> +@findex ReadShortHex
> +PROCEDURE ReadShortHex (VAR c: SHORTCARD) ;
> +
> +
> +(*
> +   WriteShortHex - writes out a SHORTCARD, c, in hexadecimal format padding
> +                  with, n, characters (leading with '0')
> +*)
> +
> +@findex WriteShortHex
> +PROCEDURE WriteShortHex (c: SHORTCARD; n: CARDINAL) ;
> +
> +
> +END CardinalIO.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Conversions, gm2-libs-pim/DebugPMD, gm2-libs-pim/CardinalIO, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Conversions
> +
> +@example
> +DEFINITION MODULE Conversions ;
> +
> +EXPORT QUALIFIED ConvertOctal, ConvertHex, ConvertCardinal,
> +                 ConvertInteger, ConvertLongInt, ConvertShortInt ;
> +
> +(*
> +   ConvertOctal - converts a CARDINAL, num, into an octal/hex/decimal
> +                  string and right justifies the string. It adds
> +                  spaces rather than '0' to pad out the string
> +                  to len characters.
> +
> +                  If the length of str is < num then the number is
> +                  truncated on the right.
> +*)
> +
> +@findex ConvertOctal
> +PROCEDURE ConvertOctal    (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +@findex ConvertHex
> +PROCEDURE ConvertHex      (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +@findex ConvertCardinal
> +PROCEDURE ConvertCardinal (num, len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +
> +(*
> +   The INTEGER counterparts will add a '-' if, num, is <0
> +*)
> +
> +@findex ConvertInteger
> +PROCEDURE ConvertInteger  (num: INTEGER; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +@findex ConvertLongInt
> +PROCEDURE ConvertLongInt  (num: LONGINT; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +@findex ConvertShortInt
> +PROCEDURE ConvertShortInt (num: SHORTINT; len: CARDINAL; VAR str: ARRAY OF CHAR) ;
> +
> +
> +END Conversions.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/DebugPMD, gm2-libs-pim/DebugTrace, gm2-libs-pim/Conversions, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/DebugPMD
> +
> +@example
> +DEFINITION MODULE DebugPMD ;
> +
> +END DebugPMD.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/DebugTrace, gm2-libs-pim/Delay, gm2-libs-pim/DebugPMD, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/DebugTrace
> +
> +@example
> +DEFINITION MODULE DebugTrace ;
> +
> +END DebugTrace.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Delay, gm2-libs-pim/Display, gm2-libs-pim/DebugTrace, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Delay
> +
> +@example
> +DEFINITION MODULE Delay ;
> +
> +EXPORT QUALIFIED Delay ;
> +
> +
> +(*
> +   milliSec - delays the program by approximately, milliSec, milliseconds.
> +*)
> +
> +@findex Delay
> +PROCEDURE Delay (milliSec: INTEGER) ;
> +
> +
> +END Delay.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Display, gm2-libs-pim/ErrorCode, gm2-libs-pim/Delay, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Display
> +
> +@example
> +DEFINITION MODULE Display ;
> +
> +EXPORT QUALIFIED Write ;
> +
> +
> +(*
> +   Write - display a character to the stdout.
> +           ASCII.EOL moves to the beginning of the next line.
> +           ASCII.del erases the character to the left of the cursor.
> +*)
> +
> +@findex Write
> +PROCEDURE Write (ch: CHAR) ;
> +
> +
> +END Display.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/ErrorCode, gm2-libs-pim/FileSystem, gm2-libs-pim/Display, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/ErrorCode
> +
> +@example
> +DEFINITION MODULE ErrorCode ;
> +
> +EXPORT QUALIFIED SetErrorCode, GetErrorCode, ExitToOS ;
> +
> +
> +(*
> +   SetErrorCode - sets the exit value which will be used if
> +                  the application terminates normally.
> +*)
> +
> +@findex SetErrorCode
> +PROCEDURE SetErrorCode (value: INTEGER) ;
> +
> +
> +(*
> +   GetErrorCode - returns the current value to be used upon
> +                  application termination.
> +*)
> +
> +@findex GetErrorCode
> +PROCEDURE GetErrorCode (VAR value: INTEGER) ;
> +
> +
> +(*
> +   ExitToOS - terminate the application and exit returning
> +              the last value set by SetErrorCode to the OS.
> +*)
> +
> +@findex ExitToOS
> +PROCEDURE ExitToOS ;
> +
> +
> +END ErrorCode.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/FileSystem, gm2-libs-pim/FloatingUtilities, gm2-libs-pim/ErrorCode, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/FileSystem
> +
> +@example
> +DEFINITION MODULE FileSystem ;
> +
> +(*  Use this module sparingly, FIO or the ISO file modules have a
> +    much cleaner interface.  *)
> +
> +FROM SYSTEM IMPORT WORD, BYTE, ADDRESS ;
> +IMPORT FIO ;
> +FROM DynamicStrings IMPORT String ;
> +
> +EXPORT QUALIFIED File, Response, Flag, FlagSet,
> +
> +                 Create, Close, Lookup, Rename, Delete,
> +                 SetRead, SetWrite, SetModify, SetOpen,
> +                 Doio, SetPos, GetPos, Length, Reset,
> +
> +                 ReadWord, ReadChar, ReadByte, ReadNBytes,
> +                 WriteWord, WriteChar, WriteByte, WriteNBytes ;
> +
> +TYPE
> +@findex File (type)
> +   File = RECORD
> +             res     : Response ;
> +             flags   : FlagSet ;
> +             eof     : BOOLEAN ;
> +             lastWord: WORD ;
> +             lastByte: BYTE ;
> +             fio     : FIO.File ;
> +             highpos,
> +             lowpos  : CARDINAL ;
> +             name    : String ;
> +@findex END (type)
> +          END ;
> +
> +@findex Flag (type)
> +   Flag = (
> +           read,        (* read access mode *)
> +           write,       (* write access mode *)
> +           modify,
> +           truncate,    (* truncate file when closed *)
> +           again,       (* reread the last character *)
> +           temporary,   (* file is temporary *)
> +           opened       (* file has been opened *)
> +          );
> +
> +@findex FlagSet (type)
> +   FlagSet = SET OF Flag;
> +
> +@findex Response (type)
> +   Response = (done, notdone, notsupported, callerror,
> +               unknownfile, paramerror, toomanyfiles,
> +@findex userdeverror) (type)
> +               userdeverror) ;
> +
> +@findex Command (type)
> +   Command = (create, close, lookup, rename, delete,
> +              setread, setwrite, setmodify, setopen,
> +              doio, setpos, getpos, length) ;
> +
> +
> +(*
> +   Create - creates a temporary file. To make the file perminant
> +            the file must be renamed.
> +*)
> +
> +@findex Create
> +PROCEDURE Create (VAR f: File) ;
> +
> +
> +(*
> +   Close - closes an open file.
> +*)
> +
> +@findex Close
> +PROCEDURE Close (f: File) ;
> +
> +
> +(*
> +   Lookup - looks for a file, filename. If the file is found
> +            then, f, is opened. If it is not found and, newFile,
> +            is TRUE then a new file is created and attached to, f.
> +            If, newFile, is FALSE and no file was found then f.res
> +            is set to notdone.
> +*)
> +
> +@findex Lookup
> +PROCEDURE Lookup (VAR f: File; filename: ARRAY OF CHAR; newFile: BOOLEAN) ;
> +
> +
> +(*
> +   Rename - rename a file and change a temporary file to a permanent
> +            file. f.res is set appropriately.
> +*)
> +
> +@findex Rename
> +PROCEDURE Rename (VAR f: File; newname: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   Delete - deletes a file, name, and sets the f.res field.
> +            f.res is set appropriately.
> +*)
> +
> +@findex Delete
> +PROCEDURE Delete (name: ARRAY OF CHAR; VAR f: File) ;
> +
> +
> +(*
> +   ReadWord - reads a WORD, w, from file, f.
> +              f.res is set appropriately.
> +*)
> +
> +@findex ReadWord
> +PROCEDURE ReadWord (VAR f: File; VAR w: WORD) ;
> +
> +
> +(*
> +   WriteWord - writes one word to a file, f.
> +               f.res is set appropriately.
> +*)
> +
> +@findex WriteWord
> +PROCEDURE WriteWord (VAR f: File; w: WORD) ;
> +
> +
> +(*
> +   ReadChar - reads one character from a file, f.
> +*)
> +
> +@findex ReadChar
> +PROCEDURE ReadChar (VAR f: File; VAR ch: CHAR) ;
> +
> +
> +(*
> +   WriteChar - writes a character, ch, to a file, f.
> +               f.res is set appropriately.
> +*)
> +
> +@findex WriteChar
> +PROCEDURE WriteChar (VAR f: File; ch: CHAR) ;
> +
> +
> +(*
> +   ReadByte - reads a BYTE, b, from file, f.
> +              f.res is set appropriately.
> +*)
> +
> +@findex ReadByte
> +PROCEDURE ReadByte (VAR f: File; VAR b: BYTE) ;
> +
> +
> +(*
> +   WriteByte - writes one BYTE, b, to a file, f.
> +               f.res is set appropriately.
> +*)
> +
> +@findex WriteByte
> +PROCEDURE WriteByte (VAR f: File; b: BYTE) ;
> +
> +
> +(*
> +   ReadNBytes - reads a sequence of bytes from a file, f.
> +*)
> +
> +@findex ReadNBytes
> +PROCEDURE ReadNBytes (VAR f: File; a: ADDRESS; amount: CARDINAL;
> +                      VAR actuallyRead: CARDINAL) ;
> +
> +
> +(*
> +   WriteNBytes - writes a sequence of bytes to file, f.
> +*)
> +
> +@findex WriteNBytes
> +PROCEDURE WriteNBytes (VAR f: File; a: ADDRESS; amount: CARDINAL;
> +                       VAR actuallyWritten: CARDINAL) ;
> +
> +
> +(*
> +   Again - returns the last character read to the internal buffer
> +           so that it can be read again.
> +*)
> +
> +@findex Again
> +PROCEDURE Again (VAR f: File) ;
> +
> +
> +(*
> +   SetRead - puts the file, f, into the read state.
> +             The file position is unchanged.
> +*)
> +
> +@findex SetRead
> +PROCEDURE SetRead (VAR f: File) ;
> +
> +
> +(*
> +   SetWrite - puts the file, f, into the write state.
> +              The file position is unchanged.
> +*)
> +
> +@findex SetWrite
> +PROCEDURE SetWrite (VAR f: File) ;
> +
> +
> +(*
> +   SetModify - puts the file, f, into the modify state.
> +               The file position is unchanged but the file can be
> +               read and written.
> +*)
> +
> +@findex SetModify
> +PROCEDURE SetModify (VAR f: File) ;
> +
> +
> +(*
> +   SetOpen - places a file, f, into the open state. The file may
> +             have been in the read/write/modify state before and
> +             in which case the previous buffer contents are flushed
> +             and the file state is reset to open. The position is
> +             unaltered.
> +*)
> +
> +@findex SetOpen
> +PROCEDURE SetOpen (VAR f: File) ;
> +
> +
> +(*
> +   Reset - places a file, f, into the open state and reset the
> +           position to the start of the file.
> +*)
> +
> +@findex Reset
> +PROCEDURE Reset (VAR f: File) ;
> +
> +
> +(*
> +   SetPos - lseek to a position within a file.
> +*)
> +
> +@findex SetPos
> +PROCEDURE SetPos (VAR f: File; high, low: CARDINAL) ;
> +
> +
> +(*
> +   GetPos - return the position within a file.
> +*)
> +
> +@findex GetPos
> +PROCEDURE GetPos (VAR f: File; VAR high, low: CARDINAL) ;
> +
> +
> +(*
> +   Length - returns the length of file, in, high, and, low.
> +*)
> +
> +@findex Length
> +PROCEDURE Length (VAR f: File; VAR high, low: CARDINAL) ;
> +
> +
> +(*
> +   Doio - effectively flushes a file in write mode, rereads the
> +          current buffer from disk if in read mode and writes
> +          and rereads the buffer if in modify mode.
> +*)
> +
> +@findex Doio
> +PROCEDURE Doio (VAR f: File) ;
> +
> +
> +(*
> +   FileNameChar - checks to see whether the character, ch, is
> +                  legal in a filename. nul is returned if the
> +                  character was illegal.
> +*)
> +
> +@findex FileNameChar
> +PROCEDURE FileNameChar (ch: CHAR) ;
> +
> +
> +END FileSystem.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/FloatingUtilities, gm2-libs-pim/InOut, gm2-libs-pim/FileSystem, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/FloatingUtilities
> +
> +@example
> +DEFINITION MODULE FloatingUtilities ;
> +
> +EXPORT QUALIFIED Frac, Round, Float, Trunc,
> +                 Fracl, Roundl, Floatl, Truncl ;
> +
> +
> +(*
> +   Frac - returns the fractional component of, r.
> +*)
> +
> +@findex Frac
> +PROCEDURE Frac (r: REAL) : REAL ;
> +
> +
> +(*
> +   Int - returns the integer part of r. It rounds the value towards zero.
> +*)
> +
> +@findex Int
> +PROCEDURE Int (r: REAL) : INTEGER ;
> +
> +
> +(*
> +   Round - returns the number rounded to the nearest integer.
> +*)
> +
> +@findex Round
> +PROCEDURE Round (r: REAL) : INTEGER ;
> +
> +
> +(*
> +   Float - returns a REAL value corresponding to, i.
> +*)
> +
> +@findex Float
> +PROCEDURE Float (i: INTEGER) : REAL ;
> +
> +
> +(*
> +   Trunc - round to the nearest integer not larger in absolute
> +           value.
> +*)
> +
> +@findex Trunc
> +PROCEDURE Trunc (r: REAL) : INTEGER ;
> +
> +
> +(*
> +   Fracl - returns the fractional component of, r.
> +*)
> +
> +@findex Fracl
> +PROCEDURE Fracl (r: LONGREAL) : LONGREAL ;
> +
> +
> +(*
> +   Intl - returns the integer part of r. It rounds the value towards zero.
> +*)
> +
> +@findex Intl
> +PROCEDURE Intl (r: LONGREAL) : LONGINT ;
> +
> +
> +(*
> +   Roundl - returns the number rounded to the nearest integer.
> +*)
> +
> +@findex Roundl
> +PROCEDURE Roundl (r: LONGREAL) : LONGINT ;
> +
> +
> +(*
> +   Floatl - returns a REAL value corresponding to, i.
> +*)
> +
> +@findex Floatl
> +PROCEDURE Floatl (i: INTEGER) : LONGREAL ;
> +
> +
> +(*
> +   Truncl - round to the nearest integer not larger in absolute
> +            value.
> +*)
> +
> +@findex Truncl
> +PROCEDURE Truncl (r: LONGREAL) : LONGINT ;
> +
> +
> +END FloatingUtilities.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/InOut, gm2-libs-pim/Keyboard, gm2-libs-pim/FloatingUtilities, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/InOut
> +
> +@example
> +DEFINITION MODULE InOut ;
> +
> +IMPORT ASCII ;
> +FROM DynamicStrings IMPORT String ;
> +EXPORT QUALIFIED EOL, Done, termCH, OpenInput, OpenOutput,
> +                 CloseInput, CloseOutput,
> +                 Read, ReadString, ReadInt, ReadCard,
> +                 Write, WriteLn, WriteString, WriteInt, WriteCard,
> +                 WriteOct, WriteHex,
> +                 ReadS, WriteS ;
> +
> +CONST
> +@findex EOL (const)
> +   EOL = ASCII.EOL ;
> +
> +VAR
> +@findex Done (var)
> +   Done  : BOOLEAN ;
> +@findex termCH (var)
> +   termCH: CHAR ;
> +
> +
> +(*
> +   OpenInput - reads a string from stdin as the filename for reading.
> +               If the filename ends with `.' then it appends the defext
> +               extension. The global variable Done is set if all
> +               was successful.
> +*)
> +
> +@findex OpenInput
> +PROCEDURE OpenInput (defext: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   CloseInput - closes an opened input file and returns input back to
> +                StdIn.
> +*)
> +
> +@findex CloseInput
> +PROCEDURE CloseInput ;
> +
> +
> +(*
> +   OpenOutput - reads a string from stdin as the filename for writing.
> +                If the filename ends with `.' then it appends the defext
> +                extension. The global variable Done is set if all
> +                was successful.
> +*)
> +
> +@findex OpenOutput
> +PROCEDURE OpenOutput (defext: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   CloseOutput - closes an opened output file and returns output back to
> +                 StdOut.
> +*)
> +
> +@findex CloseOutput
> +PROCEDURE CloseOutput ;
> +
> +
> +(*
> +   Read - reads a single character from the current input file.
> +          Done is set to FALSE if end of file is reached or an
> +          error occurs.
> +*)
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +
> +
> +(*
> +   ReadString - reads a sequence of characters. Leading white space
> +                is ignored and the string is terminated with a character
> +                <= ' '
> +*)
> +
> +@findex ReadString
> +PROCEDURE ReadString (VAR s: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WriteString - writes a string to the output file.
> +*)
> +
> +@findex WriteString
> +PROCEDURE WriteString (s: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   Write - writes out a single character, ch, to the current output file.
> +*)
> +
> +@findex Write
> +PROCEDURE Write (ch: CHAR) ;
> +
> +
> +(*
> +   WriteLn - writes a newline to the output file.
> +*)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn ;
> +
> +
> +(*
> +   ReadInt - reads a string and converts it into an INTEGER, x.
> +             Done is set if an INTEGER is read.
> +*)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (VAR x: INTEGER) ;
> +
> +
> +(*
> +   ReadInt - reads a string and converts it into an INTEGER, x.
> +             Done is set if an INTEGER is read.
> +*)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (VAR x: CARDINAL) ;
> +
> +
> +(*
> +   WriteCard - writes the CARDINAL, x, to the output file. It ensures
> +               that the number occupies, n, characters. Leading spaces
> +               are added if required.
> +*)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (x, n: CARDINAL) ;
> +
> +
> +(*
> +   WriteInt - writes the INTEGER, x, to the output file. It ensures
> +              that the number occupies, n, characters. Leading spaces
> +              are added if required.
> +*)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (x: INTEGER; n: CARDINAL) ;
> +
> +
> +(*
> +   WriteOct - writes the CARDINAL, x, to the output file in octal.
> +              It ensures that the number occupies, n, characters.
> +              Leading spaces are added if required.
> +*)
> +
> +@findex WriteOct
> +PROCEDURE WriteOct (x, n: CARDINAL) ;
> +
> +
> +(*
> +   WriteHex - writes the CARDINAL, x, to the output file in hexadecimal.
> +              It ensures that the number occupies, n, characters.
> +              Leading spaces are added if required.
> +*)
> +
> +@findex WriteHex
> +PROCEDURE WriteHex (x, n: CARDINAL) ;
> +
> +
> +(*
> +   ReadS - returns a string which has is a sequence of characters.
> +           Leading white space is ignored and string is terminated
> +           with a character <= ' '.
> +*)
> +
> +@findex ReadS
> +PROCEDURE ReadS () : String ;
> +
> +
> +(*
> +   WriteS - writes a String to the output device.
> +            It returns the string, s.
> +*)
> +
> +@findex WriteS
> +PROCEDURE WriteS (s: String) : String ;
> +
> +
> +END InOut.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Keyboard, gm2-libs-pim/LongIO, gm2-libs-pim/InOut, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Keyboard
> +
> +@example
> +DEFINITION MODULE Keyboard ;
> +
> +EXPORT QUALIFIED Read, KeyPressed ;
> +
> +
> +(*
> +   Read - reads a character from StdIn. If necessary it will wait
> +          for a key to become present on StdIn.
> +*)
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +
> +
> +(*
> +   KeyPressed - returns TRUE if a character can be read from StdIn
> +                without blocking the caller.
> +*)
> +
> +@findex KeyPressed
> +PROCEDURE KeyPressed () : BOOLEAN ;
> +
> +
> +END Keyboard.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/LongIO, gm2-libs-pim/NumberConversion, gm2-libs-pim/Keyboard, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/LongIO
> +
> +@example
> +DEFINITION MODULE LongIO ;
> +
> +EXPORT QUALIFIED Done, ReadLongInt, WriteLongInt ;
> +
> +VAR
> +@findex Done (var)
> +   Done: BOOLEAN ;
> +
> +@findex ReadLongInt
> +PROCEDURE ReadLongInt (VAR i: LONGINT) ;
> +@findex WriteLongInt
> +PROCEDURE WriteLongInt (i: LONGINT; n: CARDINAL) ;
> +
> +
> +END LongIO.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/NumberConversion, gm2-libs-pim/Random, gm2-libs-pim/LongIO, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/NumberConversion
> +
> +@example
> +DEFINITION MODULE NumberConversion ;
> +
> +(* --fixme-- finish this.  *)
> +
> +END NumberConversion.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Random, gm2-libs-pim/RealConversions, gm2-libs-pim/NumberConversion, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Random
> +
> +@example
> +DEFINITION MODULE Random ;
> +
> +FROM SYSTEM IMPORT BYTE ;
> +EXPORT QUALIFIED Randomize, RandomInit, RandomBytes, RandomCard, RandomInt, RandomReal, RandomLongReal ;
> +
> +
> +(*
> +   Randomize - initialize the random number generator with a seed
> +               based on the microseconds.
> +*)
> +
> +@findex Randomize
> +PROCEDURE Randomize ;
> +
> +
> +(*
> +   RandomInit - initialize the random number generator with value, seed.
> +*)
> +
> +@findex RandomInit
> +PROCEDURE RandomInit (seed: CARDINAL) ;
> +
> +
> +(*
> +   RandomBytes - fills in an array with random values.
> +*)
> +
> +@findex RandomBytes
> +PROCEDURE RandomBytes (VAR a: ARRAY OF BYTE) ;
> +
> +
> +(*
> +   RandomInt - return an INTEGER in the range 0..bound-1
> +*)
> +
> +@findex RandomInt
> +PROCEDURE RandomInt (bound: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   RandomCard - return a CARDINAL in the range 0..bound-1
> +*)
> +
> +@findex RandomCard
> +PROCEDURE RandomCard (bound: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   RandomReal - return a REAL number in the range 0.0..1.0
> +*)
> +
> +@findex RandomReal
> +PROCEDURE RandomReal () : REAL ;
> +
> +
> +(*
> +   RandomLongReal - return a LONGREAL number in the range 0.0..1.0
> +*)
> +
> +@findex RandomLongReal
> +PROCEDURE RandomLongReal () : LONGREAL ;
> +
> +
> +END Random.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/RealConversions, gm2-libs-pim/RealInOut, gm2-libs-pim/Random, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/RealConversions
> +
> +@example
> +DEFINITION MODULE RealConversions ;
> +
> +EXPORT QUALIFIED SetNoOfExponentDigits,
> +                 RealToString, StringToReal,
> +                 LongRealToString, StringToLongReal ;
> +
> +
> +(*
> +   SetNoOfExponentDigits - sets the number of exponent digits to be
> +                           used during future calls of LongRealToString
> +                           and RealToString providing that the width
> +                           is sufficient.
> +                           If this value is set to 0 (the default) then
> +                           the number digits used is the minimum necessary.
> +*)
> +
> +@findex SetNoOfExponentDigits
> +PROCEDURE SetNoOfExponentDigits (places: CARDINAL) ;
> +
> +
> +(*
> +   RealToString - converts a real, r, into a right justified string, str.
> +                  The number of digits to the right of the decimal point
> +                  is given in, digits.  The value, width, represents the
> +                  maximum number of characters to be used in the string,
> +                  str.
> +
> +                  If digits is negative then exponent notation is used
> +                  whereas if digits is positive then fixed point notation
> +                  is used.
> +
> +                  If, r, is less than 0.0 then a '-' preceeds the value,
> +                  str.  However, if, r, is >= 0.0 a '+' is not added.
> +
> +                  If the conversion of, r, to a string requires more
> +                  than, width, characters then the string, str, is set
> +                  to a nul string and, ok is assigned FALSE.
> +
> +                  For fixed point notation the minimum width required is
> +                  ABS(width)+8
> +
> +                  For exponent notation the minimum width required is
> +                  ABS(digits)+2+log10(magnitude).
> +
> +                  if r is a NaN then the string 'nan' is returned formatted and
> +                  ok will be FALSE.
> +*)
> +
> +@findex RealToString
> +PROCEDURE RealToString (r: REAL; digits, width: INTEGER;
> +                        VAR str: ARRAY OF CHAR; VAR ok: BOOLEAN) ;
> +
> +
> +(*
> +   LongRealToString - converts a real, r, into a right justified string, str.
> +                      The number of digits to the right of the decimal point
> +                      is given in, digits. The value, width, represents the
> +                      maximum number of characters to be used in the string,
> +                      str.
> +
> +                      If digits is negative then exponent notation is used
> +                      whereas if digits is positive then fixed point notation
> +                      is used.
> +
> +                      If, r, is less than 0.0 then a '-' preceeds the value,
> +                      str. However, if, r, is >= 0.0 a '+' is not added.
> +
> +                      If the conversion of, r, to a string requires more
> +                      than, width, characters then the string, str, is set
> +                      to a nul string and, ok is assigned FALSE.
> +
> +                      For fixed point notation the minimum width required is
> +                      ABS(width)+8
> +
> +                      For exponent notation the minimum width required is
> +                      ABS(digits)+2+log10(magnitude).
> +
> +                      Examples:
> +                      RealToString(100.0, 10, 10, a, ok)       ->  '100.000000'
> +                      RealToString(100.0, -5, 12, a, ok)       ->  '  1.00000E+2'
> +
> +                      RealToString(123.456789, 10, 10, a, ok)  ->  '123.456789'
> +                      RealToString(123.456789, -5, 13, a, ok)  ->  '    1.23456E+2'
> +
> +                      RealToString(123.456789, -2, 15, a, ok)  ->  '          1.23E+2'
> +
> +                      if r is a NaN then the string 'nan' is returned formatted and
> +                      ok will be FALSE.
> +*)
> +
> +@findex LongRealToString
> +PROCEDURE LongRealToString (r: LONGREAL; digits, width: INTEGER;
> +                            VAR str: ARRAY OF CHAR; VAR ok: BOOLEAN) ;
> +
> +
> +(*
> +   StringToReal - converts, str, into a REAL, r. The parameter, ok, is
> +                  set to TRUE if the conversion was successful.
> +*)
> +
> +@findex StringToReal
> +PROCEDURE StringToReal (str: ARRAY OF CHAR; VAR r: REAL; VAR ok: BOOLEAN) ;
> +
> +
> +(*
> +   StringToLongReal - converts, str, into a LONGREAL, r. The parameter, ok, is
> +                      set to TRUE if the conversion was successful.
> +*)
> +
> +@findex StringToLongReal
> +PROCEDURE StringToLongReal (str: ARRAY OF CHAR; VAR r: LONGREAL; VAR ok: BOOLEAN) ;
> +
> +
> +END RealConversions.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/RealInOut, gm2-libs-pim/Strings, gm2-libs-pim/RealConversions, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/RealInOut
> +
> +@example
> +DEFINITION MODULE RealInOut ;
> +
> +EXPORT QUALIFIED SetNoOfDecimalPlaces,
> +                 ReadReal, WriteReal, WriteRealOct,
> +                 ReadLongReal, WriteLongReal, WriteLongRealOct,
> +                 ReadShortReal, WriteShortReal, WriteShortRealOct,
> +                 Done ;
> +
> +CONST
> +@findex DefaultDecimalPlaces (const)
> +   DefaultDecimalPlaces = 6 ;
> +
> +VAR
> +@findex Done (var)
> +   Done: BOOLEAN ;
> +
> +
> +(*
> +   SetNoOfDecimalPlaces - number of decimal places WriteReal and
> +                          WriteLongReal should emit.  This procedure
> +                          can be used to override the default
> +                          DefaultDecimalPlaces constant.
> +*)
> +
> +@findex SetNoOfDecimalPlaces
> +PROCEDURE SetNoOfDecimalPlaces (places: CARDINAL) ;
> +
> +
> +(*
> +   ReadReal - reads a real number, legal syntaxes include:
> +              100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
> +*)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (VAR x: REAL) ;
> +
> +
> +(*
> +   WriteReal - writes a real to the terminal. The real number
> +               is right justified and, n, is the minimum field
> +               width.
> +*)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (x: REAL; n: CARDINAL) ;
> +
> +
> +(*
> +   WriteRealOct - writes the real to terminal in octal words.
> +*)
> +
> +@findex WriteRealOct
> +PROCEDURE WriteRealOct (x: REAL) ;
> +
> +
> +(*
> +   ReadLongReal - reads a LONGREAL number, legal syntaxes include:
> +                  100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
> +*)
> +
> +@findex ReadLongReal
> +PROCEDURE ReadLongReal (VAR x: LONGREAL) ;
> +
> +
> +(*
> +   WriteLongReal - writes a LONGREAL to the terminal. The real number
> +                   is right justified and, n, is the minimum field
> +                   width.
> +*)
> +
> +@findex WriteLongReal
> +PROCEDURE WriteLongReal (x: LONGREAL; n: CARDINAL) ;
> +
> +
> +(*
> +   WriteLongRealOct - writes the LONGREAL to terminal in octal words.
> +*)
> +
> +@findex WriteLongRealOct
> +PROCEDURE WriteLongRealOct (x: LONGREAL) ;
> +
> +
> +(*
> +   ReadShortReal - reads a SHORTREAL number, legal syntaxes include:
> +                   100, 100.0, 100e0, 100E0, 100E-1, E2, +1E+2, 1e+2
> +*)
> +
> +@findex ReadShortReal
> +PROCEDURE ReadShortReal (VAR x: SHORTREAL) ;
> +
> +
> +(*
> +   WriteShortReal - writes a SHORTREAL to the terminal. The real number
> +                    is right justified and, n, is the minimum field
> +                    width.
> +*)
> +
> +@findex WriteShortReal
> +PROCEDURE WriteShortReal (x: SHORTREAL; n: CARDINAL) ;
> +
> +
> +(*
> +   WriteShortRealOct - writes the SHORTREAL to terminal in octal words.
> +*)
> +
> +@findex WriteShortRealOct
> +PROCEDURE WriteShortRealOct (x: SHORTREAL) ;
> +
> +
> +END RealInOut.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Strings, gm2-libs-pim/Termbase, gm2-libs-pim/RealInOut, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Strings
> +
> +@example
> +DEFINITION MODULE Strings ;
> +
> +EXPORT QUALIFIED Assign, Insert, Delete, Pos, Copy, ConCat, Length,
> +                 CompareStr ;
> +
> +(*
> +   Assign - dest := source.
> +*)
> +
> +@findex Assign
> +PROCEDURE Assign (VAR dest: ARRAY OF CHAR; source: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   Insert - insert the string, substr, into str at position, index.
> +            substr, is added to the end of, str, if, index >= length(str)
> +*)
> +
> +@findex Insert
> +PROCEDURE Insert (substr: ARRAY OF CHAR; VAR str: ARRAY OF CHAR;
> +                  index: CARDINAL) ;
> +
> +
> +(*
> +   Delete - delete len characters from, str, starting at, index.
> +*)
> +
> +@findex Delete
> +PROCEDURE Delete (VAR str: ARRAY OF CHAR; index: CARDINAL; length: CARDINAL) ;
> +
> +
> +(*
> +   Pos - return the first position of, substr, in, str.
> +*)
> +
> +@findex Pos
> +PROCEDURE Pos (substr, str: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +(*
> +   Copy - copy at most, length, characters in, substr, to, str,
> +          starting at position, index.
> +*)
> +
> +@findex Copy
> +PROCEDURE Copy (str: ARRAY OF CHAR;
> +                index, length: CARDINAL; VAR result: ARRAY OF CHAR) ;
> +
> +(*
> +   ConCat - concatenates two strings, s1, and, s2
> +            and places the result into, dest.
> +*)
> +
> +@findex ConCat
> +PROCEDURE ConCat (s1, s2: ARRAY OF CHAR; VAR dest: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   Length - return the length of string, s.
> +*)
> +
> +@findex Length
> +PROCEDURE Length (s: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +(*
> +   CompareStr - compare two strings, left, and, right.
> +*)
> +
> +@findex CompareStr
> +PROCEDURE CompareStr (left, right: ARRAY OF CHAR) : INTEGER ;
> +
> +
> +END Strings.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Termbase, gm2-libs-pim/Terminal, gm2-libs-pim/Strings, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Termbase
> +
> +@example
> +DEFINITION MODULE Termbase ;
> +
> +(*
> +   Initially the read routines from Keyboard and the
> +   write routine from Display is assigned to the Read,
> +   KeyPressed and Write procedures.
> +*)
> +
> +EXPORT QUALIFIED ReadProcedure, StatusProcedure, WriteProcedure,
> +                 AssignRead, AssignWrite, UnAssignRead, UnAssignWrite,
> +                 Read, KeyPressed, Write ;
> +
> +TYPE
> +@findex ReadProcedure (type)
> +   ReadProcedure = PROCEDURE (VAR CHAR) ;
> +@findex WriteProcedure (type)
> +   WriteProcedure = PROCEDURE (CHAR) ;
> +@findex StatusProcedure (type)
> +   StatusProcedure = PROCEDURE () : BOOLEAN ;
> +
> +
> +(*
> +   AssignRead - assigns a read procedure and status procedure for terminal
> +                input. Done is set to TRUE if successful. Subsequent
> +                Read and KeyPressed calls are mapped onto the user supplied
> +                procedures. The previous read and status procedures are
> +                uncovered and reused after UnAssignRead is called.
> +*)
> +
> +@findex AssignRead
> +PROCEDURE AssignRead (rp: ReadProcedure; sp: StatusProcedure;
> +                      VAR Done: BOOLEAN) ;
> +
> +
> +(*
> +   UnAssignRead - undo the last call to AssignRead and set Done to TRUE
> +                  on success.
> +*)
> +
> +@findex UnAssignRead
> +PROCEDURE UnAssignRead (VAR Done: BOOLEAN) ;
> +
> +
> +(*
> +   Read - reads a single character using the currently active read
> +          procedure.
> +*)
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +
> +
> +(*
> +   KeyPressed - returns TRUE if a character is available to be read.
> +*)
> +
> +@findex KeyPressed
> +PROCEDURE KeyPressed () : BOOLEAN ;
> +
> +
> +(*
> +   AssignWrite - assigns a write procedure for terminal output.
> +                 Done is set to TRUE if successful. Subsequent
> +                 Write calls are mapped onto the user supplied
> +                 procedure. The previous write procedure is
> +                 uncovered and reused after UnAssignWrite is called.
> +*)
> +
> +@findex AssignWrite
> +PROCEDURE AssignWrite (wp: WriteProcedure; VAR Done: BOOLEAN) ;
> +
> +
> +(*
> +   UnAssignWrite - undo the last call to AssignWrite and set Done to TRUE
> +                   on success.
> +*)
> +
> +@findex UnAssignWrite
> +PROCEDURE UnAssignWrite (VAR Done: BOOLEAN) ;
> +
> +
> +(*
> +   Write - writes a single character using the currently active write
> +           procedure.
> +*)
> +
> +@findex Write
> +PROCEDURE Write (VAR ch: CHAR) ;
> +
> +
> +END Termbase.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/Terminal, gm2-libs-pim/TimeDate, gm2-libs-pim/Termbase, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/Terminal
> +
> +@example
> +DEFINITION MODULE Terminal ;
> +
> +(*
> +   It provides simple terminal input output
> +   routines which all utilize the TermBase module.
> +*)
> +
> +EXPORT QUALIFIED Read, KeyPressed, ReadAgain, ReadString, Write,
> +                 WriteString, WriteLn ;
> +
> +
> +(*
> +   Read - reads a single character.
> +*)
> +
> +@findex Read
> +PROCEDURE Read (VAR ch: CHAR) ;
> +
> +
> +(*
> +   KeyPressed - returns TRUE if a character can be read without blocking
> +                the caller.
> +*)
> +
> +@findex KeyPressed
> +PROCEDURE KeyPressed () : BOOLEAN ;
> +
> +
> +(*
> +   ReadString - reads a sequence of characters.
> +                Tabs are expanded into 8 spaces and <cr> or <lf> terminates
> +                the string.
> +*)
> +
> +@findex ReadString
> +PROCEDURE ReadString (VAR s: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   ReadAgain - makes the last character readable again.
> +*)
> +
> +@findex ReadAgain
> +PROCEDURE ReadAgain ;
> +
> +
> +(*
> +   Write - writes a single character to the Termbase module.
> +*)
> +
> +@findex Write
> +PROCEDURE Write (ch: CHAR) ;
> +
> +
> +(*
> +   WriteString - writes out a string which is terminated by a <nul>
> +                 character or the end of string HIGH(s).
> +*)
> +
> +@findex WriteString
> +PROCEDURE WriteString (s: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   WriteLn - writes a lf character.
> +*)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn ;
> +
> +
> +END Terminal.
> +@end example
> +@page
> +
> +@node gm2-libs-pim/TimeDate, , gm2-libs-pim/Terminal, PIM and Logitech 3.0 Compatible
> +@subsection gm2-libs-pim/TimeDate
> +
> +@example
> +DEFINITION MODULE TimeDate ;
> +
> +(*
> +   Legacy compatibility - you are advised to use cleaner
> +   designed modules based on 'man 3 strtime'
> +   and friends for new projects as the day value here is ugly.
> +   [it was mapped onto MSDOS pre 2000].
> +*)
> +
> +EXPORT QUALIFIED Time, GetTime, SetTime, CompareTime, TimeToZero,
> +                 TimeToString ;
> +
> +TYPE
> +(*
> +   day holds:  bits 0..4 = day of month (1..31)
> +                    5..8 = month of year (1..12)
> +                    9..  = year - 1900
> +   minute holds:    hours * 60 + minutes
> +   millisec holds:  seconds * 1000 + millisec
> +                    which is reset to 0 every minute
> +*)
> +
> +   Time = RECORD
> +             day, minute, millisec: CARDINAL ;
> +          END ;
> +
> +
> +(*
> +   GetTime - returns the current date and time.
> +*)
> +
> +@findex GetTime
> +PROCEDURE GetTime (VAR curTime: Time) ;
> +
> +
> +(*
> +   SetTime - does nothing, but provides compatibility with
> +             the Logitech-3.0 library.
> +*)
> +
> +@findex SetTime
> +PROCEDURE SetTime (curTime: Time) ;
> +
> +
> +(*
> +   CompareTime - compare two dates and time which returns:
> +
> +                 -1  if t1 < t2
> +                  0  if t1 = t2
> +                  1  if t1 > t2
> +*)
> +
> +@findex CompareTime
> +PROCEDURE CompareTime (t1, t2: Time) : INTEGER ;
> +
> +
> +(*
> +   TimeToZero - initializes, t, to zero.
> +*)
> +
> +@findex TimeToZero
> +PROCEDURE TimeToZero (VAR t: Time) ;
> +
> +
> +(*
> +   TimeToString - convert time, t, to a string.
> +                  The string, s, should be at least 19 characters
> +                  long and the returned string will be
> +
> +                  yyyy-mm-dd hh:mm:ss
> +*)
> +
> +@findex TimeToString
> +PROCEDURE TimeToString (t: Time; VAR s: ARRAY OF CHAR) ;
> +
> +
> +END TimeDate.
> +@end example
> +@page
> +
> +
> +@c ------------------------------------------------------------
> +@node PIM coroutine support, M2 ISO Libraries, PIM and Logitech 3.0 Compatible, Libraries
> +@section PIM coroutine support
> +
> +@c README.texi describes the PIM coroutine libraries.
> +@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
> +@c
> +@c This is part of the GM2 manual.
> +@c For copying conditions, see the file gcc/doc/include/fdl.texi.
> +
> +This directory contains a PIM @code{SYSTEM} containing the
> +@code{PROCESS} primitives built on top of @code{gthread}s.
> +@menu
> +* gm2-libs-coroutines/Debug::Debug.def
> +* gm2-libs-coroutines/Executive::Executive.def
> +* gm2-libs-coroutines/KeyBoardLEDs::KeyBoardLEDs.def
> +* gm2-libs-coroutines/SYSTEM::SYSTEM.def
> +* gm2-libs-coroutines/TimerHandler::TimerHandler.def
> +@end menu
> +
> +@node gm2-libs-coroutines/Debug, gm2-libs-coroutines/Executive, , PIM coroutine support
> +@subsection gm2-libs-coroutines/Debug
> +
> +@example
> +DEFINITION MODULE Debug ;
> +
> +(*
> +    Description: provides some simple debugging routines.
> +*)
> +
> +EXPORT QUALIFIED Halt, DebugString, PushOutput ;
> +
> +TYPE
> +@findex WriteP (type)
> +   WriteP = PROCEDURE (CHAR) ;
> +
> +
> +(*
> +   Halt - writes a message in the format:
> +          Module:Line:Message
> +
> +          It then terminates by calling HALT.
> +*)
> +
> +@findex Halt
> +PROCEDURE Halt (File    : ARRAY OF CHAR;
> +                LineNo  : CARDINAL;
> +                Function,
> +                Message : ARRAY OF CHAR) ;
> +
> +
> +(*
> +   DebugString - writes a string to the debugging device (Scn.Write).
> +                 It interprets \n as carriage return, linefeed.
> +*)
> +
> +@findex DebugString
> +PROCEDURE DebugString (a: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   PushOutput - pushes the output procedure, p, which is used Debug.
> +*)
> +
> +@findex PushOutput
> +PROCEDURE PushOutput (p: WriteP) ;
> +
> +
> +(*
> +   PopOutput - pops the current output procedure from the stack.
> +*)
> +
> +@findex PopOutput
> +PROCEDURE PopOutput ;
> +
> +
> +END Debug.
> +@end example
> +@page
> +
> +@node gm2-libs-coroutines/Executive, gm2-libs-coroutines/KeyBoardLEDs, gm2-libs-coroutines/Debug, PIM coroutine support
> +@subsection gm2-libs-coroutines/Executive
> +
> +@example
> +DEFINITION MODULE Executive ;
> +
> +EXPORT QUALIFIED SEMAPHORE, DESCRIPTOR,
> +                 InitProcess, KillProcess, Resume, Suspend, InitSemaphore,
> +                 Wait, Signal, WaitForIO, Ps, GetCurrentProcess,
> +                 RotateRunQueue, ProcessName, DebugProcess ;
> +
> +TYPE
> +@findex SEMAPHORE (type)
> +   SEMAPHORE ;         (* defines Dijkstra's semaphores *)
> +@findex DESCRIPTOR (type)
> +   DESCRIPTOR ;        (* handle onto a process         *)
> +
> +
> +(*
> +   InitProcess - initializes a process which is held in the suspended
> +                 state. When the process is resumed it will start executing
> +                 procedure, p. The process has a maximum stack size of,
> +                 StackSize, bytes and its textual name is, Name.
> +                 The StackSize should be at least 5000 bytes.
> +*)
> +
> +@findex InitProcess
> +PROCEDURE InitProcess (p: PROC; StackSize: CARDINAL;
> +                       Name: ARRAY OF CHAR) : DESCRIPTOR ;
> +
> +
> +(*
> +   KillProcess - kills the current process. Notice that if InitProcess
> +                 is called again, it might reuse the DESCRIPTOR of the
> +                 killed process. It is the responsibility of the caller
> +                 to ensure all other processes understand this process
> +                 is different.
> +*)
> +
> +@findex KillProcess
> +PROCEDURE KillProcess ;
> +
> +
> +(*
> +   Resume - resumes a suspended process. If all is successful then the process, p,
> +            is returned. If it fails then NIL is returned.
> +*)
> +
> +@findex Resume
> +PROCEDURE Resume (d: DESCRIPTOR) : DESCRIPTOR ;
> +
> +
> +(*
> +   Suspend - suspend the calling process.
> +             The process can only continue running if another process
> +             Resumes it.
> +*)
> +
> +@findex Suspend
> +PROCEDURE Suspend ;
> +
> +
> +(*
> +   InitSemaphore - creates a semaphore whose initial value is, v, and
> +                   whose name is, Name.
> +*)
> +
> +@findex InitSemaphore
> +PROCEDURE InitSemaphore (v: CARDINAL; Name: ARRAY OF CHAR) : SEMAPHORE ;
> +
> +
> +(*
> +   Wait - performs dijkstra's P operation on a semaphore.
> +          A process which calls this procedure will
> +          wait until the value of the semaphore is > 0
> +          and then it will decrement this value.
> +*)
> +
> +@findex Wait
> +PROCEDURE Wait (s: SEMAPHORE) ;
> +
> +
> +(*
> +   Signal - performs dijkstra's V operation on a semaphore.
> +            A process which calls the procedure will increment
> +            the semaphores value.
> +*)
> +
> +@findex Signal
> +PROCEDURE Signal (s: SEMAPHORE) ;
> +
> +
> +(*
> +   WaitForIO - waits for an interrupt to occur on vector, VectorNo.
> +*)
> +
> +@findex WaitForIO
> +PROCEDURE WaitForIO (VectorNo: CARDINAL) ;
> +
> +
> +(*
> +   Ps - displays a process list together with process status.
> +*)
> +
> +@findex Ps
> +PROCEDURE Ps ;
> +
> +
> +(*
> +   GetCurrentProcess - returns the descriptor of the current running
> +                       process.
> +*)
> +
> +@findex GetCurrentProcess
> +PROCEDURE GetCurrentProcess () : DESCRIPTOR ;
> +
> +
> +(*
> +   RotateRunQueue - rotates the process run queue.
> +                    It does not call the scheduler.
> +*)
> +
> +@findex RotateRunQueue
> +PROCEDURE RotateRunQueue ;
> +
> +
> +(*
> +   ProcessName - displays the name of process, d, through
> +                 DebugString.
> +*)
> +
> +@findex ProcessName
> +PROCEDURE ProcessName (d: DESCRIPTOR) ;
> +
> +
> +(*
> +   DebugProcess - gdb debug handle to enable users to debug deadlocked
> +                  semaphore processes.
> +*)
> +
> +@findex DebugProcess
> +PROCEDURE DebugProcess (d: DESCRIPTOR) ;
> +
> +
> +END Executive.
> +@end example
> +@page
> +
> +@node gm2-libs-coroutines/KeyBoardLEDs, gm2-libs-coroutines/SYSTEM, gm2-libs-coroutines/Executive, PIM coroutine support
> +@subsection gm2-libs-coroutines/KeyBoardLEDs
> +
> +@example
> +DEFINITION MODULE KeyBoardLEDs ;
> +
> +
> +EXPORT QUALIFIED SwitchLeds,
> +                 SwitchScroll, SwitchNum, SwitchCaps ;
> +
> +
> +(*
> +   SwitchLeds - switch the keyboard LEDs to the state defined
> +                by the BOOLEAN variables. TRUE = ON.
> +*)
> +
> +@findex SwitchLeds
> +PROCEDURE SwitchLeds (NumLock, CapsLock, ScrollLock: BOOLEAN) ;
> +
> +
> +(*
> +   SwitchScroll - switchs the scroll LED on or off.
> +*)
> +
> +@findex SwitchScroll
> +PROCEDURE SwitchScroll (Scroll: BOOLEAN) ;
> +
> +
> +(*
> +   SwitchNum - switches the Num LED on or off.
> +*)
> +
> +@findex SwitchNum
> +PROCEDURE SwitchNum (Num: BOOLEAN) ;
> +
> +
> +(*
> +   SwitchCaps - switches the Caps LED on or off.
> +*)
> +
> +@findex SwitchCaps
> +PROCEDURE SwitchCaps (Caps: BOOLEAN) ;
> +
> +
> +END KeyBoardLEDs.
> +@end example
> +@page
> +
> +@node gm2-libs-coroutines/SYSTEM, gm2-libs-coroutines/TimerHandler, gm2-libs-coroutines/KeyBoardLEDs, PIM coroutine support
> +@subsection gm2-libs-coroutines/SYSTEM
> +
> +@example
> +DEFINITION MODULE SYSTEM ;
> +
> +(* This module is designed to be used on a native operating system
> +   rather than an embedded system as it implements the coroutine
> +   primitives TRANSFER, IOTRANSFER and
> +   NEWPROCESS through the GNU Pthread library.  *)
> +
> +FROM COROUTINES IMPORT PROTECTION ;
> +
> +EXPORT QUALIFIED (* the following are built into the compiler: *)
> +                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
> +                 Target specific data types. *)
> +                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE,
> +                 (* SIZE is exported depending upon -fpim2 and
> +                    -fpedantic.  *)
> +                 (* The rest are implemented in SYSTEM.mod.  *)
> +                 PROCESS, TRANSFER, NEWPROCESS, IOTRANSFER,
> +                 LISTEN,
> +                 ListenLoop, TurnInterrupts,
> +                 (* Internal GM2 compiler functions.  *)
> +                 ShiftVal, ShiftLeft, ShiftRight,
> +                 RotateVal, RotateLeft, RotateRight ;
> +
> +
> +TYPE
> +@findex PROCESS (type)
> +   PROCESS  = RECORD
> +                 context: INTEGER ;
> +@findex END (type)
> +              END ;
> +(* all the following types are declared internally to gm2
> +   (* Target specific data types.  *)
> +*)
> +
> +
> +(*
> +   TRANSFER - save the current volatile environment into, p1.
> +              Restore the volatile environment from, p2.
> +*)
> +
> +@findex TRANSFER
> +PROCEDURE TRANSFER (VAR p1: PROCESS; p2: PROCESS) ;
> +
> +
> +(*
> +   NEWPROCESS - p is a parameterless procedure, a, is the origin of
> +                the workspace used for the process stack and containing
> +                the volatile environment of the process.  StackSize, is
> +                the maximum size of the stack in bytes which can be used
> +                by this process.  new, is the new process.
> +*)
> +
> +@findex NEWPROCESS
> +PROCEDURE NEWPROCESS (p: PROC; a: ADDRESS; StackSize: CARDINAL; VAR new: PROCESS) ;
> +
> +
> +(*
> +   IOTRANSFER - saves the current volatile environment into, First,
> +                and restores volatile environment, Second.
> +                When an interrupt, InterruptNo, is encountered then
> +                the reverse takes place.  (The then current volatile
> +                environment is shelved onto Second and First is resumed).
> +
> +                NOTE: that upon interrupt the Second might not be the
> +                      same process as that before the original call to
> +                      IOTRANSFER.
> +*)
> +
> +@findex IOTRANSFER
> +PROCEDURE IOTRANSFER (VAR First, Second: PROCESS; InterruptNo: CARDINAL) ;
> +
> +
> +(*
> +   LISTEN - briefly listen for any interrupts.
> +*)
> +
> +@findex LISTEN
> +PROCEDURE LISTEN ;
> +
> +
> +(*
> +   ListenLoop - should be called instead of users writing:
> +
> +                LOOP
> +                   LISTEN
> +                END
> +
> +                It performs the same function but yields
> +                control back to the underlying operating system
> +                via a call to pth_select.
> +                It also checks for deadlock.
> +                This function returns when an interrupt occurs ie
> +                a file descriptor becomes ready or a time event
> +                expires.  See the module RTint.
> +*)
> +
> +@findex ListenLoop
> +PROCEDURE ListenLoop ;
> +
> +
> +(*
> +   TurnInterrupts - switches processor interrupts to the protection
> +                    level, to.  It returns the old value.
> +*)
> +
> +@findex TurnInterrupts
> +PROCEDURE TurnInterrupts (to: PROTECTION) : PROTECTION ;
> +
> +
> +(*
> +   all the functions below are declared internally to gm2
> +   ====================================================
> +
> +@findex ADR
> +PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
> +  (* Returns the address of variable v. *)
> +
> +@findex SIZE
> +PROCEDURE SIZE (v: <type>) : ZType;
> +  (* Returns the number of BYTES used to store a v of
> +     any specified <type>.  Only available if -fpim2 is used.
> +  *)
> +
> +@findex TSIZE
> +PROCEDURE TSIZE (<type>) : CARDINAL;
> +  (* Returns the number of BYTES used to store a value of the
> +     specified <type>.
> +  *)
> +
> +@findex ROTATE
> +PROCEDURE ROTATE (val: <a set type>;
> +                  num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by rotating up or down
> +     (left or right) by the absolute value of num.  The direction is
> +     down if the sign of num is negative, otherwise the direction is up.
> +  *)
> +
> +@findex SHIFT
> +PROCEDURE SHIFT (val: <a set type>;
> +                 num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by shifting up or down
> +     (left or right) by the absolute value of num, introducing
> +     zeros as necessary.  The direction is down if the sign of
> +     num is negative, otherwise the direction is up.
> +  *)
> +
> +@findex THROW
> +PROCEDURE THROW (i: INTEGER) ;
> +  (*
> +     THROW is a GNU extension and was not part of the PIM or ISO
> +     standards.  It throws an exception which will be caught by the EXCEPT
> +     block (assuming it exists).  This is a compiler builtin function which
> +     interfaces to the GCC exception handling runtime system.
> +     GCC uses the term throw, hence the naming distinction between
> +     the GCC builtin and the Modula-2 runtime library procedure Raise.
> +     The later library procedure Raise will call SYSTEM.THROW after
> +     performing various housekeeping activities.
> +  *)
> +
> +@findex TBITSIZE
> +PROCEDURE TBITSIZE (<type>) : CARDINAL ;
> +  (* Returns the minimum number of bits necessary to represent
> +     <type>.  This procedure function is only useful for determining
> +     the number of bits used for any type field within a packed RECORD.
> +     It is not particularly useful elsewhere since <type> might be
> +     optimized for speed, for example a BOOLEAN could occupy a WORD.
> +  *)
> +*)
> +
> +(* The following procedures are invoked by GNU Modula-2 to
> +   shift non word sized set types.  They are not strictly part
> +   of the core PIM Modula-2, however they are used
> +   to implement the SHIFT procedure defined above,
> +   which are in turn used by the Logitech compatible libraries.
> +
> +   Users will access these procedures by using the procedure
> +   SHIFT above and GNU Modula-2 will map SHIFT onto one of
> +   the following procedures.
> +*)
> +
> +(*
> +   ShiftVal - is a runtime procedure whose job is to implement
> +              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
> +              inline a SHIFT of a single WORD sized set and will
> +              only call this routine for larger sets.
> +*)
> +
> +@findex ShiftVal
> +PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
> +                    SetSizeInBits: CARDINAL;
> +                    ShiftCount: INTEGER) ;
> +
> +
> +(*
> +   ShiftLeft - performs the shift left for a multi word set.
> +               This procedure might be called by the back end of
> +               GNU Modula-2 depending whether amount is known at
> +               compile time.
> +*)
> +
> +@findex ShiftLeft
> +PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +(*
> +   ShiftRight - performs the shift left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex ShiftRight
> +PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateVal - is a runtime procedure whose job is to implement
> +               the ROTATE procedure of ISO SYSTEM.  GNU Modula-2 will
> +               inline a ROTATE of a single WORD (or less)
> +               sized set and will only call this routine for
> +               larger sets.
> +*)
> +
> +@findex RotateVal
> +PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     RotateCount: INTEGER) ;
> +
> +
> +(*
> +   RotateLeft - performs the rotate left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known
> +                at compile time.
> +*)
> +
> +@findex RotateLeft
> +PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      RotateCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateRight - performs the rotate right for a multi word set.
> +                 This procedure might be called by the back end of
> +                 GNU Modula-2 depending whether amount is known at
> +                 compile time.
> +*)
> +
> +@findex RotateRight
> +PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
> +                       SetSizeInBits: CARDINAL;
> +                       RotateCount: CARDINAL) ;
> +
> +
> +END SYSTEM.
> +@end example
> +@page
> +
> +@node gm2-libs-coroutines/TimerHandler, , gm2-libs-coroutines/SYSTEM, PIM coroutine support
> +@subsection gm2-libs-coroutines/TimerHandler
> +
> +@example
> +DEFINITION MODULE TimerHandler ;
> +
> +(* It also provides the Executive with a basic round robin scheduler.  *)
> +
> +EXPORT QUALIFIED TicksPerSecond, GetTicks,
> +                 EVENT,
> +                 Sleep, ArmEvent, WaitOn, Cancel, ReArmEvent ;
> +
> +
> +CONST
> +@findex TicksPerSecond (const)
> +   TicksPerSecond =   25 ;  (* Number of ticks per second.  *)
> +
> +TYPE
> +@findex EVENT (type)
> +   EVENT ;
> +
> +
> +(*
> +   GetTicks - returns the number of ticks since boottime.
> +*)
> +
> +@findex GetTicks
> +PROCEDURE GetTicks () : CARDINAL ;
> +
> +
> +(*
> +   Sleep - suspends the current process for a time, t.
> +           The time is measured in ticks.
> +*)
> +
> +@findex Sleep
> +PROCEDURE Sleep (t: CARDINAL) ;
> +
> +
> +(*
> +   ArmEvent - initializes an event, e, to occur at time, t.
> +              The time, t, is measured in ticks.
> +              The event is NOT placed onto the event queue.
> +*)
> +
> +@findex ArmEvent
> +PROCEDURE ArmEvent (t: CARDINAL) : EVENT ;
> +
> +
> +(*
> +   WaitOn - places event, e, onto the event queue and then the calling
> +            process suspends. It is resumed up by either the event
> +            expiring or the event, e, being cancelled.
> +            TRUE is returned if the event was cancelled
> +            FALSE is returned if the event expires.
> +            The event, e, is always assigned to NIL when the function
> +            finishes.
> +*)
> +
> +@findex WaitOn
> +PROCEDURE WaitOn (VAR e: EVENT) : BOOLEAN ;
> +
> +
> +(*
> +   Cancel - cancels the event, e, on the event queue and makes
> +            the appropriate process runnable again.
> +            TRUE is returned if the event was cancelled and
> +            FALSE is returned is the event was not found or
> +                  no process was waiting on this event.
> +*)
> +
> +@findex Cancel
> +PROCEDURE Cancel (e: EVENT) : BOOLEAN ;
> +
> +
> +(*
> +   ReArmEvent - removes an event, e, from the event queue. A new time
> +                is given to this event and it is then re-inserted onto the
> +                event queue in the correct place.
> +                TRUE is returned if this occurred
> +                FALSE is returned if the event was not found.
> +*)
> +
> +@findex ReArmEvent
> +PROCEDURE ReArmEvent (e: EVENT; t: CARDINAL) : BOOLEAN ;
> +
> +
> +END TimerHandler.
> +@end example
> +@page
> +
> +
> +@c ------------------------------------------------------------
> +@node M2 ISO Libraries, , PIM coroutine support, Libraries
> +@section M2 ISO Libraries
> +
> +@c README.texi describes the ISO libraries.
> +@c Copyright @copyright{} 2000-2022 Free Software Foundation, Inc.
> +@c
> +@c This is part of the GM2 manual.
> +@c For copying conditions, see the file gcc/doc/include/fdl.texi.
> +
> +This directory contains the ISO definition modules and some
> +corresponding implementation modules.  The definition files:
> +@file{ChanConsts.def}, @file{CharClass.def}, @file{ComplexMath.def},
> +@file{ConvStringLong.def}, @file{ConvStringReal.def},
> +@file{ConvTypes.def}, @file{COROUTINES.def}, @file{EXCEPTIONS.def},
> +@file{GeneralUserExceptions.def}, @file{IOChan.def},
> +@file{IOConsts.def}, @file{IOLink.def}, @file{IOLink.def},
> +@file{IOResult.def}, @file{LongComplexMath.def}, @file{LongConv.def},
> +@file{LongIO.def}, @file{LongMath.def}, @file{LongStr.def},
> +@file{LowLong.def}, @file{LowReal.def}, @file{M2EXCEPTION.def},
> +@file{Processes.def}, @file{ProgramArgs.def}, @file{RawIO.def},
> +@file{RealConv.def}, @file{RealIO.def}, @file{RealMath.def},
> +@file{RealStr.def}, @file{RndFile.def}, @file{Semaphores.def},
> +@file{SeqFile.def}, @file{SIOResult.def}, @file{SLongIO.def},
> +@file{SRawIO.def}, @file{SRealIO.def}, @file{StdChans.def},
> +@file{STextIO.def}, @file{Storage.def}, @file{StreamFile.def},
> +@file{Strings.def}, @file{SWholeIO.def}, @file{SysClock.def},
> +@file{SYSTEM.def}, @file{TERMINATION.def}, @file{TextIO.def},
> +@file{WholeConv.def}, @file{WholeIO.def} and @file{WholeStr.def}
> +were defined by the International Standard
> +Information technology - programming languages BS ISO/IEC
> +10514-1:1996E Part 1: Modula-2, Base Language.
> +
> +The Copyright to the definition files @file{ChanConsts.def},
> +@file{CharClass.def}, @file{ComplexMath.def},
> +@file{ConvStringLong.def}, @file{ConvStringReal.def},
> +@file{ConvTypes.def}, @file{COROUTINES.def}, @file{EXCEPTIONS.def},
> +@file{GeneralUserExceptions.def}, @file{IOChan.def},
> +@file{IOConsts.def}, @file{IOLink.def}, @file{IOLink.def},
> +@file{IOResult.def}, @file{LongComplexMath.def}, @file{LongConv.def},
> +@file{LongIO.def}, @file{LongMath.def}, @file{LongStr.def},
> +@file{LowLong.def}, @file{LowReal.def}, @file{M2EXCEPTION.def},
> +@file{Processes.def}, @file{ProgramArgs.def}, @file{RawIO.def},
> +@file{RealConv.def}, @file{RealIO.def}, @file{RealMath.def},
> +@file{RealStr.def}, @file{RndFile.def}, @file{Semaphores.def},
> +@file{SeqFile.def}, @file{SIOResult.def}, @file{SLongIO.def},
> +@file{SRawIO.def}, @file{SRealIO.def}, @file{StdChans.def},
> +@file{STextIO.def}, @file{Storage.def}, @file{StreamFile.def},
> +@file{Strings.def}, @file{SWholeIO.def}, @file{SysClock.def},
> +@file{SYSTEM.def}, @file{TERMINATION.def}, @file{TextIO.def},
> +@file{WholeConv.def}, @file{WholeIO.def} and @file{WholeStr.def}
> +belong to ISO/IEC (International Organization for Standardization and
> +International Electrotechnical Commission).  The licence allows them
> +to be distributed with the compiler (as described on page
> +707 of the Information technology - Programming languages Part 1:
> +Modula-2, Base Language.  BS ISO/IEC 10514-1:1996).
> +
> +All implementation modules and @file{ClientSocket.def},
> +@file{LongWholeIO.def}, @file{M2RTS.def}, @file{MemStream.def},
> +@file{pth.def}, @file{RandomNumber.def}, @file{RTdata.def},
> +@file{RTentity.def}, @file{RTfio.def}, @file{RTio.def},
> +@file{ShortComplexMath.def}, @file{ShortIO.def},
> +@file{ShortWholeIO.def}, @file{SimpleCipher.def},
> +@file{SLongWholeIO.def}, @file{SShortIO.def},
> +@file{SShortWholeIO.def}, @file{StringChan.def} and
> +@file{wraptime.def} are Copyright of the FSF and are held under the
> +GPLv3 with runtime exceptions.
> +
> +Under Section 7 of GPL version 3, you are granted additional
> +permissions described in the GCC Runtime Library Exception, version
> +3.1, as published by the Free Software Foundation.
> +
> +You should have received a copy of the GNU General Public License and
> +a copy of the GCC Runtime Library Exception along with this program;
> +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> +@url{http://www.gnu.org/licenses/}.
> +
> +Notice that GNU Modula-2 contains additional libraries for
> +input/output of @code{SHORTREAL}, @code{SHORTCARD}, @code{SHORTINT},
> +@code{LONGCARD}, @code{LONGINT} data types.  It also provides a
> +@code{RandomNumber}, @code{SimpleCipher} and @code{ClientSocket}
> +modules as well as low level modules which allow the IO libraries to
> +coexist with their PIM counterparts.
> +@menu
> +* gm2-libs-iso/COROUTINES::COROUTINES.def
> +* gm2-libs-iso/ChanConsts::ChanConsts.def
> +* gm2-libs-iso/CharClass::CharClass.def
> +* gm2-libs-iso/ClientSocket::ClientSocket.def
> +* gm2-libs-iso/ComplexMath::ComplexMath.def
> +* gm2-libs-iso/ConvStringLong::ConvStringLong.def
> +* gm2-libs-iso/ConvStringReal::ConvStringReal.def
> +* gm2-libs-iso/ConvTypes::ConvTypes.def
> +* gm2-libs-iso/EXCEPTIONS::EXCEPTIONS.def
> +* gm2-libs-iso/ErrnoCategory::ErrnoCategory.def
> +* gm2-libs-iso/GeneralUserExceptions::GeneralUserExceptions.def
> +* gm2-libs-iso/IOChan::IOChan.def
> +* gm2-libs-iso/IOConsts::IOConsts.def
> +* gm2-libs-iso/IOLink::IOLink.def
> +* gm2-libs-iso/IOResult::IOResult.def
> +* gm2-libs-iso/LongComplexMath::LongComplexMath.def
> +* gm2-libs-iso/LongConv::LongConv.def
> +* gm2-libs-iso/LongIO::LongIO.def
> +* gm2-libs-iso/LongMath::LongMath.def
> +* gm2-libs-iso/LongStr::LongStr.def
> +* gm2-libs-iso/LongWholeIO::LongWholeIO.def
> +* gm2-libs-iso/LowLong::LowLong.def
> +* gm2-libs-iso/LowReal::LowReal.def
> +* gm2-libs-iso/LowShort::LowShort.def
> +* gm2-libs-iso/M2EXCEPTION::M2EXCEPTION.def
> +* gm2-libs-iso/M2RTS::M2RTS.def
> +* gm2-libs-iso/MemStream::MemStream.def
> +* gm2-libs-iso/Preemptive::Preemptive.def
> +* gm2-libs-iso/Processes::Processes.def
> +* gm2-libs-iso/ProgramArgs::ProgramArgs.def
> +* gm2-libs-iso/RTco::RTco.def
> +* gm2-libs-iso/RTdata::RTdata.def
> +* gm2-libs-iso/RTentity::RTentity.def
> +* gm2-libs-iso/RTfio::RTfio.def
> +* gm2-libs-iso/RTgen::RTgen.def
> +* gm2-libs-iso/RTgenif::RTgenif.def
> +* gm2-libs-iso/RTio::RTio.def
> +* gm2-libs-iso/RandomNumber::RandomNumber.def
> +* gm2-libs-iso/RawIO::RawIO.def
> +* gm2-libs-iso/RealConv::RealConv.def
> +* gm2-libs-iso/RealIO::RealIO.def
> +* gm2-libs-iso/RealMath::RealMath.def
> +* gm2-libs-iso/RealStr::RealStr.def
> +* gm2-libs-iso/RndFile::RndFile.def
> +* gm2-libs-iso/SIOResult::SIOResult.def
> +* gm2-libs-iso/SLongIO::SLongIO.def
> +* gm2-libs-iso/SLongWholeIO::SLongWholeIO.def
> +* gm2-libs-iso/SRawIO::SRawIO.def
> +* gm2-libs-iso/SRealIO::SRealIO.def
> +* gm2-libs-iso/SShortIO::SShortIO.def
> +* gm2-libs-iso/SShortWholeIO::SShortWholeIO.def
> +* gm2-libs-iso/STextIO::STextIO.def
> +* gm2-libs-iso/SWholeIO::SWholeIO.def
> +* gm2-libs-iso/SYSTEM::SYSTEM.def
> +* gm2-libs-iso/Semaphores::Semaphores.def
> +* gm2-libs-iso/SeqFile::SeqFile.def
> +* gm2-libs-iso/ShortComplexMath::ShortComplexMath.def
> +* gm2-libs-iso/ShortIO::ShortIO.def
> +* gm2-libs-iso/ShortWholeIO::ShortWholeIO.def
> +* gm2-libs-iso/SimpleCipher::SimpleCipher.def
> +* gm2-libs-iso/StdChans::StdChans.def
> +* gm2-libs-iso/Storage::Storage.def
> +* gm2-libs-iso/StreamFile::StreamFile.def
> +* gm2-libs-iso/StringChan::StringChan.def
> +* gm2-libs-iso/Strings::Strings.def
> +* gm2-libs-iso/SysClock::SysClock.def
> +* gm2-libs-iso/TERMINATION::TERMINATION.def
> +* gm2-libs-iso/TermFile::TermFile.def
> +* gm2-libs-iso/TextIO::TextIO.def
> +* gm2-libs-iso/WholeConv::WholeConv.def
> +* gm2-libs-iso/WholeIO::WholeIO.def
> +* gm2-libs-iso/WholeStr::WholeStr.def
> +* gm2-libs-iso/wrapsock::wrapsock.def
> +* gm2-libs-iso/wraptime::wraptime.def
> +@end menu
> +
> +@node gm2-libs-iso/COROUTINES, gm2-libs-iso/ChanConsts, , M2 ISO Libraries
> +@subsection gm2-libs-iso/COROUTINES
> +
> +@example
> +DEFINITION MODULE COROUTINES;
> +
> +(* Facilities for coroutines and the handling of interrupts *)
> +
> +IMPORT SYSTEM ;
> +
> +
> +CONST
> +@findex UnassignedPriority (const)
> +  UnassignedPriority = 0 ;
> +
> +TYPE
> +@findex COROUTINE (type)
> +  COROUTINE ; (* Values of this type are created dynamically by NEWCOROUTINE
> +                 and identify the coroutine in subsequent operations *)
> +@findex INTERRUPTSOURCE (type)
> +  INTERRUPTSOURCE = CARDINAL ;
> +@findex PROTECTION (type)
> +  PROTECTION = [UnassignedPriority..7] ;
> +
> +
> +@findex NEWCOROUTINE
> +PROCEDURE NEWCOROUTINE (procBody: PROC;
> +                        workspace: SYSTEM.ADDRESS;
> +                        size: CARDINAL;
> +                        VAR cr: COROUTINE;
> +                        [initProtection: PROTECTION = UnassignedPriority]);
> +  (* Creates a new coroutine whose body is given by procBody, and
> +     returns the identity of the coroutine in cr. workspace is a
> +     pointer to the work space allocated to the coroutine; size
> +     specifies the size of this workspace in terms of SYSTEM.LOC.
> +
> +     The optarg, initProtection, may contain a single parameter which
> +     specifies the initial protection level of the coroutine.
> +  *)
> +
> +@findex TRANSFER
> +PROCEDURE TRANSFER (VAR from: COROUTINE; to: COROUTINE);
> +  (* Returns the identity of the calling coroutine in from, and
> +     transfers control to the coroutine specified by to.
> +  *)
> +
> +@findex IOTRANSFER
> +PROCEDURE IOTRANSFER (VAR from: COROUTINE; to: COROUTINE);
> +  (* Returns the identity of the calling coroutine in from and
> +     transfers control to the coroutine specified by to.  On
> +     occurrence of an interrupt, associated with the caller, control
> +     is transferred back to the caller, and the identity of the
> +     interrupted coroutine is returned in from.  The calling coroutine
> +     must be associated with a source of interrupts.
> +  *)
> +
> +@findex ATTACH
> +PROCEDURE ATTACH (source: INTERRUPTSOURCE);
> +  (* Associates the specified source of interrupts with the calling
> +     coroutine. *)
> +
> +@findex DETACH
> +PROCEDURE DETACH (source: INTERRUPTSOURCE);
> +  (* Dissociates the specified source of interrupts from the calling
> +     coroutine. *)
> +
> +@findex IsATTACHED
> +PROCEDURE IsATTACHED (source: INTERRUPTSOURCE): BOOLEAN;
> +  (* Returns TRUE if and only if the specified source of interrupts is
> +     currently associated with a coroutine; otherwise returns FALSE.
> +  *)
> +
> +@findex HANDLER
> +PROCEDURE HANDLER (source: INTERRUPTSOURCE): COROUTINE;
> +  (* Returns the coroutine, if any, that is associated with the source
> +     of interrupts. The result is undefined if IsATTACHED(source) =
> +     FALSE.
> +  *)
> +
> +@findex CURRENT
> +PROCEDURE CURRENT (): COROUTINE;
> +  (* Returns the identity of the calling coroutine. *)
> +
> +@findex LISTEN
> +PROCEDURE LISTEN (p: PROTECTION);
> +  (* Momentarily changes the protection of the calling coroutine to
> +     p. *)
> +
> +@findex PROT
> +PROCEDURE PROT (): PROTECTION;
> +  (* Returns the protection of the calling coroutine. *)
> +
> +
> +(*
> +   TurnInterrupts - switches processor interrupts to the protection
> +                    level, to.  It returns the old value.
> +*)
> +
> +@findex TurnInterrupts
> +PROCEDURE TurnInterrupts (to: PROTECTION) : PROTECTION ;
> +
> +
> +(*
> +   ListenLoop - should be called instead of users writing:
> +
> +                LOOP
> +                   LISTEN
> +                END
> +
> +                It performs the same function but yields
> +                control back to the underlying operating system.
> +                It also checks for deadlock.
> +                Note that this function does return when an interrupt occurs.
> +                (File descriptor becomes ready or time event expires).
> +*)
> +
> +@findex ListenLoop
> +PROCEDURE ListenLoop ;
> +
> +
> +END COROUTINES.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ChanConsts, gm2-libs-iso/CharClass, gm2-libs-iso/COROUTINES, M2 ISO Libraries
> +@subsection gm2-libs-iso/ChanConsts
> +
> +@example
> +DEFINITION MODULE ChanConsts;
> +
> +  (* Common types and values for channel open requests and results *)
> +
> +TYPE
> +@findex ChanFlags (type)
> +  ChanFlags =        (* Request flags possibly given when a channel is opened *)
> +  ( readFlag,        (* input operations are requested/available *)
> +    writeFlag,       (* output operations are requested/available *)
> +    oldFlag,         (* a file may/must/did exist before the channel is opened *)
> +    textFlag,        (* text operations are requested/available *)
> +    rawFlag,         (* raw operations are requested/available *)
> +    interactiveFlag, (* interactive use is requested/applies *)
> +    echoFlag         (* echoing by interactive device on removal of characters from input
> +                        stream requested/applies *)
> +  );
> +
> +@findex FlagSet (type)
> +  FlagSet = SET OF ChanFlags;
> +
> +  (* Singleton values of FlagSet, to allow for example, read + write *)
> +
> +CONST
> +@findex read (const)
> +  read = FlagSet@{readFlag@};   (* input operations are requested/available *)
> +@findex write (const)
> +  write = FlagSet@{writeFlag@}; (* output operations are requested/available *)
> +@findex old (const)
> +  old = FlagSet@{oldFlag@};     (* a file may/must/did exist before the channel is opened *)
> +@findex text (const)
> +  text = FlagSet@{textFlag@};   (* text operations are requested/available *)
> +@findex raw (const)
> +  raw = FlagSet@{rawFlag@};     (* raw operations are requested/available *)
> +@findex interactive (const)
> +  interactive = FlagSet@{interactiveFlag@}; (* interactive use is requested/applies *)
> +@findex echo (const)
> +  echo = FlagSet@{echoFlag@};   (* echoing by interactive device on removal of characters from
> +                                 input stream requested/applies *)
> +
> +TYPE
> +@findex OpenResults (type)
> +  OpenResults =        (* Possible results of open requests *)
> +    (opened,           (* the open succeeded as requested *)
> +     wrongNameFormat,  (* given name is in the wrong format for the implementation *)
> +     wrongFlags,       (* given flags include a value that does not apply to the device *)
> +     tooManyOpen,      (* this device cannot support any more open channels *)
> +     outOfChans,       (* no more channels can be allocated *)
> +     wrongPermissions, (* file or directory permissions do not allow request *)
> +     noRoomOnDevice,   (* storage limits on the device prevent the open *)
> +     noSuchFile,       (* a needed file does not exist *)
> +     fileExists,       (* a file of the given name already exists when a new one is required *)
> +     wrongFileType,    (* the file is of the wrong type to support the required operations *)
> +     noTextOperations, (* text operations have been requested, but are not supported *)
> +     noRawOperations,  (* raw operations have been requested, but are not supported *)
> +     noMixedOperations,(* text and raw operations have been requested, but they
> +                          are not supported in combination *)
> +     alreadyOpen,      (* the source/destination is already open for operations not supported
> +                          in combination with the requested operations *)
> +     otherProblem      (* open failed for some other reason *)
> +    );
> +
> +END ChanConsts.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/CharClass, gm2-libs-iso/ClientSocket, gm2-libs-iso/ChanConsts, M2 ISO Libraries
> +@subsection gm2-libs-iso/CharClass
> +
> +@example
> +DEFINITION MODULE CharClass;
> +
> +  (* Classification of values of the type CHAR *)
> +
> +@findex IsNumeric
> +PROCEDURE IsNumeric (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch is classified as a numeric character *)
> +
> +@findex IsLetter
> +PROCEDURE IsLetter (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch is classified as a letter *)
> +
> +@findex IsUpper
> +PROCEDURE IsUpper (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch is classified as an upper case letter *)
> +
> +@findex IsLower
> +PROCEDURE IsLower (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch is classified as a lower case letter *)
> +
> +@findex IsControl
> +PROCEDURE IsControl (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch represents a control function *)
> +
> +@findex IsWhiteSpace
> +PROCEDURE IsWhiteSpace (ch: CHAR): BOOLEAN;
> +  (* Returns TRUE if and only if ch represents a space character or a format effector *)
> +
> +END CharClass.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ClientSocket, gm2-libs-iso/ComplexMath, gm2-libs-iso/CharClass, M2 ISO Libraries
> +@subsection gm2-libs-iso/ClientSocket
> +
> +@example
> +DEFINITION MODULE ClientSocket ;
> +
> +FROM IOChan IMPORT ChanId ;
> +FROM ChanConsts IMPORT FlagSet, OpenResults ;
> +
> +
> +(*
> +   OpenSocket - opens a TCP client connection to host:port.
> +*)
> +
> +@findex OpenSocket
> +PROCEDURE OpenSocket (VAR cid: ChanId;
> +                      host: ARRAY OF CHAR; port: CARDINAL;
> +                      f: FlagSet; VAR res: OpenResults) ;
> +
> +(*
> +   Close - if the channel identified by cid is not open to
> +           a socket stream, the exception wrongDevice is
> +           raised; otherwise closes the channel, and assigns
> +           the value identifying the invalid channel to cid.
> +*)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId) ;
> +
> +
> +(*
> +   IsSocket - tests if the channel identified by cid is open as
> +              a client socket stream.
> +*)
> +
> +@findex IsSocket
> +PROCEDURE IsSocket (cid: ChanId) : BOOLEAN ;
> +
> +
> +END ClientSocket.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ComplexMath, gm2-libs-iso/ConvStringLong, gm2-libs-iso/ClientSocket, M2 ISO Libraries
> +@subsection gm2-libs-iso/ComplexMath
> +
> +@example
> +DEFINITION MODULE ComplexMath;
> +
> +  (* Mathematical functions for the type COMPLEX *)
> +
> +CONST
> +@findex i (const)
> +  i =    CMPLX (0.0, 1.0);
> +@findex one (const)
> +  one =  CMPLX (1.0, 0.0);
> +@findex zero (const)
> +  zero = CMPLX (0.0, 0.0);
> +
> +@findex abs
> +PROCEDURE __BUILTIN__ abs (z: COMPLEX): REAL;
> +  (* Returns the length of z *)
> +
> +@findex arg
> +PROCEDURE __BUILTIN__ arg (z: COMPLEX): REAL;
> +  (* Returns the angle that z subtends to the positive real axis *)
> +
> +@findex conj
> +PROCEDURE __BUILTIN__ conj (z: COMPLEX): COMPLEX;
> +  (* Returns the complex conjugate of z *)
> +
> +@findex power
> +PROCEDURE __BUILTIN__ power (base: COMPLEX; exponent: REAL): COMPLEX;
> +  (* Returns the value of the number base raised to the power exponent *)
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (z: COMPLEX): COMPLEX;
> +  (* Returns the principal square root of z *)
> +
> +@findex exp
> +PROCEDURE __BUILTIN__ exp (z: COMPLEX): COMPLEX;
> +  (* Returns the complex exponential of z *)
> +
> +@findex ln
> +PROCEDURE __BUILTIN__ ln (z: COMPLEX): COMPLEX;
> +  (* Returns the principal value of the natural logarithm of z *)
> +
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (z: COMPLEX): COMPLEX;
> +  (* Returns the sine of z *)
> +
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (z: COMPLEX): COMPLEX;
> +  (* Returns the cosine of z *)
> +
> +@findex tan
> +PROCEDURE __BUILTIN__ tan (z: COMPLEX): COMPLEX;
> +  (* Returns the tangent of z *)
> +
> +@findex arcsin
> +PROCEDURE __BUILTIN__ arcsin (z: COMPLEX): COMPLEX;
> +  (* Returns the arcsine of z *)
> +
> +@findex arccos
> +PROCEDURE __BUILTIN__ arccos (z: COMPLEX): COMPLEX;
> +  (* Returns the arccosine of z *)
> +
> +@findex arctan
> +PROCEDURE __BUILTIN__ arctan (z: COMPLEX): COMPLEX;
> +  (* Returns the arctangent of z *)
> +
> +@findex polarToComplex
> +PROCEDURE polarToComplex (abs, arg: REAL): COMPLEX;
> +  (* Returns the complex number with the specified polar coordinates *)
> +
> +@findex scalarMult
> +PROCEDURE scalarMult (scalar: REAL; z: COMPLEX): COMPLEX;
> +  (* Returns the scalar product of scalar with z *)
> +
> +@findex IsCMathException
> +PROCEDURE IsCMathException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception in a
> +     routine from this module; otherwise returns FALSE.
> +  *)
> +
> +END ComplexMath.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ConvStringLong, gm2-libs-iso/ConvStringReal, gm2-libs-iso/ComplexMath, M2 ISO Libraries
> +@subsection gm2-libs-iso/ConvStringLong
> +
> +@example
> +DEFINITION MODULE ConvStringLong ;
> +
> +FROM DynamicStrings IMPORT String ;
> +
> +
> +(*
> +   RealToFloatString - converts a real with, sigFigs, into a string
> +                       and returns the result as a string.
> +*)
> +
> +@findex RealToFloatString
> +PROCEDURE RealToFloatString (real: LONGREAL; sigFigs: CARDINAL) : String ;
> +
> +
> +(*
> +   RealToEngString - converts the value of real to floating-point
> +                     string form, with sigFigs significant figures.
> +                     The number is scaled with one to three digits
> +                     in the whole number part and with an exponent
> +                     that is a multiple of three.
> +*)
> +
> +@findex RealToEngString
> +PROCEDURE RealToEngString (real: LONGREAL; sigFigs: CARDINAL) : String ;
> +
> +
> +(*
> +   RealToFixedString - returns the number of characters in the fixed-point
> +                       string representation of real rounded to the given
> +                       place relative to the decimal point.
> +*)
> +
> +@findex RealToFixedString
> +PROCEDURE RealToFixedString (real: LONGREAL; place: INTEGER) : String ;
> +
> +
> +END ConvStringLong.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ConvStringReal, gm2-libs-iso/ConvTypes, gm2-libs-iso/ConvStringLong, M2 ISO Libraries
> +@subsection gm2-libs-iso/ConvStringReal
> +
> +@example
> +DEFINITION MODULE ConvStringReal ;
> +
> +FROM DynamicStrings IMPORT String ;
> +
> +
> +(*
> +   RealToFloatString - converts a real with, sigFigs, into a string
> +                       and returns the result as a string.
> +*)
> +
> +@findex RealToFloatString
> +PROCEDURE RealToFloatString (real: REAL; sigFigs: CARDINAL) : String ;
> +
> +
> +(*
> +   RealToEngString - converts the value of real to floating-point
> +                     string form, with sigFigs significant figures.
> +                     The number is scaled with one to three digits
> +                     in the whole number part and with an exponent
> +                     that is a multiple of three.
> +*)
> +
> +@findex RealToEngString
> +PROCEDURE RealToEngString (real: REAL; sigFigs: CARDINAL) : String ;
> +
> +
> +(*
> +   RealToFixedString - returns the number of characters in the fixed-point
> +                       string representation of real rounded to the given
> +                       place relative to the decimal point.
> +*)
> +
> +@findex RealToFixedString
> +PROCEDURE RealToFixedString (real: REAL; place: INTEGER) : String ;
> +
> +
> +END ConvStringReal.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ConvTypes, gm2-libs-iso/EXCEPTIONS, gm2-libs-iso/ConvStringReal, M2 ISO Libraries
> +@subsection gm2-libs-iso/ConvTypes
> +
> +@example
> +DEFINITION MODULE ConvTypes;
> +
> +  (* Common types used in the string conversion modules *)
> +
> +TYPE
> +@findex ConvResults (type)
> +  ConvResults =     (* Values of this type are used to express the format of a string *)
> +  (
> +    strAllRight,    (* the string format is correct for the corresponding conversion *)
> +    strOutOfRange,  (* the string is well-formed but the value cannot be represented *)
> +    strWrongFormat, (* the string is in the wrong format for the conversion *)
> +    strEmpty        (* the given string is empty *)
> +  );
> +
> +@findex ScanClass (type)
> +  ScanClass =  (* Values of this type are used to classify input to finite state scanners *)
> +  (
> +    padding,   (* a leading or padding character at this point in the scan - ignore it *)
> +    valid,     (* a valid character at this point in the scan - accept it *)
> +    invalid,   (* an invalid character at this point in the scan - reject it *)
> +    terminator (* a terminating character at this point in the scan (not part of token) *)
> +  );
> +
> +@findex ScanState (type)
> +  ScanState =  (* The type of lexical scanning control procedures *)
> +    PROCEDURE (CHAR, VAR ScanClass, VAR ScanState);
> +
> +END ConvTypes.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/EXCEPTIONS, gm2-libs-iso/ErrnoCategory, gm2-libs-iso/ConvTypes, M2 ISO Libraries
> +@subsection gm2-libs-iso/EXCEPTIONS
> +
> +@example
> +DEFINITION MODULE EXCEPTIONS;
> +
> +(* Provides facilities for raising user exceptions
> +   and for making enquiries concerning the current execution state.
> +*)
> +
> +TYPE
> +  ExceptionSource;   (* values of this type are used within library
> +                        modules to identify the source of raised
> +                        exceptions *)
> +@findex ExceptionNumber (type)
> +  ExceptionNumber = CARDINAL;
> +
> +@findex AllocateSource
> +PROCEDURE AllocateSource(VAR newSource: ExceptionSource);
> +  (* Allocates a unique value of type ExceptionSource *)
> +
> +@findex RAISE
> +PROCEDURE RAISE (source: ExceptionSource;
> +                 number: ExceptionNumber; message: ARRAY OF CHAR);
> +  (* Associates the given values of source, number and message with
> +     the current context and raises an exception.
> +  *)
> +
> +@findex CurrentNumber
> +PROCEDURE CurrentNumber (source: ExceptionSource): ExceptionNumber;
> +  (* If the current coroutine is in the exceptional execution state
> +     because of the raising of an exception from source, returns
> +     the corresponding number, and otherwise raises an exception.
> +  *)
> +
> +@findex GetMessage
> +PROCEDURE GetMessage (VAR text: ARRAY OF CHAR);
> +  (* If the current coroutine is in the exceptional execution state,
> +     returns the possibly truncated string associated with the
> +     current context.  Otherwise, in normal execution state,
> +     returns the empty string.
> +  *)
> +
> +@findex IsCurrentSource
> +PROCEDURE IsCurrentSource (source: ExceptionSource): BOOLEAN;
> +  (* If the current coroutine is in the exceptional execution state
> +     because of the raising of an exception from source, returns
> +     TRUE, and otherwise returns FALSE.
> +  *)
> +
> +@findex IsExceptionalExecution
> +PROCEDURE IsExceptionalExecution (): BOOLEAN;
> +  (* If the current coroutine is in the exceptional execution state
> +     because of the raising of an exception, returns TRUE, and
> +     otherwise returns FALSE.
> +  *)
> +
> +END EXCEPTIONS.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ErrnoCategory, gm2-libs-iso/GeneralUserExceptions, gm2-libs-iso/EXCEPTIONS, M2 ISO Libraries
> +@subsection gm2-libs-iso/ErrnoCategory
> +
> +@example
> +DEFINITION MODULE ErrnoCategory ;
> +
> +(*
> +   provides an interface to errno (if the system
> +   supports it) which determines whether the current
> +   errno is a hard or soft error.  These distinctions
> +   are needed by the ISO Modula-2 libraries.  Not all
> +   errno values are tested, only those which could be
> +   related to a device.
> +*)
> +
> +IMPORT ChanConsts ;
> +
> +
> +(*
> +   IsErrnoHard - returns TRUE if the value of errno is associated with
> +                 a hard device error.
> +*)
> +
> +@findex IsErrnoHard
> +PROCEDURE IsErrnoHard (e: INTEGER) : BOOLEAN ;
> +
> +
> +(*
> +   IsErrnoSoft - returns TRUE if the value of errno is associated with
> +                 a soft device error.
> +*)
> +
> +@findex IsErrnoSoft
> +PROCEDURE IsErrnoSoft (e: INTEGER) : BOOLEAN ;
> +
> +
> +(*
> +   UnAvailable - returns TRUE if the value of errno indicates that
> +                 the resource or device is unavailable for some
> +                 reason.
> +*)
> +
> +@findex UnAvailable
> +PROCEDURE UnAvailable (e: INTEGER) : BOOLEAN ;
> +
> +
> +(*
> +   GetOpenResults - maps errno onto the ISO Modula-2 enumerated
> +                    type, OpenResults.
> +*)
> +
> +@findex GetOpenResults
> +PROCEDURE GetOpenResults (e: INTEGER) : ChanConsts.OpenResults ;
> +
> +
> +END ErrnoCategory.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/GeneralUserExceptions, gm2-libs-iso/IOChan, gm2-libs-iso/ErrnoCategory, M2 ISO Libraries
> +@subsection gm2-libs-iso/GeneralUserExceptions
> +
> +@example
> +DEFINITION MODULE GeneralUserExceptions;
> +
> +(* Provides facilities for general user-defined exceptions *)
> +
> +TYPE
> +@findex GeneralExceptions (type)
> +  GeneralExceptions = (problem, disaster);
> +
> +@findex RaiseGeneralException
> +PROCEDURE RaiseGeneralException (exception: GeneralExceptions;
> +                                 text: ARRAY OF CHAR);
> +  (* Raises exception using text as the associated message *)
> +
> +@findex IsGeneralException
> +PROCEDURE IsGeneralException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception from
> +     GeneralExceptions; otherwise returns FALSE.
> +  *)
> +
> +@findex GeneralException
> +PROCEDURE GeneralException(): GeneralExceptions;
> +  (* If the current coroutine is in the exceptional execution
> +     state because of the raising of an exception from
> +     GeneralExceptions, returns the corresponding enumeration value,
> +     and otherwise raises an exception.
> +  *)
> +
> +END GeneralUserExceptions.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/IOChan, gm2-libs-iso/IOConsts, gm2-libs-iso/GeneralUserExceptions, M2 ISO Libraries
> +@subsection gm2-libs-iso/IOChan
> +
> +@example
> +DEFINITION MODULE IOChan;
> +
> +  (* Types and procedures forming the interface to channels for
> +     device-independent data transfer modules
> +  *)
> +
> +IMPORT IOConsts, ChanConsts, SYSTEM;
> +
> +TYPE
> +  ChanId; (* Values of this type are used to identify channels *)
> +
> +  (* There is one pre-defined value identifying an invalid channel
> +     on which no data transfer operations are available.  It may
> +     be used to initialize variables of type ChanId.
> +  *)
> +
> +@findex InvalidChan
> +PROCEDURE InvalidChan (): ChanId;
> +  (* Returns the value identifying the invalid channel. *)
> +
> +  (* For each of the following operations, if the device supports
> +     the operation on the channel, the behaviour of the procedure
> +     conforms with the description below.  The full behaviour is
> +     defined for each device module.  If the device does not
> +     support the operation on the channel, the behaviour of the
> +     procedure is to raise the exception notAvailable.
> +  *)
> +
> +  (* Text operations - these perform any required translation between the
> +     internal and external representation of text.
> +  *)
> +
> +@findex Look
> +PROCEDURE Look (cid: ChanId; VAR ch: CHAR; VAR res: IOConsts.ReadResults);
> +  (* If there is a character as the next item in the input stream
> +     cid, assigns its value to ch without removing it from the stream;
> +     otherwise the value of ch is not defined.  res (and the stored
> +     read result) are set to the value allRight, endOfLine, or endOfInput.
> +  *)
> +
> +@findex Skip
> +PROCEDURE Skip (cid: ChanId);
> +  (* If the input stream cid has ended, the exception skipAtEnd
> +     is raised; otherwise the next character or line mark in cid is
> +     removed, and the stored read result is set to the value
> +     allRight.
> +  *)
> +
> +@findex SkipLook
> +PROCEDURE SkipLook (cid: ChanId; VAR ch: CHAR; VAR res: IOConsts.ReadResults);
> +  (* If the input stream cid has ended, the exception skipAtEnd is
> +     raised; otherwise the next character or line mark in cid is
> +     removed.  If there is a character as the next item in cid
> +     stream, assigns its value to ch without removing it from the
> +     stream.  Otherwise, the value of ch is not defined.  res
> +     (and the stored read result) are set to the value allRight,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn (cid: ChanId);
> +  (* Writes a line mark over the channel cid. *)
> +
> +@findex TextRead
> +PROCEDURE TextRead (cid: ChanId; to: SYSTEM.ADDRESS; maxChars: CARDINAL;
> +                    VAR charsRead: CARDINAL);
> +  (* Reads at most maxChars characters from the current line in cid,
> +     and assigns corresponding values to successive components of
> +     an ARRAY OF CHAR variable for which the address of the first
> +     component is to. The number of characters read is assigned to charsRead.
> +     The stored read result is set to allRight, endOfLine, or endOfInput.
> +  *)
> +
> +@findex TextWrite
> +PROCEDURE TextWrite (cid: ChanId; from: SYSTEM.ADDRESS;
> +                     charsToWrite: CARDINAL);
> +  (* Writes a number of characters given by the value of charsToWrite,
> +     from successive components of an ARRAY OF CHAR variable for which
> +     the address of the first component is from, to the channel cid.
> +  *)
> +
> +  (* Direct raw operations  - these do not effect translation between
> +     the internal and external representation of data
> +  *)
> +
> +@findex RawRead
> +PROCEDURE RawRead (cid: ChanId; to: SYSTEM.ADDRESS; maxLocs: CARDINAL;
> +                   VAR locsRead: CARDINAL);
> +  (* Reads at most maxLocs items from cid, and assigns corresponding
> +     values to successive components of an ARRAY OF LOC variable for
> +     which the address of the first component is to. The number of
> +     characters read is assigned to charsRead. The stored read result
> +     is set to the value allRight, or endOfInput.
> +  *)
> +
> +@findex RawWrite
> +PROCEDURE RawWrite (cid: ChanId; from: SYSTEM.ADDRESS; locsToWrite: CARDINAL);
> +  (* Writes a number of items given by the value of charsToWrite,
> +     from successive components of an ARRAY OF LOC variable for
> +     which the address of the first component is from, to the channel cid.
> +  *)
> +
> +  (* Common operations *)
> +
> +@findex GetName
> +PROCEDURE GetName (cid: ChanId; VAR s: ARRAY OF CHAR);
> +  (* Copies to s a name associated with the channel cid, possibly truncated
> +     (depending on the capacity of s).
> +  *)
> +
> +@findex Reset
> +PROCEDURE Reset (cid: ChanId);
> +  (* Resets the channel cid to a state defined by the device module. *)
> +
> +@findex Flush
> +PROCEDURE Flush (cid: ChanId);
> +  (* Flushes any data buffered by the device module out to the channel cid. *)
> +
> +  (* Access to read results *)
> +
> +@findex SetReadResult
> +PROCEDURE SetReadResult (cid: ChanId; res: IOConsts.ReadResults);
> +  (* Sets the read result value for the channel cid to the value res. *)
> +
> +@findex ReadResult
> +PROCEDURE ReadResult (cid: ChanId): IOConsts.ReadResults;
> +  (* Returns the stored read result value for the channel cid.
> +     (This is initially the value notKnown).
> +  *)
> +
> +  (* Users can discover which flags actually apply to a channel *)
> +
> +@findex CurrentFlags
> +PROCEDURE CurrentFlags (cid: ChanId): ChanConsts.FlagSet;
> +  (* Returns the set of flags that currently apply to the channel cid. *)
> +
> +  (* The following exceptions are defined for this module and its clients *)
> +
> +TYPE
> +@findex ChanExceptions (type)
> +  ChanExceptions =
> +    (wrongDevice,      (* device specific operation on wrong device *)
> +     notAvailable,     (* operation attempted that is not available on that
> +                          channel *)
> +     skipAtEnd,        (* attempt to skip data from a stream that has ended *)
> +     softDeviceError,  (* device specific recoverable error *)
> +     hardDeviceError,  (* device specific non-recoverable error *)
> +     textParseError,   (* input data does not correspond to a character or
> +                          line mark - optional detection *)
> +     notAChannel       (* given value does not identify a channel -
> +                          optional detection *)
> +    );
> +
> +@findex IsChanException
> +PROCEDURE IsChanException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception from
> +     ChanExceptions; otherwise returns FALSE.
> +  *)
> +
> +@findex ChanException
> +PROCEDURE ChanException (): ChanExceptions;
> +  (* If the current coroutine is in the exceptional execution state
> +     because of the raising of an exception from ChanExceptions,
> +     returns the corresponding enumeration value, and otherwise
> +     raises an exception.
> +  *)
> +
> +  (* When a device procedure detects a device error, it raises the
> +     exception softDeviceError or hardDeviceError.  If these
> +     exceptions are handled, the following facilities may be
> +     used to discover an implementation-defined error number for
> +     the channel.
> +  *)
> +
> +TYPE
> +@findex DeviceErrNum (type)
> +  DeviceErrNum = INTEGER;
> +
> +@findex DeviceError
> +PROCEDURE DeviceError (cid: ChanId): DeviceErrNum;
> +  (* If a device error exception has been raised for the channel cid,
> +     returns the error number stored by the device module.
> +  *)
> +
> +END IOChan.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/IOConsts, gm2-libs-iso/IOLink, gm2-libs-iso/IOChan, M2 ISO Libraries
> +@subsection gm2-libs-iso/IOConsts
> +
> +@example
> +DEFINITION MODULE IOConsts;
> +
> +  (* Types and constants for input/output modules *)
> +
> +TYPE
> +@findex ReadResults (type)
> +  ReadResults =  (* This type is used to classify the result of an input operation *)
> +  (
> +    notKnown,    (* no read result is set *)
> +    allRight,    (* data is as expected or as required *)
> +    outOfRange,  (* data cannot be represented *)
> +    wrongFormat, (* data not in expected format *)
> +    endOfLine,   (* end of line seen before expected data *)
> +    endOfInput   (* end of input seen before expected data *)
> +  );
> +
> +END IOConsts.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/IOLink, gm2-libs-iso/IOResult, gm2-libs-iso/IOConsts, M2 ISO Libraries
> +@subsection gm2-libs-iso/IOLink
> +
> +@example
> +DEFINITION MODULE IOLink;
> +
> +(* Types and procedures for the standard implementation of channels *)
> +
> +IMPORT IOChan, IOConsts, ChanConsts, SYSTEM;
> +
> +TYPE
> +  DeviceId;
> +    (* Values of this type are used to identify new device modules,
> +       and are normally obtained by them during their initialization.
> +    *)
> +
> +@findex AllocateDeviceId
> +PROCEDURE AllocateDeviceId (VAR did: DeviceId);
> +  (* Allocates a unique value of type DeviceId, and assigns this
> +     value to did. *)
> +
> +@findex MakeChan
> +PROCEDURE MakeChan (did: DeviceId; VAR cid: IOChan.ChanId);
> +  (* Attempts to make a new channel for the device module identified
> +     by did. If no more channels can be made, the identity of
> +     the invalid channel is assigned to cid.  Otherwise, the identity
> +     of a new channel is assigned to cid.
> +  *)
> +
> +@findex UnMakeChan
> +PROCEDURE UnMakeChan (did: DeviceId; VAR cid: IOChan.ChanId);
> +  (* If the device module identified by did is not the module that
> +     made the channel identified by cid, the exception wrongDevice is
> +     raised; otherwise the channel is deallocated, and the value
> +     identifying the invalid channel is assigned to cid.
> +  *)
> +
> +TYPE
> +@findex DeviceTablePtr (type)
> +  DeviceTablePtr = POINTER TO DeviceTable;
> +    (* Values of this type are used to refer to device tables *)
> +
> +TYPE
> +@findex LookProc (type)
> +  LookProc      = PROCEDURE (DeviceTablePtr, VAR CHAR, VAR IOConsts.ReadResults) ;
> +@findex SkipProc (type)
> +  SkipProc      = PROCEDURE (DeviceTablePtr) ;
> +@findex SkipLookProc (type)
> +  SkipLookProc  = PROCEDURE (DeviceTablePtr, VAR CHAR, VAR IOConsts.ReadResults) ;
> +@findex WriteLnProc (type)
> +  WriteLnProc   = PROCEDURE (DeviceTablePtr) ;
> +@findex TextReadProc (type)
> +  TextReadProc  = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL, VAR CARDINAL) ;
> +@findex TextWriteProc (type)
> +  TextWriteProc = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL) ;
> +@findex RawReadProc (type)
> +  RawReadProc   = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL, VAR CARDINAL) ;
> +@findex RawWriteProc (type)
> +  RawWriteProc  = PROCEDURE (DeviceTablePtr, SYSTEM.ADDRESS, CARDINAL) ;
> +@findex GetNameProc (type)
> +  GetNameProc   = PROCEDURE (DeviceTablePtr, VAR ARRAY OF CHAR) ;
> +@findex ResetProc (type)
> +  ResetProc     = PROCEDURE (DeviceTablePtr) ;
> +@findex FlushProc (type)
> +  FlushProc     = PROCEDURE (DeviceTablePtr) ;
> +@findex FreeProc (type)
> +  FreeProc      = PROCEDURE (DeviceTablePtr) ;
> +     (* Carry out the operations involved in closing the corresponding
> +        channel, including flushing buffers, but do not unmake the
> +        channel.
> +     *)
> +
> +
> +TYPE
> +@findex DeviceData (type)
> +  DeviceData = SYSTEM.ADDRESS;
> +
> +@findex DeviceTable (type)
> +  DeviceTable =
> +    RECORD                         (* Initialized by MakeChan to: *)
> +      cd: DeviceData;              (* the value NIL *)
> +      did: DeviceId;               (* the value given in the call of MakeChan *)
> +      cid: IOChan.ChanId;          (* the identity of the channel *)
> +      result: IOConsts.ReadResults;(* the value notKnown *)
> +      errNum: IOChan.DeviceErrNum; (* undefined *)
> +      flags: ChanConsts.FlagSet;   (* ChanConsts.FlagSet@{@} *)
> +      doLook: LookProc;            (* raise exception notAvailable *)
> +      doSkip: SkipProc;            (* raise exception notAvailable *)
> +      doSkipLook: SkipLookProc;    (* raise exception notAvailable *)
> +      doLnWrite: WriteLnProc;      (* raise exception notAvailable *)
> +      doTextRead: TextReadProc;    (* raise exception notAvailable *)
> +      doTextWrite: TextWriteProc;  (* raise exception notAvailable *)
> +      doRawRead: RawReadProc;      (* raise exception notAvailable *)
> +      doRawWrite: RawWriteProc;    (* raise exception notAvailable *)
> +      doGetName: GetNameProc;      (* return the empty string *)
> +      doReset: ResetProc;          (* do nothing *)
> +      doFlush: FlushProc;          (* do nothing *)
> +      doFree: FreeProc;            (* do nothing *)
> +    END;
> +
> +
> +  (* The pointer to the device table for a channel is obtained using the
> +     following procedure: *)
> +
> +(*
> +   If the device module identified by did is not the module that made
> +   the channel identified by cid, the exception wrongDevice is raised.
> +*)
> +
> +@findex DeviceTablePtrValue
> +PROCEDURE DeviceTablePtrValue (cid: IOChan.ChanId; did: DeviceId): DeviceTablePtr;
> +
> +
> +(*
> +   Tests if the device module identified by did is the module
> +   that made the channel identified by cid.
> +*)
> +
> +@findex IsDevice
> +PROCEDURE IsDevice (cid: IOChan.ChanId; did: DeviceId) : BOOLEAN;
> +
> +
> +TYPE
> +@findex DevExceptionRange (type)
> +  DevExceptionRange = IOChan.ChanExceptions;
> +
> +(*
> +  ISO standard states defines
> +
> +  DevExceptionRange = [IOChan.notAvailable ..  IOChan.textParseError];
> +
> +  however this must be a bug as other modules need to raise
> +  IOChan.wrongDevice exceptions.
> +*)
> +
> +@findex RAISEdevException
> +PROCEDURE RAISEdevException (cid: IOChan.ChanId; did: DeviceId;
> +                             x: DevExceptionRange; s: ARRAY OF CHAR);
> +
> +  (* If the device module identified by did is not the module that made the channel
> +     identified by cid, the exception wrongDevice is raised; otherwise the given exception
> +     is raised, and the string value in s is included in the exception message.
> +  *)
> +
> +@findex IsIOException
> +PROCEDURE IsIOException () : BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising af an exception from ChanExceptions;
> +     otherwise FALSE.
> +  *)
> +
> +@findex IOException
> +PROCEDURE IOException () : IOChan.ChanExceptions;
> +  (* If the current coroutine is in the exceptional execution state because of the
> +     raising af an exception from ChanExceptions, returns the corresponding
> +     enumeration value, and otherwise raises an exception.
> +  *)
> +
> +END IOLink.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/IOResult, gm2-libs-iso/LongComplexMath, gm2-libs-iso/IOLink, M2 ISO Libraries
> +@subsection gm2-libs-iso/IOResult
> +
> +@example
> +DEFINITION MODULE IOResult;
> +
> +  (* Read results for specified channels *)
> +
> +IMPORT IOConsts, IOChan;
> +
> +TYPE
> +@findex ReadResults (type)
> +  ReadResults = IOConsts.ReadResults;
> +
> +  (*
> +@findex ReadResults (type)
> +    ReadResults =  (* This type is used to classify the result of an input operation *)
> +    (
> +      notKnown,    (* no read result is set *)
> +      allRight,    (* data is as expected or as required *)
> +      outOfRange,  (* data cannot be represented *)
> +      wrongFormat, (* data not in expected format *)
> +      endOfLine,   (* end of line seen before expected data *)
> +      endOfInput   (* end of input seen before expected data *)
> +    );
> +  *)
> +
> +@findex ReadResult
> +PROCEDURE ReadResult (cid: IOChan.ChanId): ReadResults;
> +  (* Returns the result for the last read operation on the channel cid. *)
> +
> +END IOResult.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongComplexMath, gm2-libs-iso/LongConv, gm2-libs-iso/IOResult, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongComplexMath
> +
> +@example
> +DEFINITION MODULE LongComplexMath;
> +
> +  (* Mathematical functions for the type LONGCOMPLEX *)
> +
> +CONST
> +@findex i (const)
> +  i =    CMPLX (0.0, 1.0);
> +@findex one (const)
> +  one =  CMPLX (1.0, 0.0);
> +@findex zero (const)
> +  zero = CMPLX (0.0, 0.0);
> +
> +@findex abs
> +PROCEDURE abs (z: LONGCOMPLEX): LONGREAL;
> +  (* Returns the length of z *)
> +
> +@findex arg
> +PROCEDURE arg (z: LONGCOMPLEX): LONGREAL;
> +  (* Returns the angle that z subtends to the positive real axis *)
> +
> +@findex conj
> +PROCEDURE conj (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the complex conjugate of z *)
> +
> +@findex power
> +PROCEDURE power (base: LONGCOMPLEX; exponent: LONGREAL): LONGCOMPLEX;
> +  (* Returns the value of the number base raised to the power exponent *)
> +
> +@findex sqrt
> +PROCEDURE sqrt (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the principal square root of z *)
> +
> +@findex exp
> +PROCEDURE exp (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the complex exponential of z *)
> +
> +@findex ln
> +PROCEDURE ln (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the principal value of the natural logarithm of z *)
> +
> +@findex sin
> +PROCEDURE sin (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the sine of z *)
> +
> +@findex cos
> +PROCEDURE cos (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the cosine of z *)
> +
> +@findex tan
> +PROCEDURE tan (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the tangent of z *)
> +
> +@findex arcsin
> +PROCEDURE arcsin (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the arcsine of z *)
> +
> +@findex arccos
> +PROCEDURE arccos (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the arccosine of z *)
> +
> +@findex arctan
> +PROCEDURE arctan (z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the arctangent of z *)
> +
> +@findex polarToComplex
> +PROCEDURE polarToComplex (abs, arg: LONGREAL): LONGCOMPLEX;
> +  (* Returns the complex number with the specified polar coordinates *)
> +
> +@findex scalarMult
> +PROCEDURE scalarMult (scalar: LONGREAL; z: LONGCOMPLEX): LONGCOMPLEX;
> +  (* Returns the scalar product of scalar with z *)
> +
> +@findex IsCMathException
> +PROCEDURE IsCMathException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END LongComplexMath.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongConv, gm2-libs-iso/LongIO, gm2-libs-iso/LongComplexMath, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongConv
> +
> +@example
> +DEFINITION MODULE LongConv;
> +
> +  (* Low-level LONGREAL/string conversions *)
> +
> +IMPORT
> +  ConvTypes;
> +
> +TYPE
> +@findex ConvResults (type)
> +  ConvResults = ConvTypes.ConvResults; (* strAllRight, strOutOfRange,
> +                                          strWrongFormat, strEmpty *)
> +
> +@findex ScanReal
> +PROCEDURE ScanReal (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
> +                    VAR nextState: ConvTypes.ScanState);
> +  (* Represents the start state of a finite state scanner for real
> +     numbers - assigns class of inputCh to chClass and a procedure
> +     representing the next state to nextState.
> +  *)
> +
> +@findex FormatReal
> +PROCEDURE FormatReal (str: ARRAY OF CHAR): ConvResults;
> +  (* Returns the format of the string value for conversion to LONGREAL. *)
> +
> +@findex ValueReal
> +PROCEDURE ValueReal (str: ARRAY OF CHAR): LONGREAL;
> +  (* Returns the value corresponding to the real number string value
> +     str if str is well-formed; otherwise raises the LongConv exception.
> +  *)
> +
> +@findex LengthFloatReal
> +PROCEDURE LengthFloatReal (real: LONGREAL; sigFigs: CARDINAL): CARDINAL;
> +  (* Returns the number of characters in the floating-point string
> +     representation of real with sigFigs significant figures.
> +  *)
> +
> +@findex LengthEngReal
> +PROCEDURE LengthEngReal (real: LONGREAL; sigFigs: CARDINAL): CARDINAL;
> +  (* Returns the number of characters in the floating-point engineering
> +     string representation of real with sigFigs significant figures.
> +  *)
> +
> +@findex LengthFixedReal
> +PROCEDURE LengthFixedReal (real: LONGREAL; place: INTEGER): CARDINAL;
> +  (* Returns the number of characters in the fixed-point string
> +     representation of real rounded to the given place relative to the
> +     decimal point.
> +  *)
> +
> +@findex IsRConvException
> +PROCEDURE IsRConvException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception in a
> +     routine from this module; otherwise returns FALSE.
> +  *)
> +
> +END LongConv.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongIO, gm2-libs-iso/LongMath, gm2-libs-iso/LongConv, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongIO
> +
> +@example
> +DEFINITION MODULE LongIO;
> +
> +  (* Input and output of long real numbers in decimal text form
> +     over specified channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}, [".",
> +       @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: LONGREAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed fixed or floating
> +     point number.  The value of this number is assigned to real.
> +     The read result is set to the value allRight, outOfRange,
> +     wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (cid: IOChan.ChanId; real: LONGREAL;
> +                      sigFigs: CARDINAL; width: CARDINAL);
> +  (* Writes the value of real to cid in floating-point text form,
> +     with sigFigs significant figures, in a field of the given
> +     minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (cid: IOChan.ChanId; real: LONGREAL;
> +                    sigFigs: CARDINAL; width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with
> +     one to three digits in the whole number part, and with an
> +     exponent that is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (cid: IOChan.ChanId; real: LONGREAL;
> +                      place: INTEGER; width: CARDINAL);
> +  (* Writes the value of real to cid in fixed-point text form,
> +     rounded to the given place relative to the decimal point,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (cid: IOChan.ChanId; real: LONGREAL;
> +                     width: CARDINAL);
> +  (* Writes the value of real to cid, as WriteFixed if the
> +     sign and magnitude can be shown in the given width, or
> +     otherwise as WriteFloat.  The number of places or
> +     significant digits depends on the given width.
> +  *)
> +
> +END LongIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongMath, gm2-libs-iso/LongStr, gm2-libs-iso/LongIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongMath
> +
> +@example
> +DEFINITION MODULE LongMath;
> +
> +  (* Mathematical functions for the type LONGREAL *)
> +
> +CONST
> +@findex pi (const)
> +  pi   = 3.1415926535897932384626433832795028841972;
> +@findex exp1 (const)
> +  exp1 = 2.7182818284590452353602874713526624977572;
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: LONGREAL): LONGREAL;
> +  (* Returns the positive square root of x *)
> +
> +@findex exp
> +PROCEDURE __BUILTIN__ exp (x: LONGREAL): LONGREAL;
> +  (* Returns the exponential of x *)
> +
> +@findex ln
> +PROCEDURE __BUILTIN__ ln (x: LONGREAL): LONGREAL;
> +  (* Returns the natural logarithm of x *)
> +
> +  (* The angle in all trigonometric functions is measured in radians *)
> +
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: LONGREAL): LONGREAL;
> +  (* Returns the sine of x *)
> +
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: LONGREAL): LONGREAL;
> +  (* Returns the cosine of x *)
> +
> +@findex tan
> +PROCEDURE tan (x: LONGREAL): LONGREAL;
> +  (* Returns the tangent of x *)
> +
> +@findex arcsin
> +PROCEDURE arcsin (x: LONGREAL): LONGREAL;
> +  (* Returns the arcsine of x *)
> +
> +@findex arccos
> +PROCEDURE arccos (x: LONGREAL): LONGREAL;
> +  (* Returns the arccosine of x *)
> +
> +@findex arctan
> +PROCEDURE arctan (x: LONGREAL): LONGREAL;
> +  (* Returns the arctangent of x *)
> +
> +@findex power
> +PROCEDURE power (base, exponent: LONGREAL): LONGREAL;
> +  (* Returns the value of the number base raised to the power exponent *)
> +
> +@findex round
> +PROCEDURE round (x: LONGREAL): INTEGER;
> +  (* Returns the value of x rounded to the nearest integer *)
> +
> +@findex IsRMathException
> +PROCEDURE IsRMathException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception in a
> +     routine from this module; otherwise returns FALSE.
> +  *)
> +
> +END LongMath.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongStr, gm2-libs-iso/LongWholeIO, gm2-libs-iso/LongMath, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongStr
> +
> +@example
> +DEFINITION MODULE LongStr;
> +
> +  (* LONGREAL/string conversions *)
> +
> +IMPORT
> +   ConvTypes;
> +
> +TYPE
> +   (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
> +@findex ConvResults (type)
> +   ConvResults = ConvTypes.ConvResults;
> +
> +(* the string form of a signed fixed-point real number is
> +     ["+" | "-"], decimal digit, @{decimal digit@}, [".",
> +     @{decimal digit@}]
> +*)
> +
> +(* the string form of a signed floating-point real number is
> +     signed fixed-point real number, "E", ["+" | "-"],
> +     decimal digit, @{decimal digit@}
> +*)
> +
> +@findex StrToReal
> +PROCEDURE StrToReal (str: ARRAY OF CHAR; VAR real: LONGREAL;
> +                     VAR res: ConvResults);
> +  (* Ignores any leading spaces in str. If the subsequent characters
> +     in str are in the format of a signed real number, assigns a
> +     corresponding value to real.  Assigns a value indicating the
> +     format of str to res.
> +  *)
> +
> +@findex RealToFloat
> +PROCEDURE RealToFloat (real: LONGREAL; sigFigs: CARDINAL;
> +                       VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to floating-point string form, with
> +     sigFigs significant figures, and copies the possibly truncated
> +     result to str.
> +  *)
> +
> +@findex RealToEng
> +PROCEDURE RealToEng (real: LONGREAL; sigFigs: CARDINAL;
> +                     VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to floating-point string form, with
> +     sigFigs significant figures, and copies the possibly truncated
> +     result to str. The number is scaled with one to three digits
> +     in the whole number part and with an exponent that is a
> +     multiple of three.
> +  *)
> +
> +@findex RealToFixed
> +PROCEDURE RealToFixed (real: LONGREAL; place: INTEGER;
> +                       VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to fixed-point string form, rounded
> +     to the given place relative to the decimal point, and copies
> +     the possibly truncated result to str.
> +  *)
> +
> +@findex RealToStr
> +PROCEDURE RealToStr (real: LONGREAL; VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real as RealToFixed if the sign and
> +     magnitude can be shown within the capacity of str, or
> +     otherwise as RealToFloat, and copies the possibly truncated
> +     result to str. The number of places or significant digits
> +     depend on the capacity of str.
> +  *)
> +
> +END LongStr.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LongWholeIO, gm2-libs-iso/LowLong, gm2-libs-iso/LongStr, M2 ISO Libraries
> +@subsection gm2-libs-iso/LongWholeIO
> +
> +@example
> +DEFINITION MODULE LongWholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form
> +     over specified channels.  The read result is of the
> +     type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: LONGINT);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed whole number.  The
> +     value of this number is assigned to int.  The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (cid: IOChan.ChanId; int: LONGINT;
> +                    width: CARDINAL);
> +  (* Writes the value of int to cid in text form, in a field of
> +     the given minimum width. *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: LONGCARD);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of an unsigned whole number.  The
> +     value of this number is assigned to card. The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (cid: IOChan.ChanId; card: LONGCARD;
> +                     width: CARDINAL);
> +  (* Writes the value of card to cid in text form, in a field
> +     of the given minimum width. *)
> +
> +END LongWholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LowLong, gm2-libs-iso/LowReal, gm2-libs-iso/LongWholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/LowLong
> +
> +@example
> +DEFINITION MODULE LowLong;
> +
> +  (* Access to underlying properties of the type LONGREAL *)
> +
> +CONST
> +@findex radix (const)
> +  radix      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, radix> )) ;      (* ZType *)
> +@findex places (const)
> +  places     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, places> )) ;     (* ZType *)
> +@findex expoMin (const)
> +  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, expoMin> )) ;    (* ZType *)
> +@findex expoMax (const)
> +  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, expoMax> )) ;    (* ZType *)
> +@findex large (const)
> +  large      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, large> )) ;      (* RType *)
> +@findex small (const)
> +  small      = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, small> )) ;      (* RType *)
> +@findex IEC559 (const)
> +  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, IEC559> )) ;     (* BOOLEAN *)
> +@findex LIA1 (const)
> +  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, LIA1> )) ;       (* BOOLEAN *)
> +@findex ISO (const)
> +  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, ISO> )) ;        (* BOOLEAN *)
> +@findex IEEE (const)
> +  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, IEEE> )) ;       (* BOOLEAN *)
> +@findex rounds (const)
> +  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, rounds> )) ;     (* BOOLEAN *)
> +@findex gUnderflow (const)
> +  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, gUnderflow> )) ; (* BOOLEAN *)
> +@findex exception (const)
> +  exception  = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, exception> )) ;  (* BOOLEAN *)
> +@findex extend (const)
> +  extend     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, extend> )) ;     (* BOOLEAN *)
> +@findex nModes (const)
> +  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <LONGREAL, nModes> )) ;     (* ZType *)
> +
> +TYPE
> +@findex Modes (type)
> +  Modes = PACKEDSET OF [0 .. nModes-1];
> +
> +@findex exponent
> +PROCEDURE exponent (x: LONGREAL): INTEGER;
> +  (* Returns the exponent value of x *)
> +
> +@findex fraction
> +PROCEDURE fraction (x: LONGREAL): LONGREAL;
> +  (* Returns the significand (or significant part) of x *)
> +
> +@findex sign
> +PROCEDURE sign (x: LONGREAL): LONGREAL;
> +  (* Returns the signum of x *)
> +
> +@findex succ
> +PROCEDURE succ (x: LONGREAL): LONGREAL;
> +  (* Returns the next value of the type LONGREAL greater than x *)
> +
> +@findex ulp
> +PROCEDURE ulp (x: LONGREAL): LONGREAL;
> +  (* Returns the value of a unit in the last place of x *)
> +
> +@findex pred
> +PROCEDURE pred (x: LONGREAL): LONGREAL;
> +  (* Returns the previous value of the type LONGREAL less than x *)
> +
> +@findex intpart
> +PROCEDURE intpart (x: LONGREAL): LONGREAL;
> +  (* Returns the integer part of x *)
> +
> +@findex fractpart
> +PROCEDURE fractpart (x: LONGREAL): LONGREAL;
> +  (* Returns the fractional part of x *)
> +
> +@findex scale
> +PROCEDURE scale (x: LONGREAL; n: INTEGER): LONGREAL;
> +  (* Returns the value of x * radix ** n *)
> +
> +@findex trunc
> +PROCEDURE trunc (x: LONGREAL; n: INTEGER): LONGREAL;
> +  (* Returns the value of the first n places of x *)
> +
> +@findex round
> +PROCEDURE round (x: LONGREAL; n: INTEGER): LONGREAL;
> +  (* Returns the value of x rounded to the first n places *)
> +
> +@findex synthesize
> +PROCEDURE synthesize (expart: INTEGER; frapart: LONGREAL): LONGREAL;
> +  (* Returns a value of the type LONGREAL constructed from the given expart and frapart *)
> +
> +@findex setMode
> +PROCEDURE setMode (m: Modes);
> +  (* Sets status flags appropriate to the underlying implementation of the type LONGREAL *)
> +
> +@findex currentMode
> +PROCEDURE currentMode (): Modes;
> +  (* Returns the current status flags in the form set by setMode *)
> +
> +@findex IsLowException
> +PROCEDURE IsLowException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END LowLong.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LowReal, gm2-libs-iso/LowShort, gm2-libs-iso/LowLong, M2 ISO Libraries
> +@subsection gm2-libs-iso/LowReal
> +
> +@example
> +DEFINITION MODULE LowReal;
> +
> +  (* Access to underlying properties of the type REAL *)
> +
> +CONST
> +@findex radix (const)
> +  radix      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, radix> )) ;      (* ZType *)
> +@findex places (const)
> +  places     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, places> )) ;     (* ZType *)
> +@findex expoMin (const)
> +  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMin> )) ;    (* ZType *)
> +@findex expoMax (const)
> +  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMax> )) ;    (* ZType *)
> +@findex large (const)
> +  large      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, large> )) ;      (* RType *)
> +@findex small (const)
> +  small      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, small> )) ;      (* RType *)
> +@findex IEC559 (const)
> +  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEC559> )) ;     (* BOOLEAN *)
> +@findex LIA1 (const)
> +  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, LIA1> )) ;       (* BOOLEAN *)
> +@findex ISO (const)
> +  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <REAL, ISO> )) ;        (* BOOLEAN *)
> +@findex IEEE (const)
> +  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEEE> )) ;       (* BOOLEAN *)
> +@findex rounds (const)
> +  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, rounds> )) ;     (* BOOLEAN *)
> +@findex gUnderflow (const)
> +  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <REAL, gUnderflow> )) ; (* BOOLEAN *)
> +@findex exception (const)
> +  exception  = __ATTRIBUTE__ __BUILTIN__ (( <REAL, exception> )) ;  (* BOOLEAN *)
> +@findex extend (const)
> +  extend     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, extend> )) ;     (* BOOLEAN *)
> +@findex nModes (const)
> +  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, nModes> )) ;     (* ZType *)
> +
> +TYPE
> +@findex Modes (type)
> +  Modes = PACKEDSET OF [0..nModes-1];
> +
> +@findex exponent
> +PROCEDURE exponent (x: REAL): INTEGER;
> +  (* Returns the exponent value of x *)
> +
> +@findex fraction
> +PROCEDURE fraction (x: REAL): REAL;
> +  (* Returns the significand (or significant part) of x *)
> +
> +@findex sign
> +PROCEDURE sign (x: REAL): REAL;
> +  (* Returns the signum of x *)
> +
> +@findex succ
> +PROCEDURE succ (x: REAL): REAL;
> +  (* Returns the next value of the type REAL greater than x *)
> +
> +@findex ulp
> +PROCEDURE ulp (x: REAL): REAL;
> +  (* Returns the value of a unit in the last place of x *)
> +
> +@findex pred
> +PROCEDURE pred (x: REAL): REAL;
> +  (* Returns the previous value of the type REAL less than x *)
> +
> +@findex intpart
> +PROCEDURE intpart (x: REAL): REAL;
> +  (* Returns the integer part of x *)
> +
> +@findex fractpart
> +PROCEDURE fractpart (x: REAL): REAL;
> +  (* Returns the fractional part of x *)
> +
> +@findex scale
> +PROCEDURE scale (x: REAL; n: INTEGER): REAL;
> +  (* Returns the value of x * radix ** n *)
> +
> +@findex trunc
> +PROCEDURE trunc (x: REAL; n: INTEGER): REAL;
> +  (* Returns the value of the first n places of x *)
> +
> +@findex round
> +PROCEDURE round (x: REAL; n: INTEGER): REAL;
> +  (* Returns the value of x rounded to the first n places *)
> +
> +@findex synthesize
> +PROCEDURE synthesize (expart: INTEGER; frapart: REAL): REAL;
> +  (* Returns a value of the type REAL constructed from the given expart and frapart *)
> +
> +@findex setMode
> +PROCEDURE setMode (m: Modes);
> +  (* Sets status flags appropriate to the underlying implementation of the type REAL *)
> +
> +@findex currentMode
> +PROCEDURE currentMode (): Modes;
> +  (* Returns the current status flags in the form set by setMode *)
> +
> +@findex IsLowException
> +PROCEDURE IsLowException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END LowReal.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/LowShort, gm2-libs-iso/M2EXCEPTION, gm2-libs-iso/LowReal, M2 ISO Libraries
> +@subsection gm2-libs-iso/LowShort
> +
> +@example
> +DEFINITION MODULE LowShort;
> +
> +  (* Access to underlying properties of the type SHORTREAL *)
> +
> +CONST
> +@findex radix (const)
> +  radix      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, radix> )) ;      (* ZType *)
> +@findex places (const)
> +  places     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, places> )) ;     (* ZType *)
> +@findex expoMin (const)
> +  expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMin> )) ;    (* ZType *)
> +@findex expoMax (const)
> +  expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMax> )) ;    (* ZType *)
> +@findex large (const)
> +  large      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, large> )) ;      (* RType *)
> +@findex small (const)
> +  small      = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, small> )) ;      (* RType *)
> +@findex IEC559 (const)
> +  IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEC559> )) ;     (* BOOLEAN *)
> +@findex LIA1 (const)
> +  LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, LIA1> )) ;       (* BOOLEAN *)
> +@findex ISO (const)
> +  ISO        = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, ISO> )) ;        (* BOOLEAN *)
> +@findex IEEE (const)
> +  IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEEE> )) ;       (* BOOLEAN *)
> +@findex rounds (const)
> +  rounds     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, rounds> )) ;     (* BOOLEAN *)
> +@findex gUnderflow (const)
> +  gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, gUnderflow> )) ; (* BOOLEAN *)
> +@findex exception (const)
> +  exception  = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, exception> )) ;  (* BOOLEAN *)
> +@findex extend (const)
> +  extend     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, extend> )) ;     (* BOOLEAN *)
> +@findex nModes (const)
> +  nModes     = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, nModes> )) ;     (* ZType *)
> +
> +TYPE
> +@findex Modes (type)
> +  Modes = PACKEDSET OF [0 .. nModes-1];
> +
> +@findex exponent
> +PROCEDURE exponent (x: SHORTREAL): INTEGER;
> +  (* Returns the exponent value of x *)
> +
> +@findex fraction
> +PROCEDURE fraction (x: SHORTREAL): SHORTREAL;
> +  (* Returns the significand (or significant part) of x *)
> +
> +@findex sign
> +PROCEDURE sign (x: SHORTREAL): SHORTREAL;
> +  (* Returns the signum of x *)
> +
> +@findex succ
> +PROCEDURE succ (x: SHORTREAL): SHORTREAL;
> +  (* Returns the next value of the type SHORTREAL greater than x *)
> +
> +@findex ulp
> +PROCEDURE ulp (x: SHORTREAL): SHORTREAL;
> +  (* Returns the value of a unit in the last place of x *)
> +
> +@findex pred
> +PROCEDURE pred (x: SHORTREAL): SHORTREAL;
> +  (* Returns the previous value of the type SHORTREAL less than x *)
> +
> +@findex intpart
> +PROCEDURE intpart (x: SHORTREAL): SHORTREAL;
> +  (* Returns the integer part of x *)
> +
> +@findex fractpart
> +PROCEDURE fractpart (x: SHORTREAL): SHORTREAL;
> +  (* Returns the fractional part of x *)
> +
> +@findex scale
> +PROCEDURE scale (x: SHORTREAL; n: INTEGER): SHORTREAL;
> +  (* Returns the value of x * radix ** n *)
> +
> +@findex trunc
> +PROCEDURE trunc (x: SHORTREAL; n: INTEGER): SHORTREAL;
> +  (* Returns the value of the first n places of x *)
> +
> +@findex round
> +PROCEDURE round (x: SHORTREAL; n: INTEGER): SHORTREAL;
> +  (* Returns the value of x rounded to the first n places *)
> +
> +@findex synthesize
> +PROCEDURE synthesize (expart: INTEGER; frapart: SHORTREAL): SHORTREAL;
> +  (* Returns a value of the type SHORTREAL constructed from the given expart and frapart *)
> +
> +@findex setMode
> +PROCEDURE setMode (m: Modes);
> +  (* Sets status flags appropriate to the underlying implementation of the type SHORTREAL *)
> +
> +@findex currentMode
> +PROCEDURE currentMode (): Modes;
> +  (* Returns the current status flags in the form set by setMode *)
> +
> +@findex IsLowException
> +PROCEDURE IsLowException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END LowShort.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/M2EXCEPTION, gm2-libs-iso/M2RTS, gm2-libs-iso/LowShort, M2 ISO Libraries
> +@subsection gm2-libs-iso/M2EXCEPTION
> +
> +@example
> +DEFINITION MODULE M2EXCEPTION;
> +
> +(* Provides facilities for identifying language exceptions *)
> +
> +TYPE
> +@findex M2Exceptions (type)
> +  M2Exceptions =
> +    (indexException,     rangeException,         caseSelectException,  invalidLocation,
> +     functionException,  wholeValueException,    wholeDivException,    realValueException,
> +     realDivException,   complexValueException,  complexDivException,  protException,
> +     sysException,       coException,            exException
> +    );
> +
> +@findex M2Exception
> +PROCEDURE M2Exception (): M2Exceptions;
> +  (* If the current coroutine is in the exceptional execution state because of the raising
> +     of a language exception, returns the corresponding enumeration value, and otherwise
> +     raises an exception.
> +  *)
> +
> +@findex IsM2Exception
> +PROCEDURE IsM2Exception (): BOOLEAN;
> +  (* If the current coroutine is in the exceptional execution state because of the raising
> +     of a language exception, returns TRUE, and otherwise returns FALSE.
> +  *)
> +
> +END M2EXCEPTION.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/M2RTS, gm2-libs-iso/MemStream, gm2-libs-iso/M2EXCEPTION, M2 ISO Libraries
> +@subsection gm2-libs-iso/M2RTS
> +
> +@example
> +DEFINITION MODULE M2RTS ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +TYPE
> +@findex ArgCVEnvP (type)
> +   ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
> +
> +
> +@findex ConstructModules
> +PROCEDURE ConstructModules (applicationmodule: ADDRESS;
> +                            argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +@findex DeconstructModules
> +PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
> +                              argc: INTEGER; argv, envp: ADDRESS) ;
> +
> +
> +(*
> +   RegisterModule - adds module name to the list of outstanding
> +                    modules which need to have their dependencies
> +                    explored to determine initialization order.
> +*)
> +
> +@findex RegisterModule
> +PROCEDURE RegisterModule (name: ADDRESS;
> +                          init, fini:  ArgCVEnvP;
> +                          dependencies: PROC) ;
> +
> +
> +(*
> +   RequestDependant - used to specify that modulename is dependant upon
> +                      module dependantmodule.
> +*)
> +
> +@findex RequestDependant
> +PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
> +
> +
> +(*
> +   ExecuteTerminationProcedures - calls each installed termination
> +                                  procedure in reverse order.
> +*)
> +
> +@findex ExecuteTerminationProcedures
> +PROCEDURE ExecuteTerminationProcedures ;
> +
> +
> +(*
> +   InstallTerminationProcedure - installs a procedure, p, which will
> +                                 be called when the procedure
> +                                 ExecuteTerminationProcedures
> +                                 is invoked.  It returns TRUE is the
> +                                 procedure is installed.
> +*)
> +
> +@findex InstallTerminationProcedure
> +PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
> +
> +
> +(*
> +   ExecuteInitialProcedures - executes the initial procedures installed
> +                              by InstallInitialProcedure.
> +*)
> +
> +@findex ExecuteInitialProcedures
> +PROCEDURE ExecuteInitialProcedures ;
> +
> +
> +(*
> +   InstallInitialProcedure - installs a procedure to be executed just
> +                             before the BEGIN code section of the main
> +                             program module.
> +*)
> +
> +@findex InstallInitialProcedure
> +PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
> +
> +
> +(*
> +   HALT - terminate the current program.  The procedure
> +          ExecuteTerminationProcedures
> +          is called before the program is stopped.  The parameter
> +          exitcode is optional.  If the parameter is not supplied
> +          HALT will call libc 'abort', otherwise it will exit with
> +          the code supplied.  Supplying a parameter to HALT has the
> +          same effect as calling ExitOnHalt with the same code and
> +          then calling HALT with no parameter.
> +*)
> +
> +@findex HALT
> +PROCEDURE HALT ([exitcode: INTEGER = -1]) ;
> +
> +
> +(*
> +   Halt - provides a more user friendly version of HALT, which takes
> +          four parameters to aid debugging.
> +*)
> +
> +@findex Halt
> +PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
> +                function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   ExitOnHalt - if HALT is executed then call exit with the exit code, e.
> +*)
> +
> +@findex ExitOnHalt
> +PROCEDURE ExitOnHalt (e: INTEGER) ;
> +
> +
> +(*
> +   ErrorMessage - emits an error message to stderr and then calls exit (1).
> +*)
> +
> +@findex ErrorMessage
> +PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
> +                        file: ARRAY OF CHAR;
> +                        line: CARDINAL;
> +                        function: ARRAY OF CHAR) ;
> +
> +
> +(*
> +   IsTerminating - Returns true if any coroutine has started program termination
> +                   and false otherwise.
> +*)
> +
> +@findex IsTerminating
> +PROCEDURE IsTerminating () : BOOLEAN ;
> +
> +
> +(*
> +   HasHalted - Returns true if a call to HALT has been made and false
> +               otherwise.
> +*)
> +
> +@findex HasHalted
> +PROCEDURE HasHalted () : BOOLEAN ;
> +
> +
> +(*
> +   Length - returns the length of a string, a. This is called whenever
> +            the user calls LENGTH and the parameter cannot be calculated
> +            at compile time.
> +*)
> +
> +@findex Length
> +PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
> +
> +
> +(*
> +   The following are the runtime exception handler routines.
> +*)
> +
> +@findex AssignmentException
> +PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ReturnException
> +PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex IncException
> +PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex DecException
> +PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex InclException
> +PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ExclException
> +PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ShiftException
> +PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex RotateException
> +PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex StaticArraySubscriptException
> +PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex DynamicArraySubscriptException
> +PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopBeginException
> +PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopToException
> +PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ForLoopEndException
> +PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex PointerNilException
> +PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex NoReturnException
> +PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex CaseException
> +PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeNonPosDivException
> +PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeNonPosModException
> +PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeZeroDivException
> +PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeZeroRemException
> +PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex WholeValueException
> +PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex RealValueException
> +PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex ParameterException
> +PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +@findex NoException
> +PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
> +
> +
> +END M2RTS.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/MemStream, gm2-libs-iso/Preemptive, gm2-libs-iso/M2RTS, M2 ISO Libraries
> +@subsection gm2-libs-iso/MemStream
> +
> +@example
> +DEFINITION MODULE MemStream ;
> +
> +(*
> +    Description: provides an ISO module which can write to a memory
> +                 buffer or read from a memory buffer.
> +*)
> +
> +FROM IOChan IMPORT ChanId ;
> +FROM ChanConsts IMPORT FlagSet, OpenResults ;
> +FROM SYSTEM IMPORT ADDRESS, LOC ;
> +
> +
> +(*
> +   Attempts to obtain and open a channel connected to a contigeous
> +   buffer in memory.  The write flag is implied; without the raw
> +   flag, text is implied.  If successful, assigns to cid the identity of
> +   the opened channel, assigns the value opened to res.
> +   If a channel cannot be opened as required,
> +   the value of res indicates the reason, and cid identifies the
> +   invalid channel.
> +
> +   The parameters, buffer, length and used maybe updated as
> +   data is written.  The buffer maybe reallocated
> +   and its address might alter, however the parameters will
> +   always reflect the current active buffer.  When this
> +   channel is closed the buffer is deallocated and
> +   buffer will be set to NIL, length and used will be set to
> +   zero.
> +*)
> +
> +@findex OpenWrite
> +PROCEDURE OpenWrite (VAR cid: ChanId; flags: FlagSet;
> +                     VAR res: OpenResults;
> +                     VAR buffer: ADDRESS;
> +                     VAR length: CARDINAL;
> +                     VAR used: CARDINAL;
> +                     deallocOnClose: BOOLEAN) ;
> +
> +
> +(*
> +   Attempts to obtain and open a channel connected to a contigeous
> +   buffer in memory.  The read and old flags are implied; without
> +   the raw flag, text is implied.  If successful, assigns to cid the
> +   identity of the opened channel, assigns the value opened to res, and
> +   selects input mode, with the read position corresponding to the start
> +   of the buffer.  If a channel cannot be opened as required, the value of
> +   res indicates the reason, and cid identifies the invalid channel.
> +*)
> +
> +@findex OpenRead
> +PROCEDURE OpenRead (VAR cid: ChanId; flags: FlagSet;
> +                    VAR res: OpenResults;
> +                    buffer: ADDRESS; length: CARDINAL;
> +                    deallocOnClose: BOOLEAN) ;
> +
> +
> +(*
> +   Close - if the channel identified by cid is not open to
> +           a memory stream, the exception wrongDevice is
> +           raised; otherwise closes the channel, and assigns
> +           the value identifying the invalid channel to cid.
> +*)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId) ;
> +
> +
> +(*
> +   Rewrite - assigns the buffer index to zero.  Subsequent
> +             writes will overwrite the previous buffer contents.
> +*)
> +
> +@findex Rewrite
> +PROCEDURE Rewrite (cid: ChanId) ;
> +
> +
> +(*
> +   Reread - assigns the buffer index to zero.  Subsequent
> +            reads will read the previous buffer contents.
> +*)
> +
> +@findex Reread
> +PROCEDURE Reread (cid: ChanId) ;
> +
> +
> +(*
> +   IsMem - tests if the channel identified by cid is open as
> +           a memory stream.
> +*)
> +
> +@findex IsMem
> +PROCEDURE IsMem (cid: ChanId) : BOOLEAN ;
> +
> +
> +END MemStream.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/Preemptive, gm2-libs-iso/Processes, gm2-libs-iso/MemStream, M2 ISO Libraries
> +@subsection gm2-libs-iso/Preemptive
> +
> +@example
> +DEFINITION MODULE Preemptive ;
> +
> +
> +(*
> +   initPreemptive - if microsecs > 0 then turn on preemptive scheduling.
> +                    if microsecs = 0 then preemptive scheduling is turned off.
> +*)
> +
> +@findex initPreemptive
> +PROCEDURE initPreemptive (seconds, microsecs: CARDINAL) ;
> +
> +
> +END Preemptive.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/Processes, gm2-libs-iso/ProgramArgs, gm2-libs-iso/Preemptive, M2 ISO Libraries
> +@subsection gm2-libs-iso/Processes
> +
> +@example
> +DEFINITION MODULE Processes;
> +
> +  (* This module allows concurrent algorithms to be expressed using
> +     processes. A process is a unit of a program that has the
> +     potential to run in parallel with other processes.
> +  *)
> +
> +IMPORT SYSTEM;
> +
> +TYPE
> +  ProcessId;                      (* Used to identify processes *)
> +@findex Parameter (type)
> +  Parameter     = SYSTEM.ADDRESS; (* Used to pass data between processes *)
> +@findex Body (type)
> +  Body          = PROC;           (* Used as the type of a process body *)
> +@findex Urgency (type)
> +  Urgency       = INTEGER;        (* Used by the internal scheduler *)
> +@findex Sources (type)
> +  Sources       = CARDINAL;       (* Used to identify event sources *)
> +@findex ProcessesExceptions (type)
> +  ProcessesExceptions =           (* Exceptions raised by this module *)
> +    (passiveProgram, processError);
> +
> +(* The following procedures create processes and switch control between
> +   them. *)
> +
> +@findex Create
> +PROCEDURE Create (procBody: Body; extraSpace: CARDINAL; procUrg: Urgency;
> +                  procParams: Parameter; VAR procId: ProcessId);
> +  (* Creates a new process with procBody as its body, and with urgency
> +     and parameters given by procUrg and procParams.  At least as
> +     much workspace (in units of SYSTEM.LOC) as is specified by
> +     extraSpace is allocated to the process.
> +     An identity for the new process is returned in procId.
> +     The process is created in the passive state; it will not run
> +     until activated.
> +  *)
> +
> +@findex Start
> +PROCEDURE Start (procBody: Body; extraSpace: CARDINAL; procUrg: Urgency;
> +                 procParams: Parameter; VAR procId: ProcessId);
> +  (* Creates a new process, with parameters as for Create.
> +     The process is created in the ready state; it is eligible to
> +     run immediately.
> +  *)
> +
> +@findex StopMe
> +PROCEDURE StopMe ();
> +  (* Terminates the calling process.
> +     The process must not be associated with a source of events.
> +  *)
> +
> +@findex SuspendMe
> +PROCEDURE SuspendMe ();
> +  (* Causes the calling process to enter the passive state.  The
> +     procedure only returns when the calling process is again
> +     activated by another process.
> +  *)
> +
> +@findex Activate
> +PROCEDURE Activate (procId: ProcessId);
> +  (* Causes the process identified by procId to enter the ready
> +     state, and thus to become eligible to run again.
> +  *)
> +
> +@findex SuspendMeAndActivate
> +PROCEDURE SuspendMeAndActivate (procId: ProcessId);
> +  (* Executes an atomic sequence of SuspendMe() and
> +     Activate(procId). *)
> +
> +@findex Switch
> +PROCEDURE Switch (procId: ProcessId; VAR info: Parameter);
> +  (* Causes the calling process to enter the passive state; the
> +     process identified by procId becomes the currently executing
> +     process.  info is used to pass parameter information from the
> +     calling to the activated process.  On return, info will
> +     contain information from the process that chooses to switch
> +     back to this one (or will be NIL if Activate or
> +     SuspendMeAndActivate are used instead of Switch).
> +  *)
> +
> +@findex Wait
> +PROCEDURE Wait ();
> +  (* Causes the calling process to enter the waiting state.
> +     The procedure will return when the calling process is
> +     activated by another process, or when one of its associated
> +     eventSources has generated an event.
> +  *)
> +
> +(* The following procedures allow the association of processes
> +   with sources of external events.
> +*)
> +
> +@findex Attach
> +PROCEDURE Attach (eventSource: Sources);
> +  (* Associates the specified eventSource with the calling
> +     process. *)
> +
> +@findex Detach
> +PROCEDURE Detach (eventSource: Sources);
> +  (* Dissociates the specified eventSource from the program. *)
> +
> +@findex IsAttached
> +PROCEDURE IsAttached (eventSource: Sources): BOOLEAN;
> +  (* Returns TRUE if and only if the specified eventSource is
> +     currently associated with one of the processes of the
> +     program.
> +  *)
> +
> +@findex Handler
> +PROCEDURE Handler (eventSource: Sources): ProcessId;
> +  (* Returns the identity of the process, if any, that is
> +     associated with the specified eventSource.
> +  *)
> +
> +(* The following procedures allow processes to obtain their
> +   identity, parameters, and urgency.
> +*)
> +
> +@findex Me
> +PROCEDURE Me (): ProcessId;
> +  (* Returns the identity of the calling process (as assigned
> +     when the process was first created).
> +  *)
> +
> +@findex MyParam
> +PROCEDURE MyParam (): Parameter;
> +  (* Returns the value specified as procParams when the calling
> +     process was created. *)
> +
> +@findex UrgencyOf
> +PROCEDURE UrgencyOf (procId: ProcessId): Urgency;
> +  (* Returns the urgency established when the process identified
> +     by procId was first created.
> +  *)
> +
> +(* The following procedure provides facilities for exception
> +   handlers. *)
> +
> +@findex ProcessesException
> +PROCEDURE ProcessesException (): ProcessesExceptions;
> +  (* If the current coroutine is in the exceptional execution state
> +     because of the raising of a language exception, returns the
> +     corresponding enumeration value, and otherwise raises an
> +     exception.
> +  *)
> +
> +@findex IsProcessesException
> +PROCEDURE IsProcessesException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception in
> +     a routine from this module; otherwise returns FALSE.
> +  *)
> +
> +(*
> +   Reschedule - rotates the ready queue and transfers to the process
> +                with the highest run priority.
> +*)
> +
> +@findex Reschedule
> +PROCEDURE Reschedule ;
> +
> +
> +(*
> +   displayProcesses -
> +*)
> +
> +@findex displayProcesses
> +PROCEDURE displayProcesses (message: ARRAY OF CHAR) ;
> +
> +
> +END Processes.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ProgramArgs, gm2-libs-iso/RTco, gm2-libs-iso/Processes, M2 ISO Libraries
> +@subsection gm2-libs-iso/ProgramArgs
> +
> +@example
> +DEFINITION MODULE ProgramArgs;
> +
> +  (* Access to program arguments *)
> +
> +IMPORT IOChan;
> +
> +TYPE
> +@findex ChanId (type)
> +  ChanId = IOChan.ChanId;
> +
> +@findex ArgChan
> +PROCEDURE ArgChan (): ChanId;
> +  (* Returns a value that identifies a channel for reading
> +     program arguments *)
> +
> +@findex IsArgPresent
> +PROCEDURE IsArgPresent (): BOOLEAN;
> +  (* Tests if there is a current argument to read from.  If not,
> +     read <= IOChan.CurrentFlags() will be FALSE, and attempting
> +     to read from the argument channel will raise the exception
> +     notAvailable.
> +  *)
> +
> +@findex NextArg
> +PROCEDURE NextArg ();
> +  (* If there is another argument, causes subsequent input from the
> +     argument device to come from the start of the next argument.
> +     Otherwise there is no argument to read from, and a call of
> +     IsArgPresent will return FALSE.
> +  *)
> +
> +END ProgramArgs.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTco, gm2-libs-iso/RTdata, gm2-libs-iso/ProgramArgs, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTco
> +
> +@example
> +DEFINITION MODULE RTco ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +(* init initializes the module and allows the application to lazily invoke threads.  *)
> +
> +@findex init
> +PROCEDURE init () : INTEGER ;
> +
> +@findex initThread
> +PROCEDURE initThread (p: PROC; stackSize: CARDINAL; interruptLevel: CARDINAL) : INTEGER ;
> +
> +@findex initSemaphore
> +PROCEDURE initSemaphore (value: CARDINAL) : INTEGER ;
> +
> +@findex wait
> +PROCEDURE wait (semaphore: INTEGER) ;
> +
> +@findex signal
> +PROCEDURE signal (semaphore: INTEGER) ;
> +
> +@findex transfer
> +PROCEDURE transfer (VAR p1: INTEGER; p2: INTEGER) ;
> +
> +@findex waitThread
> +PROCEDURE waitThread (tid: INTEGER) ;
> +
> +@findex signalThread
> +PROCEDURE signalThread (tid: INTEGER) ;
> +
> +@findex currentThread
> +PROCEDURE currentThread () : INTEGER ;
> +
> +
> +(* currentInterruptLevel returns the interrupt level of the current thread.  *)
> +
> +@findex currentInterruptLevel
> +PROCEDURE currentInterruptLevel () : CARDINAL ;
> +
> +
> +(* turninterrupts returns the old interrupt level and assigns the interrupt level
> +   to newLevel.  *)
> +
> +@findex turnInterrupts
> +PROCEDURE turnInterrupts (newLevel: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   select access to the select system call which will be thread safe.
> +   This is typically called from the idle process to wait for an interrupt.
> +*)
> +
> +@findex select
> +PROCEDURE select (p1: INTEGER;
> +                  p2: ADDRESS;
> +                  p3: ADDRESS;
> +                  p4: ADDRESS;
> +                  p5: ADDRESS) : INTEGER ;
> +
> +
> +END RTco.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTdata, gm2-libs-iso/RTentity, gm2-libs-iso/RTco, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTdata
> +
> +@example
> +DEFINITION MODULE RTdata ;
> +
> +(*
> +    Description: provides a mechanism whereby devices can store
> +                 data attached to a device.
> +*)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM IOLink IMPORT DeviceTablePtr ;
> +
> +TYPE
> +@findex ModuleId (type)
> +   ModuleId ;
> +@findex FreeProcedure (type)
> +   FreeProcedure = PROCEDURE (ADDRESS) ;
> +
> +
> +(*
> +   MakeModuleId - creates a unique module Id.
> +*)
> +
> +@findex MakeModuleId
> +PROCEDURE MakeModuleId (VAR m: ModuleId) ;
> +
> +
> +(*
> +   InitData - adds, datum, to the device, d.  The datum
> +              is associated with ModuleID, m.
> +*)
> +
> +@findex InitData
> +PROCEDURE InitData (d: DeviceTablePtr; m: ModuleId;
> +                    datum: ADDRESS; f: FreeProcedure) ;
> +
> +
> +(*
> +   GetData - returns the datum assocated with ModuleId, m.
> +*)
> +
> +@findex GetData
> +PROCEDURE GetData (d: DeviceTablePtr; m: ModuleId) : ADDRESS ;
> +
> +
> +(*
> +   KillData - destroys the datum associated with ModuleId, m,
> +              in device, d.  It invokes the free procedure
> +              given during InitData.
> +*)
> +
> +@findex KillData
> +PROCEDURE KillData (d: DeviceTablePtr; m: ModuleId) ;
> +
> +
> +END RTdata.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTentity, gm2-libs-iso/RTfio, gm2-libs-iso/RTdata, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTentity
> +
> +@example
> +DEFINITION MODULE RTentity ;
> +
> +(*
> +    Description: provides a set of routines for maintaining an
> +                 efficient mechanism to group opaque (or pointer)
> +                 data structures together.  Internally the
> +                 entities are grouped together using a binary
> +                 tree.  It does not use Storage - and instead
> +                 uses malloc, free from libc as Storage uses the
> +                 module to detect erroneous deallocations.
> +*)
> +
> +IMPORT SYSTEM ;
> +
> +TYPE
> +@findex Group (type)
> +   Group ;
> +
> +
> +@findex InitGroup
> +PROCEDURE InitGroup () : Group ;
> +@findex KillGroup
> +PROCEDURE KillGroup (g: Group) : Group ;
> +@findex GetKey
> +PROCEDURE GetKey (g: Group; a: SYSTEM.ADDRESS) : CARDINAL ;
> +@findex PutKey
> +PROCEDURE PutKey (g: Group; a: SYSTEM.ADDRESS; key: CARDINAL) ;
> +@findex DelKey
> +PROCEDURE DelKey (g: Group; a: SYSTEM.ADDRESS) ;
> +@findex IsIn
> +PROCEDURE IsIn (g: Group; a: SYSTEM.ADDRESS) : BOOLEAN ;
> +
> +
> +END RTentity.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTfio, gm2-libs-iso/RTgen, gm2-libs-iso/RTentity, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTfio
> +
> +@example
> +DEFINITION MODULE RTfio ;
> +
> +(*
> +    Description: provides default FIO based methods for the RTgenif
> +                 procedures.  These will be used by StreamFile,
> +                 SeqFile, StdChans, TermFile and RndFile.
> +*)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM IOLink IMPORT DeviceTablePtr;
> +FROM RTgenif IMPORT GenDevIF ;
> +
> +
> +(*
> +   doreadchar - returns a CHAR from the file associated with, g.
> +*)
> +
> +@findex doreadchar
> +PROCEDURE doreadchar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
> +
> +
> +(*
> +   dounreadchar - pushes a CHAR back onto the file associated
> +                  with, g.
> +*)
> +
> +@findex dounreadchar
> +PROCEDURE dounreadchar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
> +
> +
> +(*
> +   dogeterrno - returns the errno relating to the generic device.
> +*)
> +
> +@findex dogeterrno
> +PROCEDURE dogeterrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
> +
> +
> +(*
> +   dorbytes - reads upto, max, bytes setting, actual, and
> +              returning FALSE if an error (not due to eof)
> +              occurred.
> +*)
> +
> +@findex dorbytes
> +PROCEDURE dorbytes (g: GenDevIF;
> +                    d: DeviceTablePtr;
> +                    to: ADDRESS;
> +                    max: CARDINAL;
> +                    VAR actual: CARDINAL) : BOOLEAN ;
> +
> +(*
> +   dowbytes - writes up to, nBytes.  It returns FALSE
> +              if an error occurred and it sets actual
> +              to the amount of data written.
> +*)
> +
> +@findex dowbytes
> +PROCEDURE dowbytes (g: GenDevIF;
> +                    d: DeviceTablePtr;
> +                    from: ADDRESS;
> +                    nBytes: CARDINAL;
> +                    VAR actual: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   dowriteln - attempt to write an end of line marker to the
> +               file and returns TRUE if successful.
> +*)
> +
> +@findex dowriteln
> +PROCEDURE dowriteln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   iseof - returns TRUE if end of file has been seen.
> +*)
> +
> +@findex iseof
> +PROCEDURE iseof (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   iseoln - returns TRUE if end of line has been seen.
> +*)
> +
> +@findex iseoln
> +PROCEDURE iseoln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   iserror - returns TRUE if an error was seen on the device.
> +             Note that reaching EOF is not classified as an
> +             error.
> +*)
> +
> +@findex iserror
> +PROCEDURE iserror (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +END RTfio.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTgen, gm2-libs-iso/RTgenif, gm2-libs-iso/RTfio, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTgen
> +
> +@example
> +DEFINITION MODULE RTgen ;
> +
> +(*
> +    Description: provides a generic device interface between
> +                 ISO channels and the underlying PIM style
> +                 FIO procedure calls.
> +*)
> +
> +FROM RTgenif IMPORT GenDevIF ;
> +FROM IOLink IMPORT DeviceId, DeviceTablePtr;
> +FROM IOConsts IMPORT ReadResults ;
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +
> +TYPE
> +@findex ChanDev (type)
> +   ChanDev ;
> +@findex DeviceType (type)
> +   DeviceType = (seqfile, streamfile, programargs, stdchans, term, socket, rndfile) ;
> +
> +
> +(*
> +   InitChanDev - initialize and return a ChanDev.
> +*)
> +
> +@findex InitChanDev
> +PROCEDURE InitChanDev (t: DeviceType; d: DeviceId; g: GenDevIF) : ChanDev ;
> +
> +
> +(*
> +   KillChanDev - deallocates, g.
> +*)
> +
> +@findex KillChanDev
> +PROCEDURE KillChanDev (g: GenDevIF) : GenDevIF ;
> +
> +
> +(*
> +   RaiseEOFinLook - returns TRUE if the Look procedure
> +                    should raise an exception if it
> +                    sees end of file.
> +*)
> +
> +@findex RaiseEOFinLook
> +PROCEDURE RaiseEOFinLook (g: ChanDev) : BOOLEAN ;
> +
> +
> +(*
> +   RaiseEOFinSkip - returns TRUE if the Skip procedure
> +                    should raise an exception if it
> +                    sees end of file.
> +*)
> +
> +@findex RaiseEOFinSkip
> +PROCEDURE RaiseEOFinSkip (g: ChanDev) : BOOLEAN ;
> +
> +
> +@findex doLook
> +PROCEDURE doLook (g: ChanDev;
> +                  d: DeviceTablePtr;
> +                  VAR ch: CHAR;
> +                  VAR r: ReadResults) ;
> +
> +@findex doSkip
> +PROCEDURE doSkip (g: ChanDev;
> +                  d: DeviceTablePtr) ;
> +
> +@findex doSkipLook
> +PROCEDURE doSkipLook (g: ChanDev;
> +                      d: DeviceTablePtr;
> +                      VAR ch: CHAR;
> +                      VAR r: ReadResults) ;
> +
> +@findex doWriteLn
> +PROCEDURE doWriteLn (g: ChanDev;
> +                     d: DeviceTablePtr) ;
> +
> +@findex doReadText
> +PROCEDURE doReadText (g: ChanDev;
> +                      d: DeviceTablePtr;
> +                      to: ADDRESS;
> +                      maxChars: CARDINAL;
> +                      VAR charsRead: CARDINAL) ;
> +
> +@findex doWriteText
> +PROCEDURE doWriteText (g: ChanDev;
> +                       d: DeviceTablePtr;
> +                       from: ADDRESS;
> +                       charsToWrite: CARDINAL) ;
> +
> +@findex doReadLocs
> +PROCEDURE doReadLocs (g: ChanDev;
> +                      d: DeviceTablePtr;
> +                      to: ADDRESS;
> +                      maxLocs: CARDINAL;
> +                      VAR locsRead: CARDINAL) ;
> +
> +@findex doWriteLocs
> +PROCEDURE doWriteLocs (g: ChanDev;
> +                       d: DeviceTablePtr;
> +                       from: ADDRESS;
> +                       locsToWrite: CARDINAL) ;
> +
> +(*
> +   checkErrno - checks a number of errno conditions and raises
> +                appropriate ISO exceptions if they occur.
> +*)
> +
> +@findex checkErrno
> +PROCEDURE checkErrno (g: ChanDev; d: DeviceTablePtr) ;
> +
> +
> +END RTgen.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTgenif, gm2-libs-iso/RTio, gm2-libs-iso/RTgen, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTgenif
> +
> +@example
> +DEFINITION MODULE RTgenif ;
> +
> +(*
> +    Description: provides a generic interface mechanism used
> +                 by RTgen.  This is not an ISO module but rather
> +                 a runtime support module.
> +*)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM IOLink IMPORT DeviceId, DeviceTablePtr ;
> +
> +TYPE
> +@findex GenDevIF (type)
> +   GenDevIF ;
> +@findex readchar (type)
> +   readchar   = PROCEDURE (GenDevIF, DeviceTablePtr) : CHAR ;
> +@findex unreadchar (type)
> +   unreadchar = PROCEDURE (GenDevIF, DeviceTablePtr, CHAR) : CHAR ;
> +@findex geterrno (type)
> +   geterrno   = PROCEDURE (GenDevIF, DeviceTablePtr) : INTEGER ;
> +@findex readbytes (type)
> +   readbytes  = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
> +@findex writebytes (type)
> +   writebytes = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
> +@findex writeln (type)
> +   writeln    = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
> +@findex iseof (type)
> +   iseof      = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
> +@findex iseoln (type)
> +   iseoln     = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
> +@findex iserror (type)
> +   iserror    = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   InitGenDevIF - initializes a generic device.
> +*)
> +
> +@findex InitGenDevIF
> +PROCEDURE InitGenDevIF (d     : DeviceId;
> +                        rc    : readchar;
> +                        urc   : unreadchar;
> +                        geterr: geterrno;
> +                        rbytes: readbytes;
> +                        wbytes: writebytes;
> +                        wl    : writeln;
> +                        eof   : iseof;
> +                        eoln  : iseoln;
> +                        iserr : iserror) : GenDevIF ;
> +
> +
> +(*
> +   getDID - returns the device id this generic interface.
> +*)
> +
> +@findex getDID
> +PROCEDURE getDID (g: GenDevIF) : DeviceId ;
> +
> +
> +(*
> +   doReadChar - returns the next character from the generic
> +                device.
> +*)
> +
> +@findex doReadChar
> +PROCEDURE doReadChar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
> +
> +
> +(*
> +   doUnReadChar - pushes back a character to the generic device.
> +*)
> +
> +@findex doUnReadChar
> +PROCEDURE doUnReadChar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
> +
> +
> +(*
> +   doGetErrno - returns the errno relating to the generic device.
> +*)
> +
> +@findex doGetErrno
> +PROCEDURE doGetErrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
> +
> +
> +(*
> +   doRBytes - attempts to read, n, bytes from the generic device.
> +              It set the actual amount read and returns a boolean
> +              to determine whether an error occurred.
> +*)
> +
> +@findex doRBytes
> +PROCEDURE doRBytes (g: GenDevIF; d: DeviceTablePtr;
> +                    to: ADDRESS; max: CARDINAL;
> +                    VAR actual: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   doWBytes - attempts to write, n, bytes to the generic device.
> +              It sets the actual amount written and returns a
> +              boolean to determine whether an error occurred.
> +*)
> +
> +@findex doWBytes
> +PROCEDURE doWBytes (g: GenDevIF; d: DeviceTablePtr;
> +                    from: ADDRESS; max: CARDINAL;
> +                    VAR actual: CARDINAL) : BOOLEAN ;
> +
> +
> +(*
> +   doWrLn - writes an end of line marker and returns
> +            TRUE if successful.
> +*)
> +
> +@findex doWrLn
> +PROCEDURE doWrLn (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   isEOF - returns true if the end of file was reached.
> +*)
> +
> +@findex isEOF
> +PROCEDURE isEOF (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   isEOLN - returns true if the end of line was reached.
> +*)
> +
> +@findex isEOLN
> +PROCEDURE isEOLN (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   isError - returns true if an error was seen in the device.
> +*)
> +
> +@findex isError
> +PROCEDURE isError (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
> +
> +
> +(*
> +   KillGenDevIF - deallocates a generic device.
> +*)
> +
> +@findex KillGenDevIF
> +PROCEDURE KillGenDevIF (g: GenDevIF) : GenDevIF ;
> +
> +
> +END RTgenif.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RTio, gm2-libs-iso/RandomNumber, gm2-libs-iso/RTgenif, M2 ISO Libraries
> +@subsection gm2-libs-iso/RTio
> +
> +@example
> +DEFINITION MODULE RTio ;
> +
> +(*
> +    Description: provides low level routines for creating and destroying
> +                 ChanIds.  This is necessary to allow multiple modules
> +                 to create, ChanId values, where ChanId is an opaque
> +                 type.
> +*)
> +
> +IMPORT FIO, IOLink ;
> +
> +TYPE
> +@findex ChanId (type)
> +   ChanId ;
> +
> +
> +(*
> +   InitChanId - return a new ChanId.
> +*)
> +
> +@findex InitChanId
> +PROCEDURE InitChanId () : ChanId ;
> +
> +
> +(*
> +   KillChanId - deallocate a ChanId.
> +*)
> +
> +@findex KillChanId
> +PROCEDURE KillChanId (c: ChanId) : ChanId ;
> +
> +
> +(*
> +   NilChanId - return a NIL pointer.
> +*)
> +
> +@findex NilChanId
> +PROCEDURE NilChanId () : ChanId ;
> +
> +
> +(*
> +   GetDeviceId - returns the device id, from, c.
> +*)
> +
> +@findex GetDeviceId
> +PROCEDURE GetDeviceId (c: ChanId) : IOLink.DeviceId ;
> +
> +
> +(*
> +   SetDeviceId - sets the device id in, c.
> +*)
> +
> +@findex SetDeviceId
> +PROCEDURE SetDeviceId (c: ChanId; d: IOLink.DeviceId) ;
> +
> +
> +(*
> +   GetDevicePtr - returns the device table ptr, from, c.
> +*)
> +
> +@findex GetDevicePtr
> +PROCEDURE GetDevicePtr (c: ChanId) : IOLink.DeviceTablePtr ;
> +
> +
> +(*
> +   SetDevicePtr - sets the device table ptr in, c.
> +*)
> +
> +@findex SetDevicePtr
> +PROCEDURE SetDevicePtr (c: ChanId; p: IOLink.DeviceTablePtr) ;
> +
> +
> +(*
> +   GetFile - returns the file field from, c.
> +*)
> +
> +@findex GetFile
> +PROCEDURE GetFile (c: ChanId) : FIO.File ;
> +
> +
> +(*
> +   SetFile - sets the file field in, c.
> +*)
> +
> +@findex SetFile
> +PROCEDURE SetFile (c: ChanId; f: FIO.File) ;
> +
> +
> +END RTio.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RandomNumber, gm2-libs-iso/RawIO, gm2-libs-iso/RTio, M2 ISO Libraries
> +@subsection gm2-libs-iso/RandomNumber
> +
> +@example
> +DEFINITION MODULE RandomNumber ;
> +
> +(*
> +    Description: provides primitives for obtaining random numbers on
> +                 pervasive data types.
> +*)
> +
> +FROM SYSTEM IMPORT BYTE ;
> +EXPORT QUALIFIED Randomize, RandomInit, RandomBytes,
> +                 RandomCard, RandomShortCard, RandomLongCard,
> +                 RandomInt, RandomShortInt, RandomLongInt,
> +                 RandomReal, RandomLongReal, RandomShortReal ;
> +
> +
> +(*
> +   Randomize - initialize the random number generator with a seed
> +               based on the microseconds.
> +*)
> +
> +@findex Randomize
> +PROCEDURE Randomize ;
> +
> +
> +(*
> +   RandomInit - initialize the random number generator with value, seed.
> +*)
> +
> +@findex RandomInit
> +PROCEDURE RandomInit (seed: CARDINAL) ;
> +
> +
> +(*
> +   RandomBytes - fills in an array with random values.
> +*)
> +
> +@findex RandomBytes
> +PROCEDURE RandomBytes (VAR a: ARRAY OF BYTE) ;
> +
> +
> +(*
> +   RandomInt - return an INTEGER in the range [low .. high].
> +*)
> +
> +@findex RandomInt
> +PROCEDURE RandomInt (low, high: INTEGER) : INTEGER ;
> +
> +
> +(*
> +   RandomShortInt - return an SHORTINT in the range [low..high].
> +*)
> +
> +@findex RandomShortInt
> +PROCEDURE RandomShortInt (low, high: SHORTINT) : SHORTINT ;
> +
> +
> +(*
> +   RandomLongInt - return an LONGINT in the range [low..high].
> +*)
> +
> +@findex RandomLongInt
> +PROCEDURE RandomLongInt (low, high: LONGINT) : LONGINT ;
> +
> +
> +(*
> +   RandomShortCard - return a SHORTCARD in the range [low..high].
> +*)
> +
> +@findex RandomShortCard
> +PROCEDURE RandomShortCard (low, high: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   RandomCard - return a CARDINAL in the range [low..high].
> +*)
> +
> +@findex RandomCard
> +PROCEDURE RandomCard (low, high: CARDINAL) : CARDINAL ;
> +
> +
> +(*
> +   RandomLongCard - return an LONGCARD in the range [low..high].
> +*)
> +
> +@findex RandomLongCard
> +PROCEDURE RandomLongCard (low, high: LONGCARD) : LONGCARD ;
> +
> +
> +(*
> +   RandomReal - return a REAL number in the range 0.0..1.0
> +*)
> +
> +@findex RandomReal
> +PROCEDURE RandomReal () : REAL ;
> +
> +
> +(*
> +   RandomShortReal - return a SHORTREAL number in the range 0.0..1.0
> +*)
> +
> +@findex RandomShortReal
> +PROCEDURE RandomShortReal () : SHORTREAL ;
> +
> +
> +(*
> +   RandomLongReal - return a LONGREAL number in the range 0.0..1.0
> +*)
> +
> +@findex RandomLongReal
> +PROCEDURE RandomLongReal () : LONGREAL ;
> +
> +
> +END RandomNumber.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RawIO, gm2-libs-iso/RealConv, gm2-libs-iso/RandomNumber, M2 ISO Libraries
> +@subsection gm2-libs-iso/RawIO
> +
> +@example
> +DEFINITION MODULE RawIO;
> +
> +  (* Reading and writing data over specified channels using raw
> +     operations, that is, with no conversion or interpretation.
> +     The read result is of the type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan, SYSTEM;
> +
> +@findex Read
> +PROCEDURE Read (cid: IOChan.ChanId; VAR to: ARRAY OF SYSTEM.LOC);
> +  (* Reads storage units from cid, and assigns them to
> +     successive components of to. The read result is set
> +     to the value allRight, wrongFormat, or endOfInput.
> +  *)
> +
> +@findex Write
> +PROCEDURE Write (cid: IOChan.ChanId; from: ARRAY OF SYSTEM.LOC);
> +  (* Writes storage units to cid from successive components
> +     of from. *)
> +
> +END RawIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RealConv, gm2-libs-iso/RealIO, gm2-libs-iso/RawIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/RealConv
> +
> +@example
> +DEFINITION MODULE RealConv;
> +
> +  (* Low-level REAL/string conversions *)
> +
> +IMPORT
> +  ConvTypes;
> +
> +TYPE
> +  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
> +@findex ConvResults (type)
> +  ConvResults = ConvTypes.ConvResults;
> +
> +@findex ScanReal
> +PROCEDURE ScanReal (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
> +                    VAR nextState: ConvTypes.ScanState);
> +  (* Represents the start state of a finite state scanner for real
> +     numbers - assigns class of inputCh to chClass and a procedure
> +     representing the next state to nextState.
> +   *)
> +
> +@findex FormatReal
> +PROCEDURE FormatReal (str: ARRAY OF CHAR): ConvResults;
> +  (* Returns the format of the string value for conversion to REAL. *)
> +
> +@findex ValueReal
> +PROCEDURE ValueReal (str: ARRAY OF CHAR): REAL;
> +  (* Returns the value corresponding to the real number string value
> +     str if str is well-formed; otherwise raises the RealConv
> +     exception.
> +  *)
> +
> +@findex LengthFloatReal
> +PROCEDURE LengthFloatReal (real: REAL; sigFigs: CARDINAL): CARDINAL;
> +  (* Returns the number of characters in the floating-point string
> +     representation of real with sigFigs significant figures.
> +  *)
> +
> +@findex LengthEngReal
> +PROCEDURE LengthEngReal (real: REAL; sigFigs: CARDINAL): CARDINAL;
> +  (* Returns the number of characters in the floating-point engineering
> +     string representation of real with sigFigs significant figures.
> +  *)
> +
> +@findex LengthFixedReal
> +PROCEDURE LengthFixedReal (real: REAL; place: INTEGER): CARDINAL;
> +  (* Returns the number of characters in the fixed-point string
> +     representation of real rounded to the given place relative to the
> +     decimal point.
> +  *)
> +
> +@findex IsRConvException
> +PROCEDURE IsRConvException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception in a
> +     routine from this module; otherwise returns FALSE.
> +  *)
> +
> +END RealConv.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RealIO, gm2-libs-iso/RealMath, gm2-libs-iso/RealConv, M2 ISO Libraries
> +@subsection gm2-libs-iso/RealIO
> +
> +@example
> +DEFINITION MODULE RealIO;
> +
> +  (* Input and output of real numbers in decimal text form
> +     over specified channels.  The read result is of the
> +     type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@},
> +       [".", @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: REAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed fixed or floating
> +     point number.  The value of this number is assigned to real.
> +     The read result is set to the value allRight, outOfRange,
> +     wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (cid: IOChan.ChanId; real: REAL;
> +                      sigFigs: CARDINAL; width: CARDINAL);
> +  (* Writes the value of real to cid in floating-point text form,
> +     with sigFigs significant figures, in a field of the given
> +     minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (cid: IOChan.ChanId; real: REAL;
> +                    sigFigs: CARDINAL; width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with
> +     one to three digits in the whole number part, and with an
> +     exponent that is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (cid: IOChan.ChanId; real: REAL;
> +                      place: INTEGER; width: CARDINAL);
> +  (* Writes the value of real to cid in fixed-point text form,
> +     rounded to the given place relative to the decimal point,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (cid: IOChan.ChanId;
> +                     real: REAL; width: CARDINAL);
> +  (* Writes the value of real to cid, as WriteFixed if the sign
> +     and magnitude can be shown in the given width, or otherwise
> +     as WriteFloat.  The number of places or significant digits
> +     depends on the given width.
> +  *)
> +
> +END RealIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RealMath, gm2-libs-iso/RealStr, gm2-libs-iso/RealIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/RealMath
> +
> +@example
> +DEFINITION MODULE RealMath;
> +
> +  (* Mathematical functions for the type REAL *)
> +
> +CONST
> +@findex pi (const)
> +  pi   = 3.1415926535897932384626433832795028841972;
> +@findex exp1 (const)
> +  exp1 = 2.7182818284590452353602874713526624977572;
> +
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: REAL): REAL;
> +  (* Returns the positive square root of x *)
> +
> +@findex exp
> +PROCEDURE __BUILTIN__ exp (x: REAL): REAL;
> +  (* Returns the exponential of x *)
> +
> +@findex ln
> +PROCEDURE __BUILTIN__ ln (x: REAL): REAL;
> +  (* Returns the natural logarithm of x *)
> +
> +  (* The angle in all trigonometric functions is measured in radians *)
> +
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: REAL): REAL;
> +  (* Returns the sine of x *)
> +
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: REAL): REAL;
> +  (* Returns the cosine of x *)
> +
> +@findex tan
> +PROCEDURE tan (x: REAL): REAL;
> +  (* Returns the tangent of x *)
> +
> +@findex arcsin
> +PROCEDURE arcsin (x: REAL): REAL;
> +  (* Returns the arcsine of x *)
> +
> +@findex arccos
> +PROCEDURE arccos (x: REAL): REAL;
> +  (* Returns the arccosine of x *)
> +
> +@findex arctan
> +PROCEDURE arctan (x: REAL): REAL;
> +  (* Returns the arctangent of x *)
> +
> +@findex power
> +PROCEDURE power (base, exponent: REAL) : REAL;
> +  (* Returns the value of the number base raised to the power exponent *)
> +
> +@findex round
> +PROCEDURE round (x: REAL) : INTEGER;
> +  (* Returns the value of x rounded to the nearest integer *)
> +
> +@findex IsRMathException
> +PROCEDURE IsRMathException () : BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END RealMath.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RealStr, gm2-libs-iso/RndFile, gm2-libs-iso/RealMath, M2 ISO Libraries
> +@subsection gm2-libs-iso/RealStr
> +
> +@example
> +DEFINITION MODULE RealStr;
> +
> +  (* REAL/string conversions *)
> +
> +IMPORT
> +  ConvTypes;
> +
> +TYPE
> +  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
> +@findex ConvResults (type)
> +  ConvResults = ConvTypes.ConvResults;
> +
> +(* the string form of a signed fixed-point real number is
> +     ["+" | "-"], decimal digit, @{decimal digit@}, [".",
> +     @{decimal digit@}]
> +*)
> +
> +(* the string form of a signed floating-point real number is
> +     signed fixed-point real number, "E", ["+" | "-"],
> +     decimal digit, @{decimal digit@}
> +*)
> +
> +@findex StrToReal
> +PROCEDURE StrToReal (str: ARRAY OF CHAR; VAR real: REAL;
> +                     VAR res: ConvResults);
> +  (* Ignores any leading spaces in str. If the subsequent characters
> +     in str are in the format of a signed real number, assigns a
> +     corresponding value to real.  Assigns a value indicating the
> +     format of str to res.
> +  *)
> +
> +@findex RealToFloat
> +PROCEDURE RealToFloat (real: REAL; sigFigs: CARDINAL;
> +                       VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to floating-point string form, with
> +     sigFigs significant figures, and copies the possibly truncated
> +     result to str.
> +  *)
> +
> +@findex RealToEng
> +PROCEDURE RealToEng (real: REAL; sigFigs: CARDINAL;
> +                     VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to floating-point string form, with
> +     sigFigs significant figures, and copies the possibly truncated
> +     result to str.  The number is scaled with one to three digits
> +     in the whole number part and with an exponent that is a multiple
> +     of three.
> +  *)
> +
> +@findex RealToFixed
> +PROCEDURE RealToFixed (real: REAL; place: INTEGER;
> +                       VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real to fixed-point string form, rounded
> +     to the given place relative to the decimal point, and copies
> +     the possibly truncated result to str.
> +  *)
> +
> +@findex RealToStr
> +PROCEDURE RealToStr (real: REAL; VAR str: ARRAY OF CHAR);
> +  (* Converts the value of real as RealToFixed if the sign and
> +     magnitude can be shown within the capacity of str, or
> +     otherwise as RealToFloat, and copies the possibly truncated
> +     result to str. The number of places or significant digits are
> +     implementation-defined.
> +  *)
> +
> +END RealStr.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/RndFile, gm2-libs-iso/SIOResult, gm2-libs-iso/RealStr, M2 ISO Libraries
> +@subsection gm2-libs-iso/RndFile
> +
> +@example
> +DEFINITION MODULE RndFile;
> +
> +  (* Random access files *)
> +
> +IMPORT IOChan, ChanConsts, SYSTEM;
> +
> +TYPE
> +@findex ChanId (type)
> +   ChanId = IOChan.ChanId;
> +@findex FlagSet (type)
> +   FlagSet = ChanConsts.FlagSet;
> +@findex OpenResults (type)
> +   OpenResults = ChanConsts.OpenResults;
> +
> +   (* Accepted singleton values of FlagSet *)
> +
> +CONST
> +   (* input operations are requested/available *)
> +@findex read (const)
> +   read = FlagSet@{ChanConsts.readFlag@};
> +   (* output operations are requested/available *)
> +@findex write (const)
> +   write = FlagSet@{ChanConsts.writeFlag@};
> +   (* a file may/must/did exist before the channel is opened *)
> +@findex old (const)
> +   old = FlagSet@{ChanConsts.oldFlag@};
> +   (* text operations are requested/available *)
> +@findex text (const)
> +   text = FlagSet@{ChanConsts.textFlag@};
> +   (* raw operations are requested/available *)
> +@findex raw (const)
> +   raw = FlagSet@{ChanConsts.rawFlag@};
> +
> +@findex OpenOld
> +PROCEDURE OpenOld (VAR cid: ChanId; name: ARRAY OF CHAR; flags: FlagSet;
> +                   VAR res: OpenResults);
> +  (* Attempts to obtain and open a channel connected to a stored random
> +     access file of the given name.
> +     The old flag is implied; without the write flag, read is implied;
> +     without the text flag, raw is implied.
> +     If successful, assigns to cid the identity of the opened channel,
> +     assigns the value opened to res, and sets the read/write position
> +     to the start of the file.
> +     If a channel cannot be opened as required, the value of res indicates
> +     the reason, and cid identifies the invalid channel.
> +  *)
> +
> +@findex OpenClean
> +PROCEDURE OpenClean (VAR cid: ChanId; name: ARRAY OF CHAR; flags: FlagSet;
> +                     VAR res: OpenResults);
> +  (* Attempts to obtain and open a channel connected to a stored random
> +     access file of the given name.
> +     The write flag is implied; without the text flag, raw is implied.
> +     If successful, assigns to cid the identity of the opened channel,
> +     assigns the value opened to res, and truncates the file to zero length.
> +     If a channel cannot be opened as required, the value of res indicates
> +     the reason, and cid identifies the invalid channel.
> +  *)
> +
> +@findex IsRndFile
> +PROCEDURE IsRndFile (cid: ChanId): BOOLEAN;
> +  (* Tests if the channel identified by cid is open to a random access file. *)
> +
> +@findex IsRndFileException
> +PROCEDURE IsRndFileException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution
> +     state because of the raising of a RndFile exception; otherwise returns
> +     FALSE.
> +  *)
> +
> +CONST
> +@findex FilePosSize (const)
> +   FilePosSize = SIZE(LONGINT) ;
> +   (* <implementation-defined whole number greater than zero>; *)
> +
> +TYPE
> +@findex FilePos (type)
> +   FilePos = LONGINT ;  (* ARRAY [1 .. FilePosSize] OF SYSTEM.LOC; *)
> +
> +@findex StartPos
> +PROCEDURE StartPos (cid: ChanId): FilePos;
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise returns the position of
> +     the start of the file.
> +  *)
> +
> +@findex CurrentPos
> +PROCEDURE CurrentPos (cid: ChanId): FilePos;
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise returns the position
> +     of the current read/write position.
> +  *)
> +
> +@findex EndPos
> +PROCEDURE EndPos (cid: ChanId): FilePos;
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise returns the first
> +     position after which there have been no writes.
> +  *)
> +
> +@findex NewPos
> +PROCEDURE NewPos (cid: ChanId; chunks: INTEGER; chunkSize: CARDINAL;
> +                  from: FilePos): FilePos;
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise returns the position
> +     (chunks * chunkSize) relative to the position given by from, or
> +     raises the exception posRange if the required position cannot be
> +     represented as a value of type FilePos.
> +  *)
> +
> +@findex SetPos
> +PROCEDURE SetPos (cid: ChanId; pos: FilePos);
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise sets the read/write
> +     position to the value given by pos.
> +  *)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId);
> +  (* If the channel identified by cid is not open to a random access file,
> +     the exception wrongDevice is raised; otherwise closes the channel,
> +     and assigns the value identifying the invalid channel to cid.
> +  *)
> +
> +END RndFile.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SIOResult, gm2-libs-iso/SLongIO, gm2-libs-iso/RndFile, M2 ISO Libraries
> +@subsection gm2-libs-iso/SIOResult
> +
> +@example
> +DEFINITION MODULE SIOResult;
> +
> +  (* Read results for the default input channel *)
> +
> +IMPORT IOConsts;
> +
> +TYPE
> +@findex ReadResults (type)
> +  ReadResults = IOConsts.ReadResults;
> +
> +  (*
> +@findex ReadResults (type)
> +    ReadResults =   (* This type is used to classify the result of an input operation *)
> +    (
> +      notKnown,     (* no read result is set *)
> +      allRight,     (* data is as expected or as required *)
> +      outOfRange,   (* data cannot be represented *)
> +      wrongFormat,  (* data not in expected format *)
> +      endOfLine,    (* end of line seen before expected data *)
> +      endOfInput    (* end of input seen before expected data *)
> +    );
> +  *)
> +
> +@findex ReadResult
> +PROCEDURE ReadResult (): ReadResults;
> +  (* Returns the result for the last read operation on the default input channel. *)
> +
> +END SIOResult.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SLongIO, gm2-libs-iso/SLongWholeIO, gm2-libs-iso/SIOResult, M2 ISO Libraries
> +@subsection gm2-libs-iso/SLongIO
> +
> +@example
> +DEFINITION MODULE SLongIO;
> +
> +  (* Input and output of long real numbers in decimal text form
> +     using default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@},
> +       [".", @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (VAR real: LONGREAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     fixed or floating point number. The value of this number
> +     is assigned to real.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (real: LONGREAL; sigFigs: CARDINAL;
> +                      width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     floating-point text form, with sigFigs significant figures,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (real: LONGREAL; sigFigs: CARDINAL;
> +                    width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with
> +     one to three digits in the whole number part, and with an
> +     exponent that is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (real: LONGREAL; place: INTEGER;
> +                      width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     fixed-point text form, rounded to the given place relative
> +     to the decimal point, in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (real: LONGREAL; width: CARDINAL);
> +  (* Writes the value of real to the default output channel, as
> +     WriteFixed if the sign and magnitude can be shown in the
> +     given width, or otherwise as WriteFloat. The number of
> +     places or significant digits depends on the given width.
> +  *)
> +
> +END SLongIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SLongWholeIO, gm2-libs-iso/SRawIO, gm2-libs-iso/SLongIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SLongWholeIO
> +
> +@example
> +DEFINITION MODULE SLongWholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form over
> +     default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (VAR int: LONGINT);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     whole number.  The value of this number is assigned
> +     to int.  The read result is set to the value allRight,
> +     outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (int: LONGINT; width: CARDINAL);
> +  (* Writes the value of int to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (VAR card: LONGCARD);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of an
> +     unsigned whole number.  The value of this number is
> +     assigned to card.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (card: LONGCARD; width: CARDINAL);
> +  (* Writes the value of card to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +END SLongWholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SRawIO, gm2-libs-iso/SRealIO, gm2-libs-iso/SLongWholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SRawIO
> +
> +@example
> +DEFINITION MODULE SRawIO;
> +
> +  (* Reading and writing data over default channels using raw operations, that is, with no
> +     conversion or interpretation. The read result is of the type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT SYSTEM;
> +
> +@findex Read
> +PROCEDURE Read (VAR to: ARRAY OF SYSTEM.LOC);
> +  (* Reads storage units from the default input channel, and assigns them to successive
> +     components of to.  The read result is set to the value allRight, wrongFormat, or
> +     endOfInput.
> +  *)
> +
> +@findex Write
> +PROCEDURE Write (from: ARRAY OF SYSTEM.LOC);
> +  (* Writes storage units to the default output channel from successive components of from.
> +  *)
> +
> +END SRawIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SRealIO, gm2-libs-iso/SShortIO, gm2-libs-iso/SRawIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SRealIO
> +
> +@example
> +DEFINITION MODULE SRealIO;
> +
> +  (* Input and output of real numbers in decimal text form over
> +     default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@},
> +       [".", @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (VAR real: REAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     fixed or floating point number. The value of this number
> +     is assigned to real.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (real: REAL; sigFigs: CARDINAL; width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     floating-point text form, with sigFigs significant figures,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (real: REAL; sigFigs: CARDINAL; width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with one to
> +     three digits in the whole number part, and with an exponent that
> +     is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (real: REAL; place: INTEGER; width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     fixed-point text form, rounded to the given place relative
> +     to the decimal point, in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (real: REAL; width: CARDINAL);
> +  (* Writes the value of real to the default output channel, as
> +     WriteFixed if the sign and magnitude can be shown in the
> +     given width, or otherwise as WriteFloat. The number of
> +     places or significant digits depends on the given width.
> +  *)
> +
> +END SRealIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SShortIO, gm2-libs-iso/SShortWholeIO, gm2-libs-iso/SRealIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SShortIO
> +
> +@example
> +DEFINITION MODULE SShortIO;
> +
> +  (* Input and output of short real numbers in decimal text form
> +     using default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@},
> +       [".", @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (VAR real: SHORTREAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     fixed or floating point number. The value of this number
> +     is assigned to real.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (real: SHORTREAL; sigFigs: CARDINAL;
> +                      width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     floating-point text form, with sigFigs significant figures,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (real: SHORTREAL; sigFigs: CARDINAL;
> +                    width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with
> +     one to three digits in the whole number part, and with an
> +     exponent that is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (real: SHORTREAL; place: INTEGER;
> +                      width: CARDINAL);
> +  (* Writes the value of real to the default output channel in
> +     fixed-point text form, rounded to the given place relative
> +     to the decimal point, in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (real: SHORTREAL; width: CARDINAL);
> +  (* Writes the value of real to the default output channel, as
> +     WriteFixed if the sign and magnitude can be shown in the
> +     given width, or otherwise as WriteFloat. The number of
> +     places or significant digits depends on the given width.
> +  *)
> +
> +END SShortIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SShortWholeIO, gm2-libs-iso/STextIO, gm2-libs-iso/SShortIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SShortWholeIO
> +
> +@example
> +DEFINITION MODULE SShortWholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form over
> +     default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (VAR int: SHORTINT);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     whole number.  The value of this number is assigned
> +     to int.  The read result is set to the value allRight,
> +     outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (int: SHORTINT; width: CARDINAL);
> +  (* Writes the value of int to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (VAR card: SHORTCARD);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of an
> +     unsigned whole number.  The value of this number is
> +     assigned to card.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (card: SHORTCARD; width: CARDINAL);
> +  (* Writes the value of card to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +END SShortWholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/STextIO, gm2-libs-iso/SWholeIO, gm2-libs-iso/SShortWholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/STextIO
> +
> +@example
> +DEFINITION MODULE STextIO;
> +
> +  (* Input and output of character and string types over default channels. The read result
> +     is of the type IOConsts.ReadResults.
> +  *)
> +
> +  (* The following procedures do not read past line marks *)
> +
> +@findex ReadChar
> +PROCEDURE ReadChar (VAR ch: CHAR);
> +  (* If possible, removes a character from the default input stream, and assigns the
> +     corresponding value to ch.  The read result is set to allRight, endOfLine or
> +     endOfInput.
> +  *)
> +
> +@findex ReadRestLine
> +PROCEDURE ReadRestLine (VAR s: ARRAY OF CHAR);
> +  (* Removes any remaining characters from the default input stream before the next line
> +     mark, copying to s as many as can be accommodated as a string value.  The read result
> +     is set to the value allRight, outOfRange, endOfLine, or endOfInput.
> +  *)
> +
> +@findex ReadString
> +PROCEDURE ReadString (VAR s: ARRAY OF CHAR);
> +  (* Removes only those characters from the default input stream before the next line mark
> +     that can be accommodated in s as a string value, and copies them to s. The read result
> +     is set to the value allRight, endOfLine, or endOfInput.
> +  *)
> +
> +@findex ReadToken
> +PROCEDURE ReadToken (VAR s: ARRAY OF CHAR);
> +  (* Skips leading spaces, and then removes characters from the default input stream before
> +     the next space or line mark, copying to s as many as can be accommodated as a string
> +     value.  The read result is set to the value allRight, outOfRange, endOfLine, or
> +     endOfInput.
> +  *)
> +
> +  (* The following procedure reads past the next line mark *)
> +
> +@findex SkipLine
> +PROCEDURE SkipLine;
> +  (* Removes successive items from the default input stream up to and including the next
> +     line mark or until the end of input is reached. The read result is set to the value
> +     allRight, or endOfInput.
> +  *)
> +
> +
> +  (* Output procedures *)
> +
> +@findex WriteChar
> +PROCEDURE WriteChar (ch: CHAR);
> +  (* Writes the value of ch to the default output stream. *)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn;
> +  (* Writes a line mark to the default output stream. *)
> +
> +@findex WriteString
> +PROCEDURE WriteString (s: ARRAY OF CHAR);
> +  (* Writes the string value of s to the default output stream. *)
> +
> +END STextIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SWholeIO, gm2-libs-iso/SYSTEM, gm2-libs-iso/STextIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SWholeIO
> +
> +@example
> +DEFINITION MODULE SWholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form over
> +     default channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (VAR int: INTEGER);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of a signed
> +     whole number.  The value of this number is assigned
> +     to int.  The read result is set to the value allRight,
> +     outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (int: INTEGER; width: CARDINAL);
> +  (* Writes the value of int to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (VAR card: CARDINAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from the default input channel that form part of an
> +     unsigned whole number.  The value of this number is
> +     assigned to card.  The read result is set to the value
> +     allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (card: CARDINAL; width: CARDINAL);
> +  (* Writes the value of card to the default output channel in
> +     text form, in a field of the given minimum width.
> +  *)
> +
> +END SWholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SYSTEM, gm2-libs-iso/Semaphores, gm2-libs-iso/SWholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SYSTEM
> +
> +@example
> +DEFINITION MODULE SYSTEM;
> +
> +  (* Gives access to system programming facilities that are probably
> +     non portable. *)
> +
> +  (* The constants and types define underlying properties of storage *)
> +
> +EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
> +                 LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
> +                 Target specific data types.  *)
> +                 ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
> +                 SHIFT, CAST, TSIZE,
> +
> +                 (* Internal GM2 compiler functions *)
> +                 ShiftVal, ShiftLeft, ShiftRight,
> +                 RotateVal, RotateLeft, RotateRight,
> +                 THROW, TBITSIZE ;
> +
> +CONST
> +                  (* <implementation-defined constant> ; *)
> +@findex BITSPERLOC (const)
> +  BITSPERLOC    = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
> +                  (* <implementation-defined constant> ; *)
> +@findex LOCSPERWORD (const)
> +  LOCSPERWORD   = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
> +                  (* <implementation-defined constant> ; *)
> +@findex LOCSPERBYTE (const)
> +  LOCSPERBYTE = 8 DIV BITSPERLOC ;
> +
> +(*
> +   all the objects below are declared internally to gm2
> +   ====================================================
> +
> +TYPE
> +   (* Target specific data types.  *)
> +
> +TYPE
> +  LOC; (* A system basic type. Values are the uninterpreted
> +          contents of the smallest addressable unit of storage *)
> +@findex ADDRESS (type)
> +  ADDRESS = POINTER TO LOC;
> +@findex WORD (type)
> +  WORD = ARRAY [0 .. LOCSPERWORD-1] OF LOC;
> +
> +  (* BYTE and LOCSPERBYTE are provided if appropriate for machine *)
> +
> +TYPE
> +@findex BYTE (type)
> +  BYTE = ARRAY [0 .. LOCSPERBYTE-1] OF LOC;
> +
> +@findex ADDADR
> +PROCEDURE ADDADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
> +  (* Returns address given by (addr + offset), or may raise
> +     an exception if this address is not valid.
> +  *)
> +
> +@findex SUBADR
> +PROCEDURE SUBADR (addr: ADDRESS; offset: CARDINAL): ADDRESS;
> +  (* Returns address given by (addr - offset), or may raise an
> +     exception if this address is not valid.
> +  *)
> +
> +@findex DIFADR
> +PROCEDURE DIFADR (addr1, addr2: ADDRESS): INTEGER;
> +  (* Returns the difference between addresses (addr1 - addr2),
> +     or may raise an exception if the arguments are invalid
> +     or address space is non-contiguous.
> +  *)
> +
> +@findex MAKEADR
> +PROCEDURE MAKEADR (high: <some type>; ...): ADDRESS;
> +  (* Returns an address constructed from a list of values whose
> +     types are implementation-defined, or may raise an
> +     exception if this address is not valid.
> +
> +     In GNU Modula-2, MAKEADR can take any number of arguments
> +     which are mapped onto the type ADDRESS. The first parameter
> +     maps onto the high address bits and subsequent parameters map
> +     onto lower address bits. For example:
> +
> +     a := MAKEADR(BYTE(0FEH), BYTE(0DCH), BYTE(0BAH), BYTE(098H),
> +                  BYTE(076H), BYTE(054H), BYTE(032H), BYTE(010H)) ;
> +
> +     then the value of, a, on a 64 bit machine is: 0FEDCBA9876543210H
> +
> +     The parameters do not have to be the same type, but constants
> +     _must_ be typed.
> +  *)
> +
> +@findex ADR
> +PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
> +  (* Returns the address of variable v. *)
> +
> +@findex ROTATE
> +PROCEDURE ROTATE (val: <a packedset type>;
> +                  num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by rotating up/right
> +     or down/right by the absolute value of num.  The direction is
> +     down/right if the sign of num is negative, otherwise the direction
> +     is up/left.
> +  *)
> +
> +@findex SHIFT
> +PROCEDURE SHIFT (val: <a packedset type>;
> +                 num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by shifting up/left
> +     or down/right by the absolute value of num, introducing
> +     zeros as necessary.  The direction is down/right if the sign of
> +     num is negative, otherwise the direction is up/left.
> +  *)
> +
> +@findex CAST
> +PROCEDURE CAST (<targettype>; val: <anytype>): <targettype>;
> +  (* CAST is a type transfer function.  Given the expression
> +     denoted by val, it returns a value of the type <targettype>.
> +     An invalid value for the target value or a
> +     physical address alignment problem may raise an exception.
> +  *)
> +
> +@findex TSIZE
> +PROCEDURE TSIZE (<type>; ... ): CARDINAL;
> +  (* Returns the number of LOCS used to store a value of the
> +     specified <type>.   The extra parameters, if present,
> +     are used to distinguish variants in a variant record.
> +  *)
> +
> +@findex THROW
> +PROCEDURE THROW (i: INTEGER) ;
> +  (*
> +     THROW is a GNU extension and was not part of the PIM or ISO
> +     standards.  It throws an exception which will be caught by the
> +     EXCEPT block (assuming it exists).  This is a compiler builtin
> +     function which interfaces to the GCC exception handling runtime
> +     system.
> +     GCC uses the term throw, hence the naming distinction between
> +     the GCC builtin and the Modula-2 runtime library procedure Raise.
> +     The later library procedure Raise will call SYSTEM.THROW after
> +     performing various housekeeping activities.
> +  *)
> +
> +@findex TBITSIZE
> +PROCEDURE TBITSIZE (<type>) : CARDINAL ;
> +  (* Returns the minimum number of bits necessary to represent
> +     <type>.  This procedure function is only useful for determining
> +     the number of bits used for any type field within a packed RECORD.
> +     It is not particularly useful elsewhere since <type> might be
> +     optimized for speed, for example a BOOLEAN could occupy a WORD.
> +  *)
> +*)
> +
> +
> +(* The following procedures are invoked by GNU Modula-2 to
> +   shift non word set types. They are not part of ISO Modula-2
> +   but are used to implement the SHIFT procedure defined above. *)
> +
> +(*
> +   ShiftVal - is a runtime procedure whose job is to implement
> +              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
> +              inline a SHIFT of a single WORD sized set and will only
> +              call this routine for larger sets.
> +*)
> +
> +@findex ShiftVal
> +PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
> +                    SetSizeInBits: CARDINAL;
> +                    ShiftCount: INTEGER) ;
> +
> +
> +(*
> +   ShiftLeft - performs the shift left for a multi word set.
> +               This procedure might be called by the back end of
> +               GNU Modula-2 depending whether amount is known at
> +               compile time.
> +*)
> +
> +@findex ShiftLeft
> +PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +(*
> +   ShiftRight - performs the shift left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex ShiftRight
> +PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateVal - is a runtime procedure whose job is to implement
> +               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
> +               inline a ROTATE of a single WORD (or less)
> +               sized set and will only call this routine for larger
> +               sets.
> +*)
> +
> +@findex RotateVal
> +PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     RotateCount: INTEGER) ;
> +
> +
> +(*
> +   RotateLeft - performs the rotate left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex RotateLeft
> +PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      RotateCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateRight - performs the rotate right for a multi word set.
> +                 This procedure might be called by the back end of
> +                 GNU Modula-2 depending whether amount is known at
> +                 compile time.
> +*)
> +
> +@findex RotateRight
> +PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
> +                       SetSizeInBits: CARDINAL;
> +                       RotateCount: CARDINAL) ;
> +
> +
> +END SYSTEM.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/Semaphores, gm2-libs-iso/SeqFile, gm2-libs-iso/SYSTEM, M2 ISO Libraries
> +@subsection gm2-libs-iso/Semaphores
> +
> +@example
> +DEFINITION MODULE Semaphores;
> +
> +  (* Provides mutual exclusion facilities for use by processes. *)
> +
> +TYPE
> +  SEMAPHORE;
> +
> +@findex Create
> +PROCEDURE Create (VAR s: SEMAPHORE; initialCount: CARDINAL );
> +  (* Creates and returns s as the identity of a new semaphore that
> +     has its associated count initialized to initialCount, and has
> +     no processes yet waiting on it.
> +  *)
> +
> +@findex Destroy
> +PROCEDURE Destroy (VAR s: SEMAPHORE);
> +  (* Recovers the resources used to implement the semaphore s,
> +     provided that no process is waiting for s to become free.
> +  *)
> +
> +@findex Claim
> +PROCEDURE Claim (s: SEMAPHORE);
> +  (* If the count associated with the semaphore s is non-zero,
> +     decrements this count and allows the calling process to
> +     continue; otherwise suspends the calling process until
> +     s is released.
> +  *)
> +
> +@findex Release
> +PROCEDURE Release (s: SEMAPHORE);
> +  (* If there are any processes waiting on the semaphore s,
> +     allows one of them to enter the ready state; otherwise
> +     increments the count associated with s.
> +  *)
> +
> +@findex CondClaim
> +PROCEDURE CondClaim (s: SEMAPHORE): BOOLEAN;
> +  (* Returns FALSE if the call Claim(s) would cause the calling
> +     process to be suspended; in this case the count associated
> +     with s is not changed. Otherwise returns TRUE and the
> +     associated count is decremented.
> +  *)
> +
> +END Semaphores.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SeqFile, gm2-libs-iso/ShortComplexMath, gm2-libs-iso/Semaphores, M2 ISO Libraries
> +@subsection gm2-libs-iso/SeqFile
> +
> +@example
> +DEFINITION MODULE SeqFile;
> +
> +  (* Rewindable sequential files *)
> +
> +IMPORT IOChan, ChanConsts;
> +
> +TYPE
> +@findex ChanId (type)
> +  ChanId = IOChan.ChanId;
> +@findex FlagSet (type)
> +  FlagSet = ChanConsts.FlagSet;
> +@findex OpenResults (type)
> +  OpenResults = ChanConsts.OpenResults;
> +
> +  (* Accepted singleton values of FlagSet *)
> +
> +CONST
> +  (* input operations are requested/available *)
> +@findex read (const)
> +  read = FlagSet@{ChanConsts.readFlag@};
> +
> +  (* output operations are requested/available *)
> +@findex write (const)
> +  write = FlagSet@{ChanConsts.writeFlag@};
> +
> +  (* a file may/must/did exist before the channel is opened *)
> +@findex old (const)
> +  old = FlagSet@{ChanConsts.oldFlag@};
> +
> +  (* text operations are requested/available *)
> +@findex text (const)
> +  text = FlagSet@{ChanConsts.textFlag@};
> +
> +  (* raw operations are requested/available *)
> +@findex raw (const)
> +  raw = FlagSet@{ChanConsts.rawFlag@};
> +
> +@findex OpenWrite
> +PROCEDURE OpenWrite (VAR cid: ChanId; name: ARRAY OF CHAR;
> +                     flags: FlagSet; VAR res: OpenResults);
> +  (*
> +     Attempts to obtain and open a channel connected to a stored
> +     rewindable file of the given name.
> +     The write flag is implied; without the raw flag, text is
> +     implied.  If successful, assigns to cid the identity of
> +     the opened channel, assigns the value opened to res, and
> +     selects output mode, with the write position at the start
> +     of the file (i.e. the file is of zero length).
> +     If a channel cannot be opened as required, the value of
> +     res indicates the reason, and cid identifies the invalid
> +     channel.
> +  *)
> +
> +@findex OpenAppend
> +PROCEDURE OpenAppend (VAR cid: ChanId; name: ARRAY OF CHAR;
> +                      flags: FlagSet; VAR res: OpenResults);
> +  (*
> +     Attempts to obtain and open a channel connected to a stored
> +     rewindable file of the given name.  The write and old flags
> +     are implied; without the raw flag, text is implied.  If
> +     successful, assigns to cid the identity of the opened channel,
> +     assigns the value opened to res, and selects output mode,
> +     with the write position corresponding to the length of the
> +     file.  If a channel cannot be opened as required, the value
> +     of res indicates the reason, and cid identifies the invalid
> +     channel.
> +  *)
> +
> +@findex OpenRead
> +PROCEDURE OpenRead (VAR cid: ChanId; name: ARRAY OF CHAR;
> +                    flags: FlagSet; VAR res: OpenResults);
> +  (* Attempts to obtain and open a channel connected to a stored
> +     rewindable file of the given name.
> +     The read and old flags are implied; without the raw flag,
> +     text is implied.  If successful, assigns to cid the
> +     identity of the opened channel, assigns the value opened to
> +     res, and selects input mode, with the read position
> +     corresponding to the start of the file.
> +     If a channel cannot be opened as required, the value of
> +     res indicates the reason, and cid identifies the invalid
> +     channel.
> +  *)
> +
> +@findex IsSeqFile
> +PROCEDURE IsSeqFile (cid: ChanId): BOOLEAN;
> +  (* Tests if the channel identified by cid is open to a
> +     rewindable sequential file. *)
> +
> +@findex Reread
> +PROCEDURE Reread (cid: ChanId);
> +  (* If the channel identified by cid is not open to a rewindable
> +     sequential file, the exception wrongDevice is raised;
> +     otherwise attempts to set the read position to the
> +     start of the file, and to select input mode.
> +     If the operation cannot be performed (perhaps because of
> +     insufficient permissions) neither input mode nor output
> +     mode is selected.
> +  *)
> +
> +@findex Rewrite
> +PROCEDURE Rewrite (cid: ChanId);
> +  (* If the channel identified by cid is not open to a
> +     rewindable sequential file, the exception wrongDevice is
> +     raised; otherwise, attempts to truncate the file to zero
> +     length, and to select output mode.  If the operation
> +     cannot be performed (perhaps because of insufficient
> +     permissions) neither input mode nor output mode is selected.
> +  *)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId);
> +  (* If the channel identified by cid is not open to a rewindable
> +     sequential file, the exception wrongDevice is raised;
> +     otherwise closes the channel, and assigns the value
> +     identifying the invalid channel to cid.
> +  *)
> +
> +END SeqFile.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ShortComplexMath, gm2-libs-iso/ShortIO, gm2-libs-iso/SeqFile, M2 ISO Libraries
> +@subsection gm2-libs-iso/ShortComplexMath
> +
> +@example
> +DEFINITION MODULE ShortComplexMath;
> +
> +  (* Mathematical functions for the type SHORTCOMPLEX *)
> +
> +CONST
> +@findex i (const)
> +  i =    CMPLX (0.0, 1.0);
> +@findex one (const)
> +  one =  CMPLX (1.0, 0.0);
> +@findex zero (const)
> +  zero = CMPLX (0.0, 0.0);
> +
> +@findex abs
> +PROCEDURE abs (z: SHORTCOMPLEX): SHORTREAL;
> +  (* Returns the length of z *)
> +
> +@findex arg
> +PROCEDURE arg (z: SHORTCOMPLEX): SHORTREAL;
> +  (* Returns the angle that z subtends to the positive real axis *)
> +
> +@findex conj
> +PROCEDURE conj (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the complex conjugate of z *)
> +
> +@findex power
> +PROCEDURE power (base: SHORTCOMPLEX; exponent: SHORTREAL): SHORTCOMPLEX;
> +  (* Returns the value of the number base raised to the power exponent *)
> +
> +@findex sqrt
> +PROCEDURE sqrt (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the principal square root of z *)
> +
> +@findex exp
> +PROCEDURE exp (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the complex exponential of z *)
> +
> +@findex ln
> +PROCEDURE ln (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the principal value of the natural logarithm of z *)
> +
> +@findex sin
> +PROCEDURE sin (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the sine of z *)
> +
> +@findex cos
> +PROCEDURE cos (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the cosine of z *)
> +
> +@findex tan
> +PROCEDURE tan (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the tangent of z *)
> +
> +@findex arcsin
> +PROCEDURE arcsin (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the arcsine of z *)
> +
> +@findex arccos
> +PROCEDURE arccos (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the arccosine of z *)
> +
> +@findex arctan
> +PROCEDURE arctan (z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the arctangent of z *)
> +
> +@findex polarToComplex
> +PROCEDURE polarToComplex (abs, arg: SHORTREAL): SHORTCOMPLEX;
> +  (* Returns the complex number with the specified polar coordinates *)
> +
> +@findex scalarMult
> +PROCEDURE scalarMult (scalar: SHORTREAL; z: SHORTCOMPLEX): SHORTCOMPLEX;
> +  (* Returns the scalar product of scalar with z *)
> +
> +@findex IsCMathException
> +PROCEDURE IsCMathException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution state
> +     because of the raising of an exception in a routine from this module; otherwise
> +     returns FALSE.
> +  *)
> +
> +END ShortComplexMath.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ShortIO, gm2-libs-iso/ShortWholeIO, gm2-libs-iso/ShortComplexMath, M2 ISO Libraries
> +@subsection gm2-libs-iso/ShortIO
> +
> +@example
> +DEFINITION MODULE ShortIO;
> +
> +  (* Input and output of short real numbers in decimal text form
> +     over specified channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed fixed-point real number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}, [".",
> +       @{decimal digit@}]
> +
> +     The text form of a signed floating-point real number is
> +       signed fixed-point real number,
> +       "E", ["+" | "-"], decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadReal
> +PROCEDURE ReadReal (cid: IOChan.ChanId; VAR real: SHORTREAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed fixed or floating
> +     point number.  The value of this number is assigned to real.
> +     The read result is set to the value allRight, outOfRange,
> +     wrongFormat, endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteFloat
> +PROCEDURE WriteFloat (cid: IOChan.ChanId; real: SHORTREAL;
> +                      sigFigs: CARDINAL; width: CARDINAL);
> +  (* Writes the value of real to cid in floating-point text form,
> +     with sigFigs significant figures, in a field of the given
> +     minimum width.
> +  *)
> +
> +@findex WriteEng
> +PROCEDURE WriteEng (cid: IOChan.ChanId; real: SHORTREAL;
> +                    sigFigs: CARDINAL; width: CARDINAL);
> +  (* As for WriteFloat, except that the number is scaled with
> +     one to three digits in the whole number part, and with an
> +     exponent that is a multiple of three.
> +  *)
> +
> +@findex WriteFixed
> +PROCEDURE WriteFixed (cid: IOChan.ChanId; real: SHORTREAL;
> +                      place: INTEGER; width: CARDINAL);
> +  (* Writes the value of real to cid in fixed-point text form,
> +     rounded to the given place relative to the decimal point,
> +     in a field of the given minimum width.
> +  *)
> +
> +@findex WriteReal
> +PROCEDURE WriteReal (cid: IOChan.ChanId; real: SHORTREAL;
> +                     width: CARDINAL);
> +  (* Writes the value of real to cid, as WriteFixed if the
> +     sign and magnitude can be shown in the given width, or
> +     otherwise as WriteFloat.  The number of places or
> +     significant digits depends on the given width.
> +  *)
> +
> +END ShortIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/ShortWholeIO, gm2-libs-iso/SimpleCipher, gm2-libs-iso/ShortIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/ShortWholeIO
> +
> +@example
> +DEFINITION MODULE ShortWholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form
> +     over specified channels.  The read result is of the
> +     type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: SHORTINT);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed whole number.  The
> +     value of this number is assigned to int.  The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (cid: IOChan.ChanId; int: SHORTINT;
> +                    width: CARDINAL);
> +  (* Writes the value of int to cid in text form, in a field of
> +     the given minimum width. *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: SHORTCARD);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of an unsigned whole number.  The
> +     value of this number is assigned to card. The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (cid: IOChan.ChanId; card: SHORTCARD;
> +                     width: CARDINAL);
> +  (* Writes the value of card to cid in text form, in a field
> +     of the given minimum width. *)
> +
> +END ShortWholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SimpleCipher, gm2-libs-iso/StdChans, gm2-libs-iso/ShortWholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/SimpleCipher
> +
> +@example
> +DEFINITION MODULE SimpleCipher ;
> +
> +(*
> +    Description: provides a simple Caesar cipher layer which
> +                 can be attached to any channel device.  This,
> +                 pedagogical, module is designed to show how
> +                 it is possible to add further layers underneath
> +                 the channel devices.
> +*)
> +
> +FROM IOChan IMPORT ChanId ;
> +
> +
> +(*
> +   InsertCipherLayer - inserts a caesar cipher below channel, cid.
> +                       The encryption, key, is specified.
> +*)
> +
> +@findex InsertCipherLayer
> +PROCEDURE InsertCipherLayer (cid: ChanId; key: INTEGER) ;
> +
> +
> +(*
> +   RemoveCipherLayer - removes a Caesar cipher below channel, cid.
> +*)
> +
> +@findex RemoveCipherLayer
> +PROCEDURE RemoveCipherLayer (cid: ChanId) ;
> +
> +
> +END SimpleCipher.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/StdChans, gm2-libs-iso/Storage, gm2-libs-iso/SimpleCipher, M2 ISO Libraries
> +@subsection gm2-libs-iso/StdChans
> +
> +@example
> +DEFINITION MODULE StdChans;
> +
> +  (* Access to standard and default channels *)
> +
> +IMPORT IOChan;
> +
> +TYPE
> +@findex ChanId (type)
> +  ChanId = IOChan.ChanId;
> +    (* Values of this type are used to identify channels *)
> +
> +  (* The following functions return the standard channel values.
> +     These channels cannot be closed.
> +  *)
> +
> +@findex StdInChan
> +PROCEDURE StdInChan (): ChanId;
> +  (* Returns the identity of the implementation-defined standard source for
> +program
> +     input.
> +  *)
> +
> +@findex StdOutChan
> +PROCEDURE StdOutChan (): ChanId;
> +  (* Returns the identity of the implementation-defined standard source for program
> +     output.
> +  *)
> +
> +@findex StdErrChan
> +PROCEDURE StdErrChan (): ChanId;
> +  (* Returns the identity of the implementation-defined standard destination for program
> +     error messages.
> +  *)
> +
> +@findex NullChan
> +PROCEDURE NullChan (): ChanId;
> +  (* Returns the identity of a channel open to the null device. *)
> +
> +  (* The following functions return the default channel values *)
> +
> +@findex InChan
> +PROCEDURE InChan (): ChanId;
> +  (* Returns the identity of the current default input channel. *)
> +
> +@findex OutChan
> +PROCEDURE OutChan (): ChanId;
> +  (* Returns the identity of the current default output channel. *)
> +
> +@findex ErrChan
> +PROCEDURE ErrChan (): ChanId;
> +  (* Returns the identity of the current default error message channel. *)
> +
> +  (* The following procedures allow for redirection of the default channels *)
> +
> +@findex SetInChan
> +PROCEDURE SetInChan (cid: ChanId);
> +  (* Sets the current default input channel to that identified by cid. *)
> +
> +@findex SetOutChan
> +PROCEDURE SetOutChan (cid: ChanId);
> +  (* Sets the current default output channel to that identified by cid. *)
> +
> +@findex SetErrChan
> +PROCEDURE SetErrChan (cid: ChanId);
> +  (* Sets the current default error channel to that identified by cid. *)
> +
> +END StdChans.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/Storage, gm2-libs-iso/StreamFile, gm2-libs-iso/StdChans, M2 ISO Libraries
> +@subsection gm2-libs-iso/Storage
> +
> +@example
> +DEFINITION MODULE Storage;
> +
> +  (* Facilities for dynamically allocating and deallocating storage *)
> +
> +IMPORT SYSTEM;
> +
> +@findex ALLOCATE
> +PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
> +  (* Allocates storage for a variable of size amount and assigns
> +     the address of this variable to addr. If there is insufficient
> +     unallocated storage to do this, the value NIL is assigned to addr.
> +  *)
> +
> +@findex DEALLOCATE
> +PROCEDURE DEALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
> +  (* Deallocates amount locations allocated by ALLOCATE for
> +     the storage of the variable addressed by addr and assigns
> +     the value NIL to addr.
> +  *)
> +
> +@findex REALLOCATE
> +PROCEDURE REALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
> +  (* Attempts to reallocate, amount of storage.  Effectively it
> +     calls ALLOCATE, copies the amount of data pointed to by
> +     addr into the new space and DEALLOCATES the addr.
> +     This procedure is a GNU extension.
> +  *)
> +
> +TYPE
> +@findex StorageExceptions (type)
> +  StorageExceptions = (
> +    nilDeallocation,             (* first argument to DEALLOCATE is NIL *)
> +    pointerToUnallocatedStorage, (* storage to deallocate not allocated by ALLOCATE *)
> +    wrongStorageToUnallocate     (* amount to deallocate is not amount allocated *)
> +  );
> +
> +@findex IsStorageException
> +PROCEDURE IsStorageException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional
> +     execution state because of the raising of an exception from
> +     StorageExceptions; otherwise returns FALSE.
> +  *)
> +
> +@findex StorageException
> +PROCEDURE StorageException (): StorageExceptions;
> +  (* If the current coroutine is in the exceptional execution
> +     state because of the raising of an exception from
> +     StorageExceptions, returns the corresponding
> +     enumeration value, and otherwise raises an exception.
> +  *)
> +
> +END Storage.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/StreamFile, gm2-libs-iso/StringChan, gm2-libs-iso/Storage, M2 ISO Libraries
> +@subsection gm2-libs-iso/StreamFile
> +
> +@example
> +DEFINITION MODULE StreamFile;
> +
> +  (* Independent sequential data streams *)
> +
> +IMPORT IOChan, ChanConsts;
> +
> +TYPE
> +@findex ChanId (type)
> +  ChanId = IOChan.ChanId;
> +@findex FlagSet (type)
> +  FlagSet = ChanConsts.FlagSet;
> +@findex OpenResults (type)
> +  OpenResults = ChanConsts.OpenResults;
> +
> +  (* Accepted singleton values of FlagSet *)
> +
> +CONST
> +@findex read (const)
> +  read = FlagSet@{ChanConsts.readFlag@};   (* input operations are requested/available *)
> +@findex write (const)
> +  write = FlagSet@{ChanConsts.writeFlag@}; (* output operations are requested/available *)
> +@findex old (const)
> +  old = FlagSet@{ChanConsts.oldFlag@};     (* a file may/must/did exist before the channel is
> +                                            opened *)
> +@findex text (const)
> +  text = FlagSet@{ChanConsts.textFlag@};   (* text operations are requested/available *)
> +@findex raw (const)
> +  raw = FlagSet@{ChanConsts.rawFlag@};     (* raw operations are requested/available *)
> +
> +
> +@findex Open
> +PROCEDURE Open (VAR cid: ChanId; name: ARRAY OF CHAR;
> +                flags: FlagSet; VAR res: OpenResults);
> +  (* Attempts to obtain and open a channel connected to a
> +     sequential stream of the given name.
> +     The read flag implies old; without the raw flag, text is
> +     implied.  If successful, assigns to cid the identity of
> +     the opened channel, and assigns the value opened to res.
> +     If a channel cannot be opened as required, the value of
> +     res indicates the reason, and cid identifies the invalid
> +     channel.
> +  *)
> +
> +@findex IsStreamFile
> +PROCEDURE IsStreamFile (cid: ChanId): BOOLEAN;
> +  (* Tests if the channel identified by cid is open to a sequential stream. *)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId);
> +  (* If the channel identified by cid is not open to a sequential stream, the exception
> +     wrongDevice is raised; otherwise closes the channel, and assigns the value identifying
> +     the invalid channel to cid.
> +  *)
> +
> +END StreamFile.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/StringChan, gm2-libs-iso/Strings, gm2-libs-iso/StreamFile, M2 ISO Libraries
> +@subsection gm2-libs-iso/StringChan
> +
> +@example
> +DEFINITION MODULE StringChan ;
> +
> +(*
> +    Description: provides a set of Channel and String
> +                 input and output procedures.
> +*)
> +
> +FROM DynamicStrings IMPORT String ;
> +IMPORT IOChan;
> +
> +
> +(*
> +   writeString - writes a string, s, to ChanId, cid.
> +                 The string, s, is not destroyed.
> +*)
> +
> +@findex writeString
> +PROCEDURE writeString (cid: IOChan.ChanId; s: String) ;
> +
> +
> +(*
> +   writeFieldWidth - writes a string, s, to ChanId, cid.
> +                     The string, s, is not destroyed and it
> +                     is prefixed by spaces so that at least,
> +                     width, characters are written.  If the
> +                     string, s, is longer than width then
> +                     no spaces are prefixed to the output
> +                     and the entire string is written.
> +*)
> +
> +@findex writeFieldWidth
> +PROCEDURE writeFieldWidth (cid: IOChan.ChanId;
> +                           s: String; width: CARDINAL) ;
> +
> +
> +END StringChan.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/Strings, gm2-libs-iso/SysClock, gm2-libs-iso/StringChan, M2 ISO Libraries
> +@subsection gm2-libs-iso/Strings
> +
> +@example
> +DEFINITION MODULE Strings;
> +
> +  (* Facilities for manipulating strings *)
> +
> +TYPE
> +@findex String1 (type)
> +  String1 = ARRAY [0..0] OF CHAR;
> +    (* String1 is provided for constructing a value of a single-character string type from a
> +       single character value in order to pass CHAR values to ARRAY OF CHAR parameters.
> +    *)
> +
> +@findex Length
> +PROCEDURE Length (stringVal: ARRAY OF CHAR): CARDINAL;
> +  (* Returns the length of stringVal (the same value as would be returned by the
> +     pervasive function LENGTH).
> +  *)
> +
> +
> +(* The following seven procedures construct a string value, and attempt to assign it to a
> +   variable parameter.  They all have the property that if the length of the constructed string
> +   value exceeds the capacity of the variable parameter, a truncated value is assigned, while
> +   if the length of the constructed string value is less than the capacity of the variable
> +   parameter, a string terminator is appended before assignment is performed.
> +*)
> +
> +@findex Assign
> +PROCEDURE Assign (source: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
> +  (* Copies source to destination *)
> +
> +@findex Extract
> +PROCEDURE Extract (source: ARRAY OF CHAR; startIndex, numberToExtract: CARDINAL;
> +                   VAR destination: ARRAY OF CHAR);
> +  (* Copies at most numberToExtract characters from source to destination, starting at position
> +     startIndex in source.
> +  *)
> +
> +@findex Delete
> +PROCEDURE Delete (VAR stringVar: ARRAY OF CHAR; startIndex, numberToDelete:
> +CARDINAL);
> +  (* Deletes at most numberToDelete characters from stringVar, starting at position
> +     startIndex.
> +  *)
> +
> +@findex Insert
> +PROCEDURE Insert (source: ARRAY OF CHAR; startIndex: CARDINAL;
> +                  VAR destination: ARRAY OF CHAR);
> +  (* Inserts source into destination at position startIndex *)
> +
> +@findex Replace
> +PROCEDURE Replace (source: ARRAY OF CHAR; startIndex: CARDINAL;
> +                   VAR destination: ARRAY OF CHAR);
> +  (* Copies source into destination, starting at position startIndex. Copying stops when
> +     all of source has been copied, or when the last character of the string value in
> +     destination has been replaced.
> +  *)
> +
> +@findex Append
> +PROCEDURE Append (source: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
> +  (* Appends source to destination. *)
> +
> +@findex Concat
> +PROCEDURE Concat (source1, source2: ARRAY OF CHAR; VAR destination: ARRAY OF CHAR);
> +  (* Concatenates source2 onto source1 and copies the result into destination. *)
> +
> +(* The following predicates provide for pre-testing of the operation-completion
> +   conditions for the procedures above.
> +*)
> +
> +@findex CanAssignAll
> +PROCEDURE CanAssignAll (sourceLength: CARDINAL; VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if a number of characters, indicated by sourceLength, will fit into
> +     destination; otherwise returns FALSE.
> +  *)
> +
> +@findex CanExtractAll
> +PROCEDURE CanExtractAll (sourceLength, startIndex, numberToExtract: CARDINAL;
> +                         VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if there are numberToExtract characters starting at startIndex and
> +     within the sourceLength of some string, and if the capacity of destination is
> +     sufficient to hold numberToExtract characters; otherwise returns FALSE.
> +  *)
> +
> +@findex CanDeleteAll
> +PROCEDURE CanDeleteAll (stringLength, startIndex, numberToDelete: CARDINAL): BOOLEAN;
> +  (* Returns TRUE if there are numberToDelete characters starting at startIndex and
> +     within the stringLength of some string; otherwise returns FALSE.
> +  *)
> +
> +@findex CanInsertAll
> +PROCEDURE CanInsertAll (sourceLength, startIndex: CARDINAL;
> +                        VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if there is room for the insertion of sourceLength characters from
> +     some string into destination starting at startIndex; otherwise returns FALSE.
> +  *)
> +
> +@findex CanReplaceAll
> +PROCEDURE CanReplaceAll (sourceLength, startIndex: CARDINAL;
> +                         VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if there is room for the replacement of sourceLength characters in
> +     destination starting at startIndex; otherwise returns FALSE.
> +  *)
> +
> +@findex CanAppendAll
> +PROCEDURE CanAppendAll (sourceLength: CARDINAL; VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if there is sufficient room in destination to append a string of
> +     length sourceLength to the string in destination; otherwise returns FALSE.
> +  *)
> +
> +@findex CanConcatAll
> +PROCEDURE CanConcatAll (source1Length, source2Length: CARDINAL;
> +                        VAR destination: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns TRUE if there is sufficient room in destination for a two strings of
> +     lengths source1Length and source2Length; otherwise returns FALSE.
> +  *)
> +
> +(* The following type and procedures provide for the comparison of string values, and for the
> +   location of substrings within strings.
> +*)
> +
> +TYPE
> +@findex CompareResults (type)
> +  CompareResults = (less, equal, greater);
> +
> +@findex Compare
> +PROCEDURE Compare (stringVal1, stringVal2: ARRAY OF CHAR): CompareResults;
> +  (* Returns less, equal, or greater, according as stringVal1 is lexically less than,
> +     equal to, or greater than stringVal2.
> +  *)
> +
> +@findex Equal
> +PROCEDURE Equal (stringVal1, stringVal2: ARRAY OF CHAR): BOOLEAN;
> +  (* Returns Strings.Compare(stringVal1, stringVal2) = Strings.equal *)
> +
> +@findex FindNext
> +PROCEDURE FindNext (pattern, stringToSearch: ARRAY OF CHAR; startIndex: CARDINAL;
> +                    VAR patternFound: BOOLEAN; VAR posOfPattern: CARDINAL);
> +  (* Looks forward for next occurrence of pattern in stringToSearch, starting the search at
> +     position startIndex. If startIndex < LENGTH(stringToSearch) and pattern is found,
> +     patternFound is returned as TRUE, and posOfPattern contains the start position in
> +     stringToSearch of pattern. Otherwise patternFound is returned as FALSE, and posOfPattern
> +     is unchanged.
> +  *)
> +
> +@findex FindPrev
> +PROCEDURE FindPrev (pattern, stringToSearch: ARRAY OF CHAR; startIndex: CARDINAL;
> +                    VAR patternFound: BOOLEAN; VAR posOfPattern: CARDINAL);
> +  (* Looks backward for the previous occurrence of pattern in stringToSearch and returns the
> +     position of the first character of the pattern if found. The search for the pattern
> +     begins at startIndex. If pattern is found, patternFound is returned as TRUE, and
> +     posOfPattern contains the start position in stringToSearch of pattern in the range
> +     [0..startIndex]. Otherwise patternFound is returned as FALSE, and posOfPattern is unchanged.
> +  *)
> +
> +@findex FindDiff
> +PROCEDURE FindDiff (stringVal1, stringVal2: ARRAY OF CHAR;
> +                    VAR differenceFound: BOOLEAN; VAR posOfDifference: CARDINAL);
> +  (* Compares the string values in stringVal1 and stringVal2 for differences. If they
> +     are equal, differenceFound is returned as FALSE, and TRUE otherwise. If
> +     differenceFound is TRUE, posOfDifference is set to the position of the first
> +     difference; otherwise posOfDifference is unchanged.
> +  *)
> +
> +@findex Capitalize
> +PROCEDURE Capitalize (VAR stringVar: ARRAY OF CHAR);
> +  (* Applies the function CAP to each character of the string value in stringVar. *)
> +
> +
> +END Strings.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/SysClock, gm2-libs-iso/TERMINATION, gm2-libs-iso/Strings, M2 ISO Libraries
> +@subsection gm2-libs-iso/SysClock
> +
> +@example
> +DEFINITION MODULE SysClock;
> +
> +(* Facilities for accessing a system clock that records the date
> +   and time of day *)
> +
> +CONST
> +@findex maxSecondParts (const)
> +  maxSecondParts = 1000000 ;
> +
> +TYPE
> +@findex Month (type)
> +  Month    = [1 .. 12];
> +@findex Day (type)
> +  Day      = [1 .. 31];
> +@findex Hour (type)
> +  Hour     = [0 .. 23];
> +@findex Min (type)
> +  Min      = [0 .. 59];
> +@findex Sec (type)
> +  Sec      = [0 .. 59];
> +@findex Fraction (type)
> +  Fraction = [0 .. maxSecondParts];
> +@findex UTCDiff (type)
> +  UTCDiff  = [-780 .. 720];
> +@findex DateTime (type)
> +  DateTime =
> +    RECORD
> +      year:      CARDINAL;
> +      month:     Month;
> +      day:       Day;
> +      hour:      Hour;
> +      minute:    Min;
> +      second:    Sec;
> +      fractions: Fraction;      (* parts of a second *)
> +      zone:      UTCDiff;       (* Time zone differential
> +                                   factor which is the number
> +                                   of minutes to add to local
> +                                   time to obtain UTC. *)
> +      summerTimeFlag: BOOLEAN;  (* Interpretation of flag
> +                                   depends on local usage. *)
> +    END;
> +
> +@findex CanGetClock
> +PROCEDURE CanGetClock(): BOOLEAN;
> +(* Tests if the clock can be read *)
> +
> +@findex CanSetClock
> +PROCEDURE CanSetClock(): BOOLEAN;
> +(* Tests if the clock can be set *)
> +
> +@findex IsValidDateTime
> +PROCEDURE IsValidDateTime(userData: DateTime): BOOLEAN;
> +(* Tests if the value of userData is a valid *)
> +
> +@findex GetClock
> +PROCEDURE GetClock(VAR userData: DateTime);
> +(* Assigns local date and time of the day to userData *)
> +
> +@findex SetClock
> +PROCEDURE SetClock(userData: DateTime);
> +(* Sets the system time clock to the given local date and
> +   time *)
> +
> +END SysClock.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/TERMINATION, gm2-libs-iso/TermFile, gm2-libs-iso/SysClock, M2 ISO Libraries
> +@subsection gm2-libs-iso/TERMINATION
> +
> +@example
> +DEFINITION MODULE TERMINATION;
> +
> +(* Provides facilities for enquiries concerning the occurrence of termination events. *)
> +
> +@findex IsTerminating
> +PROCEDURE IsTerminating (): BOOLEAN ;
> +  (* Returns true if any coroutine has started  program termination and false otherwise. *)
> +
> +@findex HasHalted
> +PROCEDURE HasHalted (): BOOLEAN ;
> +  (* Returns true if a call to HALT has been made and false otherwise. *)
> +
> +END TERMINATION.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/TermFile, gm2-libs-iso/TextIO, gm2-libs-iso/TERMINATION, M2 ISO Libraries
> +@subsection gm2-libs-iso/TermFile
> +
> +@example
> +DEFINITION MODULE TermFile;
> +
> +  (* Access to the terminal device *)
> +
> +  (* Channels opened by this module are connected to a single
> +     terminal device; typed characters are distributed between
> +     channels according to the sequence of read requests.
> +  *)
> +
> +IMPORT IOChan, ChanConsts;
> +
> +TYPE
> +@findex ChanId (type)
> +  ChanId = IOChan.ChanId;
> +@findex FlagSet (type)
> +  FlagSet = ChanConsts.FlagSet;
> +@findex OpenResults (type)
> +  OpenResults = ChanConsts.OpenResults;
> +
> +  (* Accepted singleton values of FlagSet *)
> +
> +CONST
> +@findex read (const)
> +  read = FlagSet@{ChanConsts.readFlag@};
> +  (* input operations are requested/available *)
> +@findex write (const)
> +  write = FlagSet@{ChanConsts.writeFlag@};
> +  (* output operations are requested/available *)
> +@findex text (const)
> +  text = FlagSet@{ChanConsts.textFlag@};
> +  (* text operations are requested/available *)
> +@findex raw (const)
> +  raw = FlagSet@{ChanConsts.rawFlag@};
> +  (* raw operations are requested/available *)
> +@findex echo (const)
> +  echo = FlagSet@{ChanConsts.echoFlag@};
> +  (* echoing by interactive device on reading of
> +     characters from input stream requested/applies
> +  *)
> +
> +@findex Open
> +PROCEDURE Open (VAR cid: ChanId; flagset: FlagSet; VAR res: OpenResults);
> +  (* Attempts to obtain and open a channel connected to
> +     the terminal.  Without the raw flag, text is implied.
> +     Without the echo flag, line mode is requested,
> +     otherwise single character mode is requested.
> +     If successful, assigns to cid the identity of
> +     the opened channel, and assigns the value opened to res.
> +     If a channel cannot be opened as required, the value of
> +     res indicates the reason, and cid identifies the
> +     invalid channel.
> +  *)
> +
> +@findex IsTermFile
> +PROCEDURE IsTermFile (cid: ChanId): BOOLEAN;
> +  (* Tests if the channel identified by cid is open to
> +     the terminal. *)
> +
> +@findex Close
> +PROCEDURE Close (VAR cid: ChanId);
> +  (* If the channel identified by cid is not open to the terminal,
> +     the exception wrongDevice is raised; otherwise closes the
> +     channel and assigns the value identifying the invalid channel
> +     to cid.
> +  *)
> +
> +END TermFile.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/TextIO, gm2-libs-iso/WholeConv, gm2-libs-iso/TermFile, M2 ISO Libraries
> +@subsection gm2-libs-iso/TextIO
> +
> +@example
> +DEFINITION MODULE TextIO;
> +
> +  (* Input and output of character and string types over
> +     specified channels.  The read result is of the type
> +     IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The following procedures do not read past line marks *)
> +
> +@findex ReadChar
> +PROCEDURE ReadChar (cid: IOChan.ChanId; VAR ch: CHAR);
> +  (* If possible, removes a character from the input stream
> +     cid and assigns the corresponding value to ch.  The
> +     read result is set to the value allRight, endOfLine, or
> +     endOfInput.
> +  *)
> +
> +@findex ReadRestLine
> +PROCEDURE ReadRestLine (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
> +  (* Removes any remaining characters from the input stream
> +     cid before the next line mark,  copying to s as many as
> +     can be accommodated as a string value.  The read result is
> +     set to the value allRight, outOfRange, endOfLine, or
> +     endOfInput.
> +  *)
> +
> +@findex ReadString
> +PROCEDURE ReadString (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
> +  (* Removes only those characters from the input stream cid
> +     before the next line mark that can be accommodated in s
> +     as a string value, and copies them to s.  The read result
> +     is set to the value allRight, endOfLine, or endOfInput.
> +  *)
> +
> +@findex ReadToken
> +PROCEDURE ReadToken (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR);
> +  (* Skips leading spaces, and then removes characters from
> +     the input stream cid before the next space or line mark,
> +     copying to s as many as can be accommodated as a string
> +     value.  The read result is set to the value allRight,
> +     outOfRange, endOfLine, or endOfInput.
> +  *)
> +
> +  (* The following procedure reads past the next line mark *)
> +
> +@findex SkipLine
> +PROCEDURE SkipLine (cid: IOChan.ChanId);
> +  (* Removes successive items from the input stream cid up
> +     to and including the next line mark, or until the end
> +     of input is reached.  The read result is set to the
> +     value allRight, or endOfInput.
> +  *)
> +
> +  (* Output procedures *)
> +
> +@findex WriteChar
> +PROCEDURE WriteChar (cid: IOChan.ChanId; ch: CHAR);
> +  (* Writes the value of ch to the output stream cid. *)
> +
> +@findex WriteLn
> +PROCEDURE WriteLn (cid: IOChan.ChanId);
> +  (* Writes a line mark to the output stream cid. *)
> +
> +@findex WriteString
> +PROCEDURE WriteString (cid: IOChan.ChanId; s: ARRAY OF CHAR);
> +  (* Writes the string value in s to the output stream cid. *)
> +
> +END TextIO.
> +
> +@end example
> +@page
> +
> +@node gm2-libs-iso/WholeConv, gm2-libs-iso/WholeIO, gm2-libs-iso/TextIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/WholeConv
> +
> +@example
> +DEFINITION MODULE WholeConv;
> +
> +  (* Low-level whole-number/string conversions *)
> +
> +IMPORT
> +  ConvTypes;
> +
> +TYPE
> +@findex ConvResults (type)
> +  ConvResults = ConvTypes.ConvResults;
> +        (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
> +
> +@findex ScanInt
> +PROCEDURE ScanInt (inputCh: CHAR;
> +                   VAR chClass: ConvTypes.ScanClass;
> +                   VAR nextState: ConvTypes.ScanState) ;
> +  (* Represents the start state of a finite state scanner for signed
> +     whole numbers - assigns class of inputCh to chClass and a
> +     procedure representing the next state to nextState.
> +  *)
> +
> +@findex FormatInt
> +PROCEDURE FormatInt (str: ARRAY OF CHAR): ConvResults;
> +  (* Returns the format of the string value for conversion to INTEGER. *)
> +
> +@findex ValueInt
> +PROCEDURE ValueInt (str: ARRAY OF CHAR): INTEGER;
> +  (* Returns the value corresponding to the signed whole number string
> +     value str if str is well-formed; otherwise raises the WholeConv
> +     exception.
> +   *)
> +
> +@findex LengthInt
> +PROCEDURE LengthInt (int: INTEGER): CARDINAL;
> +  (* Returns the number of characters in the string representation of
> +     int.
> +   *)
> +
> +@findex ScanCard
> +PROCEDURE ScanCard (inputCh: CHAR; VAR chClass: ConvTypes.ScanClass;
> +                    VAR nextState: ConvTypes.ScanState);
> +  (* Represents the start state of a finite state scanner for unsigned
> +     whole numbers - assigns class of inputCh to chClass and a procedure
> +     representing the next state to nextState.
> +   *)
> +
> +@findex FormatCard
> +PROCEDURE FormatCard (str: ARRAY OF CHAR): ConvResults;
> +  (* Returns the format of the string value for conversion to CARDINAL.
> +   *)
> +
> +@findex ValueCard
> +PROCEDURE ValueCard (str: ARRAY OF CHAR): CARDINAL;
> +  (* Returns the value corresponding to the unsigned whole number string
> +     value str if str is well-formed; otherwise raises the WholeConv
> +     exception.
> +   *)
> +
> +@findex LengthCard
> +PROCEDURE LengthCard (card: CARDINAL): CARDINAL;
> +  (* Returns the number of characters in the string representation of
> +     card.
> +   *)
> +
> +@findex IsWholeConvException
> +PROCEDURE IsWholeConvException (): BOOLEAN;
> +  (* Returns TRUE if the current coroutine is in the exceptional execution
> +     state because of the raising of an exception in a routine from this
> +     module; otherwise returns FALSE.
> +  *)
> +
> +END WholeConv.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/WholeIO, gm2-libs-iso/WholeStr, gm2-libs-iso/WholeConv, M2 ISO Libraries
> +@subsection gm2-libs-iso/WholeIO
> +
> +@example
> +DEFINITION MODULE WholeIO;
> +
> +  (* Input and output of whole numbers in decimal text form
> +     over specified channels.  The read result is of the
> +     type IOConsts.ReadResults.
> +  *)
> +
> +IMPORT IOChan;
> +
> +  (* The text form of a signed whole number is
> +       ["+" | "-"], decimal digit, @{decimal digit@}
> +
> +     The text form of an unsigned whole number is
> +       decimal digit, @{decimal digit@}
> +  *)
> +
> +@findex ReadInt
> +PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: INTEGER);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of a signed whole number.  The
> +     value of this number is assigned to int.  The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteInt
> +PROCEDURE WriteInt (cid: IOChan.ChanId; int: INTEGER;
> +                    width: CARDINAL);
> +  (* Writes the value of int to cid in text form, in a field of
> +     the given minimum width. *)
> +
> +@findex ReadCard
> +PROCEDURE ReadCard (cid: IOChan.ChanId; VAR card: CARDINAL);
> +  (* Skips leading spaces, and removes any remaining characters
> +     from cid that form part of an unsigned whole number.  The
> +     value of this number is assigned to card. The read result
> +     is set to the value allRight, outOfRange, wrongFormat,
> +     endOfLine, or endOfInput.
> +  *)
> +
> +@findex WriteCard
> +PROCEDURE WriteCard (cid: IOChan.ChanId; card: CARDINAL;
> +                     width: CARDINAL);
> +  (* Writes the value of card to cid in text form, in a field
> +     of the given minimum width. *)
> +
> +END WholeIO.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/WholeStr, gm2-libs-iso/wrapsock, gm2-libs-iso/WholeIO, M2 ISO Libraries
> +@subsection gm2-libs-iso/WholeStr
> +
> +@example
> +DEFINITION MODULE WholeStr;
> +
> +  (* Whole-number/string conversions *)
> +
> +IMPORT
> +  ConvTypes;
> +
> +TYPE
> +@findex ConvResults (type)
> +  ConvResults = ConvTypes.ConvResults;
> +  (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
> +
> +(* the string form of a signed whole number is
> +     ["+" | "-"], decimal digit, @{decimal digit@}
> +*)
> +
> +@findex StrToInt
> +PROCEDURE StrToInt (str: ARRAY OF CHAR; VAR int: INTEGER;
> +                    VAR res: ConvResults);
> +  (* Ignores any leading spaces in str. If the subsequent
> +     characters in str are in the format of a signed whole
> +     number, assigns a corresponding value to int. Assigns
> +     a value indicating the format of str to res.
> +  *)
> +
> +@findex IntToStr
> +PROCEDURE IntToStr (int: INTEGER; VAR str: ARRAY OF CHAR);
> +  (* Converts the value of int to string form and copies the
> +     possibly truncated result to str. *)
> +
> +(* the string form of an unsigned whole number is
> +     decimal digit, @{decimal digit@}
> +*)
> +
> +@findex StrToCard
> +PROCEDURE StrToCard (str: ARRAY OF CHAR;
> +                     VAR card: CARDINAL;
> +                     VAR res: ConvResults);
> +  (* Ignores any leading spaces in str. If the subsequent
> +     characters in str are in the format of an unsigned
> +     whole number, assigns a corresponding value to card.
> +     Assigns a value indicating the format of str to res.
> +  *)
> +
> +@findex CardToStr
> +PROCEDURE CardToStr (card: CARDINAL; VAR str: ARRAY OF CHAR);
> +  (* Converts the value of card to string form and copies the
> +     possibly truncated result to str. *)
> +
> +END WholeStr.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/wrapsock, gm2-libs-iso/wraptime, gm2-libs-iso/WholeStr, M2 ISO Libraries
> +@subsection gm2-libs-iso/wrapsock
> +
> +@example
> +DEFINITION MODULE wrapsock ;
> +
> +(*
> +    Description: provides a set of wrappers to some client side
> +                 tcp socket primatives.
> +*)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +FROM ChanConsts IMPORT OpenResults ;
> +
> +
> +TYPE
> +@findex clientInfo (type)
> +   clientInfo = ADDRESS ;
> +
> +
> +(*
> +   clientOpen - returns an ISO Modula-2 OpenResult.
> +                It attempts to connect to:  hostname:portNo.
> +                If successful then the data structure, c,
> +                will have its fields initialized.
> +*)
> +
> +@findex clientOpen
> +PROCEDURE clientOpen (c: clientInfo;
> +                      hostname: ADDRESS;
> +                      length: CARDINAL;
> +                      portNo: CARDINAL) : OpenResults ;
> +
> +
> +(*
> +   clientOpenIP - returns an ISO Modula-2 OpenResult.
> +                  It attempts to connect to:  ipaddress:portNo.
> +                  If successful then the data structure, c,
> +                  will have its fields initialized.
> +*)
> +
> +@findex clientOpenIP
> +PROCEDURE clientOpenIP (c: clientInfo;
> +                        ip: CARDINAL;
> +                        portNo: CARDINAL) : OpenResults ;
> +
> +
> +(*
> +   getClientPortNo - returns the portNo from structure, c.
> +*)
> +
> +@findex getClientPortNo
> +PROCEDURE getClientPortNo (c: clientInfo) : CARDINAL ;
> +
> +
> +(*
> +   getClientHostname - fills in the hostname of the server
> +                       the to which the client is connecting.
> +*)
> +
> +@findex getClientHostname
> +PROCEDURE getClientHostname (c: clientInfo;
> +                             hostname: ADDRESS; high: CARDINAL) ;
> +
> +
> +(*
> +   getClientSocketFd - returns the sockFd from structure, c.
> +*)
> +
> +@findex getClientSocketFd
> +PROCEDURE getClientSocketFd (c: clientInfo) : INTEGER ;
> +
> +
> +(*
> +   getClientIP - returns the sockFd from structure, s.
> +*)
> +
> +@findex getClientIP
> +PROCEDURE getClientIP (c: clientInfo) : CARDINAL ;
> +
> +
> +(*
> +   getPushBackChar - returns TRUE if a pushed back character
> +                     is available.
> +*)
> +
> +@findex getPushBackChar
> +PROCEDURE getPushBackChar (c: clientInfo; VAR ch: CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   setPushBackChar - returns TRUE if it is able to push back a
> +                     character.
> +*)
> +
> +@findex setPushBackChar
> +PROCEDURE setPushBackChar (c: clientInfo; ch: CHAR) : BOOLEAN ;
> +
> +
> +(*
> +   getSizeOfClientInfo - returns the sizeof (opaque data type).
> +*)
> +
> +@findex getSizeOfClientInfo
> +PROCEDURE getSizeOfClientInfo () : CARDINAL ;
> +
> +
> +END wrapsock.
> +@end example
> +@page
> +
> +@node gm2-libs-iso/wraptime, , gm2-libs-iso/wrapsock, M2 ISO Libraries
> +@subsection gm2-libs-iso/wraptime
> +
> +@example
> +DEFINITION MODULE wraptime ;
> +
> +(*
> +    Description: provides an interface to various time related
> +                 entities on the underlying host operating system.
> +                 It provides access to the glibc/libc functions:
> +                 gettimeofday, settimeofday and localtime_r.
> +*)
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +TYPE
> +@findex timeval (type)
> +   timeval  = ADDRESS ;
> +@findex timezone (type)
> +   timezone = ADDRESS ;
> +@findex tm (type)
> +   tm       = ADDRESS ;
> +
> +
> +(*
> +   InitTimeval - returns a newly created opaque type.
> +*)
> +
> +@findex InitTimeval
> +PROCEDURE InitTimeval () : timeval ;
> +
> +
> +(*
> +   KillTimeval - deallocates the memory associated with an
> +                 opaque type.
> +*)
> +
> +@findex KillTimeval
> +PROCEDURE KillTimeval (tv: timeval) : timeval ;
> +
> +
> +(*
> +   InitTimezone - returns a newly created opaque type.
> +*)
> +
> +@findex InitTimezone
> +PROCEDURE InitTimezone () : timezone ;
> +
> +
> +(*
> +   KillTimezone - deallocates the memory associated with an
> +                  opaque type.
> +*)
> +
> +@findex KillTimezone
> +PROCEDURE KillTimezone (tv: timezone) : timezone ;
> +
> +
> +(*
> +   InitTM - returns a newly created opaque type.
> +*)
> +
> +@findex InitTM
> +PROCEDURE InitTM () : tm ;
> +
> +
> +(*
> +   KillTM - deallocates the memory associated with an
> +            opaque type.
> +*)
> +
> +@findex KillTM
> +PROCEDURE KillTM (tv: tm) : tm ;
> +
> +
> +(*
> +   gettimeofday - calls gettimeofday(2) with the same parameters, tv,
> +                  and, tz.  It returns 0 on success.
> +*)
> +
> +@findex gettimeofday
> +PROCEDURE gettimeofday (tv: timeval; tz: timezone) : INTEGER ;
> +
> +
> +(*
> +   settimeofday - calls settimeofday(2) with the same parameters, tv,
> +                  and, tz.  It returns 0 on success.
> +*)
> +
> +@findex settimeofday
> +PROCEDURE settimeofday (tv: timeval; tz: timezone) : INTEGER ;
> +
> +
> +(*
> +   GetFractions - returns the tv_usec field inside the timeval structure
> +                  as a CARDINAL.
> +*)
> +
> +@findex GetFractions
> +PROCEDURE GetFractions (tv: timeval) : CARDINAL ;
> +
> +
> +(*
> +   localtime_r - returns the tm parameter, m, after it has been assigned with
> +                 appropriate contents determined by, tv.  Notice that
> +                 this procedure function expects, timeval, as its first
> +                 parameter and not a time_t (as expected by the posix
> +                 equivalent).  This avoids having to expose a time_t
> +                 system dependant definition.
> +*)
> +
> +@findex localtime_r
> +PROCEDURE localtime_r (tv: timeval; m: tm) : tm ;
> +
> +
> +(*
> +   GetYear - returns the year from the structure, m.
> +*)
> +
> +@findex GetYear
> +PROCEDURE GetYear (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetMonth - returns the month from the structure, m.
> +*)
> +
> +@findex GetMonth
> +PROCEDURE GetMonth (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetDay - returns the day of the month from the structure, m.
> +*)
> +
> +@findex GetDay
> +PROCEDURE GetDay (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetHour - returns the hour of the day from the structure, m.
> +*)
> +
> +@findex GetHour
> +PROCEDURE GetHour (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetMinute - returns the minute within the hour from the structure, m.
> +*)
> +
> +@findex GetMinute
> +PROCEDURE GetMinute (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetSecond - returns the seconds in the minute from the structure, m.
> +               The return value will always be in the range 0..59.
> +               A leap minute of value 60 will be truncated to 59.
> +*)
> +
> +@findex GetSecond
> +PROCEDURE GetSecond (m: tm) : CARDINAL ;
> +
> +
> +(*
> +   GetSummerTime - returns a boolean indicating whether summer time is
> +                   set.
> +*)
> +
> +@findex GetSummerTime
> +PROCEDURE GetSummerTime (tz: timezone) : BOOLEAN ;
> +
> +
> +(*
> +   GetDST - returns the number of minutes west of GMT.
> +*)
> +
> +@findex GetDST
> +PROCEDURE GetDST (tz: timezone) : INTEGER ;
> +
> +
> +(*
> +   SetTimeval - sets the fields in timeval, tv, with:
> +                second, minute, hour, day, month, year, fractions.
> +*)
> +
> +@findex SetTimeval
> +PROCEDURE SetTimeval (tv: timeval;
> +                      second, minute, hour, day,
> +                      month, year, yday, wday, isdst: CARDINAL) ;
> +
> +
> +(*
> +   SetTimezone - set the timezone field inside timeval, tv.
> +*)
> +
> +@findex SetTimezone
> +PROCEDURE SetTimezone (tv: timeval;
> +                       zone: CARDINAL; minuteswest: INTEGER) ;
> +
> +
> +END wraptime.
> +@end example
> +@page
> +
> +
> +@c ------------------------------------------------------------
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/Builtins.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/target-independent/Builtins.texi       2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,340 @@
> +
> +@example
> +DEFINITION MODULE Builtins ;
> +
> +FROM SYSTEM IMPORT ADDRESS ;
> +
> +(* floating point intrinsic procedure functions *)
> +
> +@findex isfinitef
> +PROCEDURE __BUILTIN__ isfinitef (x: SHORTREAL) : BOOLEAN ;
> +@findex isfinite
> +PROCEDURE __BUILTIN__ isfinite (x: REAL) : BOOLEAN ;
> +@findex isfinitel
> +PROCEDURE __BUILTIN__ isfinitel (x: LONGREAL) : BOOLEAN ;
> +
> +@findex sinf
> +PROCEDURE __BUILTIN__ sinf (x: SHORTREAL) : SHORTREAL ;
> +@findex sin
> +PROCEDURE __BUILTIN__ sin (x: REAL) : REAL ;
> +@findex sinl
> +PROCEDURE __BUILTIN__ sinl (x: LONGREAL) : LONGREAL ;
> +
> +@findex cosf
> +PROCEDURE __BUILTIN__ cosf (x: SHORTREAL) : SHORTREAL ;
> +@findex cos
> +PROCEDURE __BUILTIN__ cos (x: REAL) : REAL ;
> +@findex cosl
> +PROCEDURE __BUILTIN__ cosl (x: LONGREAL) : LONGREAL ;
> +
> +@findex sqrtf
> +PROCEDURE __BUILTIN__ sqrtf (x: SHORTREAL) : SHORTREAL ;
> +@findex sqrt
> +PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ;
> +@findex sqrtl
> +PROCEDURE __BUILTIN__ sqrtl (x: LONGREAL) : LONGREAL ;
> +
> +@findex atan2f
> +PROCEDURE __BUILTIN__ atan2f (x, y: SHORTREAL) : SHORTREAL ;
> +@findex atan2
> +PROCEDURE __BUILTIN__ atan2 (x, y: REAL) : REAL ;
> +@findex atan2l
> +PROCEDURE __BUILTIN__ atan2l (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex fabsf
> +PROCEDURE __BUILTIN__ fabsf (x: SHORTREAL) : SHORTREAL ;
> +@findex fabs
> +PROCEDURE __BUILTIN__ fabs (x: REAL) : REAL ;
> +@findex fabsl
> +PROCEDURE __BUILTIN__ fabsl (x: LONGREAL) : LONGREAL ;
> +
> +@findex logf
> +PROCEDURE __BUILTIN__ logf (x: SHORTREAL) : SHORTREAL ;
> +@findex log
> +PROCEDURE __BUILTIN__ log (x: REAL) : REAL ;
> +@findex logl
> +PROCEDURE __BUILTIN__ logl (x: LONGREAL) : LONGREAL ;
> +
> +@findex expf
> +PROCEDURE __BUILTIN__ expf (x: SHORTREAL) : SHORTREAL ;
> +@findex exp
> +PROCEDURE __BUILTIN__ exp (x: REAL) : REAL ;
> +@findex expl
> +PROCEDURE __BUILTIN__ expl (x: LONGREAL) : LONGREAL ;
> +
> +@findex log10f
> +PROCEDURE __BUILTIN__ log10f (x: SHORTREAL) : SHORTREAL ;
> +@findex log10
> +PROCEDURE __BUILTIN__ log10 (x: REAL) : REAL ;
> +@findex log10l
> +PROCEDURE __BUILTIN__ log10l (x: LONGREAL) : LONGREAL ;
> +
> +@findex exp10f
> +PROCEDURE __BUILTIN__ exp10f (x: SHORTREAL) : SHORTREAL ;
> +@findex exp10
> +PROCEDURE __BUILTIN__ exp10 (x: REAL) : REAL ;
> +@findex exp10l
> +PROCEDURE __BUILTIN__ exp10l (x: LONGREAL) : LONGREAL ;
> +
> +@findex ilogbf
> +PROCEDURE __BUILTIN__ ilogbf (x: SHORTREAL) : INTEGER ;
> +@findex ilogb
> +PROCEDURE __BUILTIN__ ilogb (x: REAL) : INTEGER ;
> +@findex ilogbl
> +PROCEDURE __BUILTIN__ ilogbl (x: LONGREAL) : INTEGER ;
> +
> +@findex huge_val
> +PROCEDURE __BUILTIN__ huge_val () : REAL ;
> +@findex huge_valf
> +PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ;
> +@findex huge_vall
> +PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ;
> +
> +@findex significand
> +PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ;
> +@findex significandf
> +PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ;
> +@findex significandl
> +PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ;
> +
> +@findex modf
> +PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ;
> +@findex modff
> +PROCEDURE __BUILTIN__ modff (x: SHORTREAL;
> +                             VAR y: SHORTREAL) : SHORTREAL ;
> +@findex modfl
> +PROCEDURE __BUILTIN__ modfl (x: LONGREAL; VAR y: LONGREAL) : LONGREAL ;
> +
> +@findex signbit
> +PROCEDURE __BUILTIN__ signbit (r: REAL) : INTEGER ;
> +@findex signbitf
> +PROCEDURE __BUILTIN__ signbitf (s: SHORTREAL) : INTEGER ;
> +@findex signbitl
> +PROCEDURE __BUILTIN__ signbitl (l: LONGREAL) : INTEGER ;
> +
> +@findex nextafter
> +PROCEDURE __BUILTIN__ nextafter (x, y: REAL) : REAL ;
> +@findex nextafterf
> +PROCEDURE __BUILTIN__ nextafterf (x, y: SHORTREAL) : SHORTREAL ;
> +@findex nextafterl
> +PROCEDURE __BUILTIN__ nextafterl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex nexttoward
> +PROCEDURE __BUILTIN__ nexttoward (x, y: REAL) : LONGREAL ;
> +@findex nexttowardf
> +PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ;
> +@findex nexttowardl
> +PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ;
> +
> +@findex scalb
> +PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ;
> +@findex scalbf
> +PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ;
> +@findex scalbl
> +PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ;
> +
> +@findex scalbln
> +PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ;
> +@findex scalblnf
> +PROCEDURE __BUILTIN__ scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ;
> +@findex scalblnl
> +PROCEDURE __BUILTIN__ scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ;
> +
> +@findex scalbn
> +PROCEDURE __BUILTIN__ scalbn (x: REAL; n: INTEGER) : REAL ;
> +@findex scalbnf
> +PROCEDURE __BUILTIN__ scalbnf (x: SHORTREAL; n: INTEGER) : SHORTREAL ;
> +@findex scalbnl
> +PROCEDURE __BUILTIN__ scalbnl (x: LONGREAL; n: INTEGER) : LONGREAL ;
> +
> +(* complex arithmetic intrincic procedure functions *)
> +
> +@findex cabsf
> +PROCEDURE __BUILTIN__ cabsf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex cabs
> +PROCEDURE __BUILTIN__ cabs (z: COMPLEX) : REAL ;
> +@findex cabsl
> +PROCEDURE __BUILTIN__ cabsl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex cargf
> +PROCEDURE __BUILTIN__ cargf (z: SHORTCOMPLEX) : SHORTREAL ;
> +@findex carg
> +PROCEDURE __BUILTIN__ carg (z: COMPLEX) : REAL ;
> +@findex cargl
> +PROCEDURE __BUILTIN__ cargl (z: LONGCOMPLEX) : LONGREAL ;
> +
> +@findex conjf
> +PROCEDURE __BUILTIN__ conjf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex conj
> +PROCEDURE __BUILTIN__ conj (z: COMPLEX) : COMPLEX ;
> +@findex conjl
> +PROCEDURE __BUILTIN__ conjl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cpowerf
> +PROCEDURE __BUILTIN__ cpowerf (base: SHORTCOMPLEX;
> +                               exp: SHORTREAL) : SHORTCOMPLEX ;
> +@findex cpower
> +PROCEDURE __BUILTIN__ cpower (base: COMPLEX; exp: REAL) : COMPLEX ;
> +@findex cpowerl
> +PROCEDURE __BUILTIN__ cpowerl (base: LONGCOMPLEX;
> +                               exp: LONGREAL) : LONGCOMPLEX ;
> +
> +@findex csqrtf
> +PROCEDURE __BUILTIN__ csqrtf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csqrt
> +PROCEDURE __BUILTIN__ csqrt (z: COMPLEX) : COMPLEX ;
> +@findex csqrtl
> +PROCEDURE __BUILTIN__ csqrtl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex cexpf
> +PROCEDURE __BUILTIN__ cexpf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cexp
> +PROCEDURE __BUILTIN__ cexp (z: COMPLEX) : COMPLEX ;
> +@findex cexpl
> +PROCEDURE __BUILTIN__ cexpl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex clnf
> +PROCEDURE __BUILTIN__ clnf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex cln
> +PROCEDURE __BUILTIN__ cln (z: COMPLEX) : COMPLEX ;
> +@findex clnl
> +PROCEDURE __BUILTIN__ clnl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex csinf
> +PROCEDURE __BUILTIN__ csinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex csin
> +PROCEDURE __BUILTIN__ csin (z: COMPLEX) : COMPLEX ;
> +@findex csinl
> +PROCEDURE __BUILTIN__ csinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ccosf
> +PROCEDURE __BUILTIN__ ccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ccos
> +PROCEDURE __BUILTIN__ ccos (z: COMPLEX) : COMPLEX ;
> +@findex ccosl
> +PROCEDURE __BUILTIN__ ccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex ctanf
> +PROCEDURE __BUILTIN__ ctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex ctan
> +PROCEDURE __BUILTIN__ ctan (z: COMPLEX) : COMPLEX ;
> +@findex ctanl
> +PROCEDURE __BUILTIN__ ctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carcsinf
> +PROCEDURE __BUILTIN__ carcsinf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carcsin
> +PROCEDURE __BUILTIN__ carcsin (z: COMPLEX) : COMPLEX ;
> +@findex carcsinl
> +PROCEDURE __BUILTIN__ carcsinl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carccosf
> +PROCEDURE __BUILTIN__ carccosf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carccos
> +PROCEDURE __BUILTIN__ carccos (z: COMPLEX) : COMPLEX ;
> +@findex carccosl
> +PROCEDURE __BUILTIN__ carccosl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +@findex carctanf
> +PROCEDURE __BUILTIN__ carctanf (z: SHORTCOMPLEX) : SHORTCOMPLEX ;
> +@findex carctan
> +PROCEDURE __BUILTIN__ carctan (z: COMPLEX) : COMPLEX ;
> +@findex carctanl
> +PROCEDURE __BUILTIN__ carctanl (z: LONGCOMPLEX) : LONGCOMPLEX ;
> +
> +(* memory and string intrincic procedure functions *)
> +
> +@findex alloca
> +PROCEDURE __BUILTIN__ alloca (i: CARDINAL) : ADDRESS ;
> +@findex memcpy
> +PROCEDURE __BUILTIN__ memcpy (dest, src: ADDRESS;
> +                              nbytes: CARDINAL) : ADDRESS ;
> +@findex index
> +PROCEDURE __BUILTIN__ index (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex rindex
> +PROCEDURE __BUILTIN__ rindex (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex memcmp
> +PROCEDURE __BUILTIN__ memcmp (s1, s2: ADDRESS;
> +                              nbytes: CARDINAL) : INTEGER ;
> +@findex memset
> +PROCEDURE __BUILTIN__ memset (s: ADDRESS; c: INTEGER;
> +                              nbytes: CARDINAL) : ADDRESS ;
> +@findex memmove
> +PROCEDURE __BUILTIN__ memmove (s1, s2: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcat
> +PROCEDURE __BUILTIN__ strcat (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncat
> +PROCEDURE __BUILTIN__ strncat (dest, src: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcpy
> +PROCEDURE __BUILTIN__ strcpy (dest, src: ADDRESS) : ADDRESS ;
> +@findex strncpy
> +PROCEDURE __BUILTIN__ strncpy (dest, src: ADDRESS;
> +                               nbytes: CARDINAL) : ADDRESS ;
> +@findex strcmp
> +PROCEDURE __BUILTIN__ strcmp (s1, s2: ADDRESS) : INTEGER ;
> +@findex strncmp
> +PROCEDURE __BUILTIN__ strncmp (s1, s2: ADDRESS;
> +                               nbytes: CARDINAL) : INTEGER ;
> +@findex strlen
> +PROCEDURE __BUILTIN__ strlen (s: ADDRESS) : INTEGER ;
> +@findex strstr
> +PROCEDURE __BUILTIN__ strstr (haystack, needle: ADDRESS) : ADDRESS ;
> +@findex strpbrk
> +PROCEDURE __BUILTIN__ strpbrk (s, accept: ADDRESS) : ADDRESS ;
> +@findex strspn
> +PROCEDURE __BUILTIN__ strspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strcspn
> +PROCEDURE __BUILTIN__ strcspn (s, accept: ADDRESS) : CARDINAL ;
> +@findex strchr
> +PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +@findex strrchr
> +PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
> +
> +(*
> +   longjmp - this GCC builtin restricts the val to always 1.
> +*)
> +(* do not use these two builtins, as gcc, only really
> +   anticipates that the Ada front end should use them
> +   and it only uses them in its runtime exception handling.
> +   We leave them here in the hope that someday they will
> +   behave more like their libc counterparts.  *)
> +
> +@findex longjmp
> +PROCEDURE __BUILTIN__ longjmp (env: ADDRESS; val: INTEGER) ;
> +@findex setjmp
> +PROCEDURE __BUILTIN__ setjmp (env: ADDRESS) : INTEGER ;
> +
> +
> +(*
> +   frame_address - returns the address of the frame.
> +                   The current frame is obtained if level is 0,
> +                   the next level up if level is 1 etc.
> +*)
> +
> +@findex frame_address
> +PROCEDURE __BUILTIN__ frame_address (level: CARDINAL) : ADDRESS ;
> +
> +
> +(*
> +   return_address - returns the return address of function.
> +                    The current function return address is
> +                    obtained if level is 0,
> +                    the next level up if level is 1 etc.
> +*)
> +
> +@findex return_address
> +PROCEDURE __BUILTIN__ return_address (level: CARDINAL) : ADDRESS ;
> +
> +
> +(*
> +   alloca_trace - this is a no-op which is used for internal debugging.
> +*)
> +
> +@findex alloca_trace
> +PROCEDURE alloca_trace (returned: ADDRESS; nBytes: CARDINAL) : ADDRESS ;
> +
> +
> +END Builtins.
> +@end example
> diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-pim.texi
> --- /dev/null   2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/m2/target-independent/SYSTEM-pim.texi     2022-12-14 06:54:59.688966155 +0000
> @@ -0,0 +1,176 @@
> +
> +@example
> +DEFINITION MODULE SYSTEM ;
> +
> +EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
> +                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
> +                 Target specific data types.  *)
> +                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
> +                 (* SIZE is also exported if -fpim2 is used.  *)
> +
> +CONST
> +@findex BITSPERBYTE (const)
> +  BITSPERBYTE   = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
> +@findex BYTESPERWORD (const)
> +  BYTESPERWORD  = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
> +
> +
> +(* all the following types are declared internally to gm2
> +TYPE
> +   (* Target specific data types.  *)
> +*)
> +
> +
> +(*
> +   all the functions below are declared internally to gm2
> +   ====================================================
> +
> +@findex ADR
> +PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
> +  (* Returns the address of variable v. *)
> +
> +@findex SIZE
> +PROCEDURE SIZE (v: <type>) : ZType;
> +  (* Returns the number of BYTES used to store a v of
> +     any specified <type>.  Only available if -fpim2 is used.
> +  *)
> +
> +@findex TSIZE
> +PROCEDURE TSIZE (<type>) : CARDINAL;
> +  (* Returns the number of BYTES used to store a value of the
> +     specified <type>.
> +  *)
> +
> +@findex ROTATE
> +PROCEDURE ROTATE (val: <a set type>;
> +                  num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by rotating up/right
> +     or down/right by the absolute value of num.  The direction is
> +     down/right if the sign of num is negative, otherwise the direction
> +     is up/left.
> +  *)
> +
> +@findex SHIFT
> +PROCEDURE SHIFT (val: <a set type>;
> +                 num: INTEGER): <type of first parameter>;
> +  (* Returns a bit sequence obtained from val by shifting up/left
> +     or down/right by the absolute value of num, introducing
> +     zeros as necessary.  The direction is down/right if the sign of
> +     num is negative, otherwise the direction is up/left.
> +  *)
> +
> +@findex THROW
> +PROCEDURE THROW (i: INTEGER) ;
> +  (*
> +     THROW is a GNU extension and was not part of the PIM or ISO
> +     standards.  It throws an exception which will be caught by the
> +     EXCEPT block (assuming it exists).  This is a compiler builtin
> +     function which interfaces to the GCC exception handling runtime
> +     system.
> +     GCC uses the term throw, hence the naming distinction between
> +     the GCC builtin and the Modula-2 runtime library procedure Raise.
> +     The later library procedure Raise will call SYSTEM.THROW after
> +     performing various housekeeping activities.
> +  *)
> +
> +@findex TBITSIZE
> +PROCEDURE TBITSIZE (<type>) : CARDINAL ;
> +  (* Returns the minimum number of bits necessary to represent
> +     <type>.  This procedure function is only useful for determining
> +     the number of bits used for any type field within a packed RECORD.
> +     It is not particularly useful elsewhere since <type> might be
> +     optimized for speed, for example a BOOLEAN could occupy a WORD.
> +  *)
> +*)
> +
> +(* The following procedures are invoked by GNU Modula-2 to
> +   shift non word sized set types. They are not strictly part
> +   of the core PIM Modula-2, however they are used
> +   to implement the SHIFT procedure defined above,
> +   which are in turn used by the Logitech compatible libraries.
> +
> +   Users will access these procedures by using the procedure
> +   SHIFT above and GNU Modula-2 will map SHIFT onto one of
> +   the following procedures.
> +*)
> +
> +(*
> +   ShiftVal - is a runtime procedure whose job is to implement
> +              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
> +              inline a SHIFT of a single WORD sized set and will only
> +              call this routine for larger sets.
> +*)
> +
> +@findex ShiftVal
> +PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
> +                    SetSizeInBits: CARDINAL;
> +                    ShiftCount: INTEGER) ;
> +
> +
> +(*
> +   ShiftLeft - performs the shift left for a multi word set.
> +               This procedure might be called by the back end of
> +               GNU Modula-2 depending whether amount is known at
> +               compile time.
> +*)
> +
> +@findex ShiftLeft
> +PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     ShiftCount: CARDINAL) ;
> +
> +(*
> +   ShiftRight - performs the shift left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex ShiftRight
> +PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      ShiftCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateVal - is a runtime procedure whose job is to implement
> +               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
> +               inline a ROTATE of a single WORD (or less)
> +               sized set and will only call this routine for larger
> +               sets.
> +*)
> +
> +@findex RotateVal
> +PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
> +                     SetSizeInBits: CARDINAL;
> +                     RotateCount: INTEGER) ;
> +
> +
> +(*
> +   RotateLeft - performs the rotate left for a multi word set.
> +                This procedure might be called by the back end of
> +                GNU Modula-2 depending whether amount is known at
> +                compile time.
> +*)
> +
> +@findex RotateLeft
> +PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
> +                      SetSizeInBits: CARDINAL;
> +                      RotateCount: CARDINAL) ;
> +
> +
> +(*
> +   RotateRight - performs the rotate right for a multi word set.
> +                 This procedure might be called by the back end of
> +                 GNU Modula-2 depending whether amount is known at
> +                 compile time.
> +*)
> +
> +@findex RotateRight
> +PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
> +                       SetSizeInBits: CARDINAL;
> +                       RotateCount: CARDINAL) ;
> +
> +
> +END SYSTEM.
> +@end example

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter).
  2022-12-14  8:17     ` Richard Biener
@ 2022-12-14  8:35       ` Gaius Mulley
  2022-12-15 12:03         ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Gaius Mulley @ 2022-12-14  8:35 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Richard Biener <richard.guenther@gmail.com> writes:

> On Wed, Dec 14, 2022 at 8:48 AM Gaius Mulley <gaiusmod2@gmail.com> wrote:
>>
>>
>>
>> This patch set adds a re-exp ACX_CHECK_PROG_VER to detect python3.
>> HAVE_PYTHON is then checked in gcc/m2/Make-lang.in to generate library
>> chapters if python3 is available.  If python3 is unavailable then the
>> chapters are copied from a target-independent version.
>>
>> Bugfixed --enable-generated-files-in-srcdir.
>>
>> Python3 modules section added to install.texi.
>>
>> Also included are the target-independent versions of the
>> documentation.  The only difference is in the SYSTEM module which if
>> generated when HAVE_PYTHON is "yes" will enumerate all fundamental
>> data types supported by the target and compiler.
>>
>> I've hand snipped to try and reduce the size/noise as some of
>> these files have already been reviewed.
>>
>> I'll post the unedited version as well for completness,
>
> LGTM.

thanks - this is the last patch tick.  So I'll actually do the merge now :-)

> I'll note that in other GCC manuals we have target dependent
> things documented for each supported target.  It looks like
> the M2 docs will have only documentation built for the target
> the compiler is built for?  So for example the online documentation
> hosted on gcc.gnu.org will then contain only documentation for
> the x86_64-linux target specific SYSTEM module?

true

> building documentation for openSUSE (caveat: we only build
> .info docs and manpages) the documentation is only built once
> (aka for rpm 'noarch') with the idea it will be the same on all targets.
>
> So it seems to me that enumerating the SYSTEM module documentation
> for all targets or somehow differently organizing it would be better?

yes it would.  There is a desire to move the non standard data types out
of SYSTEM (by the user community) for the future.  But having a comment
saying data type availability dependant upon target architecture would
suffice for now, I'll add a comment,

regards,
Gaius

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter).
  2022-12-14  8:35       ` Gaius Mulley
@ 2022-12-15 12:03         ` Jakub Jelinek
  2022-12-15 12:51           ` Gaius Mulley
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2022-12-15 12:03 UTC (permalink / raw)
  To: Gaius Mulley; +Cc: Richard Biener, gcc-patches

On Wed, Dec 14, 2022 at 08:35:07AM +0000, Gaius Mulley via Gcc-patches wrote:
> thanks - this is the last patch tick.  So I'll actually do the merge now :-)

I've committed following patch to fix up formatting of ChangeLog entries.

diff --git a/ChangeLog b/ChangeLog
index d429aa16dac..89f9d752562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,24 +2,27 @@
 
 	* configure.ac (target_libraries): Add target-libgm2.
 	Add NCN_STRICT_CHECK_TARGET_TOOLS entry for gm2.
-	Add GCC_TARGET_TOOL entry for gm2.  (compare_exclusions)
-	add gcc/m2/gm2-compiler/M2Version,
+	Add GCC_TARGET_TOOL entry for gm2.
+	(compare_exclusions): Add gcc/m2/gm2-compiler/M2Version,
 	gcc/m2/gm2-compiler-boot/SYSTEM and gcc/m2/gm2version.
-	* Makefile.def (target_modules): Add libgm2.  (flags_to_pass)
-	Add GM2_FOR_TARGET, GM2FLAGS_FOR_TARGET.  (dependencies) Add
-	all-target-libgm2 and on=all-target-libatomic.  (languages)
-	Add entry for language=m2 with gcc-check-target=check-m2
+	* Makefile.def (target_modules): Add libgm2.
+	(flags_to_pass): Add GM2_FOR_TARGET, GM2FLAGS_FOR_TARGET.
+	(dependencies): Add all-target-libgm2 and on=all-target-libatomic.
+	(languages): Add entry for language=m2 with gcc-check-target=check-m2
 	and lib-check-target=check-target-libgm2.
-	* Makefile.tpl (BUILD_EXPORTS): Add definition for GM2
-	and GM2FLAGS.  (HOST_EXPORTS) Add definition for GM2.
-	(BASE_TARGET_EXPORTS) Add definition for GM2.
-	(GM2_FOR_BUILD) Defined.  (GM2FLAGS) Defined.
-	(GM2_FOR_TARGET) Defined.  (GM2FLAGS_FOR_TARGET) Defined.
-	(EXTRA_HOST_FLAGS) Defined.  (POSTSTAGE1_FLAGS_TO_PASS)
-	Add GM2 and GM2_FOR_BUILD.  (EXTRA_TARGET_FLAGS) Add
-	GM2 and GM2FLAGS.  (EXTRA_GCC_FLAGS) Add GM2_FOR_TARGET.
-	* configure: (Rebuilt).
-	* Makefile.in: (Rebuilt).
+	* Makefile.tpl (BUILD_EXPORTS): Add definition for GM2 and GM2FLAGS.
+	(HOST_EXPORTS): Add definition for GM2.
+	(BASE_TARGET_EXPORTS): Add definition for GM2.
+	(GM2_FOR_BUILD): Defined.
+	(GM2FLAGS): Defined.
+	(GM2_FOR_TARGET): Defined.
+	(GM2FLAGS_FOR_TARGET): Defined.
+	(EXTRA_HOST_FLAGS): Defined.
+	(POSTSTAGE1_FLAGS_TO_PASS): Add GM2 and GM2_FOR_BUILD.
+	(EXTRA_TARGET_FLAGS): Add GM2 and GM2FLAGS.
+	(EXTRA_GCC_FLAGS): Add GM2_FOR_TARGET.
+	* configure: Rebuilt.
+	* Makefile.in: Rebuilt.
 
 2022-12-13  Philip Herron  <philip.herron@embecosm.com>
 
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c3db91c3e27..5299b0da895 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -41,13 +41,15 @@
 	* configure.ac (HAVE_PYTHON): Test for Python3 added.
 	* dwarf2out.cc (gen_compile_unit_die): Check language_string
 	and language to DW_LANG_Modula2.
-	* doc/install.texi: Add m2 as a language.  (--disable-libgm2)
-	Documented.  Add make check-m2 to testing selected tests.
+	* doc/install.texi: Add m2 as a language.
+	(--disable-libgm2): Documented.  Add make check-m2 to testing selected
+	tests.
 	* doc/sourcebuild.texi (GM2): New prerequisite item.
-	(Python3 modules) New item.  (libgm2) Added.
+	(Python3 modules) New item.
+	(libgm2) Added.
 	(gcc/m2) Added.
-	* configure: (Rebuilt).
-	* config.in: (Rebuilt).
+	* configure: Rebuilt.
+	* config.in: Rebuilt.
 	* doc/gm2.texi: New file.
 
 2022-12-14  Martin Jambor  <mjambor@suse.cz>
diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog
index a3e39efe437..34da98a594d 100644
--- a/gcc/m2/ChangeLog
+++ b/gcc/m2/ChangeLog
@@ -1,921 +1,921 @@
 2022-12-14  Gaius Mulley  <gaiusmod2@gmail.com>
 
-	* COPYING.FDL: (New file).
-	* COPYING.RUNTIME: (New file).
-	* COPYING3: (New file).
-	* COPYING3.LIB: (New file).
-	* Make-lang.in: (New file).
-	* Make-maintainer.in: (New file).
-	* NEWS: (New file).
-	* README: (New file).
-	* config-lang.in: (New file).
-	* config-make.in: (New file).
-	* configure.ac: (New file).
-	* gm2-compiler/CLexBuf.def: (New file).
-	* gm2-compiler/CLexBuf.mod: (New file).
-	* gm2-compiler/FifoQueue.def: (New file).
-	* gm2-compiler/FifoQueue.mod: (New file).
-	* gm2-compiler/Lists.def: (New file).
-	* gm2-compiler/Lists.mod: (New file).
-	* gm2-compiler/M2ALU.def: (New file).
-	* gm2-compiler/M2ALU.mod: (New file).
-	* gm2-compiler/M2AsmUtil.def: (New file).
-	* gm2-compiler/M2AsmUtil.mod: (New file).
-	* gm2-compiler/M2Base.def: (New file).
-	* gm2-compiler/M2Base.mod: (New file).
-	* gm2-compiler/M2BasicBlock.def: (New file).
-	* gm2-compiler/M2BasicBlock.mod: (New file).
-	* gm2-compiler/M2Batch.def: (New file).
-	* gm2-compiler/M2Batch.mod: (New file).
-	* gm2-compiler/M2Bitset.def: (New file).
-	* gm2-compiler/M2Bitset.mod: (New file).
-	* gm2-compiler/M2CaseList.def: (New file).
-	* gm2-compiler/M2CaseList.mod: (New file).
-	* gm2-compiler/M2Check.def: (New file).
-	* gm2-compiler/M2Check.mod: (New file).
-	* gm2-compiler/M2Code.def: (New file).
-	* gm2-compiler/M2Code.mod: (New file).
-	* gm2-compiler/M2ColorString.def: (New file).
-	* gm2-compiler/M2ColorString.mod: (New file).
-	* gm2-compiler/M2Comp.def: (New file).
-	* gm2-compiler/M2Comp.mod: (New file).
-	* gm2-compiler/M2Const.def: (New file).
-	* gm2-compiler/M2Const.mod: (New file).
-	* gm2-compiler/M2Debug.def: (New file).
-	* gm2-compiler/M2Debug.mod: (New file).
-	* gm2-compiler/M2DebugStack.def: (New file).
-	* gm2-compiler/M2DebugStack.mod: (New file).
-	* gm2-compiler/M2Defaults.def: (New file).
-	* gm2-compiler/M2Defaults.mod: (New file).
-	* gm2-compiler/M2DriverOptions.def: (New file).
-	* gm2-compiler/M2DriverOptions.mod: (New file).
-	* gm2-compiler/M2Emit.def: (New file).
-	* gm2-compiler/M2Emit.mod: (New file).
-	* gm2-compiler/M2Error.def: (New file).
-	* gm2-compiler/M2Error.mod: (New file).
-	* gm2-compiler/M2EvalSym.def: (New file).
-	* gm2-compiler/M2FileName.def: (New file).
-	* gm2-compiler/M2FileName.mod: (New file).
-	* gm2-compiler/M2GCCDeclare.def: (New file).
-	* gm2-compiler/M2GCCDeclare.mod: (New file).
-	* gm2-compiler/M2GenGCC.def: (New file).
-	* gm2-compiler/M2GenGCC.mod: (New file).
-	* gm2-compiler/M2Graph.def: (New file).
-	* gm2-compiler/M2Graph.mod: (New file).
-	* gm2-compiler/M2Lex.def: (New file).
-	* gm2-compiler/M2Lex.mod: (New file).
-	* gm2-compiler/M2LexBuf.def: (New file).
-	* gm2-compiler/M2LexBuf.mod: (New file).
-	* gm2-compiler/M2MetaError.def: (New file).
-	* gm2-compiler/M2MetaError.mod: (New file).
-	* gm2-compiler/M2Optimize.def: (New file).
-	* gm2-compiler/M2Optimize.mod: (New file).
-	* gm2-compiler/M2Options.def: (New file).
-	* gm2-compiler/M2Options.mod: (New file).
-	* gm2-compiler/M2Pass.def: (New file).
-	* gm2-compiler/M2Pass.mod: (New file).
-	* gm2-compiler/M2Preprocess.def: (New file).
-	* gm2-compiler/M2Preprocess.mod: (New file).
-	* gm2-compiler/M2Printf.def: (New file).
-	* gm2-compiler/M2Printf.mod: (New file).
-	* gm2-compiler/M2Quads.def: (New file).
-	* gm2-compiler/M2Quads.mod: (New file).
-	* gm2-compiler/M2Quiet.def: (New file).
-	* gm2-compiler/M2Quiet.mod: (New file).
-	* gm2-compiler/M2Range.def: (New file).
-	* gm2-compiler/M2Range.mod: (New file).
-	* gm2-compiler/M2Reserved.def: (New file).
-	* gm2-compiler/M2Reserved.mod: (New file).
-	* gm2-compiler/M2SSA.def: (New file).
-	* gm2-compiler/M2SSA.mod: (New file).
-	* gm2-compiler/M2Scaffold.def: (New file).
-	* gm2-compiler/M2Scaffold.mod: (New file).
-	* gm2-compiler/M2Scope.def: (New file).
-	* gm2-compiler/M2Scope.mod: (New file).
-	* gm2-compiler/M2Search.def: (New file).
-	* gm2-compiler/M2Search.mod: (New file).
-	* gm2-compiler/M2Size.def: (New file).
-	* gm2-compiler/M2Size.mod: (New file).
-	* gm2-compiler/M2StackAddress.def: (New file).
-	* gm2-compiler/M2StackAddress.mod: (New file).
-	* gm2-compiler/M2StackWord.def: (New file).
-	* gm2-compiler/M2StackWord.mod: (New file).
-	* gm2-compiler/M2Students.def: (New file).
-	* gm2-compiler/M2Students.mod: (New file).
-	* gm2-compiler/M2Swig.def: (New file).
-	* gm2-compiler/M2Swig.mod: (New file).
-	* gm2-compiler/M2System.def: (New file).
-	* gm2-compiler/M2System.mod: (New file).
-	* gm2-compiler/M2Version.def: (New file).
-	* gm2-compiler/NameKey.def: (New file).
-	* gm2-compiler/NameKey.mod: (New file).
-	* gm2-compiler/ObjectFiles.def: (New file).
-	* gm2-compiler/ObjectFiles.mod: (New file).
-	* gm2-compiler/Output.def: (New file).
-	* gm2-compiler/Output.mod: (New file).
-	* gm2-compiler/P0SymBuild.def: (New file).
-	* gm2-compiler/P0SymBuild.mod: (New file).
-	* gm2-compiler/P0SyntaxCheck.bnf: (New file).
-	* gm2-compiler/P0SyntaxCheck.def: (New file).
-	* gm2-compiler/P1Build.bnf: (New file).
-	* gm2-compiler/P1Build.def: (New file).
-	* gm2-compiler/P1SymBuild.def: (New file).
-	* gm2-compiler/P1SymBuild.mod: (New file).
-	* gm2-compiler/P2Build.bnf: (New file).
-	* gm2-compiler/P2Build.def: (New file).
-	* gm2-compiler/P2SymBuild.def: (New file).
-	* gm2-compiler/P2SymBuild.mod: (New file).
-	* gm2-compiler/P3Build.bnf: (New file).
-	* gm2-compiler/P3Build.def: (New file).
-	* gm2-compiler/P3SymBuild.def: (New file).
-	* gm2-compiler/P3SymBuild.mod: (New file).
-	* gm2-compiler/PCBuild.bnf: (New file).
-	* gm2-compiler/PCBuild.def: (New file).
-	* gm2-compiler/PCSymBuild.def: (New file).
-	* gm2-compiler/PCSymBuild.mod: (New file).
-	* gm2-compiler/PHBuild.bnf: (New file).
-	* gm2-compiler/PHBuild.def: (New file).
-	* gm2-compiler/README: (New file).
-	* gm2-compiler/Sets.def: (New file).
-	* gm2-compiler/Sets.mod: (New file).
-	* gm2-compiler/SymbolConversion.def: (New file).
-	* gm2-compiler/SymbolConversion.mod: (New file).
-	* gm2-compiler/SymbolKey.def: (New file).
-	* gm2-compiler/SymbolKey.mod: (New file).
-	* gm2-compiler/SymbolTable.def: (New file).
-	* gm2-compiler/SymbolTable.mod: (New file).
-	* gm2-compiler/bnflex.def: (New file).
-	* gm2-compiler/bnflex.mod: (New file).
-	* gm2-compiler/cflex.def: (New file).
-	* gm2-compiler/gm2.mod: (New file).
-	* gm2-compiler/gm2lcc.mod: (New file).
-	* gm2-compiler/gm2lgen.mod: (New file).
-	* gm2-compiler/gm2lorder.mod: (New file).
-	* gm2-compiler/m2flex.def: (New file).
-	* gm2-compiler/ppg.mod: (New file).
-	* gm2-gcc/README: (New file).
-	* gm2-gcc/dynamicstrings.h: (New file).
-	* gm2-gcc/gcc-consolidation.h: (New file).
-	* gm2-gcc/init.cc: (New file).
-	* gm2-gcc/init.def: (New file).
-	* gm2-gcc/init.h: (New file).
-	* gm2-gcc/m2assert.cc: (New file).
-	* gm2-gcc/m2assert.h: (New file).
-	* gm2-gcc/m2block.cc: (New file).
-	* gm2-gcc/m2block.def: (New file).
-	* gm2-gcc/m2block.h: (New file).
-	* gm2-gcc/m2builtins.cc: (New file).
-	* gm2-gcc/m2builtins.def: (New file).
-	* gm2-gcc/m2builtins.h: (New file).
-	* gm2-gcc/m2color.cc: (New file).
-	* gm2-gcc/m2color.def: (New file).
-	* gm2-gcc/m2color.h: (New file).
-	* gm2-gcc/m2configure.cc: (New file).
-	* gm2-gcc/m2configure.def: (New file).
-	* gm2-gcc/m2configure.h: (New file).
-	* gm2-gcc/m2convert.cc: (New file).
-	* gm2-gcc/m2convert.def: (New file).
-	* gm2-gcc/m2convert.h: (New file).
-	* gm2-gcc/m2decl.cc: (New file).
-	* gm2-gcc/m2decl.def: (New file).
-	* gm2-gcc/m2decl.h: (New file).
-	* gm2-gcc/m2except.cc: (New file).
-	* gm2-gcc/m2except.def: (New file).
-	* gm2-gcc/m2except.h: (New file).
-	* gm2-gcc/m2expr.cc: (New file).
-	* gm2-gcc/m2expr.def: (New file).
-	* gm2-gcc/m2expr.h: (New file).
-	* gm2-gcc/m2linemap.cc: (New file).
-	* gm2-gcc/m2linemap.def: (New file).
-	* gm2-gcc/m2linemap.h: (New file).
-	* gm2-gcc/m2misc.cc: (New file).
-	* gm2-gcc/m2misc.def: (New file).
-	* gm2-gcc/m2misc.h: (New file).
-	* gm2-gcc/m2options.h: (New file).
-	* gm2-gcc/m2range.h: (New file).
-	* gm2-gcc/m2search.h: (New file).
-	* gm2-gcc/m2statement.cc: (New file).
-	* gm2-gcc/m2statement.def: (New file).
-	* gm2-gcc/m2statement.h: (New file).
-	* gm2-gcc/m2top.cc: (New file).
-	* gm2-gcc/m2top.def: (New file).
-	* gm2-gcc/m2top.h: (New file).
-	* gm2-gcc/m2tree.cc: (New file).
-	* gm2-gcc/m2tree.def: (New file).
-	* gm2-gcc/m2tree.h: (New file).
-	* gm2-gcc/m2treelib.cc: (New file).
-	* gm2-gcc/m2treelib.def: (New file).
-	* gm2-gcc/m2treelib.h: (New file).
-	* gm2-gcc/m2type.cc: (New file).
-	* gm2-gcc/m2type.def: (New file).
-	* gm2-gcc/m2type.h: (New file).
-	* gm2-gcc/rtegraph.cc: (New file).
-	* gm2-gcc/rtegraph.h: (New file).
-	* gm2-ici/M2Emit.mod: (New file).
-	* gm2-ici/README: (New file).
-	* gm2-ici/m2linemap.c: (New file).
-	* gm2-internals.texi: (New file).
-	* gm2-lang.cc: (New file).
-	* gm2-lang.h: (New file).
-	* gm2-libiberty/README: (New file).
-	* gm2-libiberty/choosetemp.def: (New file).
-	* gm2-libiberty/pexecute.def: (New file).
-	* gm2-libs-ch/M2LINK.c: (New file).
-	* gm2-libs-ch/README: (New file).
-	* gm2-libs-ch/RTcodummy.c: (New file).
-	* gm2-libs-ch/RTintdummy.c: (New file).
-	* gm2-libs-ch/Selective.c: (New file).
-	* gm2-libs-ch/SysExceptions.c: (New file).
-	* gm2-libs-ch/UnixArgs.cc: (New file).
-	* gm2-libs-ch/cgetopt.c: (New file).
-	* gm2-libs-ch/choosetemp.c: (New file).
-	* gm2-libs-ch/dtoa.cc: (New file).
-	* gm2-libs-ch/errno.c: (New file).
-	* gm2-libs-ch/host.c: (New file).
-	* gm2-libs-ch/ldtoa.cc: (New file).
-	* gm2-libs-ch/m2rts.h: (New file).
-	* gm2-libs-ch/termios.c: (New file).
-	* gm2-libs-ch/tools.c: (New file).
-	* gm2-libs-ch/wrapc.c: (New file).
-	* gm2-libs-ch/xlibc.c: (New file).
-	* gm2-libs-coroutines/Debug.def: (New file).
-	* gm2-libs-coroutines/Debug.mod: (New file).
-	* gm2-libs-coroutines/Executive.def: (New file).
-	* gm2-libs-coroutines/Executive.mod: (New file).
-	* gm2-libs-coroutines/KeyBoardLEDs.def: (New file).
-	* gm2-libs-coroutines/README.texi: (New file).
-	* gm2-libs-coroutines/SYSTEM.def: (New file).
-	* gm2-libs-coroutines/SYSTEM.mod: (New file).
-	* gm2-libs-coroutines/TimerHandler.def: (New file).
-	* gm2-libs-coroutines/TimerHandler.mod: (New file).
-	* gm2-libs-iso/COROUTINES.def: (New file).
-	* gm2-libs-iso/COROUTINES.mod: (New file).
-	* gm2-libs-iso/ChanConsts.def: (New file).
-	* gm2-libs-iso/ChanConsts.h: (New file).
-	* gm2-libs-iso/ChanConsts.mod: (New file).
-	* gm2-libs-iso/CharClass.def: (New file).
-	* gm2-libs-iso/CharClass.mod: (New file).
-	* gm2-libs-iso/ClientSocket.def: (New file).
-	* gm2-libs-iso/ClientSocket.mod: (New file).
-	* gm2-libs-iso/ComplexMath.def: (New file).
-	* gm2-libs-iso/ComplexMath.mod: (New file).
-	* gm2-libs-iso/ConvStringLong.def: (New file).
-	* gm2-libs-iso/ConvStringLong.mod: (New file).
-	* gm2-libs-iso/ConvStringReal.def: (New file).
-	* gm2-libs-iso/ConvStringReal.mod: (New file).
-	* gm2-libs-iso/ConvTypes.def: (New file).
-	* gm2-libs-iso/ConvTypes.mod: (New file).
-	* gm2-libs-iso/EXCEPTIONS.def: (New file).
-	* gm2-libs-iso/EXCEPTIONS.mod: (New file).
-	* gm2-libs-iso/ErrnoCategory.def: (New file).
-	* gm2-libs-iso/GeneralUserExceptions.def: (New file).
-	* gm2-libs-iso/GeneralUserExceptions.mod: (New file).
-	* gm2-libs-iso/IOChan.def: (New file).
-	* gm2-libs-iso/IOChan.mod: (New file).
-	* gm2-libs-iso/IOConsts.def: (New file).
-	* gm2-libs-iso/IOConsts.mod: (New file).
-	* gm2-libs-iso/IOLink.def: (New file).
-	* gm2-libs-iso/IOLink.mod: (New file).
-	* gm2-libs-iso/IOResult.def: (New file).
-	* gm2-libs-iso/IOResult.mod: (New file).
-	* gm2-libs-iso/LongComplexMath.def: (New file).
-	* gm2-libs-iso/LongComplexMath.mod: (New file).
-	* gm2-libs-iso/LongConv.def: (New file).
-	* gm2-libs-iso/LongConv.mod: (New file).
-	* gm2-libs-iso/LongIO.def: (New file).
-	* gm2-libs-iso/LongIO.mod: (New file).
-	* gm2-libs-iso/LongMath.def: (New file).
-	* gm2-libs-iso/LongMath.mod: (New file).
-	* gm2-libs-iso/LongStr.def: (New file).
-	* gm2-libs-iso/LongStr.mod: (New file).
-	* gm2-libs-iso/LongWholeIO.def: (New file).
-	* gm2-libs-iso/LongWholeIO.mod: (New file).
-	* gm2-libs-iso/LowLong.def: (New file).
-	* gm2-libs-iso/LowLong.mod: (New file).
-	* gm2-libs-iso/LowReal.def: (New file).
-	* gm2-libs-iso/LowReal.mod: (New file).
-	* gm2-libs-iso/LowShort.def: (New file).
-	* gm2-libs-iso/LowShort.mod: (New file).
-	* gm2-libs-iso/M2EXCEPTION.def: (New file).
-	* gm2-libs-iso/M2EXCEPTION.mod: (New file).
-	* gm2-libs-iso/M2RTS.def: (New file).
-	* gm2-libs-iso/M2RTS.mod: (New file).
-	* gm2-libs-iso/MemStream.def: (New file).
-	* gm2-libs-iso/MemStream.mod: (New file).
-	* gm2-libs-iso/Preemptive.def: (New file).
-	* gm2-libs-iso/Preemptive.mod: (New file).
-	* gm2-libs-iso/Processes.def: (New file).
-	* gm2-libs-iso/Processes.mod: (New file).
-	* gm2-libs-iso/ProgramArgs.def: (New file).
-	* gm2-libs-iso/ProgramArgs.mod: (New file).
-	* gm2-libs-iso/README.texi: (New file).
-	* gm2-libs-iso/RTco.def: (New file).
-	* gm2-libs-iso/RTdata.def: (New file).
-	* gm2-libs-iso/RTdata.mod: (New file).
-	* gm2-libs-iso/RTentity.def: (New file).
-	* gm2-libs-iso/RTentity.mod: (New file).
-	* gm2-libs-iso/RTfio.def: (New file).
-	* gm2-libs-iso/RTfio.mod: (New file).
-	* gm2-libs-iso/RTgen.def: (New file).
-	* gm2-libs-iso/RTgen.mod: (New file).
-	* gm2-libs-iso/RTgenif.def: (New file).
-	* gm2-libs-iso/RTgenif.mod: (New file).
-	* gm2-libs-iso/RTio.def: (New file).
-	* gm2-libs-iso/RTio.mod: (New file).
-	* gm2-libs-iso/RandomNumber.def: (New file).
-	* gm2-libs-iso/RandomNumber.mod: (New file).
-	* gm2-libs-iso/RawIO.def: (New file).
-	* gm2-libs-iso/RawIO.mod: (New file).
-	* gm2-libs-iso/RealConv.def: (New file).
-	* gm2-libs-iso/RealConv.mod: (New file).
-	* gm2-libs-iso/RealIO.def: (New file).
-	* gm2-libs-iso/RealIO.mod: (New file).
-	* gm2-libs-iso/RealMath.def: (New file).
-	* gm2-libs-iso/RealMath.mod: (New file).
-	* gm2-libs-iso/RealStr.def: (New file).
-	* gm2-libs-iso/RealStr.mod: (New file).
-	* gm2-libs-iso/RndFile.def: (New file).
-	* gm2-libs-iso/RndFile.mod: (New file).
-	* gm2-libs-iso/SIOResult.def: (New file).
-	* gm2-libs-iso/SIOResult.mod: (New file).
-	* gm2-libs-iso/SLongIO.def: (New file).
-	* gm2-libs-iso/SLongIO.mod: (New file).
-	* gm2-libs-iso/SLongWholeIO.def: (New file).
-	* gm2-libs-iso/SLongWholeIO.mod: (New file).
-	* gm2-libs-iso/SRawIO.def: (New file).
-	* gm2-libs-iso/SRawIO.mod: (New file).
-	* gm2-libs-iso/SRealIO.def: (New file).
-	* gm2-libs-iso/SRealIO.mod: (New file).
-	* gm2-libs-iso/SShortIO.def: (New file).
-	* gm2-libs-iso/SShortIO.mod: (New file).
-	* gm2-libs-iso/SShortWholeIO.def: (New file).
-	* gm2-libs-iso/SShortWholeIO.mod: (New file).
-	* gm2-libs-iso/STextIO.def: (New file).
-	* gm2-libs-iso/STextIO.mod: (New file).
-	* gm2-libs-iso/SWholeIO.def: (New file).
-	* gm2-libs-iso/SWholeIO.mod: (New file).
-	* gm2-libs-iso/SYSTEM.def: (New file).
-	* gm2-libs-iso/SYSTEM.mod: (New file).
-	* gm2-libs-iso/Semaphores.def: (New file).
-	* gm2-libs-iso/Semaphores.mod: (New file).
-	* gm2-libs-iso/SeqFile.def: (New file).
-	* gm2-libs-iso/SeqFile.mod: (New file).
-	* gm2-libs-iso/ShortComplexMath.def: (New file).
-	* gm2-libs-iso/ShortComplexMath.mod: (New file).
-	* gm2-libs-iso/ShortIO.def: (New file).
-	* gm2-libs-iso/ShortIO.mod: (New file).
-	* gm2-libs-iso/ShortWholeIO.def: (New file).
-	* gm2-libs-iso/ShortWholeIO.mod: (New file).
-	* gm2-libs-iso/SimpleCipher.def: (New file).
-	* gm2-libs-iso/SimpleCipher.mod: (New file).
-	* gm2-libs-iso/StdChans.def: (New file).
-	* gm2-libs-iso/StdChans.mod: (New file).
-	* gm2-libs-iso/Storage.def: (New file).
-	* gm2-libs-iso/Storage.mod: (New file).
-	* gm2-libs-iso/StreamFile.def: (New file).
-	* gm2-libs-iso/StreamFile.mod: (New file).
-	* gm2-libs-iso/StringChan.def: (New file).
-	* gm2-libs-iso/StringChan.mod: (New file).
-	* gm2-libs-iso/Strings.def: (New file).
-	* gm2-libs-iso/Strings.mod: (New file).
-	* gm2-libs-iso/SysClock.def: (New file).
-	* gm2-libs-iso/SysClock.mod: (New file).
-	* gm2-libs-iso/TERMINATION.def: (New file).
-	* gm2-libs-iso/TERMINATION.mod: (New file).
-	* gm2-libs-iso/TermFile.def: (New file).
-	* gm2-libs-iso/TermFile.mod: (New file).
-	* gm2-libs-iso/TextIO.def: (New file).
-	* gm2-libs-iso/TextIO.mod: (New file).
-	* gm2-libs-iso/WholeConv.def: (New file).
-	* gm2-libs-iso/WholeConv.mod: (New file).
-	* gm2-libs-iso/WholeIO.def: (New file).
-	* gm2-libs-iso/WholeIO.mod: (New file).
-	* gm2-libs-iso/WholeStr.def: (New file).
-	* gm2-libs-iso/WholeStr.mod: (New file).
-	* gm2-libs-iso/wrapsock.c: (New file).
-	* gm2-libs-iso/wrapsock.def: (New file).
-	* gm2-libs-iso/wraptime.c: (New file).
-	* gm2-libs-iso/wraptime.def: (New file).
-	* gm2-libs-min/M2RTS.def: (New file).
-	* gm2-libs-min/M2RTS.mod: (New file).
-	* gm2-libs-min/SYSTEM.def: (New file).
-	* gm2-libs-min/SYSTEM.mod: (New file).
-	* gm2-libs-min/libc.c: (New file).
-	* gm2-libs-min/libc.def: (New file).
-	* gm2-libs-pim/BitBlockOps.def: (New file).
-	* gm2-libs-pim/BitBlockOps.mod: (New file).
-	* gm2-libs-pim/BitByteOps.def: (New file).
-	* gm2-libs-pim/BitByteOps.mod: (New file).
-	* gm2-libs-pim/BitWordOps.def: (New file).
-	* gm2-libs-pim/BitWordOps.mod: (New file).
-	* gm2-libs-pim/BlockOps.def: (New file).
-	* gm2-libs-pim/BlockOps.mod: (New file).
-	* gm2-libs-pim/Break.c: (New file).
-	* gm2-libs-pim/Break.def: (New file).
-	* gm2-libs-pim/CardinalIO.def: (New file).
-	* gm2-libs-pim/CardinalIO.mod: (New file).
-	* gm2-libs-pim/Conversions.def: (New file).
-	* gm2-libs-pim/Conversions.mod: (New file).
-	* gm2-libs-pim/DebugPMD.def: (New file).
-	* gm2-libs-pim/DebugPMD.mod: (New file).
-	* gm2-libs-pim/DebugTrace.def: (New file).
-	* gm2-libs-pim/DebugTrace.mod: (New file).
-	* gm2-libs-pim/Delay.def: (New file).
-	* gm2-libs-pim/Delay.mod: (New file).
-	* gm2-libs-pim/Display.def: (New file).
-	* gm2-libs-pim/Display.mod: (New file).
-	* gm2-libs-pim/ErrorCode.def: (New file).
-	* gm2-libs-pim/ErrorCode.mod: (New file).
-	* gm2-libs-pim/FileSystem.def: (New file).
-	* gm2-libs-pim/FileSystem.mod: (New file).
-	* gm2-libs-pim/FloatingUtilities.def: (New file).
-	* gm2-libs-pim/FloatingUtilities.mod: (New file).
-	* gm2-libs-pim/InOut.def: (New file).
-	* gm2-libs-pim/InOut.mod: (New file).
-	* gm2-libs-pim/Keyboard.def: (New file).
-	* gm2-libs-pim/Keyboard.mod: (New file).
-	* gm2-libs-pim/LongIO.def: (New file).
-	* gm2-libs-pim/LongIO.mod: (New file).
-	* gm2-libs-pim/NumberConversion.def: (New file).
-	* gm2-libs-pim/NumberConversion.mod: (New file).
-	* gm2-libs-pim/README.texi: (New file).
-	* gm2-libs-pim/Random.def: (New file).
-	* gm2-libs-pim/Random.mod: (New file).
-	* gm2-libs-pim/RealConversions.def: (New file).
-	* gm2-libs-pim/RealConversions.mod: (New file).
-	* gm2-libs-pim/RealInOut.def: (New file).
-	* gm2-libs-pim/RealInOut.mod: (New file).
-	* gm2-libs-pim/Strings.def: (New file).
-	* gm2-libs-pim/Strings.mod: (New file).
-	* gm2-libs-pim/Termbase.def: (New file).
-	* gm2-libs-pim/Termbase.mod: (New file).
-	* gm2-libs-pim/Terminal.def: (New file).
-	* gm2-libs-pim/Terminal.mod: (New file).
-	* gm2-libs-pim/TimeDate.def: (New file).
-	* gm2-libs-pim/TimeDate.mod: (New file).
-	* gm2-libs/ASCII.def: (New file).
-	* gm2-libs/ASCII.mod: (New file).
-	* gm2-libs/Args.def: (New file).
-	* gm2-libs/Args.mod: (New file).
-	* gm2-libs/Assertion.def: (New file).
-	* gm2-libs/Assertion.mod: (New file).
-	* gm2-libs/Break.def: (New file).
-	* gm2-libs/Break.mod: (New file).
-	* gm2-libs/Builtins.def: (New file).
-	* gm2-libs/Builtins.mod: (New file).
-	* gm2-libs/COROUTINES.def: (New file).
-	* gm2-libs/COROUTINES.mod: (New file).
-	* gm2-libs/CmdArgs.def: (New file).
-	* gm2-libs/CmdArgs.mod: (New file).
-	* gm2-libs/Debug.def: (New file).
-	* gm2-libs/Debug.mod: (New file).
-	* gm2-libs/DynamicStrings.def: (New file).
-	* gm2-libs/DynamicStrings.mod: (New file).
-	* gm2-libs/Environment.def: (New file).
-	* gm2-libs/Environment.mod: (New file).
-	* gm2-libs/FIO.def: (New file).
-	* gm2-libs/FIO.mod: (New file).
-	* gm2-libs/FormatStrings.def: (New file).
-	* gm2-libs/FormatStrings.mod: (New file).
-	* gm2-libs/FpuIO.def: (New file).
-	* gm2-libs/FpuIO.mod: (New file).
-	* gm2-libs/GetOpt.def: (New file).
-	* gm2-libs/GetOpt.mod: (New file).
-	* gm2-libs/IO.def: (New file).
-	* gm2-libs/IO.mod: (New file).
-	* gm2-libs/Indexing.def: (New file).
-	* gm2-libs/Indexing.mod: (New file).
-	* gm2-libs/LMathLib0.def: (New file).
-	* gm2-libs/LMathLib0.mod: (New file).
-	* gm2-libs/LegacyReal.def: (New file).
-	* gm2-libs/LegacyReal.mod: (New file).
-	* gm2-libs/M2Dependent.def: (New file).
-	* gm2-libs/M2Dependent.mod: (New file).
-	* gm2-libs/M2EXCEPTION.def: (New file).
-	* gm2-libs/M2EXCEPTION.mod: (New file).
-	* gm2-libs/M2LINK.def: (New file).
-	* gm2-libs/M2RTS.def: (New file).
-	* gm2-libs/M2RTS.mod: (New file).
-	* gm2-libs/MathLib0.def: (New file).
-	* gm2-libs/MathLib0.mod: (New file).
-	* gm2-libs/MemUtils.def: (New file).
-	* gm2-libs/MemUtils.mod: (New file).
-	* gm2-libs/NumberIO.def: (New file).
-	* gm2-libs/NumberIO.mod: (New file).
-	* gm2-libs/OptLib.def: (New file).
-	* gm2-libs/OptLib.mod: (New file).
-	* gm2-libs/PushBackInput.def: (New file).
-	* gm2-libs/PushBackInput.mod: (New file).
-	* gm2-libs/README.texi: (New file).
-	* gm2-libs/RTExceptions.def: (New file).
-	* gm2-libs/RTExceptions.mod: (New file).
-	* gm2-libs/RTint.def: (New file).
-	* gm2-libs/RTint.mod: (New file).
-	* gm2-libs/SArgs.def: (New file).
-	* gm2-libs/SArgs.mod: (New file).
-	* gm2-libs/SCmdArgs.def: (New file).
-	* gm2-libs/SCmdArgs.mod: (New file).
-	* gm2-libs/SEnvironment.def: (New file).
-	* gm2-libs/SEnvironment.mod: (New file).
-	* gm2-libs/SFIO.def: (New file).
-	* gm2-libs/SFIO.mod: (New file).
-	* gm2-libs/SMathLib0.def: (New file).
-	* gm2-libs/SMathLib0.mod: (New file).
-	* gm2-libs/SYSTEM.def: (New file).
-	* gm2-libs/SYSTEM.mod: (New file).
-	* gm2-libs/Scan.def: (New file).
-	* gm2-libs/Scan.mod: (New file).
-	* gm2-libs/Selective.def: (New file).
-	* gm2-libs/StdIO.def: (New file).
-	* gm2-libs/StdIO.mod: (New file).
-	* gm2-libs/Storage.def: (New file).
-	* gm2-libs/Storage.mod: (New file).
-	* gm2-libs/StrCase.def: (New file).
-	* gm2-libs/StrCase.mod: (New file).
-	* gm2-libs/StrIO.def: (New file).
-	* gm2-libs/StrIO.mod: (New file).
-	* gm2-libs/StrLib.def: (New file).
-	* gm2-libs/StrLib.mod: (New file).
-	* gm2-libs/StringConvert.def: (New file).
-	* gm2-libs/StringConvert.mod: (New file).
-	* gm2-libs/SysExceptions.def: (New file).
-	* gm2-libs/SysStorage.def: (New file).
-	* gm2-libs/SysStorage.mod: (New file).
-	* gm2-libs/TimeString.def: (New file).
-	* gm2-libs/TimeString.mod: (New file).
-	* gm2-libs/UnixArgs.def: (New file).
-	* gm2-libs/cbuiltin.def: (New file).
-	* gm2-libs/cgetopt.def: (New file).
-	* gm2-libs/config-host: (New file).
-	* gm2-libs/config-host.in: (New file).
-	* gm2-libs/cxxabi.def: (New file).
-	* gm2-libs/dtoa.def: (New file).
-	* gm2-libs/errno.def: (New file).
-	* gm2-libs/gdbif.def: (New file).
-	* gm2-libs/gdbif.mod: (New file).
-	* gm2-libs/gm2-libs-host.h.in: (New file).
-	* gm2-libs/ldtoa.def: (New file).
-	* gm2-libs/libc.def: (New file).
-	* gm2-libs/libm.def: (New file).
-	* gm2-libs/sckt.def: (New file).
-	* gm2-libs/termios.def: (New file).
-	* gm2-libs/wrapc.def: (New file).
-	* gm2config.h.in: (New file).
-	* gm2spec.cc: (New file).
-	* gm2version.h: (New file).
-	* init/README: (New file).
-	* init/mcinit: (New file).
-	* init/ppginit: (New file).
-	* lang-specs.h: (New file).
-	* lang.opt: (New file).
-	* m2-tree.def: (New file).
-	* m2-tree.h: (New file).
-	* m2.flex: (New file).
-	* m2pp.cc: (New file).
-	* m2pp.h: (New file).
-	* mc-boot-ch/GBuiltins.c: (New file).
-	* mc-boot-ch/GM2LINK.c: (New file).
-	* mc-boot-ch/GRTco.c: (New file).
-	* mc-boot-ch/GSYSTEM.c: (New file).
-	* mc-boot-ch/GSelective.c: (New file).
-	* mc-boot-ch/GSysExceptions.c: (New file).
-	* mc-boot-ch/GUnixArgs.cc: (New file).
-	* mc-boot-ch/Gabort.c: (New file).
-	* mc-boot-ch/Gcbuiltin.c: (New file).
-	* mc-boot-ch/Gdtoa.c: (New file).
-	* mc-boot-ch/Gerrno.c: (New file).
-	* mc-boot-ch/Gldtoa.c: (New file).
-	* mc-boot-ch/Glibc.c: (New file).
-	* mc-boot-ch/Glibm.c: (New file).
-	* mc-boot-ch/Gmcrts.c: (New file).
-	* mc-boot-ch/Gmcrts.h: (New file).
-	* mc-boot-ch/Gnetwork.h: (New file).
-	* mc-boot-ch/Gtermios.cc: (New file).
-	* mc-boot-ch/Gwrapc.c: (New file).
-	* mc-boot-ch/README: (New file).
-	* mc-boot-ch/m2rts.h: (New file).
-	* mc-boot-ch/network.c: (New file).
-	* mc-boot/GASCII.c: (New file).
-	* mc-boot/GASCII.h: (New file).
-	* mc-boot/GArgs.c: (New file).
-	* mc-boot/GArgs.h: (New file).
-	* mc-boot/GAssertion.c: (New file).
-	* mc-boot/GAssertion.h: (New file).
-	* mc-boot/GBreak.c: (New file).
-	* mc-boot/GBreak.h: (New file).
-	* mc-boot/GCOROUTINES.h: (New file).
-	* mc-boot/GCmdArgs.c: (New file).
-	* mc-boot/GCmdArgs.h: (New file).
-	* mc-boot/GDebug.c: (New file).
-	* mc-boot/GDebug.h: (New file).
-	* mc-boot/GDynamicStrings.c: (New file).
-	* mc-boot/GDynamicStrings.h: (New file).
-	* mc-boot/GEnvironment.c: (New file).
-	* mc-boot/GEnvironment.h: (New file).
-	* mc-boot/GFIO.c: (New file).
-	* mc-boot/GFIO.h: (New file).
-	* mc-boot/GFormatStrings.c: (New file).
-	* mc-boot/GFormatStrings.h: (New file).
-	* mc-boot/GFpuIO.c: (New file).
-	* mc-boot/GFpuIO.h: (New file).
-	* mc-boot/GIO.c: (New file).
-	* mc-boot/GIO.h: (New file).
-	* mc-boot/GIndexing.c: (New file).
-	* mc-boot/GIndexing.h: (New file).
-	* mc-boot/GM2Dependent.c: (New file).
-	* mc-boot/GM2Dependent.h: (New file).
-	* mc-boot/GM2EXCEPTION.c: (New file).
-	* mc-boot/GM2EXCEPTION.h: (New file).
-	* mc-boot/GM2LINK.h: (New file).
-	* mc-boot/GM2RTS.c: (New file).
-	* mc-boot/GM2RTS.h: (New file).
-	* mc-boot/GMemUtils.c: (New file).
-	* mc-boot/GMemUtils.h: (New file).
-	* mc-boot/GNumberIO.c: (New file).
-	* mc-boot/GNumberIO.h: (New file).
-	* mc-boot/GPushBackInput.c: (New file).
-	* mc-boot/GPushBackInput.h: (New file).
-	* mc-boot/GRTExceptions.c: (New file).
-	* mc-boot/GRTExceptions.h: (New file).
-	* mc-boot/GRTco.h: (New file).
-	* mc-boot/GRTint.c: (New file).
-	* mc-boot/GRTint.h: (New file).
-	* mc-boot/GSArgs.c: (New file).
-	* mc-boot/GSArgs.h: (New file).
-	* mc-boot/GSFIO.c: (New file).
-	* mc-boot/GSFIO.h: (New file).
-	* mc-boot/GSYSTEM.h: (New file).
-	* mc-boot/GSelective.h: (New file).
-	* mc-boot/GStdIO.c: (New file).
-	* mc-boot/GStdIO.h: (New file).
-	* mc-boot/GStorage.c: (New file).
-	* mc-boot/GStorage.h: (New file).
-	* mc-boot/GStrCase.c: (New file).
-	* mc-boot/GStrCase.h: (New file).
-	* mc-boot/GStrIO.c: (New file).
-	* mc-boot/GStrIO.h: (New file).
-	* mc-boot/GStrLib.c: (New file).
-	* mc-boot/GStrLib.h: (New file).
-	* mc-boot/GStringConvert.c: (New file).
-	* mc-boot/GStringConvert.h: (New file).
-	* mc-boot/GSysExceptions.h: (New file).
-	* mc-boot/GSysStorage.c: (New file).
-	* mc-boot/GSysStorage.h: (New file).
-	* mc-boot/GTimeString.c: (New file).
-	* mc-boot/GTimeString.h: (New file).
-	* mc-boot/GUnixArgs.h: (New file).
-	* mc-boot/Galists.c: (New file).
-	* mc-boot/Galists.h: (New file).
-	* mc-boot/Gdecl.c: (New file).
-	* mc-boot/Gdecl.h: (New file).
-	* mc-boot/Gdtoa.h: (New file).
-	* mc-boot/Gerrno.h: (New file).
-	* mc-boot/Gkeyc.c: (New file).
-	* mc-boot/Gkeyc.h: (New file).
-	* mc-boot/Gldtoa.h: (New file).
-	* mc-boot/Glibc.h: (New file).
-	* mc-boot/Glibm.h: (New file).
-	* mc-boot/Glists.c: (New file).
-	* mc-boot/Glists.h: (New file).
-	* mc-boot/GmcComment.c: (New file).
-	* mc-boot/GmcComment.h: (New file).
-	* mc-boot/GmcComp.c: (New file).
-	* mc-boot/GmcComp.h: (New file).
-	* mc-boot/GmcDebug.c: (New file).
-	* mc-boot/GmcDebug.h: (New file).
-	* mc-boot/GmcError.c: (New file).
-	* mc-boot/GmcError.h: (New file).
-	* mc-boot/GmcFileName.c: (New file).
-	* mc-boot/GmcFileName.h: (New file).
-	* mc-boot/GmcLexBuf.c: (New file).
-	* mc-boot/GmcLexBuf.h: (New file).
-	* mc-boot/GmcMetaError.c: (New file).
-	* mc-boot/GmcMetaError.h: (New file).
-	* mc-boot/GmcOptions.c: (New file).
-	* mc-boot/GmcOptions.h: (New file).
-	* mc-boot/GmcPreprocess.c: (New file).
-	* mc-boot/GmcPreprocess.h: (New file).
-	* mc-boot/GmcPretty.c: (New file).
-	* mc-boot/GmcPretty.h: (New file).
-	* mc-boot/GmcPrintf.c: (New file).
-	* mc-boot/GmcPrintf.h: (New file).
-	* mc-boot/GmcQuiet.c: (New file).
-	* mc-boot/GmcQuiet.h: (New file).
-	* mc-boot/GmcReserved.c: (New file).
-	* mc-boot/GmcReserved.h: (New file).
-	* mc-boot/GmcSearch.c: (New file).
-	* mc-boot/GmcSearch.h: (New file).
-	* mc-boot/GmcStack.c: (New file).
-	* mc-boot/GmcStack.h: (New file).
-	* mc-boot/GmcStream.c: (New file).
-	* mc-boot/GmcStream.h: (New file).
-	* mc-boot/Gmcflex.h: (New file).
-	* mc-boot/Gmcp1.c: (New file).
-	* mc-boot/Gmcp1.h: (New file).
-	* mc-boot/Gmcp2.c: (New file).
-	* mc-boot/Gmcp2.h: (New file).
-	* mc-boot/Gmcp3.c: (New file).
-	* mc-boot/Gmcp3.h: (New file).
-	* mc-boot/Gmcp4.c: (New file).
-	* mc-boot/Gmcp4.h: (New file).
-	* mc-boot/Gmcp5.c: (New file).
-	* mc-boot/Gmcp5.h: (New file).
-	* mc-boot/GnameKey.c: (New file).
-	* mc-boot/GnameKey.h: (New file).
-	* mc-boot/Gpth.h: (New file).
-	* mc-boot/GsymbolKey.c: (New file).
-	* mc-boot/GsymbolKey.h: (New file).
-	* mc-boot/Gtermios.h: (New file).
-	* mc-boot/Gtop.c: (New file).
-	* mc-boot/Gvarargs.c: (New file).
-	* mc-boot/Gvarargs.h: (New file).
-	* mc-boot/Gwlists.c: (New file).
-	* mc-boot/Gwlists.h: (New file).
-	* mc-boot/Gwrapc.h: (New file).
-	* mc-boot/README: (New file).
-	* mc/Indexing.def: (New file).
-	* mc/Indexing.mod: (New file).
-	* mc/README: (New file).
-	* mc/alists.def: (New file).
-	* mc/alists.mod: (New file).
-	* mc/decl.def: (New file).
-	* mc/decl.mod: (New file).
-	* mc/decl.mod-extra: (New file).
-	* mc/keyc.def: (New file).
-	* mc/keyc.mod: (New file).
-	* mc/lists.def: (New file).
-	* mc/lists.mod: (New file).
-	* mc/m2flex.def: (New file).
-	* mc/mc.flex: (New file).
-	* mc/mcComment.def: (New file).
-	* mc/mcComment.h: (New file).
-	* mc/mcComment.mod: (New file).
-	* mc/mcComp.def: (New file).
-	* mc/mcComp.mod: (New file).
-	* mc/mcDebug.def: (New file).
-	* mc/mcDebug.mod: (New file).
-	* mc/mcError.def: (New file).
-	* mc/mcError.mod: (New file).
-	* mc/mcFileName.def: (New file).
-	* mc/mcFileName.mod: (New file).
-	* mc/mcLexBuf.def: (New file).
-	* mc/mcLexBuf.h: (New file).
-	* mc/mcLexBuf.mod: (New file).
-	* mc/mcMetaError.def: (New file).
-	* mc/mcMetaError.mod: (New file).
-	* mc/mcOptions.def: (New file).
-	* mc/mcOptions.mod: (New file).
-	* mc/mcPreprocess.def: (New file).
-	* mc/mcPreprocess.mod: (New file).
-	* mc/mcPretty.def: (New file).
-	* mc/mcPretty.mod: (New file).
-	* mc/mcPrintf.def: (New file).
-	* mc/mcPrintf.mod: (New file).
-	* mc/mcQuiet.def: (New file).
-	* mc/mcQuiet.mod: (New file).
-	* mc/mcReserved.def: (New file).
-	* mc/mcReserved.h: (New file).
-	* mc/mcReserved.mod: (New file).
-	* mc/mcSearch.def: (New file).
-	* mc/mcSearch.mod: (New file).
-	* mc/mcStack.def: (New file).
-	* mc/mcStack.mod: (New file).
-	* mc/mcStream.def: (New file).
-	* mc/mcStream.mod: (New file).
-	* mc/mcflex.def: (New file).
-	* mc/mcp1.bnf: (New file).
-	* mc/mcp1.def: (New file).
-	* mc/mcp2.bnf: (New file).
-	* mc/mcp2.def: (New file).
-	* mc/mcp3.bnf: (New file).
-	* mc/mcp3.def: (New file).
-	* mc/mcp4.bnf: (New file).
-	* mc/mcp4.def: (New file).
-	* mc/mcp5.bnf: (New file).
-	* mc/mcp5.def: (New file).
-	* mc/nameKey.def: (New file).
-	* mc/nameKey.mod: (New file).
-	* mc/symbolKey.def: (New file).
-	* mc/symbolKey.mod: (New file).
-	* mc/top.mod: (New file).
-	* mc/varargs.def: (New file).
-	* mc/varargs.mod: (New file).
-	* mc/wlists.def: (New file).
-	* mc/wlists.mod: (New file).
-	* pge-boot/GASCII.c: (New file).
-	* pge-boot/GASCII.h: (New file).
-	* pge-boot/GArgs.c: (New file).
-	* pge-boot/GArgs.h: (New file).
-	* pge-boot/GAssertion.c: (New file).
-	* pge-boot/GAssertion.h: (New file).
-	* pge-boot/GBreak.h: (New file).
-	* pge-boot/GBuiltins.c: (New file).
-	* pge-boot/GCmdArgs.h: (New file).
-	* pge-boot/GDebug.c: (New file).
-	* pge-boot/GDebug.h: (New file).
-	* pge-boot/GDynamicStrings.c: (New file).
-	* pge-boot/GDynamicStrings.h: (New file).
-	* pge-boot/GEnvironment.h: (New file).
-	* pge-boot/GFIO.c: (New file).
-	* pge-boot/GFIO.h: (New file).
-	* pge-boot/GFormatStrings.h: (New file).
-	* pge-boot/GFpuIO.h: (New file).
-	* pge-boot/GIO.c: (New file).
-	* pge-boot/GIO.h: (New file).
-	* pge-boot/GIndexing.c: (New file).
-	* pge-boot/GIndexing.h: (New file).
-	* pge-boot/GLists.c: (New file).
-	* pge-boot/GLists.h: (New file).
-	* pge-boot/GM2Dependent.c: (New file).
-	* pge-boot/GM2Dependent.h: (New file).
-	* pge-boot/GM2EXCEPTION.c: (New file).
-	* pge-boot/GM2EXCEPTION.h: (New file).
-	* pge-boot/GM2LINK.c: (New file).
-	* pge-boot/GM2LINK.h: (New file).
-	* pge-boot/GM2RTS.c: (New file).
-	* pge-boot/GM2RTS.h: (New file).
-	* pge-boot/GNameKey.c: (New file).
-	* pge-boot/GNameKey.h: (New file).
-	* pge-boot/GNumberIO.c: (New file).
-	* pge-boot/GNumberIO.h: (New file).
-	* pge-boot/GOutput.c: (New file).
-	* pge-boot/GOutput.h: (New file).
-	* pge-boot/GPushBackInput.c: (New file).
-	* pge-boot/GPushBackInput.h: (New file).
-	* pge-boot/GRTExceptions.c: (New file).
-	* pge-boot/GRTExceptions.h: (New file).
-	* pge-boot/GRTco.c: (New file).
-	* pge-boot/GSArgs.h: (New file).
-	* pge-boot/GSEnvironment.h: (New file).
-	* pge-boot/GSFIO.c: (New file).
-	* pge-boot/GSFIO.h: (New file).
-	* pge-boot/GSYSTEM.c: (New file).
-	* pge-boot/GSYSTEM.h: (New file).
-	* pge-boot/GScan.h: (New file).
-	* pge-boot/GSelective.c: (New file).
-	* pge-boot/GStdIO.c: (New file).
-	* pge-boot/GStdIO.h: (New file).
-	* pge-boot/GStorage.c: (New file).
-	* pge-boot/GStorage.h: (New file).
-	* pge-boot/GStrCase.c: (New file).
-	* pge-boot/GStrCase.h: (New file).
-	* pge-boot/GStrIO.c: (New file).
-	* pge-boot/GStrIO.h: (New file).
-	* pge-boot/GStrLib.c: (New file).
-	* pge-boot/GStrLib.h: (New file).
-	* pge-boot/GStringConvert.h: (New file).
-	* pge-boot/GSymbolKey.c: (New file).
-	* pge-boot/GSymbolKey.h: (New file).
-	* pge-boot/GSysExceptions.c: (New file).
-	* pge-boot/GSysExceptions.h: (New file).
-	* pge-boot/GSysStorage.c: (New file).
-	* pge-boot/GSysStorage.h: (New file).
-	* pge-boot/GTimeString.h: (New file).
-	* pge-boot/GUnixArgs.cc: (New file).
-	* pge-boot/GUnixArgs.h: (New file).
-	* pge-boot/Gabort.c: (New file).
-	* pge-boot/Gbnflex.c: (New file).
-	* pge-boot/Gbnflex.h: (New file).
-	* pge-boot/Gcbuiltin.c: (New file).
-	* pge-boot/Gdtoa.c: (New file).
-	* pge-boot/Gdtoa.h: (New file).
-	* pge-boot/Gerrno.c: (New file).
-	* pge-boot/Gerrno.h: (New file).
-	* pge-boot/Gldtoa.c: (New file).
-	* pge-boot/Gldtoa.h: (New file).
-	* pge-boot/Glibc.c: (New file).
-	* pge-boot/Glibc.h: (New file).
-	* pge-boot/Glibm.c: (New file).
-	* pge-boot/Glibm.h: (New file).
-	* pge-boot/Gmcrts.c: (New file).
-	* pge-boot/Gmcrts.h: (New file).
-	* pge-boot/Gnetwork.h: (New file).
-	* pge-boot/Gpge.c: (New file).
-	* pge-boot/Gtermios.cc: (New file).
-	* pge-boot/Gtermios.h: (New file).
-	* pge-boot/Gwrapc.c: (New file).
-	* pge-boot/Gwrapc.h: (New file).
-	* pge-boot/README: (New file).
-	* pge-boot/m2rts.h: (New file).
-	* pge-boot/main.c: (New file).
-	* pge-boot/network.c: (New file).
-	* plugin/README: (New file).
-	* plugin/m2rte.cc: (New file).
-	* tools-src/README: (New file).
-	* tools-src/boilerplate.py: (New file).
-	* tools-src/buildpg: (New file).
-	* tools-src/calcpath: (New file).
-	* tools-src/def2doc.py: (New file).
-	* tools-src/makeSystem: (New file).
-	* tools-src/mklink.c: (New file).
-	* tools-src/tidydates.py: (New file).
-	* images/LICENSE.IMG: (New file).
-	* images/gnupng: (New file).
-	* images/gnu.eps: (New file).
-	* version.c: (New file).
-	* configure: (Rebuilt).
+	* COPYING.FDL: New file.
+	* COPYING.RUNTIME: New file.
+	* COPYING3: New file.
+	* COPYING3.LIB: New file.
+	* Make-lang.in: New file.
+	* Make-maintainer.in: New file.
+	* NEWS: New file.
+	* README: New file.
+	* config-lang.in: New file.
+	* config-make.in: New file.
+	* configure.ac: New file.
+	* gm2-compiler/CLexBuf.def: New file.
+	* gm2-compiler/CLexBuf.mod: New file.
+	* gm2-compiler/FifoQueue.def: New file.
+	* gm2-compiler/FifoQueue.mod: New file.
+	* gm2-compiler/Lists.def: New file.
+	* gm2-compiler/Lists.mod: New file.
+	* gm2-compiler/M2ALU.def: New file.
+	* gm2-compiler/M2ALU.mod: New file.
+	* gm2-compiler/M2AsmUtil.def: New file.
+	* gm2-compiler/M2AsmUtil.mod: New file.
+	* gm2-compiler/M2Base.def: New file.
+	* gm2-compiler/M2Base.mod: New file.
+	* gm2-compiler/M2BasicBlock.def: New file.
+	* gm2-compiler/M2BasicBlock.mod: New file.
+	* gm2-compiler/M2Batch.def: New file.
+	* gm2-compiler/M2Batch.mod: New file.
+	* gm2-compiler/M2Bitset.def: New file.
+	* gm2-compiler/M2Bitset.mod: New file.
+	* gm2-compiler/M2CaseList.def: New file.
+	* gm2-compiler/M2CaseList.mod: New file.
+	* gm2-compiler/M2Check.def: New file.
+	* gm2-compiler/M2Check.mod: New file.
+	* gm2-compiler/M2Code.def: New file.
+	* gm2-compiler/M2Code.mod: New file.
+	* gm2-compiler/M2ColorString.def: New file.
+	* gm2-compiler/M2ColorString.mod: New file.
+	* gm2-compiler/M2Comp.def: New file.
+	* gm2-compiler/M2Comp.mod: New file.
+	* gm2-compiler/M2Const.def: New file.
+	* gm2-compiler/M2Const.mod: New file.
+	* gm2-compiler/M2Debug.def: New file.
+	* gm2-compiler/M2Debug.mod: New file.
+	* gm2-compiler/M2DebugStack.def: New file.
+	* gm2-compiler/M2DebugStack.mod: New file.
+	* gm2-compiler/M2Defaults.def: New file.
+	* gm2-compiler/M2Defaults.mod: New file.
+	* gm2-compiler/M2DriverOptions.def: New file.
+	* gm2-compiler/M2DriverOptions.mod: New file.
+	* gm2-compiler/M2Emit.def: New file.
+	* gm2-compiler/M2Emit.mod: New file.
+	* gm2-compiler/M2Error.def: New file.
+	* gm2-compiler/M2Error.mod: New file.
+	* gm2-compiler/M2EvalSym.def: New file.
+	* gm2-compiler/M2FileName.def: New file.
+	* gm2-compiler/M2FileName.mod: New file.
+	* gm2-compiler/M2GCCDeclare.def: New file.
+	* gm2-compiler/M2GCCDeclare.mod: New file.
+	* gm2-compiler/M2GenGCC.def: New file.
+	* gm2-compiler/M2GenGCC.mod: New file.
+	* gm2-compiler/M2Graph.def: New file.
+	* gm2-compiler/M2Graph.mod: New file.
+	* gm2-compiler/M2Lex.def: New file.
+	* gm2-compiler/M2Lex.mod: New file.
+	* gm2-compiler/M2LexBuf.def: New file.
+	* gm2-compiler/M2LexBuf.mod: New file.
+	* gm2-compiler/M2MetaError.def: New file.
+	* gm2-compiler/M2MetaError.mod: New file.
+	* gm2-compiler/M2Optimize.def: New file.
+	* gm2-compiler/M2Optimize.mod: New file.
+	* gm2-compiler/M2Options.def: New file.
+	* gm2-compiler/M2Options.mod: New file.
+	* gm2-compiler/M2Pass.def: New file.
+	* gm2-compiler/M2Pass.mod: New file.
+	* gm2-compiler/M2Preprocess.def: New file.
+	* gm2-compiler/M2Preprocess.mod: New file.
+	* gm2-compiler/M2Printf.def: New file.
+	* gm2-compiler/M2Printf.mod: New file.
+	* gm2-compiler/M2Quads.def: New file.
+	* gm2-compiler/M2Quads.mod: New file.
+	* gm2-compiler/M2Quiet.def: New file.
+	* gm2-compiler/M2Quiet.mod: New file.
+	* gm2-compiler/M2Range.def: New file.
+	* gm2-compiler/M2Range.mod: New file.
+	* gm2-compiler/M2Reserved.def: New file.
+	* gm2-compiler/M2Reserved.mod: New file.
+	* gm2-compiler/M2SSA.def: New file.
+	* gm2-compiler/M2SSA.mod: New file.
+	* gm2-compiler/M2Scaffold.def: New file.
+	* gm2-compiler/M2Scaffold.mod: New file.
+	* gm2-compiler/M2Scope.def: New file.
+	* gm2-compiler/M2Scope.mod: New file.
+	* gm2-compiler/M2Search.def: New file.
+	* gm2-compiler/M2Search.mod: New file.
+	* gm2-compiler/M2Size.def: New file.
+	* gm2-compiler/M2Size.mod: New file.
+	* gm2-compiler/M2StackAddress.def: New file.
+	* gm2-compiler/M2StackAddress.mod: New file.
+	* gm2-compiler/M2StackWord.def: New file.
+	* gm2-compiler/M2StackWord.mod: New file.
+	* gm2-compiler/M2Students.def: New file.
+	* gm2-compiler/M2Students.mod: New file.
+	* gm2-compiler/M2Swig.def: New file.
+	* gm2-compiler/M2Swig.mod: New file.
+	* gm2-compiler/M2System.def: New file.
+	* gm2-compiler/M2System.mod: New file.
+	* gm2-compiler/M2Version.def: New file.
+	* gm2-compiler/NameKey.def: New file.
+	* gm2-compiler/NameKey.mod: New file.
+	* gm2-compiler/ObjectFiles.def: New file.
+	* gm2-compiler/ObjectFiles.mod: New file.
+	* gm2-compiler/Output.def: New file.
+	* gm2-compiler/Output.mod: New file.
+	* gm2-compiler/P0SymBuild.def: New file.
+	* gm2-compiler/P0SymBuild.mod: New file.
+	* gm2-compiler/P0SyntaxCheck.bnf: New file.
+	* gm2-compiler/P0SyntaxCheck.def: New file.
+	* gm2-compiler/P1Build.bnf: New file.
+	* gm2-compiler/P1Build.def: New file.
+	* gm2-compiler/P1SymBuild.def: New file.
+	* gm2-compiler/P1SymBuild.mod: New file.
+	* gm2-compiler/P2Build.bnf: New file.
+	* gm2-compiler/P2Build.def: New file.
+	* gm2-compiler/P2SymBuild.def: New file.
+	* gm2-compiler/P2SymBuild.mod: New file.
+	* gm2-compiler/P3Build.bnf: New file.
+	* gm2-compiler/P3Build.def: New file.
+	* gm2-compiler/P3SymBuild.def: New file.
+	* gm2-compiler/P3SymBuild.mod: New file.
+	* gm2-compiler/PCBuild.bnf: New file.
+	* gm2-compiler/PCBuild.def: New file.
+	* gm2-compiler/PCSymBuild.def: New file.
+	* gm2-compiler/PCSymBuild.mod: New file.
+	* gm2-compiler/PHBuild.bnf: New file.
+	* gm2-compiler/PHBuild.def: New file.
+	* gm2-compiler/README: New file.
+	* gm2-compiler/Sets.def: New file.
+	* gm2-compiler/Sets.mod: New file.
+	* gm2-compiler/SymbolConversion.def: New file.
+	* gm2-compiler/SymbolConversion.mod: New file.
+	* gm2-compiler/SymbolKey.def: New file.
+	* gm2-compiler/SymbolKey.mod: New file.
+	* gm2-compiler/SymbolTable.def: New file.
+	* gm2-compiler/SymbolTable.mod: New file.
+	* gm2-compiler/bnflex.def: New file.
+	* gm2-compiler/bnflex.mod: New file.
+	* gm2-compiler/cflex.def: New file.
+	* gm2-compiler/gm2.mod: New file.
+	* gm2-compiler/gm2lcc.mod: New file.
+	* gm2-compiler/gm2lgen.mod: New file.
+	* gm2-compiler/gm2lorder.mod: New file.
+	* gm2-compiler/m2flex.def: New file.
+	* gm2-compiler/ppg.mod: New file.
+	* gm2-gcc/README: New file.
+	* gm2-gcc/dynamicstrings.h: New file.
+	* gm2-gcc/gcc-consolidation.h: New file.
+	* gm2-gcc/init.cc: New file.
+	* gm2-gcc/init.def: New file.
+	* gm2-gcc/init.h: New file.
+	* gm2-gcc/m2assert.cc: New file.
+	* gm2-gcc/m2assert.h: New file.
+	* gm2-gcc/m2block.cc: New file.
+	* gm2-gcc/m2block.def: New file.
+	* gm2-gcc/m2block.h: New file.
+	* gm2-gcc/m2builtins.cc: New file.
+	* gm2-gcc/m2builtins.def: New file.
+	* gm2-gcc/m2builtins.h: New file.
+	* gm2-gcc/m2color.cc: New file.
+	* gm2-gcc/m2color.def: New file.
+	* gm2-gcc/m2color.h: New file.
+	* gm2-gcc/m2configure.cc: New file.
+	* gm2-gcc/m2configure.def: New file.
+	* gm2-gcc/m2configure.h: New file.
+	* gm2-gcc/m2convert.cc: New file.
+	* gm2-gcc/m2convert.def: New file.
+	* gm2-gcc/m2convert.h: New file.
+	* gm2-gcc/m2decl.cc: New file.
+	* gm2-gcc/m2decl.def: New file.
+	* gm2-gcc/m2decl.h: New file.
+	* gm2-gcc/m2except.cc: New file.
+	* gm2-gcc/m2except.def: New file.
+	* gm2-gcc/m2except.h: New file.
+	* gm2-gcc/m2expr.cc: New file.
+	* gm2-gcc/m2expr.def: New file.
+	* gm2-gcc/m2expr.h: New file.
+	* gm2-gcc/m2linemap.cc: New file.
+	* gm2-gcc/m2linemap.def: New file.
+	* gm2-gcc/m2linemap.h: New file.
+	* gm2-gcc/m2misc.cc: New file.
+	* gm2-gcc/m2misc.def: New file.
+	* gm2-gcc/m2misc.h: New file.
+	* gm2-gcc/m2options.h: New file.
+	* gm2-gcc/m2range.h: New file.
+	* gm2-gcc/m2search.h: New file.
+	* gm2-gcc/m2statement.cc: New file.
+	* gm2-gcc/m2statement.def: New file.
+	* gm2-gcc/m2statement.h: New file.
+	* gm2-gcc/m2top.cc: New file.
+	* gm2-gcc/m2top.def: New file.
+	* gm2-gcc/m2top.h: New file.
+	* gm2-gcc/m2tree.cc: New file.
+	* gm2-gcc/m2tree.def: New file.
+	* gm2-gcc/m2tree.h: New file.
+	* gm2-gcc/m2treelib.cc: New file.
+	* gm2-gcc/m2treelib.def: New file.
+	* gm2-gcc/m2treelib.h: New file.
+	* gm2-gcc/m2type.cc: New file.
+	* gm2-gcc/m2type.def: New file.
+	* gm2-gcc/m2type.h: New file.
+	* gm2-gcc/rtegraph.cc: New file.
+	* gm2-gcc/rtegraph.h: New file.
+	* gm2-ici/M2Emit.mod: New file.
+	* gm2-ici/README: New file.
+	* gm2-ici/m2linemap.c: New file.
+	* gm2-internals.texi: New file.
+	* gm2-lang.cc: New file.
+	* gm2-lang.h: New file.
+	* gm2-libiberty/README: New file.
+	* gm2-libiberty/choosetemp.def: New file.
+	* gm2-libiberty/pexecute.def: New file.
+	* gm2-libs-ch/M2LINK.c: New file.
+	* gm2-libs-ch/README: New file.
+	* gm2-libs-ch/RTcodummy.c: New file.
+	* gm2-libs-ch/RTintdummy.c: New file.
+	* gm2-libs-ch/Selective.c: New file.
+	* gm2-libs-ch/SysExceptions.c: New file.
+	* gm2-libs-ch/UnixArgs.cc: New file.
+	* gm2-libs-ch/cgetopt.c: New file.
+	* gm2-libs-ch/choosetemp.c: New file.
+	* gm2-libs-ch/dtoa.cc: New file.
+	* gm2-libs-ch/errno.c: New file.
+	* gm2-libs-ch/host.c: New file.
+	* gm2-libs-ch/ldtoa.cc: New file.
+	* gm2-libs-ch/m2rts.h: New file.
+	* gm2-libs-ch/termios.c: New file.
+	* gm2-libs-ch/tools.c: New file.
+	* gm2-libs-ch/wrapc.c: New file.
+	* gm2-libs-ch/xlibc.c: New file.
+	* gm2-libs-coroutines/Debug.def: New file.
+	* gm2-libs-coroutines/Debug.mod: New file.
+	* gm2-libs-coroutines/Executive.def: New file.
+	* gm2-libs-coroutines/Executive.mod: New file.
+	* gm2-libs-coroutines/KeyBoardLEDs.def: New file.
+	* gm2-libs-coroutines/README.texi: New file.
+	* gm2-libs-coroutines/SYSTEM.def: New file.
+	* gm2-libs-coroutines/SYSTEM.mod: New file.
+	* gm2-libs-coroutines/TimerHandler.def: New file.
+	* gm2-libs-coroutines/TimerHandler.mod: New file.
+	* gm2-libs-iso/COROUTINES.def: New file.
+	* gm2-libs-iso/COROUTINES.mod: New file.
+	* gm2-libs-iso/ChanConsts.def: New file.
+	* gm2-libs-iso/ChanConsts.h: New file.
+	* gm2-libs-iso/ChanConsts.mod: New file.
+	* gm2-libs-iso/CharClass.def: New file.
+	* gm2-libs-iso/CharClass.mod: New file.
+	* gm2-libs-iso/ClientSocket.def: New file.
+	* gm2-libs-iso/ClientSocket.mod: New file.
+	* gm2-libs-iso/ComplexMath.def: New file.
+	* gm2-libs-iso/ComplexMath.mod: New file.
+	* gm2-libs-iso/ConvStringLong.def: New file.
+	* gm2-libs-iso/ConvStringLong.mod: New file.
+	* gm2-libs-iso/ConvStringReal.def: New file.
+	* gm2-libs-iso/ConvStringReal.mod: New file.
+	* gm2-libs-iso/ConvTypes.def: New file.
+	* gm2-libs-iso/ConvTypes.mod: New file.
+	* gm2-libs-iso/EXCEPTIONS.def: New file.
+	* gm2-libs-iso/EXCEPTIONS.mod: New file.
+	* gm2-libs-iso/ErrnoCategory.def: New file.
+	* gm2-libs-iso/GeneralUserExceptions.def: New file.
+	* gm2-libs-iso/GeneralUserExceptions.mod: New file.
+	* gm2-libs-iso/IOChan.def: New file.
+	* gm2-libs-iso/IOChan.mod: New file.
+	* gm2-libs-iso/IOConsts.def: New file.
+	* gm2-libs-iso/IOConsts.mod: New file.
+	* gm2-libs-iso/IOLink.def: New file.
+	* gm2-libs-iso/IOLink.mod: New file.
+	* gm2-libs-iso/IOResult.def: New file.
+	* gm2-libs-iso/IOResult.mod: New file.
+	* gm2-libs-iso/LongComplexMath.def: New file.
+	* gm2-libs-iso/LongComplexMath.mod: New file.
+	* gm2-libs-iso/LongConv.def: New file.
+	* gm2-libs-iso/LongConv.mod: New file.
+	* gm2-libs-iso/LongIO.def: New file.
+	* gm2-libs-iso/LongIO.mod: New file.
+	* gm2-libs-iso/LongMath.def: New file.
+	* gm2-libs-iso/LongMath.mod: New file.
+	* gm2-libs-iso/LongStr.def: New file.
+	* gm2-libs-iso/LongStr.mod: New file.
+	* gm2-libs-iso/LongWholeIO.def: New file.
+	* gm2-libs-iso/LongWholeIO.mod: New file.
+	* gm2-libs-iso/LowLong.def: New file.
+	* gm2-libs-iso/LowLong.mod: New file.
+	* gm2-libs-iso/LowReal.def: New file.
+	* gm2-libs-iso/LowReal.mod: New file.
+	* gm2-libs-iso/LowShort.def: New file.
+	* gm2-libs-iso/LowShort.mod: New file.
+	* gm2-libs-iso/M2EXCEPTION.def: New file.
+	* gm2-libs-iso/M2EXCEPTION.mod: New file.
+	* gm2-libs-iso/M2RTS.def: New file.
+	* gm2-libs-iso/M2RTS.mod: New file.
+	* gm2-libs-iso/MemStream.def: New file.
+	* gm2-libs-iso/MemStream.mod: New file.
+	* gm2-libs-iso/Preemptive.def: New file.
+	* gm2-libs-iso/Preemptive.mod: New file.
+	* gm2-libs-iso/Processes.def: New file.
+	* gm2-libs-iso/Processes.mod: New file.
+	* gm2-libs-iso/ProgramArgs.def: New file.
+	* gm2-libs-iso/ProgramArgs.mod: New file.
+	* gm2-libs-iso/README.texi: New file.
+	* gm2-libs-iso/RTco.def: New file.
+	* gm2-libs-iso/RTdata.def: New file.
+	* gm2-libs-iso/RTdata.mod: New file.
+	* gm2-libs-iso/RTentity.def: New file.
+	* gm2-libs-iso/RTentity.mod: New file.
+	* gm2-libs-iso/RTfio.def: New file.
+	* gm2-libs-iso/RTfio.mod: New file.
+	* gm2-libs-iso/RTgen.def: New file.
+	* gm2-libs-iso/RTgen.mod: New file.
+	* gm2-libs-iso/RTgenif.def: New file.
+	* gm2-libs-iso/RTgenif.mod: New file.
+	* gm2-libs-iso/RTio.def: New file.
+	* gm2-libs-iso/RTio.mod: New file.
+	* gm2-libs-iso/RandomNumber.def: New file.
+	* gm2-libs-iso/RandomNumber.mod: New file.
+	* gm2-libs-iso/RawIO.def: New file.
+	* gm2-libs-iso/RawIO.mod: New file.
+	* gm2-libs-iso/RealConv.def: New file.
+	* gm2-libs-iso/RealConv.mod: New file.
+	* gm2-libs-iso/RealIO.def: New file.
+	* gm2-libs-iso/RealIO.mod: New file.
+	* gm2-libs-iso/RealMath.def: New file.
+	* gm2-libs-iso/RealMath.mod: New file.
+	* gm2-libs-iso/RealStr.def: New file.
+	* gm2-libs-iso/RealStr.mod: New file.
+	* gm2-libs-iso/RndFile.def: New file.
+	* gm2-libs-iso/RndFile.mod: New file.
+	* gm2-libs-iso/SIOResult.def: New file.
+	* gm2-libs-iso/SIOResult.mod: New file.
+	* gm2-libs-iso/SLongIO.def: New file.
+	* gm2-libs-iso/SLongIO.mod: New file.
+	* gm2-libs-iso/SLongWholeIO.def: New file.
+	* gm2-libs-iso/SLongWholeIO.mod: New file.
+	* gm2-libs-iso/SRawIO.def: New file.
+	* gm2-libs-iso/SRawIO.mod: New file.
+	* gm2-libs-iso/SRealIO.def: New file.
+	* gm2-libs-iso/SRealIO.mod: New file.
+	* gm2-libs-iso/SShortIO.def: New file.
+	* gm2-libs-iso/SShortIO.mod: New file.
+	* gm2-libs-iso/SShortWholeIO.def: New file.
+	* gm2-libs-iso/SShortWholeIO.mod: New file.
+	* gm2-libs-iso/STextIO.def: New file.
+	* gm2-libs-iso/STextIO.mod: New file.
+	* gm2-libs-iso/SWholeIO.def: New file.
+	* gm2-libs-iso/SWholeIO.mod: New file.
+	* gm2-libs-iso/SYSTEM.def: New file.
+	* gm2-libs-iso/SYSTEM.mod: New file.
+	* gm2-libs-iso/Semaphores.def: New file.
+	* gm2-libs-iso/Semaphores.mod: New file.
+	* gm2-libs-iso/SeqFile.def: New file.
+	* gm2-libs-iso/SeqFile.mod: New file.
+	* gm2-libs-iso/ShortComplexMath.def: New file.
+	* gm2-libs-iso/ShortComplexMath.mod: New file.
+	* gm2-libs-iso/ShortIO.def: New file.
+	* gm2-libs-iso/ShortIO.mod: New file.
+	* gm2-libs-iso/ShortWholeIO.def: New file.
+	* gm2-libs-iso/ShortWholeIO.mod: New file.
+	* gm2-libs-iso/SimpleCipher.def: New file.
+	* gm2-libs-iso/SimpleCipher.mod: New file.
+	* gm2-libs-iso/StdChans.def: New file.
+	* gm2-libs-iso/StdChans.mod: New file.
+	* gm2-libs-iso/Storage.def: New file.
+	* gm2-libs-iso/Storage.mod: New file.
+	* gm2-libs-iso/StreamFile.def: New file.
+	* gm2-libs-iso/StreamFile.mod: New file.
+	* gm2-libs-iso/StringChan.def: New file.
+	* gm2-libs-iso/StringChan.mod: New file.
+	* gm2-libs-iso/Strings.def: New file.
+	* gm2-libs-iso/Strings.mod: New file.
+	* gm2-libs-iso/SysClock.def: New file.
+	* gm2-libs-iso/SysClock.mod: New file.
+	* gm2-libs-iso/TERMINATION.def: New file.
+	* gm2-libs-iso/TERMINATION.mod: New file.
+	* gm2-libs-iso/TermFile.def: New file.
+	* gm2-libs-iso/TermFile.mod: New file.
+	* gm2-libs-iso/TextIO.def: New file.
+	* gm2-libs-iso/TextIO.mod: New file.
+	* gm2-libs-iso/WholeConv.def: New file.
+	* gm2-libs-iso/WholeConv.mod: New file.
+	* gm2-libs-iso/WholeIO.def: New file.
+	* gm2-libs-iso/WholeIO.mod: New file.
+	* gm2-libs-iso/WholeStr.def: New file.
+	* gm2-libs-iso/WholeStr.mod: New file.
+	* gm2-libs-iso/wrapsock.c: New file.
+	* gm2-libs-iso/wrapsock.def: New file.
+	* gm2-libs-iso/wraptime.c: New file.
+	* gm2-libs-iso/wraptime.def: New file.
+	* gm2-libs-min/M2RTS.def: New file.
+	* gm2-libs-min/M2RTS.mod: New file.
+	* gm2-libs-min/SYSTEM.def: New file.
+	* gm2-libs-min/SYSTEM.mod: New file.
+	* gm2-libs-min/libc.c: New file.
+	* gm2-libs-min/libc.def: New file.
+	* gm2-libs-pim/BitBlockOps.def: New file.
+	* gm2-libs-pim/BitBlockOps.mod: New file.
+	* gm2-libs-pim/BitByteOps.def: New file.
+	* gm2-libs-pim/BitByteOps.mod: New file.
+	* gm2-libs-pim/BitWordOps.def: New file.
+	* gm2-libs-pim/BitWordOps.mod: New file.
+	* gm2-libs-pim/BlockOps.def: New file.
+	* gm2-libs-pim/BlockOps.mod: New file.
+	* gm2-libs-pim/Break.c: New file.
+	* gm2-libs-pim/Break.def: New file.
+	* gm2-libs-pim/CardinalIO.def: New file.
+	* gm2-libs-pim/CardinalIO.mod: New file.
+	* gm2-libs-pim/Conversions.def: New file.
+	* gm2-libs-pim/Conversions.mod: New file.
+	* gm2-libs-pim/DebugPMD.def: New file.
+	* gm2-libs-pim/DebugPMD.mod: New file.
+	* gm2-libs-pim/DebugTrace.def: New file.
+	* gm2-libs-pim/DebugTrace.mod: New file.
+	* gm2-libs-pim/Delay.def: New file.
+	* gm2-libs-pim/Delay.mod: New file.
+	* gm2-libs-pim/Display.def: New file.
+	* gm2-libs-pim/Display.mod: New file.
+	* gm2-libs-pim/ErrorCode.def: New file.
+	* gm2-libs-pim/ErrorCode.mod: New file.
+	* gm2-libs-pim/FileSystem.def: New file.
+	* gm2-libs-pim/FileSystem.mod: New file.
+	* gm2-libs-pim/FloatingUtilities.def: New file.
+	* gm2-libs-pim/FloatingUtilities.mod: New file.
+	* gm2-libs-pim/InOut.def: New file.
+	* gm2-libs-pim/InOut.mod: New file.
+	* gm2-libs-pim/Keyboard.def: New file.
+	* gm2-libs-pim/Keyboard.mod: New file.
+	* gm2-libs-pim/LongIO.def: New file.
+	* gm2-libs-pim/LongIO.mod: New file.
+	* gm2-libs-pim/NumberConversion.def: New file.
+	* gm2-libs-pim/NumberConversion.mod: New file.
+	* gm2-libs-pim/README.texi: New file.
+	* gm2-libs-pim/Random.def: New file.
+	* gm2-libs-pim/Random.mod: New file.
+	* gm2-libs-pim/RealConversions.def: New file.
+	* gm2-libs-pim/RealConversions.mod: New file.
+	* gm2-libs-pim/RealInOut.def: New file.
+	* gm2-libs-pim/RealInOut.mod: New file.
+	* gm2-libs-pim/Strings.def: New file.
+	* gm2-libs-pim/Strings.mod: New file.
+	* gm2-libs-pim/Termbase.def: New file.
+	* gm2-libs-pim/Termbase.mod: New file.
+	* gm2-libs-pim/Terminal.def: New file.
+	* gm2-libs-pim/Terminal.mod: New file.
+	* gm2-libs-pim/TimeDate.def: New file.
+	* gm2-libs-pim/TimeDate.mod: New file.
+	* gm2-libs/ASCII.def: New file.
+	* gm2-libs/ASCII.mod: New file.
+	* gm2-libs/Args.def: New file.
+	* gm2-libs/Args.mod: New file.
+	* gm2-libs/Assertion.def: New file.
+	* gm2-libs/Assertion.mod: New file.
+	* gm2-libs/Break.def: New file.
+	* gm2-libs/Break.mod: New file.
+	* gm2-libs/Builtins.def: New file.
+	* gm2-libs/Builtins.mod: New file.
+	* gm2-libs/COROUTINES.def: New file.
+	* gm2-libs/COROUTINES.mod: New file.
+	* gm2-libs/CmdArgs.def: New file.
+	* gm2-libs/CmdArgs.mod: New file.
+	* gm2-libs/Debug.def: New file.
+	* gm2-libs/Debug.mod: New file.
+	* gm2-libs/DynamicStrings.def: New file.
+	* gm2-libs/DynamicStrings.mod: New file.
+	* gm2-libs/Environment.def: New file.
+	* gm2-libs/Environment.mod: New file.
+	* gm2-libs/FIO.def: New file.
+	* gm2-libs/FIO.mod: New file.
+	* gm2-libs/FormatStrings.def: New file.
+	* gm2-libs/FormatStrings.mod: New file.
+	* gm2-libs/FpuIO.def: New file.
+	* gm2-libs/FpuIO.mod: New file.
+	* gm2-libs/GetOpt.def: New file.
+	* gm2-libs/GetOpt.mod: New file.
+	* gm2-libs/IO.def: New file.
+	* gm2-libs/IO.mod: New file.
+	* gm2-libs/Indexing.def: New file.
+	* gm2-libs/Indexing.mod: New file.
+	* gm2-libs/LMathLib0.def: New file.
+	* gm2-libs/LMathLib0.mod: New file.
+	* gm2-libs/LegacyReal.def: New file.
+	* gm2-libs/LegacyReal.mod: New file.
+	* gm2-libs/M2Dependent.def: New file.
+	* gm2-libs/M2Dependent.mod: New file.
+	* gm2-libs/M2EXCEPTION.def: New file.
+	* gm2-libs/M2EXCEPTION.mod: New file.
+	* gm2-libs/M2LINK.def: New file.
+	* gm2-libs/M2RTS.def: New file.
+	* gm2-libs/M2RTS.mod: New file.
+	* gm2-libs/MathLib0.def: New file.
+	* gm2-libs/MathLib0.mod: New file.
+	* gm2-libs/MemUtils.def: New file.
+	* gm2-libs/MemUtils.mod: New file.
+	* gm2-libs/NumberIO.def: New file.
+	* gm2-libs/NumberIO.mod: New file.
+	* gm2-libs/OptLib.def: New file.
+	* gm2-libs/OptLib.mod: New file.
+	* gm2-libs/PushBackInput.def: New file.
+	* gm2-libs/PushBackInput.mod: New file.
+	* gm2-libs/README.texi: New file.
+	* gm2-libs/RTExceptions.def: New file.
+	* gm2-libs/RTExceptions.mod: New file.
+	* gm2-libs/RTint.def: New file.
+	* gm2-libs/RTint.mod: New file.
+	* gm2-libs/SArgs.def: New file.
+	* gm2-libs/SArgs.mod: New file.
+	* gm2-libs/SCmdArgs.def: New file.
+	* gm2-libs/SCmdArgs.mod: New file.
+	* gm2-libs/SEnvironment.def: New file.
+	* gm2-libs/SEnvironment.mod: New file.
+	* gm2-libs/SFIO.def: New file.
+	* gm2-libs/SFIO.mod: New file.
+	* gm2-libs/SMathLib0.def: New file.
+	* gm2-libs/SMathLib0.mod: New file.
+	* gm2-libs/SYSTEM.def: New file.
+	* gm2-libs/SYSTEM.mod: New file.
+	* gm2-libs/Scan.def: New file.
+	* gm2-libs/Scan.mod: New file.
+	* gm2-libs/Selective.def: New file.
+	* gm2-libs/StdIO.def: New file.
+	* gm2-libs/StdIO.mod: New file.
+	* gm2-libs/Storage.def: New file.
+	* gm2-libs/Storage.mod: New file.
+	* gm2-libs/StrCase.def: New file.
+	* gm2-libs/StrCase.mod: New file.
+	* gm2-libs/StrIO.def: New file.
+	* gm2-libs/StrIO.mod: New file.
+	* gm2-libs/StrLib.def: New file.
+	* gm2-libs/StrLib.mod: New file.
+	* gm2-libs/StringConvert.def: New file.
+	* gm2-libs/StringConvert.mod: New file.
+	* gm2-libs/SysExceptions.def: New file.
+	* gm2-libs/SysStorage.def: New file.
+	* gm2-libs/SysStorage.mod: New file.
+	* gm2-libs/TimeString.def: New file.
+	* gm2-libs/TimeString.mod: New file.
+	* gm2-libs/UnixArgs.def: New file.
+	* gm2-libs/cbuiltin.def: New file.
+	* gm2-libs/cgetopt.def: New file.
+	* gm2-libs/config-host: New file.
+	* gm2-libs/config-host.in: New file.
+	* gm2-libs/cxxabi.def: New file.
+	* gm2-libs/dtoa.def: New file.
+	* gm2-libs/errno.def: New file.
+	* gm2-libs/gdbif.def: New file.
+	* gm2-libs/gdbif.mod: New file.
+	* gm2-libs/gm2-libs-host.h.in: New file.
+	* gm2-libs/ldtoa.def: New file.
+	* gm2-libs/libc.def: New file.
+	* gm2-libs/libm.def: New file.
+	* gm2-libs/sckt.def: New file.
+	* gm2-libs/termios.def: New file.
+	* gm2-libs/wrapc.def: New file.
+	* gm2config.h.in: New file.
+	* gm2spec.cc: New file.
+	* gm2version.h: New file.
+	* init/README: New file.
+	* init/mcinit: New file.
+	* init/ppginit: New file.
+	* lang-specs.h: New file.
+	* lang.opt: New file.
+	* m2-tree.def: New file.
+	* m2-tree.h: New file.
+	* m2.flex: New file.
+	* m2pp.cc: New file.
+	* m2pp.h: New file.
+	* mc-boot-ch/GBuiltins.c: New file.
+	* mc-boot-ch/GM2LINK.c: New file.
+	* mc-boot-ch/GRTco.c: New file.
+	* mc-boot-ch/GSYSTEM.c: New file.
+	* mc-boot-ch/GSelective.c: New file.
+	* mc-boot-ch/GSysExceptions.c: New file.
+	* mc-boot-ch/GUnixArgs.cc: New file.
+	* mc-boot-ch/Gabort.c: New file.
+	* mc-boot-ch/Gcbuiltin.c: New file.
+	* mc-boot-ch/Gdtoa.c: New file.
+	* mc-boot-ch/Gerrno.c: New file.
+	* mc-boot-ch/Gldtoa.c: New file.
+	* mc-boot-ch/Glibc.c: New file.
+	* mc-boot-ch/Glibm.c: New file.
+	* mc-boot-ch/Gmcrts.c: New file.
+	* mc-boot-ch/Gmcrts.h: New file.
+	* mc-boot-ch/Gnetwork.h: New file.
+	* mc-boot-ch/Gtermios.cc: New file.
+	* mc-boot-ch/Gwrapc.c: New file.
+	* mc-boot-ch/README: New file.
+	* mc-boot-ch/m2rts.h: New file.
+	* mc-boot-ch/network.c: New file.
+	* mc-boot/GASCII.c: New file.
+	* mc-boot/GASCII.h: New file.
+	* mc-boot/GArgs.c: New file.
+	* mc-boot/GArgs.h: New file.
+	* mc-boot/GAssertion.c: New file.
+	* mc-boot/GAssertion.h: New file.
+	* mc-boot/GBreak.c: New file.
+	* mc-boot/GBreak.h: New file.
+	* mc-boot/GCOROUTINES.h: New file.
+	* mc-boot/GCmdArgs.c: New file.
+	* mc-boot/GCmdArgs.h: New file.
+	* mc-boot/GDebug.c: New file.
+	* mc-boot/GDebug.h: New file.
+	* mc-boot/GDynamicStrings.c: New file.
+	* mc-boot/GDynamicStrings.h: New file.
+	* mc-boot/GEnvironment.c: New file.
+	* mc-boot/GEnvironment.h: New file.
+	* mc-boot/GFIO.c: New file.
+	* mc-boot/GFIO.h: New file.
+	* mc-boot/GFormatStrings.c: New file.
+	* mc-boot/GFormatStrings.h: New file.
+	* mc-boot/GFpuIO.c: New file.
+	* mc-boot/GFpuIO.h: New file.
+	* mc-boot/GIO.c: New file.
+	* mc-boot/GIO.h: New file.
+	* mc-boot/GIndexing.c: New file.
+	* mc-boot/GIndexing.h: New file.
+	* mc-boot/GM2Dependent.c: New file.
+	* mc-boot/GM2Dependent.h: New file.
+	* mc-boot/GM2EXCEPTION.c: New file.
+	* mc-boot/GM2EXCEPTION.h: New file.
+	* mc-boot/GM2LINK.h: New file.
+	* mc-boot/GM2RTS.c: New file.
+	* mc-boot/GM2RTS.h: New file.
+	* mc-boot/GMemUtils.c: New file.
+	* mc-boot/GMemUtils.h: New file.
+	* mc-boot/GNumberIO.c: New file.
+	* mc-boot/GNumberIO.h: New file.
+	* mc-boot/GPushBackInput.c: New file.
+	* mc-boot/GPushBackInput.h: New file.
+	* mc-boot/GRTExceptions.c: New file.
+	* mc-boot/GRTExceptions.h: New file.
+	* mc-boot/GRTco.h: New file.
+	* mc-boot/GRTint.c: New file.
+	* mc-boot/GRTint.h: New file.
+	* mc-boot/GSArgs.c: New file.
+	* mc-boot/GSArgs.h: New file.
+	* mc-boot/GSFIO.c: New file.
+	* mc-boot/GSFIO.h: New file.
+	* mc-boot/GSYSTEM.h: New file.
+	* mc-boot/GSelective.h: New file.
+	* mc-boot/GStdIO.c: New file.
+	* mc-boot/GStdIO.h: New file.
+	* mc-boot/GStorage.c: New file.
+	* mc-boot/GStorage.h: New file.
+	* mc-boot/GStrCase.c: New file.
+	* mc-boot/GStrCase.h: New file.
+	* mc-boot/GStrIO.c: New file.
+	* mc-boot/GStrIO.h: New file.
+	* mc-boot/GStrLib.c: New file.
+	* mc-boot/GStrLib.h: New file.
+	* mc-boot/GStringConvert.c: New file.
+	* mc-boot/GStringConvert.h: New file.
+	* mc-boot/GSysExceptions.h: New file.
+	* mc-boot/GSysStorage.c: New file.
+	* mc-boot/GSysStorage.h: New file.
+	* mc-boot/GTimeString.c: New file.
+	* mc-boot/GTimeString.h: New file.
+	* mc-boot/GUnixArgs.h: New file.
+	* mc-boot/Galists.c: New file.
+	* mc-boot/Galists.h: New file.
+	* mc-boot/Gdecl.c: New file.
+	* mc-boot/Gdecl.h: New file.
+	* mc-boot/Gdtoa.h: New file.
+	* mc-boot/Gerrno.h: New file.
+	* mc-boot/Gkeyc.c: New file.
+	* mc-boot/Gkeyc.h: New file.
+	* mc-boot/Gldtoa.h: New file.
+	* mc-boot/Glibc.h: New file.
+	* mc-boot/Glibm.h: New file.
+	* mc-boot/Glists.c: New file.
+	* mc-boot/Glists.h: New file.
+	* mc-boot/GmcComment.c: New file.
+	* mc-boot/GmcComment.h: New file.
+	* mc-boot/GmcComp.c: New file.
+	* mc-boot/GmcComp.h: New file.
+	* mc-boot/GmcDebug.c: New file.
+	* mc-boot/GmcDebug.h: New file.
+	* mc-boot/GmcError.c: New file.
+	* mc-boot/GmcError.h: New file.
+	* mc-boot/GmcFileName.c: New file.
+	* mc-boot/GmcFileName.h: New file.
+	* mc-boot/GmcLexBuf.c: New file.
+	* mc-boot/GmcLexBuf.h: New file.
+	* mc-boot/GmcMetaError.c: New file.
+	* mc-boot/GmcMetaError.h: New file.
+	* mc-boot/GmcOptions.c: New file.
+	* mc-boot/GmcOptions.h: New file.
+	* mc-boot/GmcPreprocess.c: New file.
+	* mc-boot/GmcPreprocess.h: New file.
+	* mc-boot/GmcPretty.c: New file.
+	* mc-boot/GmcPretty.h: New file.
+	* mc-boot/GmcPrintf.c: New file.
+	* mc-boot/GmcPrintf.h: New file.
+	* mc-boot/GmcQuiet.c: New file.
+	* mc-boot/GmcQuiet.h: New file.
+	* mc-boot/GmcReserved.c: New file.
+	* mc-boot/GmcReserved.h: New file.
+	* mc-boot/GmcSearch.c: New file.
+	* mc-boot/GmcSearch.h: New file.
+	* mc-boot/GmcStack.c: New file.
+	* mc-boot/GmcStack.h: New file.
+	* mc-boot/GmcStream.c: New file.
+	* mc-boot/GmcStream.h: New file.
+	* mc-boot/Gmcflex.h: New file.
+	* mc-boot/Gmcp1.c: New file.
+	* mc-boot/Gmcp1.h: New file.
+	* mc-boot/Gmcp2.c: New file.
+	* mc-boot/Gmcp2.h: New file.
+	* mc-boot/Gmcp3.c: New file.
+	* mc-boot/Gmcp3.h: New file.
+	* mc-boot/Gmcp4.c: New file.
+	* mc-boot/Gmcp4.h: New file.
+	* mc-boot/Gmcp5.c: New file.
+	* mc-boot/Gmcp5.h: New file.
+	* mc-boot/GnameKey.c: New file.
+	* mc-boot/GnameKey.h: New file.
+	* mc-boot/Gpth.h: New file.
+	* mc-boot/GsymbolKey.c: New file.
+	* mc-boot/GsymbolKey.h: New file.
+	* mc-boot/Gtermios.h: New file.
+	* mc-boot/Gtop.c: New file.
+	* mc-boot/Gvarargs.c: New file.
+	* mc-boot/Gvarargs.h: New file.
+	* mc-boot/Gwlists.c: New file.
+	* mc-boot/Gwlists.h: New file.
+	* mc-boot/Gwrapc.h: New file.
+	* mc-boot/README: New file.
+	* mc/Indexing.def: New file.
+	* mc/Indexing.mod: New file.
+	* mc/README: New file.
+	* mc/alists.def: New file.
+	* mc/alists.mod: New file.
+	* mc/decl.def: New file.
+	* mc/decl.mod: New file.
+	* mc/decl.mod-extra: New file.
+	* mc/keyc.def: New file.
+	* mc/keyc.mod: New file.
+	* mc/lists.def: New file.
+	* mc/lists.mod: New file.
+	* mc/m2flex.def: New file.
+	* mc/mc.flex: New file.
+	* mc/mcComment.def: New file.
+	* mc/mcComment.h: New file.
+	* mc/mcComment.mod: New file.
+	* mc/mcComp.def: New file.
+	* mc/mcComp.mod: New file.
+	* mc/mcDebug.def: New file.
+	* mc/mcDebug.mod: New file.
+	* mc/mcError.def: New file.
+	* mc/mcError.mod: New file.
+	* mc/mcFileName.def: New file.
+	* mc/mcFileName.mod: New file.
+	* mc/mcLexBuf.def: New file.
+	* mc/mcLexBuf.h: New file.
+	* mc/mcLexBuf.mod: New file.
+	* mc/mcMetaError.def: New file.
+	* mc/mcMetaError.mod: New file.
+	* mc/mcOptions.def: New file.
+	* mc/mcOptions.mod: New file.
+	* mc/mcPreprocess.def: New file.
+	* mc/mcPreprocess.mod: New file.
+	* mc/mcPretty.def: New file.
+	* mc/mcPretty.mod: New file.
+	* mc/mcPrintf.def: New file.
+	* mc/mcPrintf.mod: New file.
+	* mc/mcQuiet.def: New file.
+	* mc/mcQuiet.mod: New file.
+	* mc/mcReserved.def: New file.
+	* mc/mcReserved.h: New file.
+	* mc/mcReserved.mod: New file.
+	* mc/mcSearch.def: New file.
+	* mc/mcSearch.mod: New file.
+	* mc/mcStack.def: New file.
+	* mc/mcStack.mod: New file.
+	* mc/mcStream.def: New file.
+	* mc/mcStream.mod: New file.
+	* mc/mcflex.def: New file.
+	* mc/mcp1.bnf: New file.
+	* mc/mcp1.def: New file.
+	* mc/mcp2.bnf: New file.
+	* mc/mcp2.def: New file.
+	* mc/mcp3.bnf: New file.
+	* mc/mcp3.def: New file.
+	* mc/mcp4.bnf: New file.
+	* mc/mcp4.def: New file.
+	* mc/mcp5.bnf: New file.
+	* mc/mcp5.def: New file.
+	* mc/nameKey.def: New file.
+	* mc/nameKey.mod: New file.
+	* mc/symbolKey.def: New file.
+	* mc/symbolKey.mod: New file.
+	* mc/top.mod: New file.
+	* mc/varargs.def: New file.
+	* mc/varargs.mod: New file.
+	* mc/wlists.def: New file.
+	* mc/wlists.mod: New file.
+	* pge-boot/GASCII.c: New file.
+	* pge-boot/GASCII.h: New file.
+	* pge-boot/GArgs.c: New file.
+	* pge-boot/GArgs.h: New file.
+	* pge-boot/GAssertion.c: New file.
+	* pge-boot/GAssertion.h: New file.
+	* pge-boot/GBreak.h: New file.
+	* pge-boot/GBuiltins.c: New file.
+	* pge-boot/GCmdArgs.h: New file.
+	* pge-boot/GDebug.c: New file.
+	* pge-boot/GDebug.h: New file.
+	* pge-boot/GDynamicStrings.c: New file.
+	* pge-boot/GDynamicStrings.h: New file.
+	* pge-boot/GEnvironment.h: New file.
+	* pge-boot/GFIO.c: New file.
+	* pge-boot/GFIO.h: New file.
+	* pge-boot/GFormatStrings.h: New file.
+	* pge-boot/GFpuIO.h: New file.
+	* pge-boot/GIO.c: New file.
+	* pge-boot/GIO.h: New file.
+	* pge-boot/GIndexing.c: New file.
+	* pge-boot/GIndexing.h: New file.
+	* pge-boot/GLists.c: New file.
+	* pge-boot/GLists.h: New file.
+	* pge-boot/GM2Dependent.c: New file.
+	* pge-boot/GM2Dependent.h: New file.
+	* pge-boot/GM2EXCEPTION.c: New file.
+	* pge-boot/GM2EXCEPTION.h: New file.
+	* pge-boot/GM2LINK.c: New file.
+	* pge-boot/GM2LINK.h: New file.
+	* pge-boot/GM2RTS.c: New file.
+	* pge-boot/GM2RTS.h: New file.
+	* pge-boot/GNameKey.c: New file.
+	* pge-boot/GNameKey.h: New file.
+	* pge-boot/GNumberIO.c: New file.
+	* pge-boot/GNumberIO.h: New file.
+	* pge-boot/GOutput.c: New file.
+	* pge-boot/GOutput.h: New file.
+	* pge-boot/GPushBackInput.c: New file.
+	* pge-boot/GPushBackInput.h: New file.
+	* pge-boot/GRTExceptions.c: New file.
+	* pge-boot/GRTExceptions.h: New file.
+	* pge-boot/GRTco.c: New file.
+	* pge-boot/GSArgs.h: New file.
+	* pge-boot/GSEnvironment.h: New file.
+	* pge-boot/GSFIO.c: New file.
+	* pge-boot/GSFIO.h: New file.
+	* pge-boot/GSYSTEM.c: New file.
+	* pge-boot/GSYSTEM.h: New file.
+	* pge-boot/GScan.h: New file.
+	* pge-boot/GSelective.c: New file.
+	* pge-boot/GStdIO.c: New file.
+	* pge-boot/GStdIO.h: New file.
+	* pge-boot/GStorage.c: New file.
+	* pge-boot/GStorage.h: New file.
+	* pge-boot/GStrCase.c: New file.
+	* pge-boot/GStrCase.h: New file.
+	* pge-boot/GStrIO.c: New file.
+	* pge-boot/GStrIO.h: New file.
+	* pge-boot/GStrLib.c: New file.
+	* pge-boot/GStrLib.h: New file.
+	* pge-boot/GStringConvert.h: New file.
+	* pge-boot/GSymbolKey.c: New file.
+	* pge-boot/GSymbolKey.h: New file.
+	* pge-boot/GSysExceptions.c: New file.
+	* pge-boot/GSysExceptions.h: New file.
+	* pge-boot/GSysStorage.c: New file.
+	* pge-boot/GSysStorage.h: New file.
+	* pge-boot/GTimeString.h: New file.
+	* pge-boot/GUnixArgs.cc: New file.
+	* pge-boot/GUnixArgs.h: New file.
+	* pge-boot/Gabort.c: New file.
+	* pge-boot/Gbnflex.c: New file.
+	* pge-boot/Gbnflex.h: New file.
+	* pge-boot/Gcbuiltin.c: New file.
+	* pge-boot/Gdtoa.c: New file.
+	* pge-boot/Gdtoa.h: New file.
+	* pge-boot/Gerrno.c: New file.
+	* pge-boot/Gerrno.h: New file.
+	* pge-boot/Gldtoa.c: New file.
+	* pge-boot/Gldtoa.h: New file.
+	* pge-boot/Glibc.c: New file.
+	* pge-boot/Glibc.h: New file.
+	* pge-boot/Glibm.c: New file.
+	* pge-boot/Glibm.h: New file.
+	* pge-boot/Gmcrts.c: New file.
+	* pge-boot/Gmcrts.h: New file.
+	* pge-boot/Gnetwork.h: New file.
+	* pge-boot/Gpge.c: New file.
+	* pge-boot/Gtermios.cc: New file.
+	* pge-boot/Gtermios.h: New file.
+	* pge-boot/Gwrapc.c: New file.
+	* pge-boot/Gwrapc.h: New file.
+	* pge-boot/README: New file.
+	* pge-boot/m2rts.h: New file.
+	* pge-boot/main.c: New file.
+	* pge-boot/network.c: New file.
+	* plugin/README: New file.
+	* plugin/m2rte.cc: New file.
+	* tools-src/README: New file.
+	* tools-src/boilerplate.py: New file.
+	* tools-src/buildpg: New file.
+	* tools-src/calcpath: New file.
+	* tools-src/def2doc.py: New file.
+	* tools-src/makeSystem: New file.
+	* tools-src/mklink.c: New file.
+	* tools-src/tidydates.py: New file.
+	* images/LICENSE.IMG: New file.
+	* images/gnupng: New file.
+	* images/gnu.eps: New file.
+	* version.c: New file.
+	* configure: Rebuilt.
 	* target-independent/Builtins.texi: New file.
 	* target-independent/SYSTEM-iso.texi: New file.
 	* target-independent/SYSTEM-pim.texi: New file.
 	* target-independent/gm2-libs.texi: New file.
-	* target-independent/readme.txt: New file.
\ No newline at end of file
+	* target-independent/readme.txt: New file.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a41b607e6db..a3a6de8a59d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -30,1674 +30,1678 @@
 
 2022-12-14  Gaius Mulley  <gaiusmod2@gmail.com>
 
-	* lib/gm2-dg.exp: (New file).
-	* lib/gm2.exp: (New file).
-	* lib/gm2-simple.exp: (New file).
-	* lib/gm2-torture.exp: (New file).
-	* gm2/calling-c/datatypes/unbounded/run/pass/c.c: (New file).
-	* gm2/calling-c/datatypes/unbounded/run/pass/c.def: (New file).
+	* lib/gm2-dg.exp: New file.
+	* lib/gm2.exp: New file.
+	* lib/gm2-simple.exp: New file.
+	* lib/gm2-torture.exp: New file.
+	* gm2/calling-c/datatypes/unbounded/run/pass/c.c: New file.
+	* gm2/calling-c/datatypes/unbounded/run/pass/c.def: New file.
 	* gm2/calling-c/datatypes/unbounded/run/pass/calling-c-datatypes-unbounded-run-pass.exp:
-	(New file).
-	* gm2/calling-c/datatypes/unbounded/run/pass/m.mod: (New file).
-	* gm2/case/pass/case-pass.exp: (New file).
-	* gm2/case/pass/testcase1.mod: (New file).
-	* gm2/case/pass/testcase2.mod: (New file).
-	* gm2/case/pass/testcase3.mod: (New file).
-	* gm2/case/pass/testcase4.mod: (New file).
-	* gm2/complex/fail/var1.mod: (New file).
-	* gm2/complex/pass/arith.mod: (New file).
-	* gm2/complex/pass/arith2.mod: (New file).
-	* gm2/complex/pass/arith3.mod: (New file).
-	* gm2/complex/pass/arith4.mod: (New file).
-	* gm2/complex/pass/arith5.mod: (New file).
-	* gm2/complex/pass/arith6.mod: (New file).
-	* gm2/complex/pass/complex-pass.exp: (New file).
-	* gm2/complex/pass/consts.mod: (New file).
-	* gm2/complex/pass/consts2.mod: (New file).
-	* gm2/complex/pass/consts3.mod: (New file).
-	* gm2/complex/pass/tinycabs.mod: (New file).
-	* gm2/complex/pass/var1.mod: (New file).
-	* gm2/complex/pass/var2.mod: (New file).
-	* gm2/complex/pass/var3.mod: (New file).
-	* gm2/complex/pass/var4.mod: (New file).
-	* gm2/complex/pass/var5.mod: (New file).
-	* gm2/complex/pass/var6.mod: (New file).
-	* gm2/complex/pass/var7.mod: (New file).
-	* gm2/complex/pass/var8.mod: (New file).
-	* gm2/complex/run/pass/arith3.mod: (New file).
-	* gm2/complex/run/pass/arith4.mod: (New file).
-	* gm2/complex/run/pass/arith5.mod: (New file).
-	* gm2/complex/run/pass/arith6.mod: (New file).
-	* gm2/complex/run/pass/arith7.mod: (New file).
-	* gm2/complex/run/pass/arith8.mod: (New file).
-	* gm2/complex/run/pass/complex-run-pass.exp: (New file).
-	* gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp: (New file).
-	* gm2/coroutines/pim/run/pass/testiotransfer.mod: (New file).
-	* gm2/coroutines/pim/run/pass/testtransfer.mod: (New file).
-	* gm2/cpp/fail/another.h: (New file).
-	* gm2/cpp/fail/fail1.mod: (New file).
-	* gm2/cpp/longcard2.mod: (New file).
-	* gm2/cpp/longstrimp.mod: (New file).
-	* gm2/cpp/pass/arrayhuge.mod: (New file).
-	* gm2/cpp/pass/arrayhuge2.mod: (New file).
-	* gm2/cpp/pass/cpp-pass.exp: (New file).
-	* gm2/cpp/pass/cpp.mod: (New file).
-	* gm2/cpp/pass/cpph.mod: (New file).
-	* gm2/cpp/pass/subaddr.mod: (New file).
-	* gm2/cpp/pass/testcpp.mod: (New file).
-	* gm2/cpp/pass/testcpp2.mod: (New file).
-	* gm2/cpp/setchar2.mod: (New file).
-	* gm2/cpp/setchar6.mod: (New file).
-	* gm2/cse/fail/cse-fail.exp: (New file).
-	* gm2/cse/fail/testcse38.mod: (New file).
-	* gm2/cse/pass/cse-pass.exp: (New file).
-	* gm2/cse/pass/m2t.c: (New file).
-	* gm2/cse/pass/testb.mod: (New file).
-	* gm2/cse/pass/testbuiltin.def: (New file).
-	* gm2/cse/pass/testbuiltin.mod: (New file).
-	* gm2/cse/pass/testcse.def: (New file).
-	* gm2/cse/pass/testcse.mod: (New file).
-	* gm2/cse/pass/testcse10.mod: (New file).
-	* gm2/cse/pass/testcse11.mod: (New file).
-	* gm2/cse/pass/testcse12.mod: (New file).
-	* gm2/cse/pass/testcse13.mod: (New file).
-	* gm2/cse/pass/testcse14.mod: (New file).
-	* gm2/cse/pass/testcse15.mod: (New file).
-	* gm2/cse/pass/testcse16.mod: (New file).
-	* gm2/cse/pass/testcse17.mod: (New file).
-	* gm2/cse/pass/testcse18.mod: (New file).
-	* gm2/cse/pass/testcse19.mod: (New file).
-	* gm2/cse/pass/testcse2.mod: (New file).
-	* gm2/cse/pass/testcse20.mod: (New file).
-	* gm2/cse/pass/testcse21.mod: (New file).
-	* gm2/cse/pass/testcse22.mod: (New file).
-	* gm2/cse/pass/testcse23.mod: (New file).
-	* gm2/cse/pass/testcse24.mod: (New file).
-	* gm2/cse/pass/testcse25.mod: (New file).
-	* gm2/cse/pass/testcse26.mod: (New file).
-	* gm2/cse/pass/testcse27.mod: (New file).
-	* gm2/cse/pass/testcse28.mod: (New file).
-	* gm2/cse/pass/testcse29.mod: (New file).
-	* gm2/cse/pass/testcse3.mod: (New file).
-	* gm2/cse/pass/testcse31.mod: (New file).
-	* gm2/cse/pass/testcse32.mod: (New file).
-	* gm2/cse/pass/testcse33.mod: (New file).
-	* gm2/cse/pass/testcse34.mod: (New file).
-	* gm2/cse/pass/testcse35.mod: (New file).
-	* gm2/cse/pass/testcse36.mod: (New file).
-	* gm2/cse/pass/testcse37.mod: (New file).
-	* gm2/cse/pass/testcse39.mod: (New file).
-	* gm2/cse/pass/testcse4.c: (New file).
-	* gm2/cse/pass/testcse4.mod: (New file).
-	* gm2/cse/pass/testcse40.mod: (New file).
-	* gm2/cse/pass/testcse41.mod: (New file).
-	* gm2/cse/pass/testcse42.mod: (New file).
-	* gm2/cse/pass/testcse43.mod: (New file).
-	* gm2/cse/pass/testcse44.mod: (New file).
-	* gm2/cse/pass/testcse45.mod: (New file).
-	* gm2/cse/pass/testcse46.mod: (New file).
-	* gm2/cse/pass/testcse47.mod: (New file).
-	* gm2/cse/pass/testcse48.mod: (New file).
-	* gm2/cse/pass/testcse49.mod: (New file).
-	* gm2/cse/pass/testcse5.c: (New file).
-	* gm2/cse/pass/testcse5.mod: (New file).
-	* gm2/cse/pass/testcse50.def: (New file).
-	* gm2/cse/pass/testcse50.mod: (New file).
-	* gm2/cse/pass/testcse51.mod: (New file).
-	* gm2/cse/pass/testcse52.def: (New file).
-	* gm2/cse/pass/testcse52.mod: (New file).
-	* gm2/cse/pass/testcse53.def: (New file).
-	* gm2/cse/pass/testcse53.mod: (New file).
-	* gm2/cse/pass/testcse6.c: (New file).
-	* gm2/cse/pass/testcse6.mod: (New file).
-	* gm2/cse/pass/testcse7.c: (New file).
-	* gm2/cse/pass/testcse7.mod: (New file).
-	* gm2/cse/pass/testcse8.c: (New file).
-	* gm2/cse/pass/testcse8.mod: (New file).
-	* gm2/cse/pass/testcse9.c: (New file).
-	* gm2/cse/pass/testsize.mod: (New file).
-	* gm2/dynamic/pass/add.mod: (New file).
-	* gm2/dynamic/pass/dynamic-pass.exp: (New file).
-	* gm2/dynamic/pass/prog21.mod: (New file).
-	* gm2/dynamic/pass/testarray.mod: (New file).
-	* gm2/dynamic/pass/testarray2.mod: (New file).
-	* gm2/dynamic/pass/testarray3.mod: (New file).
-	* gm2/dynamic/pass/testarray4.mod: (New file).
-	* gm2/dynamic/pass/testarray6.mod: (New file).
-	* gm2/dynamic/pass/testbec.mod: (New file).
-	* gm2/dynamic/pass/testbec10.mod: (New file).
-	* gm2/dynamic/pass/testbec11.mod: (New file).
-	* gm2/dynamic/pass/testbec12.mod: (New file).
-	* gm2/dynamic/pass/testbec13.mod: (New file).
-	* gm2/dynamic/pass/testbec14.mod: (New file).
-	* gm2/dynamic/pass/testbec15.mod: (New file).
-	* gm2/dynamic/pass/testbec16.mod: (New file).
-	* gm2/dynamic/pass/testbec17.mod: (New file).
-	* gm2/dynamic/pass/testbec18.mod: (New file).
-	* gm2/dynamic/pass/testbec19.mod: (New file).
-	* gm2/dynamic/pass/testbec2.mod: (New file).
-	* gm2/dynamic/pass/testbec20.mod: (New file).
-	* gm2/dynamic/pass/testbec21.mod: (New file).
-	* gm2/dynamic/pass/testbec22.mod: (New file).
-	* gm2/dynamic/pass/testbec23.mod: (New file).
-	* gm2/dynamic/pass/testbec24.mod: (New file).
-	* gm2/dynamic/pass/testbec25.mod: (New file).
-	* gm2/dynamic/pass/testbec26.mod: (New file).
-	* gm2/dynamic/pass/testbec27.mod: (New file).
-	* gm2/dynamic/pass/testbec28.mod: (New file).
-	* gm2/dynamic/pass/testbec29.mod: (New file).
-	* gm2/dynamic/pass/testbec3.mod: (New file).
-	* gm2/dynamic/pass/testbec30.mod: (New file).
-	* gm2/dynamic/pass/testbec31.mod: (New file).
-	* gm2/dynamic/pass/testbec32.mod: (New file).
-	* gm2/dynamic/pass/testbec33.mod: (New file).
-	* gm2/dynamic/pass/testbec34.mod: (New file).
-	* gm2/dynamic/pass/testbec35.mod: (New file).
-	* gm2/dynamic/pass/testbec36.mod: (New file).
-	* gm2/dynamic/pass/testbec37.mod: (New file).
-	* gm2/dynamic/pass/testbec38.mod: (New file).
-	* gm2/dynamic/pass/testbec39.mod: (New file).
-	* gm2/dynamic/pass/testbec4.mod: (New file).
-	* gm2/dynamic/pass/testbec40.mod: (New file).
-	* gm2/dynamic/pass/testbec41.mod: (New file).
-	* gm2/dynamic/pass/testbec42.mod: (New file).
-	* gm2/dynamic/pass/testbec43.mod: (New file).
-	* gm2/dynamic/pass/testbec44.mod: (New file).
-	* gm2/dynamic/pass/testbec45.mod: (New file).
-	* gm2/dynamic/pass/testbec5.mod: (New file).
-	* gm2/dynamic/pass/testbec6.mod: (New file).
-	* gm2/dynamic/pass/testbec7.mod: (New file).
-	* gm2/dynamic/pass/testbec8.mod: (New file).
-	* gm2/dynamic/pass/testbec9.mod: (New file).
-	* gm2/dynamic/pass/testdavid.mod: (New file).
-	* gm2/dynamic/pass/testdiv.mod: (New file).
-	* gm2/dynamic/pass/testexp.mod: (New file).
-	* gm2/dynamic/pass/testfor.mod: (New file).
-	* gm2/dynamic/pass/testfor2.mod: (New file).
-	* gm2/dynamic/pass/testfunc.mod: (New file).
-	* gm2/dynamic/pass/testfunc2.mod: (New file).
-	* gm2/dynamic/pass/testfunc3.mod: (New file).
-	* gm2/dynamic/pass/testfunc4.mod: (New file).
-	* gm2/dynamic/pass/testfunc5.mod: (New file).
-	* gm2/dynamic/pass/testfunc6.mod: (New file).
-	* gm2/dynamic/pass/testif.mod: (New file).
-	* gm2/dynamic/pass/testit.mod: (New file).
-	* gm2/dynamic/pass/testloop.mod: (New file).
-	* gm2/dynamic/pass/testloop2.mod: (New file).
-	* gm2/dynamic/pass/testloop3.mod: (New file).
-	* gm2/dynamic/pass/testloop4.mod: (New file).
-	* gm2/dynamic/pass/testloop5.mod: (New file).
-	* gm2/dynamic/pass/testmin.mod: (New file).
-	* gm2/dynamic/pass/testnum4.mod: (New file).
-	* gm2/dynamic/pass/testord.mod: (New file).
-	* gm2/dynamic/pass/testparam.mod: (New file).
-	* gm2/dynamic/pass/testparam2.mod: (New file).
-	* gm2/dynamic/pass/testproc.mod: (New file).
-	* gm2/dynamic/pass/testproc2.c: (New file).
-	* gm2/dynamic/pass/testproc2.def: (New file).
-	* gm2/dynamic/pass/testproc2.mod: (New file).
-	* gm2/dynamic/pass/testscn.mod: (New file).
-	* gm2/dynamic/pass/testset.mod: (New file).
-	* gm2/dynamic/pass/testset2.mod: (New file).
-	* gm2/dynamic/pass/testset3.mod: (New file).
-	* gm2/dynamic/pass/teststr.c: (New file).
-	* gm2/dynamic/pass/teststr.mod: (New file).
-	* gm2/dynamic/pass/teststr2.mod: (New file).
-	* gm2/dynamic/pass/teststring.mod: (New file).
-	* gm2/dynamic/pass/testunbounded.mod: (New file).
-	* gm2/dynamic/pass/testwith.mod: (New file).
-	* gm2/dynamic/pass/testzero.mod: (New file).
-	* gm2/dynamic/pass/wc.mod: (New file).
-	* gm2/embedded/pass/embedded-pass.exp: (New file).
-	* gm2/embedded/pass/varataddress.mod: (New file).
-	* gm2/embedded/pass/varataddress1.mod: (New file).
-	* gm2/embedded/pass/varataddress2.mod: (New file).
-	* gm2/embedded/pass/varataddress3.mod: (New file).
-	* gm2/errors/fail/array1.mod: (New file).
-	* gm2/errors/fail/badexpr.mod: (New file).
-	* gm2/errors/fail/badfor.mod: (New file).
-	* gm2/errors/fail/badhigh.mod: (New file).
-	* gm2/errors/fail/badshift.mod: (New file).
-	* gm2/errors/fail/badsubexpradr.mod: (New file).
-	* gm2/errors/fail/binaryconst.mod: (New file).
-	* gm2/errors/fail/binarygeneric.mod: (New file).
-	* gm2/errors/fail/binarygenericconst.mod: (New file).
-	* gm2/errors/fail/end.mod: (New file).
-	* gm2/errors/fail/errors-fail.exp: (New file).
-	* gm2/errors/fail/mismatched.mod: (New file).
-	* gm2/errors/fail/mismatchedproc.mod: (New file).
-	* gm2/errors/fail/nestedproc4.mod: (New file).
-	* gm2/errors/fail/nomodule.mod: (New file).
-	* gm2/errors/fail/proctype.mod: (New file).
-	* gm2/errors/fail/prog110.mod: (New file).
-	* gm2/errors/fail/prog111.mod: (New file).
-	* gm2/errors/fail/prog113.mod: (New file).
-	* gm2/errors/fail/prog114.mod: (New file).
-	* gm2/errors/fail/testaddress.mod: (New file).
-	* gm2/errors/fail/testarray.mod: (New file).
-	* gm2/errors/fail/testbit.mod: (New file).
-	* gm2/errors/fail/testbit2.mod: (New file).
-	* gm2/errors/fail/testcase.mod: (New file).
-	* gm2/errors/fail/testcomment.mod: (New file).
-	* gm2/errors/fail/testcomment2.mod: (New file).
-	* gm2/errors/fail/testcomment3.mod: (New file).
-	* gm2/errors/fail/testconst.mod: (New file).
-	* gm2/errors/fail/testdyn.mod: (New file).
-	* gm2/errors/fail/testdyn2.mod: (New file).
-	* gm2/errors/fail/testdyn3.mod: (New file).
-	* gm2/errors/fail/testexp.mod: (New file).
-	* gm2/errors/fail/testfio.mod: (New file).
-	* gm2/errors/fail/testimport.mod: (New file).
-	* gm2/errors/fail/testimport2.def: (New file).
-	* gm2/errors/fail/testimport2.mod: (New file).
-	* gm2/errors/fail/testinit.mod: (New file).
-	* gm2/errors/fail/testmodule.mod: (New file).
-	* gm2/errors/fail/testnil.mod: (New file).
-	* gm2/errors/fail/testnil2.mod: (New file).
-	* gm2/errors/fail/testparam.mod: (New file).
-	* gm2/errors/fail/testproc.mod: (New file).
-	* gm2/errors/fail/testproc2.mod: (New file).
-	* gm2/errors/fail/testsize.mod: (New file).
-	* gm2/errors/fail/teststring.mod: (New file).
-	* gm2/errors/fail/testsub3.mod: (New file).
-	* gm2/errors/fail/testsub4.mod: (New file).
-	* gm2/errors/fail/testtype.mod: (New file).
-	* gm2/errors/fail/testvar.mod: (New file).
-	* gm2/errors/fail/testwith.mod: (New file).
-	* gm2/errors/fail/testwrite.mod: (New file).
-	* gm2/errors/fail/type.mod: (New file).
-	* gm2/errors/fail/unarygeneric.mod: (New file).
-	* gm2/errors/mustfail: (New file).
-	* gm2/errors/options: (New file).
-	* gm2/errors/testchar.mod: (New file).
-	* gm2/errors/testsub2.mod: (New file).
-	* gm2/examples/callingC/pass/examples-callingC-pass.exp: (New file).
-	* gm2/examples/callingC/pass/hello.mod: (New file).
-	* gm2/examples/callingC/pass/libprintf.def: (New file).
-	* gm2/examples/callingC/run/pass/c.c: (New file).
-	* gm2/examples/callingC/run/pass/c.def: (New file).
-	* gm2/examples/callingC/run/pass/examples-callingC-run-pass.exp: (New file).
-	* gm2/examples/callingC/run/pass/hello.mod: (New file).
-	* gm2/examples/callingC/run/pass/libprintf.def: (New file).
-	* gm2/examples/callingC/run/pass/m.mod: (New file).
-	* gm2/examples/cpp/pass/examples-cpp-pass.exp: (New file).
-	* gm2/examples/cpp/pass/hello.mod: (New file).
-	* gm2/examples/cppDef/pass/a.def: (New file).
-	* gm2/examples/cppDef/pass/a.mod: (New file).
-	* gm2/examples/cppDef/pass/b.mod: (New file).
-	* gm2/examples/cppDef/pass/examples-cppDef-pass.exp: (New file).
-	* gm2/examples/cppDef/pass/libprintf.def: (New file).
-	* gm2/examples/hello/pass/examples-hello-pass.exp: (New file).
-	* gm2/examples/hello/pass/hello.mod: (New file).
-	* gm2/examples/map/pass/AdvMap.def: (New file).
-	* gm2/examples/map/pass/AdvMap.mod: (New file).
-	* gm2/examples/map/pass/BoxMap.def: (New file).
-	* gm2/examples/map/pass/BoxMap.mod: (New file).
-	* gm2/examples/map/pass/Chance.def: (New file).
-	* gm2/examples/map/pass/Chance.mod: (New file).
-	* gm2/examples/map/pass/Find.def: (New file).
-	* gm2/examples/map/pass/Find.mod: (New file).
-	* gm2/examples/map/pass/Geometry.def: (New file).
-	* gm2/examples/map/pass/Geometry.mod: (New file).
-	* gm2/examples/map/pass/MakeBoxes.def: (New file).
-	* gm2/examples/map/pass/MakeBoxes.mod: (New file).
-	* gm2/examples/map/pass/Map.mod: (New file).
-	* gm2/examples/map/pass/RoomMap.def: (New file).
-	* gm2/examples/map/pass/RoomMap.mod: (New file).
-	* gm2/examples/map/pass/Semantic.mod: (New file).
-	* gm2/examples/map/pass/StoreCoord.def: (New file).
-	* gm2/examples/map/pass/StoreCoord.mod: (New file).
-	* gm2/examples/map/pass/StoreCoords.def: (New file).
-	* gm2/examples/map/pass/StoreCoords.mod: (New file).
-	* gm2/examples/map/pass/WriteMap.def: (New file).
-	* gm2/examples/map/pass/WriteMap.mod: (New file).
-	* gm2/examples/map/pass/examples-map-pass.exp: (New file).
-	* gm2/examples/map/pass/makemaps: (New file).
-	* gm2/examples/map/pass/testch2.mod: (New file).
-	* gm2/examples/map/pass/testchan.mod: (New file).
-	* gm2/examples/map/pass/testcoor.mod: (New file).
-	* gm2/examples/map/pass/testmaps: (New file).
-	* gm2/exceptions/run/pass/cpp.cpp: (New file).
-	* gm2/exceptions/run/pass/cpp.def: (New file).
-	* gm2/exceptions/run/pass/exceptions-run-pass.exp: (New file).
-	* gm2/exceptions/run/pass/libexcept.mod: (New file).
-	* gm2/exceptions/run/pass/m2test.def: (New file).
-	* gm2/exceptions/run/pass/m2test.mod: (New file).
-	* gm2/exceptions/run/pass/mycpp.cpp: (New file).
-	* gm2/exceptions/run/pass/mycpp.def: (New file).
-	* gm2/exceptions/run/pass/mym2.mod: (New file).
-	* gm2/exceptions/run/pass/mym2a.mod: (New file).
-	* gm2/extensions/pass/align.mod: (New file).
-	* gm2/extensions/pass/align2.mod: (New file).
-	* gm2/extensions/pass/card16p.mod: (New file).
-	* gm2/extensions/pass/card32p.mod: (New file).
-	* gm2/extensions/pass/card64p.mod: (New file).
-	* gm2/extensions/pass/card8p.mod: (New file).
-	* gm2/extensions/pass/co.def: (New file).
-	* gm2/extensions/pass/co.mod: (New file).
-	* gm2/extensions/pass/extensions-pass.exp: (New file).
-	* gm2/extensions/pass/frame.mod: (New file).
-	* gm2/extensions/pass/hello.mod: (New file).
-	* gm2/extensions/pass/int16p.mod: (New file).
-	* gm2/extensions/pass/int32p.mod: (New file).
-	* gm2/extensions/pass/int64p.mod: (New file).
-	* gm2/extensions/pass/int8p.mod: (New file).
-	* gm2/extensions/pass/intsize8.mod: (New file).
-	* gm2/extensions/pass/jmp.mod: (New file).
-	* gm2/extensions/pass/libc.def: (New file).
-	* gm2/extensions/pass/optparam.mod: (New file).
-	* gm2/extensions/pass/optparam2.mod: (New file).
-	* gm2/extensions/pass/return.mod: (New file).
-	* gm2/extensions/pass/set8.mod: (New file).
-	* gm2/extensions/pass/set8a.mod: (New file).
-	* gm2/extensions/pass/set8b.mod: (New file).
-	* gm2/extensions/pass/testco.mod: (New file).
-	* gm2/extensions/run/fail/extensions-run-fail.exp: (New file).
-	* gm2/extensions/run/fail/intsize8.mod: (New file).
-	* gm2/extensions/run/pass/align3.mod: (New file).
-	* gm2/extensions/run/pass/align4.mod: (New file).
-	* gm2/extensions/run/pass/align5.mod: (New file).
-	* gm2/extensions/run/pass/align6.mod: (New file).
-	* gm2/extensions/run/pass/align7.mod: (New file).
-	* gm2/extensions/run/pass/callingc.mod: (New file).
-	* gm2/extensions/run/pass/card16p.mod: (New file).
-	* gm2/extensions/run/pass/card32p.mod: (New file).
-	* gm2/extensions/run/pass/card64p.mod: (New file).
-	* gm2/extensions/run/pass/card8p.mod: (New file).
-	* gm2/extensions/run/pass/column.mod: (New file).
-	* gm2/extensions/run/pass/cvararg.c: (New file).
-	* gm2/extensions/run/pass/cvararg.def: (New file).
-	* gm2/extensions/run/pass/extensions-run-pass.exp: (New file).
-	* gm2/extensions/run/pass/int16p.mod: (New file).
-	* gm2/extensions/run/pass/int32p.mod: (New file).
-	* gm2/extensions/run/pass/int64p.mod: (New file).
-	* gm2/extensions/run/pass/int8field.mod: (New file).
-	* gm2/extensions/run/pass/int8p.mod: (New file).
-	* gm2/extensions/run/pass/packedrecord.mod: (New file).
-	* gm2/extensions/run/pass/packedrecord2.mod: (New file).
-	* gm2/extensions/run/pass/real32.mod: (New file).
-	* gm2/extensions/run/pass/real32a.mod: (New file).
-	* gm2/extensions/run/pass/record.mod: (New file).
-	* gm2/extensions/run/pass/testopen.mod: (New file).
-	* gm2/extensions/run/pass/vararg.mod: (New file).
-	* gm2/extensions/run/pass/vararg2.mod: (New file).
-	* gm2/extensions/run/pass/vararg3.mod: (New file).
-	* gm2/fpu/pass/five.mod: (New file).
-	* gm2/fpu/pass/fp.def: (New file).
-	* gm2/fpu/pass/fp.mod: (New file).
-	* gm2/fpu/pass/fpu-pass.exp: (New file).
-	* gm2/fpu/pass/one.mod: (New file).
-	* gm2/fpu/pass/r1.mod: (New file).
-	* gm2/fpu/pass/realconst.mod: (New file).
-	* gm2/fpu/pass/testfp.mod: (New file).
-	* gm2/fpu/pass/testfp2.mod: (New file).
-	* gm2/fpu/pass/testfpu1.mod: (New file).
-	* gm2/fpu/pass/testfpu2.mod: (New file).
-	* gm2/fpu/pass/testfpu3.mod: (New file).
-	* gm2/fpu/pass/testsin.mod: (New file).
-	* gm2/imports/run/pass/c.def: (New file).
-	* gm2/imports/run/pass/c.mod: (New file).
-	* gm2/imports/run/pass/imports-run-pass.exp: (New file).
-	* gm2/imports/run/pass/innermods.mod: (New file).
-	* gm2/imports/run/pass/innermods2.mod: (New file).
-	* gm2/imports/run/pass/innermods3.mod: (New file).
-	* gm2/imports/run/pass/innermods4.mod: (New file).
-	* gm2/imports/run/pass/innermods5.def: (New file).
-	* gm2/imports/run/pass/innermods5.mod: (New file).
-	* gm2/imports/run/pass/innermods6.mod: (New file).
-	* gm2/integer/div.mod: (New file).
-	* gm2/integer/expr.mod: (New file).
-	* gm2/integer/mod.mod: (New file).
-	* gm2/integer/mod2.mod: (New file).
-	* gm2/integer/one.mod: (New file).
-	* gm2/integer/options: (New file).
-	* gm2/integer/zero.mod: (New file).
-	* gm2/iso/analysis/fail/Makefile: (New file).
-	* gm2/iso/analysis/fail/arithoverflow.mod: (New file).
-	* gm2/iso/analysis/fail/arithoverflow2.mod: (New file).
-	* gm2/iso/analysis/fail/arithsubcard.mod: (New file).
-	* gm2/iso/analysis/fail/arrayrange.mod: (New file).
-	* gm2/iso/analysis/fail/assignvalue.mod: (New file).
-	* gm2/iso/analysis/fail/callassignment.mod: (New file).
-	* gm2/iso/analysis/fail/callassignment2.mod: (New file).
-	* gm2/iso/analysis/fail/callassignment3.mod: (New file).
-	* gm2/iso/analysis/fail/callassignment4.mod: (New file).
-	* gm2/iso/analysis/fail/caserange.mod: (New file).
-	* gm2/iso/analysis/fail/decvalue.mod: (New file).
-	* gm2/iso/analysis/fail/forloop.mod: (New file).
-	* gm2/iso/analysis/fail/incvalue.mod: (New file).
-	* gm2/iso/analysis/fail/iso-analysis-fail.exp: (New file).
-	* gm2/iso/analysis/fail/noreturn.mod: (New file).
-	* gm2/iso/analysis/fail/returnvalue.mod: (New file).
-	* gm2/iso/analysis/fail/staticarray.mod: (New file).
-	* gm2/iso/check/fail/iso-check-fail.exp: (New file).
-	* gm2/iso/check/fail/modulusoverflow.mod: (New file).
-	* gm2/iso/fail/badarray.mod: (New file).
-	* gm2/iso/fail/badarray2.mod: (New file).
-	* gm2/iso/fail/badipv4.mod: (New file).
-	* gm2/iso/fail/bug10.mod: (New file).
-	* gm2/iso/fail/bug8.mod: (New file).
-	* gm2/iso/fail/bug9.mod: (New file).
-	* gm2/iso/fail/case.mod: (New file).
-	* gm2/iso/fail/case2.mod: (New file).
-	* gm2/iso/fail/case3.mod: (New file).
-	* gm2/iso/fail/const1.mod: (New file).
-	* gm2/iso/fail/constarray.mod: (New file).
-	* gm2/iso/fail/constarray2.mod: (New file).
-	* gm2/iso/fail/constprocedure.mod: (New file).
-	* gm2/iso/fail/constrecord.mod: (New file).
-	* gm2/iso/fail/constrecord2.mod: (New file).
-	* gm2/iso/fail/constrecord3.mod: (New file).
-	* gm2/iso/fail/constsubrange.mod: (New file).
-	* gm2/iso/fail/constsubrange2.mod: (New file).
-	* gm2/iso/fail/constsubrange3.mod: (New file).
-	* gm2/iso/fail/defa.def: (New file).
-	* gm2/iso/fail/defa.mod: (New file).
-	* gm2/iso/fail/defb.def: (New file).
-	* gm2/iso/fail/defb.mod: (New file).
-	* gm2/iso/fail/defc.def: (New file).
-	* gm2/iso/fail/defc.mod: (New file).
-	* gm2/iso/fail/except.mod: (New file).
-	* gm2/iso/fail/except2.mod: (New file).
-	* gm2/iso/fail/iso-fail.exp: (New file).
-	* gm2/iso/fail/isoa.def: (New file).
-	* gm2/iso/fail/isoa.mod: (New file).
-	* gm2/iso/fail/lengthsubexpr.mod: (New file).
-	* gm2/iso/fail/proc.mod: (New file).
-	* gm2/iso/fail/realbitscast.mod: (New file).
-	* gm2/iso/fail/varient.mod: (New file).
-	* gm2/iso/fail/varient2.mod: (New file).
-	* gm2/iso/future/builtinlj.mod: (New file).
-	* gm2/iso/pass/ChanConsts.def: (New file).
-	* gm2/iso/pass/ChanConsts.mod: (New file).
-	* gm2/iso/pass/ConvTypes.def: (New file).
-	* gm2/iso/pass/ConvTypes.mod: (New file).
-	* gm2/iso/pass/addadr1.mod: (New file).
-	* gm2/iso/pass/bits32c.mod: (New file).
-	* gm2/iso/pass/callwraptime.mod: (New file).
-	* gm2/iso/pass/caseiso.mod: (New file).
-	* gm2/iso/pass/caseiso2.mod: (New file).
-	* gm2/iso/pass/cast.mod: (New file).
-	* gm2/iso/pass/cast3.mod: (New file).
-	* gm2/iso/pass/castiso.mod: (New file).
-	* gm2/iso/pass/const1.mod: (New file).
-	* gm2/iso/pass/constreal.mod: (New file).
-	* gm2/iso/pass/constructor1.mod: (New file).
-	* gm2/iso/pass/constructor2.mod: (New file).
-	* gm2/iso/pass/constructor3.mod: (New file).
-	* gm2/iso/pass/constructor4.mod: (New file).
-	* gm2/iso/pass/constructor5.mod: (New file).
-	* gm2/iso/pass/constructor6.mod: (New file).
-	* gm2/iso/pass/constsize4.mod: (New file).
-	* gm2/iso/pass/delim.mod: (New file).
-	* gm2/iso/pass/delim2.mod: (New file).
-	* gm2/iso/pass/enummodule.mod: (New file).
-	* gm2/iso/pass/except1.mod: (New file).
-	* gm2/iso/pass/expproc.mod: (New file).
-	* gm2/iso/pass/expproc2.mod: (New file).
-	* gm2/iso/pass/iso-pass.exp: (New file).
-	* gm2/iso/pass/isob.def: (New file).
-	* gm2/iso/pass/isob.mod: (New file).
-	* gm2/iso/pass/isobitset.mod: (New file).
-	* gm2/iso/pass/isobitset2.mod: (New file).
-	* gm2/iso/pass/longm.mod: (New file).
-	* gm2/iso/pass/m.mod: (New file).
-	* gm2/iso/pass/proccast.mod: (New file).
-	* gm2/iso/pass/realbitscast.mod: (New file).
-	* gm2/iso/pass/set12.mod: (New file).
-	* gm2/iso/pass/stringchar.mod: (New file).
-	* gm2/iso/pass/subassign.mod: (New file).
-	* gm2/iso/pass/testaddindr.mod: (New file).
-	* gm2/iso/pass/testconv.def: (New file).
-	* gm2/iso/pass/testconv.mod: (New file).
-	* gm2/iso/pass/testconv2.def: (New file).
-	* gm2/iso/pass/testconv2.mod: (New file).
-	* gm2/iso/pass/testconv3.mod: (New file).
-	* gm2/iso/pass/testconv4.mod: (New file).
-	* gm2/iso/pass/testconv5.mod: (New file).
-	* gm2/iso/pass/testconv6.mod: (New file).
-	* gm2/iso/pass/testconv7.mod: (New file).
-	* gm2/iso/pass/testconv8.mod: (New file).
-	* gm2/iso/pass/testconv9.mod: (New file).
-	* gm2/iso/pass/testiso.mod: (New file).
-	* gm2/iso/pass/testiso2.mod: (New file).
-	* gm2/iso/pass/testisosize.mod: (New file).
-	* gm2/iso/pass/testlength.mod: (New file).
-	* gm2/iso/pass/testlength2.mod: (New file).
-	* gm2/iso/pass/testlength3.mod: (New file).
-	* gm2/iso/pass/testlength4.mod: (New file).
-	* gm2/iso/pass/testlength5.mod: (New file).
-	* gm2/iso/pass/unbounded.mod: (New file).
-	* gm2/iso/pass/unbounded2.mod: (New file).
-	* gm2/iso/run/pass/adraddress.mod: (New file).
-	* gm2/iso/run/pass/adrunbounded3.mod: (New file).
-	* gm2/iso/run/pass/baseimport.mod: (New file).
-	* gm2/iso/run/pass/compsize.mod: (New file).
-	* gm2/iso/run/pass/concurrentstore.mod: (New file).
-	* gm2/iso/run/pass/constprocedure.mod: (New file).
-	* gm2/iso/run/pass/constructor1.mod: (New file).
-	* gm2/iso/run/pass/constructor2.mod: (New file).
-	* gm2/iso/run/pass/conststrarray.mod: (New file).
-	* gm2/iso/run/pass/contimer.mod: (New file).
-	* gm2/iso/run/pass/except.c: (New file).
-	* gm2/iso/run/pass/except2.mod: (New file).
-	* gm2/iso/run/pass/except3.cpp: (New file).
-	* gm2/iso/run/pass/except4.mod: (New file).
-	* gm2/iso/run/pass/except5.cpp: (New file).
-	* gm2/iso/run/pass/except5.mod: (New file).
-	* gm2/iso/run/pass/except6.cpp: (New file).
-	* gm2/iso/run/pass/except7.mod: (New file).
-	* gm2/iso/run/pass/except8.mod: (New file).
-	* gm2/iso/run/pass/fileio.def: (New file).
-	* gm2/iso/run/pass/fileio.mod: (New file).
-	* gm2/iso/run/pass/hello.mod: (New file).
-	* gm2/iso/run/pass/int8field.mod: (New file).
-	* gm2/iso/run/pass/iso-run-pass.exp: (New file).
-	* gm2/iso/run/pass/long.mod: (New file).
-	* gm2/iso/run/pass/long2.mod: (New file).
-	* gm2/iso/run/pass/long3.mod: (New file).
-	* gm2/iso/run/pass/long4.c: (New file).
-	* gm2/iso/run/pass/long4.mod: (New file).
-	* gm2/iso/run/pass/minmax.mod: (New file).
-	* gm2/iso/run/pass/modulus.mod: (New file).
-	* gm2/iso/run/pass/nestediso.mod: (New file).
-	* gm2/iso/run/pass/nestedrecord.mod: (New file).
-	* gm2/iso/run/pass/onebyte.mod: (New file).
-	* gm2/iso/run/pass/onebyte2.mod: (New file).
-	* gm2/iso/run/pass/onebyte3.mod: (New file).
-	* gm2/iso/run/pass/packed.mod: (New file).
-	* gm2/iso/run/pass/proc.c: (New file).
-	* gm2/iso/run/pass/proc.mod: (New file).
-	* gm2/iso/run/pass/proc2.mod: (New file).
-	* gm2/iso/run/pass/returnrecord.mod: (New file).
-	* gm2/iso/run/pass/shift.mod: (New file).
-	* gm2/iso/run/pass/shift2.mod: (New file).
-	* gm2/iso/run/pass/shift3.mod: (New file).
-	* gm2/iso/run/pass/shift4.mod: (New file).
-	* gm2/iso/run/pass/simple: (New file).
-	* gm2/iso/run/pass/simplelarge.mod: (New file).
-	* gm2/iso/run/pass/strcons.mod: (New file).
-	* gm2/iso/run/pass/strcons2.mod: (New file).
-	* gm2/iso/run/pass/t.cpp: (New file).
-	* gm2/iso/run/pass/t1.cpp: (New file).
-	* gm2/iso/run/pass/testLength.mod: (New file).
-	* gm2/iso/run/pass/testarray.mod: (New file).
-	* gm2/iso/run/pass/testgeneric.mod: (New file).
-	* gm2/iso/run/pass/testlarge.mod: (New file).
-	* gm2/iso/run/pass/testsystem.mod: (New file).
-	* gm2/iso/run/pass/tinyconst.mod: (New file).
-	* gm2/iso/run/pass/tinyconst2.mod: (New file).
-	* gm2/iso/run/pass/tinyconst3.mod: (New file).
-	* gm2/iso/run/pass/tinyconst4.mod: (New file).
-	* gm2/iso/run/pass/tinyconst5.mod: (New file).
-	* gm2/iso/run/pass/tinytimer.mod: (New file).
-	* gm2/iso/run/pass/trivialmodulus.mod: (New file).
-	* gm2/iso/run/pass/tsize.mod: (New file).
-	* gm2/iso/run/pass/tsize2.mod: (New file).
-	* gm2/iso/run/pass/tstLength.mod: (New file).
-	* gm2/iso/run/pass/unbounded.mod: (New file).
-	* gm2/iso/run/pass/unbounded2.mod: (New file).
-	* gm2/iso/run/pass/unbounded3.mod: (New file).
-	* gm2/iso/run/pass/unbounded4.mod: (New file).
-	* gm2/iso/run/pass/unbounded5.mod: (New file).
-	* gm2/iso/run/pass/unbounded6.mod: (New file).
-	* gm2/iso/run/pass/unbounded7.mod: (New file).
-	* gm2/iso/run/pass/unbounded8.mod: (New file).
-	* gm2/isocoroutines/run/pass/coroutine.mod: (New file).
-	* gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp: (New file).
-	* gm2/isolib/run/pass/arraycons.mod: (New file).
-	* gm2/isolib/run/pass/arraycons2.mod: (New file).
-	* gm2/isolib/run/pass/arraycons3.mod: (New file).
-	* gm2/isolib/run/pass/arraycons5.mod: (New file).
-	* gm2/isolib/run/pass/arraycons6.mod: (New file).
-	* gm2/isolib/run/pass/arraycons7.mod: (New file).
-	* gm2/isolib/run/pass/arrayconst8.mod: (New file).
-	* gm2/isolib/run/pass/exceptiontest.mod: (New file).
-	* gm2/isolib/run/pass/filepos.mod: (New file).
-	* gm2/isolib/run/pass/hello.mod: (New file).
-	* gm2/isolib/run/pass/insert.mod: (New file).
-	* gm2/isolib/run/pass/intconv.mod: (New file).
-	* gm2/isolib/run/pass/isolib-run-pass.exp: (New file).
-	* gm2/isolib/run/pass/longstr.mod: (New file).
-	* gm2/isolib/run/pass/openlibc.mod: (New file).
-	* gm2/isolib/run/pass/raise.mod: (New file).
-	* gm2/isolib/run/pass/raise2.mod: (New file).
-	* gm2/isolib/run/pass/readreal.mod: (New file).
-	* gm2/isolib/run/pass/real1.mod: (New file).
-	* gm2/isolib/run/pass/real2.mod: (New file).
-	* gm2/isolib/run/pass/real3.mod: (New file).
-	* gm2/isolib/run/pass/realconv.mod: (New file).
-	* gm2/isolib/run/pass/realconv2.mod: (New file).
-	* gm2/isolib/run/pass/realstr.mod: (New file).
-	* gm2/isolib/run/pass/sigfig.mod: (New file).
-	* gm2/isolib/run/pass/stringreal2.mod: (New file).
-	* gm2/isolib/run/pass/termfile.mod-disabled: (New file).
-	* gm2/isolib/run/pass/testappend.mod: (New file).
-	* gm2/isolib/run/pass/testinput: (New file).
-	* gm2/isolib/run/pass/testio.mod: (New file).
-	* gm2/isolib/run/pass/testio2.mod: (New file).
-	* gm2/isolib/run/pass/testmem.mod: (New file).
-	* gm2/isolib/run/pass/testmem2.mod: (New file).
-	* gm2/isolib/run/pass/testnumber: (New file).
-	* gm2/isolib/run/pass/tiny.mod: (New file).
-	* gm2/isolib/run/pass/tiny2.mod: (New file).
-	* gm2/isolib/run/pass/tiny3.mod: (New file).
-	* gm2/isolib/run/pass/tiny4.mod: (New file).
-	* gm2/isolib/run/pass/tiny5.mod: (New file).
-	* gm2/libs/a.def: (New file).
-	* gm2/libs/a.mod: (New file).
-	* gm2/libs/b.def: (New file).
-	* gm2/libs/b.mod: (New file).
-	* gm2/libs/testraw.mod: (New file).
-	* gm2/link/externalscaffold/pass/hello.mod: (New file).
-	* gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: (New file).
-	* gm2/link/externalscaffold/pass/scaffold.c: (New file).
-	* gm2/link/pim/fail/import.mod: (New file).
-	* gm2/link/pim/fail/link-pim-fail.exp: (New file).
-	* gm2/link/pim/pass/link-pim-pass.exp: (New file).
-	* gm2/link/pimc/pass/README: (New file).
-	* gm2/link/pimc/pass/link-pimc-pass.exp: (New file).
-	* gm2/link/pimc/pass/testdtoa.mod: (New file).
-	* gm2/link/pimc/pass/testerrno.mod: (New file).
-	* gm2/link/pimc/pass/testgetopt.mod: (New file).
-	* gm2/link/pimc/pass/testldtoa.mod: (New file).
-	* gm2/link/pimc/pass/testlibc.mod: (New file).
-	* gm2/link/pimc/pass/testlibc2.mod: (New file).
-	* gm2/link/pimc/pass/testsckt.mod: (New file).
-	* gm2/link/pimc/pass/testselective.mod: (New file).
-	* gm2/link/pimc/pass/testsysexceptions.mod: (New file).
-	* gm2/link/pimc/pass/testtermios.mod: (New file).
-	* gm2/link/pimc/pass/testunixargs.mod: (New file).
-	* gm2/link/pimc/pass/testwrapc.mod: (New file).
-	* gm2/linking/libarchive/pass/c.c: (New file).
-	* gm2/linking/libarchive/pass/c.def: (New file).
-	* gm2/linking/libarchive/pass/d.def: (New file).
-	* gm2/linking/libarchive/pass/e.def: (New file).
-	* gm2/linking/libarchive/pass/linking-libarchive-pass.exp: (New file).
-	* gm2/linking/libarchive/pass/m.mod: (New file).
-	* gm2/linking/verbose/pass/hello.mod: (New file).
-	* gm2/linking/verbose/pass/linking-verbose-pass.exp: (New file).
-	* gm2/pim/fail/TestLong3.mod: (New file).
-	* gm2/pim/fail/TestLong6.mod: (New file).
-	* gm2/pim/fail/a.def: (New file).
-	* gm2/pim/fail/assignbounds.mod: (New file).
-	* gm2/pim/fail/assignsubrange.mod: (New file).
-	* gm2/pim/fail/assignsubrange2.mod: (New file).
-	* gm2/pim/fail/b.def: (New file).
-	* gm2/pim/fail/bad.def: (New file).
-	* gm2/pim/fail/badconst.mod: (New file).
-	* gm2/pim/fail/badfunc.mod: (New file).
-	* gm2/pim/fail/badparam.mod: (New file).
-	* gm2/pim/fail/badparam2.mod: (New file).
-	* gm2/pim/fail/badtype.mod: (New file).
-	* gm2/pim/fail/badtypes.mod: (New file).
-	* gm2/pim/fail/bits.mod: (New file).
-	* gm2/pim/fail/bits2.mod: (New file).
-	* gm2/pim/fail/bits3.mod: (New file).
-	* gm2/pim/fail/bits4.mod: (New file).
-	* gm2/pim/fail/cardword.mod: (New file).
-	* gm2/pim/fail/constbec.mod: (New file).
-	* gm2/pim/fail/constsize3.mod: (New file).
-	* gm2/pim/fail/constvar.mod: (New file).
-	* gm2/pim/fail/convert5.mod: (New file).
-	* gm2/pim/fail/dupconst.mod: (New file).
-	* gm2/pim/fail/dupenum.mod: (New file).
-	* gm2/pim/fail/dupfield.mod: (New file).
-	* gm2/pim/fail/duptype.mod: (New file).
-	* gm2/pim/fail/dupvar.mod: (New file).
-	* gm2/pim/fail/expression.mod: (New file).
-	* gm2/pim/fail/expression2.mod: (New file).
-	* gm2/pim/fail/expression3.mod: (New file).
-	* gm2/pim/fail/func.mod: (New file).
-	* gm2/pim/fail/good.def: (New file).
-	* gm2/pim/fail/good.mod: (New file).
-	* gm2/pim/fail/import.mod: (New file).
-	* gm2/pim/fail/inserttok.def: (New file).
-	* gm2/pim/fail/inserttok.mod: (New file).
-	* gm2/pim/fail/integer.mod: (New file).
-	* gm2/pim/fail/keyword.mod: (New file).
-	* gm2/pim/fail/longtypes2.mod: (New file).
-	* gm2/pim/fail/longtypes3.mod: (New file).
-	* gm2/pim/fail/multisetf.mod: (New file).
-	* gm2/pim/fail/nested3.mod: (New file).
-	* gm2/pim/fail/opaque.mod: (New file).
-	* gm2/pim/fail/opaque2.mod: (New file).
-	* gm2/pim/fail/opasfail.mod: (New file).
-	* gm2/pim/fail/opcpfail.mod: (New file).
-	* gm2/pim/fail/pim-fail.exp: (New file).
-	* gm2/pim/fail/procmod.mod: (New file).
-	* gm2/pim/fail/rotate.mod: (New file).
-	* gm2/pim/fail/rotate2.mod: (New file).
-	* gm2/pim/fail/setbec.mod: (New file).
-	* gm2/pim/fail/setequiv.mod: (New file).
-	* gm2/pim/fail/setsnulf.mod: (New file).
-	* gm2/pim/fail/settype.mod: (New file).
-	* gm2/pim/fail/shift.mod: (New file).
-	* gm2/pim/fail/shift2.mod: (New file).
-	* gm2/pim/fail/subrange7.mod: (New file).
-	* gm2/pim/fail/unary.mod: (New file).
-	* gm2/pim/fail/undeclared.mod: (New file).
-	* gm2/pim/fail/val.mod: (New file).
-	* gm2/pim/fail/val2.mod: (New file).
-	* gm2/pim/fail/wordconst.mod: (New file).
-	* gm2/pim/no-options/run/pass/integer.mod: (New file).
-	* gm2/pim/no-options/run/pass/pim-no-options-run-pass.exp: (New file).
-	* gm2/pim/options/bounds/fail/IdentifierBug.mod: (New file).
-	* gm2/pim/options/bounds/fail/pim-options-bounds-fail.exp: (New file).
-	* gm2/pim/options/optimize/run/pass/addition.def: (New file).
-	* gm2/pim/options/optimize/run/pass/addition.mod: (New file).
-	* gm2/pim/options/optimize/run/pass/concat.mod: (New file).
+	New file.
+	* gm2/calling-c/datatypes/unbounded/run/pass/m.mod: New file.
+	* gm2/case/pass/case-pass.exp: New file.
+	* gm2/case/pass/testcase1.mod: New file.
+	* gm2/case/pass/testcase2.mod: New file.
+	* gm2/case/pass/testcase3.mod: New file.
+	* gm2/case/pass/testcase4.mod: New file.
+	* gm2/complex/fail/var1.mod: New file.
+	* gm2/complex/pass/arith.mod: New file.
+	* gm2/complex/pass/arith2.mod: New file.
+	* gm2/complex/pass/arith3.mod: New file.
+	* gm2/complex/pass/arith4.mod: New file.
+	* gm2/complex/pass/arith5.mod: New file.
+	* gm2/complex/pass/arith6.mod: New file.
+	* gm2/complex/pass/complex-pass.exp: New file.
+	* gm2/complex/pass/consts.mod: New file.
+	* gm2/complex/pass/consts2.mod: New file.
+	* gm2/complex/pass/consts3.mod: New file.
+	* gm2/complex/pass/tinycabs.mod: New file.
+	* gm2/complex/pass/var1.mod: New file.
+	* gm2/complex/pass/var2.mod: New file.
+	* gm2/complex/pass/var3.mod: New file.
+	* gm2/complex/pass/var4.mod: New file.
+	* gm2/complex/pass/var5.mod: New file.
+	* gm2/complex/pass/var6.mod: New file.
+	* gm2/complex/pass/var7.mod: New file.
+	* gm2/complex/pass/var8.mod: New file.
+	* gm2/complex/run/pass/arith3.mod: New file.
+	* gm2/complex/run/pass/arith4.mod: New file.
+	* gm2/complex/run/pass/arith5.mod: New file.
+	* gm2/complex/run/pass/arith6.mod: New file.
+	* gm2/complex/run/pass/arith7.mod: New file.
+	* gm2/complex/run/pass/arith8.mod: New file.
+	* gm2/complex/run/pass/complex-run-pass.exp: New file.
+	* gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp: New file.
+	* gm2/coroutines/pim/run/pass/testiotransfer.mod: New file.
+	* gm2/coroutines/pim/run/pass/testtransfer.mod: New file.
+	* gm2/cpp/fail/another.h: New file.
+	* gm2/cpp/fail/fail1.mod: New file.
+	* gm2/cpp/longcard2.mod: New file.
+	* gm2/cpp/longstrimp.mod: New file.
+	* gm2/cpp/pass/arrayhuge.mod: New file.
+	* gm2/cpp/pass/arrayhuge2.mod: New file.
+	* gm2/cpp/pass/cpp-pass.exp: New file.
+	* gm2/cpp/pass/cpp.mod: New file.
+	* gm2/cpp/pass/cpph.mod: New file.
+	* gm2/cpp/pass/subaddr.mod: New file.
+	* gm2/cpp/pass/testcpp.mod: New file.
+	* gm2/cpp/pass/testcpp2.mod: New file.
+	* gm2/cpp/setchar2.mod: New file.
+	* gm2/cpp/setchar6.mod: New file.
+	* gm2/cse/fail/cse-fail.exp: New file.
+	* gm2/cse/fail/testcse38.mod: New file.
+	* gm2/cse/pass/cse-pass.exp: New file.
+	* gm2/cse/pass/m2t.c: New file.
+	* gm2/cse/pass/testb.mod: New file.
+	* gm2/cse/pass/testbuiltin.def: New file.
+	* gm2/cse/pass/testbuiltin.mod: New file.
+	* gm2/cse/pass/testcse.def: New file.
+	* gm2/cse/pass/testcse.mod: New file.
+	* gm2/cse/pass/testcse10.mod: New file.
+	* gm2/cse/pass/testcse11.mod: New file.
+	* gm2/cse/pass/testcse12.mod: New file.
+	* gm2/cse/pass/testcse13.mod: New file.
+	* gm2/cse/pass/testcse14.mod: New file.
+	* gm2/cse/pass/testcse15.mod: New file.
+	* gm2/cse/pass/testcse16.mod: New file.
+	* gm2/cse/pass/testcse17.mod: New file.
+	* gm2/cse/pass/testcse18.mod: New file.
+	* gm2/cse/pass/testcse19.mod: New file.
+	* gm2/cse/pass/testcse2.mod: New file.
+	* gm2/cse/pass/testcse20.mod: New file.
+	* gm2/cse/pass/testcse21.mod: New file.
+	* gm2/cse/pass/testcse22.mod: New file.
+	* gm2/cse/pass/testcse23.mod: New file.
+	* gm2/cse/pass/testcse24.mod: New file.
+	* gm2/cse/pass/testcse25.mod: New file.
+	* gm2/cse/pass/testcse26.mod: New file.
+	* gm2/cse/pass/testcse27.mod: New file.
+	* gm2/cse/pass/testcse28.mod: New file.
+	* gm2/cse/pass/testcse29.mod: New file.
+	* gm2/cse/pass/testcse3.mod: New file.
+	* gm2/cse/pass/testcse31.mod: New file.
+	* gm2/cse/pass/testcse32.mod: New file.
+	* gm2/cse/pass/testcse33.mod: New file.
+	* gm2/cse/pass/testcse34.mod: New file.
+	* gm2/cse/pass/testcse35.mod: New file.
+	* gm2/cse/pass/testcse36.mod: New file.
+	* gm2/cse/pass/testcse37.mod: New file.
+	* gm2/cse/pass/testcse39.mod: New file.
+	* gm2/cse/pass/testcse4.c: New file.
+	* gm2/cse/pass/testcse4.mod: New file.
+	* gm2/cse/pass/testcse40.mod: New file.
+	* gm2/cse/pass/testcse41.mod: New file.
+	* gm2/cse/pass/testcse42.mod: New file.
+	* gm2/cse/pass/testcse43.mod: New file.
+	* gm2/cse/pass/testcse44.mod: New file.
+	* gm2/cse/pass/testcse45.mod: New file.
+	* gm2/cse/pass/testcse46.mod: New file.
+	* gm2/cse/pass/testcse47.mod: New file.
+	* gm2/cse/pass/testcse48.mod: New file.
+	* gm2/cse/pass/testcse49.mod: New file.
+	* gm2/cse/pass/testcse5.c: New file.
+	* gm2/cse/pass/testcse5.mod: New file.
+	* gm2/cse/pass/testcse50.def: New file.
+	* gm2/cse/pass/testcse50.mod: New file.
+	* gm2/cse/pass/testcse51.mod: New file.
+	* gm2/cse/pass/testcse52.def: New file.
+	* gm2/cse/pass/testcse52.mod: New file.
+	* gm2/cse/pass/testcse53.def: New file.
+	* gm2/cse/pass/testcse53.mod: New file.
+	* gm2/cse/pass/testcse6.c: New file.
+	* gm2/cse/pass/testcse6.mod: New file.
+	* gm2/cse/pass/testcse7.c: New file.
+	* gm2/cse/pass/testcse7.mod: New file.
+	* gm2/cse/pass/testcse8.c: New file.
+	* gm2/cse/pass/testcse8.mod: New file.
+	* gm2/cse/pass/testcse9.c: New file.
+	* gm2/cse/pass/testsize.mod: New file.
+	* gm2/dynamic/pass/add.mod: New file.
+	* gm2/dynamic/pass/dynamic-pass.exp: New file.
+	* gm2/dynamic/pass/prog21.mod: New file.
+	* gm2/dynamic/pass/testarray.mod: New file.
+	* gm2/dynamic/pass/testarray2.mod: New file.
+	* gm2/dynamic/pass/testarray3.mod: New file.
+	* gm2/dynamic/pass/testarray4.mod: New file.
+	* gm2/dynamic/pass/testarray6.mod: New file.
+	* gm2/dynamic/pass/testbec.mod: New file.
+	* gm2/dynamic/pass/testbec10.mod: New file.
+	* gm2/dynamic/pass/testbec11.mod: New file.
+	* gm2/dynamic/pass/testbec12.mod: New file.
+	* gm2/dynamic/pass/testbec13.mod: New file.
+	* gm2/dynamic/pass/testbec14.mod: New file.
+	* gm2/dynamic/pass/testbec15.mod: New file.
+	* gm2/dynamic/pass/testbec16.mod: New file.
+	* gm2/dynamic/pass/testbec17.mod: New file.
+	* gm2/dynamic/pass/testbec18.mod: New file.
+	* gm2/dynamic/pass/testbec19.mod: New file.
+	* gm2/dynamic/pass/testbec2.mod: New file.
+	* gm2/dynamic/pass/testbec20.mod: New file.
+	* gm2/dynamic/pass/testbec21.mod: New file.
+	* gm2/dynamic/pass/testbec22.mod: New file.
+	* gm2/dynamic/pass/testbec23.mod: New file.
+	* gm2/dynamic/pass/testbec24.mod: New file.
+	* gm2/dynamic/pass/testbec25.mod: New file.
+	* gm2/dynamic/pass/testbec26.mod: New file.
+	* gm2/dynamic/pass/testbec27.mod: New file.
+	* gm2/dynamic/pass/testbec28.mod: New file.
+	* gm2/dynamic/pass/testbec29.mod: New file.
+	* gm2/dynamic/pass/testbec3.mod: New file.
+	* gm2/dynamic/pass/testbec30.mod: New file.
+	* gm2/dynamic/pass/testbec31.mod: New file.
+	* gm2/dynamic/pass/testbec32.mod: New file.
+	* gm2/dynamic/pass/testbec33.mod: New file.
+	* gm2/dynamic/pass/testbec34.mod: New file.
+	* gm2/dynamic/pass/testbec35.mod: New file.
+	* gm2/dynamic/pass/testbec36.mod: New file.
+	* gm2/dynamic/pass/testbec37.mod: New file.
+	* gm2/dynamic/pass/testbec38.mod: New file.
+	* gm2/dynamic/pass/testbec39.mod: New file.
+	* gm2/dynamic/pass/testbec4.mod: New file.
+	* gm2/dynamic/pass/testbec40.mod: New file.
+	* gm2/dynamic/pass/testbec41.mod: New file.
+	* gm2/dynamic/pass/testbec42.mod: New file.
+	* gm2/dynamic/pass/testbec43.mod: New file.
+	* gm2/dynamic/pass/testbec44.mod: New file.
+	* gm2/dynamic/pass/testbec45.mod: New file.
+	* gm2/dynamic/pass/testbec5.mod: New file.
+	* gm2/dynamic/pass/testbec6.mod: New file.
+	* gm2/dynamic/pass/testbec7.mod: New file.
+	* gm2/dynamic/pass/testbec8.mod: New file.
+	* gm2/dynamic/pass/testbec9.mod: New file.
+	* gm2/dynamic/pass/testdavid.mod: New file.
+	* gm2/dynamic/pass/testdiv.mod: New file.
+	* gm2/dynamic/pass/testexp.mod: New file.
+	* gm2/dynamic/pass/testfor.mod: New file.
+	* gm2/dynamic/pass/testfor2.mod: New file.
+	* gm2/dynamic/pass/testfunc.mod: New file.
+	* gm2/dynamic/pass/testfunc2.mod: New file.
+	* gm2/dynamic/pass/testfunc3.mod: New file.
+	* gm2/dynamic/pass/testfunc4.mod: New file.
+	* gm2/dynamic/pass/testfunc5.mod: New file.
+	* gm2/dynamic/pass/testfunc6.mod: New file.
+	* gm2/dynamic/pass/testif.mod: New file.
+	* gm2/dynamic/pass/testit.mod: New file.
+	* gm2/dynamic/pass/testloop.mod: New file.
+	* gm2/dynamic/pass/testloop2.mod: New file.
+	* gm2/dynamic/pass/testloop3.mod: New file.
+	* gm2/dynamic/pass/testloop4.mod: New file.
+	* gm2/dynamic/pass/testloop5.mod: New file.
+	* gm2/dynamic/pass/testmin.mod: New file.
+	* gm2/dynamic/pass/testnum4.mod: New file.
+	* gm2/dynamic/pass/testord.mod: New file.
+	* gm2/dynamic/pass/testparam.mod: New file.
+	* gm2/dynamic/pass/testparam2.mod: New file.
+	* gm2/dynamic/pass/testproc.mod: New file.
+	* gm2/dynamic/pass/testproc2.c: New file.
+	* gm2/dynamic/pass/testproc2.def: New file.
+	* gm2/dynamic/pass/testproc2.mod: New file.
+	* gm2/dynamic/pass/testscn.mod: New file.
+	* gm2/dynamic/pass/testset.mod: New file.
+	* gm2/dynamic/pass/testset2.mod: New file.
+	* gm2/dynamic/pass/testset3.mod: New file.
+	* gm2/dynamic/pass/teststr.c: New file.
+	* gm2/dynamic/pass/teststr.mod: New file.
+	* gm2/dynamic/pass/teststr2.mod: New file.
+	* gm2/dynamic/pass/teststring.mod: New file.
+	* gm2/dynamic/pass/testunbounded.mod: New file.
+	* gm2/dynamic/pass/testwith.mod: New file.
+	* gm2/dynamic/pass/testzero.mod: New file.
+	* gm2/dynamic/pass/wc.mod: New file.
+	* gm2/embedded/pass/embedded-pass.exp: New file.
+	* gm2/embedded/pass/varataddress.mod: New file.
+	* gm2/embedded/pass/varataddress1.mod: New file.
+	* gm2/embedded/pass/varataddress2.mod: New file.
+	* gm2/embedded/pass/varataddress3.mod: New file.
+	* gm2/errors/fail/array1.mod: New file.
+	* gm2/errors/fail/badexpr.mod: New file.
+	* gm2/errors/fail/badfor.mod: New file.
+	* gm2/errors/fail/badhigh.mod: New file.
+	* gm2/errors/fail/badshift.mod: New file.
+	* gm2/errors/fail/badsubexpradr.mod: New file.
+	* gm2/errors/fail/binaryconst.mod: New file.
+	* gm2/errors/fail/binarygeneric.mod: New file.
+	* gm2/errors/fail/binarygenericconst.mod: New file.
+	* gm2/errors/fail/end.mod: New file.
+	* gm2/errors/fail/errors-fail.exp: New file.
+	* gm2/errors/fail/mismatched.mod: New file.
+	* gm2/errors/fail/mismatchedproc.mod: New file.
+	* gm2/errors/fail/nestedproc4.mod: New file.
+	* gm2/errors/fail/nomodule.mod: New file.
+	* gm2/errors/fail/proctype.mod: New file.
+	* gm2/errors/fail/prog110.mod: New file.
+	* gm2/errors/fail/prog111.mod: New file.
+	* gm2/errors/fail/prog113.mod: New file.
+	* gm2/errors/fail/prog114.mod: New file.
+	* gm2/errors/fail/testaddress.mod: New file.
+	* gm2/errors/fail/testarray.mod: New file.
+	* gm2/errors/fail/testbit.mod: New file.
+	* gm2/errors/fail/testbit2.mod: New file.
+	* gm2/errors/fail/testcase.mod: New file.
+	* gm2/errors/fail/testcomment.mod: New file.
+	* gm2/errors/fail/testcomment2.mod: New file.
+	* gm2/errors/fail/testcomment3.mod: New file.
+	* gm2/errors/fail/testconst.mod: New file.
+	* gm2/errors/fail/testdyn.mod: New file.
+	* gm2/errors/fail/testdyn2.mod: New file.
+	* gm2/errors/fail/testdyn3.mod: New file.
+	* gm2/errors/fail/testexp.mod: New file.
+	* gm2/errors/fail/testfio.mod: New file.
+	* gm2/errors/fail/testimport.mod: New file.
+	* gm2/errors/fail/testimport2.def: New file.
+	* gm2/errors/fail/testimport2.mod: New file.
+	* gm2/errors/fail/testinit.mod: New file.
+	* gm2/errors/fail/testmodule.mod: New file.
+	* gm2/errors/fail/testnil.mod: New file.
+	* gm2/errors/fail/testnil2.mod: New file.
+	* gm2/errors/fail/testparam.mod: New file.
+	* gm2/errors/fail/testproc.mod: New file.
+	* gm2/errors/fail/testproc2.mod: New file.
+	* gm2/errors/fail/testsize.mod: New file.
+	* gm2/errors/fail/teststring.mod: New file.
+	* gm2/errors/fail/testsub3.mod: New file.
+	* gm2/errors/fail/testsub4.mod: New file.
+	* gm2/errors/fail/testtype.mod: New file.
+	* gm2/errors/fail/testvar.mod: New file.
+	* gm2/errors/fail/testwith.mod: New file.
+	* gm2/errors/fail/testwrite.mod: New file.
+	* gm2/errors/fail/type.mod: New file.
+	* gm2/errors/fail/unarygeneric.mod: New file.
+	* gm2/errors/mustfail: New file.
+	* gm2/errors/options: New file.
+	* gm2/errors/testchar.mod: New file.
+	* gm2/errors/testsub2.mod: New file.
+	* gm2/examples/callingC/pass/examples-callingC-pass.exp: New file.
+	* gm2/examples/callingC/pass/hello.mod: New file.
+	* gm2/examples/callingC/pass/libprintf.def: New file.
+	* gm2/examples/callingC/run/pass/c.c: New file.
+	* gm2/examples/callingC/run/pass/c.def: New file.
+	* gm2/examples/callingC/run/pass/examples-callingC-run-pass.exp: New
+	file.
+	* gm2/examples/callingC/run/pass/hello.mod: New file.
+	* gm2/examples/callingC/run/pass/libprintf.def: New file.
+	* gm2/examples/callingC/run/pass/m.mod: New file.
+	* gm2/examples/cpp/pass/examples-cpp-pass.exp: New file.
+	* gm2/examples/cpp/pass/hello.mod: New file.
+	* gm2/examples/cppDef/pass/a.def: New file.
+	* gm2/examples/cppDef/pass/a.mod: New file.
+	* gm2/examples/cppDef/pass/b.mod: New file.
+	* gm2/examples/cppDef/pass/examples-cppDef-pass.exp: New file.
+	* gm2/examples/cppDef/pass/libprintf.def: New file.
+	* gm2/examples/hello/pass/examples-hello-pass.exp: New file.
+	* gm2/examples/hello/pass/hello.mod: New file.
+	* gm2/examples/map/pass/AdvMap.def: New file.
+	* gm2/examples/map/pass/AdvMap.mod: New file.
+	* gm2/examples/map/pass/BoxMap.def: New file.
+	* gm2/examples/map/pass/BoxMap.mod: New file.
+	* gm2/examples/map/pass/Chance.def: New file.
+	* gm2/examples/map/pass/Chance.mod: New file.
+	* gm2/examples/map/pass/Find.def: New file.
+	* gm2/examples/map/pass/Find.mod: New file.
+	* gm2/examples/map/pass/Geometry.def: New file.
+	* gm2/examples/map/pass/Geometry.mod: New file.
+	* gm2/examples/map/pass/MakeBoxes.def: New file.
+	* gm2/examples/map/pass/MakeBoxes.mod: New file.
+	* gm2/examples/map/pass/Map.mod: New file.
+	* gm2/examples/map/pass/RoomMap.def: New file.
+	* gm2/examples/map/pass/RoomMap.mod: New file.
+	* gm2/examples/map/pass/Semantic.mod: New file.
+	* gm2/examples/map/pass/StoreCoord.def: New file.
+	* gm2/examples/map/pass/StoreCoord.mod: New file.
+	* gm2/examples/map/pass/StoreCoords.def: New file.
+	* gm2/examples/map/pass/StoreCoords.mod: New file.
+	* gm2/examples/map/pass/WriteMap.def: New file.
+	* gm2/examples/map/pass/WriteMap.mod: New file.
+	* gm2/examples/map/pass/examples-map-pass.exp: New file.
+	* gm2/examples/map/pass/makemaps: New file.
+	* gm2/examples/map/pass/testch2.mod: New file.
+	* gm2/examples/map/pass/testchan.mod: New file.
+	* gm2/examples/map/pass/testcoor.mod: New file.
+	* gm2/examples/map/pass/testmaps: New file.
+	* gm2/exceptions/run/pass/cpp.cpp: New file.
+	* gm2/exceptions/run/pass/cpp.def: New file.
+	* gm2/exceptions/run/pass/exceptions-run-pass.exp: New file.
+	* gm2/exceptions/run/pass/libexcept.mod: New file.
+	* gm2/exceptions/run/pass/m2test.def: New file.
+	* gm2/exceptions/run/pass/m2test.mod: New file.
+	* gm2/exceptions/run/pass/mycpp.cpp: New file.
+	* gm2/exceptions/run/pass/mycpp.def: New file.
+	* gm2/exceptions/run/pass/mym2.mod: New file.
+	* gm2/exceptions/run/pass/mym2a.mod: New file.
+	* gm2/extensions/pass/align.mod: New file.
+	* gm2/extensions/pass/align2.mod: New file.
+	* gm2/extensions/pass/card16p.mod: New file.
+	* gm2/extensions/pass/card32p.mod: New file.
+	* gm2/extensions/pass/card64p.mod: New file.
+	* gm2/extensions/pass/card8p.mod: New file.
+	* gm2/extensions/pass/co.def: New file.
+	* gm2/extensions/pass/co.mod: New file.
+	* gm2/extensions/pass/extensions-pass.exp: New file.
+	* gm2/extensions/pass/frame.mod: New file.
+	* gm2/extensions/pass/hello.mod: New file.
+	* gm2/extensions/pass/int16p.mod: New file.
+	* gm2/extensions/pass/int32p.mod: New file.
+	* gm2/extensions/pass/int64p.mod: New file.
+	* gm2/extensions/pass/int8p.mod: New file.
+	* gm2/extensions/pass/intsize8.mod: New file.
+	* gm2/extensions/pass/jmp.mod: New file.
+	* gm2/extensions/pass/libc.def: New file.
+	* gm2/extensions/pass/optparam.mod: New file.
+	* gm2/extensions/pass/optparam2.mod: New file.
+	* gm2/extensions/pass/return.mod: New file.
+	* gm2/extensions/pass/set8.mod: New file.
+	* gm2/extensions/pass/set8a.mod: New file.
+	* gm2/extensions/pass/set8b.mod: New file.
+	* gm2/extensions/pass/testco.mod: New file.
+	* gm2/extensions/run/fail/extensions-run-fail.exp: New file.
+	* gm2/extensions/run/fail/intsize8.mod: New file.
+	* gm2/extensions/run/pass/align3.mod: New file.
+	* gm2/extensions/run/pass/align4.mod: New file.
+	* gm2/extensions/run/pass/align5.mod: New file.
+	* gm2/extensions/run/pass/align6.mod: New file.
+	* gm2/extensions/run/pass/align7.mod: New file.
+	* gm2/extensions/run/pass/callingc.mod: New file.
+	* gm2/extensions/run/pass/card16p.mod: New file.
+	* gm2/extensions/run/pass/card32p.mod: New file.
+	* gm2/extensions/run/pass/card64p.mod: New file.
+	* gm2/extensions/run/pass/card8p.mod: New file.
+	* gm2/extensions/run/pass/column.mod: New file.
+	* gm2/extensions/run/pass/cvararg.c: New file.
+	* gm2/extensions/run/pass/cvararg.def: New file.
+	* gm2/extensions/run/pass/extensions-run-pass.exp: New file.
+	* gm2/extensions/run/pass/int16p.mod: New file.
+	* gm2/extensions/run/pass/int32p.mod: New file.
+	* gm2/extensions/run/pass/int64p.mod: New file.
+	* gm2/extensions/run/pass/int8field.mod: New file.
+	* gm2/extensions/run/pass/int8p.mod: New file.
+	* gm2/extensions/run/pass/packedrecord.mod: New file.
+	* gm2/extensions/run/pass/packedrecord2.mod: New file.
+	* gm2/extensions/run/pass/real32.mod: New file.
+	* gm2/extensions/run/pass/real32a.mod: New file.
+	* gm2/extensions/run/pass/record.mod: New file.
+	* gm2/extensions/run/pass/testopen.mod: New file.
+	* gm2/extensions/run/pass/vararg.mod: New file.
+	* gm2/extensions/run/pass/vararg2.mod: New file.
+	* gm2/extensions/run/pass/vararg3.mod: New file.
+	* gm2/fpu/pass/five.mod: New file.
+	* gm2/fpu/pass/fp.def: New file.
+	* gm2/fpu/pass/fp.mod: New file.
+	* gm2/fpu/pass/fpu-pass.exp: New file.
+	* gm2/fpu/pass/one.mod: New file.
+	* gm2/fpu/pass/r1.mod: New file.
+	* gm2/fpu/pass/realconst.mod: New file.
+	* gm2/fpu/pass/testfp.mod: New file.
+	* gm2/fpu/pass/testfp2.mod: New file.
+	* gm2/fpu/pass/testfpu1.mod: New file.
+	* gm2/fpu/pass/testfpu2.mod: New file.
+	* gm2/fpu/pass/testfpu3.mod: New file.
+	* gm2/fpu/pass/testsin.mod: New file.
+	* gm2/imports/run/pass/c.def: New file.
+	* gm2/imports/run/pass/c.mod: New file.
+	* gm2/imports/run/pass/imports-run-pass.exp: New file.
+	* gm2/imports/run/pass/innermods.mod: New file.
+	* gm2/imports/run/pass/innermods2.mod: New file.
+	* gm2/imports/run/pass/innermods3.mod: New file.
+	* gm2/imports/run/pass/innermods4.mod: New file.
+	* gm2/imports/run/pass/innermods5.def: New file.
+	* gm2/imports/run/pass/innermods5.mod: New file.
+	* gm2/imports/run/pass/innermods6.mod: New file.
+	* gm2/integer/div.mod: New file.
+	* gm2/integer/expr.mod: New file.
+	* gm2/integer/mod.mod: New file.
+	* gm2/integer/mod2.mod: New file.
+	* gm2/integer/one.mod: New file.
+	* gm2/integer/options: New file.
+	* gm2/integer/zero.mod: New file.
+	* gm2/iso/analysis/fail/Makefile: New file.
+	* gm2/iso/analysis/fail/arithoverflow.mod: New file.
+	* gm2/iso/analysis/fail/arithoverflow2.mod: New file.
+	* gm2/iso/analysis/fail/arithsubcard.mod: New file.
+	* gm2/iso/analysis/fail/arrayrange.mod: New file.
+	* gm2/iso/analysis/fail/assignvalue.mod: New file.
+	* gm2/iso/analysis/fail/callassignment.mod: New file.
+	* gm2/iso/analysis/fail/callassignment2.mod: New file.
+	* gm2/iso/analysis/fail/callassignment3.mod: New file.
+	* gm2/iso/analysis/fail/callassignment4.mod: New file.
+	* gm2/iso/analysis/fail/caserange.mod: New file.
+	* gm2/iso/analysis/fail/decvalue.mod: New file.
+	* gm2/iso/analysis/fail/forloop.mod: New file.
+	* gm2/iso/analysis/fail/incvalue.mod: New file.
+	* gm2/iso/analysis/fail/iso-analysis-fail.exp: New file.
+	* gm2/iso/analysis/fail/noreturn.mod: New file.
+	* gm2/iso/analysis/fail/returnvalue.mod: New file.
+	* gm2/iso/analysis/fail/staticarray.mod: New file.
+	* gm2/iso/check/fail/iso-check-fail.exp: New file.
+	* gm2/iso/check/fail/modulusoverflow.mod: New file.
+	* gm2/iso/fail/badarray.mod: New file.
+	* gm2/iso/fail/badarray2.mod: New file.
+	* gm2/iso/fail/badipv4.mod: New file.
+	* gm2/iso/fail/bug10.mod: New file.
+	* gm2/iso/fail/bug8.mod: New file.
+	* gm2/iso/fail/bug9.mod: New file.
+	* gm2/iso/fail/case.mod: New file.
+	* gm2/iso/fail/case2.mod: New file.
+	* gm2/iso/fail/case3.mod: New file.
+	* gm2/iso/fail/const1.mod: New file.
+	* gm2/iso/fail/constarray.mod: New file.
+	* gm2/iso/fail/constarray2.mod: New file.
+	* gm2/iso/fail/constprocedure.mod: New file.
+	* gm2/iso/fail/constrecord.mod: New file.
+	* gm2/iso/fail/constrecord2.mod: New file.
+	* gm2/iso/fail/constrecord3.mod: New file.
+	* gm2/iso/fail/constsubrange.mod: New file.
+	* gm2/iso/fail/constsubrange2.mod: New file.
+	* gm2/iso/fail/constsubrange3.mod: New file.
+	* gm2/iso/fail/defa.def: New file.
+	* gm2/iso/fail/defa.mod: New file.
+	* gm2/iso/fail/defb.def: New file.
+	* gm2/iso/fail/defb.mod: New file.
+	* gm2/iso/fail/defc.def: New file.
+	* gm2/iso/fail/defc.mod: New file.
+	* gm2/iso/fail/except.mod: New file.
+	* gm2/iso/fail/except2.mod: New file.
+	* gm2/iso/fail/iso-fail.exp: New file.
+	* gm2/iso/fail/isoa.def: New file.
+	* gm2/iso/fail/isoa.mod: New file.
+	* gm2/iso/fail/lengthsubexpr.mod: New file.
+	* gm2/iso/fail/proc.mod: New file.
+	* gm2/iso/fail/realbitscast.mod: New file.
+	* gm2/iso/fail/varient.mod: New file.
+	* gm2/iso/fail/varient2.mod: New file.
+	* gm2/iso/future/builtinlj.mod: New file.
+	* gm2/iso/pass/ChanConsts.def: New file.
+	* gm2/iso/pass/ChanConsts.mod: New file.
+	* gm2/iso/pass/ConvTypes.def: New file.
+	* gm2/iso/pass/ConvTypes.mod: New file.
+	* gm2/iso/pass/addadr1.mod: New file.
+	* gm2/iso/pass/bits32c.mod: New file.
+	* gm2/iso/pass/callwraptime.mod: New file.
+	* gm2/iso/pass/caseiso.mod: New file.
+	* gm2/iso/pass/caseiso2.mod: New file.
+	* gm2/iso/pass/cast.mod: New file.
+	* gm2/iso/pass/cast3.mod: New file.
+	* gm2/iso/pass/castiso.mod: New file.
+	* gm2/iso/pass/const1.mod: New file.
+	* gm2/iso/pass/constreal.mod: New file.
+	* gm2/iso/pass/constructor1.mod: New file.
+	* gm2/iso/pass/constructor2.mod: New file.
+	* gm2/iso/pass/constructor3.mod: New file.
+	* gm2/iso/pass/constructor4.mod: New file.
+	* gm2/iso/pass/constructor5.mod: New file.
+	* gm2/iso/pass/constructor6.mod: New file.
+	* gm2/iso/pass/constsize4.mod: New file.
+	* gm2/iso/pass/delim.mod: New file.
+	* gm2/iso/pass/delim2.mod: New file.
+	* gm2/iso/pass/enummodule.mod: New file.
+	* gm2/iso/pass/except1.mod: New file.
+	* gm2/iso/pass/expproc.mod: New file.
+	* gm2/iso/pass/expproc2.mod: New file.
+	* gm2/iso/pass/iso-pass.exp: New file.
+	* gm2/iso/pass/isob.def: New file.
+	* gm2/iso/pass/isob.mod: New file.
+	* gm2/iso/pass/isobitset.mod: New file.
+	* gm2/iso/pass/isobitset2.mod: New file.
+	* gm2/iso/pass/longm.mod: New file.
+	* gm2/iso/pass/m.mod: New file.
+	* gm2/iso/pass/proccast.mod: New file.
+	* gm2/iso/pass/realbitscast.mod: New file.
+	* gm2/iso/pass/set12.mod: New file.
+	* gm2/iso/pass/stringchar.mod: New file.
+	* gm2/iso/pass/subassign.mod: New file.
+	* gm2/iso/pass/testaddindr.mod: New file.
+	* gm2/iso/pass/testconv.def: New file.
+	* gm2/iso/pass/testconv.mod: New file.
+	* gm2/iso/pass/testconv2.def: New file.
+	* gm2/iso/pass/testconv2.mod: New file.
+	* gm2/iso/pass/testconv3.mod: New file.
+	* gm2/iso/pass/testconv4.mod: New file.
+	* gm2/iso/pass/testconv5.mod: New file.
+	* gm2/iso/pass/testconv6.mod: New file.
+	* gm2/iso/pass/testconv7.mod: New file.
+	* gm2/iso/pass/testconv8.mod: New file.
+	* gm2/iso/pass/testconv9.mod: New file.
+	* gm2/iso/pass/testiso.mod: New file.
+	* gm2/iso/pass/testiso2.mod: New file.
+	* gm2/iso/pass/testisosize.mod: New file.
+	* gm2/iso/pass/testlength.mod: New file.
+	* gm2/iso/pass/testlength2.mod: New file.
+	* gm2/iso/pass/testlength3.mod: New file.
+	* gm2/iso/pass/testlength4.mod: New file.
+	* gm2/iso/pass/testlength5.mod: New file.
+	* gm2/iso/pass/unbounded.mod: New file.
+	* gm2/iso/pass/unbounded2.mod: New file.
+	* gm2/iso/run/pass/adraddress.mod: New file.
+	* gm2/iso/run/pass/adrunbounded3.mod: New file.
+	* gm2/iso/run/pass/baseimport.mod: New file.
+	* gm2/iso/run/pass/compsize.mod: New file.
+	* gm2/iso/run/pass/concurrentstore.mod: New file.
+	* gm2/iso/run/pass/constprocedure.mod: New file.
+	* gm2/iso/run/pass/constructor1.mod: New file.
+	* gm2/iso/run/pass/constructor2.mod: New file.
+	* gm2/iso/run/pass/conststrarray.mod: New file.
+	* gm2/iso/run/pass/contimer.mod: New file.
+	* gm2/iso/run/pass/except.c: New file.
+	* gm2/iso/run/pass/except2.mod: New file.
+	* gm2/iso/run/pass/except3.cpp: New file.
+	* gm2/iso/run/pass/except4.mod: New file.
+	* gm2/iso/run/pass/except5.cpp: New file.
+	* gm2/iso/run/pass/except5.mod: New file.
+	* gm2/iso/run/pass/except6.cpp: New file.
+	* gm2/iso/run/pass/except7.mod: New file.
+	* gm2/iso/run/pass/except8.mod: New file.
+	* gm2/iso/run/pass/fileio.def: New file.
+	* gm2/iso/run/pass/fileio.mod: New file.
+	* gm2/iso/run/pass/hello.mod: New file.
+	* gm2/iso/run/pass/int8field.mod: New file.
+	* gm2/iso/run/pass/iso-run-pass.exp: New file.
+	* gm2/iso/run/pass/long.mod: New file.
+	* gm2/iso/run/pass/long2.mod: New file.
+	* gm2/iso/run/pass/long3.mod: New file.
+	* gm2/iso/run/pass/long4.c: New file.
+	* gm2/iso/run/pass/long4.mod: New file.
+	* gm2/iso/run/pass/minmax.mod: New file.
+	* gm2/iso/run/pass/modulus.mod: New file.
+	* gm2/iso/run/pass/nestediso.mod: New file.
+	* gm2/iso/run/pass/nestedrecord.mod: New file.
+	* gm2/iso/run/pass/onebyte.mod: New file.
+	* gm2/iso/run/pass/onebyte2.mod: New file.
+	* gm2/iso/run/pass/onebyte3.mod: New file.
+	* gm2/iso/run/pass/packed.mod: New file.
+	* gm2/iso/run/pass/proc.c: New file.
+	* gm2/iso/run/pass/proc.mod: New file.
+	* gm2/iso/run/pass/proc2.mod: New file.
+	* gm2/iso/run/pass/returnrecord.mod: New file.
+	* gm2/iso/run/pass/shift.mod: New file.
+	* gm2/iso/run/pass/shift2.mod: New file.
+	* gm2/iso/run/pass/shift3.mod: New file.
+	* gm2/iso/run/pass/shift4.mod: New file.
+	* gm2/iso/run/pass/simple: New file.
+	* gm2/iso/run/pass/simplelarge.mod: New file.
+	* gm2/iso/run/pass/strcons.mod: New file.
+	* gm2/iso/run/pass/strcons2.mod: New file.
+	* gm2/iso/run/pass/t.cpp: New file.
+	* gm2/iso/run/pass/t1.cpp: New file.
+	* gm2/iso/run/pass/testLength.mod: New file.
+	* gm2/iso/run/pass/testarray.mod: New file.
+	* gm2/iso/run/pass/testgeneric.mod: New file.
+	* gm2/iso/run/pass/testlarge.mod: New file.
+	* gm2/iso/run/pass/testsystem.mod: New file.
+	* gm2/iso/run/pass/tinyconst.mod: New file.
+	* gm2/iso/run/pass/tinyconst2.mod: New file.
+	* gm2/iso/run/pass/tinyconst3.mod: New file.
+	* gm2/iso/run/pass/tinyconst4.mod: New file.
+	* gm2/iso/run/pass/tinyconst5.mod: New file.
+	* gm2/iso/run/pass/tinytimer.mod: New file.
+	* gm2/iso/run/pass/trivialmodulus.mod: New file.
+	* gm2/iso/run/pass/tsize.mod: New file.
+	* gm2/iso/run/pass/tsize2.mod: New file.
+	* gm2/iso/run/pass/tstLength.mod: New file.
+	* gm2/iso/run/pass/unbounded.mod: New file.
+	* gm2/iso/run/pass/unbounded2.mod: New file.
+	* gm2/iso/run/pass/unbounded3.mod: New file.
+	* gm2/iso/run/pass/unbounded4.mod: New file.
+	* gm2/iso/run/pass/unbounded5.mod: New file.
+	* gm2/iso/run/pass/unbounded6.mod: New file.
+	* gm2/iso/run/pass/unbounded7.mod: New file.
+	* gm2/iso/run/pass/unbounded8.mod: New file.
+	* gm2/isocoroutines/run/pass/coroutine.mod: New file.
+	* gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp: New file.
+	* gm2/isolib/run/pass/arraycons.mod: New file.
+	* gm2/isolib/run/pass/arraycons2.mod: New file.
+	* gm2/isolib/run/pass/arraycons3.mod: New file.
+	* gm2/isolib/run/pass/arraycons5.mod: New file.
+	* gm2/isolib/run/pass/arraycons6.mod: New file.
+	* gm2/isolib/run/pass/arraycons7.mod: New file.
+	* gm2/isolib/run/pass/arrayconst8.mod: New file.
+	* gm2/isolib/run/pass/exceptiontest.mod: New file.
+	* gm2/isolib/run/pass/filepos.mod: New file.
+	* gm2/isolib/run/pass/hello.mod: New file.
+	* gm2/isolib/run/pass/insert.mod: New file.
+	* gm2/isolib/run/pass/intconv.mod: New file.
+	* gm2/isolib/run/pass/isolib-run-pass.exp: New file.
+	* gm2/isolib/run/pass/longstr.mod: New file.
+	* gm2/isolib/run/pass/openlibc.mod: New file.
+	* gm2/isolib/run/pass/raise.mod: New file.
+	* gm2/isolib/run/pass/raise2.mod: New file.
+	* gm2/isolib/run/pass/readreal.mod: New file.
+	* gm2/isolib/run/pass/real1.mod: New file.
+	* gm2/isolib/run/pass/real2.mod: New file.
+	* gm2/isolib/run/pass/real3.mod: New file.
+	* gm2/isolib/run/pass/realconv.mod: New file.
+	* gm2/isolib/run/pass/realconv2.mod: New file.
+	* gm2/isolib/run/pass/realstr.mod: New file.
+	* gm2/isolib/run/pass/sigfig.mod: New file.
+	* gm2/isolib/run/pass/stringreal2.mod: New file.
+	* gm2/isolib/run/pass/termfile.mod-disabled: New file.
+	* gm2/isolib/run/pass/testappend.mod: New file.
+	* gm2/isolib/run/pass/testinput: New file.
+	* gm2/isolib/run/pass/testio.mod: New file.
+	* gm2/isolib/run/pass/testio2.mod: New file.
+	* gm2/isolib/run/pass/testmem.mod: New file.
+	* gm2/isolib/run/pass/testmem2.mod: New file.
+	* gm2/isolib/run/pass/testnumber: New file.
+	* gm2/isolib/run/pass/tiny.mod: New file.
+	* gm2/isolib/run/pass/tiny2.mod: New file.
+	* gm2/isolib/run/pass/tiny3.mod: New file.
+	* gm2/isolib/run/pass/tiny4.mod: New file.
+	* gm2/isolib/run/pass/tiny5.mod: New file.
+	* gm2/libs/a.def: New file.
+	* gm2/libs/a.mod: New file.
+	* gm2/libs/b.def: New file.
+	* gm2/libs/b.mod: New file.
+	* gm2/libs/testraw.mod: New file.
+	* gm2/link/externalscaffold/pass/hello.mod: New file.
+	* gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: New
+	file.
+	* gm2/link/externalscaffold/pass/scaffold.c: New file.
+	* gm2/link/pim/fail/import.mod: New file.
+	* gm2/link/pim/fail/link-pim-fail.exp: New file.
+	* gm2/link/pim/pass/link-pim-pass.exp: New file.
+	* gm2/link/pimc/pass/README: New file.
+	* gm2/link/pimc/pass/link-pimc-pass.exp: New file.
+	* gm2/link/pimc/pass/testdtoa.mod: New file.
+	* gm2/link/pimc/pass/testerrno.mod: New file.
+	* gm2/link/pimc/pass/testgetopt.mod: New file.
+	* gm2/link/pimc/pass/testldtoa.mod: New file.
+	* gm2/link/pimc/pass/testlibc.mod: New file.
+	* gm2/link/pimc/pass/testlibc2.mod: New file.
+	* gm2/link/pimc/pass/testsckt.mod: New file.
+	* gm2/link/pimc/pass/testselective.mod: New file.
+	* gm2/link/pimc/pass/testsysexceptions.mod: New file.
+	* gm2/link/pimc/pass/testtermios.mod: New file.
+	* gm2/link/pimc/pass/testunixargs.mod: New file.
+	* gm2/link/pimc/pass/testwrapc.mod: New file.
+	* gm2/linking/libarchive/pass/c.c: New file.
+	* gm2/linking/libarchive/pass/c.def: New file.
+	* gm2/linking/libarchive/pass/d.def: New file.
+	* gm2/linking/libarchive/pass/e.def: New file.
+	* gm2/linking/libarchive/pass/linking-libarchive-pass.exp: New file.
+	* gm2/linking/libarchive/pass/m.mod: New file.
+	* gm2/linking/verbose/pass/hello.mod: New file.
+	* gm2/linking/verbose/pass/linking-verbose-pass.exp: New file.
+	* gm2/pim/fail/TestLong3.mod: New file.
+	* gm2/pim/fail/TestLong6.mod: New file.
+	* gm2/pim/fail/a.def: New file.
+	* gm2/pim/fail/assignbounds.mod: New file.
+	* gm2/pim/fail/assignsubrange.mod: New file.
+	* gm2/pim/fail/assignsubrange2.mod: New file.
+	* gm2/pim/fail/b.def: New file.
+	* gm2/pim/fail/bad.def: New file.
+	* gm2/pim/fail/badconst.mod: New file.
+	* gm2/pim/fail/badfunc.mod: New file.
+	* gm2/pim/fail/badparam.mod: New file.
+	* gm2/pim/fail/badparam2.mod: New file.
+	* gm2/pim/fail/badtype.mod: New file.
+	* gm2/pim/fail/badtypes.mod: New file.
+	* gm2/pim/fail/bits.mod: New file.
+	* gm2/pim/fail/bits2.mod: New file.
+	* gm2/pim/fail/bits3.mod: New file.
+	* gm2/pim/fail/bits4.mod: New file.
+	* gm2/pim/fail/cardword.mod: New file.
+	* gm2/pim/fail/constbec.mod: New file.
+	* gm2/pim/fail/constsize3.mod: New file.
+	* gm2/pim/fail/constvar.mod: New file.
+	* gm2/pim/fail/convert5.mod: New file.
+	* gm2/pim/fail/dupconst.mod: New file.
+	* gm2/pim/fail/dupenum.mod: New file.
+	* gm2/pim/fail/dupfield.mod: New file.
+	* gm2/pim/fail/duptype.mod: New file.
+	* gm2/pim/fail/dupvar.mod: New file.
+	* gm2/pim/fail/expression.mod: New file.
+	* gm2/pim/fail/expression2.mod: New file.
+	* gm2/pim/fail/expression3.mod: New file.
+	* gm2/pim/fail/func.mod: New file.
+	* gm2/pim/fail/good.def: New file.
+	* gm2/pim/fail/good.mod: New file.
+	* gm2/pim/fail/import.mod: New file.
+	* gm2/pim/fail/inserttok.def: New file.
+	* gm2/pim/fail/inserttok.mod: New file.
+	* gm2/pim/fail/integer.mod: New file.
+	* gm2/pim/fail/keyword.mod: New file.
+	* gm2/pim/fail/longtypes2.mod: New file.
+	* gm2/pim/fail/longtypes3.mod: New file.
+	* gm2/pim/fail/multisetf.mod: New file.
+	* gm2/pim/fail/nested3.mod: New file.
+	* gm2/pim/fail/opaque.mod: New file.
+	* gm2/pim/fail/opaque2.mod: New file.
+	* gm2/pim/fail/opasfail.mod: New file.
+	* gm2/pim/fail/opcpfail.mod: New file.
+	* gm2/pim/fail/pim-fail.exp: New file.
+	* gm2/pim/fail/procmod.mod: New file.
+	* gm2/pim/fail/rotate.mod: New file.
+	* gm2/pim/fail/rotate2.mod: New file.
+	* gm2/pim/fail/setbec.mod: New file.
+	* gm2/pim/fail/setequiv.mod: New file.
+	* gm2/pim/fail/setsnulf.mod: New file.
+	* gm2/pim/fail/settype.mod: New file.
+	* gm2/pim/fail/shift.mod: New file.
+	* gm2/pim/fail/shift2.mod: New file.
+	* gm2/pim/fail/subrange7.mod: New file.
+	* gm2/pim/fail/unary.mod: New file.
+	* gm2/pim/fail/undeclared.mod: New file.
+	* gm2/pim/fail/val.mod: New file.
+	* gm2/pim/fail/val2.mod: New file.
+	* gm2/pim/fail/wordconst.mod: New file.
+	* gm2/pim/no-options/run/pass/integer.mod: New file.
+	* gm2/pim/no-options/run/pass/pim-no-options-run-pass.exp: New file.
+	* gm2/pim/options/bounds/fail/IdentifierBug.mod: New file.
+	* gm2/pim/options/bounds/fail/pim-options-bounds-fail.exp: New file.
+	* gm2/pim/options/optimize/run/pass/addition.def: New file.
+	* gm2/pim/options/optimize/run/pass/addition.mod: New file.
+	* gm2/pim/options/optimize/run/pass/concat.mod: New file.
 	* gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp:
-	(New file).
-	* gm2/pim/options/optimize/run/pass/testadd.mod: (New file).
-	* gm2/pim/pass/ABSBug.mod: (New file).
-	* gm2/pim/pass/TestLong4.mod: (New file).
-	* gm2/pim/pass/TestLong7.mod: (New file).
-	* gm2/pim/pass/TestLong8.mod: (New file).
-	* gm2/pim/pass/TestLong9.mod: (New file).
-	* gm2/pim/pass/another.mod: (New file).
-	* gm2/pim/pass/aochar.mod: (New file).
-	* gm2/pim/pass/array.mod: (New file).
-	* gm2/pim/pass/array2.mod: (New file).
-	* gm2/pim/pass/array3.mod: (New file).
-	* gm2/pim/pass/array4.mod: (New file).
-	* gm2/pim/pass/array5.mod: (New file).
-	* gm2/pim/pass/array6.mod: (New file).
-	* gm2/pim/pass/arraybool.mod: (New file).
-	* gm2/pim/pass/arraychar.mod: (New file).
-	* gm2/pim/pass/arraychar2.mod: (New file).
-	* gm2/pim/pass/arraychar3.mod: (New file).
-	* gm2/pim/pass/arrayconst1.mod: (New file).
-	* gm2/pim/pass/arrayconst2.mod: (New file).
-	* gm2/pim/pass/arrayconst3.mod: (New file).
-	* gm2/pim/pass/arraydecl.mod: (New file).
-	* gm2/pim/pass/arraydim.mod: (New file).
-	* gm2/pim/pass/arraydyn.mod: (New file).
-	* gm2/pim/pass/arrayeqiv.mod: (New file).
-	* gm2/pim/pass/arrayfio.mod: (New file).
-	* gm2/pim/pass/arrayhuge.mod: (New file).
-	* gm2/pim/pass/arrayhuge2.mod: (New file).
-	* gm2/pim/pass/arrayindex.mod: (New file).
-	* gm2/pim/pass/arrayindirect.mod: (New file).
-	* gm2/pim/pass/arrayinproc.mod: (New file).
-	* gm2/pim/pass/arrayint.mod: (New file).
-	* gm2/pim/pass/arrayofbyte.mod: (New file).
-	* gm2/pim/pass/arrayofcard.mod: (New file).
-	* gm2/pim/pass/arrayptr.mod: (New file).
-	* gm2/pim/pass/arrayptr2.mod: (New file).
-	* gm2/pim/pass/arrayptr3.mod: (New file).
-	* gm2/pim/pass/arrayptr4.mod: (New file).
-	* gm2/pim/pass/arrayptr5.mod: (New file).
-	* gm2/pim/pass/arrayptr6.mod: (New file).
-	* gm2/pim/pass/arrayrecord.mod: (New file).
-	* gm2/pim/pass/arraytiny.c: (New file).
-	* gm2/pim/pass/arraytiny.mod: (New file).
-	* gm2/pim/pass/arraytype.mod: (New file).
-	* gm2/pim/pass/arraytype2.mod: (New file).
-	* gm2/pim/pass/arraytype3.mod: (New file).
-	* gm2/pim/pass/arraytype4.mod: (New file).
-	* gm2/pim/pass/assignment.mod: (New file).
-	* gm2/pim/pass/assignment2.mod: (New file).
-	* gm2/pim/pass/assignment3.mod: (New file).
-	* gm2/pim/pass/assignment4.mod: (New file).
-	* gm2/pim/pass/badpointer.mod: (New file).
-	* gm2/pim/pass/bits32.def: (New file).
-	* gm2/pim/pass/bits32.mod: (New file).
-	* gm2/pim/pass/bits32i.mod: (New file).
-	* gm2/pim/pass/bitset.mod: (New file).
-	* gm2/pim/pass/bitset2.mod: (New file).
-	* gm2/pim/pass/bitset3.mod: (New file).
-	* gm2/pim/pass/bitset4.mod: (New file).
-	* gm2/pim/pass/bitset5.mod: (New file).
-	* gm2/pim/pass/bitsetfunc.mod: (New file).
-	* gm2/pim/pass/block.mod: (New file).
-	* gm2/pim/pass/blockindirect.mod: (New file).
-	* gm2/pim/pass/builtin.def: (New file).
-	* gm2/pim/pass/builtin.mod: (New file).
-	* gm2/pim/pass/builtin2.mod: (New file).
-	* gm2/pim/pass/builtinconst.mod: (New file).
-	* gm2/pim/pass/bytearray.mod: (New file).
-	* gm2/pim/pass/card.mod: (New file).
-	* gm2/pim/pass/card2.mod: (New file).
-	* gm2/pim/pass/char.mod: (New file).
-	* gm2/pim/pass/char2.mod: (New file).
-	* gm2/pim/pass/charproc.mod: (New file).
-	* gm2/pim/pass/charset.mod: (New file).
-	* gm2/pim/pass/charset2.mod: (New file).
-	* gm2/pim/pass/charset3.mod: (New file).
-	* gm2/pim/pass/checkparm.def: (New file).
-	* gm2/pim/pass/checkparm.mod: (New file).
-	* gm2/pim/pass/colour.mod: (New file).
-	* gm2/pim/pass/comment1.mod: (New file).
-	* gm2/pim/pass/complexarray.mod: (New file).
-	* gm2/pim/pass/complextypes.mod: (New file).
-	* gm2/pim/pass/constcast.mod: (New file).
-	* gm2/pim/pass/constmax.mod: (New file).
-	* gm2/pim/pass/constset.mod: (New file).
-	* gm2/pim/pass/constset2.mod: (New file).
-	* gm2/pim/pass/constset3.mod: (New file).
-	* gm2/pim/pass/constsize.mod: (New file).
-	* gm2/pim/pass/constsize2.mod: (New file).
-	* gm2/pim/pass/convert.mod: (New file).
-	* gm2/pim/pass/convert2.mod: (New file).
-	* gm2/pim/pass/convert3.mod: (New file).
-	* gm2/pim/pass/convert4.mod: (New file).
-	* gm2/pim/pass/danglingelse.mod: (New file).
-	* gm2/pim/pass/debug: (New file).
-	* gm2/pim/pass/defset.def: (New file).
-	* gm2/pim/pass/defset.mod: (New file).
-	* gm2/pim/pass/deftype.mod: (New file).
-	* gm2/pim/pass/divaddr.mod: (New file).
-	* gm2/pim/pass/enum.mod: (New file).
-	* gm2/pim/pass/enum2.mod: (New file).
-	* gm2/pim/pass/enum3.mod: (New file).
-	* gm2/pim/pass/file.mod: (New file).
-	* gm2/pim/pass/filesystem.mod: (New file).
-	* gm2/pim/pass/foo.mod: (New file).
-	* gm2/pim/pass/foo2.mod: (New file).
-	* gm2/pim/pass/for1.mod: (New file).
-	* gm2/pim/pass/function.mod: (New file).
-	* gm2/pim/pass/function2.mod: (New file).
-	* gm2/pim/pass/gcd.def: (New file).
-	* gm2/pim/pass/gcd.mod: (New file).
-	* gm2/pim/pass/getconst.mod: (New file).
-	* gm2/pim/pass/hello.mod: (New file).
-	* gm2/pim/pass/impa.mod: (New file).
-	* gm2/pim/pass/impb.def: (New file).
-	* gm2/pim/pass/impb.mod: (New file).
-	* gm2/pim/pass/impc.def: (New file).
-	* gm2/pim/pass/impc.mod: (New file).
-	* gm2/pim/pass/impd.mod: (New file).
-	* gm2/pim/pass/impe.mod: (New file).
-	* gm2/pim/pass/impf.mod: (New file).
-	* gm2/pim/pass/impg.mod: (New file).
-	* gm2/pim/pass/imph.mod: (New file).
-	* gm2/pim/pass/impi.mod: (New file).
-	* gm2/pim/pass/impj.mod: (New file).
-	* gm2/pim/pass/impk.mod: (New file).
-	* gm2/pim/pass/impl.mod: (New file).
-	* gm2/pim/pass/impm.mod: (New file).
-	* gm2/pim/pass/impn.def: (New file).
-	* gm2/pim/pass/impn.mod: (New file).
-	* gm2/pim/pass/impo.mod: (New file).
-	* gm2/pim/pass/imports.mod: (New file).
-	* gm2/pim/pass/impp.def: (New file).
-	* gm2/pim/pass/impp.mod: (New file).
-	* gm2/pim/pass/impq.def: (New file).
-	* gm2/pim/pass/impq.mod: (New file).
-	* gm2/pim/pass/incompsets.mod: (New file).
-	* gm2/pim/pass/index.mod: (New file).
-	* gm2/pim/pass/index2.mod: (New file).
-	* gm2/pim/pass/indirect.mod: (New file).
-	* gm2/pim/pass/inner.mod: (New file).
-	* gm2/pim/pass/inner2.mod: (New file).
-	* gm2/pim/pass/int.mod: (New file).
-	* gm2/pim/pass/largeset.mod: (New file).
-	* gm2/pim/pass/largeset1.mod: (New file).
-	* gm2/pim/pass/largeset2.mod: (New file).
-	* gm2/pim/pass/largeset3.mod: (New file).
-	* gm2/pim/pass/largeset4.mod: (New file).
-	* gm2/pim/pass/largeset5.mod: (New file).
-	* gm2/pim/pass/largeset6.mod: (New file).
-	* gm2/pim/pass/largeset7.mod: (New file).
-	* gm2/pim/pass/localmod.mod: (New file).
-	* gm2/pim/pass/localproc.mod: (New file).
-	* gm2/pim/pass/localvar.mod: (New file).
-	* gm2/pim/pass/log: (New file).
-	* gm2/pim/pass/longint.mod: (New file).
-	* gm2/pim/pass/longint2.mod: (New file).
-	* gm2/pim/pass/longmm.mod: (New file).
-	* gm2/pim/pass/longreal.mod: (New file).
-	* gm2/pim/pass/longtypes.mod: (New file).
-	* gm2/pim/pass/longtypes3.mod: (New file).
-	* gm2/pim/pass/longtypes4.mod: (New file).
-	* gm2/pim/pass/longtypes5.mod: (New file).
-	* gm2/pim/pass/longtypes6.mod: (New file).
-	* gm2/pim/pass/loopexit.mod: (New file).
-	* gm2/pim/pass/math.mod: (New file).
-	* gm2/pim/pass/maxlongint.mod: (New file).
-	* gm2/pim/pass/maxreal.mod: (New file).
-	* gm2/pim/pass/maxreal2.mod: (New file).
-	* gm2/pim/pass/minmaxconst.mod: (New file).
-	* gm2/pim/pass/minmaxconst2.mod: (New file).
-	* gm2/pim/pass/modaddr.mod: (New file).
-	* gm2/pim/pass/multaddr.mod: (New file).
-	* gm2/pim/pass/multiple.mod: (New file).
-	* gm2/pim/pass/multiset.mod: (New file).
-	* gm2/pim/pass/multtypes.mod: (New file).
-	* gm2/pim/pass/mydef.def: (New file).
-	* gm2/pim/pass/negatives.def: (New file).
-	* gm2/pim/pass/negatives.mod: (New file).
-	* gm2/pim/pass/nested.mod: (New file).
-	* gm2/pim/pass/nested2.mod: (New file).
-	* gm2/pim/pass/nested3.mod: (New file).
-	* gm2/pim/pass/nested4.mod: (New file).
-	* gm2/pim/pass/nested5.mod: (New file).
-	* gm2/pim/pass/nested6.mod: (New file).
-	* gm2/pim/pass/nested7.mod: (New file).
-	* gm2/pim/pass/nestedfor.mod: (New file).
-	* gm2/pim/pass/nestedif.mod: (New file).
-	* gm2/pim/pass/nestedset.mod: (New file).
-	* gm2/pim/pass/onezero.mod: (New file).
-	* gm2/pim/pass/opaque.def: (New file).
-	* gm2/pim/pass/opaque.mod: (New file).
-	* gm2/pim/pass/opaque2.mod: (New file).
-	* gm2/pim/pass/opaquetype.def: (New file).
-	* gm2/pim/pass/opaquetype.mod: (New file).
-	* gm2/pim/pass/param.mod: (New file).
-	* gm2/pim/pass/param2.mod: (New file).
-	* gm2/pim/pass/param3.mod: (New file).
-	* gm2/pim/pass/parambool.mod: (New file).
-	* gm2/pim/pass/paramreal.mod: (New file).
-	* gm2/pim/pass/pim-pass.exp: (New file).
-	* gm2/pim/pass/pimimp.mod: (New file).
-	* gm2/pim/pass/pointer.mod: (New file).
-	* gm2/pim/pass/procadr.mod: (New file).
-	* gm2/pim/pass/procconv.mod: (New file).
-	* gm2/pim/pass/procconv2.mod: (New file).
-	* gm2/pim/pass/procedure1.mod: (New file).
-	* gm2/pim/pass/procedure2.mod: (New file).
-	* gm2/pim/pass/procindirect.mod: (New file).
-	* gm2/pim/pass/procmod.mod: (New file).
-	* gm2/pim/pass/procmod2.mod: (New file).
-	* gm2/pim/pass/procmod3.mod: (New file).
-	* gm2/pim/pass/procmod31.mod: (New file).
-	* gm2/pim/pass/procmod4.mod: (New file).
-	* gm2/pim/pass/procmod5.mod: (New file).
-	* gm2/pim/pass/procmod6.def: (New file).
-	* gm2/pim/pass/procmod6.mod: (New file).
-	* gm2/pim/pass/procmod7.mod: (New file).
-	* gm2/pim/pass/procmod8.mod: (New file).
-	* gm2/pim/pass/procmod9.mod: (New file).
-	* gm2/pim/pass/proctype.mod: (New file).
-	* gm2/pim/pass/proctype2.def: (New file).
-	* gm2/pim/pass/proctype3.mod: (New file).
-	* gm2/pim/pass/proctype4.mod: (New file).
-	* gm2/pim/pass/program.mod: (New file).
-	* gm2/pim/pass/program2.mod: (New file).
-	* gm2/pim/pass/ptrarray.mod: (New file).
-	* gm2/pim/pass/ptrarray2.mod: (New file).
-	* gm2/pim/pass/ptrarray3.mod: (New file).
-	* gm2/pim/pass/ptrcard.mod: (New file).
-	* gm2/pim/pass/quads.def: (New file).
-	* gm2/pim/pass/quads.mod: (New file).
-	* gm2/pim/pass/real.mod: (New file).
-	* gm2/pim/pass/real2.mod: (New file).
-	* gm2/pim/pass/real3.mod: (New file).
-	* gm2/pim/pass/realconst.mod: (New file).
-	* gm2/pim/pass/realneg.mod: (New file).
-	* gm2/pim/pass/realneg2.mod: (New file).
-	* gm2/pim/pass/realone.mod: (New file).
-	* gm2/pim/pass/realsize.mod: (New file).
-	* gm2/pim/pass/record1.mod: (New file).
-	* gm2/pim/pass/record10.mod: (New file).
-	* gm2/pim/pass/record11.mod: (New file).
-	* gm2/pim/pass/record12.def: (New file).
-	* gm2/pim/pass/record13.def: (New file).
-	* gm2/pim/pass/record14.def: (New file).
-	* gm2/pim/pass/record15.def: (New file).
-	* gm2/pim/pass/record16.def: (New file).
-	* gm2/pim/pass/record2.mod: (New file).
-	* gm2/pim/pass/record3.mod: (New file).
-	* gm2/pim/pass/record4.mod: (New file).
-	* gm2/pim/pass/record5.mod: (New file).
-	* gm2/pim/pass/record6.mod: (New file).
-	* gm2/pim/pass/record7.mod: (New file).
-	* gm2/pim/pass/record8.mod: (New file).
-	* gm2/pim/pass/record9.mod: (New file).
-	* gm2/pim/pass/recordarray.c: (New file).
-	* gm2/pim/pass/recordarray.mod: (New file).
-	* gm2/pim/pass/recordarray2.mod: (New file).
-	* gm2/pim/pass/redef.mod: (New file).
-	* gm2/pim/pass/set10.mod: (New file).
-	* gm2/pim/pass/set11.def: (New file).
-	* gm2/pim/pass/set11.mod: (New file).
-	* gm2/pim/pass/set12.mod: (New file).
-	* gm2/pim/pass/set4.mod: (New file).
-	* gm2/pim/pass/set5.mod: (New file).
-	* gm2/pim/pass/set6.mod: (New file).
-	* gm2/pim/pass/set7.mod: (New file).
-	* gm2/pim/pass/set8.mod: (New file).
-	* gm2/pim/pass/set9.mod: (New file).
-	* gm2/pim/pass/setchar.mod: (New file).
-	* gm2/pim/pass/setchar10.mod: (New file).
-	* gm2/pim/pass/setchar11.mod: (New file).
-	* gm2/pim/pass/setchar3.mod: (New file).
-	* gm2/pim/pass/setchar4.mod: (New file).
-	* gm2/pim/pass/setchar5.mod: (New file).
-	* gm2/pim/pass/setchar7.mod: (New file).
-	* gm2/pim/pass/setchar8.mod: (New file).
-	* gm2/pim/pass/setchar9.mod: (New file).
-	* gm2/pim/pass/setconst.mod: (New file).
-	* gm2/pim/pass/setconst2.mod: (New file).
-	* gm2/pim/pass/setconst3.mod: (New file).
-	* gm2/pim/pass/setenum.mod: (New file).
-	* gm2/pim/pass/setimp.mod: (New file).
-	* gm2/pim/pass/setimp2.mod: (New file).
-	* gm2/pim/pass/setofchar.mod: (New file).
-	* gm2/pim/pass/setoverflow.mod: (New file).
-	* gm2/pim/pass/sets.mod: (New file).
-	* gm2/pim/pass/sets2.mod: (New file).
-	* gm2/pim/pass/sets3.mod: (New file).
-	* gm2/pim/pass/sets4.mod: (New file).
-	* gm2/pim/pass/sets5.mod: (New file).
-	* gm2/pim/pass/sets6.mod: (New file).
-	* gm2/pim/pass/setsnul.mod: (New file).
-	* gm2/pim/pass/settest1.mod: (New file).
-	* gm2/pim/pass/settest2.mod: (New file).
-	* gm2/pim/pass/settest3.mod: (New file).
-	* gm2/pim/pass/simpleproc.mod: (New file).
-	* gm2/pim/pass/sizes.mod: (New file).
-	* gm2/pim/pass/sizetype.mod: (New file).
-	* gm2/pim/pass/smallset1.mod: (New file).
-	* gm2/pim/pass/smallset2.mod: (New file).
-	* gm2/pim/pass/smallset3.mod: (New file).
-	* gm2/pim/pass/smallset4.mod: (New file).
-	* gm2/pim/pass/smallset5.mod: (New file).
-	* gm2/pim/pass/smallset6.mod: (New file).
-	* gm2/pim/pass/smallset7.mod: (New file).
-	* gm2/pim/pass/stabs.mod: (New file).
-	* gm2/pim/pass/stdio.mod: (New file).
-	* gm2/pim/pass/str1.mod: (New file).
-	* gm2/pim/pass/str2.mod: (New file).
-	* gm2/pim/pass/str3.mod: (New file).
-	* gm2/pim/pass/str4.mod: (New file).
-	* gm2/pim/pass/str5.mod: (New file).
-	* gm2/pim/pass/stressset.mod: (New file).
-	* gm2/pim/pass/stringassign.mod: (New file).
-	* gm2/pim/pass/stringopaq.mod: (New file).
-	* gm2/pim/pass/strings.mod: (New file).
-	* gm2/pim/pass/strparam.def: (New file).
-	* gm2/pim/pass/strparam.mod: (New file).
-	* gm2/pim/pass/subrange.mod: (New file).
-	* gm2/pim/pass/subrange10.mod: (New file).
-	* gm2/pim/pass/subrange11.mod: (New file).
-	* gm2/pim/pass/subrange12.mod: (New file).
-	* gm2/pim/pass/subrange14.mod: (New file).
-	* gm2/pim/pass/subrange15.mod: (New file).
-	* gm2/pim/pass/subrange16.mod: (New file).
-	* gm2/pim/pass/subrange17.mod: (New file).
-	* gm2/pim/pass/subrange2.mod: (New file).
-	* gm2/pim/pass/subrange3.mod: (New file).
-	* gm2/pim/pass/subrange4.mod: (New file).
-	* gm2/pim/pass/subrange5.mod: (New file).
-	* gm2/pim/pass/subrange6.mod: (New file).
-	* gm2/pim/pass/subrange7.mod: (New file).
-	* gm2/pim/pass/subrange8.mod: (New file).
-	* gm2/pim/pass/subrange9.mod: (New file).
-	* gm2/pim/pass/test2recursive.mod: (New file).
-	* gm2/pim/pass/testabs.mod: (New file).
-	* gm2/pim/pass/testbuiltin.mod: (New file).
-	* gm2/pim/pass/testbuiltin2.mod: (New file).
-	* gm2/pim/pass/testbuiltstr.mod: (New file).
-	* gm2/pim/pass/testcap.mod: (New file).
-	* gm2/pim/pass/testcap2.mod: (New file).
-	* gm2/pim/pass/testcard.mod: (New file).
-	* gm2/pim/pass/testcard2.mod: (New file).
-	* gm2/pim/pass/testcard3.mod: (New file).
-	* gm2/pim/pass/testcard4.mod: (New file).
-	* gm2/pim/pass/testcard5.mod: (New file).
-	* gm2/pim/pass/testcase.mod: (New file).
-	* gm2/pim/pass/testcase2.mod: (New file).
-	* gm2/pim/pass/testcase3.mod: (New file).
-	* gm2/pim/pass/testcase4.mod: (New file).
-	* gm2/pim/pass/testchar.mod: (New file).
-	* gm2/pim/pass/testfloat.mod: (New file).
-	* gm2/pim/pass/testfloat2.mod: (New file).
-	* gm2/pim/pass/testfloat3.mod: (New file).
-	* gm2/pim/pass/testfloat4.mod: (New file).
-	* gm2/pim/pass/testfor.mod: (New file).
-	* gm2/pim/pass/testimpvar.mod: (New file).
-	* gm2/pim/pass/testlong3.mod: (New file).
-	* gm2/pim/pass/testmod.mod: (New file).
-	* gm2/pim/pass/testmod2.mod: (New file).
-	* gm2/pim/pass/testodd.mod: (New file).
-	* gm2/pim/pass/testopaque.mod: (New file).
-	* gm2/pim/pass/testopaque2.mod: (New file).
-	* gm2/pim/pass/testopaque3.mod: (New file).
-	* gm2/pim/pass/testord.mod: (New file).
-	* gm2/pim/pass/testparam.mod: (New file).
-	* gm2/pim/pass/testparam2.mod: (New file).
-	* gm2/pim/pass/testparam3.mod: (New file).
-	* gm2/pim/pass/testpimsize.mod: (New file).
-	* gm2/pim/pass/testrecursive.def: (New file).
-	* gm2/pim/pass/testrecursive.mod: (New file).
-	* gm2/pim/pass/testreturnstr.mod: (New file).
-	* gm2/pim/pass/testset.mod: (New file).
-	* gm2/pim/pass/testshort.mod: (New file).
-	* gm2/pim/pass/testsinf.mod: (New file).
-	* gm2/pim/pass/testsinl.mod: (New file).
-	* gm2/pim/pass/testsize.mod: (New file).
-	* gm2/pim/pass/testvar.mod: (New file).
-	* gm2/pim/pass/testvarin.mod: (New file).
-	* gm2/pim/pass/timeio.mod: (New file).
-	* gm2/pim/pass/timeio2.mod: (New file).
-	* gm2/pim/pass/timeio3.mod: (New file).
-	* gm2/pim/pass/timeio4.mod: (New file).
-	* gm2/pim/pass/timeio5.mod: (New file).
-	* gm2/pim/pass/timeio6.mod: (New file).
-	* gm2/pim/pass/timeio7.mod: (New file).
-	* gm2/pim/pass/timeio8.mod: (New file).
-	* gm2/pim/pass/timeio9.mod: (New file).
-	* gm2/pim/pass/tinyalloc.mod: (New file).
-	* gm2/pim/pass/tinyarray.mod: (New file).
-	* gm2/pim/pass/tinyarray2.mod: (New file).
-	* gm2/pim/pass/tinyarray3.mod: (New file).
-	* gm2/pim/pass/tinyarray4.mod: (New file).
-	* gm2/pim/pass/tinyarray5.mod: (New file).
-	* gm2/pim/pass/tinyarray6.mod: (New file).
-	* gm2/pim/pass/tinyassign.def: (New file).
-	* gm2/pim/pass/tinyassign.mod: (New file).
-	* gm2/pim/pass/tinyassign2.mod: (New file).
-	* gm2/pim/pass/tinyassign3.mod: (New file).
-	* gm2/pim/pass/tinyassign4.mod: (New file).
-	* gm2/pim/pass/tinyassign5.mod: (New file).
-	* gm2/pim/pass/tinybitset.mod: (New file).
-	* gm2/pim/pass/tinyelse.mod: (New file).
-	* gm2/pim/pass/tinyenum.mod: (New file).
-	* gm2/pim/pass/tinyfor.mod: (New file).
-	* gm2/pim/pass/tinyfor2.mod: (New file).
-	* gm2/pim/pass/tinyfor3.mod: (New file).
-	* gm2/pim/pass/tinyhalt.mod: (New file).
-	* gm2/pim/pass/tinyhello.mod: (New file).
-	* gm2/pim/pass/tinyif.mod: (New file).
-	* gm2/pim/pass/tinyif2.mod: (New file).
-	* gm2/pim/pass/tinyif3.mod: (New file).
-	* gm2/pim/pass/tinyif4.mod: (New file).
-	* gm2/pim/pass/tinyif5.mod: (New file).
-	* gm2/pim/pass/tinyif6.mod: (New file).
-	* gm2/pim/pass/tinyif7.mod: (New file).
-	* gm2/pim/pass/tinyif8.mod: (New file).
-	* gm2/pim/pass/tinyimp.mod: (New file).
-	* gm2/pim/pass/tinylit.mod: (New file).
-	* gm2/pim/pass/tinylit2.mod: (New file).
-	* gm2/pim/pass/tinymax.mod: (New file).
-	* gm2/pim/pass/tinymod.mod: (New file).
-	* gm2/pim/pass/tinynode.mod: (New file).
-	* gm2/pim/pass/tinyparam.mod: (New file).
-	* gm2/pim/pass/tinyparam2.mod: (New file).
-	* gm2/pim/pass/tinyplus.mod: (New file).
-	* gm2/pim/pass/tinyproc.mod: (New file).
-	* gm2/pim/pass/tinyproc2.mod: (New file).
-	* gm2/pim/pass/tinyproc3.mod: (New file).
-	* gm2/pim/pass/tinyproc4.mod: (New file).
-	* gm2/pim/pass/tinyproc5.mod: (New file).
-	* gm2/pim/pass/tinyproc6.mod: (New file).
-	* gm2/pim/pass/tinyptr.mod: (New file).
-	* gm2/pim/pass/tinyreal.mod: (New file).
-	* gm2/pim/pass/tinyrecord.mod: (New file).
-	* gm2/pim/pass/tinyrepeat.mod: (New file).
-	* gm2/pim/pass/tinyset6.mod: (New file).
-	* gm2/pim/pass/tinyset7.mod: (New file).
-	* gm2/pim/pass/tinystate.mod: (New file).
-	* gm2/pim/pass/tinysub.def: (New file).
-	* gm2/pim/pass/tinytest.mod: (New file).
-	* gm2/pim/pass/tinytrue.mod: (New file).
-	* gm2/pim/pass/tinyvar.mod: (New file).
-	* gm2/pim/pass/tinyvar2.mod: (New file).
-	* gm2/pim/pass/tinyvar3.mod: (New file).
-	* gm2/pim/pass/tinyvar4.mod: (New file).
-	* gm2/pim/pass/tinyvar5.mod: (New file).
-	* gm2/pim/pass/tinyvarient.mod: (New file).
-	* gm2/pim/pass/tinyvarient2.mod: (New file).
-	* gm2/pim/pass/tinyvarient3.def: (New file).
-	* gm2/pim/pass/tinyvarient3.mod: (New file).
-	* gm2/pim/pass/tinyvarient4.mod: (New file).
-	* gm2/pim/pass/tinyvarient5.mod: (New file).
-	* gm2/pim/pass/tinyvarient6.mod: (New file).
-	* gm2/pim/pass/tinywhile.mod: (New file).
-	* gm2/pim/pass/tinywith.mod: (New file).
-	* gm2/pim/pass/tinywith2.mod: (New file).
-	* gm2/pim/pass/tinywith3.mod: (New file).
-	* gm2/pim/pass/tinywith4.mod: (New file).
-	* gm2/pim/pass/tinywith5.mod: (New file).
-	* gm2/pim/pass/tinywith6.mod: (New file).
-	* gm2/pim/pass/trunc.mod: (New file).
-	* gm2/pim/pass/try: (New file).
-	* gm2/pim/pass/typeequiv.mod: (New file).
-	* gm2/pim/pass/typeequiv2.mod: (New file).
-	* gm2/pim/pass/typeequiv3.mod: (New file).
-	* gm2/pim/pass/typeonly.def: (New file).
-	* gm2/pim/pass/typeonly.mod: (New file).
-	* gm2/pim/pass/typesize.mod: (New file).
-	* gm2/pim/pass/unbounded.mod: (New file).
-	* gm2/pim/pass/unbounded2.mod: (New file).
-	* gm2/pim/pass/unbounded3.mod: (New file).
-	* gm2/pim/pass/v.def: (New file).
-	* gm2/pim/pass/varaddress.mod: (New file).
-	* gm2/pim/pass/varaddress2.mod: (New file).
-	* gm2/pim/pass/varaddress3.mod: (New file).
-	* gm2/pim/pass/varcard.mod: (New file).
-	* gm2/pim/pass/variant9.mod: (New file).
-	* gm2/pim/pass/varient.mod: (New file).
-	* gm2/pim/pass/varient2.mod: (New file).
-	* gm2/pim/pass/varient3.mod: (New file).
-	* gm2/pim/pass/varient4.mod: (New file).
-	* gm2/pim/pass/varient5.mod: (New file).
-	* gm2/pim/pass/varient6.mod: (New file).
-	* gm2/pim/pass/varient7.mod: (New file).
-	* gm2/pim/pass/varient8.mod: (New file).
-	* gm2/pim/pass/varin.def: (New file).
-	* gm2/pim/pass/varin.mod: (New file).
-	* gm2/pim/pass/varint.mod: (New file).
-	* gm2/pim/pass/wincat.mod: (New file).
-	* gm2/pim/pass/with.mod: (New file).
-	* gm2/pim/pass/wordconst.mod: (New file).
-	* gm2/pim/run/fail/case.mod: (New file).
-	* gm2/pim/run/fail/nil.mod: (New file).
-	* gm2/pim/run/fail/pim-run-fail.exp: (New file).
-	* gm2/pim/run/pass/Countdown.mod: (New file).
-	* gm2/pim/run/pass/EndFor.def: (New file).
-	* gm2/pim/run/pass/EndFor.mod: (New file).
-	* gm2/pim/run/pass/EnumTest.mod: (New file).
-	* gm2/pim/run/pass/For1.mod: (New file).
-	* gm2/pim/run/pass/For10.mod: (New file).
-	* gm2/pim/run/pass/For11.mod: (New file).
-	* gm2/pim/run/pass/For12.mod: (New file).
-	* gm2/pim/run/pass/For2.mod: (New file).
-	* gm2/pim/run/pass/For3.mod: (New file).
-	* gm2/pim/run/pass/For4.mod: (New file).
-	* gm2/pim/run/pass/For5.mod: (New file).
-	* gm2/pim/run/pass/For6.mod: (New file).
-	* gm2/pim/run/pass/For7.mod: (New file).
-	* gm2/pim/run/pass/For8.mod: (New file).
-	* gm2/pim/run/pass/For9.mod: (New file).
-	* gm2/pim/run/pass/FpuIOBug.mod: (New file).
-	* gm2/pim/run/pass/MaxReal.mod: (New file).
-	* gm2/pim/run/pass/MaxReal2.mod: (New file).
-	* gm2/pim/run/pass/TestLong.mod: (New file).
-	* gm2/pim/run/pass/TestLong2.mod: (New file).
-	* gm2/pim/run/pass/TestLong4.mod: (New file).
-	* gm2/pim/run/pass/TestLong5.mod: (New file).
-	* gm2/pim/run/pass/addrarray.mod: (New file).
-	* gm2/pim/run/pass/arraychar.mod: (New file).
-	* gm2/pim/run/pass/arraychar2.mod: (New file).
-	* gm2/pim/run/pass/arrayrecord.mod: (New file).
-	* gm2/pim/run/pass/bitsettest.def: (New file).
-	* gm2/pim/run/pass/bitsettest.mod: (New file).
-	* gm2/pim/run/pass/bytearray.mod: (New file).
-	* gm2/pim/run/pass/constdynstr.mod: (New file).
-	* gm2/pim/run/pass/conststr.mod: (New file).
-	* gm2/pim/run/pass/conststr2.mod: (New file).
-	* gm2/pim/run/pass/cycles.mod: (New file).
-	* gm2/pim/run/pass/dec.mod: (New file).
-	* gm2/pim/run/pass/enums.mod: (New file).
-	* gm2/pim/run/pass/incsubrange.def: (New file).
-	* gm2/pim/run/pass/incsubrange.mod: (New file).
-	* gm2/pim/run/pass/index3.mod: (New file).
-	* gm2/pim/run/pass/int16.mod: (New file).
-	* gm2/pim/run/pass/int32.mod: (New file).
-	* gm2/pim/run/pass/int8.mod: (New file).
-	* gm2/pim/run/pass/line.mod: (New file).
-	* gm2/pim/run/pass/long.mod: (New file).
-	* gm2/pim/run/pass/longfor.mod: (New file).
-	* gm2/pim/run/pass/longtypes10.mod: (New file).
-	* gm2/pim/run/pass/longtypes7.mod: (New file).
-	* gm2/pim/run/pass/longtypes8.mod: (New file).
-	* gm2/pim/run/pass/longtypes9.mod: (New file).
-	* gm2/pim/run/pass/math.mod: (New file).
-	* gm2/pim/run/pass/math2.mod: (New file).
-	* gm2/pim/run/pass/mathconst.mod: (New file).
-	* gm2/pim/run/pass/minhello.mod: (New file).
-	* gm2/pim/run/pass/minimal.mod: (New file).
-	* gm2/pim/run/pass/nestedproc.mod: (New file).
-	* gm2/pim/run/pass/nestedproc2.mod: (New file).
-	* gm2/pim/run/pass/nestedproc3.mod: (New file).
-	* gm2/pim/run/pass/nestedproc4.mod: (New file).
-	* gm2/pim/run/pass/nestedproc5.mod: (New file).
-	* gm2/pim/run/pass/nestedproc6.mod: (New file).
-	* gm2/pim/run/pass/nestedproc7.mod: (New file).
-	* gm2/pim/run/pass/nestedwith.mod: (New file).
-	* gm2/pim/run/pass/nestedwith2.mod: (New file).
-	* gm2/pim/run/pass/nestedwith3.mod: (New file).
-	* gm2/pim/run/pass/nothing.mod: (New file).
-	* gm2/pim/run/pass/pim-run-pass.exp: (New file).
-	* gm2/pim/run/pass/prog31ex.mod: (New file).
-	* gm2/pim/run/pass/rts.mod: (New file).
-	* gm2/pim/run/pass/setcritical.mod: (New file).
-	* gm2/pim/run/pass/setequiv.mod: (New file).
-	* gm2/pim/run/pass/str6.mod: (New file).
-	* gm2/pim/run/pass/stringaddr.mod: (New file).
-	* gm2/pim/run/pass/stringaddr2.def: (New file).
-	* gm2/pim/run/pass/stringaddr2.mod: (New file).
-	* gm2/pim/run/pass/stripped.mod: (New file).
-	* gm2/pim/run/pass/sys.def: (New file).
-	* gm2/pim/run/pass/sys.mod: (New file).
-	* gm2/pim/run/pass/t.def: (New file).
-	* gm2/pim/run/pass/testaddr.mod: (New file).
-	* gm2/pim/run/pass/testaddr2.mod: (New file).
-	* gm2/pim/run/pass/testaddr3.mod: (New file).
-	* gm2/pim/run/pass/testarray.mod: (New file).
-	* gm2/pim/run/pass/testarray2.mod: (New file).
-	* gm2/pim/run/pass/testarray3.mod: (New file).
-	* gm2/pim/run/pass/testarray4.mod: (New file).
-	* gm2/pim/run/pass/testarray5.mod: (New file).
-	* gm2/pim/run/pass/testavail.mod: (New file).
-	* gm2/pim/run/pass/testdiv.mod: (New file).
-	* gm2/pim/run/pass/testfpufunc.mod: (New file).
-	* gm2/pim/run/pass/testfpufunc2.mod: (New file).
-	* gm2/pim/run/pass/testlarge.mod: (New file).
-	* gm2/pim/run/pass/testlarge2.mod: (New file).
-	* gm2/pim/run/pass/testnextproc.mod: (New file).
-	* gm2/pim/run/pass/testparam.mod: (New file).
-	* gm2/pim/run/pass/testreturnstr.mod: (New file).
-	* gm2/pim/run/pass/testreturnstr2.mod: (New file).
-	* gm2/pim/run/pass/testreturnstr3.def: (New file).
-	* gm2/pim/run/pass/testreturnstr3.mod: (New file).
-	* gm2/pim/run/pass/testsize.mod: (New file).
-	* gm2/pim/run/pass/testsize2.mod: (New file).
-	* gm2/pim/run/pass/testsize3.mod: (New file).
-	* gm2/pim/run/pass/testsize4.mod: (New file).
-	* gm2/pim/run/pass/testtbitsize.mod: (New file).
-	* gm2/pim/run/pass/tinywith.mod: (New file).
-	* gm2/pim/run/pass/unbounded.mod: (New file).
-	* gm2/pim/run/pass/varaddress3.mod: (New file).
-	* gm2/pim/run/pass/varparam2.mod: (New file).
-	* gm2/pim/run/pass/varparam3.mod: (New file).
-	* gm2/pim/run/pass/varparm.mod: (New file).
-	* gm2/pim/run/pass/wr.mod: (New file).
-	* gm2/pimcoroutines/pass/imports.mod: (New file).
-	* gm2/pimcoroutines/pass/imports2.mod: (New file).
-	* gm2/pimcoroutines/pass/pimcoroutines-pass.exp: (New file).
-	* gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp: (New file).
-	* gm2/pimcoroutines/run/pass/testtime.mod: (New file).
-	* gm2/pimlib/base/run/pass/FIO.mod: (New file).
-	* gm2/pimlib/base/run/pass/StrLib.mod: (New file).
-	* gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp: (New file).
-	* gm2/pimlib/base/run/pass/testconvert.mod: (New file).
-	* gm2/pimlib/coroutines/pass/pimlib-coroutines-pass.exp: (New file).
-	* gm2/pimlib/coroutines/pass/priority.mod: (New file).
-	* gm2/pimlib/coroutines/pass/priority2.mod: (New file).
-	* gm2/pimlib/coroutines/pass/priority3.def: (New file).
-	* gm2/pimlib/coroutines/pass/priority3.mod: (New file).
-	* gm2/pimlib/logitech/pass/LogitechLong.mod: (New file).
-	* gm2/pimlib/logitech/pass/hello.mod: (New file).
-	* gm2/pimlib/logitech/pass/pimlib-logitech-pass.exp: (New file).
-	* gm2/pimlib/logitech/run/pass/bbits.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/hello.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/helloinout.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/intb.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: (New file).
-	* gm2/pimlib/logitech/run/pass/realconv.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/realinput.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/realinput2.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/realinput3.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/rename.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/timedate.mod: (New file).
-	* gm2/pimlib/logitech/run/pass/writeoct.mod: (New file).
-	* gm2/pimlib/pass/pimlib-pass.exp: (New file).
-	* gm2/pimlib/run/pass/format.mod: (New file).
-	* gm2/pimlib/run/pass/limittests.c: (New file).
-	* gm2/pimlib/run/pass/limittests.mod: (New file).
-	* gm2/pimlib/run/pass/longreal.mod: (New file).
-	* gm2/pimlib/run/pass/pimlib-run-pass.exp: (New file).
-	* gm2/pimlib/run/pass/test.c: (New file).
-	* gm2/pimlib/run/pass/testreal.mod: (New file).
-	* gm2/pimlib/run/pass/testreal2.mod: (New file).
-	* gm2/pimlib/run/pass/testreal4.mod: (New file).
-	* gm2/projects/README: (New file).
-	* gm2/projects/iso/run/pass/halma/halma.mod: (New file).
+	New file.
+	* gm2/pim/options/optimize/run/pass/testadd.mod: New file.
+	* gm2/pim/pass/ABSBug.mod: New file.
+	* gm2/pim/pass/TestLong4.mod: New file.
+	* gm2/pim/pass/TestLong7.mod: New file.
+	* gm2/pim/pass/TestLong8.mod: New file.
+	* gm2/pim/pass/TestLong9.mod: New file.
+	* gm2/pim/pass/another.mod: New file.
+	* gm2/pim/pass/aochar.mod: New file.
+	* gm2/pim/pass/array.mod: New file.
+	* gm2/pim/pass/array2.mod: New file.
+	* gm2/pim/pass/array3.mod: New file.
+	* gm2/pim/pass/array4.mod: New file.
+	* gm2/pim/pass/array5.mod: New file.
+	* gm2/pim/pass/array6.mod: New file.
+	* gm2/pim/pass/arraybool.mod: New file.
+	* gm2/pim/pass/arraychar.mod: New file.
+	* gm2/pim/pass/arraychar2.mod: New file.
+	* gm2/pim/pass/arraychar3.mod: New file.
+	* gm2/pim/pass/arrayconst1.mod: New file.
+	* gm2/pim/pass/arrayconst2.mod: New file.
+	* gm2/pim/pass/arrayconst3.mod: New file.
+	* gm2/pim/pass/arraydecl.mod: New file.
+	* gm2/pim/pass/arraydim.mod: New file.
+	* gm2/pim/pass/arraydyn.mod: New file.
+	* gm2/pim/pass/arrayeqiv.mod: New file.
+	* gm2/pim/pass/arrayfio.mod: New file.
+	* gm2/pim/pass/arrayhuge.mod: New file.
+	* gm2/pim/pass/arrayhuge2.mod: New file.
+	* gm2/pim/pass/arrayindex.mod: New file.
+	* gm2/pim/pass/arrayindirect.mod: New file.
+	* gm2/pim/pass/arrayinproc.mod: New file.
+	* gm2/pim/pass/arrayint.mod: New file.
+	* gm2/pim/pass/arrayofbyte.mod: New file.
+	* gm2/pim/pass/arrayofcard.mod: New file.
+	* gm2/pim/pass/arrayptr.mod: New file.
+	* gm2/pim/pass/arrayptr2.mod: New file.
+	* gm2/pim/pass/arrayptr3.mod: New file.
+	* gm2/pim/pass/arrayptr4.mod: New file.
+	* gm2/pim/pass/arrayptr5.mod: New file.
+	* gm2/pim/pass/arrayptr6.mod: New file.
+	* gm2/pim/pass/arrayrecord.mod: New file.
+	* gm2/pim/pass/arraytiny.c: New file.
+	* gm2/pim/pass/arraytiny.mod: New file.
+	* gm2/pim/pass/arraytype.mod: New file.
+	* gm2/pim/pass/arraytype2.mod: New file.
+	* gm2/pim/pass/arraytype3.mod: New file.
+	* gm2/pim/pass/arraytype4.mod: New file.
+	* gm2/pim/pass/assignment.mod: New file.
+	* gm2/pim/pass/assignment2.mod: New file.
+	* gm2/pim/pass/assignment3.mod: New file.
+	* gm2/pim/pass/assignment4.mod: New file.
+	* gm2/pim/pass/badpointer.mod: New file.
+	* gm2/pim/pass/bits32.def: New file.
+	* gm2/pim/pass/bits32.mod: New file.
+	* gm2/pim/pass/bits32i.mod: New file.
+	* gm2/pim/pass/bitset.mod: New file.
+	* gm2/pim/pass/bitset2.mod: New file.
+	* gm2/pim/pass/bitset3.mod: New file.
+	* gm2/pim/pass/bitset4.mod: New file.
+	* gm2/pim/pass/bitset5.mod: New file.
+	* gm2/pim/pass/bitsetfunc.mod: New file.
+	* gm2/pim/pass/block.mod: New file.
+	* gm2/pim/pass/blockindirect.mod: New file.
+	* gm2/pim/pass/builtin.def: New file.
+	* gm2/pim/pass/builtin.mod: New file.
+	* gm2/pim/pass/builtin2.mod: New file.
+	* gm2/pim/pass/builtinconst.mod: New file.
+	* gm2/pim/pass/bytearray.mod: New file.
+	* gm2/pim/pass/card.mod: New file.
+	* gm2/pim/pass/card2.mod: New file.
+	* gm2/pim/pass/char.mod: New file.
+	* gm2/pim/pass/char2.mod: New file.
+	* gm2/pim/pass/charproc.mod: New file.
+	* gm2/pim/pass/charset.mod: New file.
+	* gm2/pim/pass/charset2.mod: New file.
+	* gm2/pim/pass/charset3.mod: New file.
+	* gm2/pim/pass/checkparm.def: New file.
+	* gm2/pim/pass/checkparm.mod: New file.
+	* gm2/pim/pass/colour.mod: New file.
+	* gm2/pim/pass/comment1.mod: New file.
+	* gm2/pim/pass/complexarray.mod: New file.
+	* gm2/pim/pass/complextypes.mod: New file.
+	* gm2/pim/pass/constcast.mod: New file.
+	* gm2/pim/pass/constmax.mod: New file.
+	* gm2/pim/pass/constset.mod: New file.
+	* gm2/pim/pass/constset2.mod: New file.
+	* gm2/pim/pass/constset3.mod: New file.
+	* gm2/pim/pass/constsize.mod: New file.
+	* gm2/pim/pass/constsize2.mod: New file.
+	* gm2/pim/pass/convert.mod: New file.
+	* gm2/pim/pass/convert2.mod: New file.
+	* gm2/pim/pass/convert3.mod: New file.
+	* gm2/pim/pass/convert4.mod: New file.
+	* gm2/pim/pass/danglingelse.mod: New file.
+	* gm2/pim/pass/debug: New file.
+	* gm2/pim/pass/defset.def: New file.
+	* gm2/pim/pass/defset.mod: New file.
+	* gm2/pim/pass/deftype.mod: New file.
+	* gm2/pim/pass/divaddr.mod: New file.
+	* gm2/pim/pass/enum.mod: New file.
+	* gm2/pim/pass/enum2.mod: New file.
+	* gm2/pim/pass/enum3.mod: New file.
+	* gm2/pim/pass/file.mod: New file.
+	* gm2/pim/pass/filesystem.mod: New file.
+	* gm2/pim/pass/foo.mod: New file.
+	* gm2/pim/pass/foo2.mod: New file.
+	* gm2/pim/pass/for1.mod: New file.
+	* gm2/pim/pass/function.mod: New file.
+	* gm2/pim/pass/function2.mod: New file.
+	* gm2/pim/pass/gcd.def: New file.
+	* gm2/pim/pass/gcd.mod: New file.
+	* gm2/pim/pass/getconst.mod: New file.
+	* gm2/pim/pass/hello.mod: New file.
+	* gm2/pim/pass/impa.mod: New file.
+	* gm2/pim/pass/impb.def: New file.
+	* gm2/pim/pass/impb.mod: New file.
+	* gm2/pim/pass/impc.def: New file.
+	* gm2/pim/pass/impc.mod: New file.
+	* gm2/pim/pass/impd.mod: New file.
+	* gm2/pim/pass/impe.mod: New file.
+	* gm2/pim/pass/impf.mod: New file.
+	* gm2/pim/pass/impg.mod: New file.
+	* gm2/pim/pass/imph.mod: New file.
+	* gm2/pim/pass/impi.mod: New file.
+	* gm2/pim/pass/impj.mod: New file.
+	* gm2/pim/pass/impk.mod: New file.
+	* gm2/pim/pass/impl.mod: New file.
+	* gm2/pim/pass/impm.mod: New file.
+	* gm2/pim/pass/impn.def: New file.
+	* gm2/pim/pass/impn.mod: New file.
+	* gm2/pim/pass/impo.mod: New file.
+	* gm2/pim/pass/imports.mod: New file.
+	* gm2/pim/pass/impp.def: New file.
+	* gm2/pim/pass/impp.mod: New file.
+	* gm2/pim/pass/impq.def: New file.
+	* gm2/pim/pass/impq.mod: New file.
+	* gm2/pim/pass/incompsets.mod: New file.
+	* gm2/pim/pass/index.mod: New file.
+	* gm2/pim/pass/index2.mod: New file.
+	* gm2/pim/pass/indirect.mod: New file.
+	* gm2/pim/pass/inner.mod: New file.
+	* gm2/pim/pass/inner2.mod: New file.
+	* gm2/pim/pass/int.mod: New file.
+	* gm2/pim/pass/largeset.mod: New file.
+	* gm2/pim/pass/largeset1.mod: New file.
+	* gm2/pim/pass/largeset2.mod: New file.
+	* gm2/pim/pass/largeset3.mod: New file.
+	* gm2/pim/pass/largeset4.mod: New file.
+	* gm2/pim/pass/largeset5.mod: New file.
+	* gm2/pim/pass/largeset6.mod: New file.
+	* gm2/pim/pass/largeset7.mod: New file.
+	* gm2/pim/pass/localmod.mod: New file.
+	* gm2/pim/pass/localproc.mod: New file.
+	* gm2/pim/pass/localvar.mod: New file.
+	* gm2/pim/pass/log: New file.
+	* gm2/pim/pass/longint.mod: New file.
+	* gm2/pim/pass/longint2.mod: New file.
+	* gm2/pim/pass/longmm.mod: New file.
+	* gm2/pim/pass/longreal.mod: New file.
+	* gm2/pim/pass/longtypes.mod: New file.
+	* gm2/pim/pass/longtypes3.mod: New file.
+	* gm2/pim/pass/longtypes4.mod: New file.
+	* gm2/pim/pass/longtypes5.mod: New file.
+	* gm2/pim/pass/longtypes6.mod: New file.
+	* gm2/pim/pass/loopexit.mod: New file.
+	* gm2/pim/pass/math.mod: New file.
+	* gm2/pim/pass/maxlongint.mod: New file.
+	* gm2/pim/pass/maxreal.mod: New file.
+	* gm2/pim/pass/maxreal2.mod: New file.
+	* gm2/pim/pass/minmaxconst.mod: New file.
+	* gm2/pim/pass/minmaxconst2.mod: New file.
+	* gm2/pim/pass/modaddr.mod: New file.
+	* gm2/pim/pass/multaddr.mod: New file.
+	* gm2/pim/pass/multiple.mod: New file.
+	* gm2/pim/pass/multiset.mod: New file.
+	* gm2/pim/pass/multtypes.mod: New file.
+	* gm2/pim/pass/mydef.def: New file.
+	* gm2/pim/pass/negatives.def: New file.
+	* gm2/pim/pass/negatives.mod: New file.
+	* gm2/pim/pass/nested.mod: New file.
+	* gm2/pim/pass/nested2.mod: New file.
+	* gm2/pim/pass/nested3.mod: New file.
+	* gm2/pim/pass/nested4.mod: New file.
+	* gm2/pim/pass/nested5.mod: New file.
+	* gm2/pim/pass/nested6.mod: New file.
+	* gm2/pim/pass/nested7.mod: New file.
+	* gm2/pim/pass/nestedfor.mod: New file.
+	* gm2/pim/pass/nestedif.mod: New file.
+	* gm2/pim/pass/nestedset.mod: New file.
+	* gm2/pim/pass/onezero.mod: New file.
+	* gm2/pim/pass/opaque.def: New file.
+	* gm2/pim/pass/opaque.mod: New file.
+	* gm2/pim/pass/opaque2.mod: New file.
+	* gm2/pim/pass/opaquetype.def: New file.
+	* gm2/pim/pass/opaquetype.mod: New file.
+	* gm2/pim/pass/param.mod: New file.
+	* gm2/pim/pass/param2.mod: New file.
+	* gm2/pim/pass/param3.mod: New file.
+	* gm2/pim/pass/parambool.mod: New file.
+	* gm2/pim/pass/paramreal.mod: New file.
+	* gm2/pim/pass/pim-pass.exp: New file.
+	* gm2/pim/pass/pimimp.mod: New file.
+	* gm2/pim/pass/pointer.mod: New file.
+	* gm2/pim/pass/procadr.mod: New file.
+	* gm2/pim/pass/procconv.mod: New file.
+	* gm2/pim/pass/procconv2.mod: New file.
+	* gm2/pim/pass/procedure1.mod: New file.
+	* gm2/pim/pass/procedure2.mod: New file.
+	* gm2/pim/pass/procindirect.mod: New file.
+	* gm2/pim/pass/procmod.mod: New file.
+	* gm2/pim/pass/procmod2.mod: New file.
+	* gm2/pim/pass/procmod3.mod: New file.
+	* gm2/pim/pass/procmod31.mod: New file.
+	* gm2/pim/pass/procmod4.mod: New file.
+	* gm2/pim/pass/procmod5.mod: New file.
+	* gm2/pim/pass/procmod6.def: New file.
+	* gm2/pim/pass/procmod6.mod: New file.
+	* gm2/pim/pass/procmod7.mod: New file.
+	* gm2/pim/pass/procmod8.mod: New file.
+	* gm2/pim/pass/procmod9.mod: New file.
+	* gm2/pim/pass/proctype.mod: New file.
+	* gm2/pim/pass/proctype2.def: New file.
+	* gm2/pim/pass/proctype3.mod: New file.
+	* gm2/pim/pass/proctype4.mod: New file.
+	* gm2/pim/pass/program.mod: New file.
+	* gm2/pim/pass/program2.mod: New file.
+	* gm2/pim/pass/ptrarray.mod: New file.
+	* gm2/pim/pass/ptrarray2.mod: New file.
+	* gm2/pim/pass/ptrarray3.mod: New file.
+	* gm2/pim/pass/ptrcard.mod: New file.
+	* gm2/pim/pass/quads.def: New file.
+	* gm2/pim/pass/quads.mod: New file.
+	* gm2/pim/pass/real.mod: New file.
+	* gm2/pim/pass/real2.mod: New file.
+	* gm2/pim/pass/real3.mod: New file.
+	* gm2/pim/pass/realconst.mod: New file.
+	* gm2/pim/pass/realneg.mod: New file.
+	* gm2/pim/pass/realneg2.mod: New file.
+	* gm2/pim/pass/realone.mod: New file.
+	* gm2/pim/pass/realsize.mod: New file.
+	* gm2/pim/pass/record1.mod: New file.
+	* gm2/pim/pass/record10.mod: New file.
+	* gm2/pim/pass/record11.mod: New file.
+	* gm2/pim/pass/record12.def: New file.
+	* gm2/pim/pass/record13.def: New file.
+	* gm2/pim/pass/record14.def: New file.
+	* gm2/pim/pass/record15.def: New file.
+	* gm2/pim/pass/record16.def: New file.
+	* gm2/pim/pass/record2.mod: New file.
+	* gm2/pim/pass/record3.mod: New file.
+	* gm2/pim/pass/record4.mod: New file.
+	* gm2/pim/pass/record5.mod: New file.
+	* gm2/pim/pass/record6.mod: New file.
+	* gm2/pim/pass/record7.mod: New file.
+	* gm2/pim/pass/record8.mod: New file.
+	* gm2/pim/pass/record9.mod: New file.
+	* gm2/pim/pass/recordarray.c: New file.
+	* gm2/pim/pass/recordarray.mod: New file.
+	* gm2/pim/pass/recordarray2.mod: New file.
+	* gm2/pim/pass/redef.mod: New file.
+	* gm2/pim/pass/set10.mod: New file.
+	* gm2/pim/pass/set11.def: New file.
+	* gm2/pim/pass/set11.mod: New file.
+	* gm2/pim/pass/set12.mod: New file.
+	* gm2/pim/pass/set4.mod: New file.
+	* gm2/pim/pass/set5.mod: New file.
+	* gm2/pim/pass/set6.mod: New file.
+	* gm2/pim/pass/set7.mod: New file.
+	* gm2/pim/pass/set8.mod: New file.
+	* gm2/pim/pass/set9.mod: New file.
+	* gm2/pim/pass/setchar.mod: New file.
+	* gm2/pim/pass/setchar10.mod: New file.
+	* gm2/pim/pass/setchar11.mod: New file.
+	* gm2/pim/pass/setchar3.mod: New file.
+	* gm2/pim/pass/setchar4.mod: New file.
+	* gm2/pim/pass/setchar5.mod: New file.
+	* gm2/pim/pass/setchar7.mod: New file.
+	* gm2/pim/pass/setchar8.mod: New file.
+	* gm2/pim/pass/setchar9.mod: New file.
+	* gm2/pim/pass/setconst.mod: New file.
+	* gm2/pim/pass/setconst2.mod: New file.
+	* gm2/pim/pass/setconst3.mod: New file.
+	* gm2/pim/pass/setenum.mod: New file.
+	* gm2/pim/pass/setimp.mod: New file.
+	* gm2/pim/pass/setimp2.mod: New file.
+	* gm2/pim/pass/setofchar.mod: New file.
+	* gm2/pim/pass/setoverflow.mod: New file.
+	* gm2/pim/pass/sets.mod: New file.
+	* gm2/pim/pass/sets2.mod: New file.
+	* gm2/pim/pass/sets3.mod: New file.
+	* gm2/pim/pass/sets4.mod: New file.
+	* gm2/pim/pass/sets5.mod: New file.
+	* gm2/pim/pass/sets6.mod: New file.
+	* gm2/pim/pass/setsnul.mod: New file.
+	* gm2/pim/pass/settest1.mod: New file.
+	* gm2/pim/pass/settest2.mod: New file.
+	* gm2/pim/pass/settest3.mod: New file.
+	* gm2/pim/pass/simpleproc.mod: New file.
+	* gm2/pim/pass/sizes.mod: New file.
+	* gm2/pim/pass/sizetype.mod: New file.
+	* gm2/pim/pass/smallset1.mod: New file.
+	* gm2/pim/pass/smallset2.mod: New file.
+	* gm2/pim/pass/smallset3.mod: New file.
+	* gm2/pim/pass/smallset4.mod: New file.
+	* gm2/pim/pass/smallset5.mod: New file.
+	* gm2/pim/pass/smallset6.mod: New file.
+	* gm2/pim/pass/smallset7.mod: New file.
+	* gm2/pim/pass/stabs.mod: New file.
+	* gm2/pim/pass/stdio.mod: New file.
+	* gm2/pim/pass/str1.mod: New file.
+	* gm2/pim/pass/str2.mod: New file.
+	* gm2/pim/pass/str3.mod: New file.
+	* gm2/pim/pass/str4.mod: New file.
+	* gm2/pim/pass/str5.mod: New file.
+	* gm2/pim/pass/stressset.mod: New file.
+	* gm2/pim/pass/stringassign.mod: New file.
+	* gm2/pim/pass/stringopaq.mod: New file.
+	* gm2/pim/pass/strings.mod: New file.
+	* gm2/pim/pass/strparam.def: New file.
+	* gm2/pim/pass/strparam.mod: New file.
+	* gm2/pim/pass/subrange.mod: New file.
+	* gm2/pim/pass/subrange10.mod: New file.
+	* gm2/pim/pass/subrange11.mod: New file.
+	* gm2/pim/pass/subrange12.mod: New file.
+	* gm2/pim/pass/subrange14.mod: New file.
+	* gm2/pim/pass/subrange15.mod: New file.
+	* gm2/pim/pass/subrange16.mod: New file.
+	* gm2/pim/pass/subrange17.mod: New file.
+	* gm2/pim/pass/subrange2.mod: New file.
+	* gm2/pim/pass/subrange3.mod: New file.
+	* gm2/pim/pass/subrange4.mod: New file.
+	* gm2/pim/pass/subrange5.mod: New file.
+	* gm2/pim/pass/subrange6.mod: New file.
+	* gm2/pim/pass/subrange7.mod: New file.
+	* gm2/pim/pass/subrange8.mod: New file.
+	* gm2/pim/pass/subrange9.mod: New file.
+	* gm2/pim/pass/test2recursive.mod: New file.
+	* gm2/pim/pass/testabs.mod: New file.
+	* gm2/pim/pass/testbuiltin.mod: New file.
+	* gm2/pim/pass/testbuiltin2.mod: New file.
+	* gm2/pim/pass/testbuiltstr.mod: New file.
+	* gm2/pim/pass/testcap.mod: New file.
+	* gm2/pim/pass/testcap2.mod: New file.
+	* gm2/pim/pass/testcard.mod: New file.
+	* gm2/pim/pass/testcard2.mod: New file.
+	* gm2/pim/pass/testcard3.mod: New file.
+	* gm2/pim/pass/testcard4.mod: New file.
+	* gm2/pim/pass/testcard5.mod: New file.
+	* gm2/pim/pass/testcase.mod: New file.
+	* gm2/pim/pass/testcase2.mod: New file.
+	* gm2/pim/pass/testcase3.mod: New file.
+	* gm2/pim/pass/testcase4.mod: New file.
+	* gm2/pim/pass/testchar.mod: New file.
+	* gm2/pim/pass/testfloat.mod: New file.
+	* gm2/pim/pass/testfloat2.mod: New file.
+	* gm2/pim/pass/testfloat3.mod: New file.
+	* gm2/pim/pass/testfloat4.mod: New file.
+	* gm2/pim/pass/testfor.mod: New file.
+	* gm2/pim/pass/testimpvar.mod: New file.
+	* gm2/pim/pass/testlong3.mod: New file.
+	* gm2/pim/pass/testmod.mod: New file.
+	* gm2/pim/pass/testmod2.mod: New file.
+	* gm2/pim/pass/testodd.mod: New file.
+	* gm2/pim/pass/testopaque.mod: New file.
+	* gm2/pim/pass/testopaque2.mod: New file.
+	* gm2/pim/pass/testopaque3.mod: New file.
+	* gm2/pim/pass/testord.mod: New file.
+	* gm2/pim/pass/testparam.mod: New file.
+	* gm2/pim/pass/testparam2.mod: New file.
+	* gm2/pim/pass/testparam3.mod: New file.
+	* gm2/pim/pass/testpimsize.mod: New file.
+	* gm2/pim/pass/testrecursive.def: New file.
+	* gm2/pim/pass/testrecursive.mod: New file.
+	* gm2/pim/pass/testreturnstr.mod: New file.
+	* gm2/pim/pass/testset.mod: New file.
+	* gm2/pim/pass/testshort.mod: New file.
+	* gm2/pim/pass/testsinf.mod: New file.
+	* gm2/pim/pass/testsinl.mod: New file.
+	* gm2/pim/pass/testsize.mod: New file.
+	* gm2/pim/pass/testvar.mod: New file.
+	* gm2/pim/pass/testvarin.mod: New file.
+	* gm2/pim/pass/timeio.mod: New file.
+	* gm2/pim/pass/timeio2.mod: New file.
+	* gm2/pim/pass/timeio3.mod: New file.
+	* gm2/pim/pass/timeio4.mod: New file.
+	* gm2/pim/pass/timeio5.mod: New file.
+	* gm2/pim/pass/timeio6.mod: New file.
+	* gm2/pim/pass/timeio7.mod: New file.
+	* gm2/pim/pass/timeio8.mod: New file.
+	* gm2/pim/pass/timeio9.mod: New file.
+	* gm2/pim/pass/tinyalloc.mod: New file.
+	* gm2/pim/pass/tinyarray.mod: New file.
+	* gm2/pim/pass/tinyarray2.mod: New file.
+	* gm2/pim/pass/tinyarray3.mod: New file.
+	* gm2/pim/pass/tinyarray4.mod: New file.
+	* gm2/pim/pass/tinyarray5.mod: New file.
+	* gm2/pim/pass/tinyarray6.mod: New file.
+	* gm2/pim/pass/tinyassign.def: New file.
+	* gm2/pim/pass/tinyassign.mod: New file.
+	* gm2/pim/pass/tinyassign2.mod: New file.
+	* gm2/pim/pass/tinyassign3.mod: New file.
+	* gm2/pim/pass/tinyassign4.mod: New file.
+	* gm2/pim/pass/tinyassign5.mod: New file.
+	* gm2/pim/pass/tinybitset.mod: New file.
+	* gm2/pim/pass/tinyelse.mod: New file.
+	* gm2/pim/pass/tinyenum.mod: New file.
+	* gm2/pim/pass/tinyfor.mod: New file.
+	* gm2/pim/pass/tinyfor2.mod: New file.
+	* gm2/pim/pass/tinyfor3.mod: New file.
+	* gm2/pim/pass/tinyhalt.mod: New file.
+	* gm2/pim/pass/tinyhello.mod: New file.
+	* gm2/pim/pass/tinyif.mod: New file.
+	* gm2/pim/pass/tinyif2.mod: New file.
+	* gm2/pim/pass/tinyif3.mod: New file.
+	* gm2/pim/pass/tinyif4.mod: New file.
+	* gm2/pim/pass/tinyif5.mod: New file.
+	* gm2/pim/pass/tinyif6.mod: New file.
+	* gm2/pim/pass/tinyif7.mod: New file.
+	* gm2/pim/pass/tinyif8.mod: New file.
+	* gm2/pim/pass/tinyimp.mod: New file.
+	* gm2/pim/pass/tinylit.mod: New file.
+	* gm2/pim/pass/tinylit2.mod: New file.
+	* gm2/pim/pass/tinymax.mod: New file.
+	* gm2/pim/pass/tinymod.mod: New file.
+	* gm2/pim/pass/tinynode.mod: New file.
+	* gm2/pim/pass/tinyparam.mod: New file.
+	* gm2/pim/pass/tinyparam2.mod: New file.
+	* gm2/pim/pass/tinyplus.mod: New file.
+	* gm2/pim/pass/tinyproc.mod: New file.
+	* gm2/pim/pass/tinyproc2.mod: New file.
+	* gm2/pim/pass/tinyproc3.mod: New file.
+	* gm2/pim/pass/tinyproc4.mod: New file.
+	* gm2/pim/pass/tinyproc5.mod: New file.
+	* gm2/pim/pass/tinyproc6.mod: New file.
+	* gm2/pim/pass/tinyptr.mod: New file.
+	* gm2/pim/pass/tinyreal.mod: New file.
+	* gm2/pim/pass/tinyrecord.mod: New file.
+	* gm2/pim/pass/tinyrepeat.mod: New file.
+	* gm2/pim/pass/tinyset6.mod: New file.
+	* gm2/pim/pass/tinyset7.mod: New file.
+	* gm2/pim/pass/tinystate.mod: New file.
+	* gm2/pim/pass/tinysub.def: New file.
+	* gm2/pim/pass/tinytest.mod: New file.
+	* gm2/pim/pass/tinytrue.mod: New file.
+	* gm2/pim/pass/tinyvar.mod: New file.
+	* gm2/pim/pass/tinyvar2.mod: New file.
+	* gm2/pim/pass/tinyvar3.mod: New file.
+	* gm2/pim/pass/tinyvar4.mod: New file.
+	* gm2/pim/pass/tinyvar5.mod: New file.
+	* gm2/pim/pass/tinyvarient.mod: New file.
+	* gm2/pim/pass/tinyvarient2.mod: New file.
+	* gm2/pim/pass/tinyvarient3.def: New file.
+	* gm2/pim/pass/tinyvarient3.mod: New file.
+	* gm2/pim/pass/tinyvarient4.mod: New file.
+	* gm2/pim/pass/tinyvarient5.mod: New file.
+	* gm2/pim/pass/tinyvarient6.mod: New file.
+	* gm2/pim/pass/tinywhile.mod: New file.
+	* gm2/pim/pass/tinywith.mod: New file.
+	* gm2/pim/pass/tinywith2.mod: New file.
+	* gm2/pim/pass/tinywith3.mod: New file.
+	* gm2/pim/pass/tinywith4.mod: New file.
+	* gm2/pim/pass/tinywith5.mod: New file.
+	* gm2/pim/pass/tinywith6.mod: New file.
+	* gm2/pim/pass/trunc.mod: New file.
+	* gm2/pim/pass/try: New file.
+	* gm2/pim/pass/typeequiv.mod: New file.
+	* gm2/pim/pass/typeequiv2.mod: New file.
+	* gm2/pim/pass/typeequiv3.mod: New file.
+	* gm2/pim/pass/typeonly.def: New file.
+	* gm2/pim/pass/typeonly.mod: New file.
+	* gm2/pim/pass/typesize.mod: New file.
+	* gm2/pim/pass/unbounded.mod: New file.
+	* gm2/pim/pass/unbounded2.mod: New file.
+	* gm2/pim/pass/unbounded3.mod: New file.
+	* gm2/pim/pass/v.def: New file.
+	* gm2/pim/pass/varaddress.mod: New file.
+	* gm2/pim/pass/varaddress2.mod: New file.
+	* gm2/pim/pass/varaddress3.mod: New file.
+	* gm2/pim/pass/varcard.mod: New file.
+	* gm2/pim/pass/variant9.mod: New file.
+	* gm2/pim/pass/varient.mod: New file.
+	* gm2/pim/pass/varient2.mod: New file.
+	* gm2/pim/pass/varient3.mod: New file.
+	* gm2/pim/pass/varient4.mod: New file.
+	* gm2/pim/pass/varient5.mod: New file.
+	* gm2/pim/pass/varient6.mod: New file.
+	* gm2/pim/pass/varient7.mod: New file.
+	* gm2/pim/pass/varient8.mod: New file.
+	* gm2/pim/pass/varin.def: New file.
+	* gm2/pim/pass/varin.mod: New file.
+	* gm2/pim/pass/varint.mod: New file.
+	* gm2/pim/pass/wincat.mod: New file.
+	* gm2/pim/pass/with.mod: New file.
+	* gm2/pim/pass/wordconst.mod: New file.
+	* gm2/pim/run/fail/case.mod: New file.
+	* gm2/pim/run/fail/nil.mod: New file.
+	* gm2/pim/run/fail/pim-run-fail.exp: New file.
+	* gm2/pim/run/pass/Countdown.mod: New file.
+	* gm2/pim/run/pass/EndFor.def: New file.
+	* gm2/pim/run/pass/EndFor.mod: New file.
+	* gm2/pim/run/pass/EnumTest.mod: New file.
+	* gm2/pim/run/pass/For1.mod: New file.
+	* gm2/pim/run/pass/For10.mod: New file.
+	* gm2/pim/run/pass/For11.mod: New file.
+	* gm2/pim/run/pass/For12.mod: New file.
+	* gm2/pim/run/pass/For2.mod: New file.
+	* gm2/pim/run/pass/For3.mod: New file.
+	* gm2/pim/run/pass/For4.mod: New file.
+	* gm2/pim/run/pass/For5.mod: New file.
+	* gm2/pim/run/pass/For6.mod: New file.
+	* gm2/pim/run/pass/For7.mod: New file.
+	* gm2/pim/run/pass/For8.mod: New file.
+	* gm2/pim/run/pass/For9.mod: New file.
+	* gm2/pim/run/pass/FpuIOBug.mod: New file.
+	* gm2/pim/run/pass/MaxReal.mod: New file.
+	* gm2/pim/run/pass/MaxReal2.mod: New file.
+	* gm2/pim/run/pass/TestLong.mod: New file.
+	* gm2/pim/run/pass/TestLong2.mod: New file.
+	* gm2/pim/run/pass/TestLong4.mod: New file.
+	* gm2/pim/run/pass/TestLong5.mod: New file.
+	* gm2/pim/run/pass/addrarray.mod: New file.
+	* gm2/pim/run/pass/arraychar.mod: New file.
+	* gm2/pim/run/pass/arraychar2.mod: New file.
+	* gm2/pim/run/pass/arrayrecord.mod: New file.
+	* gm2/pim/run/pass/bitsettest.def: New file.
+	* gm2/pim/run/pass/bitsettest.mod: New file.
+	* gm2/pim/run/pass/bytearray.mod: New file.
+	* gm2/pim/run/pass/constdynstr.mod: New file.
+	* gm2/pim/run/pass/conststr.mod: New file.
+	* gm2/pim/run/pass/conststr2.mod: New file.
+	* gm2/pim/run/pass/cycles.mod: New file.
+	* gm2/pim/run/pass/dec.mod: New file.
+	* gm2/pim/run/pass/enums.mod: New file.
+	* gm2/pim/run/pass/incsubrange.def: New file.
+	* gm2/pim/run/pass/incsubrange.mod: New file.
+	* gm2/pim/run/pass/index3.mod: New file.
+	* gm2/pim/run/pass/int16.mod: New file.
+	* gm2/pim/run/pass/int32.mod: New file.
+	* gm2/pim/run/pass/int8.mod: New file.
+	* gm2/pim/run/pass/line.mod: New file.
+	* gm2/pim/run/pass/long.mod: New file.
+	* gm2/pim/run/pass/longfor.mod: New file.
+	* gm2/pim/run/pass/longtypes10.mod: New file.
+	* gm2/pim/run/pass/longtypes7.mod: New file.
+	* gm2/pim/run/pass/longtypes8.mod: New file.
+	* gm2/pim/run/pass/longtypes9.mod: New file.
+	* gm2/pim/run/pass/math.mod: New file.
+	* gm2/pim/run/pass/math2.mod: New file.
+	* gm2/pim/run/pass/mathconst.mod: New file.
+	* gm2/pim/run/pass/minhello.mod: New file.
+	* gm2/pim/run/pass/minimal.mod: New file.
+	* gm2/pim/run/pass/nestedproc.mod: New file.
+	* gm2/pim/run/pass/nestedproc2.mod: New file.
+	* gm2/pim/run/pass/nestedproc3.mod: New file.
+	* gm2/pim/run/pass/nestedproc4.mod: New file.
+	* gm2/pim/run/pass/nestedproc5.mod: New file.
+	* gm2/pim/run/pass/nestedproc6.mod: New file.
+	* gm2/pim/run/pass/nestedproc7.mod: New file.
+	* gm2/pim/run/pass/nestedwith.mod: New file.
+	* gm2/pim/run/pass/nestedwith2.mod: New file.
+	* gm2/pim/run/pass/nestedwith3.mod: New file.
+	* gm2/pim/run/pass/nothing.mod: New file.
+	* gm2/pim/run/pass/pim-run-pass.exp: New file.
+	* gm2/pim/run/pass/prog31ex.mod: New file.
+	* gm2/pim/run/pass/rts.mod: New file.
+	* gm2/pim/run/pass/setcritical.mod: New file.
+	* gm2/pim/run/pass/setequiv.mod: New file.
+	* gm2/pim/run/pass/str6.mod: New file.
+	* gm2/pim/run/pass/stringaddr.mod: New file.
+	* gm2/pim/run/pass/stringaddr2.def: New file.
+	* gm2/pim/run/pass/stringaddr2.mod: New file.
+	* gm2/pim/run/pass/stripped.mod: New file.
+	* gm2/pim/run/pass/sys.def: New file.
+	* gm2/pim/run/pass/sys.mod: New file.
+	* gm2/pim/run/pass/t.def: New file.
+	* gm2/pim/run/pass/testaddr.mod: New file.
+	* gm2/pim/run/pass/testaddr2.mod: New file.
+	* gm2/pim/run/pass/testaddr3.mod: New file.
+	* gm2/pim/run/pass/testarray.mod: New file.
+	* gm2/pim/run/pass/testarray2.mod: New file.
+	* gm2/pim/run/pass/testarray3.mod: New file.
+	* gm2/pim/run/pass/testarray4.mod: New file.
+	* gm2/pim/run/pass/testarray5.mod: New file.
+	* gm2/pim/run/pass/testavail.mod: New file.
+	* gm2/pim/run/pass/testdiv.mod: New file.
+	* gm2/pim/run/pass/testfpufunc.mod: New file.
+	* gm2/pim/run/pass/testfpufunc2.mod: New file.
+	* gm2/pim/run/pass/testlarge.mod: New file.
+	* gm2/pim/run/pass/testlarge2.mod: New file.
+	* gm2/pim/run/pass/testnextproc.mod: New file.
+	* gm2/pim/run/pass/testparam.mod: New file.
+	* gm2/pim/run/pass/testreturnstr.mod: New file.
+	* gm2/pim/run/pass/testreturnstr2.mod: New file.
+	* gm2/pim/run/pass/testreturnstr3.def: New file.
+	* gm2/pim/run/pass/testreturnstr3.mod: New file.
+	* gm2/pim/run/pass/testsize.mod: New file.
+	* gm2/pim/run/pass/testsize2.mod: New file.
+	* gm2/pim/run/pass/testsize3.mod: New file.
+	* gm2/pim/run/pass/testsize4.mod: New file.
+	* gm2/pim/run/pass/testtbitsize.mod: New file.
+	* gm2/pim/run/pass/tinywith.mod: New file.
+	* gm2/pim/run/pass/unbounded.mod: New file.
+	* gm2/pim/run/pass/varaddress3.mod: New file.
+	* gm2/pim/run/pass/varparam2.mod: New file.
+	* gm2/pim/run/pass/varparam3.mod: New file.
+	* gm2/pim/run/pass/varparm.mod: New file.
+	* gm2/pim/run/pass/wr.mod: New file.
+	* gm2/pimcoroutines/pass/imports.mod: New file.
+	* gm2/pimcoroutines/pass/imports2.mod: New file.
+	* gm2/pimcoroutines/pass/pimcoroutines-pass.exp: New file.
+	* gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp: New file.
+	* gm2/pimcoroutines/run/pass/testtime.mod: New file.
+	* gm2/pimlib/base/run/pass/FIO.mod: New file.
+	* gm2/pimlib/base/run/pass/StrLib.mod: New file.
+	* gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp: New file.
+	* gm2/pimlib/base/run/pass/testconvert.mod: New file.
+	* gm2/pimlib/coroutines/pass/pimlib-coroutines-pass.exp: New file.
+	* gm2/pimlib/coroutines/pass/priority.mod: New file.
+	* gm2/pimlib/coroutines/pass/priority2.mod: New file.
+	* gm2/pimlib/coroutines/pass/priority3.def: New file.
+	* gm2/pimlib/coroutines/pass/priority3.mod: New file.
+	* gm2/pimlib/logitech/pass/LogitechLong.mod: New file.
+	* gm2/pimlib/logitech/pass/hello.mod: New file.
+	* gm2/pimlib/logitech/pass/pimlib-logitech-pass.exp: New file.
+	* gm2/pimlib/logitech/run/pass/bbits.mod: New file.
+	* gm2/pimlib/logitech/run/pass/hello.mod: New file.
+	* gm2/pimlib/logitech/run/pass/helloinout.mod: New file.
+	* gm2/pimlib/logitech/run/pass/intb.mod: New file.
+	* gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: New file.
+	* gm2/pimlib/logitech/run/pass/realconv.mod: New file.
+	* gm2/pimlib/logitech/run/pass/realinput.mod: New file.
+	* gm2/pimlib/logitech/run/pass/realinput2.mod: New file.
+	* gm2/pimlib/logitech/run/pass/realinput3.mod: New file.
+	* gm2/pimlib/logitech/run/pass/rename.mod: New file.
+	* gm2/pimlib/logitech/run/pass/timedate.mod: New file.
+	* gm2/pimlib/logitech/run/pass/writeoct.mod: New file.
+	* gm2/pimlib/pass/pimlib-pass.exp: New file.
+	* gm2/pimlib/run/pass/format.mod: New file.
+	* gm2/pimlib/run/pass/limittests.c: New file.
+	* gm2/pimlib/run/pass/limittests.mod: New file.
+	* gm2/pimlib/run/pass/longreal.mod: New file.
+	* gm2/pimlib/run/pass/pimlib-run-pass.exp: New file.
+	* gm2/pimlib/run/pass/test.c: New file.
+	* gm2/pimlib/run/pass/testreal.mod: New file.
+	* gm2/pimlib/run/pass/testreal2.mod: New file.
+	* gm2/pimlib/run/pass/testreal4.mod: New file.
+	* gm2/projects/README: New file.
+	* gm2/projects/iso/run/pass/halma/halma.mod: New file.
 	* gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp:
-	(New file).
-	* gm2/projects/iso/run/pass/hello/hello.mod: (New file).
+	New file.
+	* gm2/projects/iso/run/pass/hello/hello.mod: New file.
 	* gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp:
-	(New file).
-	* gm2/projects/log/run/pass/hello/hello.mod: (New file).
+	New file.
+	* gm2/projects/log/run/pass/hello/hello.mod: New file.
 	* gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp:
-	(New file).
-	* gm2/projects/pim/run/pass/hello/hello.mod: (New file).
+	New file.
+	* gm2/projects/pim/run/pass/hello/hello.mod: New file.
 	* gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp:
-	(New file).
-	* gm2/projects/pim/run/pass/random/AdvMap.def: (New file).
-	* gm2/projects/pim/run/pass/random/AdvMap.mod: (New file).
-	* gm2/projects/pim/run/pass/random/BoxMap.def: (New file).
-	* gm2/projects/pim/run/pass/random/BoxMap.mod: (New file).
-	* gm2/projects/pim/run/pass/random/Chance.def: (New file).
-	* gm2/projects/pim/run/pass/random/Chance.mod: (New file).
-	* gm2/projects/pim/run/pass/random/Geometry.def: (New file).
-	* gm2/projects/pim/run/pass/random/Geometry.mod: (New file).
-	* gm2/projects/pim/run/pass/random/MakeBoxes.def: (New file).
-	* gm2/projects/pim/run/pass/random/MakeBoxes.mod: (New file).
-	* gm2/projects/pim/run/pass/random/Map.mod: (New file).
-	* gm2/projects/pim/run/pass/random/MapOptions.def: (New file).
-	* gm2/projects/pim/run/pass/random/MapOptions.mod: (New file).
-	* gm2/projects/pim/run/pass/random/Options.def: (New file).
-	* gm2/projects/pim/run/pass/random/Options.mod: (New file).
-	* gm2/projects/pim/run/pass/random/RoomMap.def: (New file).
-	* gm2/projects/pim/run/pass/random/RoomMap.mod: (New file).
-	* gm2/projects/pim/run/pass/random/StoreCoords.def: (New file).
-	* gm2/projects/pim/run/pass/random/StoreCoords.mod: (New file).
-	* gm2/projects/pim/run/pass/random/WriteMap.def: (New file).
-	* gm2/projects/pim/run/pass/random/WriteMap.mod: (New file).
+	New file.
+	* gm2/projects/pim/run/pass/random/AdvMap.def: New file.
+	* gm2/projects/pim/run/pass/random/AdvMap.mod: New file.
+	* gm2/projects/pim/run/pass/random/BoxMap.def: New file.
+	* gm2/projects/pim/run/pass/random/BoxMap.mod: New file.
+	* gm2/projects/pim/run/pass/random/Chance.def: New file.
+	* gm2/projects/pim/run/pass/random/Chance.mod: New file.
+	* gm2/projects/pim/run/pass/random/Geometry.def: New file.
+	* gm2/projects/pim/run/pass/random/Geometry.mod: New file.
+	* gm2/projects/pim/run/pass/random/MakeBoxes.def: New file.
+	* gm2/projects/pim/run/pass/random/MakeBoxes.mod: New file.
+	* gm2/projects/pim/run/pass/random/Map.mod: New file.
+	* gm2/projects/pim/run/pass/random/MapOptions.def: New file.
+	* gm2/projects/pim/run/pass/random/MapOptions.mod: New file.
+	* gm2/projects/pim/run/pass/random/Options.def: New file.
+	* gm2/projects/pim/run/pass/random/Options.mod: New file.
+	* gm2/projects/pim/run/pass/random/RoomMap.def: New file.
+	* gm2/projects/pim/run/pass/random/RoomMap.mod: New file.
+	* gm2/projects/pim/run/pass/random/StoreCoords.def: New file.
+	* gm2/projects/pim/run/pass/random/StoreCoords.mod: New file.
+	* gm2/projects/pim/run/pass/random/WriteMap.def: New file.
+	* gm2/projects/pim/run/pass/random/WriteMap.mod: New file.
 	* gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp:
-	(New file).
-	* gm2/quads/run/pass/becomes.mod: (New file).
-	* gm2/quads/run/pass/param.mod: (New file).
-	* gm2/quads/run/pass/quads-run-pass.exp: (New file).
-	* gm2/quads/run/pass/return.mod: (New file).
-	* gm2/recover/pass/cannot-solve/begin.mod: (New file).
-	* gm2/recover/pass/cannot-solve/statementsemi.mod: (New file).
-	* gm2/recover/pass/end2.mod: (New file).
-	* gm2/recover/pass/of.mod: (New file).
-	* gm2/recover/pass/procsemi.mod: (New file).
-	* gm2/recover/pass/recover-pass.exp: (New file).
-	* gm2/recover/pass/rrbra.mod: (New file).
-	* gm2/recover/pass/rsbra.mod: (New file).
-	* gm2/recover/pass/semi.mod: (New file).
-	* gm2/run/fail/list.mod: (New file).
-	* gm2/run/fail/options: (New file).
-	* gm2/run/fail/testdec.mod: (New file).
-	* gm2/run/fail/testfunc.mod: (New file).
-	* gm2/run/pass/cycles.mod: (New file).
-	* gm2/run/pass/line.mod: (New file).
-	* gm2/run/pass/nestedproc.mod: (New file).
-	* gm2/run/pass/nestedproc2.mod: (New file).
-	* gm2/run/pass/nestedproc3.mod: (New file).
-	* gm2/run/pass/nestedproc5.mod: (New file).
-	* gm2/run/pass/nestedset.mod: (New file).
-	* gm2/run/pass/nothing.mod: (New file).
-	* gm2/run/pass/options: (New file).
-	* gm2/run/pass/prog31ex.mod: (New file).
-	* gm2/run/pass/rts.mod: (New file).
-	* gm2/run/pass/stripped.mod: (New file).
-	* gm2/run/pass/testavail.mod: (New file).
-	* gm2/run/pass/testfpufunc.mod: (New file).
-	* gm2/run/pass/testfpufunc2.mod: (New file).
-	* gm2/run/pass/testnextproc.mod: (New file).
-	* gm2/run/pass/testparam.mod: (New file).
-	* gm2/run/pass/testsize.mod: (New file).
-	* gm2/run/pass/testsize2.mod: (New file).
-	* gm2/run/pass/testsize3.mod: (New file).
-	* gm2/run/pass/wr.mod: (New file).
-	* gm2/scripts/addit: (New file).
-	* gm2/scripts/comp: (New file).
-	* gm2/scripts/compile: (New file).
-	* gm2/scripts/compileiso: (New file).
-	* gm2/scripts/link: (New file).
-	* gm2/scripts/regression: (New file).
-	* gm2/scripts/subit: (New file).
-	* gm2/sets/run/pass/multisetarith.mod: (New file).
-	* gm2/sets/run/pass/multisetarith2.mod: (New file).
-	* gm2/sets/run/pass/multisetarith3.mod: (New file).
-	* gm2/sets/run/pass/multisetarith4.mod: (New file).
-	* gm2/sets/run/pass/multisetrotate.mod: (New file).
-	* gm2/sets/run/pass/multisetrotate2.mod: (New file).
-	* gm2/sets/run/pass/multisetrotate3.mod: (New file).
-	* gm2/sets/run/pass/multisetrotate4.mod: (New file).
-	* gm2/sets/run/pass/multisetshift.mod: (New file).
-	* gm2/sets/run/pass/multisetshift2.mod: (New file).
-	* gm2/sets/run/pass/multisimple.mod: (New file).
-	* gm2/sets/run/pass/multisimple2.mod: (New file).
-	* gm2/sets/run/pass/multisimple3.mod: (New file).
-	* gm2/sets/run/pass/multisimple4.mod: (New file).
-	* gm2/sets/run/pass/multisimple5.mod: (New file).
-	* gm2/sets/run/pass/multisimple6.mod: (New file).
-	* gm2/sets/run/pass/multisimple7.mod: (New file).
-	* gm2/sets/run/pass/setarith.mod: (New file).
-	* gm2/sets/run/pass/setarith2.mod: (New file).
-	* gm2/sets/run/pass/setarith3.mod: (New file).
-	* gm2/sets/run/pass/setarith4.mod: (New file).
-	* gm2/sets/run/pass/setrotate.mod: (New file).
-	* gm2/sets/run/pass/setrotate2.mod: (New file).
-	* gm2/sets/run/pass/setrotate3.mod: (New file).
-	* gm2/sets/run/pass/setrotate4.mod: (New file).
-	* gm2/sets/run/pass/sets-run-pass.exp: (New file).
-	* gm2/sets/run/pass/setshift.mod: (New file).
-	* gm2/sets/run/pass/setshift2.mod: (New file).
-	* gm2/sets/run/pass/simple.mod: (New file).
-	* gm2/sets/run/pass/simple2.mod: (New file).
-	* gm2/sets/run/pass/simple3.mod: (New file).
-	* gm2/sets/run/pass/simple4.mod: (New file).
-	* gm2/sets/run/pass/simple5.mod: (New file).
-	* gm2/sets/run/pass/simple6.mod: (New file).
-	* gm2/sets/run/pass/simple7.mod: (New file).
-	* gm2/switches/auto-init/fail/switches-auto-init-fail.exp: (New file).
-	* gm2/switches/auto-init/fail/uninitptr.mod: (New file).
-	* gm2/switches/auto-init/fail/uninitptr2.mod: (New file).
-	* gm2/switches/check-all/pim2/fail/overflow.mod: (New file).
-	* gm2/switches/check-all/pim2/fail/overflow2.mod: (New file).
-	* gm2/switches/check-all/pim2/fail/overflowdiv1.mod: (New file).
+	New file.
+	* gm2/quads/run/pass/becomes.mod: New file.
+	* gm2/quads/run/pass/param.mod: New file.
+	* gm2/quads/run/pass/quads-run-pass.exp: New file.
+	* gm2/quads/run/pass/return.mod: New file.
+	* gm2/recover/pass/cannot-solve/begin.mod: New file.
+	* gm2/recover/pass/cannot-solve/statementsemi.mod: New file.
+	* gm2/recover/pass/end2.mod: New file.
+	* gm2/recover/pass/of.mod: New file.
+	* gm2/recover/pass/procsemi.mod: New file.
+	* gm2/recover/pass/recover-pass.exp: New file.
+	* gm2/recover/pass/rrbra.mod: New file.
+	* gm2/recover/pass/rsbra.mod: New file.
+	* gm2/recover/pass/semi.mod: New file.
+	* gm2/run/fail/list.mod: New file.
+	* gm2/run/fail/options: New file.
+	* gm2/run/fail/testdec.mod: New file.
+	* gm2/run/fail/testfunc.mod: New file.
+	* gm2/run/pass/cycles.mod: New file.
+	* gm2/run/pass/line.mod: New file.
+	* gm2/run/pass/nestedproc.mod: New file.
+	* gm2/run/pass/nestedproc2.mod: New file.
+	* gm2/run/pass/nestedproc3.mod: New file.
+	* gm2/run/pass/nestedproc5.mod: New file.
+	* gm2/run/pass/nestedset.mod: New file.
+	* gm2/run/pass/nothing.mod: New file.
+	* gm2/run/pass/options: New file.
+	* gm2/run/pass/prog31ex.mod: New file.
+	* gm2/run/pass/rts.mod: New file.
+	* gm2/run/pass/stripped.mod: New file.
+	* gm2/run/pass/testavail.mod: New file.
+	* gm2/run/pass/testfpufunc.mod: New file.
+	* gm2/run/pass/testfpufunc2.mod: New file.
+	* gm2/run/pass/testnextproc.mod: New file.
+	* gm2/run/pass/testparam.mod: New file.
+	* gm2/run/pass/testsize.mod: New file.
+	* gm2/run/pass/testsize2.mod: New file.
+	* gm2/run/pass/testsize3.mod: New file.
+	* gm2/run/pass/wr.mod: New file.
+	* gm2/scripts/addit: New file.
+	* gm2/scripts/comp: New file.
+	* gm2/scripts/compile: New file.
+	* gm2/scripts/compileiso: New file.
+	* gm2/scripts/link: New file.
+	* gm2/scripts/regression: New file.
+	* gm2/scripts/subit: New file.
+	* gm2/sets/run/pass/multisetarith.mod: New file.
+	* gm2/sets/run/pass/multisetarith2.mod: New file.
+	* gm2/sets/run/pass/multisetarith3.mod: New file.
+	* gm2/sets/run/pass/multisetarith4.mod: New file.
+	* gm2/sets/run/pass/multisetrotate.mod: New file.
+	* gm2/sets/run/pass/multisetrotate2.mod: New file.
+	* gm2/sets/run/pass/multisetrotate3.mod: New file.
+	* gm2/sets/run/pass/multisetrotate4.mod: New file.
+	* gm2/sets/run/pass/multisetshift.mod: New file.
+	* gm2/sets/run/pass/multisetshift2.mod: New file.
+	* gm2/sets/run/pass/multisimple.mod: New file.
+	* gm2/sets/run/pass/multisimple2.mod: New file.
+	* gm2/sets/run/pass/multisimple3.mod: New file.
+	* gm2/sets/run/pass/multisimple4.mod: New file.
+	* gm2/sets/run/pass/multisimple5.mod: New file.
+	* gm2/sets/run/pass/multisimple6.mod: New file.
+	* gm2/sets/run/pass/multisimple7.mod: New file.
+	* gm2/sets/run/pass/setarith.mod: New file.
+	* gm2/sets/run/pass/setarith2.mod: New file.
+	* gm2/sets/run/pass/setarith3.mod: New file.
+	* gm2/sets/run/pass/setarith4.mod: New file.
+	* gm2/sets/run/pass/setrotate.mod: New file.
+	* gm2/sets/run/pass/setrotate2.mod: New file.
+	* gm2/sets/run/pass/setrotate3.mod: New file.
+	* gm2/sets/run/pass/setrotate4.mod: New file.
+	* gm2/sets/run/pass/sets-run-pass.exp: New file.
+	* gm2/sets/run/pass/setshift.mod: New file.
+	* gm2/sets/run/pass/setshift2.mod: New file.
+	* gm2/sets/run/pass/simple.mod: New file.
+	* gm2/sets/run/pass/simple2.mod: New file.
+	* gm2/sets/run/pass/simple3.mod: New file.
+	* gm2/sets/run/pass/simple4.mod: New file.
+	* gm2/sets/run/pass/simple5.mod: New file.
+	* gm2/sets/run/pass/simple6.mod: New file.
+	* gm2/sets/run/pass/simple7.mod: New file.
+	* gm2/switches/auto-init/fail/switches-auto-init-fail.exp: New file.
+	* gm2/switches/auto-init/fail/uninitptr.mod: New file.
+	* gm2/switches/auto-init/fail/uninitptr2.mod: New file.
+	* gm2/switches/check-all/pim2/fail/overflow.mod: New file.
+	* gm2/switches/check-all/pim2/fail/overflow2.mod: New file.
+	* gm2/switches/check-all/pim2/fail/overflowdiv1.mod: New file.
 	* gm2/switches/check-all/pim2/fail/switches-check-all-pim2-fail.exp:
-	(New file).
-	* gm2/switches/check-all/plugin/iso/fail/divceilposneg.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/divceilposneg2.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall2.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/divfloornegpos.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/divfloorpospos.mod: (New file).
-	* gm2/switches/check-all/plugin/iso/fail/lowdiv.mod: (New file).
+	New file.
+	* gm2/switches/check-all/plugin/iso/fail/divceilposneg.mod: New file.
+	* gm2/switches/check-all/plugin/iso/fail/divceilposneg2.mod: New file.
+	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall.mod: New
+	file.
+	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall2.mod: New
+	file.
+	* gm2/switches/check-all/plugin/iso/fail/divfloornegpos.mod: New file.
+	* gm2/switches/check-all/plugin/iso/fail/divfloorpospos.mod: New file.
+	* gm2/switches/check-all/plugin/iso/fail/lowdiv.mod: New file.
 	* gm2/switches/check-all/plugin/iso/fail/switches-check-all-plugin-iso-fail.exp:
-	(New file).
-	* gm2/switches/check-all/plugin/pim2/fail/divceil.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/highdiv.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/modulus.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin1.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin3.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin4.def: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin4.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin5.def: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin5.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin6.def: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin6.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin7.def: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin7.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin8.def: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin8.mod: (New file).
-	* gm2/switches/check-all/plugin/pim2/fail/plugin9.mod: (New file).
+	New file.
+	* gm2/switches/check-all/plugin/pim2/fail/divceil.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/highdiv.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/modulus.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin1.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin3.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin4.def: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin4.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin5.def: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin5.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin6.def: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin6.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin7.def: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin7.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin8.def: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin8.mod: New file.
+	* gm2/switches/check-all/plugin/pim2/fail/plugin9.mod: New file.
 	* gm2/switches/check-all/plugin/pim2/fail/switches-check-all-plugin-pim2-fail.exp:
-	(New file).
-	* gm2/switches/check-all/run/fail/cardrange.mod: (New file).
-	* gm2/switches/check-all/run/fail/cardrange2.mod: (New file).
-	* gm2/switches/check-all/run/fail/cardrange3.mod: (New file).
-	* gm2/switches/check-all/run/fail/intrange.mod: (New file).
-	* gm2/switches/check-all/run/fail/intrange2.mod: (New file).
-	* gm2/switches/check-all/run/fail/intrange3.mod: (New file).
-	* gm2/switches/check-all/run/fail/intrange4.mod: (New file).
-	* gm2/switches/check-all/run/fail/intrange5.mod: (New file).
-	* gm2/switches/check-all/run/fail/multint1.mod: (New file).
-	* gm2/switches/check-all/run/fail/multint2.mod: (New file).
-	* gm2/switches/check-all/run/fail/multint3.mod: (New file).
-	* gm2/switches/check-all/run/fail/rangesupport.def: (New file).
-	* gm2/switches/check-all/run/fail/rangesupport.mod: (New file).
-	* gm2/switches/check-all/run/fail/realrange.mod: (New file).
-	* gm2/switches/check-all/run/fail/subrange.mod: (New file).
+	New file.
+	* gm2/switches/check-all/run/fail/cardrange.mod: New file.
+	* gm2/switches/check-all/run/fail/cardrange2.mod: New file.
+	* gm2/switches/check-all/run/fail/cardrange3.mod: New file.
+	* gm2/switches/check-all/run/fail/intrange.mod: New file.
+	* gm2/switches/check-all/run/fail/intrange2.mod: New file.
+	* gm2/switches/check-all/run/fail/intrange3.mod: New file.
+	* gm2/switches/check-all/run/fail/intrange4.mod: New file.
+	* gm2/switches/check-all/run/fail/intrange5.mod: New file.
+	* gm2/switches/check-all/run/fail/multint1.mod: New file.
+	* gm2/switches/check-all/run/fail/multint2.mod: New file.
+	* gm2/switches/check-all/run/fail/multint3.mod: New file.
+	* gm2/switches/check-all/run/fail/rangesupport.def: New file.
+	* gm2/switches/check-all/run/fail/rangesupport.mod: New file.
+	* gm2/switches/check-all/run/fail/realrange.mod: New file.
+	* gm2/switches/check-all/run/fail/subrange.mod: New file.
 	* gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp:
-	(New file).
-	* gm2/switches/check-all/run/fail/tinyrange.mod: (New file).
-	* gm2/switches/check-all/run/pass/cardrange.mod: (New file).
-	* gm2/switches/check-all/run/pass/forcheck.mod: (New file).
-	* gm2/switches/check-all/run/pass/subrange.mod: (New file).
+	New file.
+	* gm2/switches/check-all/run/fail/tinyrange.mod: New file.
+	* gm2/switches/check-all/run/pass/cardrange.mod: New file.
+	* gm2/switches/check-all/run/pass/forcheck.mod: New file.
+	* gm2/switches/check-all/run/pass/subrange.mod: New file.
 	* gm2/switches/check-all/run/pass/switches-check-all-run-pass.exp:
-	(New file).
-	* gm2/switches/extended-opaque/fail/a.def: (New file).
-	* gm2/switches/extended-opaque/fail/a.mod: (New file).
+	New file.
+	* gm2/switches/extended-opaque/fail/a.def: New file.
+	* gm2/switches/extended-opaque/fail/a.mod: New file.
 	* gm2/switches/extended-opaque/fail/switches-extended-opaque-fail.exp:
-	(New file).
-	* gm2/switches/extended-opaque/pass/a.def: (New file).
-	* gm2/switches/extended-opaque/pass/a.mod: (New file).
-	* gm2/switches/extended-opaque/pass/b.mod: (New file).
+	New file.
+	* gm2/switches/extended-opaque/pass/a.def: New file.
+	* gm2/switches/extended-opaque/pass/a.mod: New file.
+	* gm2/switches/extended-opaque/pass/b.mod: New file.
 	* gm2/switches/extended-opaque/pass/switches-extended-opaque-pass.exp:
-	(New file).
-	* gm2/switches/iso/run/pass/modulus.mod: (New file).
-	* gm2/switches/iso/run/pass/modulus4.mod: (New file).
-	* gm2/switches/iso/run/pass/switches-iso-run-pass.exp: (New file).
-	* gm2/switches/makeall/fail/switches-makeall-fail.exp: (New file).
-	* gm2/switches/makeall/fail/test.def: (New file).
-	* gm2/switches/makeall/fail/test.mod: (New file).
-	* gm2/switches/makeall/pass/switches-makeall-pass.exp: (New file).
-	* gm2/switches/makeall/pass/test.def: (New file).
-	* gm2/switches/makeall/pass/test.mod: (New file).
-	* gm2/switches/none/run/pass/gm2-none.exp: (New file).
-	* gm2/switches/none/run/pass/hello.mod: (New file).
-	* gm2/switches/optimization/run/pass/fact.mod: (New file).
+	New file.
+	* gm2/switches/iso/run/pass/modulus.mod: New file.
+	* gm2/switches/iso/run/pass/modulus4.mod: New file.
+	* gm2/switches/iso/run/pass/switches-iso-run-pass.exp: New file.
+	* gm2/switches/makeall/fail/switches-makeall-fail.exp: New file.
+	* gm2/switches/makeall/fail/test.def: New file.
+	* gm2/switches/makeall/fail/test.mod: New file.
+	* gm2/switches/makeall/pass/switches-makeall-pass.exp: New file.
+	* gm2/switches/makeall/pass/test.def: New file.
+	* gm2/switches/makeall/pass/test.mod: New file.
+	* gm2/switches/none/run/pass/gm2-none.exp: New file.
+	* gm2/switches/none/run/pass/hello.mod: New file.
+	* gm2/switches/optimization/run/pass/fact.mod: New file.
 	* gm2/switches/optimization/run/pass/switches-optimization-run-pass.exp:
-	(New file).
-	* gm2/switches/pedantic-params/fail/a.def: (New file).
-	* gm2/switches/pedantic-params/fail/a.mod: (New file).
+	New file.
+	* gm2/switches/pedantic-params/fail/a.def: New file.
+	* gm2/switches/pedantic-params/fail/a.mod: New file.
 	* gm2/switches/pedantic-params/fail/switches-pedantic-params-fail.exp:
-	(New file).
-	* gm2/switches/pedantic-params/pass/Strings.def: (New file).
-	* gm2/switches/pedantic-params/pass/Strings.mod: (New file).
-	* gm2/switches/pedantic-params/pass/Strings2.def: (New file).
-	* gm2/switches/pedantic-params/pass/Strings2.mod: (New file).
+	New file.
+	* gm2/switches/pedantic-params/pass/Strings.def: New file.
+	* gm2/switches/pedantic-params/pass/Strings.mod: New file.
+	* gm2/switches/pedantic-params/pass/Strings2.def: New file.
+	* gm2/switches/pedantic-params/pass/Strings2.mod: New file.
 	* gm2/switches/pedantic-params/pass/switches-pedantic-params-pass.exp:
-	(New file).
-	* gm2/switches/pedantic/fail/onlywrite.mod: (New file).
-	* gm2/switches/pedantic/fail/readb4.mod: (New file).
-	* gm2/switches/pic/run/pass/func.c: (New file).
-	* gm2/switches/pic/run/pass/func.mod: (New file).
-	* gm2/switches/pic/run/pass/func2.c: (New file).
-	* gm2/switches/pic/run/pass/func2.mod: (New file).
-	* gm2/switches/pic/run/pass/switches-pic-run-pass.exp: (New file).
-	* gm2/switches/pim2/run/pass/modulus.mod: (New file).
-	* gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp: (New file).
-	* gm2/switches/pim3/run/pass/modulus.mod: (New file).
-	* gm2/switches/pim3/run/pass/switches-pim3-run-pass.exp: (New file).
-	* gm2/switches/pim4/run/pass/FpuIOBug.mod: (New file).
-	* gm2/switches/pim4/run/pass/InOutBug.mod: (New file).
-	* gm2/switches/pim4/run/pass/NumberIOBug.mod: (New file).
-	* gm2/switches/pim4/run/pass/modulus.mod: (New file).
-	* gm2/switches/pim4/run/pass/modulus2.mod: (New file).
-	* gm2/switches/pim4/run/pass/switches-pim4-run-pass.exp: (New file).
-	* gm2/switches/whole-program/pass/run/hello.mod: (New file).
-	* gm2/switches/whole-program/pass/run/hello2.mod: (New file).
+	New file.
+	* gm2/switches/pedantic/fail/onlywrite.mod: New file.
+	* gm2/switches/pedantic/fail/readb4.mod: New file.
+	* gm2/switches/pic/run/pass/func.c: New file.
+	* gm2/switches/pic/run/pass/func.mod: New file.
+	* gm2/switches/pic/run/pass/func2.c: New file.
+	* gm2/switches/pic/run/pass/func2.mod: New file.
+	* gm2/switches/pic/run/pass/switches-pic-run-pass.exp: New file.
+	* gm2/switches/pim2/run/pass/modulus.mod: New file.
+	* gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp: New file.
+	* gm2/switches/pim3/run/pass/modulus.mod: New file.
+	* gm2/switches/pim3/run/pass/switches-pim3-run-pass.exp: New file.
+	* gm2/switches/pim4/run/pass/FpuIOBug.mod: New file.
+	* gm2/switches/pim4/run/pass/InOutBug.mod: New file.
+	* gm2/switches/pim4/run/pass/NumberIOBug.mod: New file.
+	* gm2/switches/pim4/run/pass/modulus.mod: New file.
+	* gm2/switches/pim4/run/pass/modulus2.mod: New file.
+	* gm2/switches/pim4/run/pass/switches-pim4-run-pass.exp: New file.
+	* gm2/switches/whole-program/pass/run/hello.mod: New file.
+	* gm2/switches/whole-program/pass/run/hello2.mod: New file.
 	* gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp:
-	(New file).
-	* gm2/switches/whole-program/pass/run/tiny.mod: (New file).
-	* gm2/switches/whole-program/pass/run/tiny2.mod: (New file).
-	* gm2/types/bitset.mod: (New file).
-	* gm2/types/bitset2.mod: (New file).
-	* gm2/types/bitset3.mod: (New file).
-	* gm2/types/charset.mod: (New file).
-	* gm2/types/const.mod: (New file).
-	* gm2/types/prog35.mod: (New file).
-	* gm2/types/real.mod: (New file).
-	* gm2/types/run/pass/d.c: (New file).
-	* gm2/types/run/pass/d.def: (New file).
-	* gm2/types/run/pass/types-run-pass.exp: (New file).
-	* gm2/types/run/pass/varient4.mod: (New file).
-	* gm2/types/run/pass/varient5.mod: (New file).
-	* gm2/types/string.mod: (New file).
-	* gm2/types/type1.mod: (New file).
-	* gm2/types/type2.mod: (New file).
-	* gm2/types/type3.mod: (New file).
-	* gm2/types/type4.mod: (New file).
-	* gm2/types/varient.mod: (New file).
-	* gm2/types/word.mod: (New file).
-	* gm2/ulmlib/pass/ulmlib-pass.exp: (New file).
-	* gm2/ulmlib/std/pass/ulmlib-std-pass.exp: (New file).
-	* gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp: (New file).
-	* gm2/warnings/todo/nestedproc6.mod: (New file).
-	* gm2/warnings/todo/options: (New file).
-	* gm2/warnings/todo/testfor.mod: (New file).
-	* gm2/warnings/todo/testfor2.mod: (New file).
-	* gm2/warnings/todo/testfor3.mod: (New file).
-	* gm2/warnings/todo/testkeywords.mod: (New file).
-	* gm2/warnings/todo/testloop.mod: (New file).
-	* gm2/warnings/todo/testscope.mod: (New file).
-	* gm2/warnings/todo/testscope2.mod: (New file).
-	* gm2/x86-asm/asm.mod: (New file).
-	* gm2/x86-asm/asm2.mod: (New file).
+	New file.
+	* gm2/switches/whole-program/pass/run/tiny.mod: New file.
+	* gm2/switches/whole-program/pass/run/tiny2.mod: New file.
+	* gm2/types/bitset.mod: New file.
+	* gm2/types/bitset2.mod: New file.
+	* gm2/types/bitset3.mod: New file.
+	* gm2/types/charset.mod: New file.
+	* gm2/types/const.mod: New file.
+	* gm2/types/prog35.mod: New file.
+	* gm2/types/real.mod: New file.
+	* gm2/types/run/pass/d.c: New file.
+	* gm2/types/run/pass/d.def: New file.
+	* gm2/types/run/pass/types-run-pass.exp: New file.
+	* gm2/types/run/pass/varient4.mod: New file.
+	* gm2/types/run/pass/varient5.mod: New file.
+	* gm2/types/string.mod: New file.
+	* gm2/types/type1.mod: New file.
+	* gm2/types/type2.mod: New file.
+	* gm2/types/type3.mod: New file.
+	* gm2/types/type4.mod: New file.
+	* gm2/types/varient.mod: New file.
+	* gm2/types/word.mod: New file.
+	* gm2/ulmlib/pass/ulmlib-pass.exp: New file.
+	* gm2/ulmlib/std/pass/ulmlib-std-pass.exp: New file.
+	* gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp: New file.
+	* gm2/warnings/todo/nestedproc6.mod: New file.
+	* gm2/warnings/todo/options: New file.
+	* gm2/warnings/todo/testfor.mod: New file.
+	* gm2/warnings/todo/testfor2.mod: New file.
+	* gm2/warnings/todo/testfor3.mod: New file.
+	* gm2/warnings/todo/testkeywords.mod: New file.
+	* gm2/warnings/todo/testloop.mod: New file.
+	* gm2/warnings/todo/testscope.mod: New file.
+	* gm2/warnings/todo/testscope2.mod: New file.
+	* gm2/x86-asm/asm.mod: New file.
+	* gm2/x86-asm/asm2.mod: New file.
 
 2022-12-14  Julian Brown  <julian@codesourcery.com>
 
diff --git a/libgm2/ChangeLog b/libgm2/ChangeLog
index 2251fb53907..310ca65ac44 100644
--- a/libgm2/ChangeLog
+++ b/libgm2/ChangeLog
@@ -1,39 +1,39 @@
 2022-12-14  Gaius Mulley  <gaiusmod2@gmail.com>
 
-	* Makefile.am: (New file).
-	* autogen.sh: (New file).
-	* config.h.in: (New file).
-	* configure.ac: (New file).
-	* libm2cor/KeyBoardLEDs.cc: (New file).
-	* libm2cor/Makefile.am: (New file).
-	* libm2iso/ChanConsts.h: (New file).
-	* libm2iso/ErrnoCategory.cc: (New file).
-	* libm2iso/Makefile.am: (New file).
-	* libm2iso/RTco.cc: (New file).
-	* libm2iso/m2rts.h: (New file).
-	* libm2iso/wrapsock.c: (New file).
-	* libm2iso/wraptime.c: (New file).
-	* libm2log/Break.c: (New file).
-	* libm2log/Makefile.am: (New file).
-	* libm2min/Makefile.am: (New file).
-	* libm2min/libc.c: (New file).
-	* libm2pim/Makefile.am: (New file).
-	* libm2pim/Selective.cc: (New file).
-	* libm2pim/SysExceptions.cc: (New file).
-	* libm2pim/UnixArgs.cc: (New file).
-	* libm2pim/cgetopt.cc: (New file).
-	* libm2pim/dtoa.cc: (New file).
-	* libm2pim/errno.cc: (New file).
-	* libm2pim/ldtoa.cc: (New file).
-	* libm2pim/sckt.cc: (New file).
-	* libm2pim/target.c: (New file).
-	* libm2pim/termios.cc: (New file).
-	* libm2pim/wrapc.c: (New file).
-	* configure: (Rebuilt).
-	* libm2log/Makefile.in: (Rebuilt).
-	* libm2min/Makefile.in: (Rebuilt).
-	* libm2cor/Makefile.in: (Rebuilt).
-	* libm2pim/Makefile.in: (Rebuilt).
-	* libm2iso/Makefile.in: (Rebuilt).
+	* Makefile.am: New file.
+	* autogen.sh: New file.
+	* config.h.in: New file.
+	* configure.ac: New file.
+	* libm2cor/KeyBoardLEDs.cc: New file.
+	* libm2cor/Makefile.am: New file.
+	* libm2iso/ChanConsts.h: New file.
+	* libm2iso/ErrnoCategory.cc: New file.
+	* libm2iso/Makefile.am: New file.
+	* libm2iso/RTco.cc: New file.
+	* libm2iso/m2rts.h: New file.
+	* libm2iso/wrapsock.c: New file.
+	* libm2iso/wraptime.c: New file.
+	* libm2log/Break.c: New file.
+	* libm2log/Makefile.am: New file.
+	* libm2min/Makefile.am: New file.
+	* libm2min/libc.c: New file.
+	* libm2pim/Makefile.am: New file.
+	* libm2pim/Selective.cc: New file.
+	* libm2pim/SysExceptions.cc: New file.
+	* libm2pim/UnixArgs.cc: New file.
+	* libm2pim/cgetopt.cc: New file.
+	* libm2pim/dtoa.cc: New file.
+	* libm2pim/errno.cc: New file.
+	* libm2pim/ldtoa.cc: New file.
+	* libm2pim/sckt.cc: New file.
+	* libm2pim/target.c: New file.
+	* libm2pim/termios.cc: New file.
+	* libm2pim/wrapc.c: New file.
+	* configure: Generated.
+	* libm2log/Makefile.in: Generated.
+	* libm2min/Makefile.in: Generated.
+	* libm2cor/Makefile.in: Generated.
+	* libm2pim/Makefile.in: Generated.
+	* libm2iso/Makefile.in: Generated.
 	* Makefile.in: New file.
 	* aclocal.m4: New file.
\ No newline at end of file


	Jakub


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter).
  2022-12-15 12:03         ` Jakub Jelinek
@ 2022-12-15 12:51           ` Gaius Mulley
  0 siblings, 0 replies; 8+ messages in thread
From: Gaius Mulley @ 2022-12-15 12:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches

Jakub Jelinek <jakub@redhat.com> writes:

> On Wed, Dec 14, 2022 at 08:35:07AM +0000, Gaius Mulley via Gcc-patches wrote:
>> thanks - this is the last patch tick.  So I'll actually do the merge now :-)
>
> I've committed following patch to fix up formatting of ChangeLog entries.

Many thanks and apologies for messing up the house style.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-15 12:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10  0:48 [PATCH v4 1/19] modula2 front end: changes outside gcc/m2, libgm2 and gcc/testsuite Gaius Mulley
2022-12-11 10:42 ` Richard Biener
2022-12-12  9:05   ` Gaius Mulley
2022-12-14  7:48   ` [PATCH v5 1/19] modula2 front end: Fixes, improvements detecting python3 and documentation generation (shorter) Gaius Mulley
2022-12-14  8:17     ` Richard Biener
2022-12-14  8:35       ` Gaius Mulley
2022-12-15 12:03         ` Jakub Jelinek
2022-12-15 12:51           ` Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).