Jump to content
Excelsior Forums

Topspeed Convert 2 errors not understood[SOLVED]

Recommended Posts

I am trying to convert some Topsped M2 library modules to XDS
I have only just started using XDS and I am running into problems.

I am having a problem understanding the following two errors.
The code is as follows

[ CODE ]   (* This bit is Ok,  for Info only *)
  MenuDefnPtr = POINTER TO MenuDefn;

  MenuDefn = RECORD
   MenuProc : PROC;         (* Proc. to use while waiting for a responce *)
   (* Other bits of code *)
[ END CODE ]     (* No problem here *)

When a Menu is displayed and awaits a key press, if Menu Proc has been
allocated a procedure of type PROC the procedure will be called. and
will return to the Menu on completion or a Key press.

PROCEDURE SetMenuProc( MenuPtrs : Menu; NewProc : PROC );
this is set to NULLPROC when not required.   (* in Topspeed *)
   MenuProc := NULLPROC;

I changed NULLPROC to NIL but neither works.
* [./p0/src/Menus.mod 556.19 E029]
* incompatible types:
    "PROCEDURE [Modula] ()"
    MenuProc      $:= NULLPROC;
[ END Original ]

* [./p0/src/Menus.mod 556.19 E029]
* incompatible types:
    "PROCEDURE [Modula] ()"
    MenuProc      $:= NIL;      
[ END Changed ]


Another Error that I cannot understand.

* [./p0/src/Menus.mod 412.28 W325]
* possible ambiguity; two-char array passed
    PosTilde  := Pos( Name,$'~' );

How can '~' be a two char array, I believe CHAR is One Byte.

Any help to resolve these two problems would be most welcome.

Dave P..


Share this post

Link to post
Share on other sites

Hi Dave,

Please turn on "M2EXTENSIONS" option to solve the problem with type compatibility.

MODULE MyModule; 

in the command line

xc MyModule.mod +m2extensions  

or in the xc.cfg file.

M2EXTENSIONS - enable Modula-2 extensions
If the option is set ON, the compiler allows XDS Modula-2 language extensions, 
such as line comment ("--"), read-only parameters, etc., to be used in the source code.

As an alternative you can use type cast

   MenuProc := SYSTEM.CAST(PROC, NIL);

As regards to the second problem, I should see the prototype of "Pos" function to give an advice. 

With best regards,

Share this post

Link to post
Share on other sites

Many thanks for the reply Konstantin, its a great help.

Your advice has got me over the first problem,

I found the Topspeed  info for Pos  it takes an array of Char, also found info for CharPos which does the same only it takes a Char. So the 2nd problem solved.

Dave P..

Edited by DavePritchard
Extra problem Solved

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now