void __log_pdu(const char *func, int line, int level, struct PDU *pdu) { unsigned char char_buf[BUFFER_SIZE]; int char_cnt = 0; unsigned char *buf; int i; if (log_level < level) return; buf = (void *)&pdu->bhs; __log(func, line, LOG_DEBUG, level, "BHS: (%p)", buf); for (i = 0; i < BHS_SIZE; i++) dump_char(*buf++); dump_line(); buf = (void *)pdu->ahs; __log(func, line, LOG_DEBUG, level, "AHS: (%p)", buf); for (i = 0; i < pdu->ahssize; i++) dump_char(*buf++); dump_line(); buf = (void *)pdu->data; __log(func, line, LOG_DEBUG, level, "Data: (%p)", buf); for (i = 0; i < pdu->datasize; i++) dump_char(*buf++); dump_line(); }
static void dump_formal(g95_symbol *sym) { g95_formal_arglist *f; dump_char('['); for(f=sym->formal; f; f=f->next) if (f->sym == NULL) dumpf("None,"); else dumpf("%S,", f->sym->name); dump_char(']'); }
void dump_NRect(void* page, const NRect* rect) { char cs[64]; int p = sprintf(cs, "%d,%d,%d,%d (%d x %d)", rect->l, rect->t, rect->r, rect->b, rect_getWidth(rect), rect_getHeight(rect)); dump_char(page, cs, p); }
void dump_NCssBox(void* page, const void* box) { NCssBox* cbox = (NCssBox*)box; char cs[64]; int p = sprintf(cs, "[%d,%d,%d,%d]", cbox->l, cbox->t, cbox->r, cbox->b); dump_char(page, cs, p); }
/* This function transforms a header into a char so that it is useable by * db_store. */ static void * mutt_hcache_dump(header_cache_t *h, HEADER * header, int *off, unsigned int uidvalidity, mutt_hcache_store_flags_t flags) { unsigned char *d = NULL; HEADER nh; int convert = !Charset_is_utf8; *off = 0; d = lazy_malloc(sizeof (validate)); if (flags & M_GENERATE_UIDVALIDITY) { struct timeval now; gettimeofday(&now, NULL); memcpy(d, &now, sizeof (struct timeval)); } else memcpy(d, &uidvalidity, sizeof (uidvalidity)); *off += sizeof (validate); d = dump_int(h->crc, d, off); lazy_realloc(&d, *off + sizeof (HEADER)); memcpy(&nh, header, sizeof (HEADER)); /* some fields are not safe to cache */ nh.tagged = 0; nh.changed = 0; nh.threaded = 0; nh.recip_valid = 0; nh.searched = 0; nh.matched = 0; nh.collapsed = 0; nh.limited = 0; nh.num_hidden = 0; nh.recipient = 0; nh.pair = 0; nh.attach_valid = 0; nh.path = NULL; nh.tree = NULL; nh.thread = NULL; #ifdef MIXMASTER nh.chain = NULL; #endif #if defined USE_POP || defined USE_IMAP nh.data = NULL; #endif memcpy(d + *off, &nh, sizeof (HEADER)); *off += sizeof (HEADER); d = dump_envelope(nh.env, d, off, convert); d = dump_body(nh.content, d, off, convert); d = dump_char(nh.maildir_flags, d, off, convert); return d; }
static void dump_cons(char *name, g95_expr *e) { g95_constructor *c; dumpf("%s(%L,[", name, &e->where); for(c=e->value.constructor.c; c; c=c->next) { if (c->iterator == NULL) dump_expr(c->expr); else { dump_char('('); dump_expr(c->iterator->var); dump_char(','); dump_expr(c->iterator->start); dump_char(','); dump_expr(c->iterator->end); dump_char(','); dump_expr(c->iterator->step); dump_char(','); dump_expr(c->expr); dump_char(')'); } if (c->next != NULL) dump_char(','); } dumpf("])"); }
nbool wbxmlDecoder_decode(NWbxmlDecoder* decoder) { nbool result = N_FALSE; WBXMLParser *wbxml_parser = NULL; WBXMLContentHandler parse_handler = { NULL, NULL, wbxml_start_element, wbxml_end_element, wbxml_characters, NULL}; if (decoder->srcPos <= 0) return N_FALSE; wbxml_parser = wbxml_parser_create(); if (wbxml_parser) { WBXMLError ret = WBXML_OK; decoder->dstMax = decoder->srcMax * 2; decoder->dst = (char*)NBK_malloc(decoder->dstMax); decoder->dstPos = 0; #if DEBUG_DECODER dump_char(decoder->page, "decoding...", -1); dump_return(decoder->page); #endif wbxml_parser_set_user_data(wbxml_parser, decoder); wbxml_parser_set_content_handler(wbxml_parser, &parse_handler); ret = wbxml_parser_parse(wbxml_parser, decoder->src, decoder->srcPos); wbxml_parser_destroy(wbxml_parser); #if DEBUG_DECODER dump_char(decoder->page, "decoded!", -1); dump_int(decoder->page, decoder->srcPos); dump_int(decoder->page, decoder->dstPos); dump_return(decoder->page); #endif if (ret == WBXML_OK) result = N_TRUE; } return result; }
static void dump_intrinsic(g95_expr *e) { char *name; int binary; binary = 1; switch(e->value.op.operator) { case INTRINSIC_UPLUS: name = "uplus"; binary = 0; break; case INTRINSIC_NOT: name = "unot"; binary = 0; break; case INTRINSIC_UMINUS: name = "uminus"; binary = 0; break; case INTRINSIC_PLUS: name = "plus"; break; case INTRINSIC_MINUS: name = "minus"; break; case INTRINSIC_TIMES: name = "times"; break; case INTRINSIC_DIVIDE: name = "divide"; break; case INTRINSIC_POWER: name = "power"; break; case INTRINSIC_CONCAT: name = "concat"; break; case INTRINSIC_AND: name = "logical_and"; break; case INTRINSIC_OR: name = "logical_or"; break; case INTRINSIC_EQV: name = "logical_eqv"; break; case INTRINSIC_NEQV: name = "logical_neqv"; break; case INTRINSIC_EQ: name = "cmp_eq"; break; case INTRINSIC_NE: name = "cmp_ne"; break; case INTRINSIC_GT: name = "cmp_gt"; break; case INTRINSIC_GE: name = "cmp_ge"; break; case INTRINSIC_LT: name = "cmp_lt"; break; case INTRINSIC_LE: name = "cmp_le"; break; case INTRINSIC_PAREN: dump_expr(e->value.op.op1); return; default: g95_internal_error("dump_intrinsic(): Bad intrinsic"); } dumpf("%s(%L,", name, &e->where); dump_expr(e->value.op.op1); if (binary) { dump_char(','); dump_expr(e->value.op.op2); } dump_char(')'); }
static unsigned char * dump_parameter(PARAMETER * p, unsigned char *d, int *off, int convert) { unsigned int counter = 0; unsigned int start_off = *off; d = dump_int(0xdeadbeef, d, off); while (p) { d = dump_char(p->attribute, d, off, 0); d = dump_char(p->value, d, off, convert); p = p->next; counter++; } memcpy(d + start_off, &counter, sizeof (int)); return d; }
static void grow_buffer(uint8** buf, int* max, int length, void* page) { int size = BUFFER_GROW * ((length * 2 / BUFFER_GROW) + 1); *max += size; *buf = (uint8*)NBK_realloc(*buf, *max); #if DEBUG_DECODER dump_char(page, "grow buffer", -1); dump_int(page, *max); dump_return(page); #endif }
static unsigned char * dump_envelope(ENVELOPE * e, unsigned char *d, int *off, int convert) { d = dump_address(e->return_path, d, off, convert); d = dump_address(e->from, d, off, convert); d = dump_address(e->to, d, off, convert); d = dump_address(e->cc, d, off, convert); d = dump_address(e->bcc, d, off, convert); d = dump_address(e->sender, d, off, convert); d = dump_address(e->reply_to, d, off, convert); d = dump_address(e->mail_followup_to, d, off, convert); d = dump_char(e->list_post, d, off, convert); d = dump_char(e->subject, d, off, convert); if (e->real_subj) d = dump_int(e->real_subj - e->subject, d, off); else d = dump_int(-1, d, off); d = dump_char(e->message_id, d, off, 0); d = dump_char(e->supersedes, d, off, 0); d = dump_char(e->date, d, off, 0); d = dump_char(e->x_label, d, off, convert); d = dump_buffer(e->spam, d, off, convert); d = dump_list(e->references, d, off, 0); d = dump_list(e->in_reply_to, d, off, 0); d = dump_list(e->userhdrs, d, off, convert); return d; }
static unsigned char * dump_body(BODY * c, unsigned char *d, int *off, int convert) { BODY nb; memcpy (&nb, c, sizeof (BODY)); /* some fields are not safe to cache */ nb.content = NULL; nb.charset = NULL; nb.next = NULL; nb.parts = NULL; nb.hdr = NULL; nb.aptr = NULL; lazy_realloc(&d, *off + sizeof (BODY)); memcpy(d + *off, &nb, sizeof (BODY)); *off += sizeof (BODY); d = dump_char(nb.xtype, d, off, 0); d = dump_char(nb.subtype, d, off, 0); d = dump_parameter(nb.parameter, d, off, convert); d = dump_char(nb.description, d, off, convert); d = dump_char(nb.form_name, d, off, convert); d = dump_char(nb.filename, d, off, convert); d = dump_char(nb.d_filename, d, off, convert); return d; }
static char *dump_string(char *s) { static char buf[101]; int i; int n = strlen(s); if (n > 100) n = 100; for (i = 0; i < n; i++) buf[i] = dump_char(s[i]); buf[i] = 0; return buf; }
static void dump_actual(g95_actual_arglist *actual) { dump_char('['); while(actual != NULL) { if (actual->type == ARG_ALT_RETURN) dumpf("%d", actual->u.label->value); else if (actual->u.expr == NULL) dumpf("None"); else dump_expr(actual->u.expr); actual = actual->next; if (actual != NULL) dump_char(','); } dump_char(']'); }
void wbxmlDecoder_addSourceData(NWbxmlDecoder* decoder, uint8* data, int length) { #if DEBUG_DECODER dump_char(decoder->page, "add data", -1); dump_int(decoder->page, length); dump_return(decoder->page); #endif if (decoder->srcMax - decoder->srcPos < length) grow_buffer(&decoder->src, &decoder->srcMax, length, decoder->page); NBK_memcpy(&decoder->src[decoder->srcPos], data, length); decoder->srcPos += length; }
static unsigned char * dump_address(ADDRESS * a, unsigned char *d, int *off, int convert) { unsigned int counter = 0; unsigned int start_off = *off; d = dump_int(0xdeadbeef, d, off); while (a) { #ifdef EXACT_ADDRESS d = dump_char(a->val, d, off, convert); #endif d = dump_char(a->personal, d, off, convert); d = dump_char(a->mailbox, d, off, 0); d = dump_int(a->group, d, off); a = a->next; counter++; } memcpy(d + start_off, &counter, sizeof (int)); return d; }
void wbxmlDecoder_setSourceLength(NWbxmlDecoder* decoder, int length) { int size = 0; if (length > 0) size = BUFFER_GROW * ((length / BUFFER_GROW) + 1); else size = BUFFER_GROW; decoder->src = (uint8*)NBK_malloc(size); decoder->dstMax = size; #if DEBUG_DECODER dump_char(decoder->page, "init alloc", -1); dump_int(decoder->page, length); dump_int(decoder->page, decoder->srcMax); dump_return(decoder->page); #endif }
static unsigned char * dump_list(LIST * l, unsigned char *d, int *off, int convert) { unsigned int counter = 0; unsigned int start_off = *off; d = dump_int(0xdeadbeef, d, off); while (l) { d = dump_char(l->data, d, off, convert); l = l->next; counter++; } memcpy(d + start_off, &counter, sizeof (int)); return d; }
void dump_NCssValue(void* page, const void* cssVal) { NCssValue* cv = (NCssValue*)cssVal; char buf[32]; int len; switch (cv->type) { case NECVT_INT: len = sprintf(buf, "%d", cv->d.i32); break; case NECVT_PERCENT: len = sprintf(buf, "%d%%", cv->d.perc); break; case NECVT_EM: len = sprintf(buf, "%fem", cv->d.flo); break; default: nbk_strcpy(buf, "-"); len = nbk_strlen(buf); break; } dump_char(page, buf, len); }
// Dump a portion of memory to file static void memDump(uint8 *vaddr, uint32 size, uint32 base = (uint32)-1) { uint32 offs = 0; char chrdump[17]; chrdump[16] = 0; if (base == (uint32)-1) base = (uint32)vaddr; while (offs < size) { if ((offs & 15) == 0) { if (offs) Output(" | %s", chrdump); Output("%08x |\t", base + offs); } uint32 d = memRead(vaddr + offs, MO_SIZE32); Output(" %08x\t", d); chrdump[(offs & 15) + 0] = dump_char((d ) & 0xff); chrdump[(offs & 15) + 1] = dump_char((d >> 8) & 0xff); chrdump[(offs & 15) + 2] = dump_char((d >> 16) & 0xff); chrdump[(offs & 15) + 3] = dump_char((d >> 24) & 0xff); offs += 4; } while (offs & 15) { Output(" \t"); chrdump[offs & 15] = 0; offs += 4; } Output(" | %s", chrdump); }
void dump_NColor(void* page, const NColor* color) { char cs[32]; int p = sprintf(cs, "%02x%02x%02x(%02x)", color->r, color->g, color->b, color->a); dump_char(page, cs, p); }
void dump_NRectSides(void* page, const NRect* rect) { char cs[64]; int p = sprintf(cs, "%d,%d,%d,%d", rect->l, rect->t, rect->r, rect->b); dump_char(page, cs, p); }
static void dumpf(char *format, ...) { char *p, c, buffer[100]; g95_locus *where; va_list ap; long ptr; int m; va_start(ap, format); for(;;) { c = *format++; if (c == '\0') break; if (c != '%') { dump_char(c); continue; } switch(*format++) { case 'd': sprintf(buffer, "%d", va_arg(ap, int)); p = buffer; while(*p != '\0') dump_char(*p++); break; case 's': p = va_arg(ap, char *); while(*p != '\0') dump_char(*p++); break; case 'p': ptr = va_arg(ap, long); dump_char('"'); dump_char(':'); do { dump_char('A' + (ptr & 0x0F)); ptr >>= 4; } while(ptr != 0); dump_char('"'); break; case 'S': dump_char('\''); p = va_arg(ap, char *); if (p != NULL) while(*p) { c = *p++; switch(c) { case '\'': case '\\': dump_char('\\'); /* Fall through */ default: dump_char(c); break; } } dump_char('\''); break; case 'L': where = va_arg(ap, g95_locus *); if (where == NULL) p = "None"; else { sprintf(buffer, "loc(%d,%d)", where->lb->linenum, where->column); p = buffer; } while(*p != '\0') dump_char(*p++); break; case 'C': /* Statement lists. Zero is the null list. */ m = va_arg(ap, int); if (m == 0) { dump_char('['); dump_char(']'); } else { sprintf(buffer, "st%d", m); p = buffer; while(*p != '\0') dump_char(*p++); } break; case '%': dump_char('%'); break; default: g95_internal_error("dumpf(): Bad %-code"); break; } } va_end(ap); }
static void dump_variable(g95_expr *e) { g95_ref *ref; int i; dumpf("var(%L,%p,[", &e->where, e->symbol); for(ref=e->ref; ref; ref=ref->next) { switch(ref->type) { case REF_ARRAY: switch(ref->u.ar.type) { case AR_FULL: dumpf("ar_full()"); break; case AR_ELEMENT: dumpf("ar_element(["); for(i=0; i<ref->u.ar.dimen; i++) { dump_expr(ref->u.ar.start[i]); if (i < ref->u.ar.dimen-1) dump_char(','); } dumpf("])"); break; case AR_SECTION: dumpf("ar_section(["); for(i=0; i<ref->u.ar.dimen; i++) { switch(ref->u.ar.dimen_type[i]) { case DIMEN_ELEMENT: case DIMEN_VECTOR: dump_expr(ref->u.ar.start[i]); break; case DIMEN_RANGE: dump_char('('); dump_expr(ref->u.ar.start[i]); dump_char(','); dump_expr(ref->u.ar.end[i]); dump_char(','); dump_expr(ref->u.ar.stride[i]); dump_char(')'); break; default: g95_internal_error("dump_variable(): Bad dimen"); } if (i < ref->u.ar.dimen-1) dump_char(','); } dumpf("])"); break; default: g95_internal_error("dump_variable(): Bad array ref"); } break; case REF_COARRAY: dumpf("coarray(["); for(i=0; i<ref->u.car.dimen; i++) { dump_expr(ref->u.car.element[i]); dump_char(','); } dumpf("])"); break; case REF_COMPONENT: dumpf("component(%S)", ref->u.c.name); break; case REF_SUBSTRING: dumpf("substring("); dump_expr(ref->u.ss.start); dump_char(','); dump_expr(ref->u.ss.end); dump_char(')'); break; default: g95_internal_error("dump_variable(): Bad ref"); } if (ref->next != NULL) dump_char(','); } dump_char(']'); dump_char(')'); }
static void dump_expr(g95_expr *e) { if (e == NULL) { dumpf("None"); return; } switch(e->type) { case EXPR_NULL: dumpf("null(%L,%S,%d)", &e->where, g95_typename(&e->ts), e->rank); break; case EXPR_OP: dump_intrinsic(e); break; case EXPR_CONSTANT: dump_constant(e); break; case EXPR_VARIABLE: dump_variable(e); break; case EXPR_FUNCTION: if (e->value.function.isym != NULL && e->value.function.isym->id == G95_ISYM_CONVERSION) dump_expr(e->value.function.actual->u.expr); else { dumpf("fcall(%L,", &e->where); dump_name(e->symbol, e->value.function.isym); dumpf(",%S,%d,", g95_typename(&e->ts), e->rank); dump_actual(e->value.function.actual); dump_char(')'); } break; case EXPR_PROCEDURE: dumpf("procedure(%L,", &e->where); dump_name(e->symbol, NULL); dump_char(')'); break; case EXPR_STRUCTURE: dump_cons("scons", e); break; case EXPR_ARRAY: dump_cons("acons", e); break; case EXPR_SUBSTRING: dumpf("substring_exp(%L,", &e->where); dump_constant(e); dump_char(','); dump_expr(e->ref->u.ss.start); dump_char(','); dump_expr(e->ref->u.ss.end); dump_char(')'); break; default: g95_internal_error("dump_expr(): Bad expression"); } }
static int dump_code(g95_code *c) { int m, n, list_size, *list, node[2]; g95_forall_iterator *f; g95_filepos *filepos; g95_inquire *inquire; g95_close *close; g95_flush *flush; g95_alloc *alloc; g95_open *open; g95_wait *wait; g95_case *sel; g95_code *d; g95_dt *dt; if (c == NULL) return 0; n = st_n++; list = NULL; list_size = 0; dumpf("%C = []\n", n); for(; c; c=c->next) { switch(c->type) { case EXEC_CONTINUE: case EXEC_NOP: case EXEC_DT_END: dumpf("%C.append(st_nop(%L", n, &c->where); break; case EXEC_ASSIGN: dumpf("%C.append(st_assign(%L,", n, &c->where); dump_expr(c->expr); dump_char(','); dump_expr(c->expr2); break; case EXEC_POINTER_ASSIGN: dumpf("%C.append(st_ptr_assign(%L,", n, &c->where); dump_expr(c->expr); dump_char(','); dump_expr(c->expr2); break; case EXEC_GOTO: dumpf("%C.append(st_goto(%L, %d", n, &c->where, c->label->value); break; case EXEC_PAUSE: dumpf("%C.append(st_pause(%L", n, &c->where); break; case EXEC_STOP: dumpf("%C.append(st_stop(%L", n, &c->where); break; case EXEC_RETURN: dumpf("%C.append(st_return(%L", n, &c->where); if (c->expr != NULL) { dumpf(",rc="); dump_expr(c->expr); } break; case EXEC_IF: node[0] = dump_code(c->block); node[1] = dump_code(c->ext.block); list = node; list_size = 2; dumpf("%C.append(st_if(%L,", n, &c->where); dump_expr(c->expr); dumpf(",%C,%C", node[0], node[1]); break; case EXEC_DO_WHILE: node[0] = dump_code(c->block); list = node; list_size = 1; dumpf("%C.append(st_do_while(%L,", n, &c->where, node[0]); dump_expr(c->expr); dumpf(",%C", node[0]); if (c->sym != NULL) dumpf(",label='%s'", c->sym->name); break; case EXEC_DO: node[0] = dump_code(c->block); list = node; list_size = 1; dumpf("%C.append(st_do(%L, ", n, &c->where); dump_expr(c->ext.iterator->var); dump_char(','); dump_expr(c->ext.iterator->start); dump_char(','); dump_expr(c->ext.iterator->end); dump_char(','); dump_expr(c->ext.iterator->step); dumpf(",%C", node[0]); if (c->sym != NULL) dumpf(",label='%s'", c->sym->name); break; case EXEC_OPEN: open = c->ext.open; dumpf("%C.append(st_open(%L", n, &c->where); if (open->unit != NULL) { dumpf(",unit="); dump_expr(open->unit); } if (open->file != NULL) { dumpf(",file="); dump_expr(open->file); } if (open->status != NULL) { dumpf(",status="); dump_expr(open->status); } if (open->access != NULL) { dumpf(",access="); dump_expr(open->access); } if (open->form != NULL) { dumpf(",form="); dump_expr(open->form); } if (open->recl != NULL) { dumpf(",recl="); dump_expr(open->recl); } if (open->decimal != NULL) { dumpf(",decimal="); dump_expr(open->decimal); } if (open->blank != NULL) { dumpf(",blank="); dump_expr(open->position); } if (open->position != NULL) { dumpf(",position="); dump_expr(open->position); } if (open->action != NULL) { dumpf(",action="); dump_expr(open->action); } if (open->delim != NULL) { dumpf(",delim="); dump_expr(open->delim); } if (open->pad != NULL) { dumpf(",pad="); dump_expr(open->pad); } if (open->iostat != NULL) { dumpf(",iostat="); dump_expr(open->iostat); } if (open->err != NULL) dumpf(",err=%d", open->err->value); break; case EXEC_CLOSE: close = c->ext.close; dumpf("%C.append(st_close(%L", n, &c->where); if (close->unit != NULL) { dumpf(",unit="); dump_expr(close->unit); } if (close->status != NULL) { dumpf(",status="); dump_expr(close->status); } if (close->iostat != NULL) { dumpf(",iostat="); dump_expr(close->iostat); } if (close->err != NULL) dumpf(",err=%d", close->err->value); break; case EXEC_BACKSPACE: dumpf("%C.append(st_backspace(%L", n, &c->where); goto show_filepos; case EXEC_ENDFILE: dumpf("%C.append(st_endfile(%L", n, &c->where); goto show_filepos; case EXEC_REWIND: dumpf("%C.append(st_rewind(%L", n, &c->where); show_filepos: filepos = c->ext.filepos; if (filepos->unit != NULL) { dumpf(",unit="); dump_expr(filepos->unit); } if (filepos->iostat != NULL) { dumpf(",iostat="); dump_expr(filepos->iostat); } if (filepos->err != NULL) dumpf(",err=%d", filepos->err->value); break; case EXEC_INQUIRE: dumpf("%C.append(st_inquire(%L", n, &c->where); inquire = c->ext.inquire; if (inquire->unit != NULL) { dumpf(",unit="); dump_expr(inquire->unit); } if (inquire->file != NULL) { dumpf(",file="); dump_expr(inquire->file); } if (inquire->iostat != NULL) { dumpf(",iostat="); dump_expr(inquire->iostat); } if (inquire->exist != NULL) { dumpf(",exist="); dump_expr(inquire->exist); } if (inquire->opened != NULL) { dumpf(",opened="); dump_expr(inquire->opened); } if (inquire->number != NULL) { dumpf(",number="); dump_expr(inquire->number); } if (inquire->named != NULL) { dumpf(",named="); dump_expr(inquire->named); } if (inquire->name != NULL) { dumpf(",name="); dump_expr(inquire->name); } if (inquire->access != NULL) { dumpf(",access="); dump_expr(inquire->access); } if (inquire->sequential != NULL) { dumpf(",sequential="); dump_expr(inquire->sequential); } if (inquire->direct != NULL) { dumpf(",direct="); dump_expr(inquire->direct); } if (inquire->form != NULL) { dumpf(",form="); dump_expr(inquire->form); } if (inquire->formatted != NULL) { dumpf(",formatted="); dump_expr(inquire->formatted); } if (inquire->unformatted != NULL) { dumpf(",unformatted="); dump_expr(inquire->unformatted); } if (inquire->recl != NULL) { dumpf(",recl="); dump_expr(inquire->recl); } if (inquire->nextrec != NULL) { dumpf(",nextrec="); dump_expr(inquire->nextrec); } if (inquire->blank != NULL) { dumpf(",blank="); dump_expr(inquire->blank); } if (inquire->position != NULL) { dumpf(",position="); dump_expr(inquire->position); } if (inquire->action != NULL) { dumpf(",action="); dump_expr(inquire->action); } if (inquire->read != NULL) { dumpf(",read="); dump_expr(inquire->read); } if (inquire->write != NULL) { dumpf(",write="); dump_expr(inquire->write); } if (inquire->readwrite != NULL) { dumpf(",readwrite="); dump_expr(inquire->readwrite); } if (inquire->delim != NULL) { dumpf(",delim="); dump_expr(inquire->delim); } if (inquire->pad != NULL) { dumpf(",pad="); dump_expr(inquire->pad); } if (inquire->pos != NULL) { dumpf(",pos="); dump_expr(inquire->pos); } if (inquire->iolength != NULL) { dumpf(",iolength="); dump_expr(inquire->iolength); } if (inquire->size != NULL) { dumpf(",size="); dump_expr(inquire->size); } if (inquire->err != NULL) dumpf(",err=%d", inquire->err->value); break; case EXEC_FLUSH: dumpf("%C.append(st_flush(%L", n, &c->where); flush = c->ext.flush; if (flush->unit != NULL) { dumpf(",unit="); dump_expr(flush->unit); } if (flush->iostat != NULL) { dumpf(",iostat="); dump_expr(flush->iostat); } if (flush->iomsg != NULL) { dumpf(",iomsg="); dump_expr(flush->iomsg); } if (flush->err != NULL) dumpf(",err=%d", flush->err->value); break; case EXEC_WAIT: dumpf("%C.append(st_wait(%L", n, &c->where); wait = c->ext.wait; if (wait->unit != NULL) { dumpf(",unit="); dump_expr(wait->unit); } if (wait->id != NULL) { dumpf(",id="); dump_expr(wait->id); } if (wait->iostat != NULL) { dumpf(",iostat="); dump_expr(wait->iostat); } if (wait->iomsg != NULL) { dumpf(",iomsg="); dump_expr(wait->iomsg); } if (wait->err != NULL) dumpf(",err=%d", wait->err->value); if (wait->end != NULL) dumpf(",end=%d", wait->end->value); if (wait->eor != NULL) dumpf(",eof=%d", wait->eor->value); break; case EXEC_IOLENGTH: dumpf("%C.append(st_iolength(%L,", n, &c->where); dump_expr(c->expr); break; case EXEC_WRITE: dumpf("%C.append(st_write(%L", n, &c->where); goto show_dt; case EXEC_READ: dumpf("%C.append(st_read(%L", n, &c->where); show_dt: dt = c->ext.dt; if (dt->io_unit->ts.type == BT_INTEGER) dumpf(",unit="); else dumpf(",internal_unit="); dump_expr(dt->io_unit); if (dt->format_expr != NULL) { dumpf(",format_expr="); dump_expr(dt->format_expr); } if (dt->rec != NULL) { dumpf(",rec="); dump_expr(dt->rec); } if (dt->advance != NULL) { dumpf(",advance="); dump_expr(dt->advance); } if (dt->iostat != NULL) { dumpf(",iostat="); dump_expr(dt->iostat); } if (dt->size != NULL) { dumpf(",size="); dump_expr(dt->size); } if (dt->pos != NULL) { dumpf(",pos="); dump_expr(dt->pos); } if (dt->decimal != NULL) { dumpf(",decimal="); dump_expr(dt->decimal); } if (dt->namelist != NULL) dumpf(",namelist=(%S,%L)", dt->namelist->name, &dt->namelist_where); if (dt->format_label != NULL) dumpf(",format_label=%d", dt->format_label->value); if (dt->err != NULL) dumpf(",err=%d", dt->err->value); if (dt->end != NULL) dumpf(",end=%d", dt->end->value); if (dt->eor != NULL) dumpf(",eof=%d", dt->eor->value); break; case EXEC_TRANSFER: dumpf("%C.append(st_transfer(%L,%d,", n, &c->expr->where, c->ext.transfer == M_READ); dump_expr(c->expr); break; case EXEC_ALLOCATE: dumpf("%C.append(st_allocate(%L,", n, &c->where); goto show_alloc; case EXEC_DEALLOCATE: dumpf("%C.append(st_deallocate(%L,", n, &c->where); show_alloc: dumpf("["); alloc = c->ext.alloc_list; while(alloc != NULL) { dump_expr(alloc->expr); if (alloc->next != NULL) dump_char(','); alloc = alloc->next; } dumpf("]"); if (c->expr != NULL) { dumpf(",stat="); dump_expr(c->expr); } break; case EXEC_ARITHMETIC_IF: dumpf("%C.append(st_arith_if(%L,", n, &c->where); dump_expr(c->expr); dumpf(", %d, %d, %d", c->label->value, c->label2->value, c->label3->value); break; case EXEC_LABEL_ASSIGN: dumpf("%C.append(st_label_assign(%L,", n, &c->where); dump_expr(c->expr); dumpf(", %d", c->label->value); break; case EXEC_SELECT: for(d=c->block; d; d=d->block) list_size++; list = g95_getmem(list_size * sizeof(int)); m = 0; for(d=c->block; d; d=d->block) list[m++] = dump_code(d->next); dumpf("%C.append(st_select(%L, ", n, &c->where); dump_expr(c->expr); dumpf(",["); m = 0; for(d=c->block; d; d=d->next) { dumpf("["); for(sel=d->ext.case_list; sel; sel=sel->next) { dump_char('('); if (sel->low == NULL) dumpf("None"); else dump_expr(sel->low); dumpf(","); if (sel->high == NULL) dumpf("None"); else dump_expr(sel->high); } dumpf("],%C,", list[m++]); } dump_char(']'); break; case EXEC_CYCLE: dumpf("%C.append(st_cycle(%L", n, &c->where); if (c->sym != NULL) dumpf(",label=%p", c->sym); break; case EXEC_EXIT: dumpf("%C.append(st_exit(%L", n, &c->where); if (c->sym != NULL) dumpf(",label=%p", c->sym); break; case EXEC_ENTRY: dumpf("%C.append(st_entry(%L,'%s',", n, &c->where, c->sym->name); dump_formal(c->sym); break; case EXEC_WHERE: for(d=c->block; d; d=d->block) list_size++; list = g95_getmem(list_size * sizeof(int)); m = 0; for(d=c->block; d; d=d->block) list[m++] = dump_code(d->next); dumpf("%C.append(st_where(%L, [", n, &c->where); m = 0; for(d=c->block; d; d=d->block) { dump_char('('); if (d->expr == NULL) dumpf("None"); else dump_expr(d->expr); dumpf(",%C),", list[m++]); } dump_char(']'); break; case EXEC_FORALL: node[0] = dump_code(c->block); list = node; list_size = 1; dumpf("%C.append(st_forall(%L, [", n, &c->where); for(f=c->ext.forall_iterator; f; f=f->next) { dump_char('('); dump_expr(f->var); dump_char(','); dump_expr(f->start); dump_char(','); dump_expr(f->end); dump_char(','); dump_expr(f->stride); dump_char(')'); if (f->next != NULL) dump_char(','); } dumpf("], %C", node[0]); if (c->expr != NULL) { dumpf(", mask="); dump_expr(c->expr); } break; case EXEC_CALL: dumpf("%C.append(st_call(%L,", n, &c->where); dump_name(c->sym, c->ext.sub.isym); dump_char(','); dump_actual(c->ext.sub.actual); break; default: g95_internal_error("dump_code(): Bad code"); break; } if (c->here != NULL) dumpf(",here=%d", c->here->value); dumpf("))\n"); for(m=0; m<list_size; m++) if (list[m] != 0) dumpf("del %C\n", list[m]); list_size = 0; if (list != NULL && list != node) g95_free(list); } return n; }