*
* PPD command interpreter for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
cups_page_header2_t *h,
int *preferred_bits);
#ifdef DEBUG
-static void DEBUG_object(_cups_ps_obj_t *obj);
-static void DEBUG_stack(_cups_ps_stack_t *st);
+static void DEBUG_object(const char *prefix, _cups_ps_obj_t *obj);
+static void DEBUG_stack(const char *prefix, _cups_ps_stack_t *st);
#endif /* DEBUG */
while ((obj = scan_ps(st, &codeptr)) != NULL)
{
#ifdef DEBUG
- DEBUG_printf(("_cupsRasterExecPS: Stack (%d objects)\n", st->num_objs));
- DEBUG_object(obj);
+ DEBUG_printf(("_cupsRasterExecPS: Stack (%d objects)", st->num_objs));
+ DEBUG_object("_cupsRasterExecPS", obj);
#endif /* DEBUG */
switch (obj->type)
pop_stack(st);
if (cleartomark_stack(st))
- _cupsRasterAddError("cleartomark: Stack underflow!\n");
+ _cupsRasterAddError("cleartomark: Stack underflow.\n");
#ifdef DEBUG
- DEBUG_puts(" dup: ");
- DEBUG_stack(st);
+ DEBUG_puts("1_cupsRasterExecPS: dup");
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: copy");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
break;
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: dup");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: index");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
break;
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: pop");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: roll");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
}
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: setpagedevice");
- DEBUG_stack(st);
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
break;
case CUPS_PS_OTHER :
- _cupsRasterAddError("Unknown operator \"%s\"!\n", obj->value.other);
+ _cupsRasterAddError("Unknown operator \"%s\".\n", obj->value.other);
error = 1;
- DEBUG_printf(("_cupsRasterExecPS: Unknown operator \"%s\"!\n",
- obj->value.other));
+ DEBUG_printf(("_cupsRasterExecPS: Unknown operator \"%s\".", obj->value.other));
break;
}
error_stack(st, "Stack not empty:");
#ifdef DEBUG
- DEBUG_puts("_cupsRasterExecPS: Stack not empty:");
- DEBUG_stack(st);
+ DEBUG_puts("_cupsRasterExecPS: Stack not empty");
+ DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
delete_stack(st);
int n; /* Index into array */
- DEBUG_printf((" roll_stack(st=%p, s=%d, c=%d)\n", st, s, c));
+ DEBUG_printf(("3roll_stack(st=%p, s=%d, c=%d)", st, s, c));
/*
* Range check input...
* Now pull /name and value pairs from the dictionary...
*/
- DEBUG_puts("setpagedevice: Dictionary:");
+ DEBUG_puts("3setpagedevice: Dictionary:");
for (obj ++; obj < end; obj ++)
{
obj ++;
#ifdef DEBUG
- DEBUG_printf(("setpagedevice: /%s ", name));
- DEBUG_object(obj);
+ DEBUG_printf(("4setpagedevice: /%s ", name));
+ DEBUG_object("setpagedevice", obj);
#endif /* DEBUG */
/*
* Ignore unknown name+value...
*/
- DEBUG_printf((" Unknown name (\"%s\") or value...\n", name));
+ DEBUG_printf(("4setpagedevice: Unknown name (\"%s\") or value...\n", name));
while (obj[1].type != CUPS_PS_NAME && obj < end)
obj ++;
*/
static void
-DEBUG_object(_cups_ps_obj_t *obj) /* I - Object to print */
+DEBUG_object(const char *prefix, /* I - Prefix string */
+ _cups_ps_obj_t *obj) /* I - Object to print */
{
switch (obj->type)
{
case CUPS_PS_NAME :
- DEBUG_printf(("/%s\n", obj->value.name));
+ DEBUG_printf(("4%s: /%s\n", prefix, obj->value.name));
break;
case CUPS_PS_NUMBER :
- DEBUG_printf(("%g\n", obj->value.number));
+ DEBUG_printf(("4%s: %g\n", prefix, obj->value.number));
break;
case CUPS_PS_STRING :
- DEBUG_printf(("(%s)\n", obj->value.string));
+ DEBUG_printf(("4%s: (%s)\n", prefix, obj->value.string));
break;
case CUPS_PS_BOOLEAN :
if (obj->value.boolean)
- DEBUG_puts("true");
+ DEBUG_printf(("4%s: true", prefix));
else
- DEBUG_puts("false");
+ DEBUG_printf(("4%s: false", prefix));
break;
case CUPS_PS_NULL :
- DEBUG_puts("null");
+ DEBUG_printf(("4%s: null", prefix));
break;
case CUPS_PS_START_ARRAY :
- DEBUG_puts("[");
+ DEBUG_printf(("4%s: [", prefix));
break;
case CUPS_PS_END_ARRAY :
- DEBUG_puts("]");
+ DEBUG_printf(("4%s: ]", prefix));
break;
case CUPS_PS_START_DICT :
- DEBUG_puts("<<");
+ DEBUG_printf(("4%s: <<", prefix));
break;
case CUPS_PS_END_DICT :
- DEBUG_puts(">>");
+ DEBUG_printf(("4%s: >>", prefix));
break;
case CUPS_PS_START_PROC :
- DEBUG_puts("{");
+ DEBUG_printf(("4%s: {", prefix));
break;
case CUPS_PS_END_PROC :
- DEBUG_puts("}");
+ DEBUG_printf(("4%s: }", prefix));
break;
case CUPS_PS_CLEARTOMARK :
- DEBUG_puts("--cleartomark--");
+ DEBUG_printf(("4%s: --cleartomark--", prefix));
break;
case CUPS_PS_COPY :
- DEBUG_puts("--copy--");
+ DEBUG_printf(("4%s: --copy--", prefix));
break;
case CUPS_PS_DUP :
- DEBUG_puts("--dup--");
+ DEBUG_printf(("4%s: --dup--", prefix));
break;
case CUPS_PS_INDEX :
- DEBUG_puts("--index--");
+ DEBUG_printf(("4%s: --index--", prefix));
break;
case CUPS_PS_POP :
- DEBUG_puts("--pop--");
+ DEBUG_printf(("4%s: --pop--", prefix));
break;
case CUPS_PS_ROLL :
- DEBUG_puts("--roll--");
+ DEBUG_printf(("4%s: --roll--", prefix));
break;
case CUPS_PS_SETPAGEDEVICE :
- DEBUG_puts("--setpagedevice--");
+ DEBUG_printf(("4%s: --setpagedevice--", prefix));
break;
case CUPS_PS_STOPPED :
- DEBUG_puts("--stopped--");
+ DEBUG_printf(("4%s: --stopped--", prefix));
break;
case CUPS_PS_OTHER :
- DEBUG_printf(("--%s--\n", obj->value.other));
+ DEBUG_printf(("4%s: --%s--", prefix, obj->value.other));
break;
}
}
*/
static void
-DEBUG_stack(_cups_ps_stack_t *st) /* I - Stack */
+DEBUG_stack(const char *prefix, /* I - Prefix string */
+ _cups_ps_stack_t *st) /* I - Stack */
{
int c; /* Looping var */
_cups_ps_obj_t *obj; /* Current object on stack */
for (obj = st->objs, c = st->num_objs; c > 0; c --, obj ++)
- DEBUG_object(obj);
+ DEBUG_object(prefix, obj);
}
#endif /* DEBUG */