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 Using Different IO Procedure Signatures

Output for type BYTE

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

output should always show the full number of digits required by MAX(BYTE)

Output for type WORD

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

output should always show the full number of digits required by MAX(WORD)

Output for type ADDRESS

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

output should always show the full number of digits required by MAX(ADDRESS)

Output for type BITSET

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

output should always show all bits

Output for type BOOLEAN

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

Output for types CHAR and UNICHAR

Characters:                     |0123456789012345678|
WRITE("A");                   => A
WRITEF("A", "'");             => 'A'
WRITEF("A", '"');             => "A"

Output for ARRAY OF CHAR and ARRAY OF UNICHAR

Character Strings:              |012345678901234567890|
WRITE("foobar");              => foobar
WRITEF("foobar", "'");        => 'foobar'
WRITEF("foobar", '"');        => "foobar"
WRITEF("foobar", ASCII.LF);   => foobar\n

Output for type OCTET

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

Output for types CARDINAL and LONGCARD

Unsigned Whole Numerals:        |012345678901234567890|
WRITE(12345);                 => 12345
WRITEF(12345, 8);             =>    12,345
WRITEF(12345, 8, "*");        => ***12,345
WRITEF(12345, 8, "x");        => 0x00003039
WRITEF(12345, 8, "H");        => 00003039H

Output for types INTEGER and LONGINT

Signed Whole Numerals:          |012345678901234567890|
WRITE(12345);                 =>  12345
WRITE(-12345);                => -12345
WRITEF(-12345, 8);            => -   12,345
WRITEF(-12345, 8, "*");       => -***12,345
WRITEF(-12345, 8, "x");       => 0x0000CFC7
WRITEF(-12345, 8, "H");       => 0000CFC7H

Output for types REAL, LONGREAL, BCD and LONGBCD

Real Numerals:                  |012345678901234567890|
WRITE(12345.67);              =>  1.234567000E+04
WRITE(-12345.67);             => -1.234567000E+04
WRITEF(-12345.67, 8);         => -   12,345.67000
WRITEF(-12345.67, 8, 2);      => -   12,345.67
WRITEF(-12345.67, 8, 2, "*"); => -***12,345.67
WRITEF(-12345.67, 8, 3, "E"); => -12.345,670E+03