当前位置: 首页>>代码示例>>C++>>正文


C++ r_has_type函数代码示例

本文整理汇总了C++中r_has_type函数的典型用法代码示例。如果您正苦于以下问题:C++ r_has_type函数的具体用法?C++ r_has_type怎么用?C++ r_has_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了r_has_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: charstring_is_notdef_proc

static bool
charstring_is_notdef_proc(const gs_memory_t *mem, const ref *pcstr)
{
    if (r_is_array(pcstr) && r_size(pcstr) == 4) {
        ref elts[4];
        long i;

        for (i = 0; i < 4; ++i)
            array_get(mem, pcstr, i, &elts[i]);
        if (r_has_type(&elts[0], t_name) &&
            r_has_type(&elts[1], t_integer) && elts[1].value.intval == 0 &&
            r_has_type(&elts[2], t_integer) && elts[2].value.intval == 0 &&
            r_has_type(&elts[3], t_name)
            ) {
            ref nref;

            name_enter_string(mem, "pop", &nref);
            if (name_eq(&elts[0], &nref)) {
                name_enter_string(mem, "setcharwidth", &nref);
                if (name_eq(&elts[3], &nref))
                    return true;
            }
        }
    }
    return false;
}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:26,代码来源:zcharout.c

示例2: TT_char_code_from_CID_no_subst

/* Convert a CID into TT char code or to TT glyph index. */
static bool
TT_char_code_from_CID_no_subst(const gs_memory_t *mem,
                               const ref *Decoding, const ref *TT_cmap, uint nCID, uint *c)
{   ref *DecodingArray, char_code, char_code1, ih, *glyph_index;
    bool found = false;
    int i = nCID % 256, n;

    make_int(&ih, nCID / 256);
    if (dict_find(Decoding, &ih, &DecodingArray) <= 0 ||
            !r_has_type(DecodingArray, t_array) ||
            array_get(mem, DecodingArray, i, &char_code) < 0)
        return false;
    if (r_has_type(&char_code, t_integer))
        n = 1;
    else if (r_has_type(&char_code, t_array)) {
        DecodingArray = &char_code;
        i = 0;
        n = r_size(DecodingArray);
    } else
        return false; /* Must not happen. */
    for (;n--; i++) {
        if (array_get(mem, DecodingArray, i, &char_code1) < 0 ||
            !r_has_type(&char_code1, t_integer))
            return false; /* Must not happen. */
        if (dict_find(TT_cmap, &char_code1, &glyph_index) >= 0 &&
                r_has_type(glyph_index, t_integer)) {
            *c = glyph_index->value.intval;
            found = true;
            if (*c != 0)
                return true;
        }
    }
    return found;
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:35,代码来源:zcid.c

示例3: dict_check_uid_param

/* Check that a UID in a dictionary is equal to an existing, valid UID. */
bool
dict_check_uid_param(const ref * pdict, const gs_uid * puid)
{
    ref *puniqueid;

    if (uid_is_XUID(puid)) {
        uint size = uid_XUID_size(puid);
        uint i;

        if (dict_find_string(pdict, "XUID", &puniqueid) <= 0)
            return false;
        if (!r_has_type(puniqueid, t_array) ||
            r_size(puniqueid) != size
            )
            return false;
        for (i = 0; i < size; i++) {
            const ref *pvalue = puniqueid->value.const_refs + i;

            if (!r_has_type(pvalue, t_integer))
                return false;
            if (pvalue->value.intval != uid_XUID_values(puid)[i])
                return false;
        }
        return true;
    } else {
        if (dict_find_string(pdict, "UniqueID", &puniqueid) <= 0)
            return false;
        return (r_has_type(puniqueid, t_integer) &&
                puniqueid->value.intval == puid->id);
    }
}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:32,代码来源:idparam.c

示例4: zfor

int
zfor(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    register es_ptr ep;
    int code;
    float params[3];

        /* Mostly undocumented, and somewhat bizarre Adobe behavior discovered	*/
        /* with the CET (28-05) and FTS (124-01) is that the proc is not run	*/
        /* if BOTH the initial value and increment are zero.			*/
    if ((code = float_params(op - 1, 3, params)) < 0)
        return code;
    if ( params[0] == 0.0 && params[1] == 0.0 ) {
        pop(4);		/* don't run the proc */
        return 0;
    }
    check_estack(7);
    ep = esp + 6;
    check_proc(*op);
    /* Push a mark, the control variable set to the initial value, */
    /* the increment, the limit, and the procedure, */
    /* and invoke the continuation operator. */
    if (r_has_type(op - 3, t_integer) &&
        r_has_type(op - 2, t_integer)
        ) {
        make_int(ep - 4, op[-3].value.intval);
        make_int(ep - 3, op[-2].value.intval);
        switch (r_type(op - 1)) {
            case t_integer:
                make_int(ep - 2, op[-1].value.intval);
                break;
            case t_real:
                make_int(ep - 2, (long)op[-1].value.realval);
                break;
            default:
                return_op_typecheck(op - 1);
        }
        if (ep[-3].value.intval >= 0)
            make_op_estack(ep, for_pos_int_continue);
        else
            make_op_estack(ep, for_neg_int_continue);
    } else {
        make_real(ep - 4, params[0]);
        make_real(ep - 3, params[1]);
        make_real(ep - 2, params[2]);
        make_op_estack(ep, for_real_continue);
    }
    make_mark_estack(ep - 5, es_for, no_cleanup);
    ref_assign(ep - 1, op);
    esp = ep;
    pop(4);
    return o_push_estack;
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:54,代码来源:zcontrol.c

示例5: swap_entry

/*
 * Swap an entry from a higher level dictionary into a base dictionary.
 * elt[0] is the key, elt[1] is the current value in the Level 2 dictionary
 * (*pdict2).
 */
static int
swap_entry(i_ctx_t *i_ctx_p, ref elt[2], ref * pdict, ref * pdict2)
{
    ref *pvalue;
#ifdef PACIFY_VALGRIND
    ref old_value = { 0 };		/* current value in *pdict */
#else
    ref old_value;		/* current value in *pdict */
#endif
    int found = dict_find(pdict, &elt[0], &pvalue);

    switch (found) {
        default:		/* <0, error */
            /*
             * The only possible error here is a dictfull error, which is
             * harmless.
             */
            /* fall through */
        case 0:		/* missing */
            make_null(&old_value);
            break;
        case 1:		/* present */
            old_value = *pvalue;
    }
    /*
     * Temporarily flag the dictionaries as local, so that we don't
     * get invalidaccess errors.  (We know that they are both
     * referenced from systemdict, so they are allowed to reference
     * local objects even if they are global.)
     */
    {
        uint space2 = r_space(pdict2);
        int code;

        r_set_space(pdict2, avm_local);
        idict_put(pdict2, &elt[0], &old_value);
        if (r_has_type(&elt[1], t_null)) {
            code = idict_undef(pdict, &elt[0]);
            if (code == gs_error_undefined &&
                r_has_type(&old_value, t_null)
                )
                code = 0;
        } else {
            uint space = r_space(pdict);

            r_set_space(pdict, avm_local);
            code = idict_put(pdict, &elt[0], &elt[1]);
            r_set_space(pdict, space);
        }
        r_set_space(pdict2, space2);
        return code;
    }
}
开发者ID:computersforpeace,项目名称:ghostpdl,代码行数:58,代码来源:zmisc2.c

示例6: zmakewordimagedevice

/* <matrix> <width> <height> <palette> <word?> makewordimagedevice <device> */
static int
zmakewordimagedevice(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    os_ptr op1 = op - 1;
    gs_matrix imat;
    gx_device *new_dev;
    const byte *colors;
    int colors_size;
    int code;

    check_int_leu(op[-3], max_uint >> 1);	/* width */
    check_int_leu(op[-2], max_uint >> 1);	/* height */
    check_type(*op, t_boolean);
    if (r_has_type(op1, t_null)) {	/* true color */
	colors = 0;
	colors_size = -24;	/* 24-bit true color */
    } else if (r_has_type(op1, t_integer)) {
	/*
	 * We use if/else rather than switch because the value is long,
	 * which is not supported as a switch value in pre-ANSI C.
	 */
	if (op1->value.intval != 16 && op1->value.intval != 24 &&
	    op1->value.intval != 32
	    )
	    return_error(e_rangecheck);
	colors = 0;
	colors_size = -op1->value.intval;
    } else {
	check_type(*op1, t_string);	/* palette */
	if (r_size(op1) > 3 * 256)
	    return_error(e_rangecheck);
	colors = op1->value.bytes;
	colors_size = r_size(op1);
    }
    if ((code = read_matrix(imemory, op - 4, &imat)) < 0)
	return code;
    /* Everything OK, create device */
    code = gs_makewordimagedevice(&new_dev, &imat,
				  (int)op[-3].value.intval,
				  (int)op[-2].value.intval,
				  colors, colors_size,
				  op->value.boolval, true, imemory);
    if (code == 0) {
	new_dev->memory = imemory;
	make_tav(op - 4, t_device, imemory_space(iimemory) | a_all,
		 pdevice, new_dev);
	pop(4);
    }
    return code;
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:52,代码来源:zdevice.c

示例7: dict_index_entry

/* If the index designates an unoccupied entry, return gs_error_undefined. */
int
dict_index_entry(const ref * pdref, int index, ref * eltp /* ref eltp[2] */ )
{
    const dict *pdict = pdref->value.pdict;

    array_get(dict_mem(pdict), &pdict->keys, (long)(index + 1), eltp);
    if (r_has_type(eltp, t_name) ||
        (!dict_is_packed(pdict) && !r_has_type(eltp, t_null))
        ) {
        eltp[1] = pdict->values.value.refs[index + 1];
        return 0;
    }
    return gs_error_undefined;
}
开发者ID:computersforpeace,项目名称:ghostpdl,代码行数:15,代码来源:idict.c

示例8: zsetpagedevice

/* <local_dict|null> .setpagedevice - */
static int
zsetpagedevice(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    int code;

/******
    if ( igs->in_cachedevice )
        return_error(e_undefined);
 ******/
    if (r_has_type(op, t_dictionary)) {
        check_dict_read(*op);
#if 0	/****************/
        /*
         * In order to avoid invalidaccess errors on setpagedevice,
         * the dictionary must be allocated in local VM.
         */
        if (!(r_is_local(op)))
            return_error(e_invalidaccess);
#endif	/****************/
        /* Make the dictionary read-only. */
        code = zreadonly(i_ctx_p);
        if (code < 0)
            return code;
    } else {
        check_type(*op, t_null);
    }
    istate->pagedevice = *op;
    pop(1);
    return 0;
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:32,代码来源:zdevice2.c

示例9: save_page_device

/* Check whether we need to call out to create the page device dictionary. */
static bool
save_page_device(gs_state *pgs)
{
    return
        (r_has_type(&gs_int_gstate(pgs)->pagedevice, t_null) &&
         (*dev_proc(gs_currentdevice(pgs), get_page_device))(gs_currentdevice(pgs)) != 0);
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:8,代码来源:zdevice2.c

示例10: dict_find

int
dict_find(const ref * pdref, const ref * pkey, ref ** ppvalue)
{
    dict *pdict = pdref->value.pdict;
    int code = real_dict_find(pdref, pkey, ppvalue);

    stats_dict.lookups++;
    if (r_has_type(pkey, t_name) && dict_is_packed(pdict)) {
        uint nidx = name_index(dict_mem(pdict), pkey);
        uint hash =
        dict_hash_mod(dict_name_index_hash(nidx), npairs(pdict)) + 1;

        if (pdict->keys.value.packed[hash] ==
            pt_tag(pt_literal_name) + nidx
            )
            stats_dict.probe1++;
        else if (pdict->keys.value.packed[hash - 1] ==
                 pt_tag(pt_literal_name) + nidx
            )
            stats_dict.probe2++;
    }
    /* Do the cheap flag test before the expensive remainder test. */
    if (gs_debug_c('d') && !(stats_dict.lookups % 1000))
        dlprintf3("[d]lookups=%ld probe1=%ld probe2=%ld\n",
                  stats_dict.lookups, stats_dict.probe1, stats_dict.probe2);
    return code;
}
开发者ID:computersforpeace,项目名称:ghostpdl,代码行数:27,代码来源:idict.c

示例11: process_float_array

/* Get N numeric parameters (as floating point numbers) from an array */
int
process_float_array(const gs_memory_t *mem, const ref * parray, int count, float * pval)
{
    int         code = 0, indx0 = 0;

    /* we assume parray is an array of some type, of adequate length */
    if (r_has_type(parray, t_array))
        return float_params(parray->value.refs + count - 1, count, pval);

    /* short/mixed array; convert the entries to refs */
    while (count > 0 && code >= 0) {
        int     i, subcount;
        ref     ref_buff[20];   /* 20 is arbitrary */

        subcount = (count > countof(ref_buff) ? countof(ref_buff) : count);
        for (i = 0; i < subcount && code >= 0; i++)
            code = array_get(mem, parray, (long)(i + indx0), &ref_buff[i]);
        if (code >= 0)
            code = float_params(ref_buff + subcount - 1, subcount, pval);
        count -= subcount;
        pval += subcount;
        indx0 += subcount;
    }

    return code;
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:27,代码来源:iutil.c

示例12: cid_font_data_param

/* Get the additional information for a CIDFontType 0 or 2 CIDFont. */
int
cid_font_data_param(os_ptr op, gs_font_cid_data *pdata, ref *pGlyphDirectory)
{
    int code;
    ref *pgdir;

    check_type(*op, t_dictionary);
    if ((code = cid_font_system_info_param(&pdata->CIDSystemInfo, op)) < 0 ||
            (code = dict_int_param(op, "CIDCount", 0, max_int, -1,
                                   &pdata->CIDCount)) < 0
       )
        return code;
    /*
     * If the font doesn't have a GlyphDirectory, GDBytes is required.
     * If it does have a GlyphDirectory, GDBytes may still be needed for
     * CIDMap: it's up to the client to check this.
     */
    if (dict_find_string(op, "GlyphDirectory", &pgdir) <= 0) {
        /* Standard CIDFont, require GDBytes. */
        make_null(pGlyphDirectory);
        return dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 0,
                              &pdata->GDBytes);
    }
    if (r_has_type(pgdir, t_dictionary) || r_is_array(pgdir)) {
        /* GlyphDirectory, GDBytes is optional. */
        *pGlyphDirectory = *pgdir;
        code = dict_int_param(op, "GDBytes", 0, MAX_GDBytes, 0,
                              &pdata->GDBytes);
        return code;
    } else {
        return_error(e_typecheck);
    }
}
开发者ID:aberg001,项目名称:plan9,代码行数:34,代码来源:zfcid.c

示例13: zsetcacheparams

/* <mark> <size> <lower> <upper> setcacheparams - */
static int
zsetcacheparams(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    uint params[3];
    int i, code;
    os_ptr opp = op;

    for (i = 0; i < 3 && !r_has_type(opp, t_mark); i++, opp--) {
        check_int_leu(*opp, max_uint);
        params[i] = opp->value.intval;
    }
    switch (i) {
        case 3:
            if ((code = gs_setcachesize(igs, ifont_dir, params[2])) < 0)
                return code;
        case 2:
            if ((code = gs_setcachelower(ifont_dir, params[1])) < 0)
                return code;
        case 1:
            if ((code = gs_setcacheupper(ifont_dir, params[0])) < 0)
                return code;
        case 0:;
    }
    return zcleartomark(i_ctx_p);
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:27,代码来源:zfont.c

示例14: make_initial_dict

/* Create an initial dictionary if necessary. */
static ref *
make_initial_dict(i_ctx_t *i_ctx_p, const char *iname, ref idicts[])
{
    int i;

    /* systemdict was created specially. */
    if (!strcmp(iname, "systemdict"))
	return systemdict;
    for (i = 0; i < countof(initial_dictionaries); i++) {
	const char *dname = initial_dictionaries[i].name;
	const int dsize = initial_dictionaries[i].size;

	if (!strcmp(iname, dname)) {
	    ref *dref = &idicts[i];

	    if (r_has_type(dref, t_null)) {
		gs_ref_memory_t *mem =
		    (initial_dictionaries[i].local ?
		     iimemory_local : iimemory_global);
		int code = dict_alloc(mem, dsize, dref);

		if (code < 0)
		    return 0;	/* disaster */
	    }
	    return dref;
	}
    }

    /*
     * Name mentioned in some op_def, but not in initial_dictionaries.
     * Punt.
     */
    return 0;
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:35,代码来源:iinit.c

示例15: font_param

/* Validate a font parameter. */
int
font_param(const ref * pfdict, gs_font ** ppfont)
{	/*
         * Check that pfdict is a read-only dictionary, that it has a FID
         * entry whose value is a fontID, and that the fontID points to a
         * gs_font structure whose associated PostScript dictionary is
         * pfdict.
         */
    ref *pid;
    gs_font *pfont;
    const font_data *pdata;

    check_type(*pfdict, t_dictionary);
    if (dict_find_string(pfdict, "FID", &pid) <= 0 ||
        !r_has_type(pid, t_fontID)
        )
        return_error(e_invalidfont);
    pfont = r_ptr(pid, gs_font);
    if (pfont == 0)
        return_error(e_invalidfont);	/* unregistered font */
    pdata = pfont->client_data;
    if (!obj_eq(pfont->memory, &pdata->dict, pfdict))
        return_error(e_invalidfont);
    *ppfont = pfont;
    return 0;
}
开发者ID:jonathan-mui,项目名称:ruby-ghostscript,代码行数:27,代码来源:zfont.c


注:本文中的r_has_type函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。