|
|
1.1 root 1: INFORMATION ABOUT ADB INTERNALS
2:
3: 23 August 1988, Chris Torek
4:
5: (This file is incomplete.)
6:
7: TYPES
8: write something here.
9:
10: FORMATTED OUTPUT
11: Adb has a simplified, and slightly extended, version of printf,
12: called adbprintf(). adbprintf() conversion specifiers are introduced by
13: the usual `%' escape. (Beware of SCCS eating 5 and June 25, 1990 escapes.) The
14: format of a conversion-specifier is:
15:
16: [flags] [width] [`.' precision] conversion-character
17:
18: The default width is 0; the default precision is -1. The available
19: flags are `-', for right adjustment within the field, and `+', which
20: forces a sign on numeric conversions. If the result of a conversion
21: is narrower than the specified width, it is passed on the right (or
22: left if `-') with blanks. If a precision is given, and is not negative,
23: the result of a conversion will be truncated after precision characters.
24: Width and precision may be given as `*', in which case they are taken
25: from an integer argument a la printf().
26:
27: The conversion-characters, and the types they expect, are:
28:
29: [numeric]
30: d prints an hword_t value as a signed decimal integer.
31: D prints an expr_t value as a signed decimal integer.
32: u prints an hword_t value as an unsigned decimal integer.
33: U prints an expr_t value as an unsigned decimal integer.
34: q prints an hword_t value as a signed octal integer.
35: Q prints an expr_t value as a signed octal integer.
36: o prints an hword_t value as an unsigned octal integer.
37: O prints an expr_t value as an unsigned octal integer.
38: z prints an hword_t value as a signed hexadecimal integer.
39: Z prints an expr_t value as a signed hexadecimal integer.
40: x prints an hword_t value as an unsigned hexadecimal integer.
41: X prints an expr_t value as an unsigned hexadecimal integer.
42: r prints an hword_t value in the current radix.
43: R prints an expr_t value in the current radix.
44: v prints an hword_t value in signed variant of current radix.
45: V prints an expr_t value in signed variant of current radix.
46:
47: [non-numeric]
48: c prints a character.
49:
50: s prints a string.
51:
52: m prints nothing; hence %<width>m prints <width> spaces.
53:
54: t prints nothing, but adjusts the width such that it
55: becomes a tabstop. Thus %24t moves to the next column
56: that is a multiple of 24, and %8t acts like \t would
57: if \t were implemented in adb.
58:
59: [special]
60: ? converts an integer value, then applies a second
61: conversion-specifier. If integer was zero, the
62: output from the second conversion-specifier is
63: suppressed. For instance, %?s converts one integer
64: and one string, and prints the string only if the
65: integer is nonzero (and the pointer is not evaluated).
66: Thus `adbprintf("%?s", s!=NULL, s)' prints the string
67: s if and only if the pointer s is not NULL. `?'
68: conversions may be nested: ("%??x", a, b, c) prints
69: c only if both a and b are nonzero.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.