Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
Message-ID: <computer-lang/Modula2-faq/[email protected]>
Supersedes: <computer-lang/Modula2-faq/[email protected]>
Expires: 3 Jul 2009 04:13:03 GMT
References: <computer-lang/Modula2-faq/[email protected]>
X-Last-Updated: 2009/05/13
From: Rick Sutcliffe <[email protected]>
Followup-To: poster
Organization: none
Newsgroups: comp.lang.modula2,comp.answers,news.answers
Subject: Modula-2 FAQ/part2
Distribution: world
Approved: [email protected]
Keywords: languages, Modula-2
Summary: This file contains the answers to some commonly asked questions
 about the programming language Modula-2.
Originator: [email protected]
Date: 20 May 2009 04:13:11 GMT
Lines: 593
NNTP-Posting-Host: penguin-lust.mit.edu
X-Trace: 1242792791 senator-bedfellow.mit.edu 315 18.181.0.29
Xref: senator-bedfellow.mit.edu comp.lang.modula2:22187 comp.answers:66528 news.answers:323049

Archive-name: computer-lang/Modula2-faq/part2
Version: 2.33
Last-modified: 2009 05 07
Posting-frequency: Monthly

                Modula-2 Frequently Asked Questions Part 2
4. WHERE CAN I GET SOURCE CODE, OTHER INFO?

4.1.1 Is there source or other info available on the net?
A. Here are some net sites I have accessed at one time or another. I am not=
sure if all are still available or what is in them.
ftp://ftp.psg.com/pub/modula-2/
http://www.arjay.bc.ca/Modula-2/m2faq.html ( Home of this FAQ)
ftp://ftp.inf.ethz.ch/pub/
ftp://NIC.SWITCH.CH
ftp://ftp.mathematik.uni-ulm.de/pub/soft/modula/

WWW sites
http://dir.yahoo.com/Computers_and_Internet/Programming_and_Development/Lan=
guages/Modula_2/

http://i44www.info.uni-karlsruhe.de/~modula

http://modula2.org

http://lwb.mi.fu-berlin.de/murus/A large amount of Modula-2 source as well =
as the modified Mocka-on-Linux compiler (to accept def/mod files).


4.2 What other FAQs or lists of pages are available?
A1. http://dmoz.org/Computers/Programming/Languages/Modula-2/Compilers/
A2.http://murray.newcastle.edu.au/users/staff/peter/m2/Modula2.html
A3.http://freepages.modula2.org

4.3  Where can I find graphics libraries, etc?
A. Try the PMOS library for various platforms at one of the following sites=
:
ftp://ftp.psg.com/pub/modula-2/code  (North America)
ftp://cs.ru.ac.za/pub/languages   (South Africa)
ftp://dutiba.twi.tudelft.nl/pub/modula2 (Western Europe)
ftp://ftp.cnit.nsu.ru/pub/msdos/programm.ing/modula2   (Eastern Europe).

4.4 Are there any mathematical libraries available?
A1. See Numerical Procedures in Modula-2 -- authorized translation of Numer=
ical recipes in Pascal from PolyWare (Klara Vancso): [email protected]   (wor=
k) OR [email protected]   (home) The CD-ROM has the Modula-2 sources. See htt=
p://www.nr.com Note that sources given in this book are of the "quick and d=
irty" variety and cannot be sold as such, only in compiled form.

A2. LMathLib is a library that defines a number of mathematical functions f=
or Modula 2 programs. Unlike other libraries of the same kind, LMathLib pat=
ches the Modula 2 compiler. All library functions are inlined as assembler =
code for the Floating Point Unit. This results in faster code compared to t=
he traditional solution with subroutine calls. Due to this machine dependen=
t technique, you can use the library ONLY with the (free) GMD Modula System=
Mocka for Linux on INTEL based machines. You can get the LMathLib library =
via anonymous ftp from ftp://tee-1.tee.uni-essen.de/pub/Mocka/(132.252.131.=
33) Documentation is included.

A3. MATHPAK 87/32 is available for most 32-bit compilers. A lite version fo=
r Canterbury M2 is freely downloadable from http://www.webcom.com/mhc/welco=
me.html
Features:
Written fully in INTEL CPU machine language
 Math Coprocessor control
 Basic Math functions
 Vector and Vector-Scalar Routines
 Vector and Vector-Scalar 'Skip' Procedures
 Complex Number Routines
 Complex Vector and Vector-Scalar Routines
 Polynomial Manipulation Routines
 Simple Matrix and Vector-Matrix Routines
 Solving Systems of Linear and Nonlinear Equations
 Unconstrained Minimization
 Nonlinear Least-Squares Minimization
 Eigenvalues and Eigenvectors
 Singular Value Decomposition
 Extrapolation of Vector-Sequences
 Statistical and Data-Fitting Rountines
 Fourier Transforms and Convolution
 Spectral Analysis Routines
 Numerical Integration
 Differential Equations

4.5  Where can I get a Modula-2 to C converter?
A: The program mtc is available from
ftp://ftp.ira.uka.de/pub/programming/cocktail/mtc.tar.gz
ftp://ftp.Uni-Koeln.DE/usenet/comp.archives/languages/modula-2/mtc/
Several of the compilers available work or can work by producing C or C++ c=
ode and can also serve this purpose. See p1, XDS and Ulm's m2c (not the sam=
e as mtc) listings for examples.

4.6  Where can I get a Modula-2 to Component Pascal converter?
A.This is available from http://www.lrz.de/~Bernhard_Treutwein/m2o.txt
Note: Component Pascal is an Oberon dialect, but the translator does not us=
e any CP specific features, i.e. generates standard Oberon-2.

4.7 Are there any Modula-2 applications around?
A. Besides the items mentioned in 1.11, the Idaho National Engineering Labo=
ratory (INEL) develops and maintains a now
~350,000 line MODULA-2 reusable component library called SAGE. For more in=
formation on SAGE send E-Mail to [email protected] or see the web site =
at http://sage.inel.gov/homepage.htm


4.8 Are there any compiler construction tools available?
A1. Some old ones appear in ftp://ftp.gmd.de/GMD/cocktail/

A2. Coco/R generates recursive descent parsers and their associated scanner=
s from attribute grammars. Full source code, and a variety of simple exampl=
e applications are supplied in the distribution kits. The Modula versions (=
1.50 is the latest) are available from ftp://ftp.ssw.uni-linz.ac.at/pub/Coc=
o/ and the Java versions are there too, at ftp://ftp.ssw.uni-linz.ac.at/pub=
/Coco/javacoco.htm
See also:
ftp://ftp.inf.ethz.ch:/pub/software/Coco
ftp://ftp.psg.com:/pub/modula-2/coco
ftp://cs.ru.ac.za:/pub/coco
ftp://ftp.fit.qut.edu.au:/pub/coco
There are versions for the MS-DOS compilers (JPI, FST, Logitech, StonyBrook=
, Gardens Point), for the Mocka compiler for Linux and FreeBSD, as well as =
for the Gardens Point Unix compilers, including Linux and FreeBSD. There is=
also a version that produces TurboPascal units very similar to the Modula-=
2 modules. This is also FreePascal compliant now. A port for the p1 compile=
r on Mac OS 9 is also available. Latest information is available at http://=
cs.ru.ac.za/homes/cspt/cocor.htm. Pat Terry's textbook "Compilers and Compi=
ler Generators" that uses Coco/R is now online at http://www.scifac.ru.ac.z=
a/compilers

A2. A copy of the EBNF for ISO Modula-2 can be found in Appendix 3 of the s=
hareware text at:
http://www.modula-2.com

4.9 Is there an applications framework for Windows programming?
A. Try looking at
ftp://ftp.ifi.uio.no/pub/sjr/m2afx.zip orftp://ftp.leo.org/pub/comp/platfor=
ms/pc/windows/programming/modula/m2afx.zip

This software is an application framework that implements a number of class=
es that encapsulate the weirdness of the Windows C API and attempts to pres=
ent it in a cleaner way to the Modula-2 programmer.

4.10 Does there exist something to convert a C header file to a Modula-2 DE=
FINITION MODULE file for me?
A. Try looking at the XDS Ltd site for the H2D freeware product on some pla=
tforms

4.11 Where can I get the C code of a Modula-2 compiler?

A. Most Modula-2 compilers are written in Modula-2. It seems
rather strange to me that one would want to trust the compilation of a
good language to a tool written in a poor one.

4.12 What language is the linker written in?

A. That depends. If the linker is system wide (designed for multiple langua=
ges) it could be written in almost any language. If it icomes with the Modu=
laq-2 package and is designed for linking files produced by a Modula-2 comp=
iler, it may well be written in Modula-2.


4.13 What can I do with  old sources from Modula Corp?

A. From the former president Richard Ohran ([email protected]): "Modula Corp=
is dead. Do whatever you like."

4.14 Are there source code examples anywhere for Windows programmers?

A. Translations of Example Programs in Charles Petzold's book "Programming =
Windows 95" from Visual C++ to Stony Brook and XDS Modula-2 by Peter Stadle=
r, Vienna can be found at: http://www.nhm-wien.ac.at/Petzold/Index.html


4.15 Isn't there a Modula-Prolog project somewhere?

A. Try ABB Corporate Research and Carlo Muller, who may license it to you f=
or non-commercial purposes. mailto:[email protected]

4.16 Is C. Lins SCL library available?

A. Yes, at



4.17 Can you help me with my assignments?
A1. Some people may give you hints, but please do not subvert your professo=
r and your education by submitting work other people do for you.

A2. Here are two answers submitted to the newsgroup in response to a desper=
ate student's plea for ANY Modula-2 program. The first is rather prosaic; t=
he second a little more imaginative:
MODULE homework;

IMPORT STextIO;

BEGIN
 LOOP
   STextIO.WriteString ("I will do my own homework.");
   STextIO.WriteLn;
 END;
END homework.

main()
{
   int i;

   for(i=3D0; i100; i++)
       printf("I will do my own homework.\n");

}

Followup Question: Is that Modula-2? I just finished my first course in Mod=
ula-2 and that don't look at all familiar. I'm not looking forward to the f=
inal exam.
A. (Pat Terry) Computer Science changes sooo rapidly. Haven't you discovere=
d Modula-2++ yet?


5. SPECIFIC QUESTIONS ON CODE AND ALGORITHMS

5.0 Where can I get general information on algorithms?
A Try the site  http://www.cs.sunysb.edu/~algorith/

5.1 Where can I get an algorithm for an efficient random number generator?
A1. Pierre L'Ecuyer: Efficient and Portable Combined Random Number Generato=
rs, Communications of the ACM, vol. 31, no. 6, pp. 742-749. The RNG has a p=
eriod of approximately 2.3E+18. Generating 1 000 000 numbers per second, th=
at means that it would take over 73 000 years before it repeated a sequence=