Article View: net.lang.mod2
Article #415Modula-2 and other languages (under
From: lmjm
Date: Wed, 30 Apr 1986 10:59
Date: Wed, 30 Apr 1986 10:59
45 lines
1769 bytes
1769 bytes
Subject: Modula-2 and other languages (under UNIX on VAX)
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:
<14357423@ivax>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!hpda!hpisoa2!hpitg!ivax!lmjm@ivaxShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!hpda!hpisoa2!hpitg!ivax!lmjm@ivax From: lmjm@ivax Newsgroups: net.lang.mod2 Subject: Modula-2 and other languages (under Message-ID: <14357423@ivax> Date: Wed, 30-Apr-86 06:59:00 EDT Article-I.D.: ivax.14357423 Posted: Wed Apr 30 06:59:00 1986 Date-Received: Wed, 14-May-86 01:42:58 EDT Lines: 45