Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Basic Questions

1 view
Skip to first unread message

carm...@yahoo.com

unread,
Apr 5, 2008, 5:04:46 PM4/5/08
to
Hi,

I am newbie to Modula2 trying to compile some legacy code that I am
told worked with Top Speed Modula 2. Right now I am trying to use the
XDS Compiler. I have two basic questions that I think may not be
compiler specific (or may be not):

1. Does it matter if you break up a Procedure definition on to
separate lines?

i.e. is

PROCEDURE vertab (VAR a,b,c:CARDINAL;VAR rowstart:ListPoint;VAR
inf:File);

And

PROCEDURE vertab(VAR a,b,c:CARDINAL;
VAR rowstart:ListPoint;
VAR inf:File);

The same?? I know in C and many other languages this does not matter.

I am asking this question because I have the Procedure definition in
the "*.def" file exactly the same as what I have in the "*.mod" file -
and it complains saying "procedure "vertab" does not match previous
definition" I don't know what the error is? I copied and pasted one to
the other just to make sure - still I get nothing.


2. Is there some module or package called "FIO" and how do I find out
what it contains?

I have a line like

FROM FIO IMPORT Create, Open, File, Close, WrStr, WrLn, WrLngCard,

In a "*.def" file but later in that file it tells me that "File" is
not defined.

Actually these errors may be related because this error comes from the
"VAR inf:File" in the procedure definition mentioned above.

Any ideas?

Thanks a lot for the help,
O.O.

Marco van de Voort

unread,
Apr 6, 2008, 5:22:34 AM4/6/08
to
On 2008-04-05, carm...@yahoo.com <carm...@yahoo.com> wrote:
> 1. Does it matter if you break up a Procedure definition on to
> separate lines?

No. The example you give is perfectly valid.

> I am asking this question because I have the Procedure definition in
> the "*.def" file exactly the same as what I have in the "*.mod" file -
> and it complains saying "procedure "vertab" does not match previous
> definition" I don't know what the error is? I copied and pasted one to
> the other just to make sure - still I get nothing.

Typically that means that one of the types are defined differently, either
in the .def _after_ the declaration or by one of the modules imported in the
implementation.

> 2. Is there some module or package called "FIO" and how do I find out
> what it contains?

I've no XDS experience, so I can't really answer this.

Maybe file is already defined in "IO" and not reexported in FIO?

JP2R

unread,
Apr 6, 2008, 5:40:23 AM4/6/08
to
On 6 avr, 11:22, Marco van de Voort <mar...@stack.nl> wrote:

Q1 - check if
1 - reference / value parameters declarations are the same (ie VAR
xx: type versus xx: type)
2 - if parameters names are the same (XDS doesn't like that)
Q2 - IO and FIO modules are modules of topspeed RTL with XDS you'll
probably need the TS compatybility pack to compile that downloadable
from XDS site.

Regards JPRR

Marco van de Voort

unread,
Apr 6, 2008, 6:46:13 AM4/6/08
to
On 2008-04-06, JP2R <jp.de...@orange.fr> wrote:
>
> Q1 - check if
> 1 - reference / value parameters declarations are the same (ie VAR
> xx: type versus xx: type)
> 2 - if parameters names are the same (XDS doesn't like that)


> Q2 - IO and FIO modules are modules of topspeed RTL with XDS you'll
> probably need the TS compatybility pack to compile that downloadable
> from XDS site.


OP:


>>> I have a line like

>>>FROM FIO IMPORT Create, Open, File, Close, WrStr, WrLn, WrLngCard,

>>>In a "*.def" file but later in that file it tells me that "File" is
>>>not defined.

Which leads me to conclude that FIO (and thus TS-pack) _is_ installed.

O. Olson

unread,
Apr 6, 2008, 11:53:32 AM4/6/08
to
On Apr 6, 3:22 am, Marco van de Voort <mar...@stack.nl> wrote:
> No. The example you give is perfectly valid.
>
> Typically that means that one of the types are defined differently, either
> in the .def _after_ the declaration or by one of the modules imported in the
> implementation.
>

Thanks Marco for clarifying this. This means I have a problem that is
complier specific that I would post to the XDS Forums.

I don't know what I am doing wrong - because I have copied the
Procedure declaration from the DEF File to the MOD File to ensure that
they are the same. I have also searched in each of the remaining file
to ensure that this procedure is not re-declared.

Thanks again for the post.
O.O.


O. Olson

unread,
Apr 6, 2008, 11:59:53 AM4/6/08
to
Thanks JPR2.

On Apr 6, 3:40 am, JP2R <jp.deza...@orange.fr> wrote:
>
> Q1 - check if
> 1 - reference / value parameters declarations are the same (ie VAR
> xx: type versus xx: type)

I have checked this i.e. copied the entire procedure declaration from
the DEF File to the MOD File. I have also removed all the other MOD
Files except the one that I want to start compiling from the directory
so that XDS would not be able to find them. (Their corresponding DEF
files are there though.) I then went through the DEF Files to ensure
that the Procedure was declared only once.

> 2 - if parameters names are the same (XDS doesn't like that)

I have copied and pasted this - so I think this should be the same.

> Q2 - IO and FIO modules are modules of topspeed RTL with XDS you'll
> probably need the TS compatybility pack to compile that downloadable
> from XDS site.
>

I have installed this Compatibility Pack. Before I did that - I got a
lot more errors than what I get now.


> Regards JPRR

Thanks for posting
O.O.

O. Olson

unread,
Apr 6, 2008, 12:01:34 PM4/6/08
to
On Apr 6, 4:46 am, Marco van de Voort <mar...@stack.nl> wrote:
> Which leads me to conclude that FIO (and thus TS-pack) _is_ installed.

Thanks for clarifying this. Yes, the TopSpeed Pack has been installed
- but if there is some magical way to enable it then I am not doing
that. Right now I am assuming that it gets enabled by default.
O.O.


JP2R

unread,
Apr 6, 2008, 1:28:42 PM4/6/08
to

As Marco said you the 'PROCEDURE vertab...' exemple you gave is
perfectly valid.
Now ... just two sily questions, and you have probably checked that
before...
- Do you have another FIO | IO file on your hard disk (from an other
M2 compiler RTL)
- more likely to happen ... Procedure names of IO and FIO are the same
(WrLn, WrCard etc)
but parameters are NOT (in IO the File param is always implied)- maybe
check from which module TYPES identifiers are imported (File)
- TopSpeed was never an ISO compiler where XDS is,
JPRR

Martin Whitaker

unread,
Apr 6, 2008, 2:52:17 PM4/6/08
to
I think you've misunderstood Marco's point. Consider the following example:

DEFINITION MODULE x;

FROM y IMPORT File;

PROCEDURE DoSomething(f:File);

END x.

IMPLEMENTATION MODULE x;

FROM z IMPORT File;

PROCEDURE DoSomething(f:File);
BEGIN
END DoSomething;

END x.

The compiler would reject this unless y.File and z.File are aliases to the same
type. Be aware that Modula-2 matches types by name, not by structure, e.g. if
both y and z contained type definitions like:

TYPE File = RECORD
Name : ARRAY [0..127] OF CHAR;
Handle : CARDINAL
END;

y.File and z.File would be treated as different types, even though they are
structurally identical.

Hope this helps,

Martin

O. Olson

unread,
Apr 7, 2008, 1:06:23 AM4/7/08
to
On Apr 6, 12:52 pm, Martin Whitaker <spamt...@martin-whitaker.me.uk>
wrote:

> I think you've misunderstood Marco's point. Consider the following example:
>
> DEFINITION MODULE x;
>
> FROM y IMPORT File;
>
> PROCEDURE DoSomething(f:File);
>
> END x.
>
> IMPLEMENTATION MODULE x;
>
> FROM z IMPORT File;
>
> PROCEDURE DoSomething(f:File);
> BEGIN
> END DoSomething;
>
> END x.
>
> The compiler would reject this unless y.File and z.File are aliases to the same
> type. Be aware that Modula-2 matches types by name, not by structure, e.g. if
> both y and z contained type definitions like:
>
> TYPE File = RECORD
> Name : ARRAY [0..127] OF CHAR;
> Handle : CARDINAL
> END;
>
> y.File and z.File would be treated as different types, even though they are
> structurally identical.
>
> Hope this helps,
>
> Martin

Dear Martin,

Very, Very, Very, Good Point. This I did not expect - though I am yet
not sure if it is the error - but it is a good point to start out.

I have in the DEF File

FROM FIO IMPORT Create, Open, File, Close, WrStr, WrLn, WrLngCard,

WrCard;

And in the MOD file simply

IMPORT IO;

There is no where in the MOD File where it explicitly says IMPORT File
- like it does in the DEF.

This may explain why I might be getting an error in functions that
use" File" . While all the functions that give the error of not
matching the previous declaration have "File" as one of the parameters
- there are a few functions that use "File" - but yet do not give the
error.

I would check this out tomorrow.
Thanks for the tip.
O.O.

Jürgen Lerch

unread,
Apr 7, 2008, 3:01:16 AM4/7/08
to
Saluton!

On Sun, 6 Apr 2008 22:06:23 -0700 (PDT), "O. Olson" wrote:
> I have in the DEF File
> FROM FIO IMPORT Create, Open, File, Close, WrStr, WrLn, WrLngCard,
> WrCard;
> And in the MOD file simply
> IMPORT IO;
> There is no where in the MOD File where it explicitly says IMPORT File
> - like it does in the DEF.
> This may explain why I might be getting an error in functions that
> use" File" . While all the functions that give the error of not
> matching the previous declaration have "File" as one of the parameters
> - there are a few functions that use "File" - but yet do not give the
> error.

Hm, if the .mod has ,,IMPORT IO'', shouldn't the usage be
,,IO.File'' instead of merely ,,File''?

Ad Astra!
JuL

--
jyn...@gmx.de / Work like you don't need the money
Jürgen ,,JuL'' Lerch / Dance like no one was watching
/ Love like you've never been hurt
/ - ?

JP2R

unread,
Apr 7, 2008, 4:32:24 AM4/7/08
to
> I have in the DEF File
>
> FROM FIO IMPORT Create, Open, File, Close, WrStr, WrLn, WrLngCard,
>                 WrCard;
>
> And in the MOD file simply
>
> IMPORT IO;
>
> There is no where in the MOD File where it explicitly says IMPORT File
> - like it does in the DEF.


I think you got it ....
With XDS and ISO compilers you need the very same 'File' IMPORT clause
in the MOD
And yes Martin message points something very important.
JPRR

Marco van de Voort

unread,
Apr 7, 2008, 6:37:52 AM4/7/08
to

No. Import xx; imports qualified only?

It would have to read

FROM IO IMPORT File;

to cause problems.

JP2R

unread,
Apr 7, 2008, 7:13:19 AM4/7/08
to
On Apr 7, 12:37 pm, Marco van de Voort <mar...@stack.nl> wrote:

IMPORT xx imports QUALIFIED idents only
FROM xx IMPORT yy imports yy UNQUALIFIED
AND imports made in DEF is NOT known in MOD and you get an error with
XDS compiler
BUT with Topspeed this will compile ...

DEFINITION MODULE x;
FROM FIO IMPORT WrLn, File;
PROCEDURE Y (f: File);
END x.

------------------
IMPLEMENTATION MODULE x

PROCEDURE Y (f: File);
BEGIN
WrLn(f)
END Y;
END x.

Marco van de Voort

unread,
Apr 7, 2008, 3:17:02 PM4/7/08
to
On 2008-04-07, JP2R <jp.de...@orange.fr> wrote:
>> No. Import xx; imports qualified only?
>>
>> It would have to read
>>
>> FROM IO IMPORT File;
>>
>> to cause problems.
>
> IMPORT xx imports QUALIFIED idents only
> FROM xx IMPORT yy imports yy UNQUALIFIED
> AND imports made in DEF is NOT known in MOD and you get an error with
> XDS compiler

Huh? Is that conforming to the standard?

JP2R

unread,
Apr 7, 2008, 3:55:08 PM4/7/08
to
On Apr 7, 9:17 pm, Marco van de Voort <mar...@stack.nl> wrote:

Well I never read directly ISO standards texts (far too expensive),
but from documents I could read I think that it's Topspeed that is NOT
standard (and far from) - anyway at this time there was not yet a
standard, apart the de facto topspeed one in the PC/MSDOS world.
XDS has a good documentation of ISO language on his site - and as I
understand it each ident must be introduced in the module scope either
by a definition, a declaration or an IMPORT ... and a DEF module is
distinct of the matching implementation.

O. Olson

unread,
Apr 8, 2008, 7:14:44 PM4/8/08
to
Thanks to all of you for posting.

I think I managed to figure this out by copying the Import statement
from the DEF File to the MOD File. Now the error goes away - but my
file still has other errors to deal with - so I am not entirely sure
if this worked or not.

Thanks again.
O.O.


0 new messages