您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ r_type函数代码示例

51自学网 2021-06-02 11:13:25
  C++
这篇教程C++ r_type函数代码示例写得很实用,希望能帮到您。

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

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

示例1: get_font_name

/* If the font name isn't a name or a string, return an empty string. */voidget_font_name(const gs_memory_t *mem, ref * pfname, const ref * op){    switch (r_type(op)) {        case t_string:            *pfname = *op;            break;        case t_name:            name_string_ref(mem, op, pfname);            break;        default:            /* This is weird, but legal.... */            make_empty_string(pfname, a_readonly);    }}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:16,


示例2: gs_font_map_glyph_by_dict

static gs_chargs_font_map_glyph_by_dict(const gs_memory_t *mem, const ref *map, gs_glyph glyph){    ref *v, n;    if (glyph >= gs_min_cid_glyph) {        uint cid = glyph - gs_min_cid_glyph;        if (dict_find_string(map, "CIDCount", &v) > 0) {            /* This is a CIDDEcoding resource. */            make_int(&n, cid / 256);            if (dict_find(map, &n, &v) > 0) {                ref vv;                if (array_get(mem, v, cid % 256, &vv) == 0 && r_type(&vv) == t_integer)                    return vv.value.intval;            }            return GS_NO_CHAR; /* Absent in the map. */        }        /* This is GlyphNames2Unicode dictionary. */        make_int(&n, cid);    } else        name_index_ref(mem, glyph, &n);     if (dict_find(map, &n, &v) > 0) {        if (r_has_type(v, t_string)) {            int i, l = r_size(v);            gs_char c = 0;            for (i = 0; i < l; i++)                c = (c << 8) | v->value.const_bytes[i];            return c;        }        if (r_type(v) == t_integer)            return v->value.intval;    }    return GS_NO_CHAR; /* Absent in the map. */}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:36,


示例3: test_sra

void test_sra(){	printf("===test SRA===/n");	struct cpu_struct cpu;	memset(&cpu, 0, sizeof(cpu));	cpu.current_ins.rt = 1;	cpu.current_ins.rd = 2;	cpu.current_ins.shamt = 3;	cpu.current_ins.funct = 0x03;	cpu.reg[1] = 0x80000000;	r_type(&cpu);	printf("%s/n", word_to_binary(cpu.reg[1], 0, 31));	printf("%s/n", word_to_binary(cpu.reg[2], 0, 31));	assert(cpu.reg[2] == 0xf0000000);	printf("pass/n/n");}
开发者ID:ChienYuLu,项目名称:archi_project,代码行数:16,


示例4: real_param

/* If an error is returned, the return value is not updated. */intreal_param(const ref * op, double *pparam){    switch (r_type(op)) {	case t_integer:	    *pparam = op->value.intval;	    break;	case t_real:	    *pparam = op->value.realval;	    break;        case t__invalid:	    return_error(e_stackunderflow);	default:	    return_error(e_typecheck);    }    return 0;}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:18,


示例5: znot

/* <int> not <int> */intznot(i_ctx_t *i_ctx_p){    os_ptr op = osp;    switch (r_type(op)) {	case t_boolean:	    op->value.boolval = !op->value.boolval;	    break;	case t_integer:	    op->value.intval = ~op->value.intval;	    break;	default:	    return_op_typecheck(op);    }    return 0;}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:18,


示例6: float_params

/* float_params doesn't bother to keep track of the mask. */intfloat_params(const ref * op, int count, float *pval){    for (pval += count; --count >= 0; --op)	switch (r_type(op)) {	    case t_real:		*--pval = op->value.realval;		break;	    case t_integer:		*--pval = (float)op->value.intval;		break;	    case t__invalid:		return_error(e_stackunderflow);	    default:		return_error(e_typecheck);	}    return 0;}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:19,


示例7: zfont_encode_char

/* Encode a character. */gs_glyphzfont_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t gspace){    font_data *pdata = pfont_data(pfont);    const ref *pencoding = &pdata->Encoding;    ulong index = chr;	/* work around VAX widening bug */    ref cname;    int code = array_get(pfont->memory, pencoding, (long)index, &cname);    if (code < 0 || !r_has_type(&cname, t_name))        return gs_no_glyph;    if (pfont->FontType == ft_user_defined && r_type(&pdata->BuildGlyph) == t_null) {        ref nsref, tname;        name_string_ref(pfont->memory, &cname, &nsref);        if (r_size(&nsref) == 7 &&            !memcmp(nsref.value.const_bytes, ".notdef", r_size(&nsref))) {            /* A special support for high level devices.               They need a glyph name but the font doesn't provide one               due to an instandard BuildChar.               Such fonts don't conform to PLRM section 5.3.7,               but we've got real examples that we want to handle (Bug 686982).               Construct a name here.               Low level devices don't pass here, because regular PS interpretation               doesn't need such names.            */            char buf[20];            int code;            if (gspace == GLYPH_SPACE_NOGEN)                return gs_no_glyph;            sprintf(buf, "j%ld", chr); /* 'j' is arbutrary. */            code = name_ref(pfont->memory, (const byte *)buf, strlen(buf), &tname, 1);            if (code < 0) {                /* Can't propagate the error due to interface limitation,                   return with .notdef */            } else                cname = tname;        }    }    return (gs_glyph)name_index(pfont->memory, &cname);}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:43,


示例8: dict_int_null_param

/* a missing value will return e_undefined rather than 1. */intdict_int_null_param(const ref * pdict, const char *kstr, int minval,                    int maxval, int defaultval, int *pvalue){    ref *pdval;    int code, ival;    if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {        ival = defaultval;        code = 1;    } else {        switch (r_type(pdval)) {            case t_integer:                ival = pdval->value.intval;                break;            case t_real:                /* Allow an integral real, because Fontographer */                /* (which violates the Adobe specs in other ways */                /* as well) sometimes generates output that */                /* needs this. */                if (pdval->value.realval < minval || pdval->value.realval > maxval)                    return_error(e_rangecheck);                ival = (long)pdval->value.realval;                if (ival != pdval->value.realval)                    return_error(e_rangecheck);                break;            case t_null:                return 2;            default:                return_error(e_typecheck);        }        code = 0;    }    if (ival < minval || ival > maxval) {        if (code == 1)            return_error(e_undefined);        else            return_error(e_rangecheck);    }    *pvalue = (int)ival;    return code;}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:43,


示例9: zxor

/* <int1> <int2> xor <int> */intzxor(i_ctx_t *i_ctx_p){    os_ptr op = osp;    switch (r_type(op)) {	case t_boolean:	    check_type(op[-1], t_boolean);	    op[-1].value.boolval ^= op->value.boolval;	    break;	case t_integer:	    check_type(op[-1], t_integer);	    op[-1].value.intval ^= op->value.intval;	    break;	default:	    return_op_typecheck(op);    }    pop(1);    return 0;}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:21,


示例10: dict_float_param

/* Return 0 if found, 1 if defaulted, <0 if wrong type. */intdict_float_param(const ref * pdict, const char *kstr,                 floatp defaultval, float *pvalue){    ref *pdval;    if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {        *pvalue = defaultval;        return 1;    }    switch (r_type(pdval)) {        case t_integer:            *pvalue = (float)pdval->value.intval;            return 0;        case t_real:            *pvalue = pdval->value.realval;            return 0;    }    return_error(e_typecheck);}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:21,


示例11: dict_int_array_check_param

/* See idparam.h for specification. */intdict_int_array_check_param(const gs_memory_t *mem, const ref * pdict,   const char *kstr, uint len, int *ivec, int under_error, int over_error){    ref pa, *pdval;    uint size;    int i, code;    if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0)        return 0;    if (!r_is_array(pdval))        return_error(e_typecheck);    size = r_size(pdval);    if (size > len)        return_error(over_error);    for (i = 0; i < size; i++) {        code = array_get(mem, pdval, i, &pa);        if (code < 0)            return code;        /* See dict_int_param above for why we allow reals here. */        switch (r_type(&pa)) {            case t_integer:                if (pa.value.intval != (int)pa.value.intval)                    return_error(e_rangecheck);                ivec[i] = (int)pa.value.intval;                break;            case t_real:                if (pa.value.realval < min_int ||                    pa.value.realval > max_int ||                    pa.value.realval != (int)pa.value.realval                    )                    return_error(e_rangecheck);                ivec[i] = (int)pa.value.realval;                break;            default:                return_error(e_typecheck);        }    }    return (size == len || under_error >= 0 ? size :            gs_note_error(under_error));}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:42,


示例12: refs_clear_reloc

/* Clear the relocation for a ref object. */static voidrefs_clear_reloc(obj_header_t *hdr, uint size){    ref_packed *rp = (ref_packed *) (hdr + 1);    ref_packed *end = (ref_packed *) ((byte *) rp + size);    while (rp < end) {	if (r_is_packed(rp))	    rp++;	else {	    /* Full-size ref.  Store the relocation here if possible. */	    ref *const pref = (ref *)rp;	    if (!ref_type_uses_size_or_null(r_type(pref))) {		if_debug1('8', "  [8]clearing reloc at 0x%lx/n", (ulong) rp);		r_set_size(pref, 0);	    }	    rp += packed_per_ref;	}    }}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:22,


示例13: obj_string_data

/* * Set *pchars and *plen to point to the data of a name or string, and * return 0.  If the object isn't a name or string, return e_typecheck. * If the object is a string without read access, return e_invalidaccess. */intobj_string_data(const gs_memory_t *mem, const ref *op, const byte **pchars, uint *plen){    switch (r_type(op)) {    case t_name: {	ref nref;	name_string_ref(mem, op, &nref);	*pchars = nref.value.bytes;	*plen = r_size(&nref);	return 0;    }    case t_string:	check_read(*op);	*pchars = op->value.bytes;	*plen = r_size(op);	return 0;    default:	return_error(e_typecheck);    }}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:26,


示例14: test_add

void test_add(){	printf("===test ADD===/n");	struct cpu_struct cpu;	memset(&cpu, 0, sizeof(cpu));	cpu.current_ins.rs = 1;	cpu.current_ins.rt = 2;	cpu.current_ins.rd = 3;	cpu.current_ins.funct = 0x20;	int i;	for (i = 0; i < 100; i++) {		int a = rand();		int b = rand();		cpu.reg[1] = a;		cpu.reg[2] = b;		r_type(&cpu);		printf("%d + %d: %d/n", a, b, cpu.reg[3]);		assert(cpu.reg[3] == a+b);	}	printf("pass/n/n");}
开发者ID:ChienYuLu,项目名称:archi_project,代码行数:21,


示例15: num_array_get

/* or an error if the format is invalid. */intnum_array_get(const ref *op, int format, uint index, ref *np){	if ( format == num_array )	  {	int code = array_get(op, (long)index, np);		if ( code < 0 )		  return t_null;		switch ( r_type(np) )		  {		  case t_integer:			return t_integer;		  case t_real:			return t_real;		  default:			return_error(e_rangecheck);		  }	  }	else	  {	uint nbytes = encoded_number_bytes(format);		if ( index >= (r_size(op) - 4) / nbytes )		  return t_null;		return sdecode_number(op->value.bytes + 4 + index * nbytes,				      format, np);	  }}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:25,



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


C++ rad函数代码示例
C++ r_sys_getenv函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。