gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] [Exporting and Importing amongst inner modules


From: john o goyo
Subject: Re: [Gm2] [Exporting and Importing amongst inner modules
Date: Tue, 3 Jun 2014 12:51:38 -0400


On 3 Jun 2014, at 05:51, Gaius Mulley wrote (in part):

john o goyo <address@hidden> writes:

Thie following problem occurs with gm2-4.1.2 (given that I am
currently stuck building mpfr).  I cannot remember if this was
reported before and I could not find anything on the mailing list.

Hi John,

thanks for the report - I cannot remember this being reported before.
I think there are some problems with the test code though:


Symbols exported from one inner module are not seen within a second
inner module.  Example code follows.


MODULE InnerModules;
 (*-------------------------*)
 MODULE FirstInner;

 EXPORT One;  (* Not seen by gm2 *)

 PROCEDURE One() :CARDINAL;
 BEGIN
   RETURN 1;
 END One;

 END FirstInner;

 (*-------------------------*)
 MODULE SecondInner;

 FROM FirstInner IMPORT One; (* Will not compile *)

I think this should be:

   IMPORT One;

as the 'FROM' statement looks up modules from the global universe.

Interesting... this was a distillation from the file MCP1IO.mod of the M2M (ETH) compiler. (The same file is in the ULM distribution.)

Here is the truncated file showing the imports.

(****************************************
*                                       *
*     MODULA-2 Multi-Pass Compiler      *
*     ****************************      *
*                                       *
*     Implementation for Lilith         *
*                                       *
*                                       *
*     MCP1IO:                           *
*                                       *
*     input / output handling in Pass 1 *
*                                       *
*     Version C18 of 11.03.82           *
*                                       *
*     Institut fuer Informatik          *
*     ETH-Zuerich                       *
*     CH-8092 Zuerich                   *
*                                       *
****************************************)

(* changed to handle tabs 9.9.83 *)

IMPLEMENTATION MODULE MCP1IO;      (* LG *)
  (*...*)

  MODULE OutputSystem;
  (*...*)
    EXPORT
      PutS, PutSy, PutSyVal, PutIdent, Error,
      InitSave, StopSave, RestartSave, ReleaseSys,
      InitOutput, TermOutput;
  (*...*)
  END OutputSystem;

 MODULE IdentSystem;
  (*...*)
    FROM OutputSystem IMPORT Error;
  (*...*)
  END IdentSystem;

  MODULE StringSystem;
  (*...*)
    FROM OutputSystem IMPORT Error;
  (*...*)
  END StringSystem;

  MODULE SymFileInput;
  (*...*)
    FROM OutputSystem IMPORT PutS, StopSave, RestartSave, Error;
    FROM IdentSystem IMPORT InIdTab, OutIdTab, EnterId;
    FROM StringSystem IMPORT PutStrCh, InitString, TermString;
  (*...*)
  END SymFileInput;

  MODULE Scanner;
  (*...*)
    FROM OutputSystem IMPORT PutS, PutSyVal, Error;
    FROM IdentSystem IMPORT InIdTab, EnterId;
    FROM StringSystem IMPORT InitString, PutStrCh, TermString;
  (*...*)
  END Scanner;

  (*...*)
END MCP1IO.


john



reply via email to

[Prev in Thread] Current Thread [Next in Thread]