enhanced pf_log to print a character without quotes.
fixed formatting specifiers in log_char_object() in prim.c
This commit is contained in:
parent
25e4bb040c
commit
6e4a8f6081
17
lib/prim.c
17
lib/prim.c
@ -72,21 +72,21 @@ start_over:
|
|||||||
{
|
{
|
||||||
if (*ptr == '\0')
|
if (*ptr == '\0')
|
||||||
{
|
{
|
||||||
n = hcl_logbfmt (hcl, mask, "%C", *ptr);
|
n = hcl_logbfmt (hcl, mask, "%jc", *ptr);
|
||||||
HCL_ASSERT (hcl, n == 1);
|
HCL_ASSERT (hcl, n == 1);
|
||||||
rem -= n;
|
rem -= n;
|
||||||
ptr += n;
|
ptr += n;
|
||||||
goto start_over;
|
goto start_over;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = hcl_logbfmt (hcl, mask, "%.*S", rem, ptr);
|
n = hcl_logbfmt (hcl, mask, "%.*js", rem, ptr);
|
||||||
if (n <= -1) break;
|
if (n <= -1) break;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
/* to skip the unprinted character.
|
/* to skip the unprinted character.
|
||||||
* actually, this check is not needed because of '\0' skipping
|
* actually, this check is not needed because of '\0' skipping
|
||||||
* at the beginning of the loop */
|
* at the beginning of the loop */
|
||||||
n = hcl_logbfmt (hcl, mask, "%C", *ptr);
|
n = hcl_logbfmt (hcl, mask, "%jc", *ptr);
|
||||||
HCL_ASSERT (hcl, n == 1);
|
HCL_ASSERT (hcl, n == 1);
|
||||||
}
|
}
|
||||||
rem -= n;
|
rem -= n;
|
||||||
@ -114,6 +114,10 @@ static hcl_pfrc_t pf_log (hcl_t* hcl, hcl_ooi_t nargs)
|
|||||||
{
|
{
|
||||||
goto dump_object;
|
goto dump_object;
|
||||||
}
|
}
|
||||||
|
else if (HCL_OOP_IS_CHAR(msg))
|
||||||
|
{
|
||||||
|
hcl_logbfmt (hcl, mask, "%jc", HCL_OOP_TO_CHAR(msg));
|
||||||
|
}
|
||||||
else if (HCL_OOP_IS_POINTER(msg))
|
else if (HCL_OOP_IS_POINTER(msg))
|
||||||
{
|
{
|
||||||
if (HCL_OBJ_GET_FLAGS_TYPE(msg) == HCL_OBJ_TYPE_CHAR)
|
if (HCL_OBJ_GET_FLAGS_TYPE(msg) == HCL_OBJ_TYPE_CHAR)
|
||||||
@ -135,8 +139,11 @@ static hcl_pfrc_t pf_log (hcl_t* hcl, hcl_ooi_t nargs)
|
|||||||
inner = ((hcl_oop_oop_t)msg)->slot[i];
|
inner = ((hcl_oop_oop_t)msg)->slot[i];
|
||||||
|
|
||||||
if (i > 0) hcl_logbfmt (hcl, mask, " ");
|
if (i > 0) hcl_logbfmt (hcl, mask, " ");
|
||||||
if (HCL_OOP_IS_POINTER(inner) &&
|
if (HCL_OOP_IS_CHAR(inner))
|
||||||
HCL_OBJ_GET_FLAGS_TYPE(inner) == HCL_OBJ_TYPE_CHAR)
|
{
|
||||||
|
hcl_logbfmt (hcl, mask, "%jc", HCL_OOP_TO_CHAR(inner));
|
||||||
|
}
|
||||||
|
else if (HCL_OOP_IS_POINTER(inner) && HCL_OBJ_GET_FLAGS_TYPE(inner) == HCL_OBJ_TYPE_CHAR)
|
||||||
{
|
{
|
||||||
log_char_object (hcl, mask, (hcl_oop_char_t)inner);
|
log_char_object (hcl, mask, (hcl_oop_char_t)inner);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user