| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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. |
|
#2
| |||
| |||
| On 2008-04-05, carmaski@yahoo.com <carmaski@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? |
|
#3
| |||
| |||
| On 6 avr, 11:22, Marco van de Voort <mar...@stack.nl> wrote: > On 2008-04-05, carma...@yahoo.com <carma...@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? 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 |
|
#4
| |||
| |||
| On 2008-04-06, JP2R <jp.dezaire@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. |
|
#5
| |||
| |||
| 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. |
|
#6
| |||
| |||
| 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. |
|
#7
| |||
| |||
| 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. |
|
#8
| |||
| |||
| On Apr 6, 5:59 pm, "O. Olson" <olson_...@yahoo.it> wrote: > 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. 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 |
|
#9
| |||
| |||
| O. Olson wrote: > 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. > 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 |
|
#10
| |||
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.