Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!uunet!van-bc!rsoft!mindlink!a155 From: a155@mindlink.UUCP (Licerio Alvernaz) Newsgroups: comp.lang.modula2 Subject: MultiCompilers in Module Message-ID: <1894@mindlink.UUCP> Date: 24 May 90 19:22:17 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 97 I am seeking information and advice on an idea/problem that I have in mixing Modula-2 and other languages. Basically I would like to be able to use Modula-2 as a platform for mutli-compiler interface. What I mean by this is that I would put C or ASM code within the modules ( between the BEGIN and END ) and when the M2 compiler hits the other language code, it would then call the required compiler to compile that code from within the module. Am I crazy or is this a reasonable idea ? What follows is some example code of what I am talking about and I hope this illusrates the point I am trying to make. well here goes .... my 2 bits .... *-=> please note that this syntax example is just that <=-* *-=> i am on a AMIGA and using BenchMark Modula2 <=-* PROCEDURE subroutine(arg1, arg2 : CARDINAL); FROM SYSTEM IMPORT ADDRESS; MODULE subroutineX {C}; /* note the {} tells the modula2 what language*/ EXPORT sub1; PROCEDURE sub1 ( parm1, parm2 : CARDINAL) : CARDINAL; FROM Intuition IMPORT WindowPtr, NewWindow, ShowTitle(**), ScreenPtr, OpenWindow(**); VAR BLTAFWM : ADDRESS; BLTALWM : ADDRESS; scr : ScreenPtr; newwin : NewWindow; win : WindowPtr; BEGIN UWORD *BLTAFWM = (UWORD *)0xDFF044; UWORD *BLTALWM = (UWORD *)0xDFF046; if (win = OpenWindow(&newwin)) { ShowTitle(scr,FALSE); } *BLTAFWM = parm2 << (15 - (parm1 & 0x0F )); *BLTALWM = parm2 >> (parm1 & 0x0F); RETURN parm1 >> (parm1 & 0x0F) END sub1; BEGIN END subroutineX; MODULE subroutineY {asm}; /* note the {} tells the modula2 what language EXPORT sub2; PROCEDURE sub2 ( parm1, parm2 : CARDINAL); FROM ExecBase IMPORT ExecBasePtr; FROM Memory IMPORT AllocMem; CONST CHIP = 2 VAR GraphicsName : POINTER TO ARRAY OF CHAR Sprite : POINTER TO LONGWORD; EndSprite : POINTER TO WORD; SpriteLen : CARDINAL; d0,d1,a6 : LONGCARD; BEGIN move.l ExecBasePtr,a6 move.l #SpriteLen,d0 move.l #CHIP,d1 jsr AllocMem(a6) SECTION data,DATA GraphicsName: dc.b "graphics.library",0 Sprite: dc.l $6D607200 dc.l $FFFFFFFF,$FFFF0000,$0000FFFF dc.l $FFFFFFFF,$FFFF0000 dc.l $00000000 EndSprite: SpriteLen equ EndSprite - Sprite END sub2; BEGIN END subroutineY; BEGIN (* main *) IF a = 0 THEN a := sub1( arg1, arg2 ); b := sub2( arg1, arg2 ); END END subroutine; I hope this is clear in some awkward way. I'm struggling with an idea and all advice is greatly welcome. *-=> in the hopes that even bad ideas can spark <=-* *-=> the insight from which grow the great ideas <=-* -- "I says whatta I means and I means whatta I says..." L. Alvernaz Vancouver, B.C. rsoft!mindlink!a155@van-bc.UUCP