xds modula-2 for linux

This is a discussion on xds modula-2 for linux within the modula forums in Programming Languages category; Hi. Is anyone here using xds modula-2 on a linux platform. I have some questions to ask and I was hoping this would be a useful forum. There does not seem to be much traffic here anyway....

Go Back   Application Development Forum > Programming Languages > modula

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 01-18-2008, 08:07 PM
Rob Solomon
Guest
 
Default xds modula-2 for linux

Hi. Is anyone here using xds modula-2 on a linux platform.

I have some questions to ask and I was hoping this would be a useful
forum.

There does not seem to be much traffic here anyway.
Reply With Quote
  #2  
Old 01-19-2008, 10:47 AM
Rob Solomon
Guest
 
Default Re: xds modula-2 for linux

MODULE xdsseqfileio;
IMPORT SeqFile, STextIO, TextIO, SWholeIO, SIOResult, IOConsts;
CONST flags = SeqFile.text + SeqFile.old;
VAR
out,in : SeqFile.ChanId;
res : SeqFile.OpenResults;
i,c : CARDINAL;
str : ARRAY [0..255] OF CHAR;
rdreslt : IOConsts.ReadResults;
BEGIN
SeqFile.OpenWrite(out,"seqfile.txt",flags,res); (* write flag is
implied *)
IF res = SeqFile.opened THEN
FOR i:=0 TO 9 DO
TextIO.WriteString(out,"Hello");
TextIO.WriteLn(out);
END;
SeqFile.Close(out);
STextIO.WriteString(' Open and write successful.');
STextIO.WriteLn;
ELSE
STextIO.WriteString("Open error");
STextIO.WriteLn;
c := ORD(res);
STextIO.WriteString(' res Field result, as a cardinal, is: ');
SWholeIO.WriteCard(c,10);
STextIO.WriteLn;
END;
(*
SeqFile.OpenRead(in,"seqfile.txt",flags,res); (* read flag is implied
*)
IF res = SeqFile.opened THEN
STextIO.WriteString(' Open for Reading successful.');
STextIO.WriteLn;
FOR i:=0 TO 9 DO
TextIO.ReadString(in,str);
TextIO.SkipLine(in);
STextIO.WriteString(str);
STextIO.WriteLn;
END;
SeqFile.Close(in);
STextIO.WriteString(' Fixed Read finished.');
STextIO.WriteLn;
ELSE
STextIO.WriteString("Open error");
STextIO.WriteLn;
c := ORD(res);
STextIO.WriteString(' res Field result, as a cardinal, is: ');
SWholeIO.WriteCard(c,10);
STextIO.WriteLn;
END;
*)
SeqFile.OpenRead(in,"seqfile.txt",flags,res); (* read flag is implied
*)
IF res = SeqFile.opened THEN
STextIO.WriteString(' 2nd open for Reading successful.');
STextIO.WriteLn;
c := 0;
LOOP
TextIO.ReadRestLine(in,str);
STextIO.WriteString(str);
STextIO.WriteLn;
TextIO.SkipLine(in);
rdreslt := SIOResult.ReadResult();
STextIO.WriteString(' SIOResult = ');
i:= ORD(rdreslt);
SWholeIO.WriteCard(i,2);
STextIO.WriteLn;
IF rdreslt <> IOConsts.allRight THEN EXIT END;
INC(c);
IF c>20 THEN EXIT END;
STextIO.WriteString(str);
STextIO.WriteLn;
END;
SeqFile.Close(in);
STextIO.WriteString(' 2nd Read finished.');
STextIO.WriteLn;
STextIO.WriteString(' number of lines is:');
SWholeIO.WriteCard(c,10);
STextIO.WriteLn;
ELSE
STextIO.WriteString("2nd Open status error");
STextIO.WriteLn;
c := ORD(res);
STextIO.WriteString(' res Field result, as a cardinal, is: ');
SWholeIO.WriteCard(c,10);
STextIO.WriteLn;
END;

END xdsseqfileio.


This is a simple test for me to understand how to do simple file i/o in
Linux. I use stony brook for winxp, but I did not get their linux
product before they left the market.

The problem I am having is that the rdresult, variable to store
SIOResult.ReadResult(), is not allRight after the first iteration. I
know the file exists and can be read by the first loop that just reads
10 times. And I can display the file from the command prompt.

I don't know what 2 do now?

Thanks,
Rob
Reply With Quote
  #3  
Old 01-19-2008, 06:53 PM
JP2R
Guest
 
Default Re: xds modula-2 for linux

On 19 jan, 16:47, Rob Solomon <ag...@drrob1.com> wrote:
> MODULE xdsseqfileio;
> IMPORT *SeqFile, STextIO, TextIO, SWholeIO, SIOResult, IOConsts;
> CONST flags = SeqFile.text + SeqFile.old;
> VAR
> * out,in *: SeqFile.ChanId;
> * res * * : SeqFile.OpenResults;
> * i,c * * : CARDINAL;
> * str * * : ARRAY [0..255] OF CHAR;
> * rdreslt : IOConsts.ReadResults;
> BEGIN
> * SeqFile.OpenWrite(out,"seqfile.txt",flags,res); *(* write flag is
> implied *)
> * IF res = SeqFile.opened THEN
> * * FOR i:=0 TO 9 DO
> * * * TextIO.WriteString(out,"Hello");
> * * * TextIO.WriteLn(out);
> * * END;
> * * SeqFile.Close(out);
> * * STextIO.WriteString(' Open and write successful.');
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("Open error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
> (*
> * SeqFile.OpenRead(in,"seqfile.txt",flags,res); *(* read flag is implied
> *)
> * IF res = SeqFile.opened THEN
> * * STextIO.WriteString(' Open for Reading successful.');
> * * STextIO.WriteLn;
> * * FOR i:=0 TO 9 DO
> * * * TextIO.ReadString(in,str);
> * * * TextIO.SkipLine(in);
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * END;
> * * SeqFile.Close(in);
> * * STextIO.WriteString(' Fixed Read finished.');
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("Open error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
> *)
> * SeqFile.OpenRead(in,"seqfile.txt",flags,res); *(* read flag is implied
> *)
> * IF res = SeqFile.opened THEN
> * * STextIO.WriteString(' 2nd open for Reading successful.');
> * * STextIO.WriteLn;
> * * c := 0;
> * * LOOP
> * * * TextIO.ReadRestLine(in,str);
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * * TextIO.SkipLine(in);
> * * * rdreslt := SIOResult.ReadResult();
> * * * STextIO.WriteString(' SIOResult = ');
> * * * i:= ORD(rdreslt);
> * * * SWholeIO.WriteCard(i,2);
> * * * STextIO.WriteLn;
> * * * IF rdreslt <> IOConsts.allRight THEN EXIT END;
> * * * INC(c);
> * * * IF c>20 THEN EXIT END;
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * END;
> * * SeqFile.Close(in);
> * * STextIO.WriteString(' 2nd Read finished.');
> * * STextIO.WriteLn;
> * * STextIO.WriteString(' number of lines is:');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("2nd Open status error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
>
> END xdsseqfileio.
>
> This is a simple test for me to understand how to do simple file i/o in
> Linux. *I use stony brook for winxp, but I did not get their linux
> product before they left the market.
>
> The problem I am having is that the rdresult, variable to store
> SIOResult.ReadResult(), is not allRight after the first iteration. *I
> know the file exists and can be read by the first loop that just reads
> 10 times. *And I can display the file from the command prompt.
>
> I don't know what 2 do now?
>
> Thanks,
> Rob


PROCEDURE OpenWrite (VAR cid: ChanId;
name: ARRAY OF CHAR;
flags: FlagSet;
VAR res: OpenResults);

Here is a partial copy of doc

Module SeqFile
<snipped>
Inclusion of the write flag in the parameter flags is implied.
.... if the read flag is included in the request, the Reread
operation is available.

Copyright © 1999-2000 Excelsior, LLC.


Maybe with read Flag ??
JP2R

Reply With Quote
  #4  
Old 01-20-2008, 11:26 AM
JP2R
Guest
 
Default Re: xds modula-2 for linux

On 19 jan, 16:47, Rob Solomon <ag...@drrob1.com> wrote:
> MODULE xdsseqfileio;
> IMPORT *SeqFile, STextIO, TextIO, SWholeIO, SIOResult, IOConsts;
> CONST flags = SeqFile.text + SeqFile.old;
> VAR
> * out,in *: SeqFile.ChanId;
> * res * * : SeqFile.OpenResults;
> * i,c * * : CARDINAL;
> * str * * : ARRAY [0..255] OF CHAR;
> * rdreslt : IOConsts.ReadResults;
> BEGIN
> * SeqFile.OpenWrite(out,"seqfile.txt",flags,res); *(* write flag is
> implied *)
> * IF res = SeqFile.opened THEN
> * * FOR i:=0 TO 9 DO
> * * * TextIO.WriteString(out,"Hello");
> * * * TextIO.WriteLn(out);
> * * END;
> * * SeqFile.Close(out);
> * * STextIO.WriteString(' Open and write successful.');
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("Open error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
> (*
> * SeqFile.OpenRead(in,"seqfile.txt",flags,res); *(* read flag is implied
> *)
> * IF res = SeqFile.opened THEN
> * * STextIO.WriteString(' Open for Reading successful.');
> * * STextIO.WriteLn;
> * * FOR i:=0 TO 9 DO
> * * * TextIO.ReadString(in,str);
> * * * TextIO.SkipLine(in);
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * END;
> * * SeqFile.Close(in);
> * * STextIO.WriteString(' Fixed Read finished.');
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("Open error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
> *)
> * SeqFile.OpenRead(in,"seqfile.txt",flags,res); *(* read flag is implied
> *)
> * IF res = SeqFile.opened THEN
> * * STextIO.WriteString(' 2nd open for Reading successful.');
> * * STextIO.WriteLn;
> * * c := 0;
> * * LOOP
> * * * TextIO.ReadRestLine(in,str);
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * * TextIO.SkipLine(in);
> * * * rdreslt := SIOResult.ReadResult();
> * * * STextIO.WriteString(' SIOResult = ');
> * * * i:= ORD(rdreslt);
> * * * SWholeIO.WriteCard(i,2);
> * * * STextIO.WriteLn;
> * * * IF rdreslt <> IOConsts.allRight THEN EXIT END;
> * * * INC(c);
> * * * IF c>20 THEN EXIT END;
> * * * STextIO.WriteString(str);
> * * * STextIO.WriteLn;
> * * END;
> * * SeqFile.Close(in);
> * * STextIO.WriteString(' 2nd Read finished.');
> * * STextIO.WriteLn;
> * * STextIO.WriteString(' number of lines is:');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * ELSE
> * * STextIO.WriteString("2nd Open status error");
> * * STextIO.WriteLn;
> * * c := ORD(res);
> * * STextIO.WriteString(' res Field result, as a cardinal, is: ');
> * * SWholeIO.WriteCard(c,10);
> * * STextIO.WriteLn;
> * END;
>
> END xdsseqfileio.
>
> This is a simple test for me to understand how to do simple file i/o in
> Linux. *I use stony brook for winxp, but I did not get their linux
> product before they left the market.
>
> The problem I am having is that the rdresult, variable to store
> SIOResult.ReadResult(), is not allRight after the first iteration. *I
> know the file exists and can be read by the first loop that just reads
> 10 times. *And I can display the file from the command prompt.
>
> I don't know what 2 do now?
>
> Thanks,
> Rob


Hello Bob, just made a cut and paste on XDS windows.
On winXP your pgm compile and works normaly... .
Now I've just toyed with linux systems on the occasion - but I know a
problem is always the rights you have to read / write and do things on
your (own :+) machine. So are you running your program in a directory
where you are alowed to write ?
JPD
Reply With Quote
  #5  
Old 01-20-2008, 05:58 PM
Rob Solomon
Guest
 
Default Re: xds modula-2 for linux

That's funny. I installed the xds windows compiler, and I got the same
result on WinXP as linux; that is, SIOResult.ReadResult did not return a
useful value. On linux, I am compiling from my home directory to avoid
priv problems.

I got around the problem for the example by testing for 0 length string
returned from TextIO.ReadString. This will not work in long term
because it will not distinguish an empty line from endoffile.

SeqFile.OpenRead(in,"seqfile.txt",flags,res);
IF res = SeqFile.opened THEN
STextIO.WriteString(' 2nd open for Reading successful.');
STextIO.WriteLn;
c := 0;
LOOP
TextIO.ReadRestLine(in,str);
rdreslt := SIOResult.ReadResult();<== not working as it should
STextIO.WriteString(str);
STextIO.WriteLn;
TextIO.SkipLine(in);
i:= ORD(rdreslt);
SWholeIO.WriteCard(i,2);
STextIO.WriteLn;
Reply With Quote
  #6  
Old 01-20-2008, 07:53 PM
Rob Solomon
Guest
 
Default Re: xds modula-2 for linux

I found my problem. I was using the wrong procedure to check status. I
needed to use IOResult, not SIOResult.

IMPORT IOResult;

This now works.

Thanks for listening.

> That's funny. I installed the xds windows compiler, and I got the same
> result on WinXP as linux; that is, SIOResult.ReadResult did not return a
> useful value. On linux, I am compiling from my home directory to avoid
> priv problems.
>
> I got around the problem for the example by testing for 0 length string
> returned from TextIO.ReadString. This will not work in long term
> because it will not distinguish an empty line from endoffile.
>
> SeqFile.OpenRead(in,"seqfile.txt",flags,res);
> IF res = SeqFile.opened THEN
> STextIO.WriteString(' 2nd open for Reading successful.');
> STextIO.WriteLn;
> c := 0;
> LOOP
> TextIO.ReadRestLine(in,str);
> rdreslt := SIOResult.ReadResult();<== not working as it should
> STextIO.WriteString(str);
> STextIO.WriteLn;
> TextIO.SkipLine(in);
> i:= ORD(rdreslt);
> SWholeIO.WriteCard(i,2);
> STextIO.WriteLn;
>

Reply With Quote
  #7  
Old 01-21-2008, 10:43 AM
john o goyo
Guest
 
Default Re: xds modula-2 for linux

Rob Solomon wrote:
> Hi. Is anyone here using xds modula-2 on a linux platform.
>
> I have some questions to ask and I was hoping this would be a useful
> forum.


Excelsior also has a forum specific to their compilers at
http://www.excelsior-usa.com/forum/index.php?board=6.0

john

>
> There does not seem to be much traffic here anyway.

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:05 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.