HOME

Resources

Compilers Text Editors and IDEs Tutorials Papers Libs Sources Q&A Forums Lists Groups Links Downloads Pictures Guestbook

 

Recommended Links


GNU Modula-2

Modula-2.org home page

Modula-2.info home page

Excelsior home page

Questions and Answers

The Modula-2 FAQ compiled and maintained by Rick Sutcliffe is the "official Modula-2 FAQ". This section of the Modula-2 pages called 'Questions and Answers' is no rivaling document but is (and will always be) under construction and depends on your or my interest. Suggestions are welcome. Every now and then I'll add questions and answers here wich I missed when searching the web.


01. Is Modula-2 a so called "Object Oriented Language" ?
02. Debugging Modula-2 programs
03. Modula-2 is a language for systems programming - right?
04. Modula-2 and POSIX?
05. Where can I get information about ISO Modula-2?
06. Modula-2 and realtime/embedded/safety-critical programming?
6a. Code certification
07. Exceptions and Modula-2?
08. What about translating C to Modula-2?
09. Modula-2 and Ada?
10. What about Modula, the predecessor of Modula-2?
11. ISO Modula-2 library: ProgramArgs
12. I want to see (and hear) Niklaus Wirth, inventor of Modula-2
13. Modula-2 and the Windows API
14. Modula-2 and C
15. Sockets Programming in Modula-2
16. Modula-2 and X11
17. Modula-2 in videos and films
18. I want to convert my Modula-2 sources to HTML
19. Converting Modula-2 sources to PostScript
20. Literate programming and Modula-2
21. Database programming and Modula-2
22. Standard libraries and portability


[ top ] 1. Is Modula-2 a so called "Object Oriented Language" ?
 (A)
Yes, but it depends on the standard a compiler implements. Some time after the Modula-2 ISO-Standard was released, object orientation has also been standardized. The project was "JTC 1.22.18.02 Object Oriented Extensions for Modula-2". From the ISO/IEC JTC1/SC22/WG13 Homepage (wich is "the international standardization working group for the programming language Modula-2"): "The model chosen for object oriented extensions has both modules and classes; has single inheritance and has multiple roots. The document has been published as ISO/IEC 10514-2:1998." More information is available (scroll down to page 6 for examples and a description of the OO extension of ISO Modula-2). There is also a section on object oriented Modula-2 in Rick Sutcliffe's great book on Modula-2. The only compilers available implementing these extensions - as far as I know - are (1) ADW Modula-2 which is available as freeware and (2) p1 Modula-2 which is a commercial product for Apple computers.
 (B)
Roger Carvalho implemented some OO-Extensions in the last versions of FST Modula-2 (3.5+).
 (C)
You can find some information on ISO Object Oriented Modula-2 at Ulm's FTP Server. These are draft documents that do not really differ from the published standard.
 (D)
There is a book/text by Niklaus Wirth himself called Modula-2 and object-oriented programming. Be careful - object orientation means something different here...


[ top ] 2. Debugging Modula-2 programs
 (A)
Since XDS and ADW Modula-2 are available for free there are good integrated development environments available for Windows systems including debuggers. The XDS debugger can also be used for programs developed for Linux and Windows, as long as no operating system specific problems appear.
 (B)
There is a way to use Borland Turbo Debugger for programs compiled with FST Modula-2. Julian Miglio found out how to and has kindly provided an explanation plus example. Fetch the .zip from the download-area.
 (C)
M2F and GNU Modula-2 generate debug-information for GDB. The GNU Modula-2 documentation says there is dwarf-2 debugging support "and when used with gdb the programmer can display RECORDs, ARRAYs, SETs, subranges and constant char literals in Modula-2 syntax". For using GM2 and GDB together you may want to read this message.
 (D)
There are some problems with Gardens Point Modula-2 and GDB, for example have a look at http://sources.redhat.com/ml/gdb/2002-05/msg00048.html. I think the above also applies to the DJGPP-version of GPM. If you want to try DJGPP/GPM and GDB, you may want to have a look at RHIDE - available from http://www.rhide.com. This is an IDE integrating GDB.



[ top ] 3. Modula-2 is a language for systems programming - right?
 (A)
Niklaus Wirth developed Modula-2 as a language for programming the Lilith-workstation (Modula, the predecessor of M-2 was already implemented on a PDP-11). From ETH: "The first Modula-2 compiler was completed at ETH in 1979. It was implemented on a PDP-11 computer and then ported onto Lilith." If you are interested in design and implementation of the system which was called Medos-2 check Svend Erik Knudsens doctoral thesis "Medos-2: A Modula-2 Oriented Operating System for the Personal Computer Lilith (1983)" to learn more about the system. Jos Dreesen offers the Medos-2 sources and Emulith (a register­level simulation, in C, of the ETH Lilith Modula­2 computer). Extensive information on the Lilith system is available.
 (B)
There is an Operating System called LUMOS for a computer called Stride 440. These were Motorola 68k machines usually running System V UNIX. You can find some information using Google. Read a short description of the system. I thought the whole thing disappeared completely, so I asked in comp.lang.modula2 - the same day Alexander Naumov made the Sources of LUMOS-2 available again. Note that it is a real multi-user operating system in comparison to Medos-2 which was a single-user system.
 (C)
Mosys also was a Modula-2 operating system for Sage/Stride 68000 computers. There is another document (page 3) which gives more details: "Mosys is a portable operating system that was implemented by TDI Holdings Ltd., of Bristol, England, under an agreement with Niklaus Wirth, creator of the system and the Modula-2 language, and ETH Zurich." The system was very portable and also adapted for the Pinnacle 68000 by Pinnacle Systems of Dallas. Pinnacle was a strange competitor of Sage/Stride copying from the Sage/Stride boxes as Rod Coleman (founder of Sage computers and someone who very much respected and liked the work of Niklaus Wirth) explains. In the beginning Mosys was also sometimes called "Moses" (Modula-2 Support Environment System) for a time (corrected in Sage News Vol. II - No. 8 - Aug 1984, page 2). I found information under this name in Byte Magazine Volume 09 Number 08 - Modula-2 (August 1984) page 437: "It is a portable operating system written in Modula-2 that requires only a conventional character-oriented video display. 128K bytes of memory, and a floppy-disk drive. The Moses package includes a Modula-2 compiler, a screen editor, a symbolic debugger, a modifiable menu-driven user interface with windows, and a library of routines and utilities". There is a lot of Modula-2 related information in the technical publications made available by Sage/Stride. Visit the relevant sections Sage News and Tech Notes over at sageandstride.org.
 (D)
Kronos was (is) a 32-bit workstation developed in Akademgorodok, a research center of the Russian Academy of Science. It was based on the Lilith personal computer designed by Niklaus Wirth. There is a lot of information available at the homepage of the Kronos research group. The source code of the system is available under a BSD-license.
 (E)
If you are writing or trying to write a complex system such as an operating system you may be interested in PMOS by Peter Moylan. A short description from the homepage of this impressive package: "PMOS is a large library of Modula-2 modules, distributed in source form. Its primary purpose is to make it easy to write multitasking programs for real-time and/or embedded applications. However it also contains a number of modules of interest even if you don't want to write multitasking code: screen windows and screen graphics modules, various device drivers, and a variety of utility modules."
 (F)
Gaius Mulley, developer of GNU Modula-2, wrote a microkernel called LUK which is used to teach students the principles of microkernels. "LUK runs on x86_32 PC hardware and boots from a USB memory stick. When it boots it is the sole system, there is no linux, windows or OSX. LUK is written in C, Modula-2 and assembly language. LUK runs in 32 bit protected mode and can create an arbitary number of lightweight processes using the Executive module. It has a Timerhandler module for creating time related events a keyboard and screen device driver. There is also a very primative text based window device. LUK coordinates interrupts and processes via semaphores implemented in the Executive. It currently uses a simple round robin scheduler to allocate processor time to the runnable processes." GPL licensed.
 (G)
Acorn Computers used their own Modula-2 compiler (which was never released as a product of the company) to develop operating systems for their machines. There was Panos, an operating system developed in the 1980s (information from computinghistory.org.uk), which ran on the 32016 Second Processor for the BBC Micro and the Acorn Cambridge Workstation. For those interested there is a lot of information including pictures and manuals available from Chris's Acorns. Acorn also developed ARX, an operating system written in Modula-2+. The language has also been used to develop Topaz (.pdf), an operating system for the DEC SRC Firefly Multiprocessor.
 (H)
Some papers and reports about a number of operating systems written in Modula-2 are available from libraries and sites charging you for downloading academic papers. A few links to start reading: With the realtime operating system XMod an attempt has been made to design a system that is portable and, to a certain degree, independent of its environment. The development of XMod began from the realtime kernel MODEB, another interesting project. And one more portable modula-2 operating system: SAM2S, A simple nucleus written in modula-2: A case study, Modula-2 for real-time systems. For beginners there is Modula-2 projects for an operation-systems course: racing sorts and multiple windows by Michael B. Feldman: "This three-project sequence is suitable for an undergraduate course in operating systems or systems programming, and embodies the three important principles of concurrent programming, algorithm animation, and code modification." Another paper about Teaching Operating Systems with Modula-2 written by Jeffrey A. Brumfield is available (it's about implementing a process manager for an operating system). Last but not least there are the dissertations of Mr. Peschels and Mr. Fischer: the former wrote about planning and implementing an operating system called VAMOS in Modula-2. Mr. Fischer wrote about a distributed operating system called ORION which was also implemented in Modula-2.
 (I)
There was a computer called Gepard running GDOS (Gepard DOS) which was completely written in Modula-2. Very little information is available. I found an announcement and some information by Thomas Tempelmann who worked for the company Gepard computer. Later he developed Megamax Modula-2 for the Atari ST computer. Most of the information available is in german language...
 (J)
Prime Computer, a company selling so called minicomputers in the 70ies and 80ies, used Modula-2 as official language inside the company for some time. Modula-2 was used inside the kernel of PRIMOS, the operating system of Prime computers. Here are 2 snippets from the Comp.Sys.Prime FAQ: "Around 1987 the official language within Prime Engineering became Modula-2. Modula-2 ceased to be the "official" systems programming language after the second or third RIF (Reduction in Force = Redundancy) inside of Prime Engineering, as the compiler was never as good as SPL, even with some of its extensions (like INLINE procedures!) that SPL never had." But: "Modula-2 was not widely used in the Primos kernel, since the compiler writers who worked on it were reassigned around mid-1988. Various tools to replace the nice features of Modula-2 (such as strong type checking on procedure calls) were promised for SPL but never delivered (big surprise there). Modula-2 was used for the Machine-Dependent-Synchronization and Machine-Independent-Synchronization components of the kernel and actually worked out pretty well (I did some of that, and the type checking detected some problems that would have been a bitch to find at runtime)."
 (K)
There is an article in Russian language called The Modula-2 Software Kernel Based On 'elektronika-60' Microcomputer. Was there an operating system for this box written in Modula-2? I am still searching for information on this one. The Electronika 60 was a computer made in the Soviet Union. It was a clone of a DEC LSI-11 which was quite important in the early history of Modula-2. Another computer from the Elektronika series was the UKNC, according to Wikipedia "a Soviet PDP-11-compatible educational computer, aimed at teaching school informatics courses. It is also known as Elektronika MS-0511". An UKNC emulator is available as well as two Modula-2 compilers (Link that brought me there). Here is another site preserving EGOSOFT Modula-2. Everything is in Russian language. That's why I cannot test if the compiler works with the emulator.
 (L)
According to a posting in comp.lang.modula2 the company Introl offered a complete Modula-2 system: "Introl Modula-2 (...) includes compiler, linker and a some tools for libraries, hexformats etc. The library includes floating point, math routines, io-routines (not very useful for other things than Introls test programs). A small realtime kernel is included in Modula-2 source. The real time kernel is prioritised, preemptive, support process synch primitives. There is also a source level debugger which can be used with a simple monitor program or with a emulator". I tried to contact Introl but got no answer.
 (M)
Parts of older versions of IBMs OS/400 were written in Modula-2. "It was a mix of PL/MP, an IBM Rochester variant of PL/1, assembler, Modula-2, and C code in the pre-PowerPC versions of the OS/400 operating system." IBM used to have their own Modula-2 compiler!
 (N)
Some years ago I stumbled upon the documentation of a widely unknown Modula-2 compiler. Recently I found out (and I hope I am right) that it was part of The StarLite Project designed by Robert P. Cook, Sang H. Son and I guess many others at the University of Virginia. Here is a short description of the project: "The components of the StarLite environment include a Modula-2 compiler, a symbolic debugger, a profiler, an interpreter for the architecture, a window package, a simulation package, and a concurrent transaction execution facility. The compiler and interpreter are implemented in C for portability; the rest of the software is in Modula-2. The environment has been used to develop a non-proprietary, UNIX-like operating system that is designed for a multiprocessor architecture, as well as to perform experiments with concurrency control algorithms for real-time database systems. Both systems are organized as module hierarchies composed from reusable components." The designed operating system was a real-time UNIX called Phoenix. You can find a lot of information on StarLite by using your favourite search engine.
 (O)
I don't want to finish this section without giving a few pointers to operating systems written in languages similar to Modula-2. There is Native Oberon, which is an amazing operating system that can easily be installed on nearly every PC. There's also Bluebottle-OS, which is even more impressive. Niklaus Wirth and Jürg Gutknecht recently returned to their former work and published Project Oberon (New Edition 2013). The subtitle says it all: "The Design of an Operating System, a Compiler, and a Computer." The most recent stuff is available now from Project Oberon. Last but not least there is the operating system SPIN which is mostly coded in Modula-3. You may want to start by reading the SPIN Overview or the paper Writing an Operating System with Modula-3.



[ top ] 4. Modula-2 and POSIX (Portable Operating System Interface)?
 (A)
There was work being done on the ISO-project "JTC1.22.03 - Modula-2 to Posix Binding" but the project was terminated as requested by WG13 at the 1996 SC22 Plenary. Pat Terry notes that this project was a child of Mr. Keith Hopper who had to withdraw because of health problems. After he left the project fell by the wayside. "In view of Keith's ill health, a decision was made to abandon the POSIX project in favour of one that would examine the bindings to C." I am searching for Output of the POSIX/Modula-2 project. Any advice?
 (B)
A POSIX-library comes (incomplete ?) with XDS-Modula-2. After installing have a look in the subdirectory /def/posix;
 (C)
Holger Kleinschmidt has written M2LIB which is available from the download-area and implements calls to POSIX-functions. The library was written for a variety of Atari compilers, so it's quite hard to get things going on the x86 architecture.



[ top ] 5. Where can I get information about ISO Modula-2?
 (A)
The best tutorial and complete book on ISO Modula-2 was written by Rick Sutcliffe and is called Abstractions for Data and Programming Structures (Using ISO-Standard Modula-2). This is a Sharebook which means it is not free (!). Very few books about Modula-2 were published after the standard came out.
 (B)
Converting to ISO Standard Modula-2 is a short but useful guide which is part of the ADW (former Stonybrook) Modula-2 documentation.
 (C)
Some interesting example programs and thoughts on the development of ISO Modula-2 are available as part of The ModulaTor, Oberon-2 and Modula-2 Technical Publication, Erlangen's First Independent Modula_2 Journal! Nr. 2/Mar-1992. More ISO Modula-2 example programs are available as part of the Aglet Modula-2 documentation.
 (D)
Some documents (a late draft of the ISO standard) can be found and downloaded. These documents only differ slightly from the standard.
 (E)
Some information can also be found at the official homepage of WG 13 / Modula-2, the international standardization working group for the programming language Modula-2.
 (F)
Maybe the best idea to start is reading through the definition modules of the ISO Modula-2 Library (coming with ADW, XDS or GPM for example). Note that the ISO Library is not the same as the language ISO Modula-2, but one gets an idea of how powerful the new concepts are (channels, exceptions etc.). An overview of the library is available here.
 (G)
The standard itself can be bought at the International Organization for Standardization itself. This is quite expensive. Here are the relevant links for Modula-2:



[ top ] 6. Modula-2 and realtime/embedded/safety-critical programming?
You may also be interested in some of the links and literature listed under point 3 of this document called Modula-2 is a language for systems programming - right?
I always planned to put together a list of links to ressources related to the use of Modula-2 in safety critical areas and generally for people interested in software engineering for realtime embedded and high integrity applications. There is a lot of information. Most of it is from the 80ies and 90ies but shows how well suited the language Modula-2 is for this area of applications. A nice introduction is a paper by W.J. Cullyer, S.J. Goodenough and B.A. Wichmann called The choice of computer languages for use in safety-critical systems back from 1991 which is freely available. In my opinion it is wether historical nor outdated.
Microprocessors & Microsystems published a "Special issue on Modula-2: status and realtime implementations" (Volume 14 Issue 3, April 1990). The table of contents is available.
Some pointers to development systems: (1) Cambridge Modula-2 by Cambridge Microprocessor Systems is based on a subset of PIM4 with language extensions for embedded development. The compiler runs on MS-DOS and it generates code for M68K based embedded microcontrollers running the MINOS operating system. (2) Mod51 by Mandeno Granville Electronics is based on ISO Modula-2 with language extensions for embedded development following IEC1131, an industry standard for programmable logic controllers (PLC) closely related to Modula-2. The Mod51 compiler generates standalone code for 80C51 based microcontrollers.
You may also want to have a look at PMOS by Peter Moylan which claims to be a good starting point for "people who want to write real-time applications for the IBM-PC."
Of course there are papers available like the above already mentioned description of XMod, a portable realtime operating system written in Modula-2 based on the realtime kernel MODEB. More information about MODEB is available. I don't know if the information is still useful in these times of rapid changes to hard- and software environments. Same applies to the following articles: (1) Modula-2 in Embedded Systems by Christian Vetterli & Claude Vonlanthen (full .pdf at embedded.com is available). (2) Embedded systems development using Modula-2.
Already mentioned above there was an impressive project called The StarLite Project designed by Robert P. Cook and Sang H. Son. As an addition to the information given above I want to point out the project had "the goal of constructing a program library for real-time applications".
A lot of interesting papers (try Formal Methods and Software Safety for a start) are available on the topic of "SACEM" which was the Paris Metro Signaling System. "The system (...) was composed of embedded software and hardware, the software part being composed of about 21.000 lines of Modula-2 code, 63% of which was deemed to be safety critical." Still very interesting lecture for those interested in the field of embedded and safety critical development. Imagine how many trains (the system was used for the french national network (SNCF), on the Paris suburban net-work (RER) and on the underground of Cairo, Calcutta and Lyon for example) depended on the software...
So one more also of historical interest: Modula-GM dveloped by Delco Electronics, a subsidiary of General Motors Hughes Electronics. They developed a version of Modula-2 for embedded control systems starting in 1985. Wikipedia: "The first experimental use of Modula-GM in an embedded controller was in the 1985 Antilock Braking System Controller which was based on the Motorola 68xxx microprocessor, and in 1993 Gen-4 ECU used by the CART (Championship Auto Racing Teams) and IRL (Indy Racing League) teams.[19] The first production use of Modula-GM was its use in GM trucks starting with the 1990 model year VCM (Vehicle Control Module) used to manage GM Powertrain's Vortec engines. Modula-GM was also used on all ECUs for GM's 90° Buick V6 family 3800 Series II used in the 1997-2005 model year Buick Park Avenue. The Modula-GM compilers and associated software management tools were sourced by Delco from Intermetrics."



[ top ] 6a. Code certification
Synthesizing Certified Code is a NASA paper written by Michael Whalen, Johann Schumann and Bernd Fischer (Better version available here). "Code certification is a lightweight approach for formally demonstrating software quality. Its basic idea is to require code producers to provide formal proofs that their code satisfies certain quality properties. These proofs serve as certificates that can be checked independently." Another paper called Certification Support for Automatically Generated Programs by the same group is available. Both papers are describing an extension to the program synthesis system of AutoBayes "which is able to certify generated code with respect to operator safety and array bounds safety". AutoBayes is a NASA open source project, a "program synthesis tool for the automatic generation of customized algorithms from compact, declarative specifications in the data analysis domain".
Some references to a system called Mops are also available: Mops: Verifying Modula-2 programs specified in VDM-SL (2000).



[ top ] 7. Exceptions and Modula-2?
Most people think exceptions were introduced with ISO Modula-2 but Niklaus Wirth already implemented exceptions on a PDP-11 version of his Modula-2 compiler - that was 1979! Thank you people for pointing this out in comp.lang.modula2. Borland Turbo Modula-2 also had exceptions as an extension (link to the compiler docs).
Exceptions in ISO Modula-2 are a powerful way of handling exceptional situations that are runtime errors of your program ("An exception is the occurence of a condition which prevents the flow of program execution to go on normally"). Look at this example program structure which does NOT make your programs more complicated - this reduces complexity:

MODULE m2except;
 (* import, const, type, var stuff *)
BEGIN
 (* program code *)
FINALLY
 (* finalize your program before exiting *)
EXCEPT
 (* tell the program what to do in exceptional situations *)
END m2except.

The standard ISO Modula-2 library comes with predefined modules for common Modula-2 exceptions (the module collects everything from division by zero to range-errors and so on;) but it is also possible to define user exceptions. For example XDS Modula-2 comes with a Module GeneralUserExceptions to demonstrate how it is done. Exception handling is a powerful thing but one should think twice where they make sense and what errors they should catch.
The ISO library follows a simple concept so every module behaves the same. I found this very helpful documentation snippet: "All modules, that may raise specific exceptions report these exceptions in the same way. Each of these modules exports a procedure with the name 'Is<Modulename>Exception'. In case of an exception, this procedure can be used to test whether the exception was raised by the module it belongs to. If 'Is<Modulename>Exception' returns 'TRUE' (exception was raised by this module), the reason for the exception can be obtained by '<Modulename>Exception'. This function procedure has as result type an enumeration type, exported by the same module, that lists all reasons for exceptions. Some modules define only one reason for exceptions, in this case neither '<Modulename>Exception' nor the enumeration type are exported."



[ top ] 8. What about translating C to Modula-2?
 (A)
Usually one will meet people who want to translate Modula-2 to C, so there aren't (and weren't) many hints available on this topic. Don't even think of free and usable software. I found two (1,2) posts from comp.compilers which led me to a company called Knowledge Software Ltd. which has already designed a C to Modula-2 translator but as there weren't enough requests the thing was never implemented. Note they would still implement it if someone is willing to pay for it.
 (B)
There is a project at SourceForge called OpenC2Pas. This is still in an early stage but maybe it's a good starting point for working on OpenC2Mod. Before you begin working on a translator search Google Groups to get an idea what problems are awaiting you: producing readable Modula-2 code seems to be nearly impossible. Just think of all the things that are done with the C-preprocessor... Those who still use some flavor of good old Dos may want to have a look at C2PAS by L. B. Neal. This is a simple C to Turbo Pascal Translator which might be helpful on the long way from C to Modula-2.
 (C)
Don't forget the utilities coming with GNU Modula-2 and XDS Modula-2. Both compilers provide a program which translates header files to definition modules.



[ top ] 9. Modula-2 and Ada?
An article comparing the two programming languages by Boumediene Belkhouche, Linda Lawrence and Moti Thadani is available.
If you are searching for information on how to migrate from Modula-2 to Ada95, you may want to have a look at section compilers -> translators. You can find some information on translating Modula-2 to Ada when following the link provided there. There also is an article about a system called ARTK-M2: "A run-time kernel, ARTK-M2, supporting Ada tasking semantics is discussed; full support for task creation, synchronization, communication, scheduling, and termination is provided, together with all options of the Ada rendezvous. An implementation in Modula-2 is presented and a method for automatically translating Ada programs into semantically equivalent Modula-2 programs with corresponding kernel calls is introduced. A parser generator and an attribute grammar were used for the automatic translation." (full abstract) Some of the work lying ahead of you may be done already...



[ top ] 10. What about Modula, the predecessor of Modula-2?
Niklaus Wirth designed Modula to get rid of Pascals shortcomings and added important things to the language like the name-giving concept of modularity. Modula is not a well known language as it soon was replaced by Modula-2. The full original report about the language back from 1976 is available from the ETH-collection as is another report called The Use of MODULA and Design and implementation of MODULA. The latter fully lists three example programs developed in Modula.
Yes, there were implementations of Modula (also called Modula-1 sometimes), most important the implementation following the definition of the language by Niklaus Wirth himself on a PDP-11 (another reference). The Hexapus system was written using this compiler (more information). The document referenced first is a dissertation by H. Sandmayr which contains syntax diagrams for the Modula language. You can also find the basic references to Modula and Hexapus in the book The school of Niklaus Wirth: the art of simplicity (page 9).
Very soon other implementations followed, most important the University of York Modula compiler (some interesting notes about the language are available as part of a presentation by the Real-Time Systems Research Group at the university of York) and a compiler developed at Philips Laboratories named PL Modula which generated code for the LSI-11 microprocessor (This one was written in Pascal, operated under control of the U.C.S.D. system and differed slightly from original Modula as defined by Niklaus Wirth).
As Ian Cottam points out there was a project to write a kernel in Modula: Cottam was "a consultant to Ford Aerospace Corp. of Palo Alto, USA, on their use of the York Modula compiler for a secure and dependable UNIX kernel project". Another paper by William R. Bevier (his dissertation) provides some references and a little insight: "A group at Ford Aerospace designed a kernelized secure operating system (KSOS) intended to provide a secure operating system with an interface compatible with UNIX. [...] An implementation was written in MODULA, but code proofs were not anticipated and not done." Find more information in the KSOS Executive Summary and in the KSOS Final Report by Ford Aerospace and Communications Corp. The operating system was written for the US department of defense (for DARPA). Another presentation describes more details of the system as well as its importance for the development of operating systems. KSOS should replace UNIX v6! Just use a search engine to find even more.
Other projects can be found, for example Software for an air pollution measuring system: An application of modula (an article by J. M. Dubery and A. J. Pinches). In an article about programming languages used at CERN Modula-1 is mentioned as well - here I am not so sure if this wasn't a typo. Definitly Modula-1 is mentioned in recent and also in somehow dated documents. Well, I know these are no perfect citations and references but a few good starting points.



[ top ] 11. ISO Modula-2 library: ProgramArgs
This is just a problem which I came across as there are differences between the Modula-2 compilers providing support for the ISO Modula-2 language AND library: The device module ProgramArgs provides an open channel from which program arguments may be read. p1, gm2 and the Modula-2 compilers by Modulaware return the name of the executed program as the first command line argument (C and POSIX convention), XDS and ADW Modula-2 return the first "real" argument first. So depending on your compiler you may want to call NextArg before parsing through your command line arguments to get past the programname itself. For those interested in the problem there was a discussion in comp.lang.modula2 as a kind visitor of these pages pointed out. Solution? You may want to implement a check if the first argument matches the programs name to avoid portability problems.


[ top ] 12. I want to see (and hear) Niklaus Wirth, inventor of Modula-2
This is a small collection of links to interviews and speeches Mr. Wirth gave over the last few years - have fun:



[ top ] 13. Modula-2 and the Windows API
No matter if we like it or not, Windows is the most used operating system. So the main problem of every language available is an interface to the API of Windows. There are two compilers providing the capability of easily accessing this interface: XDS and ADW Modula-2. Both compilers come with modules for accressing the win32api. The great theForger's Win32 API Tutorial adapted by Frank Schoonjans for Modula-2 should be a more in depth reading and if this still is not enough information, have a look at the Translations of Example Programs in Charles Petzold's book "Programming Windows 95" from Visual C++ to Modula-2. This helps a lot and it is almost all the information you can get. For some interesting examples have a look at the Sources Store for Modula-2 and Oberon. You may download a lot of packages there saving the Windows programmer a lot of time.
Wimdows by Wim Devesse is a library to write Windows applications that take advantage of the graphics capabilities of Windows in an easy way for beginning programmers. It is focused on creating simple games and is used at Vrije Universiteit Brussel by participants of Practicum Structured Programming Modula-2. The main components of Wimdows are: Graphics functions for drawing geometric figures (lines, rectangles, circles, polygons, ...), working with bitmaps, control of the mouse and keyboard, menus, buttons and text boxes. The library was written for use with the XDS Modula-2 compiler.
Mister Shigeo Hayashi also translated some example programs from a Windows-book to Modula-2.
The Modula-2 FAQ (still) contains links in section 4 which point to an archive named m2afx.zip. Both locations are no longer serving the file but it is available from Modula2.org. The file contains an applications framework for Windows programming: The software implements a number of classes that encapsulate the weirdness of the Windows C API and attempts to present it in a cleaner way to the Modula-2 programmer. But "this software will only work on the TopSpeed Modula-2 compiler version 3.00 and later" as it uses the object-oriented extensions of TopSpeed Modula-2.


[ top ] 14. Modula-2 and C
These are just a few pointers to get you started:



[ top ] 15. Sockets Programming in Modula-2
BSD-sockets (and the winsock-api) are something like a standard for programming the internet (not only: the concept is to standardize interprocess communication). Nearly every modern programming language gives you the possibility to use sockets, where opening a socket is like opening something like an endpoint for an abstract communications-channel. There are some good introductions related to this subject available - for a start have a look at the quick and dirty primer for bsd-sockets by Jim Frost and - if that's your operating system - the Winsock Programmer's FAQ. These links provide more links to dig deeper. Best tutorial (basics and some advanced topics) I found is Beej's Guide to Network Programming using Internet Sockets (and have a look at his pages as they are a treasury).
Sockets and Modula-2:

  1. Windows Sockets (winsock): Fetch XDS-Modula-2 and the file WinSock2.zip from the Sources Store for Modula-2 and Oberon. Extract the archive from the base-directory of your XDS installation. This gives you the usual interface to the winsock-dll (via a definition module which interfaces to the winsock library). Works fine but you'll find out there are some things that do not work like expected.
  2. ADW Modula-2 comes with a module called Socket.def providing an interface for programming sockets (Usually to be found in \ADW Software Modula-2\advapidef).
  3. BSD Sockets (1): Just use GNU Modula-2. The compiler comes with a simple example using ClientSocket.def. Have a look to get started. There is also a module ServerSocket which provides a mechanism to open a server socket as an ISO Modula-2 channel. And this is the really interesting part: sockets communication using the ISO Modula-2 library!
  4. BSD Sockets (2): Page Six is a service bot for IRC channels written in XDS Modula-2 (Sources) using sockets. Very helpful to get started.
  5. BSD Sockets (3): The OS/2 version of PMOS by Peter Moylan contains a file 'sockets.def' wich provides a simple interface to bsd-sockets. Once again, mighty PMOS shows its power... I didn't find this earlier 'cause I never downloaded the OS/2 version.
  6. M2Lib by H. Kleinschmidt (available from the local download-area) is an impressive library for Atari Computers which can be used with a variety of compilers for this platform. Clicking my way through the directories of the library I found a module for handling sockets. The documentation (which is in German) says this lets you carry out elementary sockets-operations using MiNT-net by Kay Roemer. As I do not have an Atari I was not able to test this.



[ top ] 16. Modula-2 and X11



[ top ] 17. Modula-2 in videos and films
Some short films demonstrating various historic computers running or software written in Modula-2.



[ top ] 18. I want to convert my Modula-2 sources to HTML
Pygments is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis or other applications that need to prettify source code. Compared to the following programs this one is a very feature rich but harder to install piece of software. It is great. It does a lot of things, it is usable as a command-line tool and as a library and it is written in Python. Related to Modula-2 there are options to highlight PIM, ISO, objm2 (Objective Modula-2) and gm2ext (also highlight GNU extensions) dialects of the language.
Web C Plus Plus, does not only process C++ sources. It's a "command line utility that takes your source code, and converts it into an HTML file using a fully customizable syntax highlighting engine and colour schemes. This is useful if you want to post your code online and make it easier to read, or to make online programming tutorials." I used it a lot of times and it works great.
Highlight generates HTML files from your sources with external CSS definitions. Since version 2.16 Modula-2 is recognized. Packages for a lot of platforms are available (Windows, numerous Linux distributions, FreeBSD, Solaris and OS X). Highlight also works as a plugin with some programs.
modula2html: "Highlight Pascal or Modula-2 sources for WWW presentation" - download pas2html, for modula-2-source also.
MOD2HTM comes as part of the impressive Q&D Tools package which is available from the local download area. The program was developed using the Topspeed Modula-2 compiler and comes with sources ("*freeware*, but definitely NOT public domain nor even GPL. You can use these programs without cost, but they're not yours"). In the download area you'll also find a port of the program to Windows operating systems. As the author points out, the DOS version (which runs for example perfectly well inside of an emulator like DOSBox) is more stable and mature.



[ top ] 19. Converting Modula-2 sources to PostScript
Peter Bartke wrote a Modula-2 style sheet for use with a2ps. It requires a2ps version 4.9. A2ps is "an Any to PostScript filter. It started as a Text to PostScript converter, with pretty printing features and all the expected features from this kind of programs. But today, it is also able to deal with other file types (PostScript, Texinfo, compressed, whatever...) provided you have the necessary tools". The Modula-2 stylesheet is part of the GNU package.



[ top ] 20. Literate programming and Modula-2
Literate programming is a method to integrate programs with their documentation. Compilable modules are no separate entities, but they are extracted from the documentation. Here are a few hints related to Modula-2: An introduction to the CLiP approach which is language independent. Then there is DOgMA, a software tool that supports the documentation and maintenance of Modula-2 programs. The tool combines the concepts of hypertext and literate programming to deliver powerful support of the comprehension process. And last but not least there is the WEB system, originally created by Donald E. Knuth as the first implementation of what he called "literate programming". Knuths system worked with the Pascal language but was later also adapted for use with Modula-2. An online article about the implementation is here: Sewell, E. Wayne. "How to MANGLE your software: the WEB system for Modula-2" (TUGboat, 8(2), pages 118-122, July 1987). More information here.



[ top ] 21. Database programming and Modula-2
Of course Modula-2 was successfully used for database programming - already on the Lilith. Some very useable packages are available as is historically interesting information.
There is an Open Database Connectivity (ODBC) package for XDS Modula-2/Oberon-2 available from the Sources Store for Modula-2 and Oberon-2 Programming Languages written by Victor V. Sergeyev.
ADW Modula-2 comes with some definition modules to access SQL databases. These modules are translations of the original .h files provided with the Windows operating system. Have a look in the directory \ADW Software Modula-2\win32apidef of your ADW install (unless you changed the name of the main directory).
Some modules for using SQL-databases from Modula-2 were available from Modula2.org in the past. You may ask there for help.
There is DBPL, "a type-complete modular database programming language developed at the Chair of Prof. Schmidt at TU Hamburg-Harburg between 1985 and 1992. In the DBPL project we tackled the problem of supporting data-intensive applications in a single framework, clean and simple in its conceptual foundation and free of technical mismatches." And: "The DBPL project results in a mature product for modular database application programming and a follow-up project based on polymorphic types and other higher-order concepts (see Tycoon). Stable multi-user system implementations are available on request for VAX/VMS and Sun-4/SunOS4.1 platforms. These implementations also provide transparent gateways to access legacy databases on commercial SQL servers (Ingres and Oracle)." It should be noted that DBPL is a fully upward compatible extension of Modula-2. More information (VAX/VMS DBPL Modula-2 User's Guide) is available (and here).
A relational database was designed as part of the StarLite project mentioned above and research was building up on that: "The research effort during October 1989 to September 1990 was concentrated in three areas: investigating new techniques for real-time database systems, integrating a relational database system with the real-time operating system kernel ARTS, and developing a message-based database prototyping environment for empirical study."
Now for the even older (but related to DBPL) stuff: Modula/R "is a database programming language that integrates the programming language Modula-2 and the relational database model. This paper describes the language concepts of Modula/R and its implementation on the personal computer Lilith within the database project LIDAS. A transaction concept as an extension of the procedure concept is integrated into Modula/R to support its implementation in a multi-user environment with access to shared distributed databases through a network of personal computers." More information on LIDAS is available from ETH and ModulaWare.
You may also be interested in the book Object Oriented Database Programming in Modula-2 by Suad Alagic.



[ top ] 22. Standard libraries and portability
Several attempts were made to make Modula-2 more portable if used on different machines, systems and architectures. A paper by J. Thöny called Practical Considerations on Writing Portable Modula-2 Code from ETH Zürich gives some insight in a number of problems related to this topic.
Different approaches were taken by defining a set of standard libraries.
(1) BSI drafts for a proposed BSI I/O Library were drafts of the evolving ISO Modula-2 library (I think so? Anyone? There is information that the ISO/IEC/BSI-Modula-2 Standard working group had the goal to have an identical BSI and ISO Standard of Modula-2 by the end of 1990).
(2) Dotzel, G. 1986. A Modula-2 I/O Library Proposal. Journal of Pascal, Ada & Modula-2 5(2): 24-32.
(3) Craig, J.M. et al. 1985. Design of a Modula-2 Standard Library. Journal of Pascal, Ada & Modula-2 4(2): 33-46.
(4) OSSI: Biagioni, E. OSSI. a portable operating system interface and utility library for Modula-2. Eidgenössische Technische Hochschule Zürich (1986), Biagioni, E. OSSI - a portable operating system interface and utility library for Modula-2. Eidgenössische Technische Hochschule Zürich (1987). Also available: OSSI - A Portable Operating System Interface and Utility Library for Modula-2, Technical Report 86-005 of the University of North Carolina at Chapel Hill, Department of Computer Science. Some definition modules of OSSI are available from the local download area.
(5) Olsen & Associates Portable Modula-2 Library (evolved from the YAML library written by Robert Nagler). Description from README: "The library's foremost feature is its portability. Applications which use the library should be portable (usually w/o modification) and the library definition and current implementation should easily port to other systems. The library was originally centered around I/O, but has been expanded to include those facilities which we found were required for Modula-2 application programming in general." I have to add: portability in this case means portability between the Sun Modula-2 compiler and the Logitech compiler for DOS systems. This library is available from the local download area.






Get more information


FMP RSS Feed

IRC Modula-2 Chat

Modula-2 at Wikipedia.org

Modula-2 Webring
[ List all | Random | Join ]
[ Prev | Next ]

Google



Contact, suggestions, submission of news items: contact information