这篇教程C++ value_type函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中value_type函数的典型用法代码示例。如果您正苦于以下问题:C++ value_type函数的具体用法?C++ value_type怎么用?C++ value_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了value_type函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: scm_lreadrstatic voidscm_lreadr (int skipping){ int c, j; struct stoken str; LONGEST svalue = 0;tryagain: c = *lexptr++; switch (c) { case '/0': lexptr--; return; case '[': case '(': scm_lreadparen (skipping); return; case ']': case ')': error ("unexpected #//%c", c); goto tryagain; case '/'': case '`': str.ptr = lexptr - 1; scm_lreadr (skipping); if (!skipping) { struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr); if (!is_scmvalue_type (value_type (val))) error ("quoted scm form yields non-SCM value"); svalue = extract_signed_integer (value_contents (val), TYPE_LENGTH (value_type (val))); goto handle_immediate; } return; case ',': c = *lexptr++; if ('@' != c) lexptr--; scm_lreadr (skipping); return; case '#': c = *lexptr++; switch (c) { case '[': case '(': scm_lreadparen (skipping); return; case 't': case 'T': svalue = SCM_BOOL_T; goto handle_immediate; case 'f': case 'F': svalue = SCM_BOOL_F; goto handle_immediate; case 'b': case 'B': case 'o': case 'O': case 'd': case 'D': case 'x': case 'X': case 'i': case 'I': case 'e': case 'E': lexptr--; c = '#'; goto num; case '*': /* bitvector */ scm_read_token (c, 0); return; case '{': scm_read_token (c, 1); return; case '//': /* character */ c = *lexptr++; scm_read_token (c, 0); return; case '|': j = 1; /* here j is the comment nesting depth */ lp: c = *lexptr++; lpc: switch (c) { case '/0': error ("unbalanced comment"); default: goto lp; case '|': if ('#' != (c = *lexptr++)) goto lpc; if (--j) goto lp; break; case '#'://.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例2: find_function_addrCORE_ADDRfind_function_addr (struct value *function, struct type **retval_type){ struct type *ftype = check_typedef (value_type (function)); struct gdbarch *gdbarch = get_type_arch (ftype); struct type *value_type = NULL; /* Initialize it just to avoid a GCC false warning. */ CORE_ADDR funaddr = 0; /* If it's a member function, just look at the function part of it. */ /* Determine address to call. */ if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) funaddr = value_address (function); else if (TYPE_CODE (ftype) == TYPE_CODE_PTR) { funaddr = value_as_address (function); ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, ¤t_target); } if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) { value_type = TYPE_TARGET_TYPE (ftype); if (TYPE_GNU_IFUNC (ftype)) { funaddr = gnu_ifunc_resolve_addr (gdbarch, funaddr); /* Skip querying the function symbol if no RETVAL_TYPE has been asked for. */ if (retval_type) value_type = find_function_return_type (funaddr); } } else if (TYPE_CODE (ftype) == TYPE_CODE_INT) { /* Handle the case of functions lacking debugging info. Their values are characters since their addresses are char. */ if (TYPE_LENGTH (ftype) == 1) funaddr = value_as_address (value_addr (function)); else { /* Handle function descriptors lacking debug info. */ int found_descriptor = 0; funaddr = 0; /* pacify "gcc -Werror" */ if (VALUE_LVAL (function) == lval_memory) { CORE_ADDR nfunaddr; funaddr = value_as_address (value_addr (function)); nfunaddr = funaddr; funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, ¤t_target); if (funaddr != nfunaddr) found_descriptor = 1; } if (!found_descriptor) /* Handle integer used as address of a function. */ funaddr = (CORE_ADDR) value_as_long (function); } } else error (_("Invalid data type for function to be called.")); if (retval_type != NULL) *retval_type = value_type; return funaddr + gdbarch_deprecated_function_start_offset (gdbarch);}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:75,
示例3: java_print_value_fields//.........这里部分代码省略......... wrap_here (n_spaces (2 + 2 * recurse)); } annotate_field_begin (TYPE_FIELD_TYPE (type, i)); if (field_is_static (&TYPE_FIELD (type, i))) fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), language_cplus, DMGL_PARAMS | DMGL_ANSI); annotate_field_name_end (); fputs_filtered (": ", stream); annotate_field_value (); if (!field_is_static (&TYPE_FIELD (type, i)) && TYPE_FIELD_PACKED (type, i)) { struct value *v; /* Bitfields require special handling, especially due to byte order problems. */ if (TYPE_FIELD_IGNORE (type, i)) { fputs_filtered ("<optimized out or zero length>", stream); } else if (value_bits_synthetic_pointer (val, TYPE_FIELD_BITPOS (type, i), TYPE_FIELD_BITSIZE (type, i))) { fputs_filtered (_("<synthetic pointer>"), stream); } else if (!value_bits_valid (val, TYPE_FIELD_BITPOS (type, i), TYPE_FIELD_BITSIZE (type, i))) { val_print_optimized_out (val, stream); } else { struct value_print_options opts; v = value_field_bitfield (type, i, valaddr, offset, val); opts = *options; opts.deref_ref = 0; common_val_print (v, stream, recurse + 1, &opts, current_language); } } else { if (TYPE_FIELD_IGNORE (type, i)) { fputs_filtered ("<optimized out or zero length>", stream); } else if (field_is_static (&TYPE_FIELD (type, i))) { struct value *v = value_static_field (type, i); if (v == NULL) val_print_optimized_out (NULL, stream); else { struct value_print_options opts; struct type *t = check_typedef (value_type (v)); if (TYPE_CODE (t) == TYPE_CODE_STRUCT) v = value_addr (v); opts = *options; opts.deref_ref = 0; common_val_print (v, stream, recurse + 1, &opts, current_language); } } else if (TYPE_FIELD_TYPE (type, i) == NULL) fputs_filtered ("<unknown type>", stream); else { struct value_print_options opts = *options; opts.deref_ref = 0; val_print (TYPE_FIELD_TYPE (type, i), valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8, address, stream, recurse + 1, val, &opts, current_language); } } annotate_field_end (); } if (options->prettyformat) { fprintf_filtered (stream, "/n"); print_spaces_filtered (2 * recurse, stream); } } fprintf_filtered (stream, "}");}
开发者ID:Xilinx,项目名称:gdb,代码行数:101,
示例4: insertvoid ButtonsMap::add(unsigned id, CToolItem *w){ insert(value_type(id, w));}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:4,
示例5: gnuv3_rtti_typestatic struct type *gnuv3_rtti_type (struct value *value, int *full_p, int *top_p, int *using_enc_p){ struct gdbarch *gdbarch; struct type *values_type = check_typedef (value_type (value)); struct value *vtable; struct minimal_symbol *vtable_symbol; const char *vtable_symbol_name; const char *class_name; struct type *run_time_type; LONGEST offset_to_top; /* We only have RTTI for class objects. */ if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) return NULL; /* Determine architecture. */ gdbarch = get_type_arch (values_type); if (using_enc_p) *using_enc_p = 0; vtable = gnuv3_get_vtable (gdbarch, value_type (value), value_as_address (value_addr (value))); if (vtable == NULL) return NULL; /* Find the linker symbol for this vtable. */ vtable_symbol = lookup_minimal_symbol_by_pc (value_address (vtable) + value_embedded_offset (vtable)); if (! vtable_symbol) return NULL; /* The symbol's demangled name should be something like "vtable for CLASS", where CLASS is the name of the run-time type of VALUE. If we didn't like this approach, we could instead look in the type_info object itself to get the class name. But this way should work just as well, and doesn't read target memory. */ vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol); if (vtable_symbol_name == NULL || strncmp (vtable_symbol_name, "vtable for ", 11)) { warning (_("can't find linker symbol for virtual table for `%s' value"), TYPE_NAME (values_type)); if (vtable_symbol_name) warning (_(" found `%s' instead"), vtable_symbol_name); return NULL; } class_name = vtable_symbol_name + 11; /* Try to look up the class name as a type name. */ /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ run_time_type = cp_lookup_rtti_type (class_name, NULL); if (run_time_type == NULL) return NULL; /* Get the offset from VALUE to the top of the complete object. NOTE: this is the reverse of the meaning of *TOP_P. */ offset_to_top = value_as_long (value_field (vtable, vtable_field_offset_to_top)); if (full_p) *full_p = (- offset_to_top == value_embedded_offset (value) && (TYPE_LENGTH (value_enclosing_type (value)) >= TYPE_LENGTH (run_time_type))); if (top_p) *top_p = - offset_to_top; return run_time_type;}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:71,
示例6: gnuv2_virtual_fn_field/* Return a virtual function as a value. ARG1 is the object which provides the virtual function table pointer. *ARG1P is side-effected in calling this function. F is the list of member functions which contains the desired virtual function. J is an index into F which provides the desired virtual function. TYPE is the type in which F is located. */static struct value *gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, struct type * type, int offset){ struct value *arg1 = *arg1p; struct type *type1 = check_typedef (value_type (arg1)); struct type *entry_type; /* First, get the virtual function table pointer. That comes with a strange type, so cast it to type `pointer to long' (which should serve just fine as a function type). Then, index into the table, and convert final value to appropriate function type. */ struct value *entry; struct value *vfn; struct value *vtbl; struct value *vi = value_from_longest (builtin_type_int, (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j)); struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j); struct type *context; if (fcontext == NULL) /* We don't have an fcontext (e.g. the program was compiled with g++ version 1). Try to get the vtbl from the TYPE_VPTR_BASETYPE. This won't work right for multiple inheritance, but at least we should do as well as GDB 3.x did. */ fcontext = TYPE_VPTR_BASETYPE (type); context = lookup_pointer_type (fcontext); /* Now context is a pointer to the basetype containing the vtbl. */ if (TYPE_TARGET_TYPE (context) != type1) { struct value *tmp = value_cast (context, value_addr (arg1)); arg1 = value_ind (tmp); type1 = check_typedef (value_type (arg1)); } context = type1; /* Now context is the basetype containing the vtbl. */ /* This type may have been defined before its virtual function table was. If so, fill in the virtual function table entry for the type now. */ if (TYPE_VPTR_FIELDNO (context) < 0) fill_in_vptr_fieldno (context); /* The virtual function table is now an array of structures which have the form { int16 offset, delta; void *pfn; }. */ vtbl = value_primitive_field (arg1, 0, TYPE_VPTR_FIELDNO (context), TYPE_VPTR_BASETYPE (context)); /* With older versions of g++, the vtbl field pointed to an array of structures. Nowadays it points directly to the structure. */ if (TYPE_CODE (value_type (vtbl)) == TYPE_CODE_PTR && TYPE_CODE (TYPE_TARGET_TYPE (value_type (vtbl))) == TYPE_CODE_ARRAY) { /* Handle the case where the vtbl field points to an array of structures. */ vtbl = value_ind (vtbl); /* Index into the virtual function table. This is hard-coded because looking up a field is not cheap, and it may be important to save time, e.g. if the user has set a conditional breakpoint calling a virtual function. */ entry = value_subscript (vtbl, vi); } else { /* Handle the case where the vtbl field points directly to a structure. */ vtbl = value_add (vtbl, vi); entry = value_ind (vtbl); } entry_type = check_typedef (value_type (entry)); if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT) { /* Move the `this' pointer according to the virtual function table. */ set_value_offset (arg1, value_offset (arg1) + value_as_long (value_field (entry, 0))); if (!value_lazy (arg1)) { set_value_lazy (arg1, 1); value_fetch_lazy (arg1); } vfn = value_field (entry, 2); } else if (TYPE_CODE (entry_type) == TYPE_CODE_PTR) vfn = entry; else error (_("I'm confused: virtual function table has bad type")); /* Reinstantiate the function pointer with the correct type. */ deprecated_set_value_type (vfn, lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)));//.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例7: v1void test_blas_2<V, M, N>::test () { { V v1 (N), v2 (N); M m (N, N); // _t_mv initialize_vector (v1); initialize_matrix (m); ublas::blas_2::tmv (v1, m); std::cout << "tmv (v1, m) = " << v1 << std::endl; initialize_vector (v1); initialize_matrix (m); ublas::blas_2::tmv (v1, ublas::trans (m)); std::cout << "tmv (v1, trans (m)) = " << v1 << std::endl;#ifdef USE_STD_COMPLEX initialize_vector (v1); initialize_matrix (m); ublas::blas_2::tmv (v1, ublas::herm (m)); std::cout << "tmv (v1, herm (m)) = " << v1 << std::endl;#endif // _t_sv initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::lower_tag ()); ublas::blas_2::tsv (v1, m, ublas::lower_tag ()); std::cout << "tsv (v1, m) = " << v1 << " " << ublas::prod (m, v1) - v2 << std::endl; initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::upper_tag ()); ublas::blas_2::tsv (v1, ublas::trans (m), ublas::lower_tag ()); std::cout << "tsv (v1, trans (m)) = " << v1 << " " << ublas::prod (ublas::trans (m), v1) - v2 << std::endl;#ifdef USE_STD_COMPLEX initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::upper_tag ()); ublas::blas_2::tsv (v1, ublas::herm (m), ublas::lower_tag ()); std::cout << "tsv (v1, herm (m)) = " << v1 << " " << ublas::prod (ublas::herm (m), v1) - v2 << std::endl;#endif initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::upper_tag ()); ublas::blas_2::tsv (v1, m, ublas::upper_tag ()); std::cout << "tsv (v1, m) = " << v1 << " " << ublas::prod (m, v1) - v2 << std::endl; initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::lower_tag ()); ublas::blas_2::tsv (v1, ublas::trans (m), ublas::upper_tag ()); std::cout << "tsv (v1, trans (m)) = " << v1 << " " << ublas::prod (ublas::trans (m), v1) - v2 << std::endl;#ifdef USE_STD_COMPLEX initialize_vector (v1); initialize_vector (v2); initialize_matrix (m, ublas::lower_tag ()); ublas::blas_2::tsv (v1, ublas::herm (m), ublas::upper_tag ()); std::cout << "tsv (v1, herm (m)) = " << v1 << " " << ublas::prod (ublas::herm (m), v1) - v2 << std::endl;#endif // _g_mv // _s_mv // _h_mv initialize_vector (v1); initialize_vector (v2); initialize_matrix (m); ublas::blas_2::gmv (v1, value_type (1), value_type (1), m, v2); std::cout << "gmv (v1, 1, 1, m, v2) = " << v1 << std::endl; ublas::blas_2::gmv (v1, value_type (1), value_type (1), ublas::trans (m), v2); std::cout << "gmv (v1, 1, 1, trans (m), v2) = " << v1 << std::endl;#ifdef USE_STD_COMPLEX ublas::blas_2::gmv (v1, value_type (1), value_type (1), ublas::herm (m), v2); std::cout << "gmv (v1, 1, 1, herm (m), v2) = " << v1 << std::endl;#endif // _g_r // _g_ru // _g_rc initialize_vector (v1); initialize_vector (v2); initialize_matrix (m); ublas::blas_2::gr (m, value_type (1), v1, v2); std::cout << "gr (m, 1, v1, v2) = " << m << std::endl; ublas::blas_2::gr (m, value_type (1), v1, ublas::conj (v2)); std::cout << "gr (m, 1, v1, conj (v2)) = " << m << std::endl; // _s_r initialize_vector (v1); initialize_matrix (m); ublas::blas_2::sr (m, value_type (1), v1); std::cout << "sr (m, 1, v1) = " << m << std::endl;#ifdef USE_STD_COMPLEX // _h_r initialize_vector (v1); initialize_matrix (m); ublas::blas_2::hr (m, value_type (1), v1); std::cout << "hr (m, 1, v1) = " << m << std::endl;#endif // _s_r2 initialize_vector (v1); initialize_vector (v2);//.........这里部分代码省略.........
开发者ID:Adikteev,项目名称:rtbkit-deps,代码行数:101,
示例8: StieltjesPCEBasisStokhos::StieltjesPCEBasis<ordinal_type, value_type>::StieltjesPCEBasis( ordinal_type p, const Teuchos::RCP<const Stokhos::OrthogPolyApprox<ordinal_type, value_type> >& pce_, const Teuchos::RCP<const Stokhos::Quadrature<ordinal_type, value_type> >& quad_, bool use_pce_quad_points_, bool normalize, bool project_integrals_, const Teuchos::RCP<const Stokhos::Sparse3Tensor<ordinal_type, value_type> >& Cijk_) : RecurrenceBasis<ordinal_type, value_type>("Stieltjes PCE", p, normalize), pce(pce_), quad(quad_), pce_weights(quad->getQuadWeights()), basis_values(quad->getBasisAtQuadPoints()), pce_vals(), phi_vals(), use_pce_quad_points(use_pce_quad_points_), fromStieltjesMat(p+1,pce->size()), project_integrals(project_integrals_), basis(pce->basis()), Cijk(Cijk_), phi_pce_coeffs(){ // Evaluate PCE at quad points const Teuchos::Array< Teuchos::Array<value_type> >& quad_points = quad->getQuadPoints(); ordinal_type nqp = pce_weights.size(); pce_vals.resize(nqp); phi_vals.resize(nqp); for (ordinal_type i=0; i<nqp; i++) { pce_vals[i] = pce->evaluate(quad_points[i], basis_values[i]); phi_vals[i].resize(p+1); } if (project_integrals) phi_pce_coeffs.resize(basis->size()); // Compute coefficients via Stieltjes stieltjes(0, p+1, pce_weights, pce_vals, this->alpha, this->beta, this->norms, phi_vals); for (ordinal_type i=0; i<=p; i++) this->delta[i] = value_type(1.0); ordinal_type sz = pce->size(); fromStieltjesMat.putScalar(0.0); for (ordinal_type i=0; i<=p; i++) { for (ordinal_type j=0; j<sz; j++) { for (ordinal_type k=0; k<nqp; k++) fromStieltjesMat(i,j) += pce_weights[k]*phi_vals[k][i]*basis_values[k][j]; fromStieltjesMat(i,j) /= basis->norm_squared(j); } } // Setup rest of recurrence basis //this->setup(); this->gamma[0] = value_type(1); for (ordinal_type k=1; k<=p; k++) { this->gamma[k] = value_type(1); } //If you want normalized polynomials, set gamma and reset the norms to 1. if( normalize ) { for (ordinal_type k=0; k<=p; k++) { this->gamma[k] = value_type(1)/std::sqrt(this->norms[k]); this->norms[k] = value_type(1); } }}
开发者ID:haripandey,项目名称:trilinos,代码行数:69,
示例9: insert inline static insert_ret insert(HT &ht,K const& key,V const &v=V()) { return ht.insert(value_type(key,v)); }
开发者ID:fullstackenviormentss,项目名称:sbmt,代码行数:5,
示例10: insert typename hash_table<T, Hash, Equals, Allocator>::iterator hash_table<T, Hash, Equals, Allocator>:: insert(const_reference x) { return emplace(std::move(value_type(x))); }
开发者ID:mcarton,项目名称:libjsonxx,代码行数:6,
示例11: test_block_cachebool test_block_cache(){ using value_type = std::pair<int, int>; constexpr size_t magic1 = 0xc01ddead; constexpr unsigned subblock_raw_size = 1024 * 8; // 8KB subblocks constexpr unsigned block_size = 128; // 1MB blocks (=128 subblocks) constexpr unsigned num_blocks = 64; // number of blocks to use for this test constexpr unsigned cache_size = 8; // size of cache in blocks using subblock_type = foxxll::typed_block<subblock_raw_size, value_type>; using block_type = foxxll::typed_block<block_size* sizeof(subblock_type), subblock_type>; constexpr unsigned subblock_size = subblock_type::size; // size in values using bid_type = block_type::bid_type; using bid_container_type = std::vector<bid_type>; // prepare test: allocate blocks, fill them with values and write to disk bid_container_type bids(num_blocks); foxxll::block_manager* bm = foxxll::block_manager::get_instance(); bm->new_blocks(foxxll::striping(), bids.begin(), bids.end()); block_type* block = new block_type; for (unsigned i_block = 0; i_block < num_blocks; i_block++) { for (unsigned i_subblock = 0; i_subblock < block_size; i_subblock++) { for (unsigned i_value = 0; i_value < subblock_size; i_value++) { int value = i_value + i_subblock * subblock_size + i_block * block_size; (*block)[i_subblock][i_value] = value_type(value, value); } } foxxll::request_ptr req = block->write(bids[i_block]); req->wait(); } std::mt19937 randgen; std::uniform_int_distribution<int> distr_num(0, num_blocks - 1); std::uniform_int_distribution<int> distr_size(0, block_size - 1); // create block_cache using cache_type = stxxl::hash_map::block_cache<block_type>; cache_type cache(cache_size); // load random subblocks and check for values int n_runs = cache_size * 10; for (int i_run = 0; i_run < n_runs; i_run++) { int i_block = distr_num(randgen); int i_subblock = distr_size(randgen); subblock_type* subblock = cache.get_subblock(bids[i_block], i_subblock); int expected = i_block * block_size + i_subblock * subblock_size + 1; die_unless((*subblock)[1].first == expected); } // do the same again but this time with prefetching for (int i_run = 0; i_run < n_runs; i_run++) { int i_block = distr_num(randgen); int i_subblock = distr_size(randgen); cache.prefetch_block(bids[i_block]); subblock_type* subblock = cache.get_subblock(bids[i_block], i_subblock); int expected = i_block * block_size + i_subblock * subblock_size + 1; die_unless((*subblock)[1].first == expected); } // load and modify some subblocks; flush cache and check values randgen.seed(magic1); for (int i_run = 0; i_run < n_runs; i_run++) { int i_block = distr_num(randgen); int i_subblock = distr_size(randgen); subblock_type* subblock = cache.get_subblock(bids[i_block], i_subblock); die_unless(cache.make_dirty(bids[i_block])); (*subblock)[1].first = (*subblock)[1].second + 42; } randgen.seed(magic1); for (int i_run = 0; i_run < n_runs; i_run++) { int i_block = distr_num(randgen); int i_subblock = distr_size(randgen); subblock_type* subblock = cache.get_subblock(bids[i_block], i_subblock); int expected = i_block * block_size + i_subblock * subblock_size + 1; die_unequal((*subblock)[1].first, expected + 42); } // test retaining cache.clear(); // not yet cached die_unless(cache.retain_block(bids[0]) == false); cache.prefetch_block(bids[0]); // cached, should be retained die_unless(cache.retain_block(bids[0]) == true); // release again//.........这里部分代码省略.........
开发者ID:bingmann,项目名称:stxxl,代码行数:101,
示例12: emplace std::pair<iterator, bool> emplace(Args&&... args) { // TODO: optimize return insert(value_type(std::forward<Args>(args)...)); }
开发者ID:GuapoTaco,项目名称:Modular-ECS,代码行数:5,
示例13: val_print_packed_array_elementsstatic voidval_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, int offset, int bitoffset, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options){ unsigned int i; unsigned int things_printed = 0; unsigned len; struct type *elttype, *index_type; unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0); struct value *mark = value_mark (); LONGEST low = 0; elttype = TYPE_TARGET_TYPE (type); index_type = TYPE_INDEX_TYPE (type); { LONGEST high; if (get_discrete_bounds (index_type, &low, &high) < 0) len = 1; else len = high - low + 1; } i = 0; annotate_array_section_begin (i, elttype); while (i < len && things_printed < options->print_max) { struct value *v0, *v1; int i0; if (i != 0) { if (options->prettyformat_arrays) { fprintf_filtered (stream, ",/n"); print_spaces_filtered (2 + 2 * recurse, stream); } else { fprintf_filtered (stream, ", "); } } wrap_here (n_spaces (2 + 2 * recurse)); maybe_print_array_index (index_type, i + low, stream, options); i0 = i; v0 = ada_value_primitive_packed_val (NULL, valaddr + offset, (i0 * bitsize) / HOST_CHAR_BIT, (i0 * bitsize) % HOST_CHAR_BIT, bitsize, elttype); while (1) { i += 1; if (i >= len) break; v1 = ada_value_primitive_packed_val (NULL, valaddr + offset, (i * bitsize) / HOST_CHAR_BIT, (i * bitsize) % HOST_CHAR_BIT, bitsize, elttype); if (TYPE_LENGTH (check_typedef (value_type (v0))) != TYPE_LENGTH (check_typedef (value_type (v1)))) break; if (!value_contents_eq (v0, value_embedded_offset (v0), v1, value_embedded_offset (v1), TYPE_LENGTH (check_typedef (value_type (v0))))) break; } if (i - i0 > options->repeat_count_threshold) { struct value_print_options opts = *options; opts.deref_ref = 0; val_print (elttype, value_embedded_offset (v0), 0, stream, recurse + 1, v0, &opts, current_language); annotate_elt_rep (i - i0); fprintf_filtered (stream, _(" <repeats %u times>"), i - i0); annotate_elt_rep_end (); } else { int j; struct value_print_options opts = *options; opts.deref_ref = 0; for (j = i0; j < i; j += 1) { if (j > i0) { if (options->prettyformat_arrays) { fprintf_filtered (stream, ",/n");//.........这里部分代码省略.........
开发者ID:kraj,项目名称:binutils-gdb,代码行数:101,
示例14: lm32_push_dummy_callstatic CORE_ADDRlm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr){ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int first_arg_reg = SIM_LM32_R1_REGNUM; int num_arg_regs = 8; int i; /* Set the return address. */ regcache_cooked_write_signed (regcache, SIM_LM32_RA_REGNUM, bp_addr); /* If we're returning a large struct, a pointer to the address to store it at is passed as a first hidden parameter. */ if (struct_return) { regcache_cooked_write_unsigned (regcache, first_arg_reg, struct_addr); first_arg_reg++; num_arg_regs--; sp -= 4; } /* Setup parameters. */ for (i = 0; i < nargs; i++) { struct value *arg = args[i]; struct type *arg_type = check_typedef (value_type (arg)); gdb_byte *contents; int len; ULONGEST val; /* Promote small integer types to int. */ switch (TYPE_CODE (arg_type)) { case TYPE_CODE_INT: case TYPE_CODE_BOOL: case TYPE_CODE_CHAR: case TYPE_CODE_RANGE: case TYPE_CODE_ENUM: if (TYPE_LENGTH (arg_type) < 4) { arg_type = builtin_type (gdbarch)->builtin_int32; arg = value_cast (arg_type, arg); } break; } /* FIXME: Handle structures. */ contents = (gdb_byte *) value_contents (arg); len = TYPE_LENGTH (arg_type); val = extract_unsigned_integer (contents, len, byte_order); /* First num_arg_regs parameters are passed by registers, and the rest are passed on the stack. */ if (i < num_arg_regs) regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val); else { write_memory (sp, (void *) &val, len); sp -= 4; } } /* Update stack pointer. */ regcache_cooked_write_signed (regcache, SIM_LM32_SP_REGNUM, sp); /* Return adjusted stack pointer. */ return sp;}
开发者ID:BreakawayConsulting,项目名称:gdb,代码行数:72,
示例15: evaluate_subexp_modula2static struct value *evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, int *pos, enum noside noside){ enum exp_opcode op = exp->elts[*pos].opcode; struct value *arg1; struct value *arg2; struct type *type; switch (op) { case UNOP_HIGH: (*pos)++; arg1 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; else { arg1 = coerce_ref (arg1); type = check_typedef (value_type (arg1)); if (m2_is_unbounded_array (type)) { struct value *temp = arg1; type = TYPE_FIELD_TYPE (type, 1); /* i18n: Do not translate the "_m2_high" part! */ arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL, _("unbounded structure " "missing _m2_high field")); if (value_type (arg1) != type) arg1 = value_cast (type, arg1); } } return arg1; case BINOP_SUBSCRIPT: (*pos)++; arg1 = evaluate_subexp_with_coercion (exp, pos, noside); arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; /* If the user attempts to subscript something that is not an array or pointer type (like a plain int variable for example), then report this as an error. */ arg1 = coerce_ref (arg1); type = check_typedef (value_type (arg1)); if (m2_is_unbounded_array (type)) { struct value *temp = arg1; type = TYPE_FIELD_TYPE (type, 0); if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR)) { warning (_("internal error: unbounded " "array structure is unknown")); return evaluate_subexp_standard (expect_type, exp, pos, noside); } /* i18n: Do not translate the "_m2_contents" part! */ arg1 = value_struct_elt (&temp, NULL, "_m2_contents", NULL, _("unbounded structure " "missing _m2_contents field")); if (value_type (arg1) != type) arg1 = value_cast (type, arg1); check_typedef (value_type (arg1)); return value_ind (value_ptradd (arg1, value_as_long (arg2))); } else if (TYPE_CODE (type) != TYPE_CODE_ARRAY) { if (TYPE_NAME (type)) error (_("cannot subscript something of type `%s'"), TYPE_NAME (type)); else error (_("cannot subscript requested type")); } if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1)); else return value_subscript (arg1, value_as_long (arg2)); default: return evaluate_subexp_standard (expect_type, exp, pos, noside); } nosideret: return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);}
开发者ID:Caleb1994,项目名称:stewieos-binutils,代码行数:94,
示例16: gnuv2_value_rtti_typestatic struct type *gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc){ struct type *known_type; struct type *rtti_type; CORE_ADDR coreptr; struct value *vp; long top_offset = 0; char rtti_type_name[256]; CORE_ADDR vtbl; struct minimal_symbol *minsym; struct symbol *sym; char *demangled_name; struct type *btype; if (full) *full = 0; if (top) *top = -1; if (using_enc) *using_enc = 0; /* Get declared type */ known_type = value_type (v); CHECK_TYPEDEF (known_type); /* RTTI works only or class objects */ if (TYPE_CODE (known_type) != TYPE_CODE_CLASS) return NULL; /* Plan on this changing in the future as i get around to setting the vtables properly for G++ compiled stuff. Also, I'll be using the type info functions, which are always right. Deal with it until then. */ /* If the type has no vptr fieldno, try to get it filled in */ if (TYPE_VPTR_FIELDNO(known_type) < 0) fill_in_vptr_fieldno(known_type); /* If we still can't find one, give up */ if (TYPE_VPTR_FIELDNO(known_type) < 0) return NULL; /* Make sure our basetype and known type match, otherwise, cast so we can get at the vtable properly. */ btype = TYPE_VPTR_BASETYPE (known_type); CHECK_TYPEDEF (btype); if (btype != known_type ) { v = value_cast (btype, v); if (using_enc) *using_enc=1; } /* We can't use value_ind here, because it would want to use RTTI, and we'd waste a bunch of time figuring out we already know the type. Besides, we don't care about the type, just the actual pointer */ if (VALUE_ADDRESS (value_field (v, TYPE_VPTR_FIELDNO (known_type))) == 0) return NULL; vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type))); /* Try to find a symbol that is the vtable */ minsym=lookup_minimal_symbol_by_pc(vtbl); if (minsym==NULL || (demangled_name=DEPRECATED_SYMBOL_NAME (minsym))==NULL || !is_vtable_name (demangled_name)) return NULL; /* If we just skip the prefix, we get screwed by namespaces */ demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI); *(strchr(demangled_name,' '))=0; /* Lookup the type for the name */ /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ rtti_type = cp_lookup_rtti_type (demangled_name, NULL); if (rtti_type == NULL) return NULL; if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1) { if (top) *top=TYPE_BASECLASS_BITPOS(rtti_type,TYPE_VPTR_FIELDNO(rtti_type))/8; if (top && ((*top) >0)) { if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type)) { if (full) *full=0; } else { if (full) *full=1; } } } else {//.........这里部分代码省略.........
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:101,
示例17: get_number_trailerintget_number_trailer (const char **pp, int trailer){ int retval = 0; /* default */ const char *p = *pp; if (*p == '$') { struct value *val = value_from_history_ref (p, &p); if (val) /* Value history reference */ { if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT) retval = value_as_long (val); else { printf_filtered (_("History value must have integer type./n")); retval = 0; } } else /* Convenience variable */ { /* Internal variable. Make a copy of the name, so we can null-terminate it to pass to lookup_internalvar(). */ char *varname; const char *start = ++p; LONGEST val; while (isalnum (*p) || *p == '_') p++; varname = (char *) alloca (p - start + 1); strncpy (varname, start, p - start); varname[p - start] = '/0'; if (get_internalvar_integer (lookup_internalvar (varname), &val)) retval = (int) val; else { printf_filtered (_("Convenience variable must " "have integer value./n")); retval = 0; } } } else { if (*p == '-') ++p; while (*p >= '0' && *p <= '9') ++p; if (p == *pp) /* There is no number here. (e.g. "cond a == b"). */ { /* Skip non-numeric token. */ while (*p && !isspace((int) *p)) ++p; /* Return zero, which caller must interpret as error. */ retval = 0; } else retval = atoi (*pp); } if (!(isspace (*p) || *p == '/0' || *p == trailer)) { /* Trailing junk: return 0 and let caller print error msg. */ while (!(isspace (*p) || *p == '/0' || *p == trailer)) ++p; retval = 0; } p = skip_spaces_const (p); *pp = p; return retval;}
开发者ID:Caleb1994,项目名称:stewieos-binutils,代码行数:72,
示例18: c_get_stringvoidc_get_string (struct value *value, gdb_byte **buffer, int *length, struct type **char_type, const char **charset){ int err, width; unsigned int fetchlimit; struct type *type = check_typedef (value_type (value)); struct type *element_type = TYPE_TARGET_TYPE (type); int req_length = *length; enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); if (element_type == NULL) goto error; if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { /* If we know the size of the array, we can use it as a limit on the number of characters to be fetched. */ if (TYPE_NFIELDS (type) == 1 && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE) { LONGEST low_bound, high_bound; get_discrete_bounds (TYPE_FIELD_TYPE (type, 0), &low_bound, &high_bound); fetchlimit = high_bound - low_bound + 1; } else fetchlimit = UINT_MAX; } else if (TYPE_CODE (type) == TYPE_CODE_PTR) fetchlimit = UINT_MAX; else /* We work only with arrays and pointers. */ goto error; if (! c_textual_element_type (element_type, 0)) goto error; classify_type (element_type, get_type_arch (element_type), charset); width = TYPE_LENGTH (element_type); /* If the string lives in GDB's memory instead of the inferior's, then we just need to copy it to BUFFER. Also, since such strings are arrays with known size, FETCHLIMIT will hold the size of the array. */ if ((VALUE_LVAL (value) == not_lval || VALUE_LVAL (value) == lval_internalvar) && fetchlimit != UINT_MAX) { int i; const gdb_byte *contents = value_contents (value); /* If a length is specified, use that. */ if (*length >= 0) i = *length; else /* Otherwise, look for a null character. */ for (i = 0; i < fetchlimit; i++) if (extract_unsigned_integer (contents + i * width, width, byte_order) == 0) break; /* I is now either a user-defined length, the number of non-null characters, or FETCHLIMIT. */ *length = i * width; *buffer = (gdb_byte *) xmalloc (*length); memcpy (*buffer, contents, *length); err = 0; } else { CORE_ADDR addr = value_as_address (value); /* Prior to the fix for PR 16196 read_string would ignore fetchlimit if length > 0. The old "broken" behaviour is the behaviour we want: The caller may want to fetch 100 bytes from a variable length array implemented using the common idiom of having an array of length 1 at the end of a struct. In this case we want to ignore the declared size of the array. However, it's counterintuitive to implement that behaviour in read_string: what does fetchlimit otherwise mean if length > 0. Therefore we implement the behaviour we want here: If *length > 0, don't specify a fetchlimit. This preserves the previous behaviour. We could move this check above where we know whether the array is declared with a fixed size, but we only want to apply this behaviour when calling read_string. PR 16286. */ if (*length > 0) fetchlimit = UINT_MAX; err = read_string (addr, *length, width, fetchlimit, byte_order, buffer, length); if (err) { xfree (*buffer); memory_error (err, addr); } } /* If the LENGTH is specified at -1, we want to return the string//.........这里部分代码省略.........
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:101,
示例19: v1void test_blas_1<V, N>::test () { { value_type t; real_type n; V v1 (N), v2 (N); // _asum initialize_vector (v1); n = ublas::blas_1::asum (v1); std::cout << "asum (v1) = " << n << std::endl; // _amax initialize_vector (v1); n = ublas::blas_1::amax (v1); std::cout << "amax (v1) = " << n << std::endl; // _nrm2 initialize_vector (v1); n = ublas::blas_1::nrm2 (v1); std::cout << "nrm2 (v1) = " << n << std::endl; // _dot // _dotu // _dotc initialize_vector (v1); initialize_vector (v2); t = ublas::blas_1::dot (v1, v2); std::cout << "dot (v1, v2) = " << t << std::endl; t = ublas::blas_1::dot (ublas::conj (v1), v2); std::cout << "dot (conj (v1), v2) = " << t << std::endl; // _copy initialize_vector (v2); ublas::blas_1::copy (v1, v2); std::cout << "copy (v1, v2) = " << v1 << std::endl; // _swap initialize_vector (v1); initialize_vector (v2); ublas::blas_1::swap (v1, v2); std::cout << "swap (v1, v2) = " << v1 << " " << v2 << std::endl; // _scal // csscal // zdscal initialize_vector (v1); ublas::blas_1::scal (v1, value_type (1)); std::cout << "scal (v1, 1) = " << v1 << std::endl; // _axpy initialize_vector (v1); initialize_vector (v2); ublas::blas_1::axpy (v1, value_type (1), v2); std::cout << "axpy (v1, 1, v2) = " << v1 << std::endl; // _rot initialize_vector (v1); initialize_vector (v2); ublas::blas_1::rot (value_type (1), v1, value_type (1), v2); std::cout << "rot (1, v1, 1, v2) = " << v1 << " " << v2 << std::endl; }}
开发者ID:Adikteev,项目名称:rtbkit-deps,代码行数:62,
示例20: enter_if_block void enter_if_block(bool new_status) { // If enclosing block is false, then this block is also false bool enclosing_status = get_status(); this->push (value_type (new_status && enclosing_status, enclosing_status)); }
开发者ID:imos,项目名称:icfpc2015,代码行数:6,
示例21: memsetbool CCMatchBuffDescMgr::ParseItem(::CCXmlElement& element){ CCMatchBuffDesc* pNewDesc = new CCMatchBuffDesc; int n = 0; char szAttrValue[256]; char szAttrName[64]; int nAttrCount = element.GetAttributeCount(); for (int i = 0; i < nAttrCount; i++) { memset( szAttrValue, 0, 256 ); memset( szAttrName, 0, 64 ); element.GetAttribute(i, szAttrName, szAttrValue); if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_ID)) { pNewDesc->m_nBuffID = atoi(szAttrValue); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_ICON_NAME)) { strcpy(pNewDesc->m_szBuffIconName, szAttrValue); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_PERIOD_TYPE)) { if (!stricmp(szAttrValue, MICTOK_ATTRVAL_PERIOD_TYPE_LONG)) pNewDesc->m_nBuffPeriodType.Set(MMBPT_LONG); else if (!stricmp(szAttrValue, MICTOK_ATTRVAL_PERIOD_TYPE_SHORT)) pNewDesc->m_nBuffPeriodType.Set(MMBPT_SHORT); else _ASSERT(0); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_PERIOD)) { pNewDesc->m_nBuffPeriod.Set_MakeCrc(atoi(szAttrValue)); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_EFFECT_TYPE)) { if (!stricmp(szAttrValue, MICTOK_ATTRVAL_BUFF_EFFECT_TYPE_NORMAL)) pNewDesc->m_nBuffEffectType.Set(MMBET_NORMAL); else if (!stricmp(szAttrValue, MICTOK_ATTRVAL_BUFF_EFFECT_TYPE_DOTE)) pNewDesc->m_nBuffEffectType.Set(MMBET_DOTE); else _ASSERT(0); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_HP_VALUE)) { pNewDesc->m_pBuffInfo->Ref().nHP = atoi(szAttrValue); pNewDesc->m_pBuffInfo->MakeCrc(); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_AP_VALUE)) { pNewDesc->m_pBuffInfo->Ref().nAP = atoi(szAttrValue); pNewDesc->m_pBuffInfo->MakeCrc(); } else if (!stricmp(szAttrName, MICTOK_ATTRNAME_BUFF_RESPAWN_DECREASE_TIME)) { pNewDesc->m_pBuffInfo->Ref().nRespawnDecTime = atoi(szAttrValue); pNewDesc->m_pBuffInfo->MakeCrc(); } else { _ASSERT(0); delete pNewDesc; return false; } } iterator tempitor = find(pNewDesc->m_nBuffID); if (tempitor != end()) { _ASSERT(0); ///< C++ var函数代码示例 C++ value_ptr函数代码示例
|