void ip_buf_unref(struct net_buf *buf) #endif { if (!buf) { #ifdef DEBUG_IP_BUFS NET_DBG("*** ERROR *** buf %p (%s():%d)\n", buf, caller, line); #else NET_DBG("*** ERROR *** buf %p\n", buf); #endif return; } if (!buf->ref) { #ifdef DEBUG_IP_BUFS NET_DBG("*** ERROR *** buf %p is freed already (%s():%d)\n", buf, caller, line); #else NET_DBG("*** ERROR *** buf %p is freed already\n", buf); #endif return; } #ifdef DEBUG_IP_BUFS NET_DBG("%s [%d] buf %p ref %d (%s():%d)\n", type2str(ip_buf_type(buf)), get_frees(ip_buf_type(buf)), buf, buf->ref - 1, caller, line); #else NET_DBG("%s buf %p ref %d\n", type2str(ip_buf_type(buf)), buf, buf->ref - 1); #endif net_buf_unref(buf); }
//! produce an invalid-type-warning to stdout. used by nearly all getter functions void rlCanOpenTypes::invalidTypeError(int _typenr){ char* curTypeStr; char* usrTypeStr; curTypeStr = type2str(typenumber); usrTypeStr = type2str(_typenr); rlDebugPrintf("Warning! %s invalid type! current data type is: %s \n" , usrTypeStr, curTypeStr); delete curTypeStr; delete usrTypeStr; }
//check that val is of the given type static json_t* expect (json_t* val, json_type expected_type) { if (loadError || val == NULL || (json_typeof(val) != expected_type)) { if (val != NULL) LOGE("val type(%s) != expected_type(%s)", type2str(json_typeof(val)), type2str(expected_type)); else LOGE("val = NULL"); loadError = true; } return val; }
static struct net_buf *ip_buf_get_reserve(enum ip_buf_type type, uint16_t reserve_head) #endif { struct net_buf *buf = NULL; /* Note that we do not reserve any space in front of the * buffer so buf->data points to first byte of the IP header. * This is done like this so that IP stack works the same * way as BT and 802.15.4 stacks. * * The reserve_head variable in the function will tell * the size of the IP + other headers if there are any. * That variable is only used to calculate the pointer * where the application data starts. */ switch (type) { case IP_BUF_RX: buf = net_buf_get(&free_rx_bufs, 0); dec_free_rx_bufs(buf); break; case IP_BUF_TX: buf = net_buf_get(&free_tx_bufs, 0); dec_free_tx_bufs(buf); break; } if (!buf) { #ifdef DEBUG_IP_BUFS NET_ERR("Failed to get free %s buffer (%s():%d)\n", type2str(type), caller, line); #else NET_ERR("Failed to get free %s buffer\n", type2str(type)); #endif return NULL; } ip_buf_type(buf) = type; ip_buf_appdata(buf) = buf->data + reserve_head; ip_buf_appdatalen(buf) = 0; ip_buf_reserve(buf) = reserve_head; net_buf_add(buf, reserve_head); NET_BUF_CHECK_IF_NOT_IN_USE(buf); #ifdef DEBUG_IP_BUFS NET_DBG("%s [%d] buf %p reserve %u ref %d (%s():%d)\n", type2str(type), get_frees(type), buf, reserve_head, buf->ref, caller, line); #else NET_DBG("%s buf %p reserve %u ref %d\n", type2str(type), buf, reserve_head, buf->ref); #endif return buf; }
Common::String *Datum::toString() { Common::String *s = new Common::String; switch (type) { case INT: *s = Common::String::format("%d", u.i); break; case FLOAT: *s = Common::String::format(g_lingo->_floatPrecisionFormat.c_str(), u.f); break; case STRING: delete s; s = u.s; break; case OBJECT: *s = Common::String::format("#%s", u.s->c_str()); break; case VOID: *s = "#void"; break; case VAR: *s = Common::String::format("var: #%s", u.sym->name); break; default: warning("Incorrect operation toString() for type: %s", type2str()); } u.s = s; type = STRING; return u.s; }
/* * variation on vtagget. In this case, the tag_num is returned */ GAnnotations * get_tag_num(GapIO *io, /* in */ int gel, /* in */ int num_t, /* in */ char **type, /* in */ int *tag_num) /* out */ { static GAnnotations a; static int anno; int arg; char str[5]; if (!gel) anno = a.next; else if (-1 == io_read_annotation(io, gel, &anno)) return (GAnnotations *)-1; while (anno) { tag_read(io, anno, a); for (arg = 0; arg < num_t; arg++) { if (idToIndex(type[arg]) == idToIndex(type2str(a.type,str))) { *tag_num = anno; return &a; } } anno = a.next; } return (GAnnotations *)NULL; }
void hidp_dump(int level, struct frame *frm) { uint8_t hdr; char *param; hdr = p_get_u8(frm); switch (hdr & 0xf0) { case 0x00: param = result2str(hdr); break; case 0x10: param = operation2str(hdr); break; case 0x60: case 0x70: param = protocol2str(hdr); break; case 0x40: case 0x50: case 0xa0: case 0xb0: param = report2str(hdr); break; default: param = ""; break; } p_indent(level, frm); printf("HIDP: %s: %s\n", type2str(hdr), param); raw_dump(level, frm); }
void __vpn_ipconfig_newlink(int index, unsigned short type, unsigned int flags, const char *address, unsigned short mtu, struct rtnl_link_stats64 *stats) { struct vpn_ipdevice *ipdevice; GString *str; if (type == ARPHRD_LOOPBACK) return; ipdevice = g_hash_table_lookup(ipdevice_hash, GINT_TO_POINTER(index)); if (ipdevice) goto update; ipdevice = g_try_new0(struct vpn_ipdevice, 1); if (!ipdevice) return; ipdevice->index = index; ipdevice->ifname = connman_inet_ifname(index); ipdevice->type = type; ipdevice->address = g_strdup(address); g_hash_table_insert(ipdevice_hash, GINT_TO_POINTER(index), ipdevice); DBG("%s {create} index %d type %d <%s>", ipdevice->ifname, index, type, type2str(type)); update: ipdevice->mtu = mtu; if (flags == ipdevice->flags) return; ipdevice->flags = flags; str = g_string_new(NULL); if (!str) return; if (flags & IFF_UP) g_string_append(str, "UP"); else g_string_append(str, "DOWN"); if (flags & IFF_RUNNING) g_string_append(str, ",RUNNING"); if (flags & IFF_LOWER_UP) g_string_append(str, ",LOWER_UP"); DBG("%s {update} flags %u <%s>", ipdevice->ifname, flags, str->str); g_string_free(str, TRUE); }
void printFileHeader(libelfxx::ElfImage *image) { const uint8_t *ident = image->ident(); uint8_t endian = ident[EI_DATA]; uint8_t osabi = ident[EI_OSABI]; uint8_t abiVersion = ident[EI_ABIVERSION]; const char *currentStr = ""; if (image->version() == EV_CURRENT) { currentStr = " (current)"; } const char *endianStr = endian2str(endian); const char *typeStr = type2str(image->elfType()); const char *elftypeStr = elftype2str(image->type()); const char *osabiStr = osabi2str(osabi); const char *machineStr = image->machineString(); printf("ELF Header:\n"); printf(" Magic: "); for (int i = 0;i<EI_NIDENT;++i) { printf("%02x ", ident[i]); } printf("\n"); printf(" Class: %s\n", typeStr); printf(" Data: %s\n", endianStr); printf(" Version: %" PRIu8 "%s\n", image->version(), currentStr); printf(" OS/ABI: %s\n", osabiStr); printf(" ABI Version: %" PRIu8 "\n", abiVersion); printf(" Type: %s\n", elftypeStr); printf(" Machine: %s\n", machineStr); printf(" Version: 0x%" PRIx32 "\n", image->version()); printf(" Entry point address: 0x%" PRIx64 "\n", image->entry()); printf(" Start of program headers: %" PRIu64 " (bytes into file)\n", image->phoff()); printf(" Start of section headers: %" PRIu64 " (bytes into file)\n", image->shoff()); printf(" Flags: 0x%" PRIx32 "\n", image->flags()); printf(" Size of this header: %" PRId16 " (bytes)\n", image->ehsize()); printf(" Size of program headers: %" PRId16 " (bytes)\n", image->phentsize()); printf(" Number of program headers: %" PRId16 "\n", image->phnum()); printf(" Size of section headers: %" PRId16 " (bytes)\n", image->shentsize()); printf(" Number of section headers: %" PRId16 "\n", image->shnum()); printf(" Section header string table index: %" PRId16 "\n", image->shstrndx()); }
static void service_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { gchar *name; guint type, state, security; gboolean favorite; gchar *markup, *str; const gchar *format, *val; gtk_tree_model_get(model, iter, CONNMAN_COLUMN_NAME, &name, CONNMAN_COLUMN_TYPE, &type, CONNMAN_COLUMN_STATE, &state, CONNMAN_COLUMN_FAVORITE, &favorite, CONNMAN_COLUMN_SECURITY, &security, -1); if (favorite == TRUE) format = "<b>%s</b>\n" "<span size=\"small\">%s service%s%s <i>(%s)</i></span>"; else format = "%s\n<span size=\"small\">%s service%s%s <i>(%s)</i></span>"; if (name == NULL) { if (type == CONNMAN_TYPE_WIFI) str = g_strdup("<i>hidden</i>"); else str = g_strdup(type2str(type)); } else str = g_markup_printf_escaped("%s", name); if (state == CONNMAN_STATE_UNKNOWN || state == CONNMAN_STATE_IDLE) val = NULL; else val = state2str(state); markup = g_strdup_printf(format, str, type2str(type), val ? " - " : "", val ? val : "", security2str(security)); g_object_set(cell, "markup", markup, NULL); g_free(markup); g_free(str); g_free(name); }
static void report_before(MagickWand *mw, size_t size_in) { const double ks = size_in / 1024.; fprintf(stdout, "Before quality:%lu colors:%lu size:%5.1fkB type:%s format:%s ", quality(mw), (unsigned long)unique_colors(mw), ks, type2str(MagickGetImageType(mw)), MagickGetImageFormat(mw)); }
void DrawCSTags(Tcl_Interp *interp, /* in */ int x1, int x2, int tag_num, GAnnotations *annotation, int offset, char *win_name, int width, int contig_num, int read_num) { char type[100]; char *colour = tag_db[0].bg_colour; char cmd[1024], str[5]; int k; /* counter */ sprintf(type, "{tag %s t_%d num_%d rnum_%d}", type2str(annotation->type,str), tag_num, contig_num, read_num); /* find tag colour in tag_db */ for (k = 0; k < tag_db_count; k++){ if (annotation->type == str2type(tag_db[k].id)) { /* sprintf(type, "{tag %s t_%d num_%d}", tag_db[k].search_id, tag_num, contig_num); */ colour = tag_db[k].bg_colour; break; } /* end if */ } /* end for */ /* check that TagArray type and colour been allocated */ if (type == NULL) { verror(ERR_WARN, "CalcTags", "tag type not in tag database"); return; } /* end if */ sprintf(cmd, "%s create rectangle %d %d %d %d " "-fill %s -tags %s -width %d -outline %s\n", win_name, x1, offset, x2 + 1, offset, colour, type, width, colour); Tcl_Eval(interp, cmd); /* printf("cmd %s \n", cmd); */ }
bool Driver::setOpResult(NodePtr &pVar, NodePtr &pRes) { QVariant &res = pRes->val(); QVariantMap &var = pVar->map(); QVariant::Type opDataType; QString opDataTypeStr; switch (var[NODE_KEY_DATA_TYPE].toString()[0].toAscii()) { case TYPE_VAL_VOID[0]: return appendError("Error: invalid variable type void"); case TYPE_VAL_ANY[0]: opDataType = QVariant::Invalid; break; case TYPE_VAL_BOOLEAN[0]: opDataType = QVariant::Bool; break; case TYPE_VAL_BYTE[0]: opDataType = QVariant::Char; break; case TYPE_VAL_UINT32[0]: opDataType = QVariant::UInt; break; case TYPE_VAL_INT32[0]: opDataType = QVariant::Int; break; case TYPE_VAL_UINT64[0]: opDataType = QVariant::ULongLong; break; case TYPE_VAL_INT64[0]: opDataType = QVariant::LongLong; break; case TYPE_VAL_DOUBLE[0]: opDataType = QVariant::Double; break; case TYPE_VAL_STRING[0]: opDataType = QVariant::String; break; case TYPE_VAL_BYTEARRAY[0]: opDataType = QVariant::BitArray; break; case TYPE_VAL_DATETIME[0]: opDataType = QVariant::DateTime; break; default: return appendError("Error: invalid variable type"); break; } if (!res.convert(opDataType)) { return appendError("Error: the result cannot be converted to " + type2str(opDataType)); } var.insert(NODE_KEY_VALUE, res); return true; }
//--------------------------------------------------------------------------- void cpt::semantics::XMLwriter::processVariableDeclaration(cpt::node::VariableDeclaration * const node, int lvl) { os() << std::string(lvl, ' ') << "<" << node->name() \ << " identifier='" << node->identifier() << "'" \ << " type='" << type2str(node->type()) << "'" \ << " is_public='" << node->is_public() << "'" \ << " is_const='" << node->is_const() << "'" \ << ">" << std::endl; if(node->initial_value() != NULL) { openTag("initial_value", lvl+2); node->initial_value()->accept(this, lvl+4); closeTag("initial_value", lvl+2); } closeTag(node, lvl); }
struct net_buf *ip_buf_ref(struct net_buf *buf) #endif { if (!buf) { #ifdef DEBUG_IP_BUFS NET_DBG("*** ERROR *** buf %p (%s():%d)\n", buf, caller, line); #else NET_DBG("*** ERROR *** buf %p\n", buf); #endif return NULL; } #ifdef DEBUG_IP_BUFS NET_DBG("%s [%d] buf %p ref %d (%s():%d)\n", type2str(ip_buf_type(buf)), get_frees(ip_buf_type(buf)), buf, buf->ref + 1, caller, line); #else NET_DBG("%s buf %p ref %d\n", type2str(ip_buf_type(buf)), buf, buf->ref + 1); #endif return net_buf_ref(buf); }
double Datum::toFloat() { switch (type) { case INT: u.f = (double)u.i; type = FLOAT; break; case FLOAT: // no-op break; default: warning("Incorrect operation toFloat() for type: %s", type2str()); } return u.f; }
int Datum::toInt() { switch (type) { case INT: // no-op break; case FLOAT: u.i = (int)u.f; type = INT; break; default: warning("Incorrect operation toInt() for type: %s", type2str()); } return u.i; }
static void conf_opt(int level, void *ptr, int len, int in, uint16_t cid) { p_indent(level, 0); while (len > 0) { l2cap_conf_opt *h = ptr; ptr += L2CAP_CONF_OPT_SIZE + h->len; len -= L2CAP_CONF_OPT_SIZE + h->len; if (h->type & 0x80) printf("["); switch (h->type & 0x7f) { case L2CAP_CONF_MTU: set_mode(in, cid, 0x00); printf("MTU"); if (h->len > 0) printf(" %d", get_val(h->val, h->len)); break; case L2CAP_CONF_FLUSH_TO: printf("FlushTO"); if (h->len > 0) printf(" %d", get_val(h->val, h->len)); break; case L2CAP_CONF_QOS: printf("QoS"); if (h->len > 0) printf(" 0x%02x (%s)", *(h->val + 1), type2str(*(h->val + 1))); break; case L2CAP_CONF_RFC: conf_rfc(h->val, h->len, in, cid); break; default: printf("Unknown (type %2.2x, len %d)", h->type & 0x7f, h->len); break; } if (h->type & 0x80) printf("] "); else printf(" "); } printf("\n"); }
//--------------------------------------------------------------------------- void cpt::semantics::XMLwriter::processFunctionDeclaration(cpt::node::FunctionDeclaration * const node, int lvl) { os() << std::string(lvl, ' ') << "<" << node->name() \ << " identifier='" << node->identifier() << "'" \ << " type='" << type2str(node->type()) << "'" \ << " is_public='" << node->is_public() << "'"; os() << ">" << std::endl; if(node->arguments() != NULL) { openTag("Arguments", lvl+2); node->arguments()->accept(this, lvl+4); closeTag("Arguments", lvl+2); } if(node->literal() != NULL) { openTag("Literal", lvl+2); node->literal()->accept(this, lvl+4); closeTag("Literal", lvl+2); } closeTag(node, lvl); }
static void conf_efs(void *ptr) { uint8_t id, ser_type; uint16_t max_sdu; uint32_t sdu_itime, access_lat, flush_to; id = get_val(ptr, sizeof(id)); ser_type = get_val(ptr + 1, sizeof(ser_type)); max_sdu = get_val(ptr + 2, sizeof(max_sdu)); sdu_itime = get_val(ptr + 4, sizeof(sdu_itime)); access_lat = get_val(ptr + 8, sizeof(access_lat)); flush_to = get_val(ptr + 12, sizeof(flush_to)); printf("EFS (Id 0x%02x, SerType %s, MaxSDU 0x%04x, SDUitime 0x%08x, " "AccLat 0x%08x, FlushTO 0x%08x)", id, type2str(ser_type), max_sdu, sdu_itime, access_lat, flush_to); }
virtual string getMnemo(Inst inst) const { assert(inst); unsigned opcode = inst.opcode(); const ExtInstDesc* desc = getInstDesc(opcode); if (opcode == BRIG_OPCODE_AMD_GCN_APPEND || opcode == BRIG_OPCODE_AMD_GCN_CONSUME) { return string(desc->name) + "_" + type2str(inst.type()); } else if (desc->parser == parseMnemoBasicNoType) { return string(desc->name); } else { return ""; } }
static size_t dump_qd(const char *buf, size_t len, FILE *out) { char namebuf[1024]; const char *name = (const char *)buf; size_t namel = memcspn(name, len, "\x00", 1); int bytes = 0; const dns_query *q = (dns_query *)(buf + namel + 1); (void)dump_chars_buf(namebuf, sizeof namebuf, buf, namel); #if 0 printf("len=%u name[namel=%u]=%s name[10]=", (unsigned)len, (unsigned)namel, namebuf); dump_chars(name, 10, stdout); fputc('\n', stdout); #endif bytes = fprintf(out, " qd name=%s type=%hu(%s) class=%hu(%s)\n", namebuf, ntohs(q->type), type2str(ntohs(q->type)), ntohs(q->class_), class2str(ntohs(q->class_))); return bytes; }
/* the S4-style class: for dispatch required to be a single string; for the new class() function; if(!singleString) , keeps S3-style multiple classes. Called from the methods package, so exposed. */ SEXP R_data_class(SEXP obj, Rboolean singleString) { SEXP value, klass = getAttrib(obj, R_ClassSymbol); int n = length(klass); if(n == 1 || (n > 0 && !singleString)) return(klass); if(n == 0) { SEXP dim = getAttrib(obj, R_DimSymbol); int nd = length(dim); if(nd > 0) { if(nd == 2) klass = mkChar("matrix"); else klass = mkChar("array"); } else { SEXPTYPE t = TYPEOF(obj); switch(t) { case CLOSXP: case SPECIALSXP: case BUILTINSXP: klass = mkChar("function"); break; case REALSXP: klass = mkChar("numeric"); break; case SYMSXP: klass = mkChar("name"); break; case LANGSXP: klass = lang2str(obj, t); break; default: klass = type2str(t); } } } else klass = asChar(klass); PROTECT(klass); value = ScalarString(klass); UNPROTECT(1); return value; }
/* * Removes all tags of specific types (hashed in h, or all if h == NULL) * from a specified contig. * * Returns 0 on success * -1 on failure */ static int delete_tag_single_contig(GapIO *io, tg_rec crec, HashTable *h, int verbose) { contig_iterator *ci; rangec_t *r; contig_t *c; int ret = -1; ci = contig_iter_new_by_type(io, crec, 1, CITER_FIRST, CITER_CSTART, CITER_CEND, GRANGE_FLAG_ISANNO); if (!ci) return -1; if (!(c = cache_search(io, GT_Contig, crec))) { contig_iter_del(ci); return -1; } cache_incr(io, c); while (NULL != (r = contig_iter_next(io, ci))) { char t[5]; (void)type2str(r->mqual, t); if (!h || HashTableSearch(h, t, 4)) { anno_ele_t *e; if (verbose) vmessage("Removing anno %s #%"PRIrec"\tContig %s\t%d..%d\n", t, r->rec, c->name, r->start, r->end); if (bin_remove_item(io, &c, GT_AnnoEle, r->rec)) goto fail; /* FIXME: Need to reclaim the GT_AnnoEle record itself */ } } ret = 0; fail: contig_iter_del(ci); cache_decr(io, c); return ret; }
Common::String *Datum::toString() { Common::String *s = new Common::String; switch (type) { case INT: s->format("%d", u.i); break; case FLOAT: s->format(g_lingo->_floatPrecisionFormat.c_str(), u.f); break; case STRING: delete s; s = u.s; break; default: warning("Incorrect operation toString() for type: %s", type2str()); } u.s = s; type = STRING; return u.s; }
int send_eth() { // Tasks: // 1. Check 'eth_src_txt' and 'eth_dst_txt' which contain either a MAC address or a keyword // 'eth_dst' can be set without having 'eth_src_txt' specified (the next 6 bytes of the // 'arg_string' will be used). But if 'eth_src_txt' is given then also 'eth_dst_txt' // should have been specified, otherwise a default (ff-ff-ff-ff-ff-ff) will be used. // 2. Check whether 'arg_string' contains a hex-string. If YES then convert it into an // 'eth_payload' and extract eth_type. // 3. Apply 'padding' if specified // 4. Check if frame has at least minimum length (14 Bytes). // 5. Send frame 'count' times and // 6. Apply 'delay' (make precautions for better delay functions) int src, // flag telling whether user has specified a source address dst, // flag telling whether user has specified a destination address src_random=0, dst_random=0, byte_ptr=1, bytestring_s=0, min_size=15, pad=0, repeat, loop, update, i=0, j=0; char err_buf[LIBNET_ERRBUF_SIZE], message[MAX_PAYLOAD_SIZE*3]; u_int8_t bytestring[MAX_PAYLOAD_SIZE]; libnet_ptag_t t; libnet_t *l; if (tx.dot1Q) { fprintf(stderr," Note: raw layer 2 mode does not support 802.1Q builder.\n" " If you want to create VLAN tags then you must do it by hand.\n"); exit(1); } if (tx.mpls) { fprintf(stderr," Note: raw layer 2 mode does not support MPLS builder.\n" " If you want to create MPLS labels then you must do it by hand.\n"); exit(1); } // So other functions can use this function for sending Ethernet frames // These other functions must set dst, src, type and payload! if (tx.eth_params_already_set) goto ALL_SPECIFIED; if ((tx.padding) && (tx.padding<15)) // Note: ignored if padding==0 { tx.padding=15; if (mz_port) { cli_print(gcli, "Note: Set padding to 15 bytes (total length)\n"); } else fprintf(stderr, " mz/send_eth: [Note] adjusted minimum frame size to 15 bytes.\n"); } // Create a temporal, local bytestring: // for (i=0; i<MAX_PAYLOAD_SIZE; i++) bytestring[i]=0x00; bytestring_s = str2hex (tx.arg_string, bytestring, MAX_PAYLOAD_SIZE); // Set the flags to shorten subsequent decisions: src = strlen(tx.eth_src_txt); dst = strlen(tx.eth_dst_txt); // IN ANY CASE if src has been specified: // if (src) { // Evaluate Ethernet CLI options (-a and -b) if (check_eth_mac_txt(ETH_SRC)) // if true then problem! { // use own (already set in init.c) } src_random = tx.eth_src_rand; // local vars are faster } // IN ANY CASE if dst has been specified: // if (dst) { // Evaluate Ethernet CLI options (-a and -b) if (check_eth_mac_txt(ETH_DST)) // if true then problem! { str2hex("ff:ff:ff:ff:ff:ff",tx.eth_dst, 6); // the default } dst_random = tx.eth_dst_rand; // local vars are faster } // Catch errors with too short bytestrings: // if (src) { // bytestring only needs to contain eth_type min_size-=12; } else if (dst) { // bytstring must contain src and type min_size-=6; } if (bytestring_s < min_size) { j = min_size - bytestring_s; // this is what's missing bytestring_s += j; // note that bytestring has been filled up with 0x00, so we can do that } // ADDENDUM: If src specified, dst missing: // if ( (!dst) && (src) ) { str2hex_mac ("ff:ff:ff:ff:ff:ff", tx.eth_dst); } // ADDENDUM: If dst specified, src missing: // if ((dst) && (!src)) { // Get eth_src from bytestring: if (bytestring_s>=6) { (void) getbytes (bytestring, tx.eth_src, byte_ptr, byte_ptr+5); byte_ptr=7; // now points to eth_type within bytestring } } // FINALLY: If both dst and src have NOT been specified: // if ((!dst) && (!src)) { if (bytestring_s>=6) { (void) getbytes (bytestring, tx.eth_dst, byte_ptr, byte_ptr+5); byte_ptr=7; } if (bytestring_s>=12) { (void) getbytes (bytestring, tx.eth_src, byte_ptr, byte_ptr+5); byte_ptr=13; // points to eth_type } } // Set eth_type: // if (bytestring_s>=2) { tx.eth_type = 256 * bytestring[byte_ptr-1] + bytestring[byte_ptr]; // don't forget: byte_ptr counts from 1 not 0 byte_ptr+=2; // points to first payload byte (if available) } // Get remaining payload: // if ( (tx.eth_payload_s = bytestring_s - byte_ptr +1) > 0 ) // if there are any remaining bytes { (void) getbytes (bytestring, tx.eth_payload, byte_ptr, bytestring_s); } // Add padding if desired. // Note: padding means 'extend to given length' (not 'add these number of bytes') if (tx.padding) { pad = tx.padding - (14 + tx.eth_payload_s); // number of additonal pad bytes required for (i=0; i<pad; i++) { // tx.eth_payload[i+tx.eth_payload_s] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_payload[i+tx.eth_payload_s] = 0x00; } tx.eth_payload_s += pad; } ALL_SPECIFIED: // *** All Ethernet parameters have been determined ! // *** Now let's send the frame! l = libnet_init (LIBNET_LINK_ADV, tx.device, err_buf ); if (l == NULL) { fprintf(stderr, " mz/send_eth: libnet_init() failed (%s)", err_buf); return -1; } repeat=1; if (tx.count == 0) { loop = 1000000; if (!quiet) fprintf(stderr, " mz: !!! Infinite mode! Will send frames until you stop Mausezahn!!!\n"); } else loop = tx.count; if ( (!quiet) && (!tx.delay) && (tx.count==0) ) fprintf(stderr, " mz: !!! Will send at maximum frame rate without feedback!!!\n"); t=0; update=1; // this is for the statistics: mz_start = clock(); total_d = tx.count; while (repeat) { if (tx.count!=0) repeat=0; // count=0 means repeat ad inifinitum for (i=0; i<loop; i++) { if (src_random) { tx.eth_src[0] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256) & 0xFE; tx.eth_src[1] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_src[2] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_src[3] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_src[4] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_src[5] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); update=1; } if (dst_random) { tx.eth_dst[0] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_dst[1] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_dst[2] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_dst[3] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_dst[4] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); tx.eth_dst[5] = (u_int8_t) ( ((float) rand()/RAND_MAX)*256); update=1; } if (update) // new frame parameters { t = libnet_build_ethernet (tx.eth_dst, tx.eth_src, tx.eth_type, tx.eth_payload, tx.eth_payload_s, l, t); if (t == -1) { fprintf(stderr, " mz/send_eth: %s", libnet_geterror(l)); return -1; } if (verbose) { bs2str (tx.eth_dst, message, 6); // DA fprintf(stderr, " mz: send %s",message); bs2str (tx.eth_src, message, 6); // SA fprintf(stderr, " %s",message); type2str(tx.eth_type, message); fprintf(stderr, " %s",message); // Type bs2str (tx.eth_payload, message, tx.eth_payload_s); // Payload fprintf(stderr, " %s\n",message); } update=0; if (verbose==2) { fprintf(stderr, "\n"); fprintf(stderr, "*** NOTE: Simulation only! Nothing has been sent! ***\n"); libnet_destroy(l); return 0; } } libnet_write(l); if (tx.delay) { SLEEP (tx.delay); if ( (verbose) && (!src_random) && (!dst_random) ) { fprintf(stderr, "."); } } } // end for } // end while if (verbose) { if ((tx.delay) || (tx.count==0)) { fprintf(stderr,"\n"); } fprintf(stderr, " mz: sent %u frames.\n",loop); } libnet_destroy(l); return 0; }
ostream& boxpp::print (ostream& fout) const { int i, id; double r; prim0 p0; prim1 p1; prim2 p2; prim3 p3; prim4 p4; prim5 p5; Tree t1, t2, t3, ff, label, cur, min, max, step, type, name, file, arg, body, fun, args, abstr, genv, vis, lenv, ldef, slot, ident, rules; const char* str; xtended* xt = (xtended*) getUserData(box); // primitive elements if (xt) fout << xt->name(); else if (isBoxInt(box, &i)) fout << i; else if (isBoxReal(box, &r)) fout << T(r); else if (isBoxCut(box)) fout << '!'; else if (isBoxWire(box)) fout << '_'; else if (isBoxIdent(box, &str)) fout << str; else if (isBoxPrim0(box, &p0)) fout << prim0name(p0); else if (isBoxPrim1(box, &p1)) fout << prim1name(p1); else if (isBoxPrim2(box, &p2)) fout << prim2name(p2); else if (isBoxPrim3(box, &p3)) fout << prim3name(p3); else if (isBoxPrim4(box, &p4)) fout << prim4name(p4); else if (isBoxPrim5(box, &p5)) fout << prim5name(p5); else if (isBoxAbstr(box,arg,body)) fout << "\\" << boxpp(arg) << ".(" << boxpp(body) << ")"; else if (isBoxAppl(box, fun, args)) fout << boxpp(fun) << boxpp(args) ; else if (isBoxWithLocalDef(box, body, ldef)) fout << boxpp(body) << " with { " << envpp(ldef) << " }"; // foreign elements else if (isBoxFFun(box, ff)) { fout << "ffunction(" << type2str(ffrestype(ff)); Tree namelist = nth(ffsignature(ff),1); char sep = ' '; for (int i = 0; i < gFloatSize; i++) { fout << sep << tree2str(nth(namelist,i)); sep = '|'; } sep = '('; for (int i = 0; i < ffarity(ff); i++) { fout << sep << type2str(ffargtype(ff, i)); sep = ','; } fout << ')'; fout << ',' << ffincfile(ff) << ',' << fflibfile(ff) << ')'; } else if (isBoxFConst(box, type, name, file)) fout << "fconstant(" << type2str(tree2int(type)) << ' ' << tree2str(name) << ", " << tree2str(file) << ')'; else if (isBoxFVar(box, type, name, file)) fout << "fvariable(" << type2str(tree2int(type)) << ' ' << tree2str(name) << ", " << tree2str(file) << ')'; // block diagram binary operator else if (isBoxSeq(box, t1, t2)) streambinop(fout, t1, " : ", t2, 1, priority); else if (isBoxSplit(box, t1, t2)) streambinop(fout, t1, "<:", t2, 1, priority); else if (isBoxMerge(box, t1, t2)) streambinop(fout, t1, ":>", t2, 1, priority); else if (isBoxPar(box, t1, t2)) streambinop(fout, t1,",",t2, 2, priority); else if (isBoxRec(box, t1, t2)) streambinop(fout, t1,"~",t2, 4, priority); // iterative block diagram construction else if (isBoxIPar(box, t1, t2, t3)) fout << "par(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}"; else if (isBoxISeq(box, t1, t2, t3)) fout << "seq(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}"; else if (isBoxISum(box, t1, t2, t3)) fout << "sum(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}"; else if (isBoxIProd(box, t1, t2, t3)) fout << "prod(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}"; else if (isBoxInputs(box, t1)) fout << "inputs(" << boxpp(t1) << ")"; else if (isBoxOutputs(box, t1)) fout << "outputs(" << boxpp(t1) << ")"; // user interface else if (isBoxButton(box, label)) fout << "button(" << tree2quotedstr(label) << ')'; else if (isBoxCheckbox(box, label)) fout << "checkbox(" << tree2quotedstr(label) << ')'; else if (isBoxVSlider(box, label, cur, min, max, step)) { fout << "vslider(" << tree2quotedstr(label) << ", " << boxpp(cur) << ", " << boxpp(min) << ", " << boxpp(max) << ", " << boxpp(step)<< ')'; } else if (isBoxHSlider(box, label, cur, min, max, step)) { fout << "hslider(" << tree2quotedstr(label) << ", " << boxpp(cur) << ", " << boxpp(min) << ", " << boxpp(max) << ", " << boxpp(step)<< ')'; } else if (isBoxVGroup(box, label, t1)) { fout << "vgroup(" << tree2quotedstr(label) << ", " << boxpp(t1, 0) << ')'; } else if (isBoxHGroup(box, label, t1)) { fout << "hgroup(" << tree2quotedstr(label) << ", " << boxpp(t1, 0) << ')'; } else if (isBoxTGroup(box, label, t1)) { fout << "tgroup(" << tree2quotedstr(label) << ", " << boxpp(t1, 0) << ')'; } else if (isBoxHBargraph(box, label, min, max)) { fout << "hbargraph(" << tree2quotedstr(label) << ", " << boxpp(min) << ", " << boxpp(max) << ')'; } else if (isBoxVBargraph(box, label, min, max)) { fout << "vbargraph(" << tree2quotedstr(label) << ", " << boxpp(min) << ", " << boxpp(max) << ')'; } else if (isBoxNumEntry(box, label, cur, min, max, step)) { fout << "nentry(" << tree2quotedstr(label) << ", " << boxpp(cur) << ", " << boxpp(min) << ", " << boxpp(max) << ", " << boxpp(step)<< ')'; } else if (isNil(box)) { fout << "()" ; } else if (isList(box)) { Tree l = box; char sep = '('; do { fout << sep << boxpp(hd(l)); sep = ','; l = tl(l); } while (isList(l)); fout << ')'; } else if (isBoxWaveform(box)) { fout << "waveform"; char sep = '{'; for (int i=0; i<box->arity(); i++) { fout << sep << boxpp(box->branch(i)); sep = ','; } fout << '}'; /* size_t n = box->arity(); if (n < 6) { // small waveform, print all data fout << "waveform"; char sep = '{'; for (size_t i=0; i<n; i++) { fout << sep << boxpp(box->branch(i)); sep = ','; } fout << '}'; } else { // large waveform print only first and last values fout << "waveform{" << box->branch(0) << ", ..<" << n-2 << ">..," << box->branch(n-1) << "}"; } */ } else if (isBoxEnvironment(box)) { fout << "environment"; } else if (isClosure(box, abstr, genv, vis, lenv)) { fout << "closure[" << boxpp(abstr) << ", genv = " << envpp(genv) << ", lenv = " << envpp(lenv) << "]"; } else if (isBoxComponent(box, label)) { fout << "component(" << tree2quotedstr(label) << ')'; } else if (isBoxAccess(box, t1, t2)) { fout << boxpp(t1) << '.' << boxpp(t2); } else if (isImportFile(box, label)) { fout << "import(" << tree2quotedstr(label) << ')'; } else if (isBoxSlot(box, &id)) { //fout << "#" << id; fout << "x" << id; } else if (isBoxSymbolic(box, slot, body)) { fout << "\\(" << boxpp(slot) << ").(" << boxpp(body) << ")"; } // Pattern Matching Extensions else if (isBoxCase(box, rules)) { fout << "case {"; while (!isNil(rules)) { printRule(fout, hd(rules)); rules = tl(rules); } fout << "}"; } #if 1 // more useful for debugging output else if (isBoxPatternVar(box, ident)) { fout << "<" << boxpp(ident) << ">"; } #else // beautify messages involving lhs patterns else if (isBoxPatternVar(box, ident)) { fout << boxpp(ident); } #endif else if (isBoxPatternMatcher(box)) { fout << "PM[" << box << "]"; } else if (isBoxError(box)) { fout << "ERROR"; } //else if (isImportFile(box, filename)) { // printf("filename %s\n", tree2str(filename)); // fout << tree2quotedstr(filename); //} // None of the previous tests succeded, then it is not a valid box else { cerr << "Error in box::print() : " << *box << " is not a valid box" << endl; exit(1); } return fout; }
static void filter(AVFilterContext *ctx) { IDETContext *idet = ctx->priv; int y, i; int64_t alpha[2]={0}; int64_t delta=0; Type type, best_type; int match = 0; for (i = 0; i < idet->csp->nb_components; i++) { int w = idet->cur->width; int h = idet->cur->height; int refs = idet->cur->linesize[i]; if (i && i<3) { w = FF_CEIL_RSHIFT(w, idet->csp->log2_chroma_w); h = FF_CEIL_RSHIFT(h, idet->csp->log2_chroma_h); } for (y = 2; y < h - 2; y++) { uint8_t *prev = &idet->prev->data[i][y*refs]; uint8_t *cur = &idet->cur ->data[i][y*refs]; uint8_t *next = &idet->next->data[i][y*refs]; alpha[ y &1] += idet->filter_line(cur-refs, prev, cur+refs, w); alpha[(y^1)&1] += idet->filter_line(cur-refs, next, cur+refs, w); delta += idet->filter_line(cur-refs, cur, cur+refs, w); } } if (alpha[0] > idet->interlace_threshold * alpha[1]){ type = TFF; }else if(alpha[1] > idet->interlace_threshold * alpha[0]){ type = BFF; }else if(alpha[1] > idet->progressive_threshold * delta){ type = PROGRESSIVE; }else{ type = UNDETERMINED; } memmove(idet->history+1, idet->history, HIST_SIZE-1); idet->history[0] = type; best_type = UNDETERMINED; for(i=0; i<HIST_SIZE; i++){ if(idet->history[i] != UNDETERMINED){ if(best_type == UNDETERMINED) best_type = idet->history[i]; if(idet->history[i] == best_type) { match++; }else{ match=0; break; } } } if(idet->last_type == UNDETERMINED){ if(match ) idet->last_type = best_type; }else{ if(match>2) idet->last_type = best_type; } if (idet->last_type == TFF){ idet->cur->top_field_first = 1; idet->cur->interlaced_frame = 1; }else if(idet->last_type == BFF){ idet->cur->top_field_first = 0; idet->cur->interlaced_frame = 1; }else if(idet->last_type == PROGRESSIVE){ idet->cur->interlaced_frame = 0; } idet->prestat [ type] ++; idet->poststat[idet->last_type] ++; av_log(ctx, AV_LOG_DEBUG, "Single frame:%s, Multi frame:%s\n", type2str(type), type2str(idet->last_type)); }
SEXP attribute_hidden do_sprintf(SEXP call, SEXP op, SEXP args, SEXP env) { int i, nargs, cnt, v, thislen, nfmt, nprotect = 0; /* fmt2 is a copy of fmt with '*' expanded. bit will hold numeric formats and %<w>s, so be quite small. */ char fmt[MAXLINE+1], fmt2[MAXLINE+10], *fmtp, bit[MAXLINE+1], *outputString; const char *formatString; size_t n, cur, chunk; SEXP format, _this, a[MAXNARGS], ans /* -Wall */ = R_NilValue; int ns, maxlen, lens[MAXNARGS], nthis, nstar, star_arg = 0; static R_StringBuffer outbuff = {NULL, 0, MAXELTSIZE}; Rboolean has_star, use_UTF8; #define _my_sprintf(_X_) \ { \ int nc = snprintf(bit, MAXLINE+1, fmtp, _X_); \ if (nc > MAXLINE) \ error(_("required resulting string length %d is greater than maximal %d"), \ nc, MAXLINE); \ } nargs = length(args); /* grab the format string */ format = CAR(args); if (!isString(format)) error(_("'fmt' is not a character vector")); nfmt = length(format); if (nfmt == 0) return allocVector(STRSXP, 0); args = CDR(args); nargs--; if(nargs >= MAXNARGS) error(_("only %d arguments are allowed"), MAXNARGS); /* record the args for possible coercion and later re-ordering */ for(i = 0; i < nargs; i++, args = CDR(args)) { SEXPTYPE t_ai; a[i] = CAR(args); if((t_ai = TYPEOF(a[i])) == LANGSXP || t_ai == SYMSXP) /* << maybe add more .. */ error(_("invalid type of argument[%d]: '%s'"), i+1, CHAR(type2str(t_ai))); lens[i] = length(a[i]); if(lens[i] == 0) return allocVector(STRSXP, 0); } #define CHECK_maxlen \ maxlen = nfmt; \ for(i = 0; i < nargs; i++) \ if(maxlen < lens[i]) maxlen = lens[i]; \ if(maxlen % nfmt) \ error(_("arguments cannot be recycled to the same length")); \ for(i = 0; i < nargs; i++) \ if(maxlen % lens[i]) \ error(_("arguments cannot be recycled to the same length")) CHECK_maxlen; outputString = R_AllocStringBuffer(0, &outbuff); /* We do the format analysis a row at a time */ for(ns = 0; ns < maxlen; ns++) { outputString[0] = '\0'; use_UTF8 = getCharCE(STRING_ELT(format, ns % nfmt)) == CE_UTF8; if (!use_UTF8) { for(i = 0; i < nargs; i++) { if (!isString(a[i])) continue; if (getCharCE(STRING_ELT(a[i], ns % lens[i])) == CE_UTF8) { use_UTF8 = TRUE; break; } } } formatString = TRANSLATE_CHAR(format, ns % nfmt); n = strlen(formatString); if (n > MAXLINE) error(_("'fmt' length exceeds maximal format length %d"), MAXLINE); /* process the format string */ for (cur = 0, cnt = 0; cur < n; cur += chunk) { const char *curFormat = formatString + cur, *ss; char *starc; ss = NULL; if (formatString[cur] == '%') { /* handle special format command */ if (cur < n - 1 && formatString[cur + 1] == '%') { /* take care of %% in the format */ chunk = 2; strcpy(bit, "%"); } else { /* recognise selected types from Table B-1 of K&R */ /* NB: we deal with "%%" in branch above. */ /* This is MBCS-OK, as we are in a format spec */ chunk = strcspn(curFormat + 1, "diosfeEgGxXaA") + 2; if (cur + chunk > n) error(_("unrecognised format specification '%s'"), curFormat); strncpy(fmt, curFormat, chunk); fmt[chunk] = '\0'; nthis = -1; /* now look for %n$ or %nn$ form */ if (strlen(fmt) > 3 && fmt[1] >= '1' && fmt[1] <= '9') { v = fmt[1] - '0'; if(fmt[2] == '$') { if(v > nargs) error(_("reference to non-existent argument %d"), v); nthis = v-1; memmove(fmt+1, fmt+3, strlen(fmt)-2); } else if(fmt[2] >= '0' && fmt[2] <= '9' && fmt[3] == '$') { v = 10*v + fmt[2] - '0'; if(v > nargs) error(_("reference to non-existent argument %d"), v); nthis = v-1; memmove(fmt+1, fmt+4, strlen(fmt)-3); } } starc = Rf_strchr(fmt, '*'); if (starc) { /* handle * format if present */ nstar = -1; if (strlen(starc) > 3 && starc[1] >= '1' && starc[1] <= '9') { v = starc[1] - '0'; if(starc[2] == '$') { if(v > nargs) error(_("reference to non-existent argument %d"), v); nstar = v-1; memmove(starc+1, starc+3, strlen(starc)-2); } else if(starc[2] >= '0' && starc[2] <= '9' && starc[3] == '$') { v = 10*v + starc[2] - '0'; if(v > nargs) error(_("reference to non-existent argument %d"), v); nstar = v-1; memmove(starc+1, starc+4, strlen(starc)-3); } } if(nstar < 0) { if (cnt >= nargs) error(_("too few arguments")); nstar = cnt++; } if (Rf_strchr(starc+1, '*')) error(_("at most one asterisk '*' is supported in each conversion specification")); _this = a[nstar]; if(ns == 0 && TYPEOF(_this) == REALSXP) { _this = coerceVector(_this, INTSXP); PROTECT(a[nstar] = _this); nprotect++; } if(TYPEOF(_this) != INTSXP || LENGTH(_this)<1 || INTEGER(_this)[ns % LENGTH(_this)] == NA_INTEGER) error(_("argument for '*' conversion specification must be a number")); star_arg = INTEGER(_this)[ns % LENGTH(_this)]; has_star = TRUE; } else has_star = FALSE; if (fmt[strlen(fmt) - 1] == '%') { /* handle % with formatting options */ if (has_star) snprintf(bit, MAXLINE+1, fmt, star_arg); else strcpy(bit, fmt); /* was sprintf(..) for which some compiler warn */ } else { Rboolean did_this = FALSE; if(nthis < 0) { if (cnt >= nargs) error(_("too few arguments")); nthis = cnt++; } _this = a[nthis]; if (has_star) { size_t nf; char *p, *q = fmt2; for (p = fmt; *p; p++) if (*p == '*') q += sprintf(q, "%d", star_arg); else *q++ = *p; *q = '\0'; nf = strlen(fmt2); if (nf > MAXLINE) error(_("'fmt' length exceeds maximal format length %d"), MAXLINE); fmtp = fmt2; } else fmtp = fmt; #define CHECK_this_length \ PROTECT(_this); \ thislen = length(_this); \ if(thislen == 0) \ error(_("coercion has changed vector length to 0")) /* Now let us see if some minimal coercion would be sensible, but only do so once, for ns = 0: */ if(ns == 0) { SEXP tmp; Rboolean do_check; switch(*findspec(fmtp)) { case 'd': case 'i': case 'o': case 'x': case 'X': if(TYPEOF(_this) == REALSXP) { double r = REAL(_this)[0]; if((double)((int) r) == r) _this = coerceVector(_this, INTSXP); PROTECT(a[nthis] = _this); nprotect++; } break; case 'a': case 'A': case 'e': case 'f': case 'g': case 'E': case 'G': if(TYPEOF(_this) != REALSXP && /* no automatic as.double(<string>) : */ TYPEOF(_this) != STRSXP) { PROTECT(tmp = lang2(install("as.double"), _this)); #define COERCE_THIS_TO_A \ _this = eval(tmp, env); \ UNPROTECT(1); \ PROTECT(a[nthis] = _this); \ nprotect++; \ did_this = TRUE; \ CHECK_this_length; \ do_check = (lens[nthis] == maxlen); \ lens[nthis] = thislen; /* may have changed! */ \ if(do_check && thislen < maxlen) { \ CHECK_maxlen; \ } COERCE_THIS_TO_A } break; case 's': if(TYPEOF(_this) != STRSXP) { /* as.character method might call sprintf() */ size_t nc = strlen(outputString); char *z = Calloc(nc+1, char); strcpy(z, outputString); PROTECT(tmp = lang2(install("as.character"), _this)); COERCE_THIS_TO_A strcpy(outputString, z); Free(z); } break; default: break; } } /* ns == 0 (first-time only) */ if(!did_this) CHECK_this_length; switch(TYPEOF(_this)) { case LGLSXP: { int x = LOGICAL(_this)[ns % thislen]; if (checkfmt(fmtp, "di")) error(_("invalid format '%s'; %s"), fmtp, _("use format %d or %i for logical objects")); if (x == NA_LOGICAL) { fmtp[strlen(fmtp)-1] = 's'; _my_sprintf("NA") } else { _my_sprintf(x) } break; } case INTSXP: { int x = INTEGER(_this)[ns % thislen]; if (checkfmt(fmtp, "dioxX")) error(_("invalid format '%s'; %s"), fmtp, _("use format %d, %i, %o, %x or %X for integer objects")); if (x == NA_INTEGER) { fmtp[strlen(fmtp)-1] = 's'; _my_sprintf("NA") } else { _my_sprintf(x) } break; }
static inline void bccmd_dump(int level, struct frame *frm) { uint16_t type, length, seqno, varid, status; type = CSR_U16(frm); length = CSR_U16(frm); seqno = CSR_U16(frm); varid = CSR_U16(frm); status = CSR_U16(frm); p_indent(level, frm); printf("BCCMD: %s: len %d seqno %d varid 0x%4.4x status %d\n", type2str(type), length, seqno, varid, status); if (!(parser.flags & DUMP_VERBOSE)) { raw_dump(level + 1, frm); return; } switch (varid) { case 0x000b: valueless_dump(level + 1, "PS_CLR_ALL", frm); break; case 0x000c: valueless_dump(level + 1, "PS_FACTORY_SET", frm); break; case 0x082d: uint16_dump(level + 1, "PS_CLR_ALL_STORES", frm); break; case 0x2801: uint16_dump(level + 1, "BC01_STATUS", frm); break; case 0x2819: uint16_dump(level + 1, "BUILDID", frm); break; case 0x281a: uint16_dump(level + 1, "CHIPVER", frm); break; case 0x281b: uint16_dump(level + 1, "CHIPREV", frm); break; case 0x2825: uint16_dump(level + 1, "INTERFACE_VERSION", frm); break; case 0x282a: uint16_dump(level + 1, "RAND", frm); break; case 0x282c: uint16_dump(level + 1, "MAX_CRYPT_KEY_LENGTH", frm); break; case 0x2833: uint16_dump(level + 1, "E2_APP_SIZE", frm); break; case 0x2836: uint16_dump(level + 1, "CHIPANAREV", frm); break; case 0x2838: uint16_dump(level + 1, "BUILDID_LOADER", frm); break; case 0x2c00: uint32_dump(level + 1, "BT_CLOCK", frm); break; case 0x3005: psnext_dump(level + 1, "PS_NEXT", frm); break; case 0x3006: pssize_dump(level + 1, "PS_SIZE", frm); break; case 0x3008: handle_length_dump(level + 1, "CRYPT_KEY_LENGTH", frm); break; case 0x3009: handle_clock_dump(level + 1, "PICONET_INSTANCE", frm); break; case 0x300a: complex_dump(level + 1, "GET_CLR_EVT", frm); break; case 0x300b: complex_dump(level + 1, "GET_NEXT_BUILDDEF", frm); break; case 0x300e: complex_dump(level + 1, "E2_DEVICE", frm); break; case 0x300f: complex_dump(level + 1, "E2_APP_DATA", frm); break; case 0x3012: psmemtype_dump(level + 1, "PS_MEMORY_TYPE", frm); break; case 0x301c: complex_dump(level + 1, "READ_BUILD_NAME", frm); break; case 0x4001: valueless_dump(level + 1, "COLD_RESET", frm); break; case 0x4002: valueless_dump(level + 1, "WARM_RESET", frm); break; case 0x4003: valueless_dump(level + 1, "COLD_HALT", frm); break; case 0x4004: valueless_dump(level + 1, "WARM_HALT", frm); break; case 0x4005: valueless_dump(level + 1, "INIT_BT_STACK", frm); break; case 0x4006: valueless_dump(level + 1, "ACTIVATE_BT_STACK", frm); break; case 0x4007: valueless_dump(level + 1, "ENABLE_TX", frm); break; case 0x4008: valueless_dump(level + 1, "DISABLE_TX", frm); break; case 0x4009: valueless_dump(level + 1, "RECAL", frm); break; case 0x400d: valueless_dump(level + 1, "PS_FACTORY_RESTORE", frm); break; case 0x400e: valueless_dump(level + 1, "PS_FACTORY_RESTORE_ALL", frm); break; case 0x400f: valueless_dump(level + 1, "PS_DEFRAG_RESET", frm); break; case 0x4011: valueless_dump(level + 1, "HOPPING_ON", frm); break; case 0x4012: valueless_dump(level + 1, "CANCEL_PAGE", frm); break; case 0x4818: uint16_dump(level + 1, "PS_CLR", frm); break; case 0x481c: uint16_dump(level + 1, "MAP_SCO_PCM", frm); break; case 0x482e: uint16_dump(level + 1, "SINGLE_CHAN", frm); break; case 0x5004: radiotest_dump(level + 1, "RADIOTEST", frm); break; case 0x500c: psstores_dump(level + 1, "PS_CLR_STORES", frm); break; case 0x6000: valueless_dump(level + 1, "NO_VARIABLE", frm); break; case 0x6802: uint16_dump(level + 1, "CONFIG_UART", frm); break; case 0x6805: uint16_dump(level + 1, "PANIC_ARG", frm); break; case 0x6806: uint16_dump(level + 1, "FAULT_ARG", frm); break; case 0x6827: int8_dump(level + 1, "MAX_TX_POWER", frm); break; case 0x682b: int8_dump(level + 1, "DEFAULT_TX_POWER", frm); break; case 0x7003: pskey_dump(level + 1, frm); break; default: raw_dump(level + 1, frm); break; } }