... oops, forgot to mention that I added this clause to the end of the function which used to have the domPanic(…)
:
error:
Tcl_AppendResult(interp, "\n\tUnescaped string : \"", value, "\"\n", NULL);
Tcl_AppendResult(interp, "\n\t................ (hex): ", NULL);
tcldom_hexDump(interp, value);
Tcl_AppendResult(interp, "\n", NULL);
return TCL_ERROR;
}
... which uses this code, also defined earlier:
static void tcldom_hexDumpToStdErr (
char *cString
)
{
fprintf(stderr, "\n/* HEX DUMP OF cString / value = \"%s\": */", cString);
int i = 0;
char *pc2 = cString;
char chr;
while((chr = *(pc2++)) != 0) {
if((i++ & 0x7) == 0)
fprintf(stderr, "\n");
fprintf(stderr, "%02x", chr & 0xff);
}
}
static void tcldom_hexDump (
Tcl_Interp *interp,
char *cString
)
{
static const char *x_digit[] = {"0","1","2","3","4","5","6","7","8","9",
"a","b","c","d","e","f",0};
int i = 0;
char *pc2 = cString;
char chr;
while((chr = *(pc2++)) != 0) {
if((i++ & 0x7) == 0)
Tcl_AppendResult(interp, "\n\t\t", NULL);
Tcl_AppendResult(interp, x_digit[(chr>>4) & 0xf],
x_digit[(chr>>0) & 0xf],
NULL);
}
}