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.
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?
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
> 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.
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.
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.
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.
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
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.
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
/ - ?
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
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
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.
Huh? Is that conforming to the standard?
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.
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.