コード例 #1
0
ファイル: pxvendor.c プロジェクト: hackqiang/gs
static int
vu_tag_dispatch(px_args_t * par, px_state_t * pxs)
{
    px_vendor_state_t *v_state = pxs->vendor_state;

    if (v_state->state == vu_blank) {
	if (par->source.available < 6)
	    return pxNeedData;
	v_state->tag.tag_id
	    = uint16at(par->source.data, pxs->data_source_big_endian);
	v_state->tag.bytes_expected
	    = uint32at(par->source.data + 2, pxs->data_source_big_endian);
	v_state->tag.bytes_so_far = 0;
	v_state->state = vu_tagged;
	memset(v_state->row, 0xff, v_state->data_per_row);
	par->source.data += 6;
	par->source.available -= 6;
	par->source.position += 6;
	if_debug2('I', "Signature %04X expect=%d\n",
		  v_state->tag.tag_id, v_state->tag.bytes_expected);
    };
    if (v_state->state != vu_blank) {
	if_debug4('I', "tag %04X bytes=%d/%d avail=%d\n",
		  v_state->tag.tag_id,
		  v_state->tag.bytes_so_far,
		  v_state->tag.bytes_expected, par->source.available);
	switch (v_state->tag.tag_id) {
	    case 0x9031:
		/* CLJ3600 specific; 3550 returns IllegalTag */
	    case 0x9011:
	    case 0x9021:
		return tag_dispatch_90X1(par, pxs);
		break;
	    case 0x1001:
		/* do nothing */
		if (v_state->tag.bytes_expected == 0) {
		    v_state->state = vu_blank;
		    return 0;
		}
		/* probably should return error */
		return tag_dispatch_generic(par, pxs);
		break;
	    case 0x8000:
		return tag_dispatch_8000(par, pxs);
		break;
	    case 0x8001:
		return tag_dispatch_generic(par, pxs);
		break;
	    default:
		return_error(errorIllegalTag);
		break;
	}
    }
    /* unreachable */
    return pxNeedData;
}
コード例 #2
0
ファイル: pxparse.c プロジェクト: computersforpeace/ghostpdl
static void
trace_array_data(const gs_memory_t * mem, const char *label,
                 const px_value_t * pav)
{
    px_data_type_t type = pav->type;
    const byte *ptr = pav->value.array.data;
    uint count = pav->value.array.size;
    bool big_endian = (type & pxd_big_endian) != 0;
    bool text = (type & pxd_ubyte) != 0;
    uint i;

    dmputs(mem, label);
    dmputs(mem, (type & pxd_ubyte ? " <" : " {"));
    for (i = 0; i < count; ++i) {
        if (!(i & 15) && i) {
            const char *p;

            dmputs(mem, "\n  ");
            for (p = label; *p; ++p)
                dmputc(mem, ' ');
        }
        if (type & pxd_ubyte) {
            dmprintf1(mem, "%02x ", ptr[i]);
            if (ptr[i] < 32 || ptr[i] > 126)
                text = false;
        } else if (type & pxd_uint16)
            dmprintf1(mem, "%u ", uint16at(ptr + i * 2, big_endian));
        else if (type & pxd_sint16)
            dmprintf1(mem, "%d ", sint16at(ptr + i * 2, big_endian));
        else if (type & pxd_uint32)
            dmprintf1(mem, "%lu ", (ulong) uint32at(ptr + i * 4, big_endian));
        else if (type & pxd_sint32)
            dmprintf1(mem, "%ld ", (long)sint32at(ptr + i * 4, big_endian));
        else if (type & pxd_real32)
            dmprintf1(mem, "%g ", real32at(ptr + i * 4, big_endian));
        else
            dmputs(mem, "? ");
    }
    dmputs(mem, (type & pxd_ubyte ? ">\n" : "}\n"));
    if (text) {
        dmputs(mem, "%chars: \"");
        debug_print_string(mem, ptr, count);
        dmputs(mem, "\"\n");
    }
}