@@ -412,7 +412,7 @@ static REBREQ *Req_SIO;
412
412
Debug_Space (1 );
413
413
if (n > 0 && VAL_TYPE (value ) <= REB_NONE ) Debug_Chars ('.' , 1 );
414
414
else {
415
- out = Mold_Print_Value (value , limit , TRUE); // shared mold buffer
415
+ out = Mold_Print_Value (value , limit , TRUE, TRUE ); // shared mold buffer
416
416
for (i1 = i2 = 0 ; i1 < out -> tail ; i1 ++ ) {
417
417
uc = GET_ANY_CHAR (out , i1 );
418
418
if (uc < ' ' ) uc = ' ' ;
@@ -429,7 +429,7 @@ static REBREQ *Req_SIO;
429
429
430
430
/***********************************************************************
431
431
**
432
- */ void Debug_Buf (const REBYTE * fmt , va_list args )
432
+ */ void Debug_Buf (REBCNT limit , const REBYTE * fmt , va_list args )
433
433
/*
434
434
** Lower level formatted print for debugging purposes.
435
435
**
@@ -457,8 +457,12 @@ static REBREQ *Req_SIO;
457
457
458
458
RESET_SERIES (buf );
459
459
460
+ if (limit > SERIES_REST (buf ) - 1 ) {
461
+ limit = SERIES_REST (buf ) - 1 ;
462
+ }
463
+
460
464
// Limits output to size of buffer, will not expand it:
461
- bp = Form_Var_Args (STR_HEAD (buf ), SERIES_REST ( buf ) - 1 , fmt , args );
465
+ bp = Form_Var_Args (STR_HEAD (buf ), limit , fmt , args );
462
466
tail = bp - STR_HEAD (buf );
463
467
464
468
for (n = 0 ; n < tail ; n += len ) {
@@ -473,18 +477,18 @@ static REBREQ *Req_SIO;
473
477
**
474
478
*/ void Debug_Fmt_ (const REBYTE * fmt , ...)
475
479
/*
476
- ** Print using a format string and variable number
480
+ ** Print using a formatted string and variable number
477
481
** of arguments. All args must be long word aligned
478
482
** (no short or char sized values unless recast to long).
479
- ** Output will be held in series print buffer and
483
+ ** Output will be held in a series print buffer and
480
484
** will not exceed its max size. No line termination
481
485
** is supplied after the print.
482
486
**
483
487
***********************************************************************/
484
488
{
485
489
va_list args ;
486
490
va_start (args , fmt );
487
- Debug_Buf (fmt , args );
491
+ Debug_Buf (NO_LIMIT , fmt , args );
488
492
va_end (args );
489
493
}
490
494
@@ -504,7 +508,21 @@ static REBREQ *Req_SIO;
504
508
{
505
509
va_list args ;
506
510
va_start (args , fmt );
507
- Debug_Buf (fmt , args );
511
+ Debug_Buf (NO_LIMIT , fmt , args );
512
+ Debug_Line ();
513
+ va_end (args );
514
+ }
515
+ /***********************************************************************
516
+ **
517
+ */ void Debug_Fmt_Limited (REBCNT limit , const REBYTE * fmt , ...)
518
+ /*
519
+ ** Same like Debug_Fmt, but limits length of the output.
520
+ **
521
+ ***********************************************************************/
522
+ {
523
+ va_list args ;
524
+ va_start (args , fmt );
525
+ Debug_Buf (limit , fmt , args );
508
526
Debug_Line ();
509
527
va_end (args );
510
528
}
@@ -749,7 +767,7 @@ static REBREQ *Req_SIO;
749
767
vp = va_arg (args , REBVAL * );
750
768
mold_value :
751
769
// Form the REBOL value into a reused buffer:
752
- ser = Mold_Print_Value (vp , 0 , desc != 'v' );
770
+ ser = Mold_Print_Value (vp , max , desc != 'v' , TRUE );
753
771
754
772
l = Length_As_UTF8 (UNI_HEAD (ser ), SERIES_TAIL (ser ), TRUE, OS_CRLF );
755
773
if (pad != 1 && l > pad ) l = pad ;
@@ -809,7 +827,7 @@ static REBREQ *Req_SIO;
809
827
**
810
828
***********************************************************************/
811
829
{
812
- REBSER * out = Mold_Print_Value (value , limit , mold );
830
+ REBSER * out = Mold_Print_Value (value , limit , mold , FALSE );
813
831
Prin_OS_String (out -> data , out -> tail , TRUE, err );
814
832
}
815
833
0 commit comments