The ModulaTor logo 7KB

The ModulaTor

Oberon-2 and Modula-2 Technical Publication

Erlangen's First Independent Modula_2 Journal! Nr. 2/Mar-1992

ISO Modula-2 Standard I/O Library Test - part 1

by Elmar Baumgart, ModulaWare

Module TestPos is one of many example programs used to test ModulaWare's implementation of the Standard library. TestPos imports the Standard library modules RndFile, SeqFile, STextIO, SWholeIO, TextIO, RawIO, IOResult and ProgramArgs. The main purpose of the example program is to test the file positioning procedures of RndFile.

TestPos opens three files, called DATA, INSERT and SEARCH. The three file names are program argument parameters. If under VMS, the executable image TestPos.EXE is installed as a foreign command (e.g. using the declarative command $TestPos :== $Device:[dir]TestPos.EXE), the program arguments are specified in the command line (e.g. $TestPos hash.dat insert.txt search.txt), otherwise, when started with the VMS $Run-command, ProgramArgs prompts for the arguments (_$).

If at the start of the program the hash [Wirt 86] table file DATA does not exist, a new file binary is created and initialized. Otherwise, an existing file is opened for read and write. Since the hash table has fixed file size, an existing file is first checked for correct file size. In our example with 3877 strings of 40 characters each, the total file size is 155080 bytes.

INSERT and SEARCH are any text files, opened for read only. TestPos reads the file INSERT and inserts all string tokens (TextIO.ReadToken) into DATA until end-of-file. Then file SEARCH is read and all tokens are looked-up in DATA. A simple test would be to call TestPos with identical INSERT and SEARCH file, e.g.:

$Run TestPos
_$ hash.dat source.txt source.txt

After insertion of all tokens of the input file source.txt, all tokens of the file source.txt to be searched are already contained in hash.dat.

Module TestPos is now part of the MVR distribution kit and is also available for download from CompuServe's CodePort forum, section 11 (ISO Modula-2).

Literature: [Wirth 86] Niklaus Wirth: Algorithms & Data Structures, Prentice/Hall International, 1986.

MODULE TestPos; (* Test program for ISO 10154 Modula-2 Standard Library [Extension] of MaX|MVR V4 Modula-2 Compiler for AXP|VAX/OpenVMS Distribution Kit Copyright (1994) Guenter Dotzel, ModulaWare This software source code constitutes intellectual property rights of Guenter Dotzel, ModulaWare GmbH and is furnished under a Non-Disclosure Agreement and may only be used, processed and stored according to the terms and conditions of this agreement. All rights reserved. Test program for random file access. - If at the start of the program the hash table file DATA does not exist, a new file is created and initialized. Otherwise, the existing file called DATA is used. - The program reads two files called INSERT and SEARCH. Both files may have any text file format. - inserts token strings from file INSERT into a hash-table file DATA - searches token strings from file SEARCH in file DATA written by Elmar Baumgart, 10-Mar-1992, revised 27-Mar-1992 (skip multiple blank lines) *) FROM ProgramArgs IMPORT IsArgPresent, ArgChan; IMPORT STextIO, SWholeIO; FROM IOResult IMPORT ReadResult, ReadResults; FROM TextIO IMPORT WriteString, ReadToken, SkipLine, ReadString; IMPORT SeqFile; FROM RndFile IMPORT OpenClean, OpenOld, read, write, text, raw, ChanId, OpenResults, Close, FilePos, SetPos, NewPos, StartPos; FROM RawIO IMPORT Write, Read; CONST binary = raw; ITEMLENGTH = 40; ITEMS = 3877; (*prime*) (*creates ITEMS * ITEMLENGTH hash-table on disk*) DATA = 0; INSERT = 1; SEARCH = 2; TYPE WCproc = PROCEDURE(CARDINAL, CARDINAL); WSproc = PROCEDURE(ARRAY OF CHAR); ItemType = ARRAY[0..ITEMLENGTH-1] OF CHAR; fnam = ARRAY[0..255] OF CHAR; Args = ARRAY[DATA..SEARCH] OF fnam; VAR WC: WCproc; WS: WSproc; NL: PROC; data, ins, sea: ChanId; free: INTEGER; file: Args; startPos: FilePos; PROCEDURE CalcPos(Key: CARDINAL): FilePos; BEGIN RETURN NewPos(data, Key, ITEMLENGTH, startPos); END CalcPos; PROCEDURE CalcKey(item: ARRAY OF CHAR): CARDINAL; VAR len, i, key: CARDINAL; BEGIN len:= LENGTH(item); key:= 1; IF len > 0 THEN FOR i:= 0 TO len-1 DO key:= (key * (ORD(item[i]) MOD 26 + 1)) MOD ITEMS; END; END; RETURN key; END CalcKey; PROCEDURE EQUAL(old, new: ARRAY OF CHAR): BOOLEAN; VAR i: INTEGER; eq: BOOLEAN; len: INTEGER; BEGIN i:= 0; eq:= TRUE; len:= LENGTH(new); WHILE (i < len) AND eq DO eq:= old[i] = new[i]; INC(i); END; RETURN eq; END EQUAL; PROCEDURE Insert(item: ARRAY OF CHAR); VAR Key, offset: CARDINAL; atPos: ItemType; eq: BOOLEAN; BEGIN IF free > 0 THEN Key:= CalcKey(item); SetPos(data, CalcPos(Key)); Read(data, atPos); offset:= 0; eq:= EQUAL(atPos, item); WHILE NOT eq AND (atPos[0] <> 0C) AND (offset < ITEMS) DO IF ReadResult(data) = endOfInput THEN SetPos(data, startPos); END; Read(data, atPos); eq:= EQUAL(atPos, item); INC(offset); END; IF eq THEN WS('already inserted'); ELSE SetPos(data, CalcPos((Key + offset) MOD ITEMS)); Write(data, item); WS(' inserted'); DEC(free); END; WC(offset, 4); WS(' "'); WS(item); WS('"'); NL; ELSE WS('-table full-'); NL; END; END Insert; PROCEDURE Search(item: ARRAY OF CHAR); VAR Key, offset: CARDINAL; atPos: ItemType; eq: BOOLEAN; BEGIN Key:= CalcKey(item); SetPos(data, CalcPos(Key)); Read(data, atPos); offset:= 0; eq:= EQUAL(atPos, item); WHILE NOT eq AND (atPos[0] <> 0C) AND (offset < ITEMS) DO IF ReadResult(data) = endOfInput THEN SetPos(data, startPos); END; Read(data, atPos); eq:= EQUAL(atPos, item); INC(offset); END; IF offset >= ITEMS THEN eq:= FALSE; END; IF eq THEN WS(' found'); ELSE WS('not found'); END; WC(offset, 4); WS(' "'); WS(item); WS('"'); NL; END Search; PROCEDURE InsertIt; VAR item: ItemType; BEGIN SeqFile.OpenRead(ins, file[INSERT], text, ores); IF ores <> opened THEN WS('failed to open '); WS(file[INSERT]); NL; ELSE WS('Inserting token strings from file '); WS(file[INSERT]); NL; ReadToken(ins, item); WHILE ReadResult(ins) <> endOfInput DO Insert(item); ReadToken(ins, item); WHILE ReadResult(ins) = endOfLine DO SkipLine(ins); ReadToken(ins, item); END; END; SeqFile.Close(ins); END; END InsertIt; PROCEDURE SearchIt; VAR item: ItemType; BEGIN SeqFile.OpenRead(sea, file[SEARCH], text, ores); IF ores <> opened THEN WS('failed to open '); WS(file[SEARCH]); NL; ELSE WS('Searching token strings from file '); WS(file[SEARCH]); NL; ReadToken(sea, item); WHILE ReadResult(sea) <> endOfInput DO Search(item); ReadToken(sea, item); WHILE ReadResult(sea) = endOfLine DO SkipLine(sea); ReadToken(sea, item); END; END; SeqFile.Close(sea); END; END SearchIt; PROCEDURE TestIt; BEGIN InsertIt; NL; SearchIt; END TestIt; VAR ores: OpenResults; empty: ItemType; i: INTEGER; wrongArgs: BOOLEAN; BEGIN free:= ITEMS; FOR i:= 0 TO ITEMLENGTH-1 DO empty[i]:= 0C; END; WC:= SWholeIO.WriteCard; WS:= STextIO.WriteString; NL:= STextIO.WriteLn; i:= 0; WHILE (ReadResult(ArgChan()) <> endOfInput) AND (i <= SEARCH) DO ReadToken(ArgChan(), file[i]); INC(i); END; IF (ReadResult(ArgChan()) <> endOfInput) AND (i > SEARCH) THEN OpenOld(data, file[DATA], read + write + binary, ores); IF ores = noSuchFile THEN OpenClean(data, file[DATA], read + write + binary, ores); IF ores = opened THEN FOR i:= 1 TO ITEMS DO Write(data, empty); END; startPos:= StartPos(data); TestIt; Close(data); ELSE WS('data file not present, create failed'); NL; END; ELSIF ores = opened THEN startPos:= StartPos(data); i:= 0; Read(data, empty); WHILE ReadResult(data) <> endOfInput DO INC(i); Read(data, empty); IF empty[0] <> 0C THEN DEC(free); END; END; IF i <> ITEMS THEN WS(file[DATA]); WS(' is of illegal size'); NL; ELSE TestIt; END; Close(data); ELSE WS('data file present, access failed'); NL; END; WC(free, 1); WS(' entries free in '); WS(file[DATA]); NL; ELSE WS(' TESTPOS hash-file insert-file search-file '); NL; END; END TestPos.

ISO Modula-2 Standard I/O Library Test - part 2

by Elmar Baumgart, ModulaWare

Module TestExample is another example program used to test ModulaWare's implementation of the Standard library. It's unusual in that it also reads backwards through a file. Detailed comments are contained in the program listing below. The console output produced when the program is run is also included.

Module TestExample is now part of the MVR distribution kit and is also available for download from CompuServe's CodePort forum, section 11 (ISO Modula-2).

MODULE TestExample; (* Test program for ISO 10154 Modula-2 Standard Library [Extension] of MaX|MVR V4 Modula-2 Compiler for AXP|VAX/OpenVMS Distribution Kit Copyright (1994) Guenter Dotzel, ModulaWare This software source code constitutes intellectual property rights of Guenter Dotzel, ModulaWare GmbH and is furnished under a Non-Disclosure Agreement and may only be used, processed and stored according to the terms and conditions of this agreement. All rights reserved. This module illustrates the use of the ISO Modula-2 Standard I/O-Library for creating, writing, reading, re-writing, and appending to/from a text file. Also, the just created text file is opened as binary file and read forward and opened binary, random file and read backward using the positioning procedures of RndFile. When reading backards special care is taken for end-of-file detection (better called start-of-file). The console output of this program is self-explaining and is appended to the bottom of this file, enclosed in a comment. Written by Elmar Baumgart/11-Mar-1992 revised by GD/16-Oct-1992: Simplified (eof-detection when reading backwards) *) (* to make a channel, import *) FROM SeqFile IMPORT OpenAppend, OpenWrite, OpenRead, Close, OpenResults, ChanId, Rewrite, Reread, text, raw, read, write; IMPORT RndFile, SWholeIO, STextIO, SYSTEM; FROM RndFile IMPORT OpenOld, FilePos, EndPos, NewPos, SetPos, CurrentPos; (* to get the terminal channels, import *) FROM StdChans IMPORT InChan, OutChan; (* to get status information on channels, import *) FROM IOResult IMPORT ReadResult, ReadResults; (* to send and receive data along channels, import *) FROM TextIO IMPORT WriteString, ReadRestLine, WriteLn, SkipLine, WriteChar; FROM RawIO IMPORT Read; FROM CharClass IMPORT IsControl; (*information on characters*) CONST binary = raw; filename = 'TESTFILE.LIS';(* feel free to use another name *) string10 = ' 10 times foo'; string5 = ' and now 5 times bar'; string7 = ' makes 7 lines total'; PROCEDURE DumpFile(f: ChanId); VAR line: ARRAY[0..255] OF CHAR; BEGIN ReadRestLine(f, line); SkipLine(f); (* note: no EOL-character can be read in text mode. End-of-line is detected using ReadResult(f) = endOfLine. To get the next line you have to SkipLine(f). Never test for or use CR/LF or something else, because you never get such characters for portability reasons. *) WHILE ReadResult(f) <> endOfInput DO WriteString(OutChan(), line); WriteLn(OutChan()); ReadRestLine(f, line); SkipLine(f); END; END DumpFile; VAR f: ChanId; Oresult: OpenResults; Rresult: ReadResults; i: INTEGER; ch: CHAR; fpa, fp0: FilePos; PROCEDURE equal(a,b: ARRAY OF SYSTEM.LOC): BOOLEAN; (* compare two structured values; used for FilePos type *) VAR i,j,k: INTEGER; BEGIN i:=HIGH(a); j:=HIGH(b); IF i=j THEN FOR k:=0 TO i DO IF SYSTEM.CAST(CHAR,a[k]) # SYSTEM.CAST(CHAR,b[k]) THEN RETURN FALSE END; END; RETURN TRUE; ELSE RETURN FALSE END; END equal; BEGIN WriteString(OutChan(), 'small test program'); WriteLn(OutChan()); (* Hint: you can access InChan() and OutChan() implicitly using the procedures defined in S*IO - modules. 'S' means 'simple'. These procedures have no channel - parameter. e.g.: STextIO.WriteString('terminal-output'); *) (*open a new file for reading and writing text*) OpenWrite(f, filename, read + write + text, Oresult); (*opens the file in writemode!*) IF Oresult = opened THEN (*writing to a file:*) FOR i:= 1 TO 10 DO WriteString(f, string10); WriteLn(f); END; (*reading from the file:*) WriteString(OutChan(), 'initial file status:'); WriteLn(OutChan()); Reread(f); (*toggle to readmode and reset the fileposition*) DumpFile(f); (*note: a seqfile can be in either readmode or writemode. To toggle these modes use Reread and Rewrite. Writing to a file in readmode causes an exception and vice versa. *) Rewrite(f); (*toggle to writemode an clear the file*) FOR i:= 1 TO 5 DO WriteString(f, string5); WriteLn(f); END; WriteString(OutChan(), 'status after Rewrite:'); WriteLn(OutChan()); Reread(f); DumpFile(f); Close(f); (*open old file in writemode at eof*) OpenAppend(f, filename, read + write + text, Oresult); FOR i:= 1 TO 2 DO WriteString(f, string7); WriteLn(f); END; WriteString(OutChan(), 'status after OpenAppend:'); WriteLn(OutChan()); Reread(f); DumpFile(f); Close(f); (*open old file in readmode at start*) WriteString(OutChan(), 'now reading binary :-)'); WriteLn(OutChan()); OpenRead(f, filename, binary, Oresult); Read(f, ch); WHILE ReadResult(f) <> endOfInput DO WriteChar(OutChan(), ch); Read(f, ch); END; Close(f); (* now read in reverse order; uses random file access *) WriteString(OutChan(), 'now reading from eof to start'); WriteLn(OutChan()); RndFile.OpenOld(f, filename, read + binary, Oresult); Read(f, ch); (* read first char in file *) (* save start pos for endOfInput-detection when reading backwards below *) fp0:=CurrentPos(f); (* set pos to last char in file *) SetPos(f, NewPos(f, -1, SYSTEM.TSIZE(CHAR), EndPos(f))); LOOP Read(f, ch); WriteChar(OutChan(), ch); IF equal(fp0, fpa) THEN (* eof backwards reached *) EXIT END; fpa:=NewPos(f, -2, SYSTEM.TSIZE(CHAR), CurrentPos(f)); SetPos(f, fpa); END; ELSE WriteString(OutChan(), 'file not opened, sorry'); WriteLn(OutChan()); END; END TestExample. (* small test program initial file status: 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo 10 times foo status after Rewrite: and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar status after OpenAppend: and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar makes 7 lines total makes 7 lines total now reading binary :-) and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar and now 5 times bar makes 7 lines total makes 7 lines total now reading from eof to start latot senil 7 sekam latot senil 7 sekam rab semit 5 won dna rab semit 5 won dna rab semit 5 won dna rab semit 5 won dna rab semit 5 won dna *)

The ModulaTor's Forum

These are the Times that Dry Man's Souls! *

What's new in ISO-Modula-2?

Günter Dotzel, ModulaWare

After six years of extensive work, the Modula-2 Working Group SC22/WG13 of the International Standards Committee (ISO) finally agreed upon the final version of ISO-Modula-2 at the 6th WG meeting held in Tuebingen, in July, 1991. The committee draft (CD) which includes the full formal specification of the semantics of both language and Standard Library in VDM-SL is due to be distributed in April-92. Except for minor language changes compared to what Niklaus Wirth defined in "Programming in Modula-2" (3rd ed.), there are many useful extensions in ISO Modula-2:

Exception handling, module termination, <*new compiler directives syntax*>, new data types COMPLEX and LONGCOMPLEX with associated operations and the standard functions CMPLX, RE, IM. Other new system- and standard functions include ADDADR, SUBADR, DIFADR, CAST, INT, LENGTH, LFLOAT, ROTATE, and SHIFT. Other new features are multi-dimensional open arrays, larger sets (at least 256 elements), packed sets, array- and record-constructors which allow expressions of user-defined array- and record-type, and a flexible Standard Library that includes I/O-, number/string conversions, string handling, coroutines, semaphores and a rich set of mathematical functions.

New ISO Modula-2 section in CIS:CODEPORT

Those interested in ISO Modula-2 may join the new section 11 and library 11 of CompuServe's Codeport forum. The new section is called "ISO Modula-2" and focuses on the language changes, extensions, conforming compilers and Standard library. Its associated library calls for related articles and truely portable programs.

Hope to meet you there! GO CODEPORT

[ed. note/Nov-1995: I wrote the above in 1992. The ISO Modula-2 section 11 was removed from codeport in summer 1995, because the working group didn't want to use it. It seems that communication in the sense of public discussion is unwanted - this is in the best tradition of Modula-2's information hiding concept ;-) Those interested in discussing Modula-2 aspects, may look at the Modula-2 section 2 in CompuServe's CodePort or in the usenet newsgroup comp.lang.modula2.]

PS.: If you are interested in getting the ISO-Modula-2 Committee Draft (600+ pages), please contact your national Standardisation body (ANSI, IEC, IEEE, BSI, DIN).

In response to the message entitled "What's new in ISO-Modula-2?" which I posted in the VAXForum's VMS programming section, Joe writes in 03-Mar-1992:

Thanks for the info, Guenter. Some of the extras sound interesting, none of them sound like things I wouldn't want, most sound like things I'd probably never use (even if I *were* still using Modula-2 regularly).


* Quotation from George Bush's speach at the beginning of the Gulf War in CNN's live report from Baghdad in early 1991: Gentlemen, we are seeing an example of surgical bombing. Sampled by Ernst Horn. His CD The skies over Baghdad appeared on classX records/EFA, 1991.

Date:        Tue, 10 Mar 1992 20:18:14 +0100
Subject: WG13 News Bulletin 1

WG13 NEWS BULLETIN 10 March 1992

Hello everyone!

A number of recent enquiries about the state of the CD and the lack of email activity has made me aware that those people not actually working on the CD may feel very uninformed. While things continue to *appear* to be quiet I will issue occasional "bulletins" on what is going on. This is the first.

The apparent silence

One reason that there is little discusison via the WG13 list is that currently there are very few issues being raised. Those people involved in drafting and reviewing the document have been raising few (many were raised after Tuebingen and have been resolved or are being worked on still). Also, the drafting/reviewing group are using a separate distribution list so as not to bore everyone with the minutiae of technical editing. Some people have been holding discussions on alternatives to the Tuebingen exceptions/finalization position but no concensus alternative has emerged (contact John Lancaster if you want to know the latest).

I must stress that the "silence" does not mean that nothing is happening. After Tuebingen, Pat, Barry and others worked almost full-time on the draft. Their main brief was to review and revise the English and to improve consistency in the English in all clauses. A lot of progress was made but many relatively small issues were identified and have taken time to address and correct. At present Roger, Derek and Barry are devoting all their free time to the draft. Unfortunately at this stage, there is little point in asking more people to take part in drafting. I have had a number of offers of help and I will take them up as soon as there are clauses for "final" review. And, of course, there is new work...

Where we are now

Until recently, it was very difficult to judge the state of our work; frequent editorial changes, a flood of small/medium-sized issues and physical movements of the files made it nearly impossible to form a sound view. (In a few cases we have even had to undo errors introduced in the re-drafting carried out after Tuebingen.) We are still finding it difficult, but many more (sub)clauses have been progressed and Roger and I are moving to developing a schedule.

The situation has also been complicated by the committments of individuals "conspiring" to prevent more than two or three people being active at a given time. For example, its only in the last few weeks that Roger, Derek, Don, Barry and I have all been available (i.e. with time for Modula-2) and contactable. We all met on 21st February --- the first time all of us have been together since Tuebingen!

At that meeting we reviewed the state of each clause/subclause. Their maturity varies considerably depending on how much had to be done on each and how much time authors have had available. We are close to being able to develop a realistic schedule; to be able to do that we are aiming to "freeze" (sub)clauses as early as possible. I hope that we will move to a stable situation in April and issue a realistic schedule for the CD and meeting by the end of that month. As soon as we have further news, I will issue another Bulletin.

Roughly, the following summarises where we are now:

* Front-end clauses (Foreword...Requirements):

These have been redrafted a couple of times since Tuebingen a final pass is required prior to final review.

The members of the Tuebingen ad hoc group on theses clauses have agreed to remove the very small numbers from the table of minimal requirements; these are all to do with constraints imposed by a target system. We have agreed to make these values implementation-defined.

Kees has drafted all the test program generators which establish the meaning of the attributes which appear in Clause 4. Some discussion on the style of these is going on.

* Lexis:

Revised; after some review needs minor changes.

* Clause 6

The VDM for the main revisions (exceptions and finalisation) has been drafted. The revised clauses 6.1 and 6.2 were reviewed at the February meeting and (although bugs were found) the VDM was found to be generally OK. No English has been revised. Work on that is due to start this week.

The English of most of the other sub-clauses has been reviewed; the VDM has still to be reviewed.

One other large task is the revision of the storage model to fix the definition of pointers. We have discovered a problem whose correction needs substantial rewriting of VDM (this is not a change to the intended semantics).

Work on expressions also has to be finished (mostly to do with packed sets).

* Clause 7 needs to be revised.

No work has been on SYSTEM since last summer; it needs significant work done to it, arising from the revisions to the storage model and from the changes agreed at Tuebingen.

Changes wrongly made to COROUTINES during the summer have to be undone.

* Clause 8

The changes to the storage model will require some respecification of the module Storage. Otherwise this clause is nearly complete.

* Clause 9

All the subclauses have been revised to some extent. The only modules requiring significant work to be done are: SysClock,vdm io , 9-3 in progress

* Clause 10 (The VDM extras)

No work since Tuebingen; this clause contains the "local" VDM definitions; it needs to be completed but has relatively low priority.

* Annexes

Annex CS (the concrete syntax) has been revised several times. Few changes will need to be made.

Annex AS (the abstract syntax) is generated automatically from the abstract syntax fragments. Checking of this is ongoing.

Annex GL (the glossary) has not been worked on since Tuebingen. A few changes need to be included as a result of changes agreed at Tuebingen and as a result of work on English since then.

Annex TG (test generators)

The first version of this is being put together. Discussions about whether these are "tests" or "specifications" is ongoing.

As you can see, progress is slower than we had hoped. However, I am very pleased with the way the content of the document is developing. The quality of the second CD will be substantially higher than even the Tuebingen draft. The final standard, I believe, will be exemplary.

Control of document

For a variety of reasons, Roger has taken over control of the document and configuration management from Don. This allows Roger to be project editor more efficiently. He has the current version of the CD; the NPL info-server has *not* been updated since Tuebingen. (We abandoned the NPL server when changes were happening too quickly.) I would guess that the earliest we would update the server is late April. Meanwhile, WG13 members who want a reading copy of any (sub)clause should contact Roger Henry.

Paper Distribution and Email

Early in January I wrote to all National Bodies of SC22 p-members asking them to confirm the nomination of experts to WG13 and to identify two recipents for WG13 papers. The deadline was the end of February. I have received some ten replies. Please, pester the approporiate bodes in your country to respond to my letter. I am determined to properly re-establish WG13 and to limit paper ditribution to the named recipients. Furthermore, when we do submit the CD, we do not want any delays due to administration problems; it is therefore important that I am formally made aware of the names and that national bodies are aware of their local experts.

It is also important to have those names because I intend to relieve Roger and his institution of the burden of supporting WG13 email. Once the CD has been dispatched, we will move to the facility operated by Keld Simonsen in Denmark for SC22 and its working groups. I will tell you more about this as plans develop.


I can (somewhat tentatively) report that the SC22 secretariat beleive that the proposal I put to the Vienna plenary meeting of SC22 has been approved by JTC1. The SC22 secretary is currently trying to confirm the position, but is sufficiently confident of his information to have encouraged me to suggest to those of you currently just waiting for the CD to begin to think about the new work and to volunteer to contribute to the various items. I would also like further comments on how we organise ourselves regarding this work.

Best regards to you all

Mark Woodman ISO Convenor SC22/WG13 (Modula-2)

Letters to the Editor

From:        Egorov Igor Ivanovich <>
Date:        Tue, 21 Jan 1992 15:29:32 +0100
Subject: The Medium Lotos (summary)
Dear Guenter,

I have prepared (especially for you) more detail information about the medium Lotos.

Lotos: A Distributed Library Operating Medium

1. Introduction

The medium Lotos is oriented to a development of the program systems that are characterised by a complicated logic of a component interaction and the hard requirements to a system reliability. The medium may be used for such problem areas as real-time embedded systems, CAD/CAM/CAE, CASE, Multimedia. The following requirements was formulated for the medium Lotos:

- a support of a concurrent (asynchronous) execution of processes in the (possibly heterogenous) distributed computer systems;

- a sophisticated mechanism for an exception handling;

- an effective implementation of an application system in the "bare" hardware.

2. The Fundamental Notions

The fundamental notions of the medium Lotos (unit, process, IDA, task, application) are based on an asynchronous nature of a component interaction. In the other words, all executable parts of the application system are considered as independent parallel ones a priori, and the system behaviour is regulated by restrictions, that applied to an order of execution of actions.

The Unit is a software-hardware thing, which includes CPU, memory, I/O devices, timer and so on. The underlying software is a low-level interface to the hardware. The examples are a workstation, a transputer module, an user process in OS UNIX. The units may be connected with each other by any communication means.

All elementary components are decomposed on two non- intersection groups (as in the methodology Mascot-3): the active components and the passive ones. The active components (processes) can interact with each other by the passive components (IDA) only.

The Process is a sequential executable code, which has own work space (stack). It is characterised by the unique identifier and a fact of a birth/death.

The IDA (Intermediate Data Area) is intend for support of an interprocess communication (process synchronisation, integrity of shared data). A process interacts with IDA by the special sets of data and of procedures. An internal logic of IDA is provided by Petri Nets.

To construct an application system from elementary components the component constructors are used (task, compound IDA, application).

The Task is a net of processes and of IDAs, which oriented to a solution of the application problem. A task (as process) can't place in several units at the same time.

The compound IDA is constructed from simple IDAs and other compound ones. An internal structure of a compound IDA can include the active components (processes).

In terminology of the medium Lotos such notion as program is absent. Instead of program the notion of application was introduced. The application is constructed from the above- mentioned structured primitives.

3. Features of the Medium Lotos

The medium Lotos supports as conventional structured programming (based on the concept of module) as object- oriented programming (based on the concept of class).

The virtualisation of address space for code and data is reached by support of 3 memory types: base memory, expanded memory and disk memory. The virtualisation of code is provided by dynamic linking, and the virtualisation of data is reached by support of virtual memory with page organisation. Also, one can create a new process, which has its stack placed in memory of any type.

Exception handling in the medium Lotos is based on approaches, that implemented in CLU and Modula-3 languages. In the medium Lotos an exception handling is extended by introduction of concept of resource guard. The resource guard is a instance of class "Guard", which is a superclass of all classes in the medium Lotos. In the moment of exception appearance the instance method (in class Guard) is called automatically. The method executes all actions oriented to recovery.of the resource.

4. Implementation of the Medium Lotos

Modula-2 was selected as base programming language. Implementation of the distributed library operating medium Lotos V4.0 was carry out in operating system MS-DOS V3.30 by development environment JPI TopSpeed DOS Release 1.04b (Modula-2 V2.0). Run-time system (except the floating point emulator) was reprogrammed entirely.

The medium Lotos consists of the Kernel and its environment. The Kernel is divided on 5 layers (Safety, Memory, Scheduling, Framework, Flesh).

The layer Safety is responsible for exception handling and for support of mechanism of resource guards.

The layer Memory includes tools for management of base memory and of virtual memory (expanded memory supports such standards as EMS LIM V3.2 and XMS V2.0).

The layer Scheduling is responsible for scheduling of tasks and of processes, for support of dynamic linking and for access to network tools. As distinct from TopSpeed implementation of DLL the Lotos implementation has some features. Firstly, mechanism of DLL is realized with orientation to exception handling and to support of multi- process environment. Secondary, dynamic uploading is carry out on the level of individual segments of code (but not on the level of whole DLL). Thirdly, DLL can be one of 2 types: shared DLL or nonshared one. Also tools for fixing/unfixing of DLL are accessible. Finally, the number of DLL is only restricted by amount of accessible base memory. Network tools are implemented on base of NetBIOS in Novell Netware V2.15.

The layer Framework concentrates tools for creation and for using of structured primitives.

The layer Flesh plays an auxiliary role for other layers of the Kernel and includes the following:

The total amount of the Kernel is: The next stage (after completion of testing of the Kernel), is a development (mostly, adaptation of the previous version of the Lotos) of the Toolkit environment and of the Window environment. Then activities directed on design and implementation of DataBase environment will be started.

Sincerely, Igor

                    ###  ##  #####    ===============
                  ## ##  ##  ##   ##  ============
                ##   ##  ##  ##   ##  ========
                #######  ##  #####    ======
                ##   ##  ##  ##   ##  ===

                e-mail        :
                organisation  : Moscow Aviation Institute, Moscow, Russia
                phone (voice) : (7)-(095)-158-4969

From: Sergey Nelubov <>
Subject: Thank for "ModulaTor"s
To: Guenter Dotzel <>
Date: Tue, 25 Feb 1992 15:33:00 +0100
Dear Gunter.

A lot of thanks for your parcel with "The ModulaTor"s. It is very unusual and interesting papers. A bit about our jobs.

We have being worked with KRONOS - Modula-2 computer, mainly derived from Lilith, but significantly extended to 32-bits, more powerful real time instruction set and so on. OS likes Unix with scheduler and strong real time features. Single copy of shared code for many processes. Global VAR's could be made as shared between processes or unic for each. Fully dynamic modules linking at a time of loading. KRONOS was made in Computer Center of Russian Academy of Science in Novosibirsk. We have developed graphical controller, graphical accelerator and video memory(VM). VM looks as part of system memory and may be the only memory for both KRONOS processor and graphical devices. On the base such work station was developed some multytasking window system with decent speed property as compared with Ultrix installed X11 on VAX 3100. Our goal is to control online (real time) data acquisition in physical experiments.

I think that modula folks should known about each others, so I decide to write you about our jobs

Best wishes. Sergey.

Nelubov Sergey (E-mail/Internet: OR

IMPRESSUM: The ModulaTor is an unrefereed journal. Technical papers are to be taken as working papers and personal rather than organizational statements. Items are printed at the discretion of the Editor based upon his judgement on the interest and relevancy to the readership. Letters, announcements, and other items of professional interest are selected on the same basis. Office of publication. The Editor of The ModulaTor is Günter Dotzel; he can be reached at mailto:[email deleted due to spam]

Home | Site_index | Legal | OpenVMS_compiler | Alpha_Oberon_System | ModulaTor | Bibliography | Oberon[-2]_links | Modula-2_links | [3KB] [Any browser]

Books Music Video Enter keywords... logo

Webdesign by, 16-Dec-1998