HOME

Resources

Compilers Tutorials/Papers Libs/Sources Newsgroups FAQ Forums/Lists

Special Areas

GNU Modula-2 Modula-2 CGI Tutorial Howto Setup a Fine Modula-2 Environment Programming with Modula-2 Misc. Modula-2 Related Pages Not-English Modula-2 Pages Downloads Please Sign My Guestbook Code Search

Recommended Links

GNU Modula-2

Modula-2 home page

Frequently Asked Questions

There are two FAQ's available on the net: The Modula-2 FAQ compiled by Rick Sutcliffe - This is something like the "official Modula-2 FAQ". The document is being updated and is highly recommended lecture for people new to Modula-2.
There's another FAQ online which is a bit dated: questions compiled from comp.lang.modula2.


[ top ]  Local FAQ

This section is under construction. Every now and then I'll add questions and answers here wich I missed when searching the web. What's to appear here depends on your or my interest - suggestions welcome. I don't want to write a FAQ concurring to the one maintained by Rick Sutcliffe - I suggest to start reading there. The material here should be seen as an extension like the ISO-Modula-2 standard for generics -

1. Is Modula-2 a so called "Object Oriented Language" ?
2. Debugging Modula-2 programs
3. Modula-2 is a language for systems programming - right?
4. Modula-2 and POSIX?
5. Where can I get information about ISO Modula-2?
6. Is there any Information available on Real Time Programming?
7. Exceptions and Modula-2?
8. What about translating C to Modula-2?


[ 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."
 (B)
Roger Carvalho implemented some OO-Extensions in the last versions of FST Modula-2 (3.5+).
 (C)
You can find some information on Object Oriented Modula-2 at ULM's FTP Server.


[ top ] 2. Debugging Modula-2 programs
 (A)
There is a way to use 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.
 (B)
M2F and GNU Modula-2 generate debug-information for GDB.
 (C)
There are some problems with Gardens Point Modula-2, 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.
 (D)
Working on a Windows-platform, maybe the best idea would be switching to XDS-Modula-2. The package is free for educational use and comes with a native win32-debugger. Download at http://www.excelsior-usa.com/xdsx86.html.


[ 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.
 (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)
Writing a complex system such as an operating system also makes PMOS by Peter Moylan very interesting for you. A short description from the homepage: "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."
 (D)
A simple Modula-2 kernel is possibly still available from ftp://floppsie.comp.glam.ac.uk. Packages are available for Debian and Redhat systems. I haven't had time to have a look at this.
 (E)
Well, at the moment no pure Modula-2 system is available. You may be interested in Native Oberon, which is an amazing operating system that can be easily installed on nearly every PC. There's also Bluebottle-OS, which is even more impressive. Description from homepage: "Bluebottle is a powerful operating system based on the Active Object System (Aos) kernel. It provides a compact runtime environment for the Active Oberon language ( pdf), which supports active objects directly, and enables the construction of efficient active object-based systems that run directly on the hardware. Above this layer is a flexible collection of modules providing generic abstractions for devices and services, e.g., file systems, user interfaces and TCP/IP networking". Just have a look - but you'll have to write Oberon which is in my opinion VERY different to Modula-2.
 (F)
Last but not least there is the operating system SPIN which is mostly coded in Modula-3. The homepage of the project contains lots of useful information. 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?
 (A)
There was work being done on the ISO-project "JTC1.22.03 -- Modula-2 to Posix Binding" but the project was cancelled. 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 this 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 book "Abstractions for Data and Programming Structures (Using ISO-Standard Modula-2)" by R. Sutcliffe. This is a Sharebook (!). There were only a few books published after the standard came out. Anyone has a list of books dealing with ISO M2?
 (B)
Some documents (draft 4 of the ISO standard;) can still be found and downloaded. But this material differs slightly from the standard.
 (C)
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.
 (D)
Maybe the best idea to start is reading through the definition modules of the ISO Modula-2 Library (coming with 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.).
 (E)
The standard itself can be bought at the International Organization for Standardization itself. This is expensive. Here are the relevant links for Modula-2:



[ top ] 6. Is there any Information available on Real Time Programming?
I haven't found a lot of informantion yet. Some courses on the topic were held at ETH Zuerich. Some (german) pdfs can be found via search machines.



[ top ] 7. Exceptions and Modula-2?
In my humble opinion this is one of the nice concepts introduced with ISO Modula-2. Exceptions are a really powerful way of handling exceptional situations that are errors of your program. 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 read where they make sense and what errors they should catch. When I started with exceptions I raised one every tick my program made: but as the name says, usually a program should only raise an exception when something really unexpected happens. Well, that's my understanding at the moment.



[ 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.





Get more information


FMP RSS Feed

Modula-2 Webring
[ List_all | Random | Join ]
[ Prev | Next ]

Google


dmoz







Made with CSS