gm2
[Top][All Lists]
Advanced

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

[Gm2] more LONGINT/LONGCARD


From: John B. Wallace, Jr.
Subject: [Gm2] more LONGINT/LONGCARD
Date: Thu, 30 Dec 2004 20:59:55 -0500

I extended the program I used for testing the INTEGER to LONGINT (and
CARDINAL to LONGCARD) parameter passing problem/question and got some
interesting results: Constants work correctly, after which variables
work correctly?


MODULE TestLongParam;

(***************************************************************)
(*    IMPORTANT: THIS IS TEST CODE AND MAY BE INCORRECT        *)
(***************************************************************)

FROM StrIO IMPORT WriteLn;

FROM FpuIO IMPORT WriteLongInt;

VAR
  Int  : INTEGER;
  Card : CARDINAL;

PROCEDURE LongIntParameter ( LongInt : LONGINT );
  BEGIN
    WriteLongInt(LongInt,0);
    WriteLn
  END LongIntParameter;

PROCEDURE LongCardParameter ( LongCard : LONGCARD );
  BEGIN
    (* I could not find a WriteLongCard procedure in the gm2 libraries *)
    WriteLongInt(LongCard,0);
    WriteLn
  END LongCardParameter;

BEGIN
  Int := -1000;
  LongIntParameter(Int);
  WriteLn;
  LongIntParameter(-12345);
  WriteLn;
  Int := -12;
  LongIntParameter(Int);
  WriteLn;
  Int := -50000;
  LongIntParameter(Int);
  WriteLn;
  Card := 100000;
  LongCardParameter(Card);
  WriteLn;
  LongCardParameter(12345678);
  WriteLn;
  Card := 12345;
  LongCardParameter(Card);
  WriteLn;
  Card := 55;
  LongCardParameter(Card);
  WriteLn
END TestLongParam.


On my system (Linux/i586) this is the output:

438086663192
 
-12345
 
-12
 
-50000
 
-4294867296
 
12345678
 
12345
 
55
 


Also, I want to repeat, at this point I have NOT found any problems
with LONGINT or LONGCARD assignment or constants in the 2004/12/22
release. The parameter passing problem above is an old problem.


John Wallace





reply via email to

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