🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.mod2
Article #386

Modula-2 and other languages (under UNIX on VAX)

#386
From: lmjm
Date: Wed, 30 Apr 1986 01:59
43 lines
1836 bytes
Both Powells compiler and one I've been working on locally use the same
trick.  You write the DEFINITION module in M2 but the IMPLEMENTATION of
that module in some other language.  I can't remember what the conventions
are in Powells but I have all identifier names qualified with the module
name at the begining followed by an '_'.  There is also an initialisation
function for each module with the name module-name__init.

For example:

DEFINITION MODULE x;

	EXPORT QUALIFIED 
	PROCEDURE f ( a : INTEGER ) : INTEGER;
END x;

/* implementation of x in C */
x_f( a )
int a;
{
	blah blah blah
	return( 0 );
}

x__init()
{
	function to initialise x
	call to this automatically generated by modules that import x.
}


Although this has the IMPLEMENTATION in C so long as the name
conventions (and of course the call/return conventions) are adhered to
any language can be used.

Using a M2 module from C is just as easy so long as you remember to
call module-name__init() before using it.
--
UKUUCP SUPPORT  Lee McLoughlin
	"What you once thought was only a nightmare is now a reality!"

Janet: lmcl@uk.ac.ukc, lmjm@uk.ac.ic.doc
DARPA: lmjm%uk.ac.doc.ic@ucl-cs
Uucp:  lmjm@icdoc.UUCP, ukc!icdoc!lmjm
Technical Details
Message-ID: <8604292015.a025052@ivax.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!doc.ic.ac.uk!lmjm

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!doc.ic.ac.uk!lmjm
From: lmjm@doc.ic.ac.uk
Newsgroups: net.lang.mod2
Subject: Modula-2 and other languages (under UNIX on VAX)
Message-ID: <8604292015.a025052@ivax.doc.ic.ac.uk>
Date: Tue, 29-Apr-86 21:59:32 EDT
Article-I.D.: ivax.8604292015.a025052
Posted: Tue Apr 29 21:59:32 1986
Date-Received: Fri, 2-May-86 07:41:12 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 43