diff --git a/mps/code/abq.c b/mps/code/abq.c index 63abd1e5725..74abcdf009a 100644 --- a/mps/code/abq.c +++ b/mps/code/abq.c @@ -164,7 +164,7 @@ Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *strea if (!TESTT(ABQ, abq)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "ABQ $P {\n", (WriteFP)abq, " elements: $U \n", (WriteFU)abq->elements, " in: $U \n", (WriteFU)abq->in, @@ -186,7 +186,7 @@ Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *strea METER_WRITE(abq->peek, stream, depth + 2); METER_WRITE(abq->delete, stream, depth + 2); - res = WriteF(depth, stream, "} ABQ $P\n", (WriteFP)abq, NULL); + res = WriteF(stream, depth, "} ABQ $P\n", (WriteFP)abq, NULL); if(res != ResOK) return res; diff --git a/mps/code/arena.c b/mps/code/arena.c index b344b3a6129..fa70084f194 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -47,7 +47,7 @@ static Res ArenaTrivDescribe(Arena arena, mps_lib_FILE *stream, Count depth) * subclass describe method should avoid invoking * ARENA_SUPERCLASS()->describe. RHSK 2007-04-27. */ - return WriteF(depth, stream, + return WriteF(stream, depth, " No class-specific description available.\n", NULL); } @@ -436,14 +436,14 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) if (!TESTT(Arena, arena)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, "Arena $P {\n", (WriteFP)arena, + res = WriteF(stream, depth, "Arena $P {\n", (WriteFP)arena, " class $P (\"$S\")\n", (WriteFP)arena->class, arena->class->name, NULL); if (res != ResOK) return res; if (arena->poolReady) { - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "controlPool $P\n", (WriteFP)&arena->controlPoolStruct, NULL); if (res != ResOK) return res; @@ -451,14 +451,14 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) /* Note: this Describe clause calls a function */ reserved = ArenaReserved(arena); - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "reserved $W <-- " "total size of address-space reserved\n", (WriteFW)reserved, NULL); if (res != ResOK) return res; - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "committed $W <-- " "total bytes currently stored (in RAM or swap)\n", (WriteFW)arena->committed, @@ -470,7 +470,7 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) NULL); if (res != ResOK) return res; - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "droppedMessages $U$S\n", (WriteFU)arena->droppedMessages, (arena->droppedMessages == 0 ? "" : " -- MESSAGES DROPPED!"), NULL); @@ -479,14 +479,14 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) res = (*arena->class->describe)(arena, stream, depth); if (res != ResOK) return res; - res = WriteF(depth + 2, stream, "Globals {\n", NULL); + res = WriteF(stream, depth + 2, "Globals {\n", NULL); if (res != ResOK) return res; res = GlobalsDescribe(ArenaGlobals(arena), stream, depth + 4); if (res != ResOK) return res; - res = WriteF(depth + 2, stream, "} Globals\n", NULL); + res = WriteF(stream, depth + 2, "} Globals\n", NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "} Arena $P ($U)\n", (WriteFP)arena, (WriteFU)arena->serial, NULL); @@ -515,7 +515,7 @@ Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth) size = ArenaAlign(arena); if (TractBase(tract) > oldLimit) { - res = WriteF(depth, stream, + res = WriteF(stream, depth, "[$P, $P) $W $U ---\n", (WriteFP)oldLimit, (WriteFP)base, (WriteFW)AddrOffset(oldLimit, base), @@ -524,7 +524,7 @@ Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "[$P, $P) $W $U $P ($S)\n", (WriteFP)base, (WriteFP)limit, (WriteFW)size, (WriteFW)size, diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 4b74b2ac68d..08f68b6fb75 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -204,7 +204,7 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth) * */ - res = WriteF(depth, stream, + res = WriteF(stream, depth, " spareSize: $U\n", (WriteFU)vmArena->spareSize, NULL); if(res != ResOK) diff --git a/mps/code/buffer.c b/mps/code/buffer.c index 13d223ca7f6..bb5ef1d995b 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -153,7 +153,7 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth) if (!TESTT(Buffer, buffer)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Buffer $P ($U) {\n", (WriteFP)buffer, (WriteFU)buffer->serial, " class $P (\"$S\")\n", @@ -181,7 +181,7 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth) res = buffer->class->describe(buffer, stream, depth + 2); if (res != ResOK) return res; - res = WriteF(depth, stream, "} Buffer $P ($U)\n", + res = WriteF(stream, depth, "} Buffer $P ($U)\n", (WriteFP)buffer, (WriteFU)buffer->serial, NULL); return res; @@ -1439,7 +1439,7 @@ static Res segBufDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth) res = super->describe(buffer, stream, depth); if (res != ResOK) return res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Seg $P\n", (WriteFP)segbuf->seg, "rankSet $U\n", (WriteFU)segbuf->rankSet, NULL); diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 942f1b651c8..c7facb9a98f 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -660,7 +660,7 @@ static Res cbsBlockDescribe(CBSBlock block, mps_lib_FILE *stream) if (stream == NULL) return ResFAIL; - res = WriteF(0, stream, + res = WriteF(stream, 0, "[$P,$P) {$U, $B}", (WriteFP)block->base, (WriteFP)block->limit, @@ -1064,7 +1064,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "CBS $P {\n", (WriteFP)cbs, " alignment: $U\n", (WriteFU)cbs->alignment, " blockPool: $P\n", (WriteFP)cbsBlockPool(cbs), @@ -1080,7 +1080,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream, Count depth) &cbsSplayNodeDescribe); if (res != ResOK) return res; - res = WriteF(depth, stream, "} CBS $P\n", (WriteFP)cbs, NULL); + res = WriteF(stream, depth, "} CBS $P\n", (WriteFP)cbs, NULL); return res; } diff --git a/mps/code/clock.h b/mps/code/clock.h index 9b0dc7d6203..2766ccd724c 100644 --- a/mps/code/clock.h +++ b/mps/code/clock.h @@ -66,8 +66,8 @@ typedef union EventClockUnion { (*(EventClockUnion *)&(clock)).half.high, \ (*(EventClockUnion *)&(clock)).half.low) -#define EVENT_CLOCK_WRITE(depth, stream, clock) \ - WriteF(depth, stream, "$W$W", \ +#define EVENT_CLOCK_WRITE(stream, depth, clock) \ + WriteF(stream, depth, "$W$W", \ (*(EventClockUnion *)&(clock)).half.high, \ (*(EventClockUnion *)&(clock)).half.low, \ NULL) @@ -86,8 +86,8 @@ typedef union EventClockUnion { #endif -#define EVENT_CLOCK_WRITE(depth, stream, clock) \ - WriteF(depth, stream, "$W", (WriteFW)(clock), NULL) +#define EVENT_CLOCK_WRITE(stream, depth, clock) \ + WriteF(stream, depth, "$W", (WriteFW)(clock), NULL) #endif @@ -136,8 +136,8 @@ __extension__ typedef unsigned long long EventClock; (unsigned long)((clock) >> 32), \ (unsigned long)((clock) & 0xffffffff)) -#define EVENT_CLOCK_WRITE(depth, stream, clock) \ - WriteF(depth, stream, "$W$W", (WriteFW)((clock) >> 32), (WriteFW)clock, NULL) +#define EVENT_CLOCK_WRITE(stream, depth, clock) \ + WriteF(stream, depth, "$W$W", (WriteFW)((clock) >> 32), (WriteFW)clock, NULL) #endif /* Intel, GCC or Clang */ @@ -154,8 +154,8 @@ typedef mps_clock_t EventClock; #define EVENT_CLOCK_PRINT(stream, clock) \ fprintf(stream, "%lu", (unsigned long)clock) -#define EVENT_CLOCK_WRITE(depth, stream, clock) \ - WriteF(depth, stream, "$W", (WriteFW)clock, NULL) +#define EVENT_CLOCK_WRITE(stream, depth, clock) \ + WriteF(stream, depth, "$W", (WriteFW)clock, NULL) #endif diff --git a/mps/code/event.c b/mps/code/event.c index 54be8cba89f..d2b182d7377 100644 --- a/mps/code/event.c +++ b/mps/code/event.c @@ -329,14 +329,14 @@ Res EventDescribe(Event event, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Event $P {\n", (WriteFP)event, " code $U\n", (WriteFU)event->any.code, " clock ", NULL); if (res != ResOK) return res; - res = EVENT_CLOCK_WRITE(depth, stream, event->any.clock); + res = EVENT_CLOCK_WRITE(stream, depth, event->any.clock); if (res != ResOK) return res; - res = WriteF(depth, stream, "\n size $U\n", (WriteFU)event->any.size, NULL); + res = WriteF(stream, depth, "\n size $U\n", (WriteFU)event->any.size, NULL); if (res != ResOK) return res; switch (event->any.code) { @@ -347,7 +347,7 @@ Res EventDescribe(Event event, mps_lib_FILE *stream, Count depth) #define EVENT_DESC(X, name, _code, always, kind) \ case _code: \ - res = WriteF(depth, stream, \ + res = WriteF(stream, depth, \ " event \"$S\"", (WriteFS)#name, \ EVENT_##name##_PARAMS(EVENT_DESC_PARAM, name) \ NULL); \ @@ -357,13 +357,13 @@ Res EventDescribe(Event event, mps_lib_FILE *stream, Count depth) EVENT_LIST(EVENT_DESC, X) default: - res = WriteF(depth, stream, " event type unknown", NULL); + res = WriteF(stream, depth, " event type unknown", NULL); if (res != ResOK) return res; /* TODO: Hexdump unknown event contents. */ break; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "\n} Event $P\n", (WriteFP)event, NULL); return res; @@ -377,7 +377,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) if (event == NULL) return ResFAIL; if (stream == NULL) return ResFAIL; - res = EVENT_CLOCK_WRITE(0, stream, event->any.clock); + res = EVENT_CLOCK_WRITE(stream, 0, event->any.clock); if (res != ResOK) return res; @@ -388,7 +388,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) #define EVENT_WRITE(X, name, code, always, kind) \ case code: \ - res = WriteF(0, stream, " $S", #name, \ + res = WriteF(stream, 0, " $S", #name, \ EVENT_##name##_PARAMS(EVENT_WRITE_PARAM, name) \ NULL); \ if (res != ResOK) return res; \ @@ -396,7 +396,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) EVENT_LIST(EVENT_WRITE, X) default: - res = WriteF(0, stream, " ", event->any.code, NULL); + res = WriteF(stream, 0, " ", event->any.code, NULL); if (res != ResOK) return res; /* TODO: Hexdump unknown event contents. */ break; @@ -416,7 +416,7 @@ void EventDump(mps_lib_FILE *stream) /* This can happen if there's a backtrace very early in the life of the MPS, and will cause an access violation if we continue. */ if (!eventInited) { - (void)WriteF(0, stream, "No events\n", NULL); + (void)WriteF(stream, 0, "No events\n", NULL); return; } @@ -427,7 +427,7 @@ void EventDump(mps_lib_FILE *stream) /* Try to keep going even if there's an error, because this is used as a backtrace and we'll take what we can get. */ (void)EventWrite(event, stream); - (void)WriteF(0, stream, "\n", NULL); + (void)WriteF(stream, 0, "\n", NULL); } } } diff --git a/mps/code/format.c b/mps/code/format.c index 92f34b3de4c..965ca61c306 100644 --- a/mps/code/format.c +++ b/mps/code/format.c @@ -197,7 +197,7 @@ Res FormatDescribe(Format format, mps_lib_FILE *stream, Count depth) { Res res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Format $P ($U) {\n", (WriteFP)format, (WriteFU)format->serial, " arena $P ($U)\n", (WriteFP)format->arena, (WriteFU)format->arena->serial, diff --git a/mps/code/freelist.c b/mps/code/freelist.c index 814039a8723..f51f44fbceb 100644 --- a/mps/code/freelist.c +++ b/mps/code/freelist.c @@ -557,7 +557,7 @@ static Bool freelistDescribeIterateMethod(Bool *deleteReturn, Range range, AVERT(Range, range); AVER(stream != NULL); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "[$P,", (WriteFP)RangeBase(range), "$P)", (WriteFP)RangeLimit(range), " {$U}\n", (WriteFU)RangeSize(range), @@ -575,7 +575,7 @@ Res FreelistDescribe(Freelist fl, mps_lib_FILE *stream, Count depth) if (!TESTT(Freelist, fl)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Freelist $P {\n", (WriteFP)fl, " alignment = $U\n", (WriteFU)fl->alignment, " listSize = $U\n", (WriteFU)fl->listSize, @@ -583,7 +583,7 @@ Res FreelistDescribe(Freelist fl, mps_lib_FILE *stream, Count depth) FreelistIterate(fl, freelistDescribeIterateMethod, stream, depth + 2); - res = WriteF(depth, stream, "} Freelist $P\n", (WriteFP)fl, NULL); + res = WriteF(stream, depth, "} Freelist $P\n", (WriteFP)fl, NULL); return res; } diff --git a/mps/code/global.c b/mps/code/global.c index ec2c8e0a80f..0b8f331b101 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -1047,7 +1047,7 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResFAIL; arena = GlobalsArena(arenaGlobals); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "mpsVersion $S\n", arenaGlobals->mpsVersionString, "lock $P\n", (WriteFP)arenaGlobals->lock, "pollThreshold $U kB\n", @@ -1079,13 +1079,13 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; for(i=0; i < LDHistoryLENGTH; ++ i) { - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "[$U] = $B\n", i, arena->history[i], NULL); if (res != ResOK) return res; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "} history\n", "suspended $S\n", arena->suspended ? "YES" : "NO", "shDepth $U\n", arena->shDepth, diff --git a/mps/code/locus.c b/mps/code/locus.c index c5baf0f542b..a6017a6b09c 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -136,7 +136,7 @@ Res GenDescDescribe(GenDesc gen, mps_lib_FILE *stream, Count depth) if (!TESTT(GenDesc, gen)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "GenDesc $P {\n", (WriteFP)gen, " zones $B\n", (WriteFB)gen->zones, " capacity $U\n", (WriteFU)gen->capacity, @@ -151,7 +151,7 @@ Res GenDescDescribe(GenDesc gen, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(depth, stream, "} GenDesc $P\n", (WriteFP)gen, NULL); + res = WriteF(stream, depth, "} GenDesc $P\n", (WriteFP)gen, NULL); return res; } @@ -451,7 +451,7 @@ Res ChainDescribe(Chain chain, mps_lib_FILE *stream, Count depth) if (!TESTT(Chain, chain)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Chain $P {\n", (WriteFP)chain, " arena $P\n", (WriteFP)chain->arena, " activeTraces $B\n", (WriteFB)chain->activeTraces, @@ -463,7 +463,7 @@ Res ChainDescribe(Chain chain, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "} Chain $P\n", (WriteFP)chain, NULL); return res; @@ -532,7 +532,7 @@ Res PoolGenDescribe(PoolGen pgen, mps_lib_FILE *stream, Count depth) if (!TESTT(PoolGen, pgen)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "PoolGen $P ($U) {\n", (WriteFP)pgen, (WriteFU)pgen->nr, "pool $P ($U) \"$S\"\n", (WriteFP)pgen->pool, (WriteFU)pgen->pool->serial, diff --git a/mps/code/meter.c b/mps/code/meter.c index debf0ee3fcc..e112986119d 100644 --- a/mps/code/meter.c +++ b/mps/code/meter.c @@ -68,7 +68,7 @@ Res MeterWrite(Meter meter, mps_lib_FILE *stream, Count depth) { Res res = ResOK; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "meter \"$S\" {", meter->name, "count: $U", meter->count, NULL); @@ -77,7 +77,7 @@ Res MeterWrite(Meter meter, mps_lib_FILE *stream, Count depth) if (meter->count > 0) { double mean = meter->total / (double)meter->count; - res = WriteF(0, stream, + res = WriteF(stream, 0, ", total: $D", meter->total, ", max: $U", meter->max, ", min: $U", meter->min, @@ -87,7 +87,7 @@ Res MeterWrite(Meter meter, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(0, stream, "}\n", NULL); + res = WriteF(stream, 0, "}\n", NULL); return res; } diff --git a/mps/code/mpm.c b/mps/code/mpm.c index 5de82a1f022..35bd33ea6f0 100644 --- a/mps/code/mpm.c +++ b/mps/code/mpm.c @@ -430,28 +430,28 @@ static Res WriteDouble(mps_lib_FILE *stream, double d) * .writef.check: See .check.writef. */ -Res WriteF(Count depth, mps_lib_FILE *stream, ...) +Res WriteF(mps_lib_FILE *stream, Count depth, ...) { Res res; va_list args; - va_start(args, stream); - res = WriteF_v(depth, stream, args); + va_start(args, depth); + res = WriteF_v(stream, depth, args); va_end(args); return res; } -Res WriteF_v(Count depth, mps_lib_FILE *stream, va_list args) +Res WriteF_v(mps_lib_FILE *stream, Count depth, va_list args) { const char *firstformat; Res res; firstformat = va_arg(args, const char *); - res = WriteF_firstformat_v(depth, stream, firstformat, args); + res = WriteF_firstformat_v(stream, depth, firstformat, args); return res; } -Res WriteF_firstformat_v(Count depth, mps_lib_FILE *stream, +Res WriteF_firstformat_v(mps_lib_FILE *stream, Count depth, const char *firstformat, va_list args) { const char *format; diff --git a/mps/code/mpm.h b/mps/code/mpm.h index c41e3b2e61d..f912718cc53 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -153,9 +153,9 @@ extern Bool (WordIsP2)(Word word); /* Formatted Output -- see , */ -extern Res WriteF(Count depth, mps_lib_FILE *stream, ...); -extern Res WriteF_v(Count depth, mps_lib_FILE *stream, va_list args); -extern Res WriteF_firstformat_v(Count depth, mps_lib_FILE *stream, +extern Res WriteF(mps_lib_FILE *stream, Count depth, ...); +extern Res WriteF_v(mps_lib_FILE *stream, Count depth, va_list args); +extern Res WriteF_firstformat_v(mps_lib_FILE *stream, Count depth, const char *firstformat, va_list args); diff --git a/mps/code/nailboard.c b/mps/code/nailboard.c index 1167a838a6c..f8104371efd 100644 --- a/mps/code/nailboard.c +++ b/mps/code/nailboard.c @@ -413,7 +413,7 @@ Res NailboardDescribe(Nailboard board, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Nailboard $P\n{\n", (WriteFP)board, " base: $P\n", (WriteFP)RangeBase(&board->range), " limit: $P\n", (WriteFP)RangeLimit(&board->range), @@ -427,21 +427,21 @@ Res NailboardDescribe(Nailboard board, mps_lib_FILE *stream, Count depth) for(i = 0; i < board->levels; ++i) { Count levelNails = nailboardLevelBits(nailboardNails(board), i); Count resetNails = BTCountResRange(board->level[i], 0, levelNails); - res = WriteF(depth + 2, stream, "Level $U ($U bits, $U set): ", + res = WriteF(stream, depth + 2, "Level $U ($U bits, $U set): ", i, levelNails, levelNails - resetNails, NULL); if (res != ResOK) return res; for (j = 0; j < levelNails; ++j) { char c = BTGet(board->level[i], j) ? '*' : '.'; - res = WriteF(0, stream, "$C", c, NULL); + res = WriteF(stream, 0, "$C", c, NULL); if (res != ResOK) return res; } - res = WriteF(0, stream, "\n", NULL); + res = WriteF(stream, 0, "\n", NULL); if (res != ResOK) return res; } - res = WriteF(depth, stream, "} Nailboard $P\n", (WriteFP)board, NULL); + res = WriteF(stream, depth, "} Nailboard $P\n", (WriteFP)board, NULL); if (res != ResOK) return res; diff --git a/mps/code/pool.c b/mps/code/pool.c index ed50c5c0933..ec125b7bec0 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -530,7 +530,7 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (!TESTT(Pool, pool)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Pool $P ($U) {\n", (WriteFP)pool, (WriteFU)pool->serial, " class $P (\"$S\")\n", (WriteFP)pool->class, pool->class->name, @@ -543,7 +543,7 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth) res = FormatDescribe(pool->format, stream, depth + 2); if (res != ResOK) return res; } - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "fillMutatorSize $UKb\n", (WriteFU)(pool->fillMutatorSize / 1024), "emptyMutatorSize $UKb\n", @@ -564,7 +564,7 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "} Pool $P ($U)\n", (WriteFP)pool, (WriteFU)pool->serial, NULL); if (res != ResOK) return res; diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index ee20a829f77..cc0eb6e838c 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c @@ -315,7 +315,7 @@ Res PoolTrivDescribe(Pool pool, mps_lib_FILE *stream, Count depth) { AVERT(Pool, pool); AVER(stream != NULL); - return WriteF(depth, stream, + return WriteF(stream, depth, "No class-specific description available.\n", NULL); } diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 5777b95c72b..05dea8bc83c 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -258,7 +258,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) p = AddrAdd(base, pool->format->headerSize); limit = SegLimit(seg); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "AMC seg $P [$A,$A){\n", (WriteFP)seg, (WriteFA)base, (WriteFA)limit, NULL); @@ -266,16 +266,16 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) return res; if(amcSegHasNailboard(seg)) { - res = WriteF(depth + 2, stream, "Boarded\n", NULL); + res = WriteF(stream, depth + 2, "Boarded\n", NULL); } else if(SegNailed(seg) == TraceSetEMPTY) { - res = WriteF(depth + 2, stream, "Mobile\n", NULL); + res = WriteF(stream, depth + 2, "Mobile\n", NULL); } else { - res = WriteF(depth + 2, stream, "Stuck\n", NULL); + res = WriteF(stream, depth + 2, "Stuck\n", NULL); } if(res != ResOK) return res; - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "Map: *===:object @+++:nails bbbb:buffer\n", NULL); if(res != ResOK) return res; @@ -289,7 +289,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) Addr j; char c; - res = WriteF(depth + 2, stream, "$A ", i, NULL); + res = WriteF(stream, depth + 2, "$A ", i, NULL); if(res != ResOK) return res; @@ -309,22 +309,22 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) c = (nailed ? '+' : '='); } } - res = WriteF(0, stream, "$C", c, NULL); + res = WriteF(stream, 0, "$C", c, NULL); if(res != ResOK) return res; } - res = WriteF(0, stream, "\n", NULL); + res = WriteF(stream, 0, "\n", NULL); if(res != ResOK) return res; } AMCSegSketch(seg, abzSketch, NELEMS(abzSketch)); - res = WriteF(depth + 2, stream, "Sketch: $S\n", (WriteFS)abzSketch, NULL); + res = WriteF(stream, depth + 2, "Sketch: $S\n", (WriteFS)abzSketch, NULL); if(res != ResOK) return res; - res = WriteF(depth, stream, "} AMC Seg $P\n", (WriteFP)seg, NULL); + res = WriteF(stream, depth, "} AMC Seg $P\n", (WriteFP)seg, NULL); if(res != ResOK) return res; @@ -715,7 +715,7 @@ static Res amcGenDescribe(amcGen gen, mps_lib_FILE *stream, Count depth) if(!TESTT(amcGen, gen)) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "amcGen $P ($U) {\n", (WriteFP)gen, (WriteFU)amcGenNr(gen), " buffer $P\n", gen->forward, @@ -2278,7 +2278,7 @@ static Res AMCDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if(stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, (amc->rankSet == RankSetEMPTY) ? "AMCZ" : "AMC", " $P {\n", (WriteFP)amc, " pool $P ($U)\n", (WriteFP)AMC2Pool(amc), (WriteFU)AMC2Pool(amc)->serial, @@ -2297,7 +2297,7 @@ static Res AMCDescribe(Pool pool, mps_lib_FILE *stream, Count depth) rampmode = "unknown ramp mode"; break; } - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, rampmode, " ($U)\n", (WriteFU)amc->rampCount, NULL); if(res != ResOK) @@ -2320,7 +2320,7 @@ static Res AMCDescribe(Pool pool, mps_lib_FILE *stream, Count depth) } } - res = WriteF(depth, stream, "} AMC $P\n", (WriteFP)amc, NULL); + res = WriteF(stream, depth, "} AMC $P\n", (WriteFP)amc, NULL); if(res != ResOK) return res; diff --git a/mps/code/poolams.c b/mps/code/poolams.c index fe3d8d36db3..e85f06991ed 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -525,7 +525,7 @@ failCreateTablesLo: BEGIN \ if ((buffer) != NULL \ && (i) == AMS_ADDR_INDEX(seg, accessor(buffer))) { \ - Res _res = WriteF(0, stream, char, NULL); \ + Res _res = WriteF(stream, 0, char, NULL); \ if (_res != ResOK) return _res; \ } \ END @@ -550,21 +550,21 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) buffer = SegBuffer(seg); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "AMS $P\n", (WriteFP)amsseg->ams, "grains $W\n", (WriteFW)amsseg->grains, NULL); if (res != ResOK) return res; if (amsseg->allocTableInUse) - res = WriteF(depth, stream, + res = WriteF(stream, depth, "alloctable $P\n", (WriteFP)amsseg->allocTable, NULL); else - res = WriteF(depth, stream, + res = WriteF(stream, depth, "firstFree $W\n", (WriteFW)amsseg->firstFree, NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "tables: nongrey $P, nonwhite $P\n", (WriteFP)amsseg->nongreyTable, (WriteFP)amsseg->nonwhiteTable, @@ -576,9 +576,9 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) char c = 0; if (i % 64 == 0) { - res = WriteF(0, stream, "\n", NULL); + res = WriteF(stream, 0, "\n", NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, " ", NULL); + res = WriteF(stream, depth, " ", NULL); if (res != ResOK) return res; } @@ -600,7 +600,7 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) c = '.'; } else c = ' '; - res = WriteF(0, stream, "$C", c, NULL); + res = WriteF(stream, 0, "$C", c, NULL); if (res != ResOK) return res; @@ -1658,7 +1658,7 @@ static Res AMSDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (!TESTT(AMS, ams)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "AMS $P {\n", (WriteFP)ams, " pool $P ($U)\n", (WriteFP)pool, (WriteFU)pool->serial, @@ -1670,7 +1670,7 @@ static Res AMSDescribe(Pool pool, mps_lib_FILE *stream, Count depth) NULL); if (res != ResOK) return res; - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "segments: * black + grey - white . alloc ! bad\n" "buffers: [ base < scan limit | init > alloc ] limit\n", NULL); @@ -1682,7 +1682,7 @@ static Res AMSDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; } - res = WriteF(depth, stream, "} AMS $P\n",(WriteFP)ams, NULL); + res = WriteF(stream, depth, "} AMS $P\n",(WriteFP)ams, NULL); if (res != ResOK) return res; diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index 9b3e469e28a..baf7c2f5ee4 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c @@ -322,7 +322,7 @@ static Res MFSDescribe(Pool pool, mps_lib_FILE *stream, Count depth) AVER(stream != NULL); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "unrounded unit size $W\n", (WriteFW)mfs->unroundedUnitSize, "unit size $W\n", (WriteFW)mfs->unitSize, "extent size $W\n", (WriteFW)mfs->extendBy, diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index add1d013db8..bc7762e9091 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -806,13 +806,13 @@ static Res MRGDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (stream == NULL) return ResFAIL; arena = PoolArena(pool); - res = WriteF(depth, stream, " extendBy $W\n", mrg->extendBy, NULL); + res = WriteF(stream, depth, " extendBy $W\n", mrg->extendBy, NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, " Entry queue:\n", NULL); + res = WriteF(stream, depth, " Entry queue:\n", NULL); if (res != ResOK) return res; RING_FOR(node, &mrg->entryRing, nextNode) { refPart = MRGRefPartOfLink(linkOfRing(node), arena); - res = WriteF(depth, stream, " at $A Ref $A\n", + res = WriteF(stream, depth, " at $A Ref $A\n", (WriteFA)refPart, (WriteFA)MRGRefPartRef(arena, refPart), NULL); if (res != ResOK) return res; diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 7f181a405b0..6af3ae68724 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -687,7 +687,7 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if(!TESTT(MV, mv)) return ResFAIL; if(stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "blockPool $P ($U)\n", (WriteFP)mvBlockPool(mv), (WriteFU)mvBlockPool(mv)->serial, "spanPool $P ($U)\n", @@ -707,10 +707,10 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth) Addr i, j; MVBlock block; span = RING_ELT(MVSpan, spans, node); - res = WriteF(depth, stream, "MVSpan $P {\n", (WriteFP)span, NULL); + res = WriteF(stream, depth, "MVSpan $P {\n", (WriteFP)span, NULL); if(res != ResOK) return res; - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "span $P\n", (WriteFP)span, "tract $P\n", (WriteFP)span->tract, "space $W\n", (WriteFW)span->space, @@ -720,15 +720,15 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if(res != ResOK) return res; if (span->largestKnown) /* .design.largest */ - res = WriteF(0, stream, "$W\n", (WriteFW)span->largest, NULL); + res = WriteF(stream, 0, "$W\n", (WriteFW)span->largest, NULL); else - res = WriteF(0, stream, "unknown\n", NULL); + res = WriteF(stream, 0, "unknown\n", NULL); if(res != ResOK) return res; block = span->blocks; for(i = span->base.base; i < span->limit.limit; i = AddrAdd(i, length)) { - res = WriteF(depth + 2, stream, "$A ", i, NULL); + res = WriteF(stream, depth + 2, "$A ", i, NULL); if(res != ResOK) return res; for(j = i; @@ -751,13 +751,13 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth) c = ']'; else /* j > block->base && j < block->limit */ c = '='; - res = WriteF(0, stream, "$C", c, NULL); + res = WriteF(stream, 0, "$C", c, NULL); if(res != ResOK) return res; } - res = WriteF(0, stream, "\n", NULL); + res = WriteF(stream, 0, "\n", NULL); if(res != ResOK) return res; } - res = WriteF(depth, stream, "} MVSpan $P\n", (WriteFP)span, NULL); + res = WriteF(stream, depth, "} MVSpan $P\n", (WriteFP)span, NULL); if(res != ResOK) return res; } diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index 5a457b0612d..6dd86183205 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -1013,7 +1013,7 @@ static Res MVTDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (!TESTT(MVT, mvt)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "MVT $P {\n", (WriteFP)mvt, " minSize: $U\n", (WriteFU)mvt->minSize, " meanSize: $U\n", (WriteFU)mvt->meanSize, @@ -1075,7 +1075,7 @@ static Res MVTDescribe(Pool pool, mps_lib_FILE *stream, Count depth) METER_WRITE(mvt->exceptionSplinters, stream, depth + 2); METER_WRITE(mvt->exceptionReturns, stream, depth + 2); - res = WriteF(depth, stream, "} MVT $P\n", (WriteFP)mvt, NULL); + res = WriteF(stream, depth, "} MVT $P\n", (WriteFP)mvt, NULL); return res; } diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index ec5ecb86e54..b5f6e942ba4 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -679,7 +679,7 @@ static Res MVFFDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (!TESTT(MVFF, mvff)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "MVFF $P {\n", (WriteFP)mvff, " pool $P ($U)\n", (WriteFP)pool, (WriteFU)pool->serial, @@ -699,7 +699,7 @@ static Res MVFFDescribe(Pool pool, mps_lib_FILE *stream, Count depth) if (res != ResOK) return res; - res = WriteF(depth, stream, "} MVFF $P\n", (WriteFP)mvff, NULL); + res = WriteF(stream, depth, "} MVFF $P\n", (WriteFP)mvff, NULL); return res; } diff --git a/mps/code/range.c b/mps/code/range.c index 41ba26216b6..222e335f95b 100644 --- a/mps/code/range.c +++ b/mps/code/range.c @@ -46,7 +46,7 @@ Res RangeDescribe(Range range, mps_lib_FILE *stream, Count depth) AVERT(Range, range); AVER(stream != NULL); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Range $P\n{\n", (WriteFP)range, " base: $P\n", (WriteFP)RangeBase(range), " limit: $P\n", (WriteFP)RangeLimit(range), diff --git a/mps/code/root.c b/mps/code/root.c index a3ed0c80b7e..4732af15a62 100644 --- a/mps/code/root.c +++ b/mps/code/root.c @@ -587,7 +587,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) if (!TESTT(Root, root)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Root $P ($U) {\n", (WriteFP)root, (WriteFU)root->serial, " arena $P ($U)\n", (WriteFP)root->arena, (WriteFU)root->arena->serial, @@ -599,7 +599,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) switch(root->var) { case RootTABLE: - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "table base $A limit $A\n", root->the.table.base, root->the.table.limit, NULL); @@ -607,7 +607,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) break; case RootTABLE_MASKED: - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "table base $A limit $A mask $B\n", root->the.tableMasked.base, root->the.tableMasked.limit, root->the.tableMasked.mask, @@ -616,7 +616,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) break; case RootFUN: - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "scan function $F\n", (WriteFF)root->the.fun.scan, "environment p $P s $W\n", root->the.fun.p, (WriteFW)root->the.fun.s, @@ -625,7 +625,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) break; case RootREG: - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "thread $P\n", (WriteFP)root->the.reg.thread, "environment p $P", root->the.reg.p, NULL); @@ -633,7 +633,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) break; case RootFMT: - res = WriteF(depth + 2, stream, + res = WriteF(stream, depth + 2, "scan function $F\n", (WriteFF)root->the.fmt.scan, "format base $A limit $A\n", root->the.fmt.base, root->the.fmt.limit, @@ -645,7 +645,7 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) NOTREACHED; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "} Root $P ($U)\n", (WriteFP)root, (WriteFU)root->serial, NULL); if (res != ResOK) return res; diff --git a/mps/code/seg.c b/mps/code/seg.c index 7e022362b30..f55a07334af 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -365,7 +365,7 @@ Res SegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) pool = SegPool(seg); - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Segment $P [$A,$A) {\n", (WriteFP)seg, (WriteFA)SegBase(seg), (WriteFA)SegLimit(seg), " class $P (\"$S\")\n", @@ -378,10 +378,10 @@ Res SegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) res = seg->class->describe(seg, stream, depth + 2); if (res != ResOK) return res; - res = WriteF(0, stream, "\n", NULL); + res = WriteF(stream, 0, "\n", NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, "} Segment $P\n", (WriteFP)seg, NULL); + res = WriteF(stream, depth, "} Segment $P\n", (WriteFP)seg, NULL); return res; } @@ -1032,7 +1032,7 @@ static Res segTrivDescribe(Seg seg, mps_lib_FILE *stream, Count depth) if (!TESTT(Seg, seg)) return ResFAIL; if (stream == NULL) return ResFAIL; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "shield depth $U\n", (WriteFU)seg->depth, "protection mode: ", (SegPM(seg) & AccessREAD) ? "" : "!", "READ", " ", @@ -1600,13 +1600,13 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth) res = super->describe(seg, stream, depth); if (res != ResOK) return res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "summary $W\n", (WriteFW)gcseg->summary, NULL); if (res != ResOK) return res; if (gcseg->buffer == NULL) { - res = WriteF(depth, stream, "buffer: NULL\n", NULL); + res = WriteF(stream, depth, "buffer: NULL\n", NULL); } else { res = BufferDescribe(gcseg->buffer, stream, depth); } diff --git a/mps/code/splay.c b/mps/code/splay.c index 4325d8b2c56..0e5c1ad6edb 100644 --- a/mps/code/splay.c +++ b/mps/code/splay.c @@ -1015,14 +1015,14 @@ static Res SplayNodeDescribe(Tree node, mps_lib_FILE *stream, /* stream and nodeDescribe checked by SplayTreeDescribe */ #endif - res = WriteF(0, stream, "( ", NULL); + res = WriteF(stream, 0, "( ", NULL); if (res != ResOK) return res; if (TreeHasLeft(node)) { res = SplayNodeDescribe(TreeLeft(node), stream, nodeDescribe); if (res != ResOK) return res; - res = WriteF(0, stream, " / ", NULL); + res = WriteF(stream, 0, " / ", NULL); if (res != ResOK) return res; } @@ -1030,14 +1030,14 @@ static Res SplayNodeDescribe(Tree node, mps_lib_FILE *stream, if (res != ResOK) return res; if (TreeHasRight(node)) { - res = WriteF(0, stream, " \\ ", NULL); + res = WriteF(stream, 0, " \\ ", NULL); if (res != ResOK) return res; res = SplayNodeDescribe(TreeRight(node), stream, nodeDescribe); if (res != ResOK) return res; } - res = WriteF(0, stream, " )", NULL); + res = WriteF(stream, 0, " )", NULL); if (res != ResOK) return res; return ResOK; @@ -1335,20 +1335,20 @@ Res SplayTreeDescribe(SplayTree splay, mps_lib_FILE *stream, Count depth, if (!FUNCHECK(nodeDescribe)) return ResFAIL; #endif - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Splay $P {\n", (WriteFP)splay, " compare $F\n", (WriteFF)splay->compare, NULL); if (res != ResOK) return res; if (SplayTreeRoot(splay) != TreeEMPTY) { - res = WriteF(depth, stream, " tree ", NULL); + res = WriteF(stream, depth, " tree ", NULL); if (res != ResOK) return res; res = SplayNodeDescribe(SplayTreeRoot(splay), stream, nodeDescribe); if (res != ResOK) return res; } - res = WriteF(depth, stream, "\n} Splay $P\n", (WriteFP)splay, NULL); + res = WriteF(stream, depth, "\n} Splay $P\n", (WriteFP)splay, NULL); return res; } diff --git a/mps/code/than.c b/mps/code/than.c index 5ce14031bd9..0ee0a3cc363 100644 --- a/mps/code/than.c +++ b/mps/code/than.c @@ -132,7 +132,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth) { Res res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Thread $P ($U) {\n", (WriteFP)thread, (WriteFU)thread->serial, " arena $P ($U)\n", (WriteFP)thread->arena, (WriteFU)thread->arena->serial, diff --git a/mps/code/thix.c b/mps/code/thix.c index c4a7f9ad71c..cc6a3b61219 100644 --- a/mps/code/thix.c +++ b/mps/code/thix.c @@ -276,7 +276,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth) { Res res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Thread $P ($U) {\n", (WriteFP)thread, (WriteFU)thread->serial, " arena $P ($U)\n", (WriteFP)thread->arena, (WriteFU)thread->arena->serial, diff --git a/mps/code/thw3.c b/mps/code/thw3.c index 730d2d00352..96af1f83f6b 100644 --- a/mps/code/thw3.c +++ b/mps/code/thw3.c @@ -216,7 +216,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth) { Res res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Thread $P ($U) {\n", (WriteFP)thread, (WriteFU)thread->serial, " arena $P ($U)\n", (WriteFP)thread->arena, (WriteFU)thread->arena->serial, diff --git a/mps/code/thxc.c b/mps/code/thxc.c index 99468e1158d..3160bec9caf 100644 --- a/mps/code/thxc.c +++ b/mps/code/thxc.c @@ -252,7 +252,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth) { Res res; - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Thread $P ($U) {\n", (WriteFP)thread, (WriteFU)thread->serial, " arena $P ($U)\n", (WriteFP)thread->arena, (WriteFU)thread->arena->serial, diff --git a/mps/code/trace.c b/mps/code/trace.c index 0083446a3f7..8ea1b1bf0fd 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1918,7 +1918,7 @@ Res TraceDescribe(Trace trace, mps_lib_FILE *stream, Count depth) default: state = "unknown"; break; } - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Trace $P ($U) {\n", (WriteFP)trace, (WriteFU)trace->ti, "arena $P ($U)\n", (WriteFP)trace->arena, (WriteFU)trace->arena->serial, @@ -1941,7 +1941,7 @@ Res TraceDescribe(Trace trace, mps_lib_FILE *stream, Count depth) NULL); if (res != ResOK) return res; - res = WriteF(depth, stream, "} Trace $P\n", (WriteFP)trace, NULL); + res = WriteF(stream, depth, "} Trace $P\n", (WriteFP)trace, NULL); return res; } diff --git a/mps/design/writef.txt b/mps/design/writef.txt index ef39175b56d..bfb2a131e26 100644 --- a/mps/design/writef.txt +++ b/mps/design/writef.txt @@ -38,7 +38,7 @@ _`.writef`: Our output requirements are few, so the code is short. The only output function which should be used in the rest of the MPM is ``WriteF()``. -``Res WriteF(Count depth, mps_lib_FILE *stream, ...)`` +``Res WriteF(mps_lib_FILE *stream, Count depth, ...)`` If ``depth`` is greater than zero, then the first format character, and each format character after a newline, is preceded by ``depth`` @@ -48,7 +48,7 @@ spaces. insert into the output, followed by another format string, more items, and so on, and finally a ``NULL`` format string. For example:: - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Hello: $A\n", address, "Spong: $U ($S)\n", number, string, NULL); @@ -56,7 +56,7 @@ and so on, and finally a ``NULL`` format string. For example:: This makes ``Describe()`` methods much easier to write. For example, ``BufferDescribe()`` contains the following code:: - res = WriteF(depth, stream, + res = WriteF(stream, depth, "Buffer $P ($U) {\n", (WriteFP)buffer, (WriteFU)buffer->serial, " class $P (\"$S\")\n", @@ -81,12 +81,6 @@ This makes ``Describe()`` methods much easier to write. For example, ``BufferDes NULL); if (res != ResOK) return res; -_`.indent`: ``WriteF()`` maintains the indentation of nested -structures automatically. In a format string, ``{`` increases the -indentation level by one, and ``}`` decreases it by one. Before -emitting the first character on a line (but after updating the depth), -``WriteF()`` emits the indentation whitespace for the current depth. - _`.types`: For each format ``$X`` that ``WriteF()`` supports, there is a type defined in impl.h.mpmtypes ``WriteFX()`` which is the promoted version of that type. These are provided both to ensure promotion and