4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 00:38:06 +08:00

Improve markup of sscanf and swscanf documentation

- use bullet points to separate width, size and type sections, rather than using
rows in an enormous table, for consistency with sprintf and swprintf.

- use code markup for size bullet point for consistency

- use a texinfo multitable for description of the size flags, rather than some
preformatted text

- tidy up some whitespace so type flags are all aligned

2015-11-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdio/sscanf.c: Improve documentation markup.
	* libc/stdio/swscanf.c: Ditto.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Jon Turney 2015-11-12 13:13:34 +00:00
parent 396e8310b1
commit 21e6ba20ae
3 changed files with 242 additions and 114 deletions

View File

@ -1,3 +1,8 @@
2015-11-12 Jon Turney <jon.turney@dronecode.org.uk>
* libc/stdio/sscanf.c: Improve documentation markup.
* libc/stdio/swscanf.c: Ditto.
2015-11-17 Yaakov Selkowitz <yselkowi@redhat.com> 2015-11-17 Yaakov Selkowitz <yselkowi@redhat.com>
* libc/include/stdlib.h (rpmatch): Declare. * libc/include/stdlib.h (rpmatch): Declare.

View File

@ -132,12 +132,14 @@ DESCRIPTION
Each format specification begins with the percent character (<<%>>). Each format specification begins with the percent character (<<%>>).
The other fields are: The other fields are:
o+ O+
o * o *
an optional marker; if present, it suppresses interpretation and an optional marker; if present, it suppresses interpretation and
assignment of this input field. assignment of this input field.
o <[width]> o <[width]>
an optional maximum field width: a decimal integer, an optional maximum field width: a decimal integer,
which controls the maximum number of characters that which controls the maximum number of characters that
will be read before converting the current input field. If the will be read before converting the current input field. If the
@ -150,58 +152,115 @@ DESCRIPTION
to that character are read, converted, and stored. to that character are read, converted, and stored.
Then <<scanf>> proceeds to the next format specification. Then <<scanf>> proceeds to the next format specification.
o size o <[size]>
<<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size <<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size
characters which override the default way that <<scanf>> characters which override the default way that <<scanf>>
interprets the data type of the corresponding argument. interprets the data type of the corresponding argument.
@multitable @columnfractions 0.18 0.30 0.52
.Modifier Type(s) @headitem
. hh d, i, o, u, x, n convert input to char, Modifier
. store in char object @tab
. Type(s)
. h d, i, o, u, x, n convert input to short, @tab
. store in short object @item
. hh
. h D, I, O, U, X no effect @tab
. e, f, c, s, p d, i, o, u, x, n
. @tab
. j d, i, o, u, x, n convert input to intmax_t, convert input to char, store in char object
. store in intmax_t object @item
. h
. j all others no effect @tab
. d, i, o, u, x, n
. l d, i, o, u, x, n convert input to long, @tab
. store in long object convert input to short, store in short object
. @item
. l e, f, g convert input to double h
. store in a double object @tab
. D, I, O, U, X, e, f, c, s, p
. l D, I, O, U, X no effect @tab
. c, s, p no effect
. @item
. ll d, i, o, u, x, n convert to long long, j
. store in long long @tab
. d, i, o, u, x, n
. L d, i, o, u, x, n convert to long long, @tab
. store in long long convert input to intmax_t, store in intmax_t object
. @item
. L e, f, g, E, G convert to long double, j
. store in long double @tab
. all others
. L all others no effect @tab
. no effect
. t d, i, o, u, x, n convert input to ptrdiff_t, @item
. store in ptrdiff_t object l
. @tab
. t all others no effect d, i, o, u, x, n
. @tab
. z d, i, o, u, x, n convert input to size_t, convert input to long, store in long object
. store in size_t object @item
. l
. z all others no effect @tab
. e, f, g
@tab
convert input to double, store in a double object
@item
l
@tab
D, I, O, U, X, c, s, p
@tab
no effect
@item
ll
@tab
d, i, o, u, x, n
@tab
convert to long long, store in long long object
@item
L
@tab
d, i, o, u, x, n
@tab
convert to long long, store in long long object
@item
L
@tab
e, f, g, E, G
@tab
convert to long double, store in long double object
@item
L
@tab
all others
@tab
no effect
@item
t
@tab
d, i, o, u, x, n
@tab
convert input to ptrdiff_t, store in ptrdiff_t object
@item
t
@tab
all others
@tab
no effect
@item
z
@tab
d, i, o, u, x, n
@tab
convert input to size_t, store in size_t object
@item
z
@tab
all others
@tab
no effect
@end multitable
o <[type]> o <[type]>
@ -245,7 +304,6 @@ DESCRIPTION
Reads an unsigned decimal integer into the corresponding Reads an unsigned decimal integer into the corresponding
<[arg]>: <<(unsigned int *arg)>>. <[arg]>: <<(unsigned int *arg)>>.
o U o U
Reads an unsigned decimal integer into the corresponding <[arg]>: Reads an unsigned decimal integer into the corresponding <[arg]>:
<<(unsigned long *arg)>>. <<(unsigned long *arg)>>.
@ -316,7 +374,7 @@ DESCRIPTION
where objects inclosed in square brackets are optional, and <<ddd>> where objects inclosed in square brackets are optional, and <<ddd>>
represents decimal, octal, or hexadecimal digits. represents decimal, octal, or hexadecimal digits.
o- O-
RETURNS RETURNS
<<scanf>> returns the number of input fields successfully <<scanf>> returns the number of input fields successfully

View File

@ -134,12 +134,14 @@ DESCRIPTION
Each format specification begins with the percent character (<<%>>). Each format specification begins with the percent character (<<%>>).
The other fields are: The other fields are:
o+ O+
o * o *
an optional marker; if present, it suppresses interpretation and an optional marker; if present, it suppresses interpretation and
assignment of this input field. assignment of this input field.
o <[width]> o <[width]>
an optional maximum field width: a decimal integer, an optional maximum field width: a decimal integer,
which controls the maximum number of characters that which controls the maximum number of characters that
will be read before converting the current input field. If the will be read before converting the current input field. If the
@ -152,58 +154,121 @@ DESCRIPTION
to that character are read, converted, and stored. to that character are read, converted, and stored.
Then <<wscanf>> proceeds to the next format specification. Then <<wscanf>> proceeds to the next format specification.
o size o <[size]>
<<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size <<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size
characters which override the default way that <<wscanf>> characters which override the default way that <<wscanf>>
interprets the data type of the corresponding argument. interprets the data type of the corresponding argument.
@multitable @columnfractions 0.18 0.30 0.52
.Modifier Type(s) @headitem
. hh d, i, o, u, x, n convert input to char, Modifier
. store in char object @tab
. Type(s)
. h d, i, o, u, x, n convert input to short, @tab
. store in short object @item
. hh
. h e, f, c, s, p no effect @tab
. d, i, o, u, x, n
. j d, i, o, u, x, n convert input to intmax_t, @tab
. store in intmax_t object convert input to char, store in char object
. @item
. j all others no effect h
. @tab
. l d, i, o, u, x, n convert input to long, d, i, o, u, x, n
. store in long object @tab
. convert input to short, store in short object
. l e, f, g convert input to double @item
. store in a double object h
. @tab
. l c, s, [ the input is stored in a wchar_t object e, f, c, s, p
. @tab
. l p no effect no effect
. @item
. ll d, i, o, u, x, n convert to long long, j
. store in long long @tab
. d, i, o, u, x, n
. L d, i, o, u, x, n convert to long long, @tab
. store in long long convert input to intmax_t, store in intmax_t object
. @item
. L e, f, g, E, G convert to long double, j
. store in long double @tab
. all others
. L all others no effect @tab
. no effect
. t d, i, o, u, x, n convert input to ptrdiff_t, @item
. store in ptrdiff_t object l
. @tab
. t all others no effect d, i, o, u, x, n
. @tab
. z d, i, o, u, x, n convert input to size_t, convert input to long, store in long object
. store in size_t object @item
. l
. z all others no effect @tab
. e, f, g
@tab
convert input to double, store in a double object
@item
l
@tab
c, s, [
@tab
the input is stored in a wchar_t object
@item
l
@tab
p
@tab
no effect
@item
ll
@tab
d, i, o, u, x, n
@tab
convert to long long, store in long long object
@item
L
@tab
d, i, o, u, x, n
@tab
convert to long long, store in long long object
@item
L
@tab
e, f, g, E, G
@tab
convert to long double, store in long double object
@item
L
@tab
all others
@tab
no effect
@item
t
@tab
d, i, o, u, x, n
@tab
convert input to ptrdiff_t, store in ptrdiff_t object
@item
t
@tab
all others
@tab
no effect
@item
z
@tab
d, i, o, u, x, n
@tab
convert input to size_t, store in size_t object
@item
z
@tab
all others
@tab
no effect
@end multitable
o <[type]> o <[type]>
@ -303,7 +368,7 @@ DESCRIPTION
where objects inclosed in square brackets are optional, and <<ddd>> where objects inclosed in square brackets are optional, and <<ddd>>
represents decimal, octal, or hexadecimal digits. represents decimal, octal, or hexadecimal digits.
o- O-
RETURNS RETURNS
<<wscanf>> returns the number of input fields successfully <<wscanf>> returns the number of input fields successfully