std::ostream& operator<<(std::ostream& o, type_id t) { return o << type_name(t); }
conversion_error make_coercion_error(const char* cpp, type_id amqp) { return conversion_error(std::string("invalid proton::coerce<") + cpp + ">(" + type_name(amqp) + ")"); }
/// Node indices for each face IndicesT face_nodes; /// Iterator range over the nodes of the given face RangeT face_node_range(const Uint face) const { if(face_first_nodes.empty()) return boost::make_iterator_range(face_nodes.begin(), face_nodes.end()); IndicesT::const_iterator begin = face_nodes.begin() + face_first_nodes[face]; return boost::make_iterator_range(begin, begin + face_node_counts[face]); } }; /// Default constructor without arguments ElementType( const std::string& name = type_name() ); /// Default destructor virtual ~ElementType(); static std::string type_name() { return "ElementType"; } /// @return m_nameShape std::string shape_name() const { return Mesh::GeoShape::Convert::instance().to_str( m_shape ); } /// @return m_geoShape GeoShape::Type shape() const { return m_shape; } /// @return number of faces Uint nb_faces() const { return m_nb_faces; }
static const unsigned char *display_rr(const unsigned char *aptr, const unsigned char *abuf, int alen, dns_resp_t *response) { const unsigned char *p; char *name; int type, dnsclass, ttl, dlen, status; long len; struct in_addr addr; /* Parse the RR name. */ status = ares_expand_name(aptr, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; aptr += len; /* Make sure there is enough data after the RR name for the fixed * part of the RR. */ if (aptr + RRFIXEDSZ > abuf + alen) { xfree(name); return NULL; } /* Parse the fixed part of the RR, and advance to the RR data field. */ type = DNS_RR_TYPE(aptr); dnsclass = DNS_RR_CLASS(aptr); ttl = DNS_RR_TTL(aptr); dlen = DNS_RR_LEN(aptr); aptr += RRFIXEDSZ; if (aptr + dlen > abuf + alen) { xfree(name); return NULL; } /* Display the RR name, class, and type. */ sprintf(msg, "\t%-15s.\t%d", name, ttl); addtobuffer(response->msgbuf, msg); if (dnsclass != C_IN) { sprintf(msg, "\t%s", class_name(dnsclass)); addtobuffer(response->msgbuf, msg); } sprintf(msg, "\t%s", type_name(type)); addtobuffer(response->msgbuf, msg); xfree(name); /* Display the RR data. Don't touch aptr. */ switch (type) { case T_CNAME: case T_MB: case T_MD: case T_MF: case T_MG: case T_MR: case T_NS: case T_PTR: /* For these types, the RR data is just a domain name. */ status = ares_expand_name(aptr, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.", name); addtobuffer(response->msgbuf, msg); xfree(name); break; case T_HINFO: /* The RR data is two length-counted character strings. */ p = aptr; len = *p; if (p + len + 1 > aptr + dlen) return NULL; sprintf(msg, "\t%.*s", (int) len, p + 1); addtobuffer(response->msgbuf, msg); p += len + 1; len = *p; if (p + len + 1 > aptr + dlen) return NULL; sprintf(msg, "\t%.*s", (int) len, p + 1); addtobuffer(response->msgbuf, msg); break; case T_MINFO: /* The RR data is two domain names. */ p = aptr; status = ares_expand_name(p, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.", name); addtobuffer(response->msgbuf, msg); xfree(name); p += len; status = ares_expand_name(p, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.", name); addtobuffer(response->msgbuf, msg); xfree(name); break; case T_MX: /* The RR data is two bytes giving a preference ordering, and then a domain name. */ if (dlen < 2) return NULL; sprintf(msg, "\t%d", (aptr[0] << 8) | aptr[1]); addtobuffer(response->msgbuf, msg); status = ares_expand_name(aptr + 2, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.", name); addtobuffer(response->msgbuf, msg); xfree(name); break; case T_SOA: /* * The RR data is two domain names and then five four-byte * numbers giving the serial number and some timeouts. */ p = aptr; status = ares_expand_name(p, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.\n", name); addtobuffer(response->msgbuf, msg); xfree(name); p += len; status = ares_expand_name(p, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t\t\t\t\t\t%s.\n", name); addtobuffer(response->msgbuf, msg); xfree(name); p += len; if (p + 20 > aptr + dlen) return NULL; sprintf(msg, "\t\t\t\t\t\t( %d %d %d %d %d )", (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3], (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7], (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11], (p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15], (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]); addtobuffer(response->msgbuf, msg); break; case T_TXT: /* The RR data is one or more length-counted character strings. */ p = aptr; while (p < aptr + dlen) { len = *p; if (p + len + 1 > aptr + dlen) return NULL; sprintf(msg, "\t%.*s", (int)len, p + 1); addtobuffer(response->msgbuf, msg); p += len + 1; } break; case T_A: /* The RR data is a four-byte Internet address. */ if (dlen != 4) return NULL; memcpy(&addr, aptr, sizeof(struct in_addr)); sprintf(msg, "\t%s", inet_ntoa(addr)); addtobuffer(response->msgbuf, msg); break; case T_WKS: /* Not implemented yet */ break; case T_SRV: /* * The RR data is three two-byte numbers representing the * priority, weight, and port, followed by a domain name. */ sprintf(msg, "\t%d", DNS__16BIT(aptr)); addtobuffer(response->msgbuf, msg); sprintf(msg, " %d", DNS__16BIT(aptr + 2)); addtobuffer(response->msgbuf, msg); sprintf(msg, " %d", DNS__16BIT(aptr + 4)); addtobuffer(response->msgbuf, msg); status = ares_expand_name(aptr + 6, abuf, alen, &name, &len); if (status != ARES_SUCCESS) return NULL; sprintf(msg, "\t%s.", name); addtobuffer(response->msgbuf, msg); xfree(name); break; default: sprintf(msg, "\t[Unknown RR; cannot parse]"); addtobuffer(response->msgbuf, msg); } sprintf(msg, "\n"); addtobuffer(response->msgbuf, msg); return aptr + dlen; }
void game_sv_GameState::Create (shared_str &options) { string_path fn_game; m_item_respawner.clear_respawns(); if (FS.exist(fn_game, "$level$", "level.game")) { IReader *F = FS.r_open (fn_game); IReader *O = 0; // Load RPoints if (0!=(O = F->open_chunk (RPOINT_CHUNK))) { for (int id=0; O->find_chunk(id); ++id) { RPoint R; u8 team; u8 type; u16 GameType; shared_str rp_profile; O->r_fvector3 (R.P); O->r_fvector3 (R.A); team = O->r_u8 (); type = O->r_u8 (); GameType = O->r_u16 (); if(type==rptItemSpawn) O->r_stringZ (rp_profile); if (GameType != EGameIDs(u16(-1))) { if ((Type() == eGameIDCaptureTheArtefact) && (GameType & eGameIDCaptureTheArtefact)) { team = team - 1; R_ASSERT2( ((team >= 0) && (team < 4)) || (type != rptActorSpawn), "Problem with CTA Team indexes. Propably you have added rpoint of team 0 for cta game type."); } if ((!(GameType & eGameIDDeathmatch) && (Type() == eGameIDDeathmatch)) || (!(GameType & eGameIDTeamDeathmatch) && (Type() == eGameIDTeamDeathmatch)) || (!(GameType & eGameIDArtefactHunt) && (Type() == eGameIDArtefactHunt)) || (!(GameType & eGameIDCaptureTheArtefact) && (Type() == eGameIDCaptureTheArtefact)) ) { continue; }; }; switch (type) { case rptActorSpawn: { rpoints[team].push_back (R); for (int i=0; i<int(rpoints[team].size())-1; i++) { RPoint rp = rpoints[team][i]; float dist = R.P.distance_to_xz(rp.P)/2; if (dist<rpoints_MinDist[team]) rpoints_MinDist[team] = dist; dist = R.P.distance_to(rp.P)/2; if (dist<rpoints_Dist[team]) rpoints_Dist[team] = dist; }; }break; case rptItemSpawn: { m_item_respawner.add_new_rpoint(rp_profile, R); } }; }; O->close(); } FS.r_close (F); } if (!g_dedicated_server) { // loading scripts ai().script_engine().remove_script_process(ScriptEngine::eScriptProcessorGame); string_path S; FS.update_path (S,"$game_config$","script.ltx"); CInifile *l_tpIniFile = xr_new<CInifile>(S); R_ASSERT (l_tpIniFile); if( l_tpIniFile->section_exist( type_name() ) ) if (l_tpIniFile->r_string(type_name(),"script")) ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorGame,xr_new<CScriptProcess>("game",l_tpIniFile->r_string(type_name(),"script"))); else ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorGame,xr_new<CScriptProcess>("game","")); xr_delete (l_tpIniFile); } //--------------------------------------------------------------------- ConsoleCommands_Create(); //--------------------------------------------------------------------- // CCC_LoadCFG_custom* pTmp = xr_new<CCC_LoadCFG_custom>("sv_"); // pTmp->Execute (Console->ConfigFile); // xr_delete (pTmp); //--------------------------------------------------------------------- LPCSTR svcfg_ltx_name = "-svcfg "; if (strstr(Core.Params, svcfg_ltx_name)) { string_path svcfg_name = ""; int sz = xr_strlen(svcfg_ltx_name); sscanf (strstr(Core.Params,svcfg_ltx_name)+sz,"%[^ ] ",svcfg_name); // if (FS.exist(svcfg_name)) { Console->ExecuteScript(svcfg_name); } }; //--------------------------------------------------------------------- ReadOptions(options); }
void do_object(int begin, int end) { type_name("jobject" ); }
/** * \brief Destroy the processing step */ ProcessingStep::~ProcessingStep() { debug(LOG_DEBUG, DEBUG_LOG, 0, "destroying %s @ %p", type_name().c_str(), this); // ensure we are neither precursor nor successor of any other step remove_me(); }
std::string InstrumentComponent::toString() { return stringprintf("%-16.16s %-8.8s %-32.32s %-2ld %s", type_name().c_str(), component_typename().c_str(), name().c_str(), unit(), servername().c_str()); }
void print_tree (FILE *fp, struct predicate *node, int indent) { int i; if (node == NULL) return; for (i = 0; i < indent; i++) fprintf (fp, " "); fprintf (fp, "pred=["); print_predicate (fp, node); fprintf (fp, "] type=%s prec=%s", type_name (node->p_type), prec_name (node->p_prec)); fprintf (fp, " cost=%s rate=%#03.2g %sside effects ", cost_name (node->p_cost), node->est_success_rate, (node->side_effects ? "" : "no ")); if (node->need_stat || node->need_type || node->need_inum) { int comma = 0; fprintf (fp, "Needs "); if (node->need_stat) { fprintf (fp, "stat"); comma = 1; } if (node->need_inum) { fprintf (fp, "%sinode", comma ? "," : ""); comma = 1; } if (node->need_type) { fprintf (fp, "%stype", comma ? "," : ""); } } fprintf (fp, "\n"); for (i = 0; i < indent; i++) fprintf (fp, " "); if (NULL == node->pred_left && NULL == node->pred_right) { fprintf (fp, "no children.\n"); } else { if (node->pred_left) { fprintf (fp, "left:\n"); print_tree (fp, node->pred_left, indent + 1); } else { fprintf (fp, "no left.\n"); } for (i = 0; i < indent; i++) fprintf (fp, " "); if (node->pred_right) { fprintf (fp, "right:\n"); print_tree (fp, node->pred_right, indent + 1); } else { fprintf (fp, "no right.\n"); } } }
static void do_ncdump(const char *path, struct fspec* specp) { int ndims; /* number of dimensions */ int nvars; /* number of variables */ int ngatts; /* number of global attributes */ int xdimid; /* id of unlimited dimension */ int dimid; /* dimension id */ int varid; /* variable id */ struct ncdim dims[NC_MAX_DIMS]; /* dimensions */ size_t vdims[NC_MAX_DIMS]; /* dimension sizes for a single variable */ struct ncvar var; /* variable */ struct ncatt att; /* attribute */ int id; /* dimension number per variable */ int ia; /* attribute number */ int iv; /* variable number */ int is_coord; /* true if variable is a coordinate variable */ int ncid; /* netCDF id */ vnode* vlist = 0; /* list for vars specified with -v option */ int nc_status; /* return from netcdf calls */ nc_status = nc_open(path, NC_NOWRITE, &ncid); if (nc_status != NC_NOERR) { error("%s: %s", path, nc_strerror(nc_status)); } /* * If any vars were specified with -v option, get list of associated * variable ids */ if (specp->nlvars > 0) { vlist = newvlist(); /* list for vars specified with -v option */ for (iv=0; iv < specp->nlvars; iv++) { NC_CHECK( nc_inq_varid(ncid, specp->lvars[iv], &varid) ); varadd(vlist, varid); } } /* if name not specified, derive it from path */ if (specp->name == (char *)0) { specp->name = name_path (path); } Printf ("netcdf %s {\n", specp->name); /* * get number of dimensions, number of variables, number of global * atts, and dimension id of unlimited dimension, if any */ NC_CHECK( nc_inq(ncid, &ndims, &nvars, &ngatts, &xdimid) ); /* get dimension info */ if (ndims > 0) Printf ("dimensions:\n"); for (dimid = 0; dimid < ndims; dimid++) { NC_CHECK( nc_inq_dim(ncid, dimid, dims[dimid].name, &dims[dimid].size) ); if (dimid == xdimid) Printf ("\t%s = %s ; // (%ld currently)\n",dims[dimid].name, "UNLIMITED", (long)dims[dimid].size); else Printf ("\t%s = %ld ;\n", dims[dimid].name, (long)dims[dimid].size); } if (nvars > 0) Printf ("variables:\n"); /* get variable info, with variable attributes */ for (varid = 0; varid < nvars; varid++) { NC_CHECK( nc_inq_var(ncid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts) ); Printf ("\t%s %s", type_name(var.type), var.name); if (var.ndims > 0) Printf ("("); for (id = 0; id < var.ndims; id++) { Printf ("%s%s", dims[var.dims[id]].name, id < var.ndims-1 ? ", " : ")"); } Printf (" ;\n"); /* get variable attributes */ for (ia = 0; ia < var.natts; ia++) pr_att(ncid, varid, var.name, ia); /* print ia-th attribute */ } /* get global attributes */ if (ngatts > 0) Printf ("\n// global attributes:\n"); for (ia = 0; ia < ngatts; ia++) pr_att(ncid, NC_GLOBAL, "", ia); /* print ia-th global attribute */ if (! specp->header_only) { if (nvars > 0) { Printf ("data:\n"); } /* output variable data */ for (varid = 0; varid < nvars; varid++) { /* if var list specified, test for membership */ if (specp->nlvars > 0 && ! varmember(vlist, varid)) continue; NC_CHECK( nc_inq_var(ncid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts) ); if (specp->coord_vals) { /* Find out if this is a coordinate variable */ is_coord = 0; for (dimid = 0; dimid < ndims; dimid++) { if (strcmp(dims[dimid].name, var.name) == 0 && var.ndims == 1) { is_coord = 1; break; } } if (! is_coord) /* don't get data for non-coordinate vars */ continue; } /* * Only get data for variable if it is not a record variable, * or if it is a record variable and at least one record has * been written. */ if (var.ndims == 0 || var.dims[0] != xdimid || dims[xdimid].size != 0) { /* Collect variable's dim sizes */ for (id = 0; id < var.ndims; id++) vdims[id] = dims[var.dims[id]].size; var.has_fillval = 1; /* by default, but turn off for bytes */ /* get _FillValue attribute */ nc_status = nc_inq_att(ncid,varid,_FillValue,&att.type,&att.len); if(nc_status == NC_NOERR && att.type == var.type && att.len == 1) { if(var.type == NC_CHAR) { char fillc; NC_CHECK( nc_get_att_text(ncid, varid, _FillValue, &fillc ) ); var.fillval = fillc; } else { NC_CHECK( nc_get_att_double(ncid, varid, _FillValue, &var.fillval) ); } } else { switch (var.type) { case NC_BYTE: /* don't do default fill-values for bytes, too risky */ var.has_fillval = 0; break; case NC_CHAR: var.fillval = NC_FILL_CHAR; break; case NC_SHORT: var.fillval = NC_FILL_SHORT; break; case NC_INT: var.fillval = NC_FILL_INT; break; case NC_FLOAT: var.fillval = NC_FILL_FLOAT; break; case NC_DOUBLE: var.fillval = NC_FILL_DOUBLE; break; default: break; } } if (vardata(&var, vdims, ncid, varid, specp) == -1) { error("can't output data for variable %s", var.name); NC_CHECK( nc_close(ncid) ); if (vlist) free(vlist); return; } } } } Printf ("}\n"); NC_CHECK( nc_close(ncid) ); if (vlist) free(vlist); }
void slug::dump() // print contents of a slug { printf("# %d %-4.4s parm %d dv %d base %d s%d f%d H%d\n#\t\t%s\n", serialno(), type_name(), parm, dv, base, size, font, hpos, headstr()); }
static int unpack_array(scanner_t *s, json_t *root, va_list *ap) { size_t i = 0; int strict = 0; if(root && !json_is_array(root)) { set_error(s, "<validation>", "Expected array, got %s", type_name(root)); return -1; } next_token(s); while(s->token != ']') { json_t *value; if(strict != 0) { set_error(s, "<format>", "Expected ']' after '%c', got '%c'", (strict == 1 ? '!' : '*'), s->token); return -1; } if(!s->token) { set_error(s, "<format>", "Unexpected end of format string"); return -1; } if(s->token == '!' || s->token == '*') { strict = (s->token == '!' ? 1 : -1); next_token(s); continue; } if(!strchr(unpack_value_starters, s->token)) { set_error(s, "<format>", "Unexpected format character '%c'", s->token); return -1; } if(!root) { /* skipping */ value = NULL; } else { value = json_array_get(root, i); if(!value) { set_error(s, "<validation>", "Array index %lu out of range", (unsigned long)i); return -1; } } if(unpack(s, value, ap)) return -1; next_token(s); i++; } if(strict == 0 && (s->flags & JSON_STRICT)) strict = 1; if(root && strict == 1 && i != json_array_size(root)) { long diff = (long)json_array_size(root) - (long)i; set_error(s, "<validation>", "%li array item(s) left unpacked", diff); return -1; } return 0; }
static int unpack_object(scanner_t *s, json_t *root, va_list *ap) { int ret = -1; int strict = 0; /* Use a set (emulated by a hashtable) to check that all object keys are accessed. Checking that the correct number of keys were accessed is not enough, as the same key can be unpacked multiple times. */ hashtable_t key_set; if(hashtable_init(&key_set)) { set_error(s, "<internal>", "Out of memory"); return -1; } if(root && !json_is_object(root)) { set_error(s, "<validation>", "Expected object, got %s", type_name(root)); goto out; } next_token(s); while(s->token != '}') { const char *key; json_t *value; int opt = 0; if(strict != 0) { set_error(s, "<format>", "Expected '}' after '%c', got '%c'", (strict == 1 ? '!' : '*'), s->token); goto out; } if(!s->token) { set_error(s, "<format>", "Unexpected end of format string"); goto out; } if(s->token == '!' || s->token == '*') { strict = (s->token == '!' ? 1 : -1); next_token(s); continue; } if(s->token != 's') { set_error(s, "<format>", "Expected format 's', got '%c'", s->token); goto out; } key = va_arg(*ap, const char *); if(!key) { set_error(s, "<args>", "NULL object key"); goto out; } next_token(s); if(s->token == '?') { opt = 1; next_token(s); } if(!root) { /* skipping */ value = NULL; } else { value = json_object_get(root, key); if(!value && !opt) { set_error(s, "<validation>", "Object item not found: %s", key); goto out; } } if(unpack(s, value, ap)) goto out; hashtable_set(&key_set, key, 0, json_null()); next_token(s); } if(strict == 0 && (s->flags & JSON_STRICT)) strict = 1; if(root && strict == 1 && key_set.size != json_object_size(root)) { long diff = (long)json_object_size(root) - (long)key_set.size; set_error(s, "<validation>", "%li object item(s) left unpacked", diff); goto out; } ret = 0; out: hashtable_close(&key_set); return ret; }
static int fsck_tag_buffer(struct tag *tag, const char *data, unsigned long size, struct fsck_options *options) { struct object_id oid; int ret = 0; const char *buffer; char *to_free = NULL, *eol; struct strbuf sb = STRBUF_INIT; const char *p; if (data) buffer = data; else { enum object_type type; buffer = to_free = read_object_file(&tag->object.oid, &type, &size); if (!buffer) return report(options, &tag->object, FSCK_MSG_MISSING_TAG_OBJECT, "cannot read tag object"); if (type != OBJ_TAG) { ret = report(options, &tag->object, FSCK_MSG_TAG_OBJECT_NOT_TAG, "expected tag got %s", type_name(type)); goto done; } } ret = verify_headers(buffer, size, &tag->object, options); if (ret) goto done; if (!skip_prefix(buffer, "object ", &buffer)) { ret = report(options, &tag->object, FSCK_MSG_MISSING_OBJECT, "invalid format - expected 'object' line"); goto done; } if (parse_oid_hex(buffer, &oid, &p) || *p != '\n') { ret = report(options, &tag->object, FSCK_MSG_BAD_OBJECT_SHA1, "invalid 'object' line format - bad sha1"); if (ret) goto done; } buffer = p + 1; if (!skip_prefix(buffer, "type ", &buffer)) { ret = report(options, &tag->object, FSCK_MSG_MISSING_TYPE_ENTRY, "invalid format - expected 'type' line"); goto done; } eol = strchr(buffer, '\n'); if (!eol) { ret = report(options, &tag->object, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line"); goto done; } if (type_from_string_gently(buffer, eol - buffer, 1) < 0) ret = report(options, &tag->object, FSCK_MSG_BAD_TYPE, "invalid 'type' value"); if (ret) goto done; buffer = eol + 1; if (!skip_prefix(buffer, "tag ", &buffer)) { ret = report(options, &tag->object, FSCK_MSG_MISSING_TAG_ENTRY, "invalid format - expected 'tag' line"); goto done; } eol = strchr(buffer, '\n'); if (!eol) { ret = report(options, &tag->object, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line"); goto done; } strbuf_addf(&sb, "refs/tags/%.*s", (int)(eol - buffer), buffer); if (check_refname_format(sb.buf, 0)) { ret = report(options, &tag->object, FSCK_MSG_BAD_TAG_NAME, "invalid 'tag' name: %.*s", (int)(eol - buffer), buffer); if (ret) goto done; } buffer = eol + 1; if (!skip_prefix(buffer, "tagger ", &buffer)) { /* early tags do not contain 'tagger' lines; warn only */ ret = report(options, &tag->object, FSCK_MSG_MISSING_TAGGER_ENTRY, "invalid format - expected 'tagger' line"); if (ret) goto done; } else ret = fsck_ident(&buffer, &tag->object, options); done: strbuf_release(&sb); free(to_free); return ret; }
void do_long() { type_name("jlong" ); }
void do_bool() { type_name("jboolean"); }
void do_void() { type_name("void" ); }
void do_char() { type_name("jchar" ); }
void do_array (int begin, int end) { type_name("jobject" ); }
void do_float() { type_name("jfloat" ); }
const std::string& id() const { if (id_.empty()) return type_name(); else return id_; }
void do_double() { type_name("jdouble" ); }
static const unsigned char *display_rr(const unsigned char *aptr, const unsigned char *abuf, int alen) { const unsigned char *p; int type, dnsclass, ttl, dlen, status; long len; char addr[46]; union { unsigned char * as_uchar; char * as_char; } name; /* Parse the RR name. */ status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; aptr += len; /* Make sure there is enough data after the RR name for the fixed * part of the RR. */ if (aptr + RRFIXEDSZ > abuf + alen) { ares_free_string(name.as_char); return NULL; } /* Parse the fixed part of the RR, and advance to the RR data * field. */ type = DNS_RR_TYPE(aptr); dnsclass = DNS_RR_CLASS(aptr); ttl = DNS_RR_TTL(aptr); dlen = DNS_RR_LEN(aptr); aptr += RRFIXEDSZ; if (aptr + dlen > abuf + alen) { ares_free_string(name.as_char); return NULL; } /* Display the RR name, class, and type. */ printf("\t%-15s.\t%d", name.as_char, ttl); if (dnsclass != C_IN) printf("\t%s", class_name(dnsclass)); printf("\t%s", type_name(type)); ares_free_string(name.as_char); /* Display the RR data. Don't touch aptr. */ switch (type) { case T_CNAME: case T_MB: case T_MD: case T_MF: case T_MG: case T_MR: case T_NS: case T_PTR: /* For these types, the RR data is just a domain name. */ status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.", name.as_char); ares_free_string(name.as_char); break; case T_HINFO: /* The RR data is two length-counted character strings. */ p = aptr; len = *p; if (p + len + 1 > aptr + dlen) return NULL; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s", name.as_char); ares_free_string(name.as_char); p += len; len = *p; if (p + len + 1 > aptr + dlen) return NULL; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s", name.as_char); ares_free_string(name.as_char); break; case T_MINFO: /* The RR data is two domain names. */ p = aptr; status = ares_expand_name(p, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.", name.as_char); ares_free_string(name.as_char); p += len; status = ares_expand_name(p, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.", name.as_char); ares_free_string(name.as_char); break; case T_MX: /* The RR data is two bytes giving a preference ordering, and * then a domain name. */ if (dlen < 2) return NULL; printf("\t%d", DNS__16BIT(aptr)); status = ares_expand_name(aptr + 2, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.", name.as_char); ares_free_string(name.as_char); break; case T_SOA: /* The RR data is two domain names and then five four-byte * numbers giving the serial number and some timeouts. */ p = aptr; status = ares_expand_name(p, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.\n", name.as_char); ares_free_string(name.as_char); p += len; status = ares_expand_name(p, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t\t\t\t\t\t%s.\n", name.as_char); ares_free_string(name.as_char); p += len; if (p + 20 > aptr + dlen) return NULL; printf("\t\t\t\t\t\t( %lu %lu %lu %lu %lu )", (unsigned long)DNS__32BIT(p), (unsigned long)DNS__32BIT(p+4), (unsigned long)DNS__32BIT(p+8), (unsigned long)DNS__32BIT(p+12), (unsigned long)DNS__32BIT(p+16)); break; case T_TXT: /* The RR data is one or more length-counted character * strings. */ p = aptr; while (p < aptr + dlen) { len = *p; if (p + len + 1 > aptr + dlen) return NULL; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s", name.as_char); ares_free_string(name.as_char); p += len; } break; case T_A: /* The RR data is a four-byte Internet address. */ if (dlen != 4) return NULL; printf("\t%s", ares_inet_ntop(AF_INET,aptr,addr,sizeof(addr))); break; case T_AAAA: /* The RR data is a 16-byte IPv6 address. */ if (dlen != 16) return NULL; printf("\t%s", ares_inet_ntop(AF_INET6,aptr,addr,sizeof(addr))); break; case T_WKS: /* Not implemented yet */ break; case T_SRV: /* The RR data is three two-byte numbers representing the * priority, weight, and port, followed by a domain name. */ printf("\t%d", DNS__16BIT(aptr)); printf(" %d", DNS__16BIT(aptr + 2)); printf(" %d", DNS__16BIT(aptr + 4)); status = ares_expand_name(aptr + 6, abuf, alen, &name.as_char, &len); if (status != ARES_SUCCESS) return NULL; printf("\t%s.", name.as_char); ares_free_string(name.as_char); break; case T_NAPTR: printf("\t%d", DNS__16BIT(aptr)); /* order */ printf(" %d\n", DNS__16BIT(aptr + 2)); /* preference */ p = aptr + 4; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t\t\t\t\t\t%s\n", name.as_char); ares_free_string(name.as_char); p += len; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t\t\t\t\t\t%s\n", name.as_char); ares_free_string(name.as_char); p += len; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t\t\t\t\t\t%s\n", name.as_char); ares_free_string(name.as_char); p += len; status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); if (status != ARES_SUCCESS) return NULL; printf("\t\t\t\t\t\t%s", name.as_char); ares_free_string(name.as_char); break; default: printf("\t[Unknown RR; cannot parse]"); break; } printf("\n"); return aptr + dlen; }
void do_byte() { type_name("jbyte" ); }
void c_add() { switch (sp->type) { #ifndef NO_BUFFER_TYPE case T_BUFFER: { if (!((sp-1)->type == T_BUFFER)) { error("Bad type argument to +. Had %s and %s.\n", type_name((sp - 1)->type), type_name(sp->type)); } else { buffer_t *b; b = allocate_buffer(sp->u.buf->size + (sp - 1)->u.buf->size); memcpy(b->item, (sp - 1)->u.buf->item, (sp - 1)->u.buf->size); memcpy(b->item + (sp - 1)->u.buf->size, sp->u.buf->item, sp->u.buf->size); free_buffer((sp--)->u.buf); free_buffer(sp->u.buf); sp->u.buf = b; } break; } /* end of x + T_BUFFER */ #endif case T_NUMBER: { switch ((--sp)->type) { case T_NUMBER: sp->u.number += (sp+1)->u.number; break; case T_REAL: sp->u.real += (sp+1)->u.number; break; case T_STRING: { char buff[20]; sprintf(buff, "%d", (sp+1)->u.number); EXTEND_SVALUE_STRING(sp, buff, "f_add: 2"); break; } default: error("Bad type argument to +. Had %s and %s.\n", type_name(sp->type), type_name((sp+1)->type)); } break; } /* end of x + NUMBER */ case T_REAL: { switch ((--sp)->type) { case T_NUMBER: sp->type = T_REAL; sp->u.real = sp->u.number + (sp+1)->u.real; break; case T_REAL: sp->u.real += (sp+1)->u.real; break; case T_STRING: { char buff[40]; sprintf(buff, "%f", (sp+1)->u.real); EXTEND_SVALUE_STRING(sp, buff, "f_add: 2"); break; } default: error("Bad type argument to +. Had %s and %s\n", type_name(sp->type), type_name((sp+1)->type)); } break; } /* end of x + T_REAL */ case T_ARRAY: { if (!((sp-1)->type == T_ARRAY)) { error("Bad type argument to +. Had %s and %s\n", type_name((sp - 1)->type), type_name(sp->type)); } else { /* add_array now free's the arrays */ (sp-1)->u.arr = add_array((sp - 1)->u.arr, sp->u.arr); sp--; break; } } /* end of x + T_ARRAY */ case T_MAPPING: { if ((sp-1)->type == T_MAPPING) { mapping_t *map; map = add_mapping((sp - 1)->u.map, sp->u.map); free_mapping((sp--)->u.map); free_mapping(sp->u.map); sp->u.map = map; break; } else error("Bad type argument to +. Had %s and %s\n", type_name((sp - 1)->type), type_name(sp->type)); } /* end of x + T_MAPPING */ case T_STRING: { switch ((sp-1)->type) { case T_NUMBER: { char buff[20]; sprintf(buff, "%d", (sp-1)->u.number); SVALUE_STRING_ADD_LEFT(buff, "f_add: 3"); break; } /* end of T_NUMBER + T_STRING */ case T_REAL: { char buff[40]; sprintf(buff, "%f", (sp - 1)->u.real); SVALUE_STRING_ADD_LEFT(buff, "f_add: 3"); break; } /* end of T_REAL + T_STRING */ case T_STRING: { SVALUE_STRING_JOIN(sp-1, sp, "f_add: 1"); sp--; break; } /* end of T_STRING + T_STRING */ default: error("Bad type argument to +. Had %s and %s\n", type_name((sp - 1)->type), type_name(sp->type)); } break; } /* end of x + T_STRING */ default: error("Bad type argument to +. Had %s and %s.\n", type_name((sp-1)->type), type_name(sp->type)); } }
void do_short() { type_name("jshort" ); }
bool TControl::is_type(char *tname) { return strcmp(type_name(),tname)==0; }
void do_int() { type_name("jint" ); }
/// 1D shape functions. /// Therefore the only possible SFD element types are Lines (1D), Quadrilaterals(2D), Hexahedrals(3D) class SFDM_API ShapeFunction : public mesh::ShapeFunction { public: typedef boost::detail::multi_array::multi_array_view<Real,2> FieldView; private: typedef const boost::detail::multi_array::const_sub_array<Uint,1> RowRef; public: /// Constructor ShapeFunction(const std::string& name = type_name()); /// Type name static std::string type_name() { return "ShapeFunction"; } // Concrete implementation virtual const RealMatrix& local_coordinates() const { return sol_pts(); } // Concrete implementation virtual RealRowVector value(const RealVector& local_coordinate) const; // Concrete implementation virtual RealMatrix gradient(const RealVector& local_coordinate) const; // Concrete implementation virtual Uint nb_nodes() const { return nb_sol_pts(); }
uintptr_t la_pltexit(Elf32_Sym *symp, uint_t symndx, uintptr_t *refcookie, uintptr_t *defcookie, uintptr_t retval) #endif { #if !defined(_LP64) const char *sym_name = (const char *)symp->st_name; #endif sigset_t omask; char buf[256]; GElf_Sym sym; prsyminfo_t si; ctf_file_t *ctfp; ctf_funcinfo_t finfo; char *defname = (char *)(*defcookie); char *refname = (char *)(*refcookie); abilock(&omask); if (pidout) (void) fprintf(ABISTREAM, "%7u:", (unsigned int)getpid()); if (retval == 0) { if (verbose_list == NULL) { (void) fprintf(ABISTREAM, "<- %-8s -> %8s:%s()\n", refname, defname, sym_name); (void) fflush(ABISTREAM); } abiunlock(&omask); return (retval); } if ((ctfp = Pname_to_ctf(proc_hdl, defname)) == NULL) goto fail; if (Pxlookup_by_name(proc_hdl, PR_LMID_EVERY, defname, sym_name, &sym, &si) != 0) goto fail; if (ctf_func_info(ctfp, si.prs_id, &finfo) == CTF_ERR) goto fail; if (verbose_list != NULL) { if (check_intlist(verbose_list, sym_name) != 0) { (void) type_name(ctfp, finfo.ctc_return, buf, sizeof (buf)); (void) fprintf(ABISTREAM, "\treturn = (%s) ", buf); print_value(ctfp, finfo.ctc_return, retval); (void) fprintf(ABISTREAM, "\n"); (void) fprintf(ABISTREAM, "<- %-8s -> %8s:%s()", refname, defname, sym_name); (void) fprintf(ABISTREAM, " = 0x%p\n", (void *)retval); } } else { (void) fprintf(ABISTREAM, "<- %-8s -> %8s:%s()", refname, defname, sym_name); (void) fprintf(ABISTREAM, " = 0x%p\n", (void *)retval); } (void) fflush(ABISTREAM); abiunlock(&omask); return (retval); fail: if (verbose_list != NULL) { if (check_intlist(verbose_list, sym_name) != 0) { (void) fprintf(ABISTREAM, "\treturn = 0x%p\n", (void *)retval); (void) fprintf(ABISTREAM, "<- %-8s -> %8s:%s()", refname, defname, sym_name); (void) fprintf(ABISTREAM, " = 0x%p\n", (void *)retval); } } else { (void) fprintf(ABISTREAM, "<- %-8s -> %8s:%s()", refname, defname, sym_name); (void) fprintf(ABISTREAM, " = 0x%p\n", (void *)retval); } (void) fflush(ABISTREAM); abiunlock(&omask); return (retval); }