• Topspeed Modules in XDS Compiler - bugs?

    From jd63@21:1/5 to All on Fri Oct 22 07:11:32 2021
    This concerns the Linux version only (native compiler). Version 2.60 from github. The code uses the RANDOMIZE and RANDOM functions from the Lib module, and WrLn from IO. Compiled with "xc -topspeed+ =m randtest.mod".

    MODULE randtest;
    IMPORT IO,Lib;
    VAR roll,i: CARDINAL;
    BEGIN
    Lib.RANDOMIZE;
    FOR i:=1 TO 6 DO
    roll:=Lib.RANDOM(6)+1;
    IO.WrCard(roll,1);
    IO.WrLn;
    END;
    END randtest.

    Firstly, RANDOMIZE doesn't work because on each run the numbers are the same, and secondly, carriage return isn't working in WrLn because on successive new lines the numbers are cumulatively offset by 1 space.

    The Win32 version of the compiler (using Wine) produces the expected correct output (no offsets and different numbers each time).

    I haven't raised this issue yet on github because I first wanted to see if there are any other XDS users getting the same behaviour.

    Thanks!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Brown@21:1/5 to All on Sat Oct 23 09:05:05 2021
    On 22/10/2021 15:11, jd63 wrote:
    This concerns the Linux version only (native compiler). Version 2.60 from github. The code uses the RANDOMIZE and RANDOM functions from the Lib module, and WrLn from IO. Compiled with "xc -topspeed+ =m randtest.mod".

    MODULE randtest;
    IMPORT IO,Lib;
    VAR roll,i: CARDINAL;
    BEGIN
    Lib.RANDOMIZE;
    FOR i:=1 TO 6 DO
    roll:=Lib.RANDOM(6)+1;
    IO.WrCard(roll,1);
    IO.WrLn;
    END;
    END randtest.

    Firstly, RANDOMIZE doesn't work because on each run the numbers are the same, and secondly, carriage return isn't working in WrLn because on successive new lines the numbers are cumulatively offset by 1 space.

    The Win32 version of the compiler (using Wine) produces the expected correct output (no offsets and different numbers each time).

    I have never seen that problem with the Windows version. I'd hazard a
    guess that it gets a fixed answer for system time under Linux for some
    reason. Can you set an explicit starting seed successfully?

    You may have to inspect the generated code in a debugger to find out
    what is going on here. I suspect IO.WrLn is still DOSian <cr><lf>.

    I haven't raised this issue yet on github because I first wanted to see if there are any other XDS users getting the same behaviour.

    Thanks!

    I don't think there are many people still using it now.
    (I could be wrong)

    --
    Regards,
    Martin Brown

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jd63@21:1/5 to Martin Brown on Sat Oct 23 06:50:48 2021
    On Saturday, October 23, 2021 at 9:05:09 AM UTC+1, Martin Brown wrote:
    On 22/10/2021 15:11, jd63 wrote:
    This concerns the Linux version only (native compiler). Version 2.60 from github. The code uses the RANDOMIZE and RANDOM functions from the Lib module, and WrLn from IO. Compiled with "xc -topspeed+ =m randtest.mod".

    MODULE randtest;
    IMPORT IO,Lib;
    VAR roll,i: CARDINAL;
    BEGIN
    Lib.RANDOMIZE;
    FOR i:=1 TO 6 DO
    roll:=Lib.RANDOM(6)+1;
    IO.WrCard(roll,1);
    IO.WrLn;
    END;
    END randtest.

    Firstly, RANDOMIZE doesn't work because on each run the numbers are the same, and secondly, carriage return isn't working in WrLn because on successive new lines the numbers are cumulatively offset by 1 space.

    The Win32 version of the compiler (using Wine) produces the expected correct output (no offsets and different numbers each time).
    I have never seen that problem with the Windows version. I'd hazard a
    guess that it gets a fixed answer for system time under Linux for some reason. Can you set an explicit starting seed successfully?

    You may have to inspect the generated code in a debugger to find out
    what is going on here. I suspect IO.WrLn is still DOSian <cr><lf>.
    I haven't raised this issue yet on github because I first wanted to see if there are any other XDS users getting the same behaviour.

    Thanks!
    I don't think there are many people still using it now.
    (I could be wrong)

    --
    Regards,
    Martin Brown

    Thanks for the reply. I suspect your educated guesses are correct. I've had no problems with the Windows compiler TS modules, and I've made another module for random numbers which works on Linux. Cheers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nemo@21:1/5 to Martin Brown on Sat Oct 23 10:06:31 2021
    On 2021-10-23 04:05, Martin Brown wrote:
    On 22/10/2021 15:11, jd63 wrote:
    This concerns the Linux version only (native compiler). Version 2.60
    from github. The code uses the RANDOMIZE and RANDOM functions from the
    Lib module, and WrLn from IO. Compiled with "xc -topspeed+ =m
    randtest.mod".

    MODULE randtest;
    IMPORT IO,Lib;
    VAR roll,i: CARDINAL;
    BEGIN
       Lib.RANDOMIZE;
       FOR i:=1 TO 6 DO
         roll:=Lib.RANDOM(6)+1;
         IO.WrCard(roll,1);
         IO.WrLn;
       END;
    END randtest.

    Firstly, RANDOMIZE doesn't work because on each run the numbers are
    the same, and secondly, carriage return isn't working in WrLn because
    on successive new lines the numbers are cumulatively offset by 1 space.

    The Win32 version of the compiler (using Wine) produces the expected
    correct output (no offsets and different numbers each time).

    I have never seen that problem with the Windows version. I'd hazard a
    guess that it gets a fixed answer for system time under Linux for some reason. Can you set an explicit starting seed successfully?

    I have never used the Windows version but I used the OS/2 and Linux
    versions extensively. I never had problems with RANDOMIZE/RANDDOM().

    You may have to inspect the generated code in a debugger to find out
    what is going on here.

    On top of Martin's good advice, I would look at the source of Lib.mod (https://github.com/excelsior-oss/xds/blob/cfd20e209193c9cfcee94ad2ca30d8c32ead48c9/Sources/Lib/src/TSlibs/Lib.mod).
    As Martin guessed, it seeds with the system clock and then does a bit
    of shuffling.

    I suspect IO.WrLn is still DOSian <cr><lf>.

    I never found that using it under Linux. IO.mod (https://github.com/excelsior-oss/xds/blob/master/Sources/Lib/src/TSlibs/IO.mod)
    is implemented with the ISO libs.


    I haven't raised this issue yet on github because I first wanted to
    see if there are any other XDS users getting the same behaviour.

    Thanks!

    I don't think there are many people still using it now.
    (I could be wrong)

    One never knows, Martin. #6-)

    N.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brian Knoblauch@21:1/5 to All on Sun Oct 24 05:42:17 2021
    On Friday, October 22, 2021 at 10:11:33 AM UTC-4, jd63 wrote:
    I haven't raised this issue yet on github because I first wanted to see if there are any other XDS users getting the same behaviour.

    I'm an XDS user, but only Windows. I wouldn't mind spinning up a GNU/Linux VM and giving it a try, but am swamped with work at the moment so won't be able to do it anytime real soon.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)