Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Output Formatting

Output for type OCTET

OCTET Numerals:                 |012345678901234567890|
WRITE(03FH);                  => 3F
WRITEF("x", 03FH);            => 0x3F
WRITEF("H", 03FH);            => 03FH
WRITEF("B", 03FH);            => 00111111B

NB: The size of type OCTET is guaranteed to be eight bits.

Output for type BYTE

8-bit BYTE Numerals:            |012345678901234567890|
WRITE(03FH);                  => 3F
WRITEF("x", 03FH);            => 0x3F
WRITEF("H", 03FH);            => 03FH
WRITEF("B", 03FH);            => 00111111B

NB: The size of type BYTE may not be eight bits.

Output for type WORD

32-bit WORD Numerals:           |012345678901234567890|
WRITE(017AE003FH);            => 17AE003F
WRITEF("_4", 017AE003FH);     => 17AE 003F
WRITEF(".4", 017AE003FH);     => 17AE.003F
WRITEF("_2", 017AE003FH);     => 17 AE 00 3F
WRITEF(".2", 017AE003FH);     => 17.AE.00.3F

NB: The size of type WORD may not be 32 bits.

Output for type ADDRESS

64-bit ADDRESS Numerals:        |0123456789012345678|
WRITE(0DEADBEEFH);            => 00000000DEADBEEF
WRITEF("_8", 0DEADBEEFH);     => 00000000 DEADBEEF
WRITEF(":8", 0DEADBEEFH);     => 00000000:DEADBEEF
WRITEF(".4", 0DEADBEEFH);     => 0000.0000.DEAD.BEEF

NB: The size of type ADDRESS may not be 64 bits.

Output for type BITSET

Bitset Values:                  |0123456789012345678|
WRITE(03FH); (*8-bit BITSET*) => {00111111}
WRITEF("_4", 03FH);           => { 0011 1111 }
WRITEF(".4", 03FH);           => { 0011.1111 }
WRITEF(":4", 03FH);           => { 0011:1111 }

NB: Output will always show all bits

Output for type BOOLEAN

Boolean Values:                 |012345678901234567890|
WRITE(TRUE);                  => TRUE
WRITE(FALSE);                 => FALSE
WRITEF("Y", TRUE);            => YES
WRITEF("Y", FALSE);           => NO

Output for types CHAR and UNICHAR

WRITE("A");                   => A
WRITEF("Q" ,"A");             => 'A'
WRITEF("D" ,"A");             => "A"

Output for ARRAY OF CHAR and ARRAY OF UNICHAR

Character Strings:              |0123456789012345678|
WRITE("foobar");              => foobar
WRITEF("Q", "foobar");        => 'foobar'
WRITEF("D", "foobar");        => "foobar"

Output for types CARDINAL and LONGCARD

Unsigned Whole Numerals:        |0123456789012345678|
WRITE(12345);                 => 12345
WRITEF("8;", 12345);          =>    12,345
WRITEF("*8;", 12345);         => ***12,345
WRITEF("H8", 12345);          => 00003039H

Output for types INTEGER and LONGINT

Signed Whole Numerals:           |0123456789012345678|
WRITE(12345);                 =>  12345
WRITE(-12345);                => -12345
WRITEF("8;", -12345);         => -   12,345
WRITEF("*8;", -12345);        => -***12,345
WRITEF("H8", -12345);         => 0000CFC7H

Output for types REAL, LONGREAL, BCD and LONGBCD

Real Numerals:                   |0123456789012345678|
WRITE(12345.67);              =>  1.234567000E+04
WRITE(-12345.67);             => -1.234567000E+04
WRITEF("8.5;", -12345.67);    => -   12,345.67000
WRITEF("8.2;", -12345.67);    => -   12,345.67
WRITEF("*8.2;", -12345.67);   => -***12,345.67
WRITEF("2.6;E", -12345.67);   => -12.345,670E+03