gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] WriteCard and SYSTEM.CARDINAL8


From: Gaius Mulley
Subject: Re: [Gm2] WriteCard and SYSTEM.CARDINAL8
Date: Wed, 16 Dec 2009 01:24:32 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Martin Kalbfuß <address@hidden> writes:

> Hi,
>
> I have the following procedure and record
>
> Version = RECORD
>       major : SYSTEM.CARDINAL8;
>       minor : SYSTEM.CARDINAL8;
>       patch : SYSTEM.CARDINAL8;
> END;
>
> PROCEDURE LinkedSKVersion(): Version;
> VAR version : Version;
> BEGIN
>         version.major := SK_MAJOR;
>         version.minor := SK_MINOR;
>         version.patch := SK_PATCH;     
> RETURN version;
> END LinkedSKVersion;
>
> I wrote an example to test this procedure:
>
> MODULE version;
>
> IMPORT SKGeneral;
> IMPORT STextIO;
> IMPORT SWholeIO;
>
> VAR SKVersion : SKGeneral.Version;
> BEGIN
>      SKVersion := SKGeneral.LinkedSKVersion(); 
>      
>      STextIO.WriteString('SK version is: ');
>      SWholeIO.WriteCard(SKVersion.major, 1);
>      STextIO.WriteString('.');
>      SWholeIO.WriteCard(SKVersion.minor, 1);
>      STextIO.WriteString('.');
>      SWholeIO.WriteCard(SKVersion.patch, 1);
>      STextIO.WriteLn();
>
> END version.
>
>
> I get 
>
> SK version is: 134654208.134654209.134654208
>
> Definitely not the version number. Can't I write CARDINAL8 with
> WriteCard?
>
> I checked SK_MAJOR, SK_MINOR, SK_PATCH. They are correct.
>
> Thanks,

Hi Martin,

I've written some test code:

MODULE tinycardio ;

IMPORT SWholeIO, SYSTEM, STextIO ;

VAR
   c: SYSTEM.CARDINAL8 ;
BEGIN
   c := 8 ;
   SWholeIO.WriteCard(c, 1); STextIO.WriteLn
END tinycardio.

which works.  I suspect the bug above is to do with returning
a record structure.  I'll check this..

regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]