| 12345678910111213141516171819202122232425262728 |
- program t76_width;
- { t76 -- write FIELD WIDTHS.
- CALC.INC:135 is `writeln(I:2)'; DisplayCell later uses `Value:FW:DEC', the
- REAL form, which waits for real support. The width is an EXPRESSION (CALC
- passes FW, a variable), and it is pushed after the value, so the runtime's
- wrintw reads the value at [BP+6] and the width at [BP+4].
- Right-justification: pad = width - characters, the sign counting as one; a
- width narrower than the number does not truncate it. The last two lines
- are the no-width and width-1 cases, so a writer that always pads (or never
- does) is caught as well. }
- var
- i, w : integer;
- begin
- i := 7;
- writeln (i:3, '|');
- writeln (42:5, '|');
- writeln (-7:4, '|');
- writeln (123:2, '|');
- writeln (0:2, '|');
- w := 6;
- writeln (i:w, '|');
- writeln (i:1, '|');
- writeln (i, '|')
- end.
|