这篇教程C++ type_print函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中type_print函数的典型用法代码示例。如果您正苦于以下问题:C++ type_print函数的具体用法?C++ type_print怎么用?C++ type_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了type_print函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: expr_typecheckstruct type * expr_typecheck(struct expr *e) { if(!e) return type_create(TYPE_VOID, 0, 0, 0); struct type *L = expr_typecheck(e->left); struct type *R = expr_typecheck(e->right); switch(e->kind) { case EXPR_ASSIGNMENT: if(L->kind == TYPE_FUNCTION){ printf("type error: cannot use assignment operator on function "); expr_print(e->left); error_count++; } if(R->kind == TYPE_FUNCTION){ printf("type error: cannot use assignment operator on function "); expr_print(e->right); error_count++; } if(!type_compare(L, R)){ printf("type error: cannot assign "); type_print(R); printf(" "); expr_print(e->right); printf(" to "); type_print(L); printf(" "); expr_print(e->left); printf("/n"); error_count++; } return L; break; case EXPR_GE: if(L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER){ printf("type error: cannot use operator >= to compare "); type_print(L); printf(" "); expr_print(e->left); printf(" and "); type_print(R); printf(" "); expr_print(e->right); printf(". This operator can only be used on two integers./n"); error_count++; } return type_create(TYPE_BOOLEAN, 0, 0, 0); break; case EXPR_LE: if(L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER){ printf("type error: cannot use operator <= to compare "); type_print(L); expr_print(e->left); printf(" and "); type_print(R); expr_print(e->right); printf(". This operator can only be used on two integers./n"); error_count++; } return type_create(TYPE_BOOLEAN, 0, 0, 0); break; case EXPR_GT: if(L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER){ printf("type error: cannot use operator > to compare "); type_print(L); printf(" "); expr_print(e->left); printf(" and "); type_print(R); printf(" "); expr_print(e->right); printf(". This operator can only be used on two integers./n"); error_count++; } return type_create(TYPE_BOOLEAN, 0, 0, 0); break; case EXPR_LT: if(L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER){ printf("type error: cannot use operator < to compare "); type_print(L); printf(" "); expr_print(e->left); printf(" and "); type_print(R); printf(" "); expr_print(e->right); printf(". This operator can only be used on two integers./n"); error_count++; } return type_create(TYPE_BOOLEAN, 0, 0, 0); break; case EXPR_EQ: if(L->kind == TYPE_ARRAY){ printf("type error: cannot use operator == on array "); expr_print(e->left); printf("/n"); error_count++; } else if(L->kind == TYPE_FUNCTION){ printf("type error: cannot use operator == on function "); expr_print(e->left); printf("/n"); error_count++; }//.........这里部分代码省略.........
开发者ID:cjbara,项目名称:cminorCompiler,代码行数:101,
示例2: c_val_print//.........这里部分代码省略......... { print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); break; } len = TYPE_NFIELDS (type); val = unpack_long (type, valaddr + embedded_offset); for (i = 0; i < len; i++) { QUIT; if (val == TYPE_FIELD_BITPOS (type, i)) { break; } } if (i < len) { fputs_filtered (TYPE_FIELD_NAME (type, i), stream); } else { print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_FUNC: if (format) { print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (address, stream, demangle); break; case TYPE_CODE_BOOL: format = format ? format : output_format; if (format) print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); else { val = unpack_long (type, valaddr + embedded_offset); if (val == 0) fputs_filtered ("false", stream); else if (val == 1) fputs_filtered ("true", stream); else print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_RANGE: /* FIXME: create_range_type does not set the unsigned bit in a range type (I think it probably should copy it from the target type), so we won't print values which are too large to fit in a signed integer correctly. */ /* FIXME: Doesn't handle ranges of enums correctly. (Can't just print with the target type, though, because the size of our type and the target type might differ). */ /* FALLTHROUGH */ case TYPE_CODE_INT:
开发者ID:HoMeCracKeR,项目名称:gdb-ng,代码行数:67,
示例3: dump_subexp_body_standardintdump_subexp_body_standard (struct expression *exp, struct ui_file *stream, int elt){ int opcode = exp->elts[elt++].opcode; switch (opcode) { case TERNOP_COND: case TERNOP_SLICE: case TERNOP_SLICE_COUNT: elt = dump_subexp (exp, stream, elt); case BINOP_ADD: case BINOP_SUB: case BINOP_MUL: case BINOP_DIV: case BINOP_REM: case BINOP_MOD: case BINOP_LSH: case BINOP_RSH: case BINOP_LOGICAL_AND: case BINOP_LOGICAL_OR: case BINOP_BITWISE_AND: case BINOP_BITWISE_IOR: case BINOP_BITWISE_XOR: case BINOP_EQUAL: case BINOP_NOTEQUAL: case BINOP_LESS: case BINOP_GTR: case BINOP_LEQ: case BINOP_GEQ: case BINOP_REPEAT: case BINOP_ASSIGN: case BINOP_COMMA: case BINOP_SUBSCRIPT: case BINOP_EXP: case BINOP_MIN: case BINOP_MAX: case BINOP_INTDIV: case BINOP_ASSIGN_MODIFY: case BINOP_VAL: case BINOP_INCL: case BINOP_EXCL: case BINOP_CONCAT: case BINOP_IN: case BINOP_RANGE: case BINOP_END: elt = dump_subexp (exp, stream, elt); case UNOP_NEG: case UNOP_LOGICAL_NOT: case UNOP_COMPLEMENT: case UNOP_IND: case UNOP_ADDR: case UNOP_PREINCREMENT: case UNOP_POSTINCREMENT: case UNOP_PREDECREMENT: case UNOP_POSTDECREMENT: case UNOP_SIZEOF: case UNOP_PLUS: case UNOP_CAP: case UNOP_CHR: case UNOP_ORD: case UNOP_ABS: case UNOP_FLOAT: case UNOP_HIGH: case UNOP_MAX: case UNOP_MIN: case UNOP_ODD: case UNOP_TRUNC: case UNOP_LOWER: case UNOP_UPPER: case UNOP_LENGTH: case UNOP_CARD: case UNOP_CHMAX: case UNOP_CHMIN: elt = dump_subexp (exp, stream, elt); break; case OP_LONG: fprintf_filtered (stream, "Type @"); gdb_print_host_address (exp->elts[elt].type, stream); fprintf_filtered (stream, " ("); type_print (exp->elts[elt].type, NULL, stream, 0); fprintf_filtered (stream, "), value %ld (0x%lx)", (long) exp->elts[elt + 1].longconst, (long) exp->elts[elt + 1].longconst); elt += 3; break; case OP_DOUBLE: fprintf_filtered (stream, "Type @"); gdb_print_host_address (exp->elts[elt].type, stream); fprintf_filtered (stream, " ("); type_print (exp->elts[elt].type, NULL, stream, 0); fprintf_filtered (stream, "), value %g", (double) exp->elts[elt + 1].doubleconst); elt += 3; break; case OP_VAR_VALUE: fprintf_filtered (stream, "Block @"); gdb_print_host_address (exp->elts[elt].block, stream); fprintf_filtered (stream, ", symbol @");//.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例4: f_val_print//.........这里部分代码省略......... { if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) { struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr + embedded_offset), NULL); val_print (VALUE_TYPE (deref_val), VALUE_CONTENTS (deref_val), 0, VALUE_ADDRESS (deref_val), stream, format, deref_ref, recurse, pretty); } else fputs_filtered ("???", stream); } break; case TYPE_CODE_FUNC: if (format) { print_scalar_formatted (valaddr, type, format, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (address, stream, demangle); break; case TYPE_CODE_INT: format = format ? format : output_format; if (format) print_scalar_formatted (valaddr, type, format, 0, stream); else { val_print_type_code_int (type, valaddr, stream); /* C and C++ has no single byte int type, char is used instead. Since we don't know whether the value is really intended to be used as an integer or a character, print the character equivalent as well. */ if (TYPE_LENGTH (type) == 1) { fputs_filtered (" ", stream); LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr), stream); } } break; case TYPE_CODE_FLT: if (format) print_scalar_formatted (valaddr, type, format, 0, stream); else print_floating (valaddr, type, stream); break;
开发者ID:2014-class,项目名称:freerouter,代码行数:66,
示例5: c_type_print_basevoidc_type_print_base (struct type *type, struct ui_file *stream, int show, int level){ int i; int len, real_len; int lastval; char *mangled_name; char *demangled_name; char *demangled_no_static; enum { s_none, s_public, s_private, s_protected } section_type; int need_access_label = 0; int j, len2; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered (_("<type unknown>"), stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ /* If we have "typedef struct foo {. . .} bar;" do we want to print it as "struct foo" or as "bar"? Pick the latter, because C++ folk tend to expect things like "class5 *foo" rather than "struct class5 *foo". */ if (show <= 0 && TYPE_NAME (type) != NULL) { c_type_print_modifier (type, stream, 0, 1); fputs_filtered (TYPE_NAME (type), stream); return; } CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { case TYPE_CODE_TYPEDEF: case TYPE_CODE_ARRAY: case TYPE_CODE_PTR: case TYPE_CODE_MEMBER: case TYPE_CODE_REF: case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_STRUCT: c_type_print_modifier (type, stream, 0, 1); /* Note TYPE_CODE_STRUCT and TYPE_CODE_CLASS have the same value, * so we use another means for distinguishing them. */ if (HAVE_CPLUS_STRUCT (type)) { switch (TYPE_DECLARED_TYPE (type)) { case DECLARED_TYPE_CLASS: fprintf_filtered (stream, "class "); break; case DECLARED_TYPE_UNION: fprintf_filtered (stream, "union "); break; case DECLARED_TYPE_STRUCT: fprintf_filtered (stream, "struct "); break; default: /* If there is a CPLUS_STRUCT, assume class if not * otherwise specified in the declared_type field. */ fprintf_filtered (stream, "class "); break; } /* switch */ } else { /* If not CPLUS_STRUCT, then assume it's a C struct */ fprintf_filtered (stream, "struct "); } goto struct_union; case TYPE_CODE_UNION: c_type_print_modifier (type, stream, 0, 1); fprintf_filtered (stream, "union "); struct_union: /* Print the tag if it exists. * The HP aCC compiler emits * a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" * tag for unnamed struct/union/enum's, which we don't * want to print. *///.........这里部分代码省略.........
开发者ID:aosm,项目名称:gdb,代码行数:101,
示例6: java_type_print_basestatic voidjava_type_print_base (struct type *type, struct ui_file *stream, int show, int level, const struct type_print_options *flags){ int i; int len; char *mangled_name; char *demangled_name; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered ("<type unknown>", stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ if (show <= 0 && TYPE_NAME (type) != NULL) { fputs_filtered (TYPE_NAME (type), stream); return; } type = check_typedef (type); switch (TYPE_CODE (type)) { case TYPE_CODE_PTR: java_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level, flags); break; case TYPE_CODE_STRUCT: if (TYPE_TAG_NAME (type) != NULL && TYPE_TAG_NAME (type)[0] == '[') { /* array type */ char *name = java_demangle_type_signature (TYPE_TAG_NAME (type)); fputs_filtered (name, stream); xfree (name); break; } if (show >= 0) fprintf_filtered (stream, "class "); if (TYPE_TAG_NAME (type) != NULL) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show > 0) fputs_filtered (" ", stream); } wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { java_type_print_derivation_info (stream, type); fprintf_filtered (stream, "{/n"); if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0)) { if (TYPE_STUB (type)) fprintfi_filtered (level + 4, stream, "<incomplete type>/n"); else fprintfi_filtered (level + 4, stream, "<no data fields>/n"); } /* If there is a base class for this type, do not print the field that it occupies. */ len = TYPE_NFIELDS (type); for (i = TYPE_N_BASECLASSES (type); i < len; i++) { QUIT; /* Don't print out virtual function table. */ if (startswith (TYPE_FIELD_NAME (type, i), "_vptr") && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; /* Don't print the dummy field "class". */ if (startswith (TYPE_FIELD_NAME (type, i), "class")) continue; print_spaces_filtered (level + 4, stream); if (HAVE_CPLUS_STRUCT (type)) { if (TYPE_FIELD_PROTECTED (type, i)) fprintf_filtered (stream, "protected ");//.........这里部分代码省略.........
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:101,
示例7: dump_subexp_body_standardintdump_subexp_body_standard (struct expression *exp, struct ui_file *stream, int elt){ int opcode = exp->elts[elt++].opcode; switch (opcode) { case TERNOP_COND: case TERNOP_SLICE: elt = dump_subexp (exp, stream, elt); /* FALL THROUGH */ case BINOP_ADD: case BINOP_SUB: case BINOP_MUL: case BINOP_DIV: case BINOP_REM: case BINOP_MOD: case BINOP_LSH: case BINOP_RSH: case BINOP_LOGICAL_AND: case BINOP_LOGICAL_OR: case BINOP_BITWISE_AND: case BINOP_BITWISE_IOR: case BINOP_BITWISE_XOR: case BINOP_EQUAL: case BINOP_NOTEQUAL: case BINOP_LESS: case BINOP_GTR: case BINOP_LEQ: case BINOP_GEQ: case BINOP_REPEAT: case BINOP_ASSIGN: case BINOP_COMMA: case BINOP_SUBSCRIPT: case BINOP_EXP: case BINOP_MIN: case BINOP_MAX: case BINOP_INTDIV: case BINOP_ASSIGN_MODIFY: case BINOP_VAL: case BINOP_CONCAT: case BINOP_IN: case BINOP_RANGE: case BINOP_END: case STRUCTOP_MEMBER: case STRUCTOP_MPTR: elt = dump_subexp (exp, stream, elt); /* FALL THROUGH */ case UNOP_NEG: case UNOP_LOGICAL_NOT: case UNOP_COMPLEMENT: case UNOP_IND: case UNOP_ADDR: case UNOP_PREINCREMENT: case UNOP_POSTINCREMENT: case UNOP_PREDECREMENT: case UNOP_POSTDECREMENT: case UNOP_SIZEOF: case UNOP_PLUS: case UNOP_CAP: case UNOP_CHR: case UNOP_ORD: case UNOP_ABS: case UNOP_FLOAT: case UNOP_HIGH: case UNOP_MAX: case UNOP_MIN: case UNOP_ODD: case UNOP_TRUNC: elt = dump_subexp (exp, stream, elt); break; case OP_LONG: fprintf_filtered (stream, "Type @"); gdb_print_host_address (exp->elts[elt].type, stream); fprintf_filtered (stream, " ("); type_print (exp->elts[elt].type, NULL, stream, 0); fprintf_filtered (stream, "), value %ld (0x%lx)", (long) exp->elts[elt + 1].longconst, (long) exp->elts[elt + 1].longconst); elt += 3; break; case OP_DOUBLE: fprintf_filtered (stream, "Type @"); gdb_print_host_address (exp->elts[elt].type, stream); fprintf_filtered (stream, " ("); type_print (exp->elts[elt].type, NULL, stream, 0); fprintf_filtered (stream, "), value %g", (double) exp->elts[elt + 1].doubleconst); elt += 3; break; case OP_VAR_VALUE: fprintf_filtered (stream, "Block @"); gdb_print_host_address (exp->elts[elt].block, stream); fprintf_filtered (stream, ", symbol @"); gdb_print_host_address (exp->elts[elt + 1].symbol, stream); fprintf_filtered (stream, " (%s)", SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol)); elt += 3; break;//.........这里部分代码省略.........
开发者ID:5kg,项目名称:gdb,代码行数:101,
示例8: ada_val_print_numstatic voidada_val_print_num (struct type *type, const gdb_byte *valaddr, int offset, int offset_aligned, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *original_value, const struct value_print_options *options, const struct language_defn *language){ if (ada_is_fixed_point_type (type)) { LONGEST v = unpack_long (type, valaddr + offset_aligned); fprintf_filtered (stream, TYPE_LENGTH (type) < 4 ? "%.11g" : "%.17g", (double) ada_fixed_to_float (type, v)); return; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) { struct type *target_type = TYPE_TARGET_TYPE (type); if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type)) { /* Obscure case of range type that has different length from its base type. Perform a conversion, or we will get a nonsense value. Actually, we could use the same code regardless of lengths; I'm just avoiding a cast. */ struct value *v1 = value_from_contents_and_address (type, valaddr + offset, 0); struct value *v = value_cast (target_type, v1); val_print (target_type, value_embedded_offset (v), 0, stream, recurse + 1, v, options, language); } else val_print (TYPE_TARGET_TYPE (type), offset, address, stream, recurse, original_value, options, language); return; } else { int format = (options->format ? options->format : options->output_format); if (format) { struct value_print_options opts = *options; opts.format = format; val_print_scalar_formatted (type, offset_aligned, original_value, &opts, 0, stream); } else if (ada_is_system_address_type (type)) { /* FIXME: We want to print System.Address variables using the same format as for any access type. But for some reason GNAT encodes the System.Address type as an int, so we have to work-around this deficiency by handling System.Address values as a special case. */ struct gdbarch *gdbarch = get_type_arch (type); struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; CORE_ADDR addr = extract_typed_address (valaddr + offset_aligned, ptr_type); fprintf_filtered (stream, "("); type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); fputs_filtered (paddress (gdbarch, addr), stream); } else { val_print_type_code_int (type, valaddr + offset_aligned, stream); if (ada_is_character_type (type)) { LONGEST c; fputs_filtered (" ", stream); c = unpack_long (type, valaddr + offset_aligned); ada_printchar (c, type, stream); } } return; }}
开发者ID:kraj,项目名称:binutils-gdb,代码行数:86,
示例9: decl_typecheckvoid decl_typecheck(struct decl *d){ if(!d)return; if(d->value){ if(d->type->kind!=TYPE_ARRAY){ struct type* t; t = expr_typecheck(d->value); if(d->type-> kind != t->kind){ printf("Cannot assign "); expr_print(d->value); printf(" to "); type_print(d->type); printf("/n"); get_incrementError(2); } }else { if(d->value->kind!=EXPR_ARRAY_LIST){ printf("Cannot assign "); expr_print(d->value); printf(" to array %s/n",d->name); get_incrementError(2); } else{ struct type* aux_type = d->type; int lenght = 1; if(aux_type->expression){ while(aux_type->kind == TYPE_ARRAY){ if(aux_type->expression && aux_type->expression->kind!= EXPR_INTEGER_LITERAL){ printf("Array %s must have a literal value as index/n",d->name); lenght = 99999; break; } else{ lenght*=aux_type->expression->literal_value; } aux_type = aux_type->subtype; } } else{ lenght = 99999; while(aux_type->kind == TYPE_ARRAY)aux_type = aux_type->subtype; } resolve_array_values(d->value,aux_type,d->name); if(const_expr > lenght){ get_incrementError(2); printf("Too many arguments on inicialization of array %s/n",d->name); } } } } if(d->symbol->kind == SYMBOL_GLOBAL) { const_expr = 0; expr_constant(d->value); if(const_expr>0){ get_incrementError(1); printf("Tried to assign not constant variable in the declaration of %s/n",d->name); } } if(d->code)stmt_typecheck(d->code,d->type->subtype); decl_typecheck(d->next);}
开发者ID:brunobraga95,项目名称:Compilers-Project-Cminor,代码行数:69,
示例10: c_value_printintc_value_print (struct value *val, struct ui_file *stream, const struct value_print_options *options){ struct type *type, *real_type, *val_type; int full, top, using_enc; struct value_print_options opts = *options; opts.deref_ref = 1; /* If it is a pointer, indicate what it points to. Print type also if it is a reference. C++: if it is a member pointer, we will take care of that when we print it. */ /* Preserve the original type before stripping typedefs. We prefer to pass down the original type when possible, but for local checks it is better to look past the typedefs. */ val_type = value_type (val); type = check_typedef (val_type); if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF) { /* Hack: remove (char *) for char strings. Their type is indicated by the quoted string anyway. (Don't use c_textual_element_type here; quoted strings are always exactly (char *), (wchar_t *), or the like. */ if (TYPE_CODE (val_type) == TYPE_CODE_PTR && TYPE_NAME (val_type) == NULL && TYPE_NAME (TYPE_TARGET_TYPE (val_type)) != NULL && (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (val_type)), "char") == 0 || textual_name (TYPE_NAME (TYPE_TARGET_TYPE (val_type))))) { /* Print nothing */ } else if (options->objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) { if (TYPE_CODE(type) == TYPE_CODE_REF) { /* Copy value, change to pointer, so we don't get an * error about a non-pointer type in value_rtti_target_type */ struct value *temparg; temparg=value_copy(val); deprecated_set_value_type (temparg, lookup_pointer_type (TYPE_TARGET_TYPE(type))); val=temparg; } /* Pointer to class, check real type of object */ fprintf_filtered (stream, "("); real_type = value_rtti_target_type (val, &full, &top, &using_enc); if (real_type) { /* RTTI entry found */ if (TYPE_CODE (type) == TYPE_CODE_PTR) { /* create a pointer type pointing to the real type */ type = lookup_pointer_type (real_type); } else { /* create a reference type referencing the real type */ type = lookup_reference_type (real_type); } /* JYG: Need to adjust pointer value. */ /* NOTE: cagney/2005-01-02: THIS IS BOGUS. */ value_contents_writeable (val)[0] -= top; /* Note: When we look up RTTI entries, we don't get any information on const or volatile attributes */ } type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); val_type = type; } else { /* normal case */ fprintf_filtered (stream, "("); type_print (value_type (val), "", stream, -1); fprintf_filtered (stream, ") "); } } if (!value_initialized (val)) fprintf_filtered (stream, " [uninitialized] "); if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object */ real_type = value_rtti_type (val, &full, &top, &using_enc); if (real_type) { /* We have RTTI information, so use it */ val = value_full_object (val, real_type, full, top, using_enc); fprintf_filtered (stream, "(%s%s) ",//.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例11: ada_val_print_1//.........这里部分代码省略......... if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type)) { /* Obscure case of range type that has different length from its base type. Perform a conversion, or we will get a nonsense value. Actually, we could use the same code regardless of lengths; I'm just avoiding a cast. */ struct value *v = value_cast (target_type, value_from_contents_and_address (type, valaddr, 0)); return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0, stream, format, 0, recurse + 1, pretty); } else return ada_val_print_1 (TYPE_TARGET_TYPE (type), valaddr0, embedded_offset, address, stream, format, deref_ref, recurse, pretty); } else { format = format ? format : output_format; if (format) { print_scalar_formatted (valaddr, type, format, 0, stream); } else if (ada_is_system_address_type (type)) { /* FIXME: We want to print System.Address variables using the same format as for any access type. But for some reason GNAT encodes the System.Address type as an int, so we have to work-around this deficiency by handling System.Address values as a special case. */ fprintf_filtered (stream, "("); type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); print_address_numeric (extract_typed_address (valaddr, builtin_type_void_data_ptr), 1, stream); } else { val_print_type_code_int (type, valaddr, stream); if (ada_is_character_type (type)) { fputs_filtered (" ", stream); ada_printchar ((unsigned char) unpack_long (type, valaddr), stream); } } return 0; } case TYPE_CODE_ENUM: if (format) { print_scalar_formatted (valaddr, type, format, 0, stream); break; } len = TYPE_NFIELDS (type); val = unpack_long (type, valaddr); for (i = 0; i < len; i++) { QUIT; if (val == TYPE_FIELD_BITPOS (type, i)) { break;
开发者ID:sjohnston-adventiumlabs,项目名称:xen-micart-scheduler,代码行数:67,
示例12: c_val_print//.........这里部分代码省略......... { break; } } if (i < len) { fputs_filtered (TYPE_FIELD_NAME (type, i), stream); } else { print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_FLAGS: if (options->format) print_scalar_formatted (valaddr + embedded_offset, type, options, 0, stream); else val_print_type_code_flags (type, valaddr + embedded_offset, stream); break; case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: if (options->format) { print_scalar_formatted (valaddr + embedded_offset, type, options, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_BOOL: if (options->format || options->output_format) { struct value_print_options opts = *options; opts.format = (options->format ? options->format : options->output_format); print_scalar_formatted (valaddr + embedded_offset, type, &opts, 0, stream); } else { val = unpack_long (type, valaddr + embedded_offset); if (val == 0) fputs_filtered ("false", stream); else if (val == 1) fputs_filtered ("true", stream); else print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_RANGE: /* FIXME: create_range_type does not set the unsigned bit in a range type (I think it probably should copy it from the target type), so we won't print values which are too large to fit in a signed integer correctly. */ /* FIXME: Doesn't handle ranges of enums correctly. (Can't just
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:67,
示例13: inspect_type//.........这里部分代码省略......... || TYPE_CODE (otype) == TYPE_CODE_NAMESPACE) { long len; int is_anon; struct type *type; struct demangle_parse_info *i; struct ui_file *buf; /* Get the real type of the typedef. */ type = check_typedef (otype); /* If the symbol is a namespace and its type name is no different than the name we looked up, this symbol is not a namespace alias and does not need to be substituted. */ if (TYPE_CODE (otype) == TYPE_CODE_NAMESPACE && strcmp (TYPE_NAME (type), name) == 0) return 0; is_anon = (TYPE_TAG_NAME (type) == NULL && (TYPE_CODE (type) == TYPE_CODE_ENUM || TYPE_CODE (type) == TYPE_CODE_STRUCT || TYPE_CODE (type) == TYPE_CODE_UNION)); if (is_anon) { struct type *last = otype; /* Find the last typedef for the type. */ while (TYPE_TARGET_TYPE (last) != NULL && (TYPE_CODE (TYPE_TARGET_TYPE (last)) == TYPE_CODE_TYPEDEF)) last = TYPE_TARGET_TYPE (last); /* If there is only one typedef for this anonymous type, do not substitute it. */ if (type == otype) return 0; else /* Use the last typedef seen as the type for this anonymous type. */ type = last; } buf = mem_fileopen (); TRY { type_print (type, "", buf, -1); } /* If type_print threw an exception, there is little point in continuing, so just bow out gracefully. */ CATCH (except, RETURN_MASK_ERROR) { ui_file_delete (buf); return 0; } END_CATCH name = ui_file_obsavestring (buf, &info->obstack, &len); ui_file_delete (buf); /* Turn the result into a new tree. Note that this tree will contain pointers into NAME, so NAME cannot be free'd until all typedef conversion is done and the final result is converted into a string. */ i = cp_demangled_name_to_comp (name, NULL); if (i != NULL) { /* Merge the two trees. */ cp_merge_demangle_parse_infos (info, ret_comp, i); /* Replace any newly introduced typedefs -- but not if the type is anonymous (that would lead to infinite looping). */ if (!is_anon) replace_typedefs (info, ret_comp, finder, data); } else { /* This shouldn't happen unless the type printer has output something that the name parser cannot grok. Nonetheless, an ounce of prevention... Canonicalize the name again, and store it in the current node (RET_COMP). */ char *canon = cp_canonicalize_string_no_typedefs (name); if (canon != NULL) { /* Copy the canonicalization into the obstack and free CANON. */ name = copy_string_to_obstack (&info->obstack, canon, &len); xfree (canon); } ret_comp->u.s_name.s = name; ret_comp->u.s_name.len = len; } return 1; }
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:101,
示例14: list_args_or_locals/* Print a list of the locals or the arguments for the currently selected frame. If the argument passed is 0, printonly the names of the variables, if an argument of 1 is passed, print the values as well. */static voidlist_args_or_locals (int locals, int values, struct frame_info *fi){ struct block *block; struct symbol *sym; struct dict_iterator iter; int nsyms; struct cleanup *cleanup_list; static struct ui_stream *stb = NULL; struct type *type; stb = ui_out_stream_new (uiout); block = get_frame_block (fi, 0); cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args"); while (block != 0) { ALL_BLOCK_SYMBOLS (block, iter, sym) { int print_me = 0; switch (SYMBOL_CLASS (sym)) { default: case LOC_UNDEF: /* catches errors */ case LOC_CONST: /* constant */ case LOC_TYPEDEF: /* local typedef */ case LOC_LABEL: /* local label */ case LOC_BLOCK: /* local function */ case LOC_CONST_BYTES: /* loc. byte seq. */ case LOC_UNRESOLVED: /* unresolved static */ case LOC_OPTIMIZED_OUT: /* optimized out */ print_me = 0; break; case LOC_ARG: /* argument */ case LOC_REF_ARG: /* reference arg */ case LOC_REGPARM: /* register arg */ case LOC_REGPARM_ADDR: /* indirect register arg */ case LOC_LOCAL_ARG: /* stack arg */ case LOC_BASEREG_ARG: /* basereg arg */ case LOC_COMPUTED_ARG: /* arg with computed location */ if (!locals) print_me = 1; break; case LOC_LOCAL: /* stack local */ case LOC_BASEREG: /* basereg local */ case LOC_STATIC: /* static */ case LOC_REGISTER: /* register */ case LOC_COMPUTED: /* computed location */ if (locals) print_me = 1; break; } if (print_me) { struct cleanup *cleanup_tuple = NULL; struct symbol *sym2; if (values != PRINT_NO_VALUES) cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym)); if (!locals) sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym), block, VAR_DOMAIN, (int *) NULL, (struct symtab **) NULL); else sym2 = sym; switch (values) { case PRINT_SIMPLE_VALUES: type = check_typedef (sym2->type); type_print (sym2->type, "", stb->stream, -1); ui_out_field_stream (uiout, "type", stb); if (TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_CODE (type) != TYPE_CODE_STRUCT && TYPE_CODE (type) != TYPE_CODE_UNION) { print_variable_value (sym2, fi, stb->stream); ui_out_field_stream (uiout, "value", stb); } do_cleanups (cleanup_tuple); break; case PRINT_ALL_VALUES: print_variable_value (sym2, fi, stb->stream); ui_out_field_stream (uiout, "value", stb); do_cleanups (cleanup_tuple); break; } } }//.........这里部分代码省略.........
开发者ID:DonCN,项目名称:haiku,代码行数:101,
示例15: cpp_basic_data_type//.........这里部分代码省略......... c = 'G'; goto dochar; // same as TYushort } else { pstate.STflags |= PFLmfc; c = 'Y'; goto dochar2; } // Digital Mars extensions case TYifloat: c = 'R'; goto dochar2; case TYidouble: c = 'S'; goto dochar2; case TYildouble: c = 'T'; goto dochar2; case TYcfloat: c = 'U'; goto dochar2; case TYcdouble: c = 'V'; goto dochar2; case TYcldouble: c = 'W'; goto dochar2; case TYchar16: c = 'X'; goto dochar2; case TYdchar: c = 'Y'; goto dochar2; case TYnullptr: c = 'Z'; goto dochar2; dochar2: CHAR('_'); goto dochar;#if TARGET_SEGMENTED case TYsptr: case TYcptr: case TYf16ptr: case TYfptr: case TYhptr: case TYvptr:#endif#if !MARS case TYmemptr:#endif case TYnptr: c = 'P' + cpp_cvidx(t->Tty); CHAR(c); if(I64) CHAR('E'); // __ptr64 modifier cpp_pointer_type(t); break; case TYstruct: case TYenum: cpp_ecsu_data_type(t); break; case TYarray: i = cpp_cvidx(t->Tty); i |= 1; // always const CHAR('P' + i); cpp_pointer_type(t); break; case TYvoid: c = 'X'; goto dochar;#if !MARS case TYident: if (pstate.STintemplate) { CHAR('V'); // pretend to be a class name cpp_zname(t->Tident); } else {#if SCPP cpperr(EM_no_type,t->Tident); // no type for argument#endif c = 'X'; goto dochar; } break; case TYtemplate: if (pstate.STintemplate) { CHAR('V'); // pretend to be a class name cpp_zname(((typetemp_t *)t)->Tsym->Sident); } else goto Ldefault; break;#endif default: Ldefault: if (tyfunc(t->Tty)) cpp_function_type(t); else {#if SCPP#ifdef DEBUG if (!errcnt) type_print(t);#endif assert(errcnt);#endif } }}
开发者ID:AlbertLkn,项目名称:dmd,代码行数:101,
示例16: java_value_printintjava_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty){ struct type *type; CORE_ADDR address; int i; char *name; type = VALUE_TYPE (val); address = VALUE_ADDRESS (val) + VALUE_OFFSET (val); if (is_object_type (type)) { CORE_ADDR obj_addr; /* Get the run-time type, and cast the object into that */ obj_addr = unpack_pointer (type, VALUE_CONTENTS (val)); if (obj_addr != 0) { type = type_from_class (java_class_from_object (val)); type = lookup_pointer_type (type); val = value_at (type, address, NULL); } } if (TYPE_CODE (type) == TYPE_CODE_PTR && !value_logical_not (val)) type_print (TYPE_TARGET_TYPE (type), "", stream, -1); name = TYPE_TAG_NAME (type); if (TYPE_CODE (type) == TYPE_CODE_STRUCT && name != NULL && (i = strlen (name), name[i - 1] == ']')) { char buf4[4]; long length; unsigned int things_printed = 0; int reps; struct type *el_type = java_primitive_type_from_name (name, i - 2); i = 0; read_memory (address + JAVA_OBJECT_SIZE, buf4, 4); length = (long) extract_signed_integer (buf4, 4); fprintf_filtered (stream, "{length: %ld", length); if (el_type == NULL) { CORE_ADDR element; CORE_ADDR next_element = -1; /* dummy initial value */ address += JAVA_OBJECT_SIZE + 4; /* Skip object header and length. */ while (i < length && things_printed < print_max) { char *buf; buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT); fputs_filtered (", ", stream); wrap_here (n_spaces (2)); if (i > 0) element = next_element; else { read_memory (address, buf, sizeof (buf)); address += TARGET_PTR_BIT / HOST_CHAR_BIT; element = extract_address (buf, sizeof (buf)); } for (reps = 1; i + reps < length; reps++) { read_memory (address, buf, sizeof (buf)); address += TARGET_PTR_BIT / HOST_CHAR_BIT; next_element = extract_address (buf, sizeof (buf)); if (next_element != element) break; } if (reps == 1) fprintf_filtered (stream, "%d: ", i); else fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1); if (element == 0) fprintf_filtered (stream, "null"); else fprintf_filtered (stream, "@%s", paddr_nz (element)); things_printed++; i += reps; } } else { struct value *v = allocate_value (el_type); struct value *next_v = allocate_value (el_type);//.........这里部分代码省略.........
开发者ID:jichu4n,项目名称:prc-tools-remix,代码行数:101,
示例17: switchstruct type *expr_typecheck(struct expr *e) { if(!e) return type_create(TYPE_VOID, 0, 0, 0); struct param_list *param_ptr; struct expr *expr_ptr; struct type *left; struct type *right; switch(e->kind) { case EXPR_LIST: left = expr_typecheck(e->left); right = expr_typecheck(e->right); return type_create(TYPE_VOID, 0, 0, 0); break; case EXPR_ASSIGNMENT: left = expr_typecheck(e->left); right = expr_typecheck(e->right); while(left->kind == TYPE_ARRAY) left = left->subtype; while(right->kind == TYPE_ARRAY) left = left->subtype; if(type_equal(left, right) && left->kind != TYPE_FUNCTION) { return type_copy(left); } else { printf("Cannot assign "); type_print(right); printf(" to "); type_print(left); if(e->left->name) { printf(" %s/n", e->left->name); } else { printf("/n"); } type_check_errors++; return left; } break; case EXPR_NOT_EQUALS: case EXPR_EQUALS: left = expr_typecheck(e->left); right = expr_typecheck(e->right); if(type_equal(left, right) && left->kind != TYPE_FUNCTION && left->kind != TYPE_ARRAY) { return type_create(TYPE_BOOLEAN, 0, 0, 0); } else { printf("Cannot perform logical equals operation on "); type_print(left); printf(" and "); type_print(right); printf("/n"); type_check_errors++; return type_create(TYPE_BOOLEAN, 0, 0, 0); } break; case EXPR_LT: case EXPR_GT: case EXPR_LE: case EXPR_GE: left = expr_typecheck(e->left); right = expr_typecheck(e->right); if(left->kind == TYPE_INTEGER && right->kind == TYPE_INTEGER) { return type_create(TYPE_BOOLEAN, 0, 0, 0); } else { printf("Cannot perform boolean operations on "); type_print(left); printf(" and "); type_print(right); printf("/n"); type_check_errors++; return type_create(TYPE_BOOLEAN, 0, 0, 0); } break; case EXPR_ADD: case EXPR_MINUS: case EXPR_TIMES: case EXPR_DIVIDES: case EXPR_MOD: case EXPR_POWER: left = expr_typecheck(e->left); right = expr_typecheck(e->right); if(left->kind == TYPE_INTEGER && right->kind == TYPE_INTEGER) { return type_create(TYPE_INTEGER, 0, 0, 0); } else { printf("Cannot perform arithmetic operations on "); type_print(left); printf(" and "); type_print(right); printf("/n"); type_check_errors++; return type_create(TYPE_INTEGER, 0, 0, 0); } break; case EXPR_NEGATIVE: right = expr_typecheck(e->right); if(right->kind == TYPE_INTEGER) { return type_create(TYPE_INTEGER, 0, 0, 0); } else { printf("Cannot take the negative of "); type_print(right); printf("/n"); type_check_errors++; return type_create(TYPE_INTEGER, 0, 0, 0); } break; case EXPR_OR://.........这里部分代码省略.........
开发者ID:dmattia,项目名称:C-minor-Compiler,代码行数:101,
示例18: expr_typecheckstruct type * expr_typecheck( struct expr *e ) { if (!e) return type_create(TYPE_VOID, 0, 0); struct type *L; struct type *R; switch (e->kind) { case EXPR_INT_VAL: return type_create(TYPE_INTEGER, 0, 0); case EXPR_NAME: return type_copy(e->symbol->type); case EXPR_STRING_VAL: return type_create(TYPE_STRING, 0, 0); case EXPR_CHAR_VAL: return type_create(TYPE_CHARACTER, 0, 0); case EXPR_BOOLEAN_VAL: return type_create(TYPE_BOOLEAN, 0, 0); case EXPR_ARRAY_VAL: { struct expr *vals = e->right; struct type *subtype = 0; int num_subtype = 0; while (vals) { struct type *cur_t = expr_typecheck(vals); if (!subtype) { subtype = cur_t; } if (!type_compare(subtype, cur_t)) { decl_has_error = 1; printf("type error: array of element type "); type_print(subtype); printf(" cannot have expression of type "); type_print(cur_t); printf("/n"); } num_subtype++; vals = vals->next; } struct type *t = type_create(TYPE_ARRAY, 0, subtype); t->num_subtype = expr_create_integer_literal(num_subtype); return t; } //return type_copy(e->symbol->type); case EXPR_ARRAY_SUB: L = expr_typecheck(e->left); R = expr_typecheck(e->right); if (R->kind != TYPE_INTEGER) { decl_has_error = 1; printf("type error: cannot use "); type_print(R); printf(" as index to an array/n"); } if (L->kind != TYPE_ARRAY) { decl_has_error = 1; printf("type error: access an "); type_print(R); printf(" as an array/n"); } return type_copy(L->subtype); case EXPR_FUNCTION_VAL: // need to check function params!!!!! param_list_typecheck(e->right, e->symbol->params, e->name); return type_copy(e->symbol->type->subtype); case EXPR_ADD: L = expr_typecheck(e->left); R = expr_typecheck(e->right); if (L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER) { decl_has_error = 1; printf("type error: cannot add "); type_print(L); printf(" to a "); type_print(R); printf("/n"); } return type_create(TYPE_INTEGER, 0, 0); case EXPR_SUB: L = expr_typecheck(e->left); R = expr_typecheck(e->right); if ( !(L->kind == TYPE_INTEGER && L->kind == TYPE_INTEGER) || R->kind != TYPE_INTEGER) { decl_has_error = 1; printf("type error: cannot subtract "); type_print(L); printf(" to a "); type_print(R); printf("/n"); } return type_create(TYPE_INTEGER, 0, 0); case EXPR_MUL: L = expr_typecheck(e->left); R = expr_typecheck(e->right); if (L->kind != TYPE_INTEGER || R->kind != TYPE_INTEGER) { decl_has_error = 1; printf("type error: cannot multiply "); type_print(L); printf(" to a "); type_print(R); printf("/n"); } return type_create(TYPE_INTEGER, 0, 0); case EXPR_DIV: L = expr_typecheck(e->left); R = expr_typecheck(e->right);//.........这里部分代码省略.........
开发者ID:cindyxinyiwang,项目名称:cminor,代码行数:101,
示例19: pascal_type_print_basevoidpascal_type_print_base (struct type *type, struct ui_file *stream, int show, int level){ int i; int len; int lastval; enum { s_none, s_public, s_private, s_protected } section_type; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered ("<type unknown>", stream); return; } /* void pointer */ if ((TYPE_CODE (type) == TYPE_CODE_PTR) && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)) { fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer", stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ if (show <= 0 && TYPE_NAME (type) != NULL) { fputs_filtered (TYPE_NAME (type), stream); return; } CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { case TYPE_CODE_TYPEDEF: case TYPE_CODE_PTR: case TYPE_CODE_MEMBER: case TYPE_CODE_REF: /* case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: */ pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_ARRAY: /* pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0); pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0); */ pascal_print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0); break; case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: /* pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); only after args !! */ break; case TYPE_CODE_STRUCT: if (TYPE_TAG_NAME (type) != NULL) { fputs_filtered (TYPE_TAG_NAME (type), stream); fputs_filtered (" = ", stream); } if (HAVE_CPLUS_STRUCT (type)) { fprintf_filtered (stream, "class "); } else { fprintf_filtered (stream, "record "); } goto struct_union; case TYPE_CODE_UNION: if (TYPE_TAG_NAME (type) != NULL) { fputs_filtered (TYPE_TAG_NAME (type), stream); fputs_filtered (" = ", stream); } fprintf_filtered (stream, "case <?> of "); struct_union: wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { pascal_type_print_derivation_info (stream, type);//.........这里部分代码省略.........
开发者ID:HoMeCracKeR,项目名称:gdb-ng,代码行数:101,
示例20: f_val_print//.........这里部分代码省略......... fprintf_filtered (stream, "@"); fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } /* De-reference the reference. */ if (options->deref_ref) { if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) { struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr + embedded_offset)); common_val_print (deref_val, stream, recurse, options, current_language); } else fputs_filtered ("???", stream); } break; case TYPE_CODE_FUNC: if (options->format) { print_scalar_formatted (valaddr, type, options, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_INT: if (options->format || options->output_format) { struct value_print_options opts = *options; opts.format = (options->format ? options->format : options->output_format); print_scalar_formatted (valaddr, type, &opts, 0, stream); } else { val_print_type_code_int (type, valaddr, stream); /* C and C++ has no single byte int type, char is used instead. Since we don't know whether the value is really intended to be used as an integer or a character, print the character equivalent as well. */ if (TYPE_LENGTH (type) == 1) { fputs_filtered (" ", stream); LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr), type, stream); } } break; case TYPE_CODE_FLAGS: if (options->format)
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:67,
示例21: c_value_printvoidc_value_print (struct value *val, struct ui_file *stream, const struct value_print_options *options){ struct type *type, *real_type, *val_type; int full, top, using_enc; struct value_print_options opts = *options; opts.deref_ref = 1; /* If it is a pointer, indicate what it points to. Print type also if it is a reference. C++: if it is a member pointer, we will take care of that when we print it. */ /* Preserve the original type before stripping typedefs. We prefer to pass down the original type when possible, but for local checks it is better to look past the typedefs. */ val_type = value_type (val); type = check_typedef (val_type); if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF) { /* Hack: remove (char *) for char strings. Their type is indicated by the quoted string anyway. (Don't use c_textual_element_type here; quoted strings are always exactly (char *), (wchar_t *), or the like. */ if (TYPE_CODE (val_type) == TYPE_CODE_PTR && TYPE_NAME (val_type) == NULL && TYPE_NAME (TYPE_TARGET_TYPE (val_type)) != NULL && (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (val_type)), "char") == 0 || textual_name (TYPE_NAME (TYPE_TARGET_TYPE (val_type))))) { /* Print nothing. */ } else if (options->objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) { int is_ref = TYPE_CODE (type) == TYPE_CODE_REF; if (is_ref) val = value_addr (val); /* Pointer to class, check real type of object. */ fprintf_filtered (stream, "("); if (value_entirely_available (val)) { real_type = value_rtti_indirect_type (val, &full, &top, &using_enc); if (real_type) { /* RTTI entry found. */ type = real_type; /* Need to adjust pointer value. */ val = value_from_pointer (real_type, value_as_address (val) - top); if (is_ref) { val = value_ref (value_ind (val)); type = value_type (val); } /* Note: When we look up RTTI entries, we don't get any information on const or volatile attributes. */ } } type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); val_type = type; } else { /* normal case */ fprintf_filtered (stream, "("); type_print (value_type (val), "", stream, -1); fprintf_filtered (stream, ") "); } } if (!value_initialized (val)) fprintf_filtered (stream, " [uninitialized] "); if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object. */ real_type = value_rtti_type (val, &full, &top, &using_enc); if (real_type) { /* We have RTTI information, so use it. */ val = value_full_object (val, real_type, full, top, using_enc); fprintf_filtered (stream, "(%s%s) ",//.........这里部分代码省略.........
开发者ID:nds32,项目名称:binutils,代码行数:101,
示例22: type_printvoid type_print(type *t){ type_debug(t); dbg_printf("Tty="); WRTYxx(t->Tty); dbg_printf(" Tmangle=%d",t->Tmangle); dbg_printf(" Tflags=x%x",t->Tflags); dbg_printf(" Tcount=%d",t->Tcount); if (!(t->Tflags & TFsizeunknown) && tybasic(t->Tty) != TYvoid && tybasic(t->Tty) != TYident && tybasic(t->Tty) != TYmfunc && tybasic(t->Tty) != TYarray && tybasic(t->Tty) != TYtemplate) dbg_printf(" Tsize=%ld",type_size(t)); dbg_printf(" Tnext=%p",t->Tnext); switch (tybasic(t->Tty)) { case TYstruct: case TYmemptr: dbg_printf(" Ttag=%p,'%s'",t->Ttag,t->Ttag->Sident); //dbg_printf(" Sfldlst=%p",t->Ttag->Sstruct->Sfldlst); break; case TYarray: dbg_printf(" Tdim=%ld",t->Tdim); break; case TYident: dbg_printf(" Tident='%s'",t->Tident); break; case TYtemplate: dbg_printf(" Tsym='%s'",((typetemp_t *)t)->Tsym->Sident); { param_t *p; int i; i = 1; for (p = t->Tparamtypes; p; p = p->Pnext) { dbg_printf("/nTP%d (%p): ",i++,p); fflush(stdout);dbg_printf("Pident=%p,Ptype=%p,Pelem=%p,Pnext=%p ",p->Pident,p->Ptype,p->Pelem,p->Pnext); param_debug(p); if (p->Pident) printf("'%s' ", p->Pident); if (p->Ptype) type_print(p->Ptype); if (p->Pelem) elem_print(p->Pelem); } } break; default: if (tyfunc(t->Tty)) { param_t *p; int i; i = 1; for (p = t->Tparamtypes; p; p = p->Pnext) { dbg_printf("/nP%d (%p): ",i++,p); fflush(stdout);dbg_printf("Pident=%p,Ptype=%p,Pelem=%p,Pnext=%p ",p->Pident,p->Ptype,p->Pelem,p->Pnext); param_debug(p); if (p->Pident) printf("'%s' ", p->Pident); type_print(p->Ptype); } } break; } dbg_printf("/n"); if (t->Tnext) type_print(t->Tnext);}
开发者ID:michelf,项目名称:dmd,代码行数:70,
示例23: java_value_printintjava_value_print (struct value *val, struct ui_file *stream, const struct value_print_options *options){ struct gdbarch *gdbarch = get_type_arch (value_type (val)); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct type *type; CORE_ADDR address; int i; char *name; struct value_print_options opts; type = value_type (val); address = value_address (val); if (is_object_type (type)) { CORE_ADDR obj_addr; /* Get the run-time type, and cast the object into that */ obj_addr = unpack_pointer (type, value_contents (val)); if (obj_addr != 0) { type = type_from_class (gdbarch, java_class_from_object (val)); type = lookup_pointer_type (type); val = value_at (type, address); } } if (TYPE_CODE (type) == TYPE_CODE_PTR && !value_logical_not (val)) type_print (TYPE_TARGET_TYPE (type), "", stream, -1); name = TYPE_TAG_NAME (type); if (TYPE_CODE (type) == TYPE_CODE_STRUCT && name != NULL && (i = strlen (name), name[i - 1] == ']')) { gdb_byte buf4[4]; long length; unsigned int things_printed = 0; int reps; struct type *el_type = java_primitive_type_from_name (gdbarch, name, i - 2); i = 0; read_memory (address + get_java_object_header_size (gdbarch), buf4, 4); length = (long) extract_signed_integer (buf4, 4, byte_order); fprintf_filtered (stream, "{length: %ld", length); if (el_type == NULL) { CORE_ADDR element; CORE_ADDR next_element = -1; /* dummy initial value */ /* Skip object header and length. */ address += get_java_object_header_size (gdbarch) + 4; while (i < length && things_printed < options->print_max) { gdb_byte *buf; buf = alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT); fputs_filtered (", ", stream); wrap_here (n_spaces (2)); if (i > 0) element = next_element; else { read_memory (address, buf, sizeof (buf)); address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT; /* FIXME: cagney/2003-05-24: Bogus or what. It pulls a host sized pointer out of the target and then extracts that as an address (while assuming that the address is unsigned)! */ element = extract_unsigned_integer (buf, sizeof (buf), byte_order); } for (reps = 1; i + reps < length; reps++) { read_memory (address, buf, sizeof (buf)); address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT; /* FIXME: cagney/2003-05-24: Bogus or what. It pulls a host sized pointer out of the target and then extracts that as an address (while assuming that the address is unsigned)! */ next_element = extract_unsigned_integer (buf, sizeof (buf), byte_order); if (next_element != element) break; } if (reps == 1) fprintf_filtered (stream, "%d: ", i); else fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);//.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例24: m2_val_print//.........这里部分代码省略......... format, 0, stream); break; } len = TYPE_NFIELDS (type); val = unpack_long (type, valaddr + embedded_offset); for (i = 0; i < len; i++) { QUIT; if (val == TYPE_FIELD_BITPOS (type, i)) { break; } } if (i < len) { fputs_filtered (TYPE_FIELD_NAME (type, i), stream); } else { print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_FUNC: if (format) { print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (address, stream, demangle); break; case TYPE_CODE_BOOL: format = format ? format : output_format; if (format) print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); else { val = unpack_long (type, valaddr + embedded_offset); if (val == 0) fputs_filtered ("FALSE", stream); else if (val == 1) fputs_filtered ("TRUE", stream); else fprintf_filtered (stream, "%ld)", (long int) val); } break; case TYPE_CODE_RANGE: if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type))) { m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset, address, stream, format, deref_ref, recurse, pretty); break; } /* FIXME: create_range_type does not set the unsigned bit in a range type (I think it probably should copy it from the target type), so we won't print values which are too large to
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:67,
示例25: c_value_printintc_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty){ struct type *type, *real_type; int full, top, using_enc; /* If it is a pointer, indicate what it points to. Print type also if it is a reference. C++: if it is a member pointer, we will take care of that when we print it. */ type = check_typedef (value_type (val)); if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF) { /* Hack: remove (char *) for char strings. Their type is indicated by the quoted string anyway. */ if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_NAME (type) == NULL && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0) { /* Print nothing */ } else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) { if (TYPE_CODE(type) == TYPE_CODE_REF) { /* Copy value, change to pointer, so we don't get an * error about a non-pointer type in value_rtti_target_type */ struct value *temparg; temparg=value_copy(val); deprecated_set_value_type (temparg, lookup_pointer_type (TYPE_TARGET_TYPE(type))); val=temparg; } /* Pointer to class, check real type of object */ fprintf_filtered (stream, "("); real_type = value_rtti_target_type (val, &full, &top, &using_enc); if (real_type) { /* RTTI entry found */ if (TYPE_CODE (type) == TYPE_CODE_PTR) { /* create a pointer type pointing to the real type */ type = lookup_pointer_type (real_type); } else { /* create a reference type referencing the real type */ type = lookup_reference_type (real_type); } /* JYG: Need to adjust pointer value. */ /* NOTE: cagney/2005-01-02: THIS IS BOGUS. */ value_contents_writeable (val)[0] -= top; /* Note: When we look up RTTI entries, we don't get any information on const or volatile attributes */ } type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); } else { /* normal case */ fprintf_filtered (stream, "("); type_print (value_type (val), "", stream, -1); fprintf_filtered (stream, ") "); } } /* APPLE LOCAL begin variable initialized status. */ if (value_var_status (val) == 0) fprintf_filtered (stream, " [uninitialized] "); /* APPLE LOCAL end variable initialized status. */ if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object */ real_type = value_rtti_type (val, &full, &top, &using_enc); if (real_type) { /* We have RTTI information, so use it */ val = value_full_object (val, real_type, full, top, using_enc); fprintf_filtered (stream, "(%s%s) ", TYPE_NAME (real_type), full ? "" : _(" [incomplete object]")); /* Print out object: enclosing type is same as real_type if full */ return val_print (value_enclosing_type (val), value_contents_all (val), 0, VALUE_ADDRESS (val), stream, format, 1, 0, pretty); /* Note: When we look up RTTI entries, we don't get any information on const or volatile attributes */ } else if (type != check_typedef (value_enclosing_type (val)))//.........这里部分代码省略.........
开发者ID:HoMeCracKeR,项目名称:gdb-ng,代码行数:101,
示例26: pascal_val_print//.........这里部分代码省略......... { QUIT; if (val == TYPE_FIELD_BITPOS (type, i)) { break; } } if (i < len) { fputs_filtered (TYPE_FIELD_NAME (type, i), stream); } else { print_longest (stream, 'd', 0, val); } break; case TYPE_CODE_FLAGS: if (format) print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); else val_print_type_code_flags (type, valaddr + embedded_offset, stream); break; case TYPE_CODE_FUNC: if (format) { print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); break; } /* FIXME, we should consider, at least for ANSI C language, eliminating the distinction made between FUNCs and POINTERs to FUNCs. */ fprintf_filtered (stream, "{"); type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (address, stream, demangle); break; case TYPE_CODE_BOOL: format = format ? format : output_format; if (format) print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); else { val = unpack_long (type, valaddr + embedded_offset); if (val == 0) fputs_filtered ("false", stream); else if (val == 1) fputs_filtered ("true", stream); else { fputs_filtered ("true (", stream); fprintf_filtered (stream, "%ld)", (long int) val); } } break; case TYPE_CODE_RANGE: /* FIXME: create_range_type does not set the unsigned bit in a range type (I think it probably should copy it from the target type), so we won't print values which are too large to fit in a signed integer correctly. */ /* FIXME: Doesn't handle ranges of enums correctly. (Can't just print with the target type, though, because the size of our type and the target type might differ). */
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:67,
示例27: print_subexp_standard//.........这里部分代码省略......... return; /* Will not occur for Modula-2 */ case STRUCTOP_PTR: tem = longest_to_int (exp->elts[pc + 1].longconst); (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered ("->", stream); fputs_filtered (&exp->elts[pc + 2].string, stream); return; case BINOP_SUBSCRIPT: print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered ("[", stream); print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); fputs_filtered ("]", stream); return; case UNOP_POSTINCREMENT: print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered ("++", stream); return; case UNOP_POSTDECREMENT: print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered ("--", stream); return; case UNOP_CAST: (*pos) += 2; if ((int) prec > (int) PREC_PREFIX) fputs_filtered ("(", stream); fputs_filtered ("(", stream); type_print (exp->elts[pc + 1].type, "", stream, 0); fputs_filtered (") ", stream); print_subexp (exp, pos, stream, PREC_PREFIX); if ((int) prec > (int) PREC_PREFIX) fputs_filtered (")", stream); return; case UNOP_MEMVAL: (*pos) += 2; if ((int) prec > (int) PREC_PREFIX) fputs_filtered ("(", stream); if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC && exp->elts[pc + 3].opcode == OP_LONG) { /* We have a minimal symbol fn, probably. It's encoded as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address). Swallow the OP_LONG (including both its opcodes); ignore its type; print the value in the type of the MEMVAL. */ (*pos) += 4; val = value_at_lazy (exp->elts[pc + 1].type, (CORE_ADDR) exp->elts[pc + 5].longconst); value_print (val, stream, 0, Val_no_prettyprint); } else { fputs_filtered ("{", stream); type_print (exp->elts[pc + 1].type, "", stream, 0); fputs_filtered ("} ", stream); print_subexp (exp, pos, stream, PREC_PREFIX); } if ((int) prec > (int) PREC_PREFIX) fputs_filtered (")", stream); return;
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:67,
示例28: list_arg_or_localstatic voidlist_arg_or_local (const struct frame_arg *arg, enum what_to_list what, enum print_values values, int skip_unavailable){ struct cleanup *old_chain; struct ui_out *uiout = current_uiout; struct ui_file *stb; gdb_assert (!arg->val || !arg->error); gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL && arg->error == NULL) || values == PRINT_SIMPLE_VALUES || (values == PRINT_ALL_VALUES && (arg->val != NULL || arg->error != NULL))); gdb_assert (arg->entry_kind == print_entry_values_no || (arg->entry_kind == print_entry_values_only && (arg->val || arg->error))); if (skip_unavailable && arg->val != NULL && (value_entirely_unavailable (arg->val) /* A scalar object that does not have all bits available is also considered unavailable, because all bits contribute to its representation. */ || (val_print_scalar_type_p (value_type (arg->val)) && !value_bytes_available (arg->val, value_embedded_offset (arg->val), TYPE_LENGTH (value_type (arg->val)))))) return; stb = mem_fileopen (); old_chain = make_cleanup_ui_file_delete (stb); if (values != PRINT_NO_VALUES || what == all) make_cleanup_ui_out_tuple_begin_end (uiout, NULL); fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb); if (arg->entry_kind == print_entry_values_only) fputs_filtered ("@entry", stb); ui_out_field_stream (uiout, "name", stb); if (what == all && SYMBOL_IS_ARGUMENT (arg->sym)) ui_out_field_int (uiout, "arg", 1); if (values == PRINT_SIMPLE_VALUES) { check_typedef (arg->sym->type); type_print (arg->sym->type, "", stb, -1); ui_out_field_stream (uiout, "type", stb); } if (arg->val || arg->error) { const char *error_message = NULL; if (arg->error) error_message = arg->error; else { TRY { struct value_print_options opts; get_no_prettyformat_print_options (&opts); opts.deref_ref = 1; common_val_print (arg->val, stb, 0, &opts, language_def (SYMBOL_LANGUAGE (arg->sym))); } CATCH (except, RETURN_MASK_ERROR) { error_message = except.message; } END_CATCH } if (error_message != NULL) fprintf_filtered (stb, _("<error reading variable: %s>"), error_message); ui_out_field_stream (uiout, "value", stb); } do_cleanups (old_chain);}
开发者ID:RWTH-OS,项目名称:binutils,代码行数:81,
示例29: c_type_print_basevoidc_type_print_base (struct type *type, struct ui_file *stream, int show, int level){ int i; int len, real_len; enum { s_none, s_public, s_private, s_protected } section_type; int need_access_label = 0; int j, len2; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered (_("<type unknown>"), stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ /* If we have "typedef struct foo {. . .} bar;" do we want to print it as "struct foo" or as "bar"? Pick the latter, because C++ folk tend to expect things like "class5 *foo" rather than "struct class5 *foo". */ if (show <= 0 && TYPE_NAME (type) != NULL) { c_type_print_modifier (type, stream, 0, 1); fputs_filtered (TYPE_NAME (type), stream); return; } CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { case TYPE_CODE_TYPEDEF: /* If we get here, the typedef doesn't have a name, and we couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */ gdb_assert (TYPE_NAME (type) == NULL); gdb_assert (TYPE_TARGET_TYPE (type) == NULL); fprintf_filtered (stream, _("<unnamed typedef>")); break; case TYPE_CODE_ARRAY: case TYPE_CODE_PTR: case TYPE_CODE_MEMBERPTR: case TYPE_CODE_REF: case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: case TYPE_CODE_METHODPTR: c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: c_type_print_modifier (type, stream, 0, 1); if (TYPE_CODE (type) == TYPE_CODE_UNION) fprintf_filtered (stream, "union "); else if (TYPE_DECLARED_CLASS (type)) fprintf_filtered (stream, "class "); else fprintf_filtered (stream, "struct "); /* Print the tag if it exists. The HP aCC compiler emits a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" tag for unnamed struct/union/enum's, which we don't want to print. */ if (TYPE_TAG_NAME (type) != NULL && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8)) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show > 0) fputs_filtered (" ", stream); } wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { struct type *basetype; int vptr_fieldno; cp_type_print_derivation_info (stream, type); fprintf_filtered (stream, "{/n"); if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0 && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)//.........这里部分代码省略.........
开发者ID:johnhubbard,项目名称:kgdb-pci-gdb,代码行数:101,
示例30: ast_new_builtinstruct ast *ast_new_builtin(struct scan_st *sc, struct builtin *bi, struct ast *right){ struct ast *a; struct type *t, *tr; int unify = 0; t = bi->ty(); type_ensure_routine(t);#ifdef DEBUG if (trace_type_inference) { printf("(builtin `"); fputsu8(stdout, bi->name); printf("`)*****/n"); printf("type of args is: "); if (right != NULL) type_print(stdout, right->datatype); printf("/ntype of builtin is: "); type_print(stdout, t); }#endif if (right == NULL) tr = type_new(TYPE_VOID); else tr = right->datatype; unify = type_unify_crit(sc, type_representative(t)->t.closure.domain, tr);#ifdef DEBUG if (trace_type_inference) { printf("/nthese unify? --> %d <--", unify); printf("/n****/n"); }#endif /* * Fold constants. */ if (bi->is_pure && ast_is_constant(right)) { struct value v; struct activation *ar; struct ast *g; int i = 0; int varity; if (bi->arity == -1) { varity = ast_count_args(right); } else { varity = bi->arity; } if (unify) { ar = activation_new_on_heap(varity, NULL, NULL); for (g = right, i = 0; g != NULL && g->type == AST_ARG && i < varity; g = g->u.arg.right, i++) { if (g->u.arg.left != NULL) activation_initialize_value(ar, i, g->u.arg.left->u.value.value); } v = bi->fn(ar); } else { a = NULL; } a = ast_new_value(v, type_representative(t)->t.closure.range); return(a); } a = ast_new(AST_BUILTIN); a->u.builtin.bi = bi; a->u.builtin.right = right; a->datatype = type_representative(t)->t.closure.range; return(a);}
开发者ID:catseye,项目名称:Bhuna,代码行数:81,
注:本文中的type_print函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ type_register_static函数代码示例 C++ type_name_no_tag函数代码示例 |