aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Yavner2004-01-24 17:39:47 +0000
committerJonathan Yavner2004-01-24 17:39:47 +0000
commit728345f8b15055d2d9b8273b87f674399f8c41e5 (patch)
tree2b02fe222fe82efbffe82232a92a3b24cb89a728 /src
parent2528f9c4a681cabd8038411807ddd2128d5e3dbb (diff)
downloademacs-728345f8b15055d2d9b8273b87f674399f8c41e5.tar.gz
emacs-728345f8b15055d2d9b8273b87f674399f8c41e5.zip
For `format', make source and documentation match.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/editfns.c b/src/editfns.c
index a636c35a464..d3039ca0273 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3193,6 +3193,10 @@ It may contain %-sequences meaning to substitute the next argument.
3193 The argument used for %d, %o, %x, %e, %f, %g or %c must be a number. 3193 The argument used for %d, %o, %x, %e, %f, %g or %c must be a number.
3194Use %% to put a single % into the output. 3194Use %% to put a single % into the output.
3195 3195
3196The basic structure of a %-sequence is
3197 % <flags> <width> <precision> character
3198where flags is [- #0]+, width is [0-9]+, and precision is .[0-9]+
3199
3196usage: (format STRING &rest OBJECTS) */) 3200usage: (format STRING &rest OBJECTS) */)
3197 (nargs, args) 3201 (nargs, args)
3198 int nargs; 3202 int nargs;
@@ -3300,7 +3304,7 @@ usage: (format STRING &rest OBJECTS) */)
3300 3304
3301 where 3305 where
3302 3306
3303 flags ::= [#-* 0]+ 3307 flags ::= [- #0]+
3304 field-width ::= [0-9]+ 3308 field-width ::= [0-9]+
3305 precision ::= '.' [0-9]* 3309 precision ::= '.' [0-9]*
3306 3310
@@ -3312,14 +3316,7 @@ usage: (format STRING &rest OBJECTS) */)
3312 digits to print after the '.' for floats, or the max. 3316 digits to print after the '.' for floats, or the max.
3313 number of chars to print from a string. */ 3317 number of chars to print from a string. */
3314 3318
3315 /* NOTE the handling of specifiers here differs in some ways 3319 while (index ("-0# ", *format))
3316 from the libc model. There are bugs in this code that lead
3317 to incorrect formatting when flags recognized by C but
3318 neither parsed nor rejected here are used. Further
3319 revisions will be made soon. */
3320
3321 /* incorrect list of flags to skip; will be fixed */
3322 while (index ("-*# 0", *format))
3323 ++format; 3320 ++format;
3324 3321
3325 if (*format >= '0' && *format <= '9') 3322 if (*format >= '0' && *format <= '9')
@@ -3403,7 +3400,7 @@ usage: (format STRING &rest OBJECTS) */)
3403 if (*format == 'c') 3400 if (*format == 'c')
3404 { 3401 {
3405 if (! SINGLE_BYTE_CHAR_P (XINT (args[n])) 3402 if (! SINGLE_BYTE_CHAR_P (XINT (args[n]))
3406 /* Note: No one can remeber why we have to treat 3403 /* Note: No one can remember why we have to treat
3407 the character 0 as a multibyte character here. 3404 the character 0 as a multibyte character here.
3408 But, until it causes a real problem, let's 3405 But, until it causes a real problem, let's
3409 don't change it. */ 3406 don't change it. */
@@ -3494,17 +3491,19 @@ usage: (format STRING &rest OBJECTS) */)
3494 discarded[format - format_start] = 1; 3491 discarded[format - format_start] = 1;
3495 format++; 3492 format++;
3496 3493
3497 /* Process a numeric arg and skip it. */ 3494 while (index("-0# ", *format))
3498 /* NOTE atoi is the wrong thing to use here; will be fixed */ 3495 {
3496 if (*format == '-')
3497 {
3498 negative = 1;
3499 }
3500 discarded[format - format_start] = 1;
3501 ++format;
3502 }
3503
3499 minlen = atoi (format); 3504 minlen = atoi (format);
3500 if (minlen < 0) 3505
3501 minlen = - minlen, negative = 1; 3506 while ((*format >= '0' && *format <= '9') || *format == '.')
3502
3503 /* NOTE the parsing here is not consistent with the first
3504 pass, and neither attempt is what we want to do. Will be
3505 fixed. */
3506 while ((*format >= '0' && *format <= '9')
3507 || *format == '-' || *format == ' ' || *format == '.')
3508 { 3507 {
3509 discarded[format - format_start] = 1; 3508 discarded[format - format_start] = 1;
3510 format++; 3509 format++;