Skip to content

Commit

Permalink
FEAT: added /fmt refinement to DUMP function for displaying only inte…
Browse files Browse the repository at this point in the history
…rnal information about series value without displaying its data
  • Loading branch information
Oldes committed Jul 6, 2019
1 parent 362fe7e commit 6df2ece
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/boot/natives.r
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ do-commands: native [
]

ds: native ["Temporary stack debug"]
dump: native ["Temporary debug dump" v]
dump: native ["Temporary debug dump" v /fmt "only series format"]
check: native ["Temporary series debug check" val [series!]]

do-callback: native [
Expand Down
12 changes: 11 additions & 1 deletion src/core/d-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

/***********************************************************************
**
*/ void Dump_Series(REBSER *series, const char *memo)
*/ void Dump_Series_Fmt(REBSER *series, const char *memo)
/*
***********************************************************************/
{
Expand All @@ -50,6 +50,16 @@
SERIES_REST(series),
SERIES_FLAGS(series)
);
}

/***********************************************************************
**
*/ void Dump_Series(REBSER *series, const char *memo)
/*
***********************************************************************/
{
if (!series) return;
Dump_Series_Fmt(series, memo);
if (SERIES_WIDE(series) == sizeof(REBVAL)) {
Dump_Values(BLK_HEAD(series), SERIES_TAIL(series));
} else
Expand Down
9 changes: 7 additions & 2 deletions src/core/n-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,13 @@ static int Do_Ordinal(REBVAL *ds, REBINT n)
#ifdef _DEBUG
REBVAL *arg = D_ARG(1);

if (ANY_SERIES(arg))
Dump_Series(VAL_SERIES(arg), "=>");
if (ANY_SERIES(arg)) {
if (D_REF(2)) {
Dump_Series_Fmt(VAL_SERIES(arg), "=>");
} else {
Dump_Series(VAL_SERIES(arg), "=>");
}
}
else
Dump_Values(arg, 1);
#endif
Expand Down

0 comments on commit 6df2ece

Please sign in to comment.