aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code/mpm.c
diff options
context:
space:
mode:
authorRichard Kistruck2007-08-07 19:09:43 +0100
committerRichard Kistruck2007-08-07 19:09:43 +0100
commit5cbd84f9b46384ee08da255db816a0971fd5bf3f (patch)
treeab667435bae3f2b2659fcc561f0473e24cf7bc9f /mps/code/mpm.c
parent5a478d9a7d637d87a07625ad1c37bac5c3633573 (diff)
downloademacs-5cbd84f9b46384ee08da255db816a0971fd5bf3f.tar.gz
emacs-5cbd84f9b46384ee08da255db816a0971fd5bf3f.zip
Mps br/diagtag:
diag.c: support tagging of diagnostics, and avoid having to say DIAG_STREAM every time, with new macros: DIAG_SINGLEF, DIAG_FIRSTF, DIAG_MOREF, DIAG_END. mpm.c: new WriteF_firstformat_v required by DIAG_MOREF. Copied from Perforce Change: 163059 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code/mpm.c')
-rw-r--r--mps/code/mpm.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/mps/code/mpm.c b/mps/code/mpm.c
index 4282a06b937..04bb8418f61 100644
--- a/mps/code/mpm.c
+++ b/mps/code/mpm.c
@@ -409,7 +409,16 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
409 409
410/* WriteF -- write formatted output 410/* WriteF -- write formatted output
411 * 411 *
412 * Calls WriteF_v. 412 * .writef.des: See <design/writef/>, also <design/lib/>
413 *
414 * .writef.p: There is an assumption that void * fits in Word in
415 * the case of $P, and unsigned long for $U and $B. This is checked in
416 * MPMCheck.
417 *
418 * .writef.div: Although MPS_WORD_WIDTH/4 appears three times, there
419 * are effectively three separate decisions to format at this width.
420 *
421 * .writef.check: See .check.writef.
413 */ 422 */
414 423
415Res WriteF(mps_lib_FILE *stream, ...) 424Res WriteF(mps_lib_FILE *stream, ...)
@@ -423,21 +432,20 @@ Res WriteF(mps_lib_FILE *stream, ...)
423 return res; 432 return res;
424} 433}
425 434
435Res WriteF_v(mps_lib_FILE *stream, va_list args)
436{
437 const char *firstformat;
438 int r;
439 size_t i;
440 Res res;
426 441
427/* WriteF_v -- write formatted output 442 firstformat = va_arg(args, const char *);
428 * 443 res = WriteF_firstformat_v(stream, firstformat, args);
429 * .writef.des: See <design/writef/>, also <design/lib/> 444 return res;
430 * 445}
431 * .writef.p: There is an assumption that void * fits in Word in
432 * the case of $P, and unsigned long for $U and $B. This is checked in
433 * MPMCheck.
434 *
435 * .writef.div: Although MPS_WORD_WIDTH/4 appears three times, there
436 * are effectively three separate decisions to format at this width.
437 *
438 * .writef.check: See .check.writef. */
439 446
440Res WriteF_v(mps_lib_FILE *stream, va_list args) 447Res WriteF_firstformat_v(mps_lib_FILE *stream,
448 const char *firstformat, va_list args)
441{ 449{
442 const char *format; 450 const char *format;
443 int r; 451 int r;
@@ -445,9 +453,10 @@ Res WriteF_v(mps_lib_FILE *stream, va_list args)
445 Res res; 453 Res res;
446 454
447 AVER(stream != NULL); 455 AVER(stream != NULL);
456
457 format = firstformat;
448 458
449 for(;;) { 459 for(;;) {
450 format = va_arg(args, const char *);
451 if (format == NULL) 460 if (format == NULL)
452 break; 461 break;
453 462
@@ -534,6 +543,8 @@ Res WriteF_v(mps_lib_FILE *stream, va_list args)
534 543
535 ++format; 544 ++format;
536 } 545 }
546
547 format = va_arg(args, const char *);
537 } 548 }
538 549
539 return ResOK; 550 return ResOK;