コード例 #1
0
ファイル: d-print.c プロジェクト: mbk/ren-c
*/	void Debug_String(const void *p, REBCNT len, REBOOL uni, REBINT lines)
/*
***********************************************************************/
{
	REBUNI uc;
	const REBYTE *bp = uni ? NULL : cast(const REBYTE *, p);
	const REBUNI *up = uni ? cast(const REBUNI *, p) : NULL;

	if (Trace_Limit > 0) {
		if (Trace_Buffer->tail >= Trace_Limit)
			Remove_Series(Trace_Buffer, 0, 2000);
		if (len == UNKNOWN) len = uni ? Strlen_Uni(up) : LEN_BYTES(bp);
		// !!! account for unicode!
		for (; len > 0; len--) {
			uc = uni ? *up++ : *bp++;
			Append_Byte(Trace_Buffer, uc);
		}
		//Append_Unencoded_Len(Trace_Buffer, bp, len);
		for (; lines > 0; lines--) Append_Byte(Trace_Buffer, LF);
	}
	else {
		Prin_OS_String(p, len, uni);
		for (; lines > 0; lines--) Print_OS_Line();
	}
}
コード例 #2
0
ファイル: d-print.c プロジェクト: mbk/ren-c
*/  void Out_Value(const REBVAL *value, REBCNT limit, REBOOL mold, REBINT lines)
/*
***********************************************************************/
{
	Print_Value(value, limit, mold); // higher level!
	for (; lines > 0; lines--) Print_OS_Line();
}
コード例 #3
0
ファイル: d-print.c プロジェクト: mbk/ren-c
*/	void Out_Str(const REBYTE *bp, REBINT lines)
/*
***********************************************************************/
{
	Prin_OS_String(bp, UNKNOWN, 0);
	for (; lines > 0; lines--) Print_OS_Line();
}
コード例 #4
0
ファイル: n-io.c プロジェクト: fort-ascension/ren-c
static REBFLG Print_Native_Modifying_Throws(
    REBVAL *value, // Value may be modified.  Contents must be GC-safe!
    REBOOL newline
) {
    if (IS_UNSET(value)) {
    #if !defined(NDEBUG)
        if (LEGACY(OPTIONS_PRINT_FORMS_EVERYTHING))
            goto form_it;
    #endif

        // No effect (not even a newline).  Previously this also was the
        // behavior for NONE, but now that none is considered "reified" it
        // does not opt out from rendering.
    }
    else if (IS_BINARY(value)) {

    #if !defined(NDEBUG)
        if (LEGACY(OPTIONS_PRINT_FORMS_EVERYTHING))
            goto form_it;
    #endif

        // Send raw bytes to the console.  CGI+ANSI+VT100 etc. require it
        // for full 8-bit byte transport (UTF-8 is by definition not good
        // enough...some bytes are illegal to occur in UTF-8 at all).
        //
        // Given that PRINT is not a general-purpose PROBE tool (it has
        // never output values purely "as is", evaluating blocks for
        // instance) it's worth doing a "strange" thing (though no stranger
        // than WRITE) to be able to access the facility.

        Prin_OS_String(VAL_BIN_DATA(value), VAL_LEN(value), OPT_ENC_RAW);

        // !!! Binary print should never output a newline.  This would seem
        // more natural if PRINT's decision to output newlines was guided
        // by whether it was given a block or not (under consideration).
    }
    else if (IS_BLOCK(value)) {
        // !!! Pending plan for PRINT of BLOCK! is to do something like
        // COMBINE where NONE! is elided, single characters are not spaced out,
        // nested blocks are recursed, etc.  So:
        //
        //     print ["A" newline "B" if 1 > 2 [newline] if 1 < 2 ["C"]]]
        //
        // Would output the following (where _ is space):
        //
        //     A
        //     B_C
        //
        // As opposed to historical output, which is:
        //
        //     A_
        //     B_none_C
        //
        // Currently it effectively FORM REDUCEs the output.

        if (Reduce_Block_Throws(
            value, VAL_SERIES(value), VAL_INDEX(value), FALSE
        )) {
            return TRUE;
        }

        Prin_Value(value, 0, 0);
        if (newline)
            Print_OS_Line();
    }
    else {
#if !defined(NDEBUG)
    form_it: // used only by OPTIONS_PRINT_FORMS_EVERYTHING
#endif
        // !!! Full behavior review needed for all types.

        Prin_Value(value, 0, 0);
        if (newline)
            Print_OS_Line();
    }

    return FALSE;
}