Loading ...
Sorry, an error occurred while loading the content.
 

RE: [GPCP] [GPM] Question about Gardens Point Modula-2

Expand Messages
  • K John Gough
    Hi All For those that are following the GPM thread I have a definitive answer. The existing distributions include both the conventional (PIM-style) and ISO
    Message 1 of 11 , Oct 21, 2010

      Hi All

       

      For those that are following the GPM thread I have a definitive answer.

       

      The existing distributions include both the conventional (PIM-style) and ISO libraries.  However the ISO libraries are almost impossible to use because there are two low-level libraries (StdDevice and TermDevice) missing.  In all the native code distributions of GPM these two were implemented in ANSI C.  I have had another look at the sources, and the translation to C# is daunting to say the least.  They could be accessed by using the Microsoft libc and putting an interop wrapper around it, but this looks like a lot of work for a bad cause.

       

      The IO parts of the ISO Modula-2 libraries have a three layer structure based on Channels, Links and Device-Instances.  Making it sit on top of a conventional file system is a right pain, and nothing about the newer developments in IO on the major platforms has made this any easier.  In short, the ISO proposal was flying against the current wisdom at the time and still does.  I know, I know, I was one of the people who developed the ISO standard.  I thought the IO libraries were a mistake at the time, but did not convince enough members of the committee to throw the proposal out.

       

      Now the snag is that if you use any of the libraries that directly or indirectly import the missing functionality then your program will fail to load. This does not affect the compiler or any of my own programs, since I treat all the ISO IO as the spawn of Satan.  Instead, all of the tools themselves depend ultimately on a library called UxFiles, originally an interface to the UNIX file system, hence the name.  UxFiles translated into C# with about one hour of programming effort.  So InOut, Console, TextInOut, RealInOut all rely on UxFiles.   The current distribution also includes the definition modules for other libraries that have not been implemented on the CLR, these include Coroutines, and the pipe utilities.

       

      So how to solve the problem of “standard” programs that can’t find StdDevice.dll and the like?

       

      I have put a new distribution together, which I will place on CodePlex in the next few days.  This excludes all of the libraries that are directly or indirectly broken.  Other libraries which are not implemented have their definitions removed from the distribution so as not to hold out false hopes.  The new distribution bootstraps the tools, and runs all the Non ISO-specific parts of the test suite.

       

      I will post again when the distribution is up on CodePlex.

       

      Cheers

      John

       

       

       

      From: GPCP@yahoogroups.com [mailto:GPCP@yahoogroups.com] On Behalf Of K John Gough
      Sent: Wednesday, 13 October 2010 11:15 AM
      To: GPCP@yahoogroups.com
      Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2

       

       

      Hi All

       

      Sorry for the gap in reading the group news.  I have been in Europe the last two weeks, and am just catching up.  Will get back soon.

       

      However, the problem is definitely not lack of IO capability generally.  The compiler boostraps itself and runs the 2000-odd programs in the test suite.  The plot thickens, but I am sure it is something simple.

       

      Cheers

      John

       

      From: GPCP@yahoogroups.com [mailto:GPCP@yahoogroups.com] On Behalf Of Stephen Harris
      Sent: Tuesday, 12 October 2010 1:30 AM
      To: GPCP@yahoogroups.com
      Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2

       

       

      All,

      FYI: I modified the program to use only PIM-3 syntax, i.e., use only the InOut module, to see if that got around the linker problem described below.  It didn't.  "stddevice.dll" is a necessary file that I can't live with out.  I am not smart enough to write my own.

      John: any luck tracking it down?

      -Steve


      --- On Sat, 9/18/10, Stephen Harris <sharris1_us@...> wrote:


      From: Stephen Harris <sharris1_us@...>
      Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2
      To: GPCP@yahoogroups.com
      Date: Saturday, September 18, 2010, 1:11 PM

       

      Thanks John.  I don't know if you ever hear it, or hear it enough, but thanks for the work you do with Modula-2 & Component Pascal.

      --- On Fri, 9/17/10, K John Gough <john@...> wrote:


      From: K John Gough <john@...>
      Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2
      To: GPCP@yahoogroups.com
      Date: Friday, September 17, 2010, 8:25 PM

       

      Hi Stephen

      Ok, I’ll have a look and get back to you.  There are a couple of standard libraries that have not been converted to the CLR format.  This *could* be the issue, but I will confirm this or find out what other issue might be involved.

       

      I am still planning to put the whole distribution up on CodePlex, but this will only happen *after* I get some specific doco generated. <sigh>

      Cheers

      John

       

      From: GPCP@yahoogroups.com [mailto:GPCP@yahoogroups.com] On Behalf Of Stephen Harris
      Sent: Saturday, 18 September 2010 8:19 AM
      To: GPCP@yahoogroups.com
      Cc: john@...
      Subject: [GPCP] [GPM] Question about Gardens Point Modula-2

       

       

      Hi all,

      I am writing a program in Modula-2 (listed below). The code compiles, but when I run it I get the following error message:

      ---
      Dump Modula-2 Gardens Point, version 1.3.6 20100917.1

      System.TypeInitializationException: The type initializer for 'SeqFile.SeqFile' threw an exception. ---> System.TypeInitializationExc
      eption: The type initializer for 'IOLink.IOLink' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or as
      sembly 'stddevice, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the fil
      e specified.
      File name: 'stddevice, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
      at IOLink.IOLink..cctor()

      WRN: Assembly binding logging is turned OFF.
      To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
      Note: There is some performance penalty associated with assembly bind failure logging.
      To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

      --- End of inner exception stack trace ---
      at IOLink.IOLink.AllocateDeviceId(Void** did)
      at SeqFile.SeqFile..cctor()
      --- End of inner exception stack trace ---
      at SeqFile.SeqFile.OpenRead(Void** cid, Byte* name, UInt32 hi$name1, Int32 flags, OpenResults* res)
      at Dump.Dump..M2main() in Dump.mod:line 180
      at Dump.Dump..CatchWrapper(String[] args)
      ---

      There is no stddevice.dll in my C:\gpm\bin, so there is nothing to link to.

      What did I do wrong?

      -Steve

      (* Dump.mod

      To Set Up:
      set CLRSYM=C:\gpm\gpmd\clrsyms
      set M2SYM=C:\gpm\gpmd\GPMsym;C:\gpm\gpmd\ISOsym
      set EXTENDGPM=TRUE
      set GPNAMES=Mixed

      if not exist M2RTS.dll copy C:\gpm\bin\M2RTS.dll .\
      if not exist InOut.dll copy C:\gpm\bin\InOut.dll .\
      if not exist m2iop.dll copy C:\gpm\bin\m2iop.dll .\
      if not exist iochan.dll copy C:\gpm\bin\iochan.dll .\
      if not exist chanconsts.dll copy C:\gpm\bin\chanconsts.dll .\
      if not exist seqfile.dll copy C:\gpm\bin\seqfile.dll .\
      if not exist iolink.dll copy C:\gpm\bin\iolink.dll .\
      if not exist stdchans.dll copy C:\gpm\bin\stdchans.dll .\
      if not exist stddevice.dll copy C:\gpm\bin\stddevice.dll .\ <---- no file?
      if not exist rndfile.dll copy C:\gpm\bin\rndfile.dll .\


      To Compile:
      C:\gpm\bin\gpx /c /g /v Dump.mod

      To Execute:
      .\Dump.exe {[-m] file {file ...}}
      *)

      MODULE Dump;

      FROM InOut
      IMPORT WriteString, WriteCard, WriteInt, WriteLn;

      FROM ProgArgs
      IMPORT ArgNumber, GetArg;

      FROM IOChan IMPORT ChanId;
      FROM ChanConsts IMPORT ChanFlags, FlagSet, OpenResults;
      FROM SeqFile IMPORT OpenRead, Close;

      CONST
      THISPROGRAM = "Dump";
      LANGUAGE = "Modula-2";
      COMPILER = "Gardens Point, version 1.3.6";
      VERSION = "20100917.1";

      TYPE
      String = ARRAY [0 .. 255] OF CHAR;

      VAR
      more : BOOLEAN;
      i, j, k, l, m, n : INTEGER;
      argN, more_opt : String;
      f : ChanId;
      r : OpenResults;
      flag : BOOLEAN;

      PROCEDURE StrInit(s : ARRAY OF CHAR);
      VAR
      i : CARDINAL;
      BEGIN
      FOR i := 0 TO HIGH(s) DO
      s[i] := CHR(0);
      END;
      END StrInit;

      PROCEDURE Length(s : ARRAY OF CHAR) : CARDINAL;
      CONST
      MAXLEN = 65535;
      VAR
      i : CARDINAL;
      BEGIN
      FOR i := 0 TO MAXLEN DO
      IF s[i] = CHR(0) THEN
      RETURN i
      END;
      END;
      RETURN MAXLEN;
      END Length;

      PROCEDURE Equal(s, t: ARRAY OF CHAR) : BOOLEAN;
      CONST
      MAXLEN = 65535;
      VAR
      i : CARDINAL;
      BEGIN
      IF Length(s) <> Length(t) THEN
      RETURN FALSE; (* quick exit! *)
      ELSE
      FOR i := 0 TO Length(s) DO
      IF s[i] <> t[i] THEN
      RETURN FALSE;
      END;
      END;
      END;
      RETURN TRUE;
      END Equal;

      PROCEDURE Assign(s :ARRAY OF CHAR; VAR t:ARRAY OF CHAR);
      CONST
      MAXLEN = 65536;
      VAR
      i : CARDINAL;
      BEGIN
      FOR i := 0 TO Length(s) DO
      t[i] := s[i];
      END;
      t[i + 1] := CHR(0);
      END Assign;

      PROCEDURE Index(VAR c : CHAR; s : ARRAY OF CHAR):INTEGER;
      CONST
      NOTFOUND = -1;
      VAR
      i : INTEGER;
      BEGIN
      FOR i := 0 TO INTEGER(Length(s)) DO
      IF c = s[i] THEN
      RETURN i;
      END;
      END;
      RETURN NOTFOUND;
      END Index;

      PROCEDURE Is_LowerCase(c : CHAR):BOOLEAN;
      BEGIN
      IF Index(c,'abcdefghijklmnopqrstuvwxyz') # -1 THEN
      RETURN TRUE;
      ELSE
      RETURN FALSE;
      END;
      END Is_LowerCase;

      PROCEDURE Is_Alphabetic(c : CHAR):BOOLEAN;
      BEGIN
      IF Index(c,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') # -1 THEN
      RETURN TRUE;
      ELSE
      RETURN FALSE;
      END;
      END Is_Alphabetic;

      PROCEDURE UpCase(s : String);
      VAR
      i : INTEGER;
      BEGIN
      FOR i := 0 TO INTEGER(Length(s)) DO
      IF ((Is_Alphabetic(s[i])) AND (Is_LowerCase(s[i]))) THEN
      s[i] := CHR(ORD(s[i]) + (ORD('a') - ORD('A')));
      END;
      END;
      END UpCase;

      PROCEDURE StrCompCaseI(VAR s, t : ARRAY OF CHAR) : BOOLEAN;
      VAR
      r, q : String;
      i : INTEGER;
      BEGIN
      StrInit(r); StrInit(q);
      IF Length(s) <> Length(t) THEN
      RETURN FALSE; (* quick exit! *)
      END;
      Assign(s,r); Assign(t,q);
      UpCase(r); UpCase(q);
      RETURN Equal(r,q);
      END StrCompCaseI;

      BEGIN
      WriteString(THISPROGRAM + " " + LANGUAGE + " " + COMPILER + " " + VERSION);
      WriteLn; WriteLn;

      StrInit(argN);
      more := FALSE;
      i := ArgNumber();
      IF i > 0 THEN
      FOR j := 0 TO i - 1 DO
      GetArg(j, argN);
      Assign('-m',more_opt);
      IF StrCompCaseI(argN, more_opt) THEN
      more := TRUE;
      ELSE
      OpenRead(f, argN, FlagSet{rawFlag}, r);
      (*Open(f, argN, ReadOnly, flag);*)
      IF r = opened THEN
      Close(f);
      ELSE
      WriteString('File could not be opened.');
      END;
      END;
      END;
      ELSE
      WriteString("No command line arguments provided.");
      END;
      END Dump.
      (* ---- End of file ---- *)

       

    • K John Gough
      Hi All The new distribution of gpm/clr is now up on codeplex. See http://gpmclr.codeplex.com I will arrange a notice on the plas.fit website pointing to this
      Message 2 of 11 , Oct 25, 2010

        Hi All

        The new distribution of gpm/clr is now up on codeplex.  See

        http://gpmclr.codeplex.com

        I will arrange a notice on the plas.fit website pointing to this new page.

        Enjoy.

        John

         

        From: GPCP@yahoogroups.com [mailto:GPCP@yahoogroups.com] On Behalf Of K John Gough
        Sent: Friday, 22 October 2010 4:27 PM
        To: GPCP@yahoogroups.com
        Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2

         

         

        Hi All

         

        For those that are following the GPM thread I have a definitive answer.

        <snip>

      • Stephen Harris
        John et al., I had not tried the UxFiles functions because I guessed (incorrectly) that they were only meant for UNIX.  But they work beautifully on Windows,
        Message 3 of 11 , Oct 26, 2010
          John et al.,

          I had not tried the UxFiles functions because I guessed (incorrectly) that they were only meant for UNIX.  But they work beautifully on Windows, as you knew they would, and my program is up and running.  I have to admit, I *do* like the UxFiles routines better than the ISO stuff - it just feels closer to the syntax I am more familiar with.

          Thanks,
          -Steve

          --- On Tue, 10/26/10, K John Gough <john@...> wrote:

          From: K John Gough <john@...>
          Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2
          To: GPCP@yahoogroups.com
          Date: Tuesday, October 26, 2010, 1:35 AM

           

          Hi All

          The new distribution of gpm/clr is now up on codeplex.  See

          http://gpmclr.codeplex.com

          I will arrange a notice on the plas.fit website pointing to this new page.

          Enjoy.

          John

           

          From: GPCP@yahoogroups.com [mailto:GPCP@yahoogroups.com] On Behalf Of K John Gough
          Sent: Friday, 22 October 2010 4:27 PM
          To: GPCP@yahoogroups.com
          Subject: RE: [GPCP] [GPM] Question about Gardens Point Modula-2

           

           

          Hi All

           

          For those that are following the GPM thread I have a definitive answer.

          <snip>


        Your message has been successfully submitted and would be delivered to recipients shortly.