Skip to content

Instantly share code, notes, and snippets.

@deadmarshal
Created December 1, 2023 08:53
Show Gist options
  • Save deadmarshal/4a8eee8d65bcaec96f06fc13191c8ef1 to your computer and use it in GitHub Desktop.
Save deadmarshal/4a8eee8d65bcaec96f06fc13191c8ef1 to your computer and use it in GitHub Desktop.
MODULE BasicTypes EXPORTS Main;
IMPORT IO;
PROCEDURE RepeatChar(READONLY C:CHAR;READONLY Start,End:CARDINAL) =
BEGIN
FOR I := Start TO End DO IO.PutChar(C) END;
IO.Put("\n")
END RepeatChar;
BEGIN
IO.Put("BYTESIZE(CHAR): "); IO.PutInt(BYTESIZE(CHAR)); IO.Put("\n");
IO.Put("BITSIZE(CHAR): "); IO.PutInt(BITSIZE(CHAR)); IO.Put("\n");
IO.Put("ADRSIZE(CHAR): "); IO.PutInt(ADRSIZE(CHAR)); IO.Put("\n");
IO.Put("FIRST(CHAR): "); IO.PutInt(ORD(FIRST(CHAR)));
IO.Put(" LAST(CHAR): "); IO.PutInt(ORD(LAST(CHAR))); IO.Put("\n");
RepeatChar('-',0,79);
IO.Put("BYTESIZE(WIDECHAR): "); IO.PutInt(BYTESIZE(WIDECHAR)); IO.Put("\n");
IO.Put("BITSIZE(WIDECHAR): "); IO.PutInt(BITSIZE(WIDECHAR)); IO.Put("\n");
IO.Put("ADRSIZE(WIDECHAR): "); IO.PutInt(ADRSIZE(WIDECHAR)); IO.Put("\n");
IO.Put("FIRST(WIDECHAR): "); IO.PutInt(ORD(FIRST(WIDECHAR)));
IO.Put(" LAST(WIDECHAR): "); IO.PutInt(ORD(LAST(WIDECHAR))); IO.Put("\n");
RepeatChar('-',0,79);
IO.Put("BYTESIZE(INTEGER): "); IO.PutInt(BYTESIZE(INTEGER)); IO.Put("\n");
IO.Put("BITSIZE(INTEGER): "); IO.PutInt(BITSIZE(INTEGER)); IO.Put("\n");
IO.Put("ADRSIZE(INTEGER): "); IO.PutInt(ADRSIZE(INTEGER)); IO.Put("\n");
IO.Put("FIRST(INTEGER): "); IO.PutInt(FIRST(INTEGER));
IO.Put(" LAST(INTEGER): "); IO.PutInt(LAST(INTEGER)); IO.Put("\n");
RepeatChar('-',0,79);
IO.Put("BYTESIZE(LONGINT): "); IO.PutInt(BYTESIZE(LONGINT)); IO.Put("\n");
IO.Put("BITSIZE(LONGINT): "); IO.PutInt(BITSIZE(LONGINT)); IO.Put("\n");
IO.Put("ADRSIZE(LONGINT): "); IO.PutInt(ADRSIZE(LONGINT)); IO.Put("\n");
IO.Put("FIRST(LONGINT): "); IO.PutLongInt(ORD(FIRST(LONGINT)));
IO.Put(" LAST(LONGINT): "); IO.PutLongInt(ORD(LAST(LONGINT))); IO.Put("\n");
RepeatChar('-',0,79);
IO.Put("BYTESIZE(CARDINAL): "); IO.PutInt(BYTESIZE(CARDINAL)); IO.Put("\n");
IO.Put("BITSIZE(CARDINAL): "); IO.PutInt(BITSIZE(CARDINAL)); IO.Put("\n");
IO.Put("ADRSIZE(CARDINAL): "); IO.PutInt(ADRSIZE(CARDINAL)); IO.Put("\n");
IO.Put("FIRST(CARDINAL): "); IO.PutInt(FIRST(CARDINAL));
IO.Put(" LAST(CARDINAL): "); IO.PutInt(LAST(CARDINAL)); IO.Put("\n");
END BasicTypes.
(*
BYTESIZE(CHAR): 1
BITSIZE(CHAR): 8
ADRSIZE(CHAR): 1
FIRST(CHAR): 0 LAST(CHAR): 255
--------------------------------------------------------------------------------
BYTESIZE(WIDECHAR): 2
BITSIZE(WIDECHAR): 16
ADRSIZE(WIDECHAR): 2
FIRST(WIDECHAR): 0 LAST(WIDECHAR): 65535
--------------------------------------------------------------------------------
BYTESIZE(INTEGER): 8
BITSIZE(INTEGER): 64
ADRSIZE(INTEGER): 8
FIRST(INTEGER): -9223372036854775808 LAST(INTEGER): 9223372036854775807
--------------------------------------------------------------------------------
BYTESIZE(LONGINT): 8
BITSIZE(LONGINT): 64
ADRSIZE(LONGINT): 8
FIRST(LONGINT): -9223372036854775808 LAST(LONGINT): 9223372036854775807
--------------------------------------------------------------------------------
BYTESIZE(CARDINAL): 8
BITSIZE(CARDINAL): 64
ADRSIZE(CARDINAL): 8
FIRST(CARDINAL): 0 LAST(CARDINAL): 9223372036854775807
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment