[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/doc/m4.texinfo,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/doc/m4.texinfo,v [branch-1_4] |
Date: |
Tue, 29 May 2007 13:19:48 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 07/05/29 13:19:48
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.126
retrieving revision 1.1.1.1.2.127
diff -u -b -r1.1.1.1.2.126 -r1.1.1.1.2.127
--- doc/m4.texinfo 25 May 2007 20:29:17 -0000 1.1.1.1.2.126
+++ doc/m4.texinfo 29 May 2007 13:19:47 -0000 1.1.1.1.2.127
@@ -4887,15 +4887,27 @@
Its use is best described by a few examples:
address@hidden This test is a bit fragile, if someone tries to port to a
address@hidden platform without infinity.
@example
define(`foo', `The brown fox jumped over the lazy dog')
@result{}
format(`The string "%s" uses %d characters', foo, len(foo))
@result{}The string "The brown fox jumped over the lazy dog" uses 38 characters
+format(`%*.*d', `-1', `-1', `1')
address@hidden
format(`%.0f', `56789.9876')
@result{}56790
-len(format(`%-*X', `300', `1'))
address@hidden
+len(format(`%-*X', `5000', `1'))
address@hidden
+ifelse(format(`%010F', `infinity'), ` INF', `success',
+ format(`%010F', `infinity'), ` INFINITY', `success',
+ `fail')
address@hidden
+ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success',
+ format(`%.1A', `1.999'), `0X2.0P+0', `success',
+ `fail')
address@hidden
@end example
Using the @code{forloop} macro defined earlier (@pxref{Forloop}), this
@@ -4921,18 +4933,32 @@
@end example
The builtin @code{format} is modeled after the ANSI C @samp{printf}
-function, and supports these @samp{%} specifiers: @samp{c},
address@hidden, @samp{d}, @samp{o}, @samp{x}, @samp{X}, @samp{u}, @samp{e},
address@hidden, @samp{f}, @samp{F}, @samp{g}, @samp{G}, and @samp{%}; it
-supports field widths and precisions, and the
-modifiers @samp{+}, @samp{-}, @address@hidden }}, @samp{0}, @samp{#}, @samp{h}
and
address@hidden For more details on the functioning of @code{printf}, see the
-C Library Manual.
-
-For now, unrecognized specifiers are silently ignored, but it is
-anticipated that a future release of @acronym{GNU} @code{m4} will support more
-specifiers, and give warnings when problems are encountered. Likewise,
-escape sequences are not yet recognized.
+function, and supports these @samp{%} specifiers: @samp{c}, @samp{s},
address@hidden, @samp{o}, @samp{x}, @samp{X}, @samp{u}, @samp{a}, @samp{A},
address@hidden, @samp{E}, @samp{f}, @samp{F}, @samp{g}, @samp{G}, and
address@hidden; it supports field widths and precisions, and the flags
address@hidden, @samp{-}, @samp{ }, @samp{0}, @samp{#}, and @samp{'}. For
+integer specifiers, the width modifiers @samp{hh}, @samp{h}, and
address@hidden are recognized, and for floating point specifiers, the width
+modifier @samp{l} is recognized. Items not yet supported include
+positional arguments, the @samp{n}, @samp{p}, @samp{S}, and @samp{C}
+specifiers, the @samp{z}, @samp{t}, @samp{j}, @samp{L} and @samp{ll}
+modifiers, and any platform extensions available in the native
address@hidden For more details on the functioning of @code{printf},
+see the C Library Manual, or the @acronym{POSIX} specification (for
+example, @samp{%a} is supported even on platforms that haven't yet
+implemented C99 hexadecimal floating point output natively).
+
+Unrecognized specifiers result in a warning. It is anticipated that a
+future release of @acronym{GNU} @code{m4} will support more specifiers,
+and give better warnings when various problems such as overflow are
+encountered. Likewise, escape sequences are not yet recognized.
+
address@hidden
+format(`%p', `0')
address@hidden:stdin:1: Warning: unrecognized specifier in `%p'
address@hidden
address@hidden example
@node Arithmetic
@chapter Macros for doing arithmetic
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2007/05/25
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2007/05/25
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2007/05/25
- Changes to m4/doc/m4.texinfo,v [branch-1_4],
Eric Blake <=
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2007/05/31