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

Common Programming Problems using Modula-2


Instead of writing a Modula-2 tutorial I decided to write this getting-started-guide - the turorial I started to write did not get closer to the thing I wanted it to be: simple and illustrated by good examples. Meanwhile the tutorials at Modula2.org were published. So here are some hints for certain areas that are not covered by the tutorials I know of. Most of the links collected here deal with the lack of interfaces provided by Modula-2 compilers for common programming tasks.


[ top ]  Windows API

No matter if we like it or not, Windows in all its more or less weak implementations 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 StonyBrook Modula-2, the latter being no longer available, the only free one at the moment being XDS-Modula-2. Download the package from Excelsior and have a look at the examples for getting started. 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 german-speaking people there is another great resource that can be found at the University of Graz (Austria): this is a tutorial on programming Windows with Modula-2 containing simple examples and a basic introduction to the concepts of Windows. Used compiler is XDS-Modula-2. For more complex examples have a look at the Sources Store for Modula-2 and Oberon. You may download a RichEdit-package, an ODBC-interface and some other really interesting material there.
Mister Shigeo Hayashi also translated some example programs from a Windows-book to Modula-2. Useful.
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 ]  Modula-2 and C


[ top ]  Sockets

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 and the winsock-primer by Jim Frost. These short introductions also provide links to get in 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): The only free approach I know of works with XDS-Modula-2. After installing the compiler, you'll have to go to the Sources Store for Modula-2 and Oberon. Download the file 'WinSock2.zip' from there and extract it 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). Until now I just compiled some simple programs - seems to work fine.
  2. BSD Sockets (1): Just use GNU Modula-2. The compiler comes with a simple example using ClientSocket.def. Have a look to get started. For other compilers you'll have to interface to C - which is possible with most Linux and BSD compilers.
  3. 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.
  4. 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.
  5. 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 ]  X11



Get more information


FMP RSS Feed

IRC Modula-2 Chat

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

Google


dmoz



Contact, suggestions, submission of news items: contact information







Made with CSS