Cours the Programming Language Modula-2 and its Environment, tutoriel & guide de travaux pratiques en pdf.
Modula-2 under the Share-11 Operating System
Share-11 is the fastest multi-user extension to RT-11 for PDP/LSI-11s. It is the most complete RT-11 compatible system and allows realtime applications also. Share-11 is easy to install and requires no system generation. It uses any combination of standard mapped and unmapped RT-11 handlers and allows you to mix 18 and 22 bit controllers with impunity. Handlers are loaded into kernel space and not into user space.
The Modula-2 environment used under Share-11, is actually identical to the RT-11 environment. The proper assignments must be performed in the system’s startup files of each user (SHAREx.COM): since several programmers or jobs can operate the Modula-2 compiler at the same time now, each job has to use its own work files for the compilation process and its own DUMP.COR file for the debugging process (logical device VS). The file lookup strategy for different devices (DK and SY in the standard environment) is further supported by Share-11 in an optimal way through the .ASSIGN/PATH command: libraries can now be grouped on logical disks (LD or VD). The .SET TT COMMAND feature allows command files with program parameters also.
The standard Modula-2 run time system intercepts software traps with its own trap-handler for the emulation purposes and run time error handling, but it does not tell the operating system anything about that. This would cause serious problems in a multi-user environment. The trap-handler was modified by the author: The programmed request .TRPSET is used for the interception of illegal memory reference, emulation of direct PSW-access, time-out, illegal or reserved instruction and interpretation of FIS-instructions with FPU (vectors 4 and 10) and .SFPA for the interception of floating point unit trap (244). Thus core-dump and debug features will now operate under Share-11 too.
The IOTRANSFER feature of Modula-2 together with direct I/O-page access can not be used under Share-11 currently. This is the only limitation.
Modula-2/XM for the PDP-11/RT-11
A Modula-2/XM version for PDP-11/23 with hardware memory management unit (MMU) under RT11SJ (single job) operating system is available from Technische Universität München since December 1983. It is an upgrade to the Modula-2 M2RT11 version from ETH-Zürich. It is compatible with the normal implementation, i.e. no recompilation is necessary. Neither the language nor the Modula-2 compiler were modified. Modula/XM uses one page addressing register (PAR) of the MMU and allows 2MBytes of program code, up to 44KByte of user data in low memory and I/O-Page access. Linker, loader, debugger and the RTS were extended. Existing programs and modules must not be recompiled. Only relinking is required.
Virtual Arrays: Procedures are available for the handling of additional large virtual arrays in the 22Bit address space (4MBytes).
Modula-2 is « ROMable »: The Modula/XM linker separates code and data and allows [E|P]ROMable code production. A « PROMer » module is available.
Modula-2 User Library Modules
Many useful library modules have been added to the Modula-2 library by the author (and later ModulaWare™) since 1981, mainly to support real to string conversions and vice versa, MathLib and new I/O-concepts, namely UNIV, TIRF and CIO. UNIV incorporates parametric I/O-procedures for elementary data types and strings, TIRF (terminal independent retyping feature) serves for input line editing and CIO is a channel oriented ASCII-I/O-interface for sequential files (devices).
TIRF was integrated into the user library and into all commonly used programs. The TIRF concept stems from the environment of the programming language EDISON (developed for the LSI-11 under direction of Per Brinch Hansen, University of Southern California). The EDISON System implements a unique retyping technique for system monitor commands, data entry and the video-terminal editor. Only four control keys are used for line editing: back-space (BS), delete (DEL, rubout) tabulation (TAB, HT), and carriage return (CR, RET). BS moves left, TAB moves right, DEL deletes the character at the current cursor postion, and CR terminates input string editing. As a central feature in the Modula-2 environment, this feature is implemented by the module ReadString.
Channel Oriented Input-Output, CIO
The module CIO offers a channel oriented user input-output interface. CIO supports reading and writing of characters, integers, reals, and strings from and to any device (channel or stream) in ASCII form. CIO defines a hidden type CHANNEL. The procedure Channel connects a device to a CHANNEL. The procedure DeChannel disconnects a CHANNEL. For CIO we show only two procedure definitions, Channel and ReadR:
-TYPE CHANNEL; (* hidden type *)
-PROCEDURE Channel (dfn: FileName; NewFileOrDevice: BOOLEAN;
-VAR c: CHANNEL; VAR ChannelOK: BOOLEAN);
(* Connect an ASCII stream of dfn (device, filename, extension) to channel c; IF NewFileOrDevice THEN a new file dfn is created, ELSE an existing file is connected. ChannelOK reflects a good result (file found, or new file properly created). *)
PROCEDURE ReadR (c: CHANNEL; VAR r: REAL; VAR IsNumber: BOOLEAN; VAR NextChar: CHAR);
(*Read a floating point number r from a previously « channeled » ASCII file or device c. The termination character is asssigned to NextChar. The variable IsNumber reflects whether a legal number was read or NOT. *)