aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code/mpm.c
diff options
context:
space:
mode:
authorNick Barnes2001-12-17 15:18:17 +0000
committerNick Barnes2001-12-17 15:18:17 +0000
commitdb4b3a6fa51ea452f62ed64612da5466d7bc292e (patch)
tree4401c0c97d4df2e1c48ad06f263c27199e92d5dc /mps/code/mpm.c
parentc864931fe4271b6592ca4a76ce856938d263c74a (diff)
downloademacs-db4b3a6fa51ea452f62ed64612da5466d7bc292e.tar.gz
emacs-db4b3a6fa51ea452f62ed64612da5466d7bc292e.zip
Remove trailing whitespace.
Copied from Perforce Change: 25309 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code/mpm.c')
-rw-r--r--mps/code/mpm.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/mps/code/mpm.c b/mps/code/mpm.c
index 1335c6c6e36..bfdc8dad29e 100644
--- a/mps/code/mpm.c
+++ b/mps/code/mpm.c
@@ -64,7 +64,7 @@ Bool MPMCheck(void)
64 CHECKL(-(DBL_MIN_10_EXP) <= DBL_MAX_10_EXP); 64 CHECKL(-(DBL_MIN_10_EXP) <= DBL_MAX_10_EXP);
65 } 65 }
66 66
67 return TRUE; 67 return TRUE;
68} 68}
69 69
70 70
@@ -194,7 +194,7 @@ Addr (AddrAlignDown)(Addr addr, Align alignment)
194} 194}
195 195
196 196
197/* ResIsAllocFailure 197/* ResIsAllocFailure
198 * 198 *
199 * Test whether a result code is in the set of allocation failure codes. */ 199 * Test whether a result code is in the set of allocation failure codes. */
200 200
@@ -209,7 +209,7 @@ Bool ResIsAllocFailure(Res res)
209 * Output as an unsigned value in the given base (2-16), padded to the 209 * Output as an unsigned value in the given base (2-16), padded to the
210 * given width. */ 210 * given width. */
211 211
212static Res WriteWord(mps_lib_FILE *stream, Word w, unsigned base, 212static Res WriteWord(mps_lib_FILE *stream, Word w, unsigned base,
213 unsigned width) 213 unsigned width)
214{ 214{
215 static const char digit[16] = "0123456789ABCDEF"; 215 static const char digit[16] = "0123456789ABCDEF";
@@ -222,7 +222,7 @@ static Res WriteWord(mps_lib_FILE *stream, Word w, unsigned base,
222 AVER(stream != NULL); 222 AVER(stream != NULL);
223 AVER(2 <= base && base <= 16); 223 AVER(2 <= base && base <= 16);
224 AVER(width <= MPS_WORD_WIDTH); 224 AVER(width <= MPS_WORD_WIDTH);
225 225
226 /* Add digits to the buffer starting at the right-hand end, so that */ 226 /* Add digits to the buffer starting at the right-hand end, so that */
227 /* the buffer forms a string representing the number. A do...while */ 227 /* the buffer forms a string representing the number. A do...while */
228 /* loop is used to ensure that at least one digit (zero) is written */ 228 /* loop is used to ensure that at least one digit (zero) is written */
@@ -262,7 +262,7 @@ static Res WriteWord(mps_lib_FILE *stream, Word w, unsigned base,
262 * .write.double.check: There being no DBL_EXP_DIG, we assume that it is 262 * .write.double.check: There being no DBL_EXP_DIG, we assume that it is
263 * less than DBL_DIG. */ 263 * less than DBL_DIG. */
264 264
265static Res WriteDouble(mps_lib_FILE *stream, double d) 265static Res WriteDouble(mps_lib_FILE *stream, double d)
266{ 266{
267 double F = d; 267 double F = d;
268 int E = 0, i, x = 0; 268 int E = 0, i, x = 0;
@@ -281,7 +281,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
281 /* terminator. See .write.double.check. */ 281 /* terminator. See .write.double.check. */
282 char buf[1+DBL_DIG+2+1+1+DBL_DIG+1]; 282 char buf[1+DBL_DIG+2+1+1+DBL_DIG+1];
283 int j = 0; 283 int j = 0;
284 284
285 if (F == 0.0) { 285 if (F == 0.0) {
286 if (mps_lib_fputs("0", stream) == mps_lib_EOF) 286 if (mps_lib_fputs("0", stream) == mps_lib_EOF)
287 return ResIO; 287 return ResIO;
@@ -293,7 +293,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
293 j++; 293 j++;
294 F = - F; 294 F = - F;
295 } 295 }
296 296
297 /* This scaling operation could introduce rounding errors. */ 297 /* This scaling operation could introduce rounding errors. */
298 for ( ; F >= 1.0 ; F /= 10.0) { 298 for ( ; F >= 1.0 ; F /= 10.0) {
299 E++; 299 E++;
@@ -305,7 +305,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
305 } 305 }
306 for ( ; F < 0.1; F *= 10) 306 for ( ; F < 0.1; F *= 10)
307 E--; 307 E--;
308 308
309 /* See if %e notation is required */ 309 /* See if %e notation is required */
310 if (E > expmax || E <= expmin) { 310 if (E > expmax || E <= expmin) {
311 x = E - 1; 311 x = E - 1;
@@ -330,7 +330,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
330 /* the exponent. This is Steele and White's FP3 algorithm. */ 330 /* the exponent. This is Steele and White's FP3 algorithm. */
331 do { 331 do {
332 int U; 332 int U;
333 333
334 if (E == 0) { 334 if (E == 0) {
335 buf[j] = '.'; 335 buf[j] = '.';
336 j++; 336 j++;
@@ -351,7 +351,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
351 buf[j] = digits[U]; 351 buf[j] = digits[U];
352 j++; 352 j++;
353 } while (1); 353 } while (1);
354 354
355 /* Insert trailing 0's */ 355 /* Insert trailing 0's */
356 for (i = E; i > 0; i--) { 356 for (i = E; i > 0; i--) {
357 buf[j] = '0'; 357 buf[j] = '0';
@@ -384,7 +384,7 @@ static Res WriteDouble(mps_lib_FILE *stream, double d)
384 } while (i > 0); 384 } while (i > 0);
385 } 385 }
386 buf[j] = '\0'; /* arnold */ 386 buf[j] = '\0'; /* arnold */
387 387
388 if (mps_lib_fputs(buf, stream) == mps_lib_EOF) 388 if (mps_lib_fputs(buf, stream) == mps_lib_EOF)
389 return ResIO; 389 return ResIO;
390 return ResOK; 390 return ResOK;
@@ -413,7 +413,7 @@ Res WriteF(mps_lib_FILE *stream, ...)
413 va_list args; 413 va_list args;
414 414
415 AVER(stream != NULL); 415 AVER(stream != NULL);
416 416
417 va_start(args, stream); 417 va_start(args, stream);
418 418
419 for(;;) { 419 for(;;) {
@@ -432,14 +432,14 @@ Res WriteF(mps_lib_FILE *stream, ...)
432 switch(*format) { 432 switch(*format) {
433 case 'A': { /* address */ 433 case 'A': { /* address */
434 WriteFA addr = va_arg(args, WriteFA); 434 WriteFA addr = va_arg(args, WriteFA);
435 res = WriteWord(stream, (Word)addr, 16, 435 res = WriteWord(stream, (Word)addr, 16,
436 (sizeof(WriteFA) * CHAR_BIT + 3) / 4); 436 (sizeof(WriteFA) * CHAR_BIT + 3) / 4);
437 if (res != ResOK) return res; 437 if (res != ResOK) return res;
438 } break; 438 } break;
439 439
440 case 'P': { /* pointer, see .writef.p */ 440 case 'P': { /* pointer, see .writef.p */
441 WriteFP p = va_arg(args, WriteFP); 441 WriteFP p = va_arg(args, WriteFP);
442 res = WriteWord(stream, (Word)p, 16, 442 res = WriteWord(stream, (Word)p, 16,
443 (sizeof(WriteFP) * CHAR_BIT + 3)/ 4); 443 (sizeof(WriteFP) * CHAR_BIT + 3)/ 4);
444 if (res != ResOK) return res; 444 if (res != ResOK) return res;
445 } break; 445 } break;
@@ -448,24 +448,24 @@ Res WriteF(mps_lib_FILE *stream, ...)
448 WriteFF f = va_arg(args, WriteFF); 448 WriteFF f = va_arg(args, WriteFF);
449 Byte *b = (Byte *)&f; 449 Byte *b = (Byte *)&f;
450 for(i=0; i < sizeof(WriteFF); i++) { 450 for(i=0; i < sizeof(WriteFF); i++) {
451 res = WriteWord(stream, (Word)(b[i]), 16, 451 res = WriteWord(stream, (Word)(b[i]), 16,
452 (CHAR_BIT + 3) / 4); 452 (CHAR_BIT + 3) / 4);
453 if (res != ResOK) return res; 453 if (res != ResOK) return res;
454 } 454 }
455 } break; 455 } break;
456 456
457 case 'S': { /* string */ 457 case 'S': { /* string */
458 WriteFS s = va_arg(args, WriteFS); 458 WriteFS s = va_arg(args, WriteFS);
459 r = mps_lib_fputs((const char *)s, stream); 459 r = mps_lib_fputs((const char *)s, stream);
460 if (r == mps_lib_EOF) return ResIO; 460 if (r == mps_lib_EOF) return ResIO;
461 } break; 461 } break;
462 462
463 case 'C': { /* character */ 463 case 'C': { /* character */
464 WriteFC c = va_arg(args, WriteFC); /* promoted */ 464 WriteFC c = va_arg(args, WriteFC); /* promoted */
465 r = mps_lib_fputc((int)c, stream); 465 r = mps_lib_fputc((int)c, stream);
466 if (r == mps_lib_EOF) return ResIO; 466 if (r == mps_lib_EOF) return ResIO;
467 } break; 467 } break;
468 468
469 case 'W': { /* word */ 469 case 'W': { /* word */
470 WriteFW w = va_arg(args, WriteFW); 470 WriteFW w = va_arg(args, WriteFW);
471 res = WriteWord(stream, (Word)w, 16, 471 res = WriteWord(stream, (Word)w, 16,
@@ -484,7 +484,7 @@ Res WriteF(mps_lib_FILE *stream, ...)
484 res = WriteWord(stream, (Word)b, 2, sizeof(WriteFB) * CHAR_BIT); 484 res = WriteWord(stream, (Word)b, 2, sizeof(WriteFB) * CHAR_BIT);
485 if (res != ResOK) return res; 485 if (res != ResOK) return res;
486 } break; 486 } break;
487 487
488 case '$': { /* dollar char */ 488 case '$': { /* dollar char */
489 r = mps_lib_fputc('$', stream); 489 r = mps_lib_fputc('$', stream);
490 if (r == mps_lib_EOF) return ResIO; 490 if (r == mps_lib_EOF) return ResIO;
@@ -495,7 +495,7 @@ Res WriteF(mps_lib_FILE *stream, ...)
495 res = WriteDouble(stream, d); 495 res = WriteDouble(stream, d);
496 if (res != ResOK) return res; 496 if (res != ResOK) return res;
497 } break; 497 } break;
498 498
499 default: 499 default:
500 NOTREACHED; 500 NOTREACHED;
501 } 501 }
@@ -504,9 +504,9 @@ Res WriteF(mps_lib_FILE *stream, ...)
504 ++format; 504 ++format;
505 } 505 }
506 } 506 }
507 507
508 va_end(args); 508 va_end(args);
509 509
510 return ResOK; 510 return ResOK;
511} 511}
512 512
@@ -519,7 +519,7 @@ size_t StringLength(const char *s)
519 519
520 AVER(s != NULL); 520 AVER(s != NULL);
521 521
522 for(i = 0; s[i] != '\0'; i++) 522 for(i = 0; s[i] != '\0'; i++)
523 NOOP; 523 NOOP;
524 return(i); 524 return(i);
525} 525}